diff --git a/package/PikaStdLib/PikaStdData_List.c b/package/PikaStdLib/PikaStdData_List.c index 60c200c77..329cee37c 100644 --- a/package/PikaStdLib/PikaStdData_List.c +++ b/package/PikaStdLib/PikaStdData_List.c @@ -68,7 +68,7 @@ void PikaStdData_List_reverse(PikaObj* self) { } PikaObj* PikaStdData_List___add__(PikaObj* self, PikaObj* others) { - PikaObj* res = New_pikaList(); + PikaObj* res = New_PikaList(); for (size_t i = 0; i < pikaList_getSize(self); i++) { Arg* arg = pikaList_get(self, i); pikaList_append(res, arg_copy(arg)); diff --git a/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdData_List.c b/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdData_List.c index 60c200c77..329cee37c 100644 --- a/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdData_List.c +++ b/port/linux/package/pikascript/pikascript-lib/PikaStdLib/PikaStdData_List.c @@ -68,7 +68,7 @@ void PikaStdData_List_reverse(PikaObj* self) { } PikaObj* PikaStdData_List___add__(PikaObj* self, PikaObj* others) { - PikaObj* res = New_pikaList(); + PikaObj* res = New_PikaList(); for (size_t i = 0; i < pikaList_getSize(self); i++) { Arg* arg = pikaList_get(self, i); pikaList_append(res, arg_copy(arg)); diff --git a/port/linux/package/pikascript/pikascript-lib/json/_json.c b/port/linux/package/pikascript/pikascript-lib/json/_json.c index e90110b91..4e92a6ab9 100644 --- a/port/linux/package/pikascript/pikascript-lib/json/_json.c +++ b/port/linux/package/pikascript/pikascript-lib/json/_json.c @@ -91,7 +91,7 @@ Arg* json_encode_jsmn(jsmntok_t* t, break; } case JSMN_OBJECT: { - PikaObj* ret = New_pikaDict(); + PikaObj* ret = New_PikaDict(); int num_keys = t[*index].size; for (int i = 0; i < num_keys; i++) { (*index)++; diff --git a/port/linux/package/pikascript/pikascript-lib/pika_lua/_pika_lua.c b/port/linux/package/pikascript/pikascript-lib/pika_lua/_pika_lua.c index 4722648ff..d0df22b91 100644 --- a/port/linux/package/pikascript/pikascript-lib/pika_lua/_pika_lua.c +++ b/port/linux/package/pikascript/pikascript-lib/pika_lua/_pika_lua.c @@ -51,10 +51,10 @@ Arg* _lua_val_to_arg(lua_State* L) { // 'key' is at index -2 and 'value' at index -1 if (!get_list && !get_dict) { if (lua_isinteger(L, -2)) { - ret = New_pikaList(); + ret = New_PikaList(); get_list = PIKA_TRUE; } else { - ret = New_pikaDict(); + ret = New_PikaDict(); get_dict = PIKA_TRUE; } } diff --git a/port/linux/package/pikascript/pikascript-lib/re/re-api-adapter.c b/port/linux/package/pikascript/pikascript-lib/re/re-api-adapter.c index c14af9d06..d924fa4dc 100644 --- a/port/linux/package/pikascript/pikascript-lib/re/re-api-adapter.c +++ b/port/linux/package/pikascript/pikascript-lib/re/re-api-adapter.c @@ -769,10 +769,10 @@ PikaObj* __findall(void* pattern__or__re, if (!vcs) { if (m_n < 0) return NULL; - Any list = New_pikaList(); + Any list = New_PikaList(); return list; } - Any list = New_pikaList(); + Any list = New_PikaList(); PikaTuple* tu; if (brackets == 1) { for (int i = 0; i < m_n; i++) { diff --git a/src/PikaObj.c b/src/PikaObj.c index 58678d7e9..0af187134 100644 --- a/src/PikaObj.c +++ b/src/PikaObj.c @@ -3325,7 +3325,7 @@ Arg* builtins_list(PikaObj* self, PikaTuple* val) { Arg* builtins_dict(PikaObj* self, PikaTuple* val) { #if PIKA_BUILTIN_STRUCT_ENABLE - return arg_newObj(New_pikaDict()); + return arg_newObj(New_PikaDict()); #else obj_setErrorCode(self, 1); __platform_printf("[Error] built-in dist is not enabled.\r\n"); @@ -3516,7 +3516,7 @@ PikaObj* builtins_dir(PikaObj* self, Arg* arg) { } PikaObj* obj = arg_getPtr(arg); PikaObj* New_PikaStdData_List(Args * args); - PikaObj* list = New_pikaList(); + PikaObj* list = New_PikaList(); Args* context = New_args(NULL); args_setPtr(context, "_list", list); args_foreach(obj->list, __dir_each, context); @@ -4069,7 +4069,7 @@ PikaObj* _New_pikaListOrTuple(int isTuple) { return self; } -PikaList* New_pikaList(void) { +PikaList* New_PikaList(void) { return _New_pikaListOrTuple(0); } @@ -4084,7 +4084,7 @@ void pikaDict_init(PikaObj* self) { obj_setPtr(self, "_keys", keys); } -PikaDict* New_pikaDict(void) { +PikaDict* New_PikaDict(void) { PikaDict* self = newNormalObj(New_PikaStdData_Dict); pikaDict_init(self); return self; diff --git a/src/PikaObj.h b/src/PikaObj.h index 42911badd..655996b11 100644 --- a/src/PikaObj.h +++ b/src/PikaObj.h @@ -441,25 +441,25 @@ PikaObj* _pika_dict_new(int num_args, ...); /* Macro to create a new tuple PikaObj with the given arguments (of type Arg*). */ -#define New_pikaTupleFromVarArgs(...) \ +#define New_PikaTupleFromVarArgs(...) \ _pika_tuple_new(sizeof((Arg*[]){__VA_ARGS__}) / sizeof(Arg*), __VA_ARGS__) /* Macro to create a new list PikaObj with the given arguments (of type Arg*). */ -#define New_pikaListFromVarArgs(...) \ +#define New_PikaListFromVarArgs(...) \ _pika_list_new(sizeof((Arg*[]){__VA_ARGS__}) / sizeof(Arg*), __VA_ARGS__) /* Macro to create a new dict PikaObj with the given arguments (of type * Arg*). */ -#define New_pikaDictFromVarArgs(...) \ +#define New_PikaDictFromVarArgs(...) \ _pika_dict_new(sizeof((Arg*[]){__VA_ARGS__, NULL}) / sizeof(Arg*) - 1, \ __VA_ARGS__) -#define New_pikaDictFrom New_pikaDictFromVarArgs -#define New_pikaListFrom New_pikaListFromVarArgs -#define New_pikaTupleFrom New_pikaTupleFromVarArgs +#define New_PikaDictFrom New_PikaDictFromVarArgs +#define New_PikaListFrom New_PikaListFromVarArgs +#define New_PikaTupleFrom New_PikaTupleFromVarArgs PikaObj* newNormalObj(NewFun newObjFun); Arg* arg_setRef(Arg* self, char* name, PikaObj* obj); @@ -933,10 +933,9 @@ static inline ArgType pikaTuple_getType(PikaTuple* self, int index) { } /* dict api */ -PikaDict* New_pikaDict(void); - -PikaList* New_pikaList(void); -PikaTuple* New_pikaTuple(void); +PikaDict* New_PikaDict(void); +PikaList* New_PikaList(void); +PikaTuple* New_PikaTuple(void); PikaTuple* args_getTuple(Args* self, char* name); PikaDict* args_getDict(Args* self, char* name); diff --git a/src/PikaVM.c b/src/PikaVM.c index 90b16d7af..5bb65bc24 100644 --- a/src/PikaVM.c +++ b/src/PikaVM.c @@ -1291,7 +1291,7 @@ static void _type_list_parse(FunctionArgsInfo* f) { static void _kw_push(FunctionArgsInfo* f, Arg* call_arg, int i) { if (NULL == f->kw) { - f->kw = New_pikaDict(); + f->kw = New_PikaDict(); } arg_setIsKeyword(call_arg, pika_false); Hash kw_hash = call_arg->name_hash; @@ -1565,7 +1565,7 @@ static int VMState_loadArgsFromMethodArg(VMState* vm, if (arg_def[0] == '*' && arg_def[1] == '*') { /* get kw dict name */ f.kw_dict_name = arg_def + 2; - f.kw = New_pikaDict(); + f.kw = New_PikaDict(); /* remove the format arg */ strPopLastToken(f.type_list, ','); continue; @@ -1709,7 +1709,7 @@ static Arg* VM_instruction_handler_DCT(PikaObj* self, Arg* arg_ret_reg) { #if PIKA_BUILTIN_STRUCT_ENABLE uint32_t n_arg = VMState_getInputArgNum(vm); - PikaObj* dict = New_pikaDict(); + PikaObj* dict = New_PikaDict(); Stack stack = {0}; stack_init(&stack); /* load to local stack to change sort */ diff --git a/src/PikaVersion.h b/src/PikaVersion.h index 79fb1592a..9c2d8b94a 100644 --- a/src/PikaVersion.h +++ b/src/PikaVersion.h @@ -2,4 +2,4 @@ #define PIKA_VERSION_MINOR 12 #define PIKA_VERSION_MICRO 5 -#define PIKA_EDIT_TIME "2023/08/08 21:01:20" +#define PIKA_EDIT_TIME "2023/08/08 22:10:05" diff --git a/src/pika_adapter_old_api.h b/src/pika_adapter_old_api.h index 1c51713b6..9152d9435 100644 --- a/src/pika_adapter_old_api.h +++ b/src/pika_adapter_old_api.h @@ -106,6 +106,19 @@ extern "C" { #define PIKA_FALSE pika_false #define pikaScriptInit pikaPythonInit #define pikaScriptShell pikaPythonShell + +#define New_pikaList New_PikaList +#define New_pikaDict New_PikaDict +#define New_pikaTuple New_PikaTuple + +#define New_pikaTupleFrom New_PikaTupleFrom +#define New_pikaListFrom New_PikaListFrom +#define New_pikaDictFrom New_PikaDictFrom + +#define New_pikaTupleFromVarArgs New_PikaTupleFromVarArgs +#define New_pikaListFromVarArgs New_PikaListFromVarArgs +#define New_pikaDictFromVarArgs New_PikaDictFromVarArgs + #endif #endif