Json stl拓展完成

This commit is contained in:
2022-04-22 02:16:45 +08:00
parent bb87d4d3a9
commit 44ea52a10a
9 changed files with 250 additions and 42 deletions

View File

@@ -14,7 +14,7 @@ static realSqNewClosure* RealSqNewClosure = (realSqNewClosure*)0x135B850;
#define INIT_NUT_ADDRESS 0x135B850
static realSqNewClosure* MLnewclosure = nullptr;
// New槽
typedef int(SqNewSlot)(uint32_t v, int a, bool b);
typedef int(SqNewSlot)(uint32_t v, int a, BOOL b);
static SqNewSlot* SQNewSlot = (SqNewSlot*)0x135AA80;
// 平栈
typedef int(SqPopTop)(uint32_t v);
@@ -25,9 +25,55 @@ static SqPop* SQPop = (SqPop*)0x1358FD0;
//SQ_Get
typedef int(Sq_Get)(uint32_t v, int n);
static Sq_Get* SQ_Get = (Sq_Get*)0x135AE30;
//SQ_Get
#define _RT_NULL 0x00000001
#define _RT_INTEGER 0x00000002
#define _RT_FLOAT 0x00000004
#define _RT_BOOL 0x00000008
#define _RT_STRING 0x00000010
#define _RT_TABLE 0x00000020
#define _RT_ARRAY 0x00000040
#define _RT_USERDATA 0x00000080
#define _RT_CLOSURE 0x00000100
#define _RT_NATIVECLOSURE 0x00000200
#define _RT_GENERATOR 0x00000400
#define _RT_USERPOINTER 0x00000800
#define _RT_THREAD 0x00001000
#define _RT_FUNCPROTO 0x00002000
#define _RT_CLASS 0x00004000
#define _RT_INSTANCE 0x00008000
#define _RT_WEAKREF 0x00010000
#define SQOBJECT_REF_COUNTED 0x08000000
#define SQOBJECT_NUMERIC 0x04000000
#define SQOBJECT_DELEGABLE 0x02000000
#define SQOBJECT_CANBEFALSE 0x01000000
typedef enum tagSQObjectType {
OT_NULL = (_RT_NULL | SQOBJECT_CANBEFALSE),
OT_INTEGER = (_RT_INTEGER | SQOBJECT_NUMERIC | SQOBJECT_CANBEFALSE),
OT_FLOAT = (_RT_FLOAT | SQOBJECT_NUMERIC | SQOBJECT_CANBEFALSE),
OT_BOOL = (_RT_BOOL | SQOBJECT_CANBEFALSE),
OT_STRING = (_RT_STRING | SQOBJECT_REF_COUNTED),
OT_TABLE = (_RT_TABLE | SQOBJECT_REF_COUNTED | SQOBJECT_DELEGABLE),
OT_ARRAY = (_RT_ARRAY | SQOBJECT_REF_COUNTED),
OT_USERDATA = (_RT_USERDATA | SQOBJECT_REF_COUNTED | SQOBJECT_DELEGABLE),
OT_CLOSURE = (_RT_CLOSURE | SQOBJECT_REF_COUNTED),
OT_NATIVECLOSURE = (_RT_NATIVECLOSURE | SQOBJECT_REF_COUNTED),
OT_GENERATOR = (_RT_GENERATOR | SQOBJECT_REF_COUNTED),
OT_USERPOINTER = _RT_USERPOINTER,
OT_THREAD = (_RT_THREAD | SQOBJECT_REF_COUNTED),
OT_FUNCPROTO = (_RT_FUNCPROTO | SQOBJECT_REF_COUNTED), //internal usage only
OT_CLASS = (_RT_CLASS | SQOBJECT_REF_COUNTED),
OT_INSTANCE = (_RT_INSTANCE | SQOBJECT_REF_COUNTED | SQOBJECT_DELEGABLE),
OT_WEAKREF = (_RT_WEAKREF | SQOBJECT_REF_COUNTED)
}SQObjectType;
//SQ_GetType
typedef int(Sq_GetType)(uint32_t v, int n);
static Sq_GetType* SQ_GetType = (Sq_GetType*)0x1358CD0;
//SQ_Rawget
typedef int(Sq_Rawget)(uint32_t v, int n);
static Sq_Rawget* SQ_Rawget = (Sq_Rawget*)0x135AEA0;
@@ -47,10 +93,10 @@ static SQ_RemoveFunc* SQ_Remove = (SQ_RemoveFunc*)0x1359000;
typedef int(SqGetIntFunc)(uint32_t v, uint32_t stackIndex, int* sint);
static SqGetIntFunc* SQGetInt = (SqGetIntFunc*)0x1358D70;
//GetFloat
typedef int(SqGetFloatFunc)(uint32_t v, uint32_t stackIndex, float* sfloat);
typedef int(SqGetFloatFunc)(uint32_t v, uint32_t stackIndex, FLOAT* sfloat);
static SqGetFloatFunc* SQGetFloat = (SqGetFloatFunc*)0x1358DD0;
//GetBool
typedef int(SqGetBoolFunc)(uint32_t v, uint32_t stackIndex, bool* sbool);
typedef int(SqGetBoolFunc)(uint32_t v, uint32_t stackIndex, BOOL* sbool);
static SqGetBoolFunc* SQGetBool = (SqGetBoolFunc*)0x1358E30;
//GetString
typedef int(SqGetStringFunc)(uint32_t v, uint32_t stackIndex, wchar_t** sstring);
@@ -81,19 +127,19 @@ static SqPushStringFuncs* SQPushStringc = (SqPushStringFuncs*)0x1358A60;
typedef int(SqPushIntFunc)(uint32_t v, int sint);
static SqPushIntFunc* SQPushInt = (SqPushIntFunc*)0x1358AD0;
//PushBool
typedef int(SqPushBoolFunc)(uint32_t v, bool sbool);
typedef int(SqPushBoolFunc)(uint32_t v, BOOL sbool);
static SqPushBoolFunc* SQPushBool = (SqPushBoolFunc*)0x1358B10;
//PushFloat
typedef int(SqPushFloatFunc)(uint32_t v, float sfloat);
typedef int(SqPushFloatFunc)(uint32_t v, FLOAT sfloat);
static SqPushFloatFunc* SQPushFloat = (SqPushFloatFunc*)0x1358B60;
//SQLOADFILE
typedef void* (SQLOADFILEFunc)(uint32_t v, const wchar_t* filename, bool printerror);
typedef void* (SQLOADFILEFunc)(uint32_t v, const wchar_t* filename, BOOL printerror);
static SQLOADFILEFunc* SQLOADFILEF = (SQLOADFILEFunc*)0x13560E0;
//SQDOFILE
typedef void* (SQDOFILEFunc)(uint32_t v, const wchar_t* filename, bool retval, bool printerror);
typedef void* (SQDOFILEFunc)(uint32_t v, const wchar_t* filename, BOOL retval, BOOL printerror);
static SQDOFILEFunc* SQDOFILE = (SQDOFILEFunc*)0x1356240;
@@ -130,7 +176,7 @@ static SQ_ReadclosureFunc* SQ_Readclosure = (SQ_ReadclosureFunc*)0x1359460;
typedef int(SQ__FcloseFunc)(void* file);
static SQ__FcloseFunc* SQ__Fclose = (SQ__FcloseFunc*)0x1355E70;
//SQ_Compile
typedef int(SQ_CompileFunc)(uint32_t v, LSQLEXREADFUNC FUNC, void* file, const wchar_t* filename, bool printerror);
typedef int(SQ_CompileFunc)(uint32_t v, LSQLEXREADFUNC FUNC, void* file, const wchar_t* filename, BOOL printerror);
static SQ_CompileFunc* SQ_Compile = (SQ_CompileFunc*)0x135A390;
//SQ_Throwerror
typedef int(SQ_ThrowerrorFunc)(uint32_t v, const wchar_t* error);
@@ -146,8 +192,8 @@ private:
public://加载
static int SQloadfile(uint32_t v, const wchar_t* filename, bool printerror);
static int SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool printerror);
static int SQloadfile(uint32_t v, const wchar_t* filename, BOOL printerror);
static int SQdofile(uint32_t v, const wchar_t* filename, BOOL retval, BOOL printerror);
public://NUT API 接口
static int sq_Test(uint32_t v);//测试接口
@@ -183,6 +229,7 @@ public://
static int Set_STL(uint32_t v);//设置 类型容器
static int New_STL(uint32_t v);//new 类型容器
static int Timer_STL(uint32_t v);//时间容器
static int Jsoner_STL(uint32_t v);//时间容器
public://龙盒
static int Sync_Dragon_Pack(uint32_t v);//同步 龙盒数据包