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 XFA_INCLUDE_FXJSE_FXJSE_H_ | 7 #ifndef XFA_INCLUDE_FXJSE_FXJSE_H_ |
8 #define XFA_INCLUDE_FXJSE_FXJSE_H_ | 8 #define XFA_INCLUDE_FXJSE_FXJSE_H_ |
9 | 9 |
10 #include "core/include/fpdfapi/fpdf_parser.h" | 10 #include "core/include/fpdfapi/fpdf_parser.h" |
11 #include "core/include/fxcrt/fx_string.h" | 11 #include "core/include/fxcrt/fx_string.h" |
12 #include "core/include/fxcrt/fx_system.h" | 12 #include "core/include/fxcrt/fx_system.h" |
13 | 13 |
14 class CPDFDoc_Environment; | 14 class CPDFDoc_Environment; |
15 class CPDF_Page; | 15 class CPDF_Page; |
| 16 struct FXJSE_CLASS; |
16 | 17 |
17 typedef struct FXJSE_HRUNTIME_ { void* pData; } * FXJSE_HRUNTIME; | 18 typedef struct FXJSE_HRUNTIME_ { void* pData; } * FXJSE_HRUNTIME; |
18 typedef struct FXJSE_HCONTEXT_ { void* pData; } * FXJSE_HCONTEXT; | 19 typedef struct FXJSE_HCONTEXT_ { void* pData; } * FXJSE_HCONTEXT; |
19 typedef struct FXJSE_HCLASS_ { void* pData; } * FXJSE_HCLASS; | 20 typedef struct FXJSE_HCLASS_ { void* pData; } * FXJSE_HCLASS; |
20 typedef struct FXJSE_HVALUE_ { void* pData; } * FXJSE_HVALUE; | 21 typedef struct FXJSE_HVALUE_ { void* pData; } * FXJSE_HVALUE; |
21 typedef struct FXJSE_HOBJECT_ : public FXJSE_HVALUE_{} * FXJSE_HOBJECT; | 22 typedef struct FXJSE_HOBJECT_ : public FXJSE_HVALUE_{} * FXJSE_HOBJECT; |
| 23 typedef double FXJSE_DOUBLE; |
22 | 24 |
23 typedef double FXJSE_DOUBLE; | |
24 void FXJSE_Initialize(); | 25 void FXJSE_Initialize(); |
25 void FXJSE_Finalize(); | 26 void FXJSE_Finalize(); |
26 FXJSE_HRUNTIME FXJSE_Runtime_Create(); | 27 FXJSE_HRUNTIME FXJSE_Runtime_Create(); |
27 void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime); | 28 void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime); |
28 typedef struct _FXJSE_CLASS FXJSE_CLASS; | 29 |
29 FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, | 30 FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, |
30 const FXJSE_CLASS* lpGlobalClass = nullptr, | 31 const FXJSE_CLASS* lpGlobalClass = nullptr, |
31 void* lpGlobalObject = nullptr); | 32 void* lpGlobalObject = nullptr); |
32 void FXJSE_Context_Release(FXJSE_HCONTEXT hContext); | 33 void FXJSE_Context_Release(FXJSE_HCONTEXT hContext); |
33 FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext); | 34 FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext); |
34 FXJSE_HRUNTIME FXJSE_Context_GetRuntime(FXJSE_HCONTEXT hContext); | 35 FXJSE_HRUNTIME FXJSE_Context_GetRuntime(FXJSE_HCONTEXT hContext); |
35 enum FXJSE_CompatibleModeFlags { | 36 enum FXJSE_CompatibleModeFlags { |
36 FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS = (1 << 0), | 37 FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS = (1 << 0), |
37 FXJSE_COMPATIBLEMODEFLAGCOUNT = 1, | 38 FXJSE_COMPATIBLEMODEFLAGCOUNT = 1, |
38 }; | 39 }; |
(...skipping 15 matching lines...) Expand all Loading... |
54 const CFX_ByteStringC& szFuncName, | 55 const CFX_ByteStringC& szFuncName, |
55 CFXJSE_Arguments& args); | 56 CFXJSE_Arguments& args); |
56 typedef void (*FXJSE_PropAccessor)(FXJSE_HOBJECT hObject, | 57 typedef void (*FXJSE_PropAccessor)(FXJSE_HOBJECT hObject, |
57 const CFX_ByteStringC& szPropName, | 58 const CFX_ByteStringC& szPropName, |
58 FXJSE_HVALUE hValue); | 59 FXJSE_HVALUE hValue); |
59 typedef int32_t (*FXJSE_PropTypeGetter)(FXJSE_HOBJECT hObject, | 60 typedef int32_t (*FXJSE_PropTypeGetter)(FXJSE_HOBJECT hObject, |
60 const CFX_ByteStringC& szPropName, | 61 const CFX_ByteStringC& szPropName, |
61 FX_BOOL bQueryIn); | 62 FX_BOOL bQueryIn); |
62 typedef FX_BOOL (*FXJSE_PropDeleter)(FXJSE_HOBJECT hObject, | 63 typedef FX_BOOL (*FXJSE_PropDeleter)(FXJSE_HOBJECT hObject, |
63 const CFX_ByteStringC& szPropName); | 64 const CFX_ByteStringC& szPropName); |
64 typedef struct _FXJSE_FUNCTION { | 65 struct FXJSE_FUNCTION { |
65 const FX_CHAR* name; | 66 const FX_CHAR* name; |
66 FXJSE_FuncCallback callbackProc; | 67 FXJSE_FuncCallback callbackProc; |
67 } FXJSE_FUNCTION; | 68 }; |
68 #define FXJSE_DEF_FUNCTION(functionName, functionCallback) \ | 69 #define FXJSE_DEF_FUNCTION(functionName, functionCallback) \ |
69 { functionName, functionCallback } | 70 { functionName, functionCallback } |
70 void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, | 71 void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, |
71 const FXJSE_FUNCTION* lpFunctions, | 72 const FXJSE_FUNCTION* lpFunctions, |
72 int nNum); | 73 int nNum); |
73 typedef struct _FXJSE_PROPERTY { | 74 struct FXJSE_PROPERTY { |
74 const FX_CHAR* name; | 75 const FX_CHAR* name; |
75 FXJSE_PropAccessor getProc; | 76 FXJSE_PropAccessor getProc; |
76 FXJSE_PropAccessor setProc; | 77 FXJSE_PropAccessor setProc; |
77 } FXJSE_PROPERTY; | 78 }; |
78 enum FXJSE_ClassPropTypes { | 79 enum FXJSE_ClassPropTypes { |
79 FXJSE_ClassPropType_None, | 80 FXJSE_ClassPropType_None, |
80 FXJSE_ClassPropType_Property, | 81 FXJSE_ClassPropType_Property, |
81 FXJSE_ClassPropType_Method | 82 FXJSE_ClassPropType_Method |
82 }; | 83 }; |
83 typedef struct _FXJSE_CLASS { | 84 struct FXJSE_CLASS { |
84 const FX_CHAR* name; | 85 const FX_CHAR* name; |
85 FXJSE_FuncCallback constructor; | 86 FXJSE_FuncCallback constructor; |
86 FXJSE_PROPERTY* properties; | 87 FXJSE_PROPERTY* properties; |
87 FXJSE_FUNCTION* methods; | 88 FXJSE_FUNCTION* methods; |
88 int32_t propNum; | 89 int32_t propNum; |
89 int32_t methNum; | 90 int32_t methNum; |
90 FXJSE_PropTypeGetter dynPropTypeGetter; | 91 FXJSE_PropTypeGetter dynPropTypeGetter; |
91 FXJSE_PropAccessor dynPropGetter; | 92 FXJSE_PropAccessor dynPropGetter; |
92 FXJSE_PropAccessor dynPropSetter; | 93 FXJSE_PropAccessor dynPropSetter; |
93 FXJSE_PropDeleter dynPropDeleter; | 94 FXJSE_PropDeleter dynPropDeleter; |
94 FXJSE_FuncCallback dynMethodCall; | 95 FXJSE_FuncCallback dynMethodCall; |
95 } FXJSE_CLASS; | 96 }; |
96 FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, | 97 FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, |
97 const FXJSE_CLASS* lpClass); | 98 const FXJSE_CLASS* lpClass); |
98 FXJSE_HCLASS FXJSE_GetClass(FXJSE_HCONTEXT hContext, | 99 FXJSE_HCLASS FXJSE_GetClass(FXJSE_HCONTEXT hContext, |
99 const CFX_ByteStringC& szName); | 100 const CFX_ByteStringC& szName); |
100 FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime); | 101 FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime); |
101 void FXJSE_Value_Release(FXJSE_HVALUE hValue); | 102 void FXJSE_Value_Release(FXJSE_HVALUE hValue); |
102 FXJSE_HRUNTIME FXJSE_Value_GetRuntime(FXJSE_HVALUE hValue); | 103 FXJSE_HRUNTIME FXJSE_Value_GetRuntime(FXJSE_HVALUE hValue); |
103 FX_BOOL FXJSE_Value_IsUndefined(FXJSE_HVALUE hValue); | 104 FX_BOOL FXJSE_Value_IsUndefined(FXJSE_HVALUE hValue); |
104 FX_BOOL FXJSE_Value_IsNull(FXJSE_HVALUE hValue); | 105 FX_BOOL FXJSE_Value_IsNull(FXJSE_HVALUE hValue); |
105 FX_BOOL FXJSE_Value_IsBoolean(FXJSE_HVALUE hValue); | 106 FX_BOOL FXJSE_Value_IsBoolean(FXJSE_HVALUE hValue); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, | 168 void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, |
168 const CFX_ByteStringC& utf8Message); | 169 const CFX_ByteStringC& utf8Message); |
169 FX_BOOL FXJSE_ReturnValue_GetMessage(FXJSE_HVALUE hRetValue, | 170 FX_BOOL FXJSE_ReturnValue_GetMessage(FXJSE_HVALUE hRetValue, |
170 CFX_ByteString& utf8Name, | 171 CFX_ByteString& utf8Name, |
171 CFX_ByteString& utf8Message); | 172 CFX_ByteString& utf8Message); |
172 FX_BOOL FXJSE_ReturnValue_GetLineInfo(FXJSE_HVALUE hRetValue, | 173 FX_BOOL FXJSE_ReturnValue_GetLineInfo(FXJSE_HVALUE hRetValue, |
173 int32_t& nLine, | 174 int32_t& nLine, |
174 int32_t& nCol); | 175 int32_t& nCol); |
175 | 176 |
176 #endif // XFA_INCLUDE_FXJSE_FXJSE_H_ | 177 #endif // XFA_INCLUDE_FXJSE_FXJSE_H_ |
OLD | NEW |