pikastech 3 éve
szülő
commit
f3101c94ee

+ 7 - 0
package/PikaStdLib/PikaDebug.pyi

@@ -0,0 +1,7 @@
+class Debuger:
+    def __init__(self):
+        pass
+
+    def set_trace(self):
+        pass
+    

+ 170 - 0
package/PikaStdLib/PikaStdData.pyi

@@ -0,0 +1,170 @@
+from PikaObj import *
+
+
+class Tuple:
+    def __init__(self): ...
+
+    def get(self, i: int) -> any:
+        """get an arg by the index"""
+
+    def len(self) -> int:
+        """get the length of list"""
+
+    def __iter__(self) -> any:
+        """support for loop"""
+
+    def __next__(self) -> any:
+        """support for loop"""
+
+    def __getitem__(self, __key: any) -> any:
+        """support val = list[]"""
+
+    def __del__(self): ...
+    def __str__(self) -> str: ...
+    def __len__(self) -> int: ...
+
+    def __contains__(self, val: any) -> int:
+        """ support val in list """
+
+
+class List(Tuple):
+    def __init__(self): ...
+
+    def append(self, arg: any):
+        """add an arg after the end of list"""
+
+    def set(self, i: int, arg: any):
+        """set an arg by the index"""
+
+    def reverse(self):
+        """reverse the list"""
+
+    def pop(self) -> any:
+        """pop the last element"""
+
+    def remove(self, val: any):
+        """remove the first element"""
+
+    def insert(self, i: int, arg: any):
+        """insert an arg before the index"""
+
+    def __setitem__(self, __key: any, __val: any):
+        """support list[]  = val"""
+
+    def __str__(self) -> str: ...
+
+    def __add__(self, others: List) -> List:
+        """ support list + list"""
+
+
+class Dict:
+    def __init__(self):
+        """ get an arg by the key """
+
+    def get(self, key: str) -> any: ...
+
+    def set(self, key: str, arg: any):
+        """ set an arg by the key """
+
+    def remove(self, key: str):
+        """ remove an arg by the key """
+
+    def __iter__(self) -> any: ...
+    def __next__(self) -> any: ...
+
+    def __setitem__(self, __key: any, __val: any):
+        """ support dict[]  = val """
+
+    def __getitem__(self, __key: any) -> any:
+        """ support val = dict[] """
+
+    def __del__(self): ...
+    def __str__(self) -> str: ...
+    def keys(self) -> dict_keys: ...
+    def items(self) -> dict_items: ...
+    def __len__(self) -> int: ...
+
+    def __contains__(self, val: any) -> int:
+        """ support val in dict """
+
+    def update(self, other: Dict):
+        """ update dict """
+
+
+class dict_keys:
+    def __iter__(self) -> any: ...
+    def __next__(self) -> any: ...
+    def __str__(self) -> str: ...
+    def __len__(self) -> int: ...
+
+
+class dict_items:
+    def __iter__(self) -> any: ...
+    def __next__(self) -> any: ...
+    def __str__(self) -> str: ...
+    def __len__(self) -> int: ...
+
+
+class String:
+    def __init__(self, s: str): ...
+    def set(self, s: str): ...
+    def get(self) -> str: ...
+    def __iter__(self) -> any: ...
+    def __next__(self) -> any: ...
+
+    def __setitem__(self, __key: any, __val: any):
+        """ support string[]  = val """
+
+    def __getitem__(self, __key: any) -> any:
+        """ support val = string[] """
+
+    def __str__(self) -> str:
+        """ support str() """
+
+    def __len__(self) -> int: ...
+    def encode(self, *encoding) -> bytes: ...
+    def startswith(self, prefix: str) -> int: ...
+    def endswith(self, suffix: str) -> int: ...
+    def isdigit(self) -> int: ...
+    def islower(self) -> int: ...
+    def isalnum(self) -> int: ...
+    def isalpha(self) -> int: ...
+    def isspace(self) -> int: ...
+    def split(self, s: str) -> List: ...
+    def replace(self, old: str, new: str) -> str: ...
+    def strip(self) -> str: ...
+
+
+class ByteArray:
+    def __init__(self, bytes: any):
+        """ convert a bytes to ByteArray """
+
+    def __iter__(self) -> any:
+        """ support for loop """
+
+    def __next__(self) -> any:
+        """ support for loop """
+
+    def __getitem__(self, __key: int) -> int:
+        """ support [] index """
+
+    def __setitem__(self, __key: int, __val: int): ...
+    def __str__(self) -> str: ...
+    def decode(self) -> str: ...
+
+
+class FILEIO:
+    def init(self, path: str, mode: str) -> int: ...
+    def read(self, size: int) -> any: ...
+    def write(self, s: any) -> int: ...
+    def close(self): ...
+    def seek(self, offset: int, *fromwhere) -> int: ...
+    def tell(self) -> int: ...
+    def readline(self) -> str: ...
+    def readlines(self) -> List: ...
+    def writelines(self, lines: List): ...
+
+
+class Utils:
+    def int_to_bytes(self, val: int) -> bytes:
+        """ convert a int to bytes """

+ 37 - 0
package/PikaStdLib/PikaStdTask.pyi

@@ -0,0 +1,37 @@
+import PikaStdData
+import PikaStdLib
+
+
+class Task(PikaStdLib.SysObj):
+    calls = PikaStdData.List()
+
+    def __init__(self):
+        pass
+
+    # regist a function to be called always
+    def call_always(self, fun_todo: any):
+        pass
+    
+    # regist a function to be called when fun_when() return 'True'
+    def call_when(self, fun_todo: any, fun_when: any):
+        pass
+
+    # regist a function to be called periodically 
+    def call_period_ms(self, fun_todo: any, period_ms: int):
+        pass
+
+    # run all registed function once
+    def run_once(self):
+        pass
+
+    # run all registed function forever
+    def run_forever(self):
+        pass
+
+    # run all registed function until time is up
+    def run_until_ms(self, until_ms: int):
+        pass
+
+    # need be overried to supply the system tick
+    def platformGetTick(self):
+        pass

+ 1 - 1
src/PikaPlatform.h

@@ -163,7 +163,7 @@ void __platform_error_handle(void);
 
 void __pks_hook_instruct(void);
 
-#if pika_floatYPE_DOUBLE
+#if PIKA_FLOAT_TYPE_DOUBLE
 #define pika_float double
 #else
 #define pika_float float

+ 2 - 2
src/pika_config_valid.h

@@ -305,8 +305,8 @@
         #define PIKA_PRINT_LLD_ENABLE 1
     #endif
 
-    #ifndef pika_floatYPE_DOUBLE
-        #define pika_floatYPE_DOUBLE 1
+    #ifndef PIKA_FLOAT_TYPE_DOUBLE
+        #define PIKA_FLOAT_TYPE_DOUBLE 1
     #endif
 
     /* configuration validation */