BOOLEAN_TO_JSVAL

  • Revision slug: SpiderMonkey/JSAPI_Reference/BOOLEAN_TO_JSVAL
  • Revision title: BOOLEAN_TO_JSVAL
  • Revision id: 147250
  • Created:
  • Creator: MMondor
  • Is current revision? No
  • Comment /* Description */

Revision Content

<title>BOOLEAN_TO_JSVAL</title> {{template.Jsapiref()}}

Summary

Macro

Converts a specified C integer JS boolean value.

Syntax

jsval BOOLEAN_TO_JSVAL(int b);
Name Type Description
b int C integer value to be converted to a jsval boolean.

Description

BOOLEAN_TO_JSVAL converts a C integer, b, to a JS Boolean value type (true or false) using a bitwise left shift operation and setting the data type flag to JSVAL_BOOLEAN.

To be converted to a boolean, any non-zero C integer will be converted to true, and any 0 to false, as per C boolean conventions.

See Also

Groups Macros
Documents {{template.LXRSearch("ident", "i", "BOOLEAN_TO_JSVAL LXR", "ID Search")}}
Entries INT_TO_JSVAL, JSVAL_TO_BOOLEAN, PRIVATE_TO_JSVAL

Revision Source

<p> &lt;title&gt;BOOLEAN_TO_JSVAL&lt;/title&gt;
{{template.Jsapiref()}}
</p>
<h3 name="Summary"> Summary </h3>
<p><b>Macro</b>
</p><p>Converts a specified C integer JS boolean value.
</p>
<h3 name="Syntax"> Syntax </h3>
<pre>jsval BOOLEAN_TO_JSVAL(int b);
</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>b</code></td>
<td><code>int</code></td>
<td>C integer value to be converted to a <code>jsval</code> boolean.</td>
</tr>
</tbody></table>
<h3 name="Description"> Description </h3>
<p><code>BOOLEAN_TO_JSVAL</code> converts a C integer, <code>b</code>, to a JS <code>Boolean</code> value type (<code>true</code> or <code>false</code>) using a bitwise left shift operation and setting the data type flag to <code>JSVAL_BOOLEAN</code>.
</p><p>To be converted to a boolean, any non-zero C integer will be converted to <code>true</code>, and any <code>0</code> to <code>false</code>, as per C boolean conventions.
</p>
<h3 name="See_Also"> See Also </h3>
<table class="fullwidth-table">
<tbody><tr>
<td>Groups</td>
<td><a href="en/JSAPI_Reference#Macros">Macros</a></td>
</tr>
<tr>
<td>Documents</td>
<td>{{template.LXRSearch("ident", "i", "BOOLEAN_TO_JSVAL LXR", "ID Search")}}</td>
</tr>
<tr>
<td>Entries</td>
<td><a href="en/JSAPI_Reference/INT_TO_JSVAL">INT_TO_JSVAL</a>, <a href="en/JSAPI_Reference/JSVAL_TO_BOOLEAN">JSVAL_TO_BOOLEAN</a>, <a href="en/JSAPI_Reference/PRIVATE_TO_JSVAL">PRIVATE_TO_JSVAL</a></td>
</tr>
</tbody></table>
Revert to this revision