C-Level Extensibility And The Javascript Interpreter; Data Types - Adobe 38040334 - Dreamweaver CS3 User Manual

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

void
MM_Init()
{
JS_DefineFunction("readContentsOfFile", readContentsOfFile, 1);
}
Your library must include exactly one instance of the following macro:
/* MM_STATE is a macro that expands to some definitions that are
* needed to interact with Dreamweaver. This macro must
* be defined exactly once in your library. */
MM_STATE
Note: The library can be implemented in either C or C++, but the file that contains the
macro must be implemented in C. The C++ compiler garbles function names, which makes it impossible for
MM_STATE
Dreamweaver to find the
MM_Init()

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
structure.

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.
function.
DREAMWEAVER CS3
Extending Dreamweaver
function and the
MM_Init()
MM_Environment
347

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents