Subj : Re: How to convert some C-values to jsval? To : =?ISO-8859-1?Q?Georg_Maa=DF?= From : Brendan Eich Date : Sat Aug 02 2003 01:38 pm Georg Maaß wrote: > BOOLEAN_TO_JSVAL converts a C++ bool C boolean (int 0 or 1). Same thing, but I wanted to stress that C++ can use C APIs such as the JS API, but JS does not have a C++ API. value to a jsval > INT_TO_JSVAL converts a C++ int value to a jsval These macros are for cases where you know the source domain, and also where you need speed and small code. There are general ways to make values from various C types in the API, if you read down a little further in jsapi.h. > > But how can I convert following C types to a jsval: > > double JS_NewNumberValue. > unsigned int > long (might be different to int) > unsigned long All of these must be cast to double and passed to JS_NewNumberValue. JS (the language, not mozilla/js/src/ the SpiderMonkey implementation) does not have explicit integral types, only IEEE double and some 32-bit signed and unsigned types implicit in certain operators (the bitwise logicals), build-in properties (array lengths), and methods. > char* / std::string You are reading jsapi.h and the API docs, right? /be .