add New_pika<Type>From() api

This commit is contained in:
Lyon 2023-08-08 09:58:38 +08:00
parent f05ffd3468
commit 999b449877
4 changed files with 7 additions and 3 deletions

View File

@ -25,7 +25,7 @@ void _network_WLAN_active(PikaObj* self, int is_active) {
if (hal_wifi == NULL) {
return;
}
if (is_active){
if (is_active) {
check_res(pika_hal_ioctl(hal_wifi, PIKA_HAL_IOCTL_ENABLE));
return;
}

View File

@ -3295,7 +3295,7 @@ Arg* builtins_list(PikaObj* self, PikaTuple* val) {
};
return pikaVM_runByteCodeReturn(self, (uint8_t*)bytes, "@res_list");
}
return arg_newObj(New_pikaListFromVarArgs(NULL));
return arg_newObj(New_pikaListFrom(NULL));
#else
obj_setErrorCode(self, 1);
__platform_printf("[Error] built-in list is not enabled.\r\n");

View File

@ -457,6 +457,10 @@ PikaObj* _pika_dict_new(int num_args, ...);
_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
PikaObj* newNormalObj(NewFun newObjFun);
Arg* arg_setRef(Arg* self, char* name, PikaObj* obj);
Arg* arg_setObj(Arg* self, char* name, PikaObj* obj);

View File

@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 12
#define PIKA_VERSION_MICRO 5
#define PIKA_EDIT_TIME "2023/08/06 19:07:18"
#define PIKA_EDIT_TIME "2023/08/08 09:58:08"