C-Level Extensibility And The Javascript Interpreter; Data Types - MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Manual

Extending dreamweaver
Hide thumbs Also See for DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER:
Table of Contents

Advertisement

Note: The library can be implemented in either C or C++, but the file that contains the
function and the
names, which makes it impossible for Dreamweaver to find the

C-level extensibility and the JavaScript interpreter

The C code in your library must interact with the Dreamweaver JavaScript interpreter at the
following different times:
At startup, to register the library's functions
When the function is called, to parse the arguments that JavaScript is passing to C
Before the function returns, to package the return value
To accomplish these tasks, the interpreter defines several data types and exposes an API.
Definitions for the data types and functions that are listed in this section appear in the
mm_jsapi.h file. For your library to work properly, you must include the mm_jsapi.h file with the
following line at the top of each file in your library:
#include "mm_jsapi.h"
Including the mm_jsapi.h file includes, in turn, mm_jsapi_environment.h, which defines the
MM_Environment

Data types

The JavaScript interpreter defines the following data types.
typedef struct JSContext JSContext
A pointer to this opaque data type passes to the C-level function. Some functions in the API
accept this pointer as one of their arguments.
typedef struct JSObject JSObject
A pointer to this opaque data type passes to the C-level function. This data type represents an
object, which might be an array object or some other object type.
typedef struct jsval jsval
An opaque data structure that can contain an integer, or a pointer to a float, string, or object.
Some functions in the API can read the values of function arguments by reading the contents of a
structure, and some can be used to write the function's return value by writing a
jsval
structure.
typedef enum { JS_FALSE = 0, JS_TRUE = 1 } JSBool
A simple data type that stores a Boolean value.
macro must be implemented in C. The C++ compiler garbles function
MM_STATE
structure.
MM_Init()
function.
MM_Init()
Data types
jsval
355

Advertisement

Table of Contents
loading
Need help?

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

This manual is also suitable for:

Dreamweaver mx 2004

Table of Contents