OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _JS_DEFINE_H_ | 7 #ifndef _JS_DEFINE_H_ |
8 #define _JS_DEFINE_H_ | 8 #define _JS_DEFINE_H_ |
9 | 9 |
10 typedef v8::Value JSValue; | 10 typedef v8::Value JSValue; |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 return 0;\ | 592 return 0;\ |
593 } | 593 } |
594 | 594 |
595 /* ======================================== GLOBAL CONSTS ======================
====================== */ | 595 /* ======================================== GLOBAL CONSTS ======================
====================== */ |
596 #define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\ | 596 #define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\ |
597 if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntim
e,JS_WIDESTRING(const_value)))) return -1 | 597 if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntim
e,JS_WIDESTRING(const_value)))) return -1 |
598 | 598 |
599 /* ======================================== GLOBAL ARRAYS ======================
====================== */ | 599 /* ======================================== GLOBAL ARRAYS ======================
====================== */ |
600 | 600 |
601 #define DEFINE_GLOBAL_ARRAY(pRuntime)\ | 601 #define DEFINE_GLOBAL_ARRAY(pRuntime)\ |
602 int size = sizeof(ArrayContent) / sizeof(FX_LPCWSTR);\ | 602 int size = FX_ArraySize(ArrayContent);\ |
603 \ | 603 \ |
604 CJS_Array array(pRuntime);\ | 604 CJS_Array array(pRuntime);\ |
605 for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,ArrayContent[i]
));\ | 605 for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,ArrayContent[i]
));\ |
606 \ | 606 \ |
607 CJS_PropValue prop(pRuntime);\ | 607 CJS_PropValue prop(pRuntime);\ |
608 prop << array;\ | 608 prop << array;\ |
609 if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToJSValue())
< 0)\ | 609 if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToJSValue())
< 0)\ |
610 return -1 | 610 return -1 |
611 | 611 |
612 /* ============================================================ */ | 612 /* ============================================================ */ |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 else if (strcmp(sType,VALUE_NAME_NULL) == 0) | 672 else if (strcmp(sType,VALUE_NAME_NULL) == 0) |
673 return VT_null; | 673 return VT_null; |
674 else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0) | 674 else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0) |
675 return VT_undefined; | 675 return VT_undefined; |
676 */ | 676 */ |
677 | 677 |
678 return VT_unknown; | 678 return VT_unknown; |
679 } | 679 } |
680 | 680 |
681 #endif //_JS_DEFINE_H_ | 681 #endif //_JS_DEFINE_H_ |
OLD | NEW |