use ... insetad of pass in PikaStdLib.pyi

This commit is contained in:
lyon 2022-04-28 15:53:09 +08:00
parent 8df290da3f
commit 652962c4c3
10 changed files with 63 additions and 136 deletions

View File

@ -2,67 +2,32 @@
from PikaObj import *
class MemChecker(TinyObj):
def max(self):
pass
def now(self):
pass
def getMax(self) -> float:
pass
def getNow(self) -> float:
pass
def resetMax(self):
pass
def max(self):...
def now(self):...
def getMax(self) -> float:...
def getNow(self) -> float:...
def resetMax(self):...
class SysObj(BaseObj):
def type(self, arg: any):
pass
def remove(self, argPath: str):
pass
def int(self, arg: any) -> int:
pass
def float(self, arg: any) -> float:
pass
def str(self, arg: any) -> str:
pass
def iter(self, arg: any) -> any:
pass
def range(self, a1: int, a2: int) -> any:
pass
def __set__(self, obj: any, key: any, val: any, obj_str: str):
pass
def __get__(self, obj: any, key: any) -> any:
pass
def len(self, arg:any) -> int:
pass
def list(self) -> any:
pass
def dict(self) -> any:
pass
def type(self, arg: any):...
def remove(self, argPath: str):...
def int(self, arg: any) -> int:...
def float(self, arg: any) -> float:...
def str(self, arg: any) -> str:...
def iter(self, arg: any) -> any:...
def range(self, a1: int, a2: int) -> any:...
def __set__(self, obj: any, key: any, val: any, obj_str: str):...
def __get__(self, obj: any, key: any) -> any:...
def len(self, arg:any) -> int:...
def list(self) -> any:...
def dict(self) -> any:...
class RangeObj(TinyObj):
def __next__(self) -> any:
pass
def __next__(self) -> any:...
class StringObj(TinyObj):
def __next__(self) -> any:
pass
def __next__(self) -> any:...
class PikaObj(TinyObj):
pass
class PikaObj(TinyObj):...

View File

@ -2,67 +2,32 @@
from PikaObj import *
class MemChecker(TinyObj):
def max(self):
pass
def now(self):
pass
def getMax(self) -> float:
pass
def getNow(self) -> float:
pass
def resetMax(self):
pass
def max(self):...
def now(self):...
def getMax(self) -> float:...
def getNow(self) -> float:...
def resetMax(self):...
class SysObj(BaseObj):
def type(self, arg: any):
pass
def remove(self, argPath: str):
pass
def int(self, arg: any) -> int:
pass
def float(self, arg: any) -> float:
pass
def str(self, arg: any) -> str:
pass
def iter(self, arg: any) -> any:
pass
def range(self, a1: int, a2: int) -> any:
pass
def __set__(self, obj: any, key: any, val: any, obj_str: str):
pass
def __get__(self, obj: any, key: any) -> any:
pass
def len(self, arg:any) -> int:
pass
def list(self) -> any:
pass
def dict(self) -> any:
pass
def type(self, arg: any):...
def remove(self, argPath: str):...
def int(self, arg: any) -> int:...
def float(self, arg: any) -> float:...
def str(self, arg: any) -> str:...
def iter(self, arg: any) -> any:...
def range(self, a1: int, a2: int) -> any:...
def __set__(self, obj: any, key: any, val: any, obj_str: str):...
def __get__(self, obj: any, key: any) -> any:...
def len(self, arg:any) -> int:...
def list(self) -> any:...
def dict(self) -> any:...
class RangeObj(TinyObj):
def __next__(self) -> any:
pass
def __next__(self) -> any:...
class StringObj(TinyObj):
def __next__(self) -> any:
pass
def __next__(self) -> any:...
class PikaObj(TinyObj):
pass
class PikaObj(TinyObj):...

View File

@ -5,17 +5,6 @@ import GTestTask
import PikaMath
import PikaStdDevice
def dcrf32_test():
rlen = ctypes.c_uint(0)
rcvbuf = ctypes.c_wchar_p('')
t = ctypes.Test()
sendbuf = b'\x00\x84\x00\x00\x08'
i = 0
while i < 3 :
t.dc_cpuapdu_hex(5, sendbuf, rlen, rcvbuf)
t.print_rcv(rcvbuf)
i += 1
@ -28,7 +17,16 @@ print(s)
cnt = 0
while cnt < 3:
dcrf32_test()
rlen = ctypes.c_uint(0)
rcvbuf = ctypes.c_wchar_p('')
t = ctypes.Test()
sendbuf = b'\x00\x84\x00\x00\x08'
i = 0
while i < 3 :
t.dc_cpuapdu_hex(5, sendbuf, rlen, rcvbuf)
t.print_rcv(rcvbuf)
i += 1
print('----------------------')
log = 'loop '+ str(cnt) + 'mem use max:'
print(log)

View File

@ -5,7 +5,7 @@ exit 1;
fi
pkg=$1
cp package/pikascript/pikascript-lib/$pkg ../../package/ -r
cp package/pikascript/$pkg.py ../../package/$pkg/
cp package/pikascript/$pkg.pyi ../../package/$pkg/
git add package/pikascript/pikascript-lib/$pkg
git add package/pikascript/$pkg.py
git add package/pikascript/$pkg.pyi
git add ../../package/$pkg

View File

@ -1,5 +1,5 @@
cp package/pikascript/pikascript-core/* ../../src
cp package/pikascript/PikaObj.py ../../src
cp package/pikascript/PikaObj.pyi ../../src
sh std_push.sh PikaStdLib
sh std_push.sh PikaStdData
sh std_push.sh PikaDebug

View File

@ -1,6 +1,6 @@
pkg=$1
cp package/pikascript/pikascript-lib/PikaStdLib ../../package/ -r
cp package/pikascript/$pkg.py ../../package/PikaStdLib/
cp package/pikascript/$pkg.pyi ../../package/PikaStdLib/
git add package/pikascript/pikascript-lib/PikaStdLib
git add package/pikascript/$pkg.py
git add package/pikascript/$pkg.pyi
git add ../../package/PikaStdLib

View File

@ -2180,7 +2180,6 @@ TEST(asmer, asmer_to_instructUnit) {
EXPECT_EQ(pikaMemNow(), 0);
}
TEST(asmer, asm_to_bytecodeArray) {
char* pikaAsm =(char*)
"B0\n"

View File

@ -376,7 +376,7 @@ PikaObj* newRootObj(char* name, NewFun newObjFun) {
}
Arg* obj_getRefArg(PikaObj* self) {
return arg_setPtr(NULL, "", ARG_TYPE_OBJECT_FREE, self);
return arg_setPtr(NULL, "", ARG_TYPE_OBJECT_NEW, self);
}
Arg* arg_newMetaObj(NewFun new_obj_fun) {
@ -388,7 +388,7 @@ Arg* arg_newMetaObj(NewFun new_obj_fun) {
Arg* arg_newDirectObj(NewFun new_obj_fun) {
PikaObj* newObj = NewObjDirect(new_obj_fun);
Arg* arg_new = arg_setPtr(NULL, "", ARG_TYPE_OBJECT_FREE, newObj);
Arg* arg_new = arg_setPtr(NULL, "", ARG_TYPE_OBJECT_NEW, newObj);
return arg_new;
}
@ -429,7 +429,7 @@ static PikaObj* __obj_getObjDirect(PikaObj* self, char* name) {
return __obj_initSubObj(self, name);
}
/* found Objcet */
if (type == ARG_TYPE_OBJECT || type == ARG_TYPE_OBJECT_FREE) {
if (type == ARG_TYPE_OBJECT || type == ARG_TYPE_OBJECT_NEW) {
return args_getPtr(self->list, name);
}
return NULL;

View File

@ -160,7 +160,7 @@ static Arg* VM_instruction_handler_NEW(PikaObj* self, VMState* vs, char* data) {
Arg* origin_arg = obj_getArg(vs->locals, data);
Arg* new_arg = arg_copy(origin_arg);
origin_arg = arg_setType(origin_arg, ARG_TYPE_OBJECT);
arg_setType(new_arg, ARG_TYPE_OBJECT_FREE);
arg_setType(new_arg, ARG_TYPE_OBJECT_NEW);
return new_arg;
}
@ -367,7 +367,7 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self, VMState* vs, char* data) {
VMState_runMethodArg(vs, method_host_obj, sub_locals, method_arg);
/* __init__() */
if (ARG_TYPE_OBJECT_FREE == arg_getType(return_arg)) {
if (ARG_TYPE_OBJECT_NEW == arg_getType(return_arg)) {
/* init object */
PikaObj* new_obj = arg_getPtr(return_arg);
Arg* method_arg = obj_getMethodArg(new_obj, "__init__");
@ -498,7 +498,7 @@ static Arg* VM_instruction_handler_OUT(PikaObj* self, VMState* vs, char* data) {
hostObj = args_getPtr(vs->locals->list, "__runAs");
}
/* set free object to nomal object */
if (ARG_TYPE_OBJECT_FREE == outArg_type) {
if (ARG_TYPE_OBJECT_NEW == outArg_type) {
arg_setType(outArg, ARG_TYPE_OBJECT);
}
@ -1333,7 +1333,7 @@ void VMState_solveUnusedStack(VMState* vs) {
arg_deinit(arg);
continue;
}
if (ARG_TYPE_OBJECT_FREE == type) {
if (ARG_TYPE_OBJECT_NEW == type) {
obj_deinit(arg_getPtr(arg));
arg_deinit(arg);
continue;

View File

@ -43,7 +43,7 @@ typedef enum {
ARG_TYPE_POINTER,
ARG_TYPE_OBJECT,
ARG_TYPE_OBJECT_META,
ARG_TYPE_OBJECT_FREE,
ARG_TYPE_OBJECT_NEW,
ARG_TYPE_METHOD_NATIVE,
ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR,
ARG_TYPE_METHOD_CONSTRUCTOR,