638
edits
(→CData objects: Add .toSource() and .toString()) |
(→Conversions: ConvertToJS on characters and strings) |
||
| Line 302: | Line 302: | ||
* If the value is of a number type other than the pointer-sized types and the 64-bit types, return the corresponding JavaScript number. | * If the value is of a number type other than the pointer-sized types and the 64-bit types, return the corresponding JavaScript number. | ||
* If the value is of a string type | * If the value is of a character type, select the corresponding Unicode character. ''(Open issue: here be dragons!)'' Convert the character to UTF-16. Return a JavaScript string containing the UTF-16 code units. (If the character type is 1 or 2 bytes, as it is on all platforms we care about, the result is a one-character JavaScript string.) | ||
* If the value is of a string type and non-null, return a JavaScript string. | * If the value is of a string type and is <code>NULL</code>, return <code>null</code>. | ||
* If the value is of type <code>cstring</code> and is non-null, transcode it to UTF-16 and return a JavaScript string containing the UTF-16 code units. ''(Open issue: here be dragons!)'' | |||
* If the value is of type <code>ustring</code> and is non-null, return a JavaScript string containing the same sequence of 16-bit characters. | |||
* Otherwise the value is of an array, struct, or pointer type. If the argument ''x'' is already a <code>CData</code> object, return it. Otherwise allocate a buffer containing a copy of the C/C++ value ''x'', and return a <code>CData</code> object of the appropriate type referring to the object in the new buffer. | * Otherwise the value is of an array, struct, or pointer type. If the argument ''x'' is already a <code>CData</code> object, return it. Otherwise allocate a buffer containing a copy of the C/C++ value ''x'', and return a <code>CData</code> object of the appropriate type referring to the object in the new buffer. | ||
edits