The C-level API
The C-level extensibility API consists of the following functions:
typedef JSBool (*JSNative)(JSContext *cx, JSObject *obj, unsigned int
argc, jsval *argv, jsval *rval)
Description
This function signature describes C-level implementations of JavaScript functions in the
following situations:
•
The
pointer is a pointer to an opaque
cx
of the functions in the JavaScript API. This variable holds the interpreter's execution context.
•
The
pointer is a pointer to the object in whose context the script executes. While the script
obj
is running, the
•
The
integer is the number of arguments being passed to the function.
argc
•
The
pointer is a pointer to an array of
argv
in length.
•
The
pointer is a pointer to a single
rval
be written to
The function returns
, the current script stops executing and an error message appears.
JS_FALSE
JSBool JS_DefineFunction()
Description
This function registers a C-level function with the JavaScript interpreter in Dreamweaver. After
the
JS_DefineFunction()
argument, you can invoke it in a JavaScript script by referring to it with the name that you specify
in the
argument. The
name
Typically, this function is called from the
during startup.
Arguments
,
char *name
JSNative call
•
The
argument is the name of the function as it is exposed to JavaScript.
name
•
The
argument is a pointer to a C-level function. The function must accept the same
call
arguments as
failure.
•
The
argument is the number of arguments that the function expects to receive.
nargs
Returns
A Boolean value:
356
Chapter 21: C-Level Extensibility
keyword is equal to this object.
this
.
*rval
if successful;
JS_TRUE
function registers the C-level function that you specify in the
is case-sensitive.
name
,
unsigned int nargs
readContentsOfFile
indicates success;
JS_TRUE
structure, which must be passed to some
JSContext
structures. The array is
jsval
structure. The function's return value should
jsval
otherwise. If the function returns
JS_FALSE
function, which Dreamweaver calls
MM_Init()
, and it must return a
indicates failure.
JS_FALSE
argc
, which indicates success or
JSBool
elements
call
Need help?
Do you have a question about the DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER and is the answer not in the manual?
Questions and answers