add pikaStdData

This commit is contained in:
lyon 2021-12-13 22:14:59 +08:00
parent 5fe634105b
commit 0132327c84
3 changed files with 41 additions and 2 deletions

View File

@ -1,17 +1,39 @@
from PikaObj import *
class List(TinyObj):
def __init__():
pass
# add an arg after the end of list
def append(arg: any):
pass
# get an arg by the index
def get(i: int) -> any:
pass
# set an arg by the index
def set(i: int, arg: any):
pass
# get the length of list
def len() -> int:
pass
pass
class Dict(TinyObj):
def __init__():
pass
# get an arg by the key
def get(key: str) -> any:
pass
# set an arg by the key
def set(key: str, arg: any):
pass
# remove an arg by the key
def remove(key: str):
pass

View File

@ -0,0 +1,17 @@
#include "PikaObj.h"
#include "PikaStdLib_SysObj.h"
#include "PikaStdData_Dict.h"
Arg* PikaStdData_Dict_get(PikaObj* self, char* key) {
return arg_copy(obj_getArg(self, key));
}
void PikaStdData_Dict___init__(PikaObj* self) {}
void PikaStdData_Dict_set(PikaObj* self, Arg* arg, char* key) {
obj_setArg(self, key, arg);
}
void PikaStdData_Dict_remove(PikaObj* self, char* key) {
PikaStdLib_SysObj_remove(self, key);
}

View File

@ -1,4 +1,4 @@
#include "PikaStdData_List.h"
#include "PikaObj.h"
void PikaStdData_List_append(PikaObj* self, Arg* arg) {
int top = obj_getInt(self, "top");