JavaScript-1.5 Reference

JS_NewDoubleValue Function

Summary

Creates a JS value based on a JS double.

Syntax

JSBool JS_NewDoubleValue(JSContext *cx, jsdouble d,
    jsval *rval);
NameTypeDescription
cxJSContext *Pointer to a JS context from which to derive runtime information.
djsdoubleAn existing double to assign as a value to the jsval.
rvaljsval *Pointer to a previously declared jsval into which to store the double value.

Description

JS_NewDoubleValue creates a jsval containing a double value that corresponds to the double passed in as an argument. cx is the executable script context in which this call is made. d is the double value to assign to the jsval, and rval is the jsval into which the new JS double value is stored. Space for the new value is allocated from the JS garbage collection heap.

JS_NewDoubleValue attempts to creates a temporary copy of the double value. If the copy is successful, then the jsval is created, and the function returns JS_TRUE.Otherwise it returns JS_FALSE.

Notes

After you create it, a JS double is subject to garbage collection until you protect against it using a local root, an object property, or the JS_AddRoot function.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_AddRoot | JS_NewNumberValue ]

This page was generated by APIDOC