Merge to XFA: Remove unused nParamNum values from JS method tables.
[pdfium.git] / fpdfsdk / include / javascript / JS_Define.h
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4  
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef _JS_DEFINE_H_
8 #define _JS_DEFINE_H_
9
10 #include "../jsapi/fxjs_v8.h"
11 #include "resource.h"
12
13 #include "JS_Object.h"
14 #include "JS_Value.h"
15
16 struct JSConstSpec
17 {
18         const wchar_t* pName;
19         double number;
20         const wchar_t* string;
21         FX_BYTE t; //0:double 1:str
22 };
23
24 struct JSPropertySpec
25 {
26         const wchar_t* pName;
27         v8::AccessorGetterCallback pPropGet;
28         v8::AccessorSetterCallback pPropPut;
29 };
30
31 struct JSMethodSpec
32 {
33         const wchar_t* pName;
34         v8::FunctionCallback pMethodCall;
35 };
36
37 /* ====================================== PUBLIC DEFINE SPEC ============================================== */
38 #define JS_WIDESTRING(widestring) L###widestring
39
40 #define BEGIN_JS_STATIC_CONST(js_class_name) JSConstSpec js_class_name::JS_Class_Consts[] = {
41 #define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) {JS_WIDESTRING(const_name), pValue, L"", 0},
42 #define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) {JS_WIDESTRING(const_name), 0, JS_WIDESTRING(pValue), 1},
43 #define END_JS_STATIC_CONST() {0, 0, 0, 0}};
44
45 #define BEGIN_JS_STATIC_PROP(js_class_name) JSPropertySpec js_class_name::JS_Class_Properties[] = {
46 #define JS_STATIC_PROP_ENTRY(prop_name) {JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static},
47 #define END_JS_STATIC_PROP() {0, 0, 0}};
48
49 #define BEGIN_JS_STATIC_METHOD(js_class_name) JSMethodSpec js_class_name::JS_Class_Methods[] = {
50 #define JS_STATIC_METHOD_ENTRY(method_name) {JS_WIDESTRING(method_name), method_name##_static},
51 #define END_JS_STATIC_METHOD() {0, 0}};
52
53 /* ======================================== PROP CALLBACK ============================================ */
54
55 template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
56 void JSPropGetter(const char* prop_name_string,
57                   const char* class_name_string,
58                   v8::Local<v8::String> property,
59                   const v8::PropertyCallbackInfo<v8::Value>& info) {
60   v8::Isolate* isolate = info.GetIsolate();
61   IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
62   IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
63   CJS_PropValue value(isolate);
64   value.StartGetting();
65   CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());
66   C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
67   CFX_WideString sError;
68   if (!(pObj->*M)(pRuntimeContext, value, sError)) {
69     JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, sError));
70     return;
71   }
72   info.GetReturnValue().Set((v8::Handle<v8::Value>)value);
73 }
74
75 template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
76 void JSPropSetter(const char* prop_name_string,
77                   const char* class_name_string,
78                   v8::Local<v8::String> property,
79                   v8::Local<v8::Value> value,
80                   const v8::PropertyCallbackInfo<void>& info) {
81   v8::Isolate* isolate = info.GetIsolate();
82   IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
83   IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
84   CJS_PropValue propValue(CJS_Value(isolate, value, VT_unknown));
85   propValue.StartSetting();
86   CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());
87   C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
88   CFX_WideString sError;
89   if (!(pObj->*M)(pRuntimeContext, propValue, sError)) {
90     JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, sError));
91   }
92 }
93
94 #define JS_STATIC_PROP(prop_name, class_name) \
95   static void get_##prop_name##_static( \
96       v8::Local<v8::String> property, \
97       const v8::PropertyCallbackInfo<v8::Value>& info) { \
98     JSPropGetter<class_name, &class_name::prop_name>( \
99         #prop_name, #class_name, property, info); \
100   } \
101   static void set_##prop_name##_static( \
102       v8::Local<v8::String> property, \
103       v8::Local<v8::Value> value, \
104       const v8::PropertyCallbackInfo<void>& info) { \
105     JSPropSetter<class_name, &class_name::prop_name>( \
106         #prop_name, #class_name, property, value, info); \
107   }
108
109 /* ========================================= METHOD CALLBACK =========================================== */
110
111 template <class C, FX_BOOL (C::*M)(IFXJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)>
112 void JSMethod(const char* method_name_string,
113               const char* class_name_string,
114               const v8::FunctionCallbackInfo<v8::Value>& info) {
115   v8::Isolate* isolate = info.GetIsolate();
116   IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
117   IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
118   CJS_Parameters parameters;
119   for (unsigned int i = 0; i<(unsigned int)info.Length(); i++) {
120     parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));
121   }
122   CJS_Value valueRes(isolate);
123   CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate,info.Holder());
124   C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
125   CFX_WideString sError;
126   if (!(pObj->*M)(pRuntimeContext, parameters, valueRes, sError)) {
127     JS_Error(isolate, JSFormatErrorString(class_name_string, method_name_string, sError));
128     return;
129   }
130   info.GetReturnValue().Set(valueRes.ToV8Value());
131 }
132
133 #define JS_STATIC_METHOD(method_name, class_name) \
134   static void method_name##_static( \
135       const v8::FunctionCallbackInfo<v8::Value>& info) {    \
136     JSMethod<class_name, &class_name::method_name>( \
137         #method_name, #class_name, info); \
138   }
139
140 #define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name) \
141   static void method_name##_static( \
142       const v8::FunctionCallbackInfo<v8::Value>& info) {    \
143     JSMethod<class_alternate, &class_alternate::method_name>( \
144         #method_name, #class_name, info); \
145   }
146
147 /* ===================================== JS CLASS =============================================== */
148
149 #define DECLARE_JS_CLASS(js_class_name) \
150         static void JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\
151         static void JSDestructor(JSFXObject obj);\
152         static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
153         static JSConstSpec JS_Class_Consts[];\
154         static JSPropertySpec JS_Class_Properties[];\
155         static JSMethodSpec     JS_Class_Methods[];\
156         static const wchar_t* m_pClassName
157
158 #define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
159 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
160 void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global)\
161 {\
162         CJS_Object* pObj = FX_NEW js_class_name(obj);\
163         pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
164         JS_SetPrivate(NULL,obj,(void*)pObj); \
165         pObj->InitInstance(cc);\
166 }\
167 \
168 void js_class_name::JSDestructor(JSFXObject obj) \
169 {\
170         js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
171         ASSERT(pObj != NULL);\
172         pObj->ExitInstance();\
173         delete pObj;\
174 }\
175 \
176 int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
177 {\
178         int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor, 0);\
179         if (nObjDefnID >= 0)\
180         {\
181                 for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\
182                 {\
183                         if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet, JS_Class_Properties[j].pPropPut) < 0) return -1;\
184                 }\
185                 for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\
186                 {\
187                         if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName, JS_Class_Methods[k].pMethodCall) < 0) return -1;\
188                 }\
189                 return nObjDefnID;\
190         }\
191         return -1;\
192 }
193
194 #define IMPLEMENT_JS_CLASS(js_class_name, class_name) IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)
195
196 /* ======================================== CONST CLASS ============================================ */
197
198 #define DECLARE_JS_CLASS_CONST() \
199         static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
200         static JSConstSpec JS_Class_Consts[];\
201         static const wchar_t* m_pClassName
202
203 #define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
204 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
205 int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
206 {\
207         int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, NULL, NULL, 0);\
208         if (nObjDefnID >=0)\
209         {\
210                 for (int i=0, sz=sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1; i<sz; i++)\
211                 {\
212                         if (JS_Class_Consts[i].t == 0)\
213                         {\
214                                 if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewNumber(pRuntime,JS_Class_Consts[i].number)) < 0) return -1;\
215                         }\
216                         else\
217                         {\
218                         if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewString(pRuntime,JS_Class_Consts[i].string)) < 0) return -1;\
219                         }\
220                 }\
221                 return nObjDefnID;\
222         }\
223         return -1;\
224 }
225
226 /* ===================================== SPECIAL JS CLASS =============================================== */
227
228 template <class Alt>
229 void JSSpecialPropQuery(const char *, v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info) {
230   v8::Isolate* isolate = info.GetIsolate();
231   v8::String::Utf8Value utf8_value(property);
232   CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
233   CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
234   Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
235   FX_BOOL bRet = pObj->QueryProperty(propname.c_str());
236   info.GetReturnValue().Set(bRet ? 4 : 0);
237 }
238
239 template <class Alt>
240 void JSSpecialPropGet(const char* class_name,
241                       v8::Local<v8::String> property,
242                       const v8::PropertyCallbackInfo<v8::Value>& info) {
243   v8::Isolate* isolate = info.GetIsolate();
244   v8::Local<v8::Context> context = isolate->GetCurrentContext();
245   IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
246   IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
247   CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
248   Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
249   v8::String::Utf8Value utf8_value(property);
250   CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
251   CFX_WideString sError;
252   CJS_PropValue value(isolate);
253   value.StartGetting();
254   if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), value, sError)) {
255       JS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError));
256       return;
257   }
258   info.GetReturnValue().Set((v8::Handle<v8::Value>)value);
259 }
260
261 template <class Alt>
262 void JSSpecialPropPut(const char* class_name,
263                       v8::Local<v8::String> property,
264                       v8::Local<v8::Value> value,
265                       const v8::PropertyCallbackInfo<v8::Value>& info) {
266   v8::Isolate* isolate = info.GetIsolate();
267   v8::Local<v8::Context> context = isolate->GetCurrentContext();
268   IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
269   IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
270   CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
271   Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
272   v8::String::Utf8Value utf8_value(property);
273   CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
274   CFX_WideString sError;
275   CJS_PropValue PropValue(CJS_Value(isolate,value,VT_unknown));
276   PropValue.StartSetting();
277   if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), PropValue, sError)) {
278       JS_Error(isolate, JSFormatErrorString(class_name, "PutProperty", sError));
279   }
280 }
281
282 template <class Alt>
283 void JSSpecialPropDel(const char* class_name,
284                       v8::Local<v8::String> property,
285                       const v8::PropertyCallbackInfo<v8::Boolean>& info) {
286   v8::Isolate* isolate = info.GetIsolate();
287   v8::Local<v8::Context> context = isolate->GetCurrentContext();
288   IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
289   IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
290   CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
291   Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
292   v8::String::Utf8Value utf8_value(property);
293   CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
294   CFX_WideString sError;
295   if (!pObj->DelProperty(pRuntimeContext, propname.c_str(), sError)) {
296     CFX_ByteString cbName;
297     cbName.Format("%s.%s", class_name, "DelProperty");
298     // Probably a missing call to JS_Error().
299   }
300 }
301
302 #define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
303         static void JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global);\
304         static void JSDestructor(JSFXObject obj);\
305         static JSConstSpec JS_Class_Consts[];\
306         static JSPropertySpec JS_Class_Properties[];\
307         static JSMethodSpec     JS_Class_Methods[];\
308         static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
309         static const wchar_t* m_pClassName;\
310         static void queryprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info);\
311         static void getprop_##js_class_name##_static(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info);\
312         static void putprop_##js_class_name##_static(v8::Local<v8::String> property,v8::Local<v8::Value> value,const v8::PropertyCallbackInfo<v8::Value>& info);\
313         static void delprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Boolean>& info)
314
315 #define IMPLEMENT_SPECIAL_JS_CLASS(js_class_name, class_alternate, class_name) \
316 const wchar_t * js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
317 void js_class_name::queryprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info) { \
318   JSSpecialPropQuery<class_alternate>(#class_name, property, info);     \
319 }\
320 void js_class_name::getprop_##js_class_name##_static(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { \
321   JSSpecialPropGet<class_alternate>(#class_name, property, info); \
322 }                                                                       \
323 void js_class_name::putprop_##js_class_name##_static(v8::Local<v8::String> property,v8::Local<v8::Value> value,const v8::PropertyCallbackInfo<v8::Value>& info) {\
324   JSSpecialPropPut<class_alternate>(#class_name, property, value, info); \
325 }\
326 void js_class_name::delprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Boolean>& info) { \
327   JSSpecialPropDel<class_alternate>(#class_name, property, info); \
328 } \
329 void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject  obj,JSFXObject  global)\
330 {\
331         CJS_Object* pObj = FX_NEW js_class_name(obj);\
332         pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
333         JS_SetPrivate(NULL,obj, (void*)pObj); \
334         pObj->InitInstance(cc);\
335 }\
336 \
337 void js_class_name::JSDestructor(JSFXObject obj) \
338 {\
339         js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
340         ASSERT(pObj != NULL);\
341         pObj->ExitInstance();\
342         delete pObj;\
343 }\
344 \
345 int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
346 {\
347 \
348         int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor, 0);\
349 \
350         if (nObjDefnID >= 0)\
351         {\
352                 for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\
353                 {\
354                         if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet,JS_Class_Properties[j].pPropPut)<0)return -1;\
355                 }\
356 \
357                 for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\
358                 {\
359                         if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName,JS_Class_Methods[k].pMethodCall)<0)return -1;\
360                 }\
361                 if (JS_DefineObjAllProperties(pRuntime, nObjDefnID, js_class_name::queryprop_##js_class_name##_static, js_class_name::getprop_##js_class_name##_static,js_class_name::putprop_##js_class_name##_static,js_class_name::delprop_##js_class_name##_static)<0) return -1;\
362 \
363                 return nObjDefnID;\
364         }\
365 \
366         return -1;\
367 }
368
369 /* ======================================== GLOBAL METHODS ============================================ */
370
371 template <FX_BOOL (*F)(IFXJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)>
372 void JSGlobalFunc(const char *func_name_string,
373                   const v8::FunctionCallbackInfo<v8::Value>& info) {
374   v8::Isolate* isolate = info.GetIsolate();
375   IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
376   IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
377   CJS_Parameters parameters;
378   for (unsigned int i = 0; i<(unsigned int)info.Length(); i++) {
379     parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));
380   }
381   CJS_Value valueRes(isolate);
382   CFX_WideString sError;
383   if (!(*F)(pRuntimeContext, parameters, valueRes, sError)) {
384     JS_Error(isolate, JSFormatErrorString(func_name_string, nullptr, sError));
385     return;
386   }
387   info.GetReturnValue().Set(valueRes.ToV8Value());
388 }
389
390 #define JS_STATIC_GLOBAL_FUN(fun_name) \
391   static void fun_name##_static(const v8::FunctionCallbackInfo<v8::Value>& info) { \
392     JSGlobalFunc<fun_name>(#fun_name, info); \
393   }
394
395 #define JS_STATIC_DECLARE_GLOBAL_FUN() \
396 static JSMethodSpec     global_methods[]; \
397 static int Init(IJS_Runtime* pRuntime)
398
399 #define BEGIN_JS_STATIC_GLOBAL_FUN(js_class_name) \
400 JSMethodSpec js_class_name::global_methods[] = {
401
402 #define JS_STATIC_GLOBAL_FUN_ENTRY(method_name) JS_STATIC_METHOD_ENTRY(method_name)
403
404 #define END_JS_STATIC_GLOBAL_FUN() END_JS_STATIC_METHOD()
405
406 #define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \
407 int js_class_name::Init(IJS_Runtime* pRuntime)\
408 {\
409         for (int i=0, sz=sizeof(js_class_name::global_methods)/sizeof(JSMethodSpec)-1; i<sz; i++)\
410         {\
411                 if (JS_DefineGlobalMethod(pRuntime,\
412                                 js_class_name::global_methods[i].pName,\
413                                 js_class_name::global_methods[i].pMethodCall\
414                                 ) < 0\
415                         )return -1;\
416         }\
417         return 0;\
418 }
419
420 /* ======================================== GLOBAL CONSTS ============================================ */
421 #define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\
422 if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntime,JS_WIDESTRING(const_value)))) return -1
423
424 /* ======================================== GLOBAL ARRAYS ============================================ */
425
426 #define DEFINE_GLOBAL_ARRAY(pRuntime)\
427 int size = FX_ArraySize(ArrayContent);\
428 \
429 CJS_Array array(pRuntime);\
430 for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,ArrayContent[i]));\
431 \
432 CJS_PropValue prop(pRuntime);\
433 prop << array;\
434 if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToV8Value()) < 0)\
435         return -1
436
437 /* ============================================================ */
438
439 #define VALUE_NAME_STRING               L"string"
440 #define VALUE_NAME_NUMBER               L"number"
441 #define VALUE_NAME_BOOLEAN              L"boolean"
442 #define VALUE_NAME_DATE                 L"date"
443 #define VALUE_NAME_OBJECT               L"object"
444 #define VALUE_NAME_FXOBJ                L"fxobj"
445 #define VALUE_NAME_NULL                 L"null"
446 #define VALUE_NAME_UNDEFINED    L"undefined"
447
448 FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p);
449
450 #endif //_JS_DEFINE_H_