Index: xfa/fxjse/include/fxjse.h |
diff --git a/xfa/include/fxjse/fxjse.h b/xfa/fxjse/include/fxjse.h |
similarity index 92% |
rename from xfa/include/fxjse/fxjse.h |
rename to xfa/fxjse/include/fxjse.h |
index b1074c38d557b7546eb4896ad6db31ade477f31e..d957c58651bd0d023943cabba5fb7169841c60db 100644 |
--- a/xfa/include/fxjse/fxjse.h |
+++ b/xfa/fxjse/include/fxjse.h |
@@ -4,13 +4,14 @@ |
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
-#ifndef XFA_INCLUDE_FXJSE_FXJSE_H_ |
-#define XFA_INCLUDE_FXJSE_FXJSE_H_ |
+#ifndef XFA_FXJSE_INCLUDE_FXJSE_H_ |
+#define XFA_FXJSE_INCLUDE_FXJSE_H_ |
#include "core/include/fxcrt/fx_string.h" |
#include "core/include/fxcrt/fx_system.h" |
struct FXJSE_CLASS; |
+class CFXJSE_Arguments; |
typedef struct FXJSE_HRUNTIME_ { void* pData; } * FXJSE_HRUNTIME; |
typedef struct FXJSE_HCONTEXT_ { void* pData; } * FXJSE_HCONTEXT; |
@@ -20,35 +21,6 @@ typedef struct FXJSE_HVALUE_ { void* pData; } * FXJSE_HVALUE; |
typedef struct FXJSE_HOBJECT_ : public FXJSE_HVALUE_{} * FXJSE_HOBJECT; |
typedef double FXJSE_DOUBLE; |
-void FXJSE_Initialize(); |
-void FXJSE_Finalize(); |
-FXJSE_HRUNTIME FXJSE_Runtime_Create(); |
-void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime); |
- |
-FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, |
- const FXJSE_CLASS* lpGlobalClass = nullptr, |
- void* lpGlobalObject = nullptr); |
-void FXJSE_Context_Release(FXJSE_HCONTEXT hContext); |
-FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext); |
-FXJSE_HRUNTIME FXJSE_Context_GetRuntime(FXJSE_HCONTEXT hContext); |
-enum FXJSE_CompatibleModeFlags { |
- FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS = (1 << 0), |
- FXJSE_COMPATIBLEMODEFLAGCOUNT = 1, |
-}; |
-void FXJSE_Context_EnableCompatibleMode(FXJSE_HCONTEXT hContext, |
- FX_DWORD dwCompatibleFlags); |
-class CFXJSE_Arguments { |
- public: |
- FXJSE_HRUNTIME GetRuntime() const; |
- int32_t GetLength() const; |
- FXJSE_HVALUE GetValue(int32_t index) const; |
- FX_BOOL GetBoolean(int32_t index) const; |
- int32_t GetInt32(int32_t index) const; |
- FX_FLOAT GetFloat(int32_t index) const; |
- CFX_ByteString GetUTF8String(int32_t index) const; |
- void* GetObject(int32_t index, FXJSE_HCLASS hClass = nullptr) const; |
- FXJSE_HVALUE GetReturnValue(); |
-}; |
typedef void (*FXJSE_FuncCallback)(FXJSE_HOBJECT hThis, |
const CFX_ByteStringC& szFuncName, |
CFXJSE_Arguments& args); |
@@ -60,25 +32,29 @@ typedef int32_t (*FXJSE_PropTypeGetter)(FXJSE_HOBJECT hObject, |
FX_BOOL bQueryIn); |
typedef FX_BOOL (*FXJSE_PropDeleter)(FXJSE_HOBJECT hObject, |
const CFX_ByteStringC& szPropName); |
+ |
+enum FXJSE_ClassPropTypes { |
+ FXJSE_ClassPropType_None, |
+ FXJSE_ClassPropType_Property, |
+ FXJSE_ClassPropType_Method |
+}; |
+ |
+enum FXJSE_CompatibleModeFlags { |
+ FXJSE_COMPATIBLEMODEFLAG_CONSTRUCTOREXTRAMETHODS = (1 << 0), |
+ FXJSE_COMPATIBLEMODEFLAGCOUNT = 1, |
+}; |
+ |
struct FXJSE_FUNCTION { |
const FX_CHAR* name; |
FXJSE_FuncCallback callbackProc; |
}; |
-#define FXJSE_DEF_FUNCTION(functionName, functionCallback) \ |
- { functionName, functionCallback } |
-void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, |
- const FXJSE_FUNCTION* lpFunctions, |
- int nNum); |
+ |
struct FXJSE_PROPERTY { |
const FX_CHAR* name; |
FXJSE_PropAccessor getProc; |
FXJSE_PropAccessor setProc; |
}; |
-enum FXJSE_ClassPropTypes { |
- FXJSE_ClassPropType_None, |
- FXJSE_ClassPropType_Property, |
- FXJSE_ClassPropType_Method |
-}; |
+ |
struct FXJSE_CLASS { |
const FX_CHAR* name; |
FXJSE_FuncCallback constructor; |
@@ -92,13 +68,35 @@ struct FXJSE_CLASS { |
FXJSE_PropDeleter dynPropDeleter; |
FXJSE_FuncCallback dynMethodCall; |
}; |
+ |
+void FXJSE_Initialize(); |
+void FXJSE_Finalize(); |
+ |
+FXJSE_HRUNTIME FXJSE_Runtime_Create(); |
+void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime); |
+ |
+FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, |
+ const FXJSE_CLASS* lpGlobalClass = nullptr, |
+ void* lpGlobalObject = nullptr); |
+void FXJSE_Context_Release(FXJSE_HCONTEXT hContext); |
+FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext); |
+FXJSE_HRUNTIME FXJSE_Context_GetRuntime(FXJSE_HCONTEXT hContext); |
+ |
+void FXJSE_Context_EnableCompatibleMode(FXJSE_HCONTEXT hContext, |
+ FX_DWORD dwCompatibleFlags); |
+ |
+void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, |
+ const FXJSE_FUNCTION* lpFunctions, |
+ int nNum); |
FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, |
const FXJSE_CLASS* lpClass); |
FXJSE_HCLASS FXJSE_GetClass(FXJSE_HCONTEXT hContext, |
const CFX_ByteStringC& szName); |
+ |
FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime); |
void FXJSE_Value_Release(FXJSE_HVALUE hValue); |
FXJSE_HRUNTIME FXJSE_Value_GetRuntime(FXJSE_HVALUE hValue); |
+ |
FX_BOOL FXJSE_Value_IsUndefined(FXJSE_HVALUE hValue); |
FX_BOOL FXJSE_Value_IsNull(FXJSE_HVALUE hValue); |
FX_BOOL FXJSE_Value_IsBoolean(FXJSE_HVALUE hValue); |
@@ -109,12 +107,14 @@ FX_BOOL FXJSE_Value_IsObject(FXJSE_HVALUE hValue); |
FX_BOOL FXJSE_Value_IsArray(FXJSE_HVALUE hValue); |
FX_BOOL FXJSE_Value_IsFunction(FXJSE_HVALUE hValue); |
FX_BOOL FXJSE_Value_IsDate(FXJSE_HVALUE hValue); |
+ |
FX_BOOL FXJSE_Value_ToBoolean(FXJSE_HVALUE hValue); |
FX_FLOAT FXJSE_Value_ToFloat(FXJSE_HVALUE hValue); |
FXJSE_DOUBLE FXJSE_Value_ToDouble(FXJSE_HVALUE hValue); |
int32_t FXJSE_Value_ToInteger(FXJSE_HVALUE hValue); |
void FXJSE_Value_ToUTF8String(FXJSE_HVALUE hValue, CFX_ByteString& szStrOutput); |
void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, FXJSE_HCLASS hClass); |
+ |
void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue); |
void FXJSE_Value_SetNull(FXJSE_HVALUE hValue); |
void FXJSE_Value_SetBoolean(FXJSE_HVALUE hValue, FX_BOOL bBoolean); |
@@ -131,6 +131,7 @@ void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, |
FXJSE_HVALUE* rgValues); |
void FXJSE_Value_SetDate(FXJSE_HVALUE hValue, FXJSE_DOUBLE dDouble); |
void FXJSE_Value_Set(FXJSE_HVALUE hValue, FXJSE_HVALUE hOriginalValue); |
+ |
FX_BOOL FXJSE_Value_GetObjectProp(FXJSE_HVALUE hValue, |
const CFX_ByteStringC& szPropName, |
FXJSE_HVALUE hPropValue); |
@@ -151,6 +152,7 @@ FX_BOOL FXJSE_Value_ObjectHasOwnProp(FXJSE_HVALUE hValue, |
FX_BOOL FXJSE_Value_SetObjectOwnProp(FXJSE_HVALUE hValue, |
const CFX_ByteStringC& szPropName, |
FXJSE_HVALUE hPropValue); |
+ |
FX_BOOL FXJSE_Value_CallFunction(FXJSE_HVALUE hFunction, |
FXJSE_HVALUE hThis, |
FXJSE_HVALUE hRetValue, |
@@ -159,12 +161,15 @@ FX_BOOL FXJSE_Value_CallFunction(FXJSE_HVALUE hFunction, |
FX_BOOL FXJSE_Value_SetFunctionBind(FXJSE_HVALUE hValue, |
FXJSE_HVALUE hOldFunction, |
FXJSE_HVALUE hNewThis); |
+ |
FX_BOOL FXJSE_ExecuteScript(FXJSE_HCONTEXT hContext, |
const FX_CHAR* szScript, |
FXJSE_HVALUE hRetValue, |
FXJSE_HVALUE hNewThisObject = nullptr); |
+ |
void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, |
const CFX_ByteStringC& utf8Message); |
+ |
FX_BOOL FXJSE_ReturnValue_GetMessage(FXJSE_HVALUE hRetValue, |
CFX_ByteString& utf8Name, |
CFX_ByteString& utf8Message); |
@@ -172,4 +177,4 @@ FX_BOOL FXJSE_ReturnValue_GetLineInfo(FXJSE_HVALUE hRetValue, |
int32_t& nLine, |
int32_t& nCol); |
-#endif // XFA_INCLUDE_FXJSE_FXJSE_H_ |
+#endif // XFA_FXJSE_INCLUDE_FXJSE_H_ |