Adobe Extending Dreamweaver CS4 Manuale Utente Pagina 355

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 387
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 354
349
EXTENDING DREAMWEAVER CS4
C-level extensibility
Note: The library can be implemented in either C or C++, but the file that contains the MM_Init() function and the
MM_STATE macro must be implemented in C. The C++ compiler garbles function names, which makes it impossible for
Dreamweaver to find the
MM_Init() function.
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
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.
typedef struct JSVal JSVal
An opaque data structure that can contain an integer, or a pointer to a floating-point number, string, or object. Some
functions in the API can read the values of function arguments by reading the contents of a JSVal 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.
The C-level API
The C-level extensibility API consists of the following functions:
Vedere la pagina 354
1 2 ... 350 351 352 353 354 355 356 357 358 359 360 ... 386 387

Commenti su questo manuale

Nessun commento