<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Parrot - Boolean PMC</title> <link rel="stylesheet" type="text/css" href="../../../resources/parrot.css" media="all"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div id="wrapper"> <div id="header"> <a href="http://www.parrot.org"> <img border=0 src="../../../resources/parrot_logo.png" id="logo" alt="parrot"> </a> </div> <!-- "header" --> <div id="divider"></div> <div id="mainbody"> <div id="breadcrumb"> <a href="../../../html/index.html">Home</a> » <a href="../../../html/pmc.html">PMCs</a> » Boolean PMC </div> <h1><a name="NAME" >NAME</a></h1> <p>src/pmc/boolean.pmc - Boolean PMC</p> <h1><a name="DESCRIPTION" >DESCRIPTION</a></h1> <p>This PMC implements a Boolean type with a single true/false value. A <code>Boolean</code> does not morph to other types when its value is set; it simply changes its value.</p> <p>This implementation of <code>Boolean</code> inherits from the <code>Scalar</code> PMC. Unlike the previous implementation, it does <i>not</i> inherit from <code>Integer</code>.</p> <h2><a name="Functions" >Functions</a></h2> <dl> <dt><a name="void_init()" ><b><code>void init()</b></code></a></dt> Create a new <code>Boolean</code> with initial value <code>FALSE</code>. <dt><a name="void_init_pmc(PMC_*value)" ><b><code>void init_pmc(PMC *value)</b></code></a></dt> Create a new <code>Boolean</code> with the given initial value interpreted as a Boolean. <dt><a name="void_init_int(INTVAL_value)" ><b><code>void init_int(INTVAL value)</b></code></a></dt> Create a new <code>Boolean</code> with the given initial value interpreted as a Boolean. <dt><a name="INTVAL_get_bool()" ><b><code>INTVAL get_bool()</b></code></a></dt> Obtain the value of the <code>Boolean</code> as an integer: 1 = <code>TRUE</code>, 0 = <code>FALSE</code>. <dt><a name="INTVAL_get_integer()" ><b><code>INTVAL get_integer()</b></code></a></dt> Same as <code>get_bool()</code>. <dt><a name="FLOATVAL_get_number()" ><b><code>FLOATVAL get_number()</b></code></a></dt> Obtain the value of the <code>Boolean</code> as a float: 1.0 = <code>TRUE</code>, 0.0 = <code>FALSE</code>. <dt><a name="STRING_*get_string()" ><b><code>STRING *get_string()</b></code></a></dt> Obtain the value of the <code>Boolean</code> as a string: "1" = <code>TRUE</code>, "0" = <code>FALSE</code>. <dt><a name="void_set_bool(INTVAL_value)" ><b><code>void set_bool(INTVAL value)</b></code></a></dt> Sets the value of the Boolean to the specified integer value: 0 = <code>FALSE</code>, non-0 = <code>TRUE</code>. <dt><a name="void_set_integer_native(INTVAL_value)" ><b><code>void set_integer_native(INTVAL value)</b></code></a></dt> Same as <code>set_bool()</code>. <dt><a name="void_set_number_native(FLOATVAL_value)" ><b><code>void set_number_native(FLOATVAL value)</b></code></a></dt> Sets the value of the Boolean to the specified float value: 0.0 = <code>FALSE</code>, non-0.0 = <code>TRUE</code>. <dt><a name="void_set_string_native(STRING_*value)" ><b><code>void set_string_native(STRING *value)</b></code></a></dt> Sets the Boolean to the value represented by the specified string. All values are considered <code>TRUE</code> except for <code>""</code> and <code>"0</code>", which are considered <code>FALSE</code>. <dt><a name="void_freeze(PMC_*info)" ><b><code>void freeze(PMC *info)</b></code></a></dt> Used to archive the <code>Boolean</code>. <dt><a name="void_thaw(PMC_*info)" ><b><code>void thaw(PMC *info)</b></code></a></dt> Used to unarchive the <code>Boolean</code>.</dl> <p>See also the <code>Scalar</code> PMC.</p> </div> <!-- "mainbody" --> <div id="divider"></div> <div id="footer"> Copyright © 2002-2011, Parrot Foundation. </div> </div> <!-- "wrapper" --> </body> </html>