mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
simplize prefix and inner arg length
This commit is contained in:
parent
2e9ff11b74
commit
a8a1c2831e
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(PikaObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classLoader, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
|
||||
int32_t obj_newObj(PikaObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int res = 0;
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
@ -160,8 +160,8 @@ static void set(PikaObj *self, Args *args)
|
||||
PikaObj *New_BaseObj(Args *args)
|
||||
{
|
||||
PikaObj *self = New_TinyObj(args);
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
class_defineMethod(self, "print(val:any)", print);
|
||||
class_defineMethod(self, "set(argPath:str, val:any)", set);
|
||||
return self;
|
||||
|
@ -218,7 +218,7 @@ int32_t obj_setObjWithoutClass(PikaObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(PikaObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -294,12 +294,12 @@ int32_t obj_set(PikaObj *self, char *argPath, char *valStr)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -316,8 +316,8 @@ PikaObj *removeMethodInfo(PikaObj *thisClass)
|
||||
PikaObj *obj_getClassObjByNewFun(PikaObj *context, char *name, NewFun newClassFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
PikaObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -334,7 +334,7 @@ char *obj_getClassPath(PikaObj *objHost, Args *buffs, char *objName)
|
||||
|
||||
void *getNewObjFunByClass(PikaObj *obj, char *classPath)
|
||||
{
|
||||
PikaObj *classLoader = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classLoader = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classLoader)
|
||||
{
|
||||
return NULL;
|
||||
@ -362,11 +362,11 @@ PikaObj *newRootObj(char *name, NewFun newObjFun)
|
||||
|
||||
static void removeClassLoader(PikaObj *obj)
|
||||
{
|
||||
PikaObj *classLoader = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classLoader = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classLoader)
|
||||
{
|
||||
obj_deinit(classLoader);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ PikaObj *initObj(PikaObj *obj, char *name)
|
||||
PikaObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -446,8 +446,8 @@ exit:
|
||||
void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -456,7 +456,7 @@ void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -465,7 +465,7 @@ static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
static void *getMethodPtr(PikaObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -19,17 +19,17 @@ PikaObj *New_TinyObj(Args *args)
|
||||
self->attributeList = New_args(NULL);
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
self->name = obj_getStr(self, "_n");
|
||||
return self;
|
||||
}
|
@ -92,7 +92,7 @@ void PikaStdLib_SysObj_type(PikaObj *self, char *argPath)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
PikaObj *objHost = obj_getPtr(self, "__context");
|
||||
PikaObj *objHost = obj_getPtr(self, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, self->name);
|
||||
if (NULL == objArg)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(PikaObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
PikaObj *classHost = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classHost = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classHost, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
|
||||
int32_t obj_newObj(PikaObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int res = 0;
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
@ -101,12 +101,12 @@ static void init_baseObj(PikaObj *self, Args *args)
|
||||
{
|
||||
/* attribute */
|
||||
/* object */
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
/*
|
||||
init classLoader now, in order to the
|
||||
find it after inited the self object.
|
||||
*/
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
|
||||
/* operation */
|
||||
|
||||
|
@ -218,7 +218,7 @@ int32_t obj_setObjWithoutClass(PikaObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(PikaObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -294,12 +294,12 @@ int32_t obj_set(PikaObj *self, char *argPath, char *valStr)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -316,8 +316,8 @@ PikaObj *removeMethodInfo(PikaObj *thisClass)
|
||||
PikaObj *obj_getClassObjByNewFun(PikaObj *context, char *name, NewFun newClassFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
PikaObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -334,7 +334,7 @@ char *obj_getClassPath(PikaObj *objHost, Args *buffs, char *objName)
|
||||
|
||||
void *getNewObjFunByClass(PikaObj *obj, char *classPath)
|
||||
{
|
||||
PikaObj *classHost = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classHost = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classHost)
|
||||
{
|
||||
return NULL;
|
||||
@ -362,11 +362,11 @@ PikaObj *newRootObj(char *name, NewFun newObjFun)
|
||||
|
||||
static void removeClassLoader(PikaObj *obj)
|
||||
{
|
||||
PikaObj *classObj = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classObj = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classObj)
|
||||
{
|
||||
obj_deinit(classObj);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ PikaObj *initObj(PikaObj *obj, char *name)
|
||||
PikaObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -446,8 +446,8 @@ exit:
|
||||
void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -456,7 +456,7 @@ void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -465,7 +465,7 @@ static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
static void *getMethodPtr(PikaObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -28,7 +28,7 @@ static void type(PikaObj *obj, Args *args)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
PikaObj *objHost = obj_getPtr(obj, "__context");
|
||||
PikaObj *objHost = obj_getPtr(obj, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, obj->name);
|
||||
if (NULL == objArg)
|
||||
{
|
||||
@ -187,12 +187,12 @@ static void print(PikaObj *obj, Args *args)
|
||||
int32_t loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -19,17 +19,17 @@ PikaObj *New_TinyObj(Args *args)
|
||||
self->attributeList = New_args(NULL);
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
self->name = obj_getStr(self, "_n");
|
||||
return self;
|
||||
}
|
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(PikaObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
PikaObj *classHost = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classHost = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classHost, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
|
||||
int32_t obj_newObj(PikaObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int res = 0;
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
@ -101,12 +101,12 @@ static void init_baseObj(PikaObj *self, Args *args)
|
||||
{
|
||||
/* attribute */
|
||||
/* object */
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
/*
|
||||
init classLoader now, in order to the
|
||||
find it after inited the self object.
|
||||
*/
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
|
||||
/* operation */
|
||||
|
||||
|
@ -218,7 +218,7 @@ int32_t obj_setObjWithoutClass(PikaObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(PikaObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -294,12 +294,12 @@ int32_t obj_set(PikaObj *self, char *argPath, char *valStr)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -316,8 +316,8 @@ PikaObj *removeMethodInfo(PikaObj *thisClass)
|
||||
PikaObj *obj_getClassObjByNewFun(PikaObj *context, char *name, NewFun newClassFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
PikaObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -334,7 +334,7 @@ char *obj_getClassPath(PikaObj *objHost, Args *buffs, char *objName)
|
||||
|
||||
void *getNewObjFunByClass(PikaObj *obj, char *classPath)
|
||||
{
|
||||
PikaObj *classHost = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classHost = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classHost)
|
||||
{
|
||||
return NULL;
|
||||
@ -362,11 +362,11 @@ PikaObj *newRootObj(char *name, NewFun newObjFun)
|
||||
|
||||
static void removeClassLoader(PikaObj *obj)
|
||||
{
|
||||
PikaObj *classObj = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classObj = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classObj)
|
||||
{
|
||||
obj_deinit(classObj);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ PikaObj *initObj(PikaObj *obj, char *name)
|
||||
PikaObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -446,8 +446,8 @@ exit:
|
||||
void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -456,7 +456,7 @@ void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -465,7 +465,7 @@ static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
static void *getMethodPtr(PikaObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -28,7 +28,7 @@ static void type(PikaObj *obj, Args *args)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
PikaObj *objHost = obj_getPtr(obj, "__context");
|
||||
PikaObj *objHost = obj_getPtr(obj, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, obj->name);
|
||||
if (NULL == objArg)
|
||||
{
|
||||
@ -187,12 +187,12 @@ static void print(PikaObj *obj, Args *args)
|
||||
int32_t loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -19,17 +19,17 @@ PikaObj *New_TinyObj(Args *args)
|
||||
self->attributeList = New_args(NULL);
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
self->name = obj_getStr(self, "_n");
|
||||
return self;
|
||||
}
|
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(PikaObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
PikaObj *classHost = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classHost = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classHost, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
|
||||
int32_t obj_newObj(PikaObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int res = 0;
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
@ -101,12 +101,12 @@ static void init_baseObj(PikaObj *self, Args *args)
|
||||
{
|
||||
/* attribute */
|
||||
/* object */
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
/*
|
||||
init classLoader now, in order to the
|
||||
find it after inited the self object.
|
||||
*/
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
|
||||
/* operation */
|
||||
|
||||
|
@ -218,7 +218,7 @@ int32_t obj_setObjWithoutClass(PikaObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(PikaObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -294,12 +294,12 @@ int32_t obj_set(PikaObj *self, char *argPath, char *valStr)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -316,8 +316,8 @@ PikaObj *removeMethodInfo(PikaObj *thisClass)
|
||||
PikaObj *obj_getClassObjByNewFun(PikaObj *context, char *name, NewFun newClassFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
PikaObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -334,7 +334,7 @@ char *obj_getClassPath(PikaObj *objHost, Args *buffs, char *objName)
|
||||
|
||||
void *getNewObjFunByClass(PikaObj *obj, char *classPath)
|
||||
{
|
||||
PikaObj *classHost = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classHost = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classHost)
|
||||
{
|
||||
return NULL;
|
||||
@ -362,11 +362,11 @@ PikaObj *newRootObj(char *name, NewFun newObjFun)
|
||||
|
||||
static void removeClassLoader(PikaObj *obj)
|
||||
{
|
||||
PikaObj *classObj = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classObj = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classObj)
|
||||
{
|
||||
obj_deinit(classObj);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ PikaObj *initObj(PikaObj *obj, char *name)
|
||||
PikaObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -446,8 +446,8 @@ exit:
|
||||
void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -456,7 +456,7 @@ void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -465,7 +465,7 @@ static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
static void *getMethodPtr(PikaObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -28,7 +28,7 @@ static void type(PikaObj *obj, Args *args)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
PikaObj *objHost = obj_getPtr(obj, "__context");
|
||||
PikaObj *objHost = obj_getPtr(obj, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, obj->name);
|
||||
if (NULL == objArg)
|
||||
{
|
||||
@ -187,12 +187,12 @@ static void print(PikaObj *obj, Args *args)
|
||||
int32_t loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -19,17 +19,17 @@ PikaObj *New_TinyObj(Args *args)
|
||||
self->attributeList = New_args(NULL);
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
self->name = obj_getStr(self, "_n");
|
||||
return self;
|
||||
}
|
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(PikaObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
PikaObj *classHost = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classHost = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classHost, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
|
||||
int32_t obj_newObj(PikaObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int res = 0;
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
@ -101,12 +101,12 @@ static void init_baseObj(PikaObj *self, Args *args)
|
||||
{
|
||||
/* attribute */
|
||||
/* object */
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
/*
|
||||
init classLoader now, in order to the
|
||||
find it after inited the self object.
|
||||
*/
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
|
||||
/* operation */
|
||||
|
||||
|
@ -218,7 +218,7 @@ int32_t obj_setObjWithoutClass(PikaObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(PikaObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -294,12 +294,12 @@ int32_t obj_set(PikaObj *self, char *argPath, char *valStr)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -316,8 +316,8 @@ PikaObj *removeMethodInfo(PikaObj *thisClass)
|
||||
PikaObj *obj_getClassObjByNewFun(PikaObj *context, char *name, NewFun newClassFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
PikaObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -334,7 +334,7 @@ char *obj_getClassPath(PikaObj *objHost, Args *buffs, char *objName)
|
||||
|
||||
void *getNewObjFunByClass(PikaObj *obj, char *classPath)
|
||||
{
|
||||
PikaObj *classHost = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classHost = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classHost)
|
||||
{
|
||||
return NULL;
|
||||
@ -362,11 +362,11 @@ PikaObj *newRootObj(char *name, NewFun newObjFun)
|
||||
|
||||
static void removeClassLoader(PikaObj *obj)
|
||||
{
|
||||
PikaObj *classObj = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classObj = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classObj)
|
||||
{
|
||||
obj_deinit(classObj);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ PikaObj *initObj(PikaObj *obj, char *name)
|
||||
PikaObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -446,8 +446,8 @@ exit:
|
||||
void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -456,7 +456,7 @@ void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -465,7 +465,7 @@ static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
static void *getMethodPtr(PikaObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -28,7 +28,7 @@ static void type(PikaObj *obj, Args *args)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
PikaObj *objHost = obj_getPtr(obj, "__context");
|
||||
PikaObj *objHost = obj_getPtr(obj, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, obj->name);
|
||||
if (NULL == objArg)
|
||||
{
|
||||
@ -187,12 +187,12 @@ static void print(PikaObj *obj, Args *args)
|
||||
int32_t loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -19,17 +19,17 @@ PikaObj *New_TinyObj(Args *args)
|
||||
self->attributeList = New_args(NULL);
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
self->name = obj_getStr(self, "_n");
|
||||
return self;
|
||||
}
|
@ -314,12 +314,12 @@ int obj_set(MimiObj *self, char *argPath, char *valStr)
|
||||
|
||||
int removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -466,8 +466,8 @@ exit:
|
||||
void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -476,7 +476,7 @@ void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -485,7 +485,7 @@ static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
static void *getMethodPtr(MimiObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -185,12 +185,12 @@ static void print(MimiObj *obj, Args *args)
|
||||
int loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -314,12 +314,12 @@ int obj_set(MimiObj *self, char *argPath, char *valStr)
|
||||
|
||||
int removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -466,8 +466,8 @@ exit:
|
||||
void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -476,7 +476,7 @@ void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -485,7 +485,7 @@ static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
static void *getMethodPtr(MimiObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -185,12 +185,12 @@ static void print(MimiObj *obj, Args *args)
|
||||
int loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(MimiObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
MimiObj *classHost = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classHost = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classHost, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(MimiObj *self, char *className, void *classPtr)
|
||||
{
|
||||
MimiObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(MimiObj *self, char *className, void *classPtr)
|
||||
|
||||
int32_t obj_newObj(MimiObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
MimiObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
if (NULL == NewObjPtr)
|
||||
@ -91,12 +91,12 @@ static void init_baseObj(MimiObj *self, Args *args)
|
||||
{
|
||||
/* attribute */
|
||||
/* object */
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
/*
|
||||
init classLoader now, in order to the
|
||||
find it after inited the self object.
|
||||
*/
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
|
||||
/* operation */
|
||||
|
||||
|
@ -230,7 +230,7 @@ int32_t obj_setObjWithoutClass(MimiObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(MimiObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -306,12 +306,12 @@ int32_t obj_set(MimiObj *self, char *argPath, char *valStr)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -328,8 +328,8 @@ MimiObj *removeMethodInfo(MimiObj *thisClass)
|
||||
MimiObj *obj_getClassObjByNewFun(MimiObj *context, char *name, void *(*newClassFun)(Args *initArgs))
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
MimiObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -346,7 +346,7 @@ char *obj_getClassPath(MimiObj *objHost, Args *buffs, char *objName)
|
||||
|
||||
void *getNewObjFunByClass(MimiObj *obj, char *classPath)
|
||||
{
|
||||
MimiObj *classHost = args_getPtr(obj->attributeList, "__classLoader");
|
||||
MimiObj *classHost = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classHost)
|
||||
{
|
||||
return NULL;
|
||||
@ -374,11 +374,11 @@ MimiObj *newRootObj(char *name, void *newObjFun)
|
||||
|
||||
static void removeClassLoader(MimiObj *obj)
|
||||
{
|
||||
MimiObj *classObj = args_getPtr(obj->attributeList, "__classLoader");
|
||||
MimiObj *classObj = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classObj)
|
||||
{
|
||||
obj_deinit(classObj);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ MimiObj *initObj(MimiObj *obj, char *name)
|
||||
MimiObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -458,8 +458,8 @@ exit:
|
||||
void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -468,7 +468,7 @@ void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -477,7 +477,7 @@ static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
static void *getMethodPtr(MimiObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -28,7 +28,7 @@ static void type(MimiObj *obj, Args *args)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
MimiObj *objHost = obj_getPtr(obj, "__context");
|
||||
MimiObj *objHost = obj_getPtr(obj, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, obj->name);
|
||||
if (NULL == objArg)
|
||||
{
|
||||
@ -186,12 +186,12 @@ static void print(MimiObj *obj, Args *args)
|
||||
int32_t loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -31,17 +31,17 @@ MimiObj *New_TinyObj(Args *args)
|
||||
self->_beforDinit = _beforDinit;
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
self->name = obj_getStr(self, "_n");
|
||||
return self;
|
||||
}
|
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(MimiObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
MimiObj *classHost = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classHost = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classHost, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(MimiObj *self, char *className, void *classPtr)
|
||||
{
|
||||
MimiObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(MimiObj *self, char *className, void *classPtr)
|
||||
|
||||
int32_t obj_newObj(MimiObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
MimiObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
if (NULL == NewObjPtr)
|
||||
@ -91,12 +91,12 @@ static void init_baseObj(MimiObj *self, Args *args)
|
||||
{
|
||||
/* attribute */
|
||||
/* object */
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
/*
|
||||
init classLoader now, in order to the
|
||||
find it after inited the self object.
|
||||
*/
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
|
||||
/* operation */
|
||||
|
||||
|
@ -230,7 +230,7 @@ int32_t obj_setObjWithoutClass(MimiObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(MimiObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -306,12 +306,12 @@ int32_t obj_set(MimiObj *self, char *argPath, char *valStr)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -328,8 +328,8 @@ MimiObj *removeMethodInfo(MimiObj *thisClass)
|
||||
MimiObj *obj_getClassObjByNewFun(MimiObj *context, char *name, void *(*newClassFun)(Args *initArgs))
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
MimiObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -346,7 +346,7 @@ char *obj_getClassPath(MimiObj *objHost, Args *buffs, char *objName)
|
||||
|
||||
void *getNewObjFunByClass(MimiObj *obj, char *classPath)
|
||||
{
|
||||
MimiObj *classHost = args_getPtr(obj->attributeList, "__classLoader");
|
||||
MimiObj *classHost = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classHost)
|
||||
{
|
||||
return NULL;
|
||||
@ -374,11 +374,11 @@ MimiObj *newRootObj(char *name, void *newObjFun)
|
||||
|
||||
static void removeClassLoader(MimiObj *obj)
|
||||
{
|
||||
MimiObj *classObj = args_getPtr(obj->attributeList, "__classLoader");
|
||||
MimiObj *classObj = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classObj)
|
||||
{
|
||||
obj_deinit(classObj);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ MimiObj *initObj(MimiObj *obj, char *name)
|
||||
MimiObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -458,8 +458,8 @@ exit:
|
||||
void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -468,7 +468,7 @@ void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -477,7 +477,7 @@ static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
static void *getMethodPtr(MimiObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -28,7 +28,7 @@ static void type(MimiObj *obj, Args *args)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
MimiObj *objHost = obj_getPtr(obj, "__context");
|
||||
MimiObj *objHost = obj_getPtr(obj, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, obj->name);
|
||||
if (NULL == objArg)
|
||||
{
|
||||
@ -186,12 +186,12 @@ static void print(MimiObj *obj, Args *args)
|
||||
int32_t loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -31,17 +31,17 @@ MimiObj *New_TinyObj(Args *args)
|
||||
self->_beforDinit = _beforDinit;
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
self->name = obj_getStr(self, "_n");
|
||||
return self;
|
||||
}
|
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(MimiObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
MimiObj *classHost = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classHost = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classHost, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(MimiObj *self, char *className, void *classPtr)
|
||||
{
|
||||
MimiObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(MimiObj *self, char *className, void *classPtr)
|
||||
|
||||
int32_t obj_newObj(MimiObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
MimiObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
MimiObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
if (NULL == NewObjPtr)
|
||||
@ -91,12 +91,12 @@ static void init_baseObj(MimiObj *self, Args *args)
|
||||
{
|
||||
/* attribute */
|
||||
/* object */
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
/*
|
||||
init classLoader now, in order to the
|
||||
find it after inited the self object.
|
||||
*/
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
|
||||
/* operation */
|
||||
|
||||
|
@ -230,7 +230,7 @@ int32_t obj_setObjWithoutClass(MimiObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(MimiObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -306,12 +306,12 @@ int32_t obj_set(MimiObj *self, char *argPath, char *valStr)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -328,8 +328,8 @@ MimiObj *removeMethodInfo(MimiObj *thisClass)
|
||||
MimiObj *obj_getClassObjByNewFun(MimiObj *context, char *name, void *(*newClassFun)(Args *initArgs))
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
MimiObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -346,7 +346,7 @@ char *obj_getClassPath(MimiObj *objHost, Args *buffs, char *objName)
|
||||
|
||||
void *getNewObjFunByClass(MimiObj *obj, char *classPath)
|
||||
{
|
||||
MimiObj *classHost = args_getPtr(obj->attributeList, "__classLoader");
|
||||
MimiObj *classHost = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classHost)
|
||||
{
|
||||
return NULL;
|
||||
@ -374,11 +374,11 @@ MimiObj *newRootObj(char *name, void *newObjFun)
|
||||
|
||||
static void removeClassLoader(MimiObj *obj)
|
||||
{
|
||||
MimiObj *classObj = args_getPtr(obj->attributeList, "__classLoader");
|
||||
MimiObj *classObj = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classObj)
|
||||
{
|
||||
obj_deinit(classObj);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ MimiObj *initObj(MimiObj *obj, char *name)
|
||||
MimiObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -458,8 +458,8 @@ exit:
|
||||
void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -468,7 +468,7 @@ void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -477,7 +477,7 @@ static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
static void *getMethodPtr(MimiObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -28,7 +28,7 @@ static void type(MimiObj *obj, Args *args)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
MimiObj *objHost = obj_getPtr(obj, "__context");
|
||||
MimiObj *objHost = obj_getPtr(obj, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, obj->name);
|
||||
if (NULL == objArg)
|
||||
{
|
||||
@ -186,12 +186,12 @@ static void print(MimiObj *obj, Args *args)
|
||||
int32_t loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -31,17 +31,17 @@ MimiObj *New_TinyObj(Args *args)
|
||||
self->_beforDinit = _beforDinit;
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
self->name = obj_getStr(self, "_n");
|
||||
return self;
|
||||
}
|
@ -314,12 +314,12 @@ int obj_set(MimiObj *self, char *argPath, char *valStr)
|
||||
|
||||
int removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -466,8 +466,8 @@ exit:
|
||||
void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
@ -476,7 +476,7 @@ void loadMethodInfo(MimiObj *methodHost, char *methodName, char *methodDeclearat
|
||||
static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -485,7 +485,7 @@ static char *getMethodDeclearation(MimiObj *obj, char *methodName)
|
||||
static void *getMethodPtr(MimiObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
|
@ -185,12 +185,12 @@ static void print(MimiObj *obj, Args *args)
|
||||
int loadExceptMethod(Arg *argEach, Args *handleArgs)
|
||||
{
|
||||
char *argName = arg_getName(argEach);
|
||||
if (strIsStartWith(argName, "[methodDec]"))
|
||||
if (strIsStartWith(argName, "[md]"))
|
||||
{
|
||||
/* skip method declearation */
|
||||
// return 0;
|
||||
}
|
||||
if (strIsStartWith(argName, "[methodPtr]"))
|
||||
if (strIsStartWith(argName, "[mp]"))
|
||||
{
|
||||
/* skip method pointer */
|
||||
// return 0;
|
||||
|
@ -30,7 +30,7 @@ int32_t sysObj_setObjbyClass(PikaObj *self, char *objName, char *classPath)
|
||||
{
|
||||
/* class means subprocess init */
|
||||
Args *buffs = New_strBuff();
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
void *newFunPtr = getClassPtr(classLoader, classPath);
|
||||
|
||||
/* class means subprocess init */
|
||||
@ -63,7 +63,7 @@ exit:
|
||||
|
||||
int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int32_t res = storeClassInfo(classLoader, buffs, className, classPtr);
|
||||
args_deinit(buffs);
|
||||
@ -72,7 +72,7 @@ int32_t obj_import(PikaObj *self, char *className, NewFun classPtr)
|
||||
|
||||
int32_t obj_newObj(PikaObj *self, char *objPath, char *classPath)
|
||||
{
|
||||
PikaObj *classLoader = obj_getObj(self, "__classLoader", 0);
|
||||
PikaObj *classLoader = obj_getObj(self, "_clsld", 0);
|
||||
Args *buffs = New_args(NULL);
|
||||
int res = 0;
|
||||
void *NewObjPtr = getClassPtr(classLoader, classPath);
|
||||
@ -160,8 +160,8 @@ static void set(PikaObj *self, Args *args)
|
||||
PikaObj *New_BaseObj(Args *args)
|
||||
{
|
||||
PikaObj *self = New_TinyObj(args);
|
||||
obj_setObjWithoutClass(self, "__classLoader", New_TinyObj);
|
||||
obj_getObj(self, "__classLoader", 0);
|
||||
obj_setObjWithoutClass(self, "_clsld", New_TinyObj);
|
||||
obj_getObj(self, "_clsld", 0);
|
||||
class_defineMethod(self, "print(val:any)", print);
|
||||
class_defineMethod(self, "set(argPath:str, val:any)", set);
|
||||
return self;
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include "dataStrs.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
|
||||
char *getDirectStr(Args *buffs, char *argPath)
|
||||
{
|
||||
char *directStr = NULL;
|
||||
@ -158,9 +156,6 @@ char *getTypeVal(Args *buffs, char *typeToken)
|
||||
return strsGetLastToken(buffs, typeToken, ':');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void transferReturnVal(PikaObj *self, char *returnType, char *returnName, Args *args)
|
||||
{
|
||||
if (strEqu("->int", returnType))
|
||||
@ -180,7 +175,6 @@ static void transferReturnVal(PikaObj *self, char *returnType, char *returnName,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Args *getArgsByNameMatch(PikaObj *self, char *typeList, char *argList)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
@ -268,8 +262,6 @@ static Args *getArgsBySort(PikaObj *self, char *typeList, char *argList)
|
||||
return args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Args *getArgsBySentence(PikaObj *self, char *typeList, char *argList)
|
||||
{
|
||||
if (strIsContain(argList, '='))
|
||||
@ -282,7 +274,7 @@ static Args *getArgsBySentence(PikaObj *self, char *typeList, char *argList)
|
||||
static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
char *res = obj_getStr(obj, methodDeclearationPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -291,7 +283,7 @@ static char *getMethodDeclearation(PikaObj *obj, char *methodName)
|
||||
static void *getMethodPtr(PikaObj *methodHost, char *methodName)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
void *res = obj_getPtr(methodHost, methodPtrPath);
|
||||
args_deinit(buffs);
|
||||
return res;
|
||||
@ -323,7 +315,6 @@ static char *getCleanCmd(Args *buffs, char *cmd)
|
||||
return strOut;
|
||||
}
|
||||
|
||||
|
||||
char *getMethodPath(Args *buffs, char *methodToken)
|
||||
{
|
||||
if (strIsContain(methodToken, '='))
|
||||
@ -359,7 +350,7 @@ Args *obj_invoke(PikaObj *self, char *cmd)
|
||||
char *methodName = strsGetLastToken(buffs, methodPath, '.');
|
||||
|
||||
void *classPtr = obj_getPtr(methodHostObj, "__classPtr");
|
||||
char *methodHostClassName = strsAppend(buffs, "classObj-", methodHostObj->name);
|
||||
char *methodHostClassName = strsAppend(buffs, "classObj-", obj_getStr(methodHostObj, "_n"));
|
||||
methodHostClass = obj_getClassObjByNewFun(methodHostObj, methodHostClassName, classPtr);
|
||||
/* get method Ptr */
|
||||
void (*methodPtr)(PikaObj * self, Args * args) = getMethodPtr(methodHostClass, methodName);
|
@ -3,12 +3,12 @@
|
||||
#include "dataMemory.h"
|
||||
#include "dataString.h"
|
||||
#include "dataStrs.h"
|
||||
#include "invoke.h"
|
||||
#include "PikaInvoke.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
void *getNewObjFunByClass(PikaObj *obj, char *classPath)
|
||||
{
|
||||
PikaObj *classLoader = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classLoader = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL == classLoader)
|
||||
{
|
||||
return NULL;
|
||||
@ -230,7 +230,7 @@ int32_t obj_setObjWithoutClass(PikaObj *self, char *objName, void *newFun)
|
||||
int32_t obj_addOther(PikaObj *self, char *subObjectName, void *new_ObjectFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", self);
|
||||
args_setPtr(initArgs, "_ctx", self);
|
||||
void *(*new_Object)(Args * initArgs) = (void *(*)(Args *))new_ObjectFun;
|
||||
void *subObject = new_Object(initArgs);
|
||||
obj_setPtr(self, subObjectName, subObject);
|
||||
@ -307,8 +307,8 @@ int32_t obj_set(PikaObj *self, char *argPath, char *valStr)
|
||||
PikaObj *obj_getClassObjByNewFun(PikaObj *context, char *name, NewFun newClassFun)
|
||||
{
|
||||
Args *initArgs = New_args(NULL);
|
||||
args_setPtr(initArgs, "__context", context);
|
||||
args_setStr(initArgs, "__name", name);
|
||||
args_setPtr(initArgs, "_ctx", context);
|
||||
args_setStr(initArgs, "_n", name);
|
||||
PikaObj *thisClass = newClassFun(initArgs);
|
||||
obj_setPtr(thisClass, "__classPtr", newClassFun);
|
||||
args_deinit(initArgs);
|
||||
@ -335,12 +335,12 @@ void *getNewClassObjFunByName(PikaObj *obj, char *name)
|
||||
|
||||
int32_t removeEachMethodInfo(Arg *argNow, Args *argList)
|
||||
{
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodDec]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[md]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
}
|
||||
if (strIsStartWith(arg_getName(argNow), "[methodPtr]"))
|
||||
if (strIsStartWith(arg_getName(argNow), "[mp]"))
|
||||
{
|
||||
args_removeArg(argList, arg_getName(argNow));
|
||||
return 0;
|
||||
@ -356,11 +356,11 @@ PikaObj *removeMethodInfo(PikaObj *thisClass)
|
||||
|
||||
static void removeClassLoader(PikaObj *obj)
|
||||
{
|
||||
PikaObj *classLoader = args_getPtr(obj->attributeList, "__classLoader");
|
||||
PikaObj *classLoader = args_getPtr(obj->attributeList, "_clsld");
|
||||
if (NULL != classLoader)
|
||||
{
|
||||
obj_deinit(classLoader);
|
||||
args_removeArg(obj->attributeList, "__classLoader");
|
||||
args_removeArg(obj->attributeList, "_clsld");
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ PikaObj *initObj(PikaObj *obj, char *name)
|
||||
PikaObj *newObj = removeMethodInfo(thisClass);
|
||||
/* delete [mate]<objName> */
|
||||
obj_removeArg(obj, strsAppend(buffs, "[mate]", name));
|
||||
/* delete "__classLoader" object */
|
||||
/* delete "_clsld" object */
|
||||
removeClassLoader(newObj);
|
||||
|
||||
char *type = args_getType(obj->attributeList, name);
|
||||
@ -447,8 +447,8 @@ exit:
|
||||
void loadMethodInfo(PikaObj *methodHost, char *methodName, char *methodDeclearation, void *methodPtr)
|
||||
{
|
||||
Args *buffs = New_strBuff();
|
||||
char *methodPtrPath = strsAppend(buffs, "[methodPtr]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[methodDec]", methodName);
|
||||
char *methodPtrPath = strsAppend(buffs, "[mp]", methodName);
|
||||
char *methodDeclearationPath = strsAppend(buffs, "[md]", methodName);
|
||||
obj_setPtr(methodHost, methodPtrPath, methodPtr);
|
||||
obj_setStr(methodHost, methodDeclearationPath, methodDeclearation);
|
||||
args_deinit(buffs);
|
||||
|
@ -12,7 +12,6 @@ struct PikaObj_t
|
||||
{
|
||||
/* list */
|
||||
Args *attributeList;
|
||||
char *name;
|
||||
};
|
||||
|
||||
/* operation */
|
||||
|
@ -18,17 +18,16 @@ PikaObj *New_TinyObj(Args *args)
|
||||
self->attributeList = New_args(NULL);
|
||||
|
||||
/* attribute */
|
||||
obj_setPtr(self, "__context", self);
|
||||
obj_setStr(self, "__name", "root");
|
||||
obj_setPtr(self, "_ctx", self);
|
||||
obj_setStr(self, "_n", "root");
|
||||
|
||||
/* load */
|
||||
if (NULL != args)
|
||||
{
|
||||
obj_load(self, args, "__name");
|
||||
obj_load(self, args, "__context");
|
||||
obj_load(self, args, "_n");
|
||||
obj_load(self, args, "_ctx");
|
||||
}
|
||||
|
||||
/* hard attribute */
|
||||
self->name = obj_getStr(self, "__name");
|
||||
return self;
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ void PikaStdLib_SysObj_type(PikaObj *self, char *argPath)
|
||||
if (NULL == argPath)
|
||||
{
|
||||
/* no input obj path, use current obj */
|
||||
PikaObj *objHost = obj_getPtr(self, "__context");
|
||||
Arg *objArg = obj_getArg(objHost, self->name);
|
||||
PikaObj *objHost = obj_getPtr(self, "_ctx");
|
||||
Arg *objArg = obj_getArg(objHost, obj_getStr(self, "_n"));
|
||||
if (NULL == objArg)
|
||||
{
|
||||
obj_setSysOut(self, "[error] type: arg no found.");
|
||||
@ -112,4 +112,3 @@ void PikaStdLib_SysObj_type(PikaObj *self, char *argPath)
|
||||
}
|
||||
obj_setSysOut(self, arg_getType(arg));
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ void hello2(PikaObj *obj, Args *args)
|
||||
char *name1 = args_getStr(args, (char *)"name1");
|
||||
char *name2 = args_getStr(args, (char *)"name2");
|
||||
char *name3 = args_getStr(args, (char *)"name3");
|
||||
char *myName = obj->name;
|
||||
char *myName = obj_getStr(obj, (char *)"_n");
|
||||
int32_t isShow = args_getInt(args, (char *)"isShow");
|
||||
if (isShow)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user