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_CompileUCFunction (Function)
Summary:     Creates a JS function from a Unicode-encoded character string.
Syntax:
JSFunction * JS_CompileUCFunction(JSContext *cx, JSObject *obj,
const char *name, uintN nargs, const char **argnames,
const jschar *chars, 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 function is associated.
                 
     name     const char *     Name to assign the newly compiled function.
                 
     nargs     uintN     Number of arguments to pass to the function.
                 
     argnames     const char **     Names to assign to the arguments passed to the function.
                 
     chars     const jschar *     Unicode string containing the function to compile.
                 
     length     size_t     Size, in Unicode characters, of the function to compile.
                 
     filename     const char *     Name of file or URL containing the function. 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_CompileUCFunction compiles a function from a Unicode-encoded character string, chars, and associated it with a JS object, obj.

name is the name to assign to the newly created function. nargs is the number of arguments the function takes, and argnames is a pointer to an array of names to assign each argument. The number of argument names should match the number of arguments specified in nargs.

chars is the Unicode-encoded string containing the function. length indicates the size of the function in Unicode characters.

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

If a function compiles successfully, JS_CompileUCFunction returns a pointer to the function. Otherwise JS_CompileUCFunction returns NULL.


See also:
JS_CallFunction
JS_CallFunctionName
JS_CallFunctionValue
JS_CompileFunction
JS_DecompileFunction
JS_DecompileFunctionBody
JS_DefineFunction
JS_DefineFunctions
JS_GetFunctionObject
JS_NewFunction
JS_SetBranchCallback
JS_ValueToFunction

[sh-index] Back to list of manuals