exe...@gmail.com
unread,May 16, 2013, 11:16:45 PM5/16/13You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Here is SM 17 hello world:
#include "jsapi.h"
JSRuntime *rt;
JSContext *cx;
JSObject *global;
JSClass GlobalClass = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub};
int main() {
rt = JS_NewRuntime(32L * 1024L * 1024L);
cx = JS_NewContext (rt, 10*20*8192);
global = JS_NewGlobalObject(cx, &GlobalClass, NULL);
JS_InitStandardClasses(cx, global);
jsval R;
char *script = "2+2";
JS_EvaluateScript(cx, global, script, strlen(script), "arg", 1, &R);
double d;
JS_ValueToNumber(cx, R, &d);
printf("%f\n", d);
return 0;
}