AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Entry:     JS_ValueToECMAUint32 (Function)
Summary:     Converts a JS value to an ECMA-compliant, unisgned 32-bit integer.
Syntax:
JSBool JS_ValueToECMAUint32(JSContext *cx, jsval v, uint32 *ip);

     Argument     Type     Description
     cx     JSContext *     Pointer to a JS context from which to derive runtime information.
                 
     v     jsval     The JS value to convert.
                 
     ip     uint32 *     Pointer to the JS value that contains the converted integer when the function returns.
                 
Description:
JS_ValueToECMAUint32 converts a JS value, v, to a JS double, and then to an ECMA-standard, 32-bit, signed integer. The fractional portion of the double is dropped silently during conversion to an integer value. If the double is out of range, the result is computed modulo 2**32.

You can convert a JS value to an integer if the JS value to convert is a JSVAL_INTJSVAL_DOUBLE, or JSVAL_BOOLEAN. If the JS value is a JSVAL_STRING that contains a well formed numeric literal (ignoring leading and trailing whitespace) conversion also succeeds. If the JS value is a JSVAL_OBJECT, conversion is successful if the object's convert operation returns a primitive value that can be converted.

If the conversion is successful, JS_ValueToECMAInt32 returns JS_TRUE, and ip contains a pointer to the converted value. Otherwise, it reports an error and returns JS_FALSE.


See also:
JS_ConvertArguments
JS_ValueToBoolean
JS_ValueToECMAInt32
JS_ValueToFunction
JS_ValueToId
JS_ValueToInt32
JS_ValueToNumber
JS_ValueToObject
JS_ValueToString
JS_ValueToUint16

[sh-index] Back to list of manuals