My favorites | Sign in
Logo
                
Search
for
Updated May 31, 2009 by soubok
Labels: doc
jshost  
jshost executable

jshost executable

home > JSLibs > jshost -

Description

jshost ( javascript host ) is a small executable file that run javascript programs. The main features are:

Command line options

Exit code

example:
 function Exit(code) {
  throw code;
 }

 Exit(2);

Global functions

Global properties

Configuration object

jshost create a global _configuration object to provide other modules some useful informations like stdout access and unsafeMode flag.

Remarks

Generated filename extensions are

Modules entry points signature are

"ModuleInit" JSBool (*ModuleInitFunction)(JSContext *, JSObject *) Called when the module is being load
"ModuleRelease" void (*ModuleReleaseFunction)(JSContext *cx) Called when the module is not more needed
"ModuleFree" void (*ModuleFreeFunction)(void) Called to let the module moke some cleanup tasks

Exemple (win32)

extern "C" __declspec(dllexport) JSBool ModuleInit(JSContext *cx, JSObject *obj) {

 InitFileClass(cx, obj);
 InitDirectoryClass(cx, obj);
 InitSocketClass(cx, obj);
 InitErrorClass(cx, obj);
 InitGlobal(cx, obj);

 return JS_TRUE;
}

== Embedding JS scripts in your jshost binary ==
 This can only be done at jshost compilation time.
 # Checkout [http://code.google.com/p/jslibs/source/checkout jslibs sources]
 # Save your embbeded script in the file _jslibs/src/jshost/embeddedBootstrapScript.js_
 # [jslibsBuild Compile jslibs] (or only jshost if jslibs has already been compiled once)

Comment by dusel...@hotmail.ru, Sep 29, 2009

Print( 'Unsafe mode: '+(underscore)configuration.unsafeMode, '\n' ); P.S. Submit eliminates real undescores(?)

Comment by soubok, Sep 29, 2009

I think undescores are used in wiki markups for italic. You can escape them using the back quote: `_`configuration


Sign in to add a comment
Hosted by Google Code