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_CompileScript (Function)
Summary:     Compiles a script for execution.
Syntax:
JSScript * JS_CompileScript(JSContext *cx, JSObject *obj,
const char *bytes, size_t length, const char *filename,
uintN lineno);

     Argument     Type     Description
     cx     JSContext *     Pointer to a JS context from which to derive runtime information.
                 
     obj     JSObject *     Object with which the script is associated.
                 
     bytes     const char *     String containing the script to compile.
                 
     length     size_t     Size, in bytes, of the script to compile.
                 
     filename     const char *     Name of file or URL containing the script. Used to report filename or URL in error messages.
                 
     lineno     uintN     Line number. Used to report the offending line in the file or URL if an error occurs.
                 
Description:
JS_CompileScript compiles a script, bytes, for execution. The script is associated with a JS object. bytes is the string containing the text of the script. length indicates the size of the text version of the script in bytes.

filename is the name of the file (or URL) containing the script. This information in included in error messages if an eror occurs during compilation. Similarly, lineno is used to report the line number of the script or file where an error occurred during compilation.

If a script compiles successfully, JS_CompileScript returns a pointer to the compiled script. Otherwise JS_CompileScript returns NULL, and reports an error.


See also:
JS_CompileFile
JS_CompileUCScript
JS_DecompileScript
JS_DestroyScript
JS_EvaluateScript
JS_ExecuteScript

[sh-index] Back to list of manuals