mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
update pckage for PikaStdLib.py
This commit is contained in:
parent
2f8ce3768c
commit
659d92c377
@ -31,6 +31,9 @@ class SysObj(BaseObj):
|
||||
def float(arg: any) -> float:
|
||||
pass
|
||||
|
||||
def str(arg: any) -> str:
|
||||
pass
|
||||
|
||||
def iter(arg: any) -> any:
|
||||
pass
|
||||
|
||||
|
@ -76,6 +76,27 @@ int PikaStdLib_SysObj_int(PikaObj* self, Arg* arg) {
|
||||
return -999999999;
|
||||
}
|
||||
|
||||
char* PikaStdLib_SysObj_str(PikaObj* self, Arg* arg) {
|
||||
ArgType type = arg_getType(arg);
|
||||
Args* buffs = New_strBuff();
|
||||
char* res = NULL;
|
||||
do {
|
||||
if (TYPE_INT == type) {
|
||||
int val = arg_getInt(arg);
|
||||
res = strsFormat(buffs, 11, "%d", val);
|
||||
break;
|
||||
}
|
||||
if (TYPE_FLOAT == type) {
|
||||
float val = arg_getFloat(arg);
|
||||
res = strsFormat(buffs, 11, "%f", val);
|
||||
break;
|
||||
}
|
||||
} while (0);
|
||||
obj_setStr(self, "__strtmp", res);
|
||||
args_deinit(buffs);
|
||||
return obj_getStr(self, "__strtmp");
|
||||
}
|
||||
|
||||
Arg* PikaStdLib_SysObj_iter(PikaObj* self, Arg* arg) {
|
||||
/* a MATE object */
|
||||
if (TYPE_MATE_OBJECT == arg_getType(arg)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user