mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
update cmsis-pack
This commit is contained in:
parent
5706d29ac1
commit
43978e8e72
@ -243,6 +243,7 @@
|
|||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_ByteArray.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_ByteArray.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_Dict.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_Dict.h" />
|
||||||
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_dict_items.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_dict_keys.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_dict_keys.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_FILEIO.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_FILEIO.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_List.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_List.h" />
|
||||||
|
@ -14,6 +14,10 @@ class any:
|
|||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
class int64:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
def printNoEnd(val: any): ...
|
def printNoEnd(val: any): ...
|
||||||
def abstractmethod(fn): ...
|
def abstractmethod(fn): ...
|
||||||
def PIKA_C_MACRO_IF(fn): ...
|
def PIKA_C_MACRO_IF(fn): ...
|
||||||
|
@ -20,6 +20,9 @@ class Tuple:
|
|||||||
def __str__(self) -> str: ...
|
def __str__(self) -> str: ...
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
|
|
||||||
|
def __contains__(self, val: any) -> int:
|
||||||
|
""" support val in list """
|
||||||
|
|
||||||
|
|
||||||
class List(Tuple):
|
class List(Tuple):
|
||||||
def __init__(self): ...
|
def __init__(self): ...
|
||||||
@ -59,8 +62,12 @@ class Dict:
|
|||||||
def __del__(self): ...
|
def __del__(self): ...
|
||||||
def __str__(self) -> str: ...
|
def __str__(self) -> str: ...
|
||||||
def keys(self) -> dict_keys: ...
|
def keys(self) -> dict_keys: ...
|
||||||
|
def items(self) -> dict_items: ...
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
|
|
||||||
|
def __contains__(self, val: any) -> int:
|
||||||
|
""" support val in list """
|
||||||
|
|
||||||
|
|
||||||
class dict_keys:
|
class dict_keys:
|
||||||
def __iter__(self) -> any: ...
|
def __iter__(self) -> any: ...
|
||||||
@ -68,6 +75,11 @@ class dict_keys:
|
|||||||
def __str__(self) -> str: ...
|
def __str__(self) -> str: ...
|
||||||
def __len__(self) -> int: ...
|
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:
|
class String:
|
||||||
def __init__(self, s: str): ...
|
def __init__(self, s: str): ...
|
||||||
@ -82,7 +94,7 @@ class String:
|
|||||||
# support str()
|
# support str()
|
||||||
def __str__(self) -> str: ...
|
def __str__(self) -> str: ...
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
def encode(self) -> bytes: ...
|
def encode(self, *encoding) -> bytes: ...
|
||||||
def startswith(self, prefix: str) -> int: ...
|
def startswith(self, prefix: str) -> int: ...
|
||||||
def endswith(self, suffix: str) -> int: ...
|
def endswith(self, suffix: str) -> int: ...
|
||||||
def isdigit(self) -> int: ...
|
def isdigit(self) -> int: ...
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from PikaObj import *
|
from PikaObj import *
|
||||||
|
|
||||||
|
|
||||||
class MemChecker:
|
class MemChecker:
|
||||||
def max(self): ...
|
def max(self): ...
|
||||||
def now(self): ...
|
def now(self): ...
|
||||||
@ -15,9 +16,6 @@ class MemChecker:
|
|||||||
|
|
||||||
|
|
||||||
class SysObj:
|
class SysObj:
|
||||||
@staticmethod
|
|
||||||
def type(arg: any) -> any: ...
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def int(arg: any) -> int: ...
|
def int(arg: any) -> int: ...
|
||||||
|
|
||||||
@ -31,14 +29,10 @@ class SysObj:
|
|||||||
def iter(arg: any) -> any: ...
|
def iter(arg: any) -> any: ...
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def range(a1: int, a2: int) -> any: ...
|
def range(*ax) -> any: ...
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def print(*val): ...
|
def print(*val, **ops): ...
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE")
|
|
||||||
def printNoEnd(val: any): ...
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __setitem__(obj: any, key: any, val: any) -> any: ...
|
def __setitem__(obj: any, key: any, val: any) -> any: ...
|
||||||
@ -46,6 +40,10 @@ class SysObj:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def __getitem__(obj: any, key: any) -> any: ...
|
def __getitem__(obj: any, key: any) -> any: ...
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE")
|
||||||
|
def type(arg: any) -> any: ...
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@PIKA_C_MACRO_IF("PIKA_BUILTIN_STRUCT_ENABLE")
|
@PIKA_C_MACRO_IF("PIKA_BUILTIN_STRUCT_ENABLE")
|
||||||
def __slice__(obj: any, start: any, end: any, step: int) -> any: ...
|
def __slice__(obj: any, start: any, end: any, step: int) -> any: ...
|
||||||
@ -105,6 +103,10 @@ class SysObj:
|
|||||||
@PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE")
|
@PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE")
|
||||||
def setattr(obj: object, name: str, val: any): ...
|
def setattr(obj: object, name: str, val: any): ...
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
@PIKA_C_MACRO_IF("!PIKA_NANO_ENABLE")
|
||||||
|
def exit(): ...
|
||||||
|
|
||||||
|
|
||||||
@PIKA_C_MACRO_IF("0")
|
@PIKA_C_MACRO_IF("0")
|
||||||
class RangeObj:
|
class RangeObj:
|
||||||
@ -114,4 +116,3 @@ class RangeObj:
|
|||||||
@PIKA_C_MACRO_IF("0")
|
@PIKA_C_MACRO_IF("0")
|
||||||
class StringObj:
|
class StringObj:
|
||||||
def __next__(self) -> any: ...
|
def __next__(self) -> any: ...
|
||||||
|
|
||||||
|
@ -243,6 +243,7 @@
|
|||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_ByteArray.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_ByteArray.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_Dict.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_Dict.h" />
|
||||||
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_dict_items.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_dict_keys.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_dict_keys.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_FILEIO.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_FILEIO.h" />
|
||||||
<file attr="config" category="header" name="pikascript-api/PikaStdData_List.h" />
|
<file attr="config" category="header" name="pikascript-api/PikaStdData_List.h" />
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
@del "pikascript-api\PikaStdData.h"
|
@del "pikascript-api\PikaStdData.h"
|
||||||
@del "pikascript-api\PikaStdData_ByteArray.h"
|
@del "pikascript-api\PikaStdData_ByteArray.h"
|
||||||
@del "pikascript-api\PikaStdData_Dict.h"
|
@del "pikascript-api\PikaStdData_Dict.h"
|
||||||
|
@del "pikascript-api\PikaStdData_dict_items.h"
|
||||||
@del "pikascript-api\PikaStdData_dict_keys.h"
|
@del "pikascript-api\PikaStdData_dict_keys.h"
|
||||||
@del "pikascript-api\PikaStdData_FILEIO.h"
|
@del "pikascript-api\PikaStdData_FILEIO.h"
|
||||||
@del "pikascript-api\PikaStdData_List.h"
|
@del "pikascript-api\PikaStdData_List.h"
|
||||||
|
@ -24,6 +24,7 @@ Arg* PikaStdData_List(PikaObj *self);
|
|||||||
Arg* PikaStdData_String(PikaObj *self);
|
Arg* PikaStdData_String(PikaObj *self);
|
||||||
Arg* PikaStdData_Tuple(PikaObj *self);
|
Arg* PikaStdData_Tuple(PikaObj *self);
|
||||||
Arg* PikaStdData_Utils(PikaObj *self);
|
Arg* PikaStdData_Utils(PikaObj *self);
|
||||||
|
Arg* PikaStdData_dict_items(PikaObj *self);
|
||||||
Arg* PikaStdData_dict_keys(PikaObj *self);
|
Arg* PikaStdData_dict_keys(PikaObj *self);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_Dict(Args *args);
|
PikaObj *New_PikaStdData_Dict(Args *args);
|
||||||
|
|
||||||
|
int PikaStdData_Dict___contains__(PikaObj *self, Arg* val);
|
||||||
void PikaStdData_Dict___del__(PikaObj *self);
|
void PikaStdData_Dict___del__(PikaObj *self);
|
||||||
Arg* PikaStdData_Dict___getitem__(PikaObj *self, Arg* __key);
|
Arg* PikaStdData_Dict___getitem__(PikaObj *self, Arg* __key);
|
||||||
void PikaStdData_Dict___init__(PikaObj *self);
|
void PikaStdData_Dict___init__(PikaObj *self);
|
||||||
@ -26,6 +27,7 @@ Arg* PikaStdData_Dict___next__(PikaObj *self);
|
|||||||
void PikaStdData_Dict___setitem__(PikaObj *self, Arg* __key, Arg* __val);
|
void PikaStdData_Dict___setitem__(PikaObj *self, Arg* __key, Arg* __val);
|
||||||
char* PikaStdData_Dict___str__(PikaObj *self);
|
char* PikaStdData_Dict___str__(PikaObj *self);
|
||||||
Arg* PikaStdData_Dict_get(PikaObj *self, char* key);
|
Arg* PikaStdData_Dict_get(PikaObj *self, char* key);
|
||||||
|
PikaObj* PikaStdData_Dict_items(PikaObj *self);
|
||||||
PikaObj* PikaStdData_Dict_keys(PikaObj *self);
|
PikaObj* PikaStdData_Dict_keys(PikaObj *self);
|
||||||
void PikaStdData_Dict_remove(PikaObj *self, char* key);
|
void PikaStdData_Dict_remove(PikaObj *self, char* key);
|
||||||
void PikaStdData_Dict_set(PikaObj *self, char* key, Arg* arg);
|
void PikaStdData_Dict_set(PikaObj *self, char* key, Arg* arg);
|
||||||
|
@ -24,7 +24,7 @@ int PikaStdData_String___len__(PikaObj *self);
|
|||||||
Arg* PikaStdData_String___next__(PikaObj *self);
|
Arg* PikaStdData_String___next__(PikaObj *self);
|
||||||
void PikaStdData_String___setitem__(PikaObj *self, Arg* __key, Arg* __val);
|
void PikaStdData_String___setitem__(PikaObj *self, Arg* __key, Arg* __val);
|
||||||
char* PikaStdData_String___str__(PikaObj *self);
|
char* PikaStdData_String___str__(PikaObj *self);
|
||||||
Arg* PikaStdData_String_encode(PikaObj *self);
|
Arg* PikaStdData_String_encode(PikaObj *self, PikaTuple* encoding);
|
||||||
int PikaStdData_String_endswith(PikaObj *self, char* suffix);
|
int PikaStdData_String_endswith(PikaObj *self, char* suffix);
|
||||||
char* PikaStdData_String_get(PikaObj *self);
|
char* PikaStdData_String_get(PikaObj *self);
|
||||||
int PikaStdData_String_isalnum(PikaObj *self);
|
int PikaStdData_String_isalnum(PikaObj *self);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_Tuple(Args *args);
|
PikaObj *New_PikaStdData_Tuple(Args *args);
|
||||||
|
|
||||||
|
int PikaStdData_Tuple___contains__(PikaObj *self, Arg* val);
|
||||||
void PikaStdData_Tuple___del__(PikaObj *self);
|
void PikaStdData_Tuple___del__(PikaObj *self);
|
||||||
Arg* PikaStdData_Tuple___getitem__(PikaObj *self, Arg* __key);
|
Arg* PikaStdData_Tuple___getitem__(PikaObj *self, Arg* __key);
|
||||||
void PikaStdData_Tuple___init__(PikaObj *self);
|
void PikaStdData_Tuple___init__(PikaObj *self);
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* [Warning!] This file is auto-generated by pika compiler.
|
||||||
|
* Do not edit it manually.
|
||||||
|
* The source code is *.pyi file.
|
||||||
|
* More details:
|
||||||
|
* English Doc:
|
||||||
|
* https://pikadoc.readthedocs.io/en/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html
|
||||||
|
* Chinese Doc:
|
||||||
|
* https://pikadoc.readthedocs.io/zh/latest/PikaScript%20%E6%A8%A1%E5%9D%97%E6%A6%82%E8%BF%B0.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PikaStdData_dict_items__H
|
||||||
|
#define __PikaStdData_dict_items__H
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "PikaObj.h"
|
||||||
|
|
||||||
|
PikaObj *New_PikaStdData_dict_items(Args *args);
|
||||||
|
|
||||||
|
Arg* PikaStdData_dict_items___iter__(PikaObj *self);
|
||||||
|
int PikaStdData_dict_items___len__(PikaObj *self);
|
||||||
|
Arg* PikaStdData_dict_items___next__(PikaObj *self);
|
||||||
|
char* PikaStdData_dict_items___str__(PikaObj *self);
|
||||||
|
|
||||||
|
#endif
|
@ -26,6 +26,7 @@ char* PikaStdLib_SysObj_chr(PikaObj *self, int val);
|
|||||||
Arg* PikaStdLib_SysObj_dict(PikaObj *self);
|
Arg* PikaStdLib_SysObj_dict(PikaObj *self);
|
||||||
PikaObj* PikaStdLib_SysObj_dir(PikaObj *self, PikaObj* obj);
|
PikaObj* PikaStdLib_SysObj_dir(PikaObj *self, PikaObj* obj);
|
||||||
void PikaStdLib_SysObj_exec(PikaObj *self, char* code);
|
void PikaStdLib_SysObj_exec(PikaObj *self, char* code);
|
||||||
|
void PikaStdLib_SysObj_exit(PikaObj *self);
|
||||||
double PikaStdLib_SysObj_float(PikaObj *self, Arg* arg);
|
double PikaStdLib_SysObj_float(PikaObj *self, Arg* arg);
|
||||||
Arg* PikaStdLib_SysObj_getattr(PikaObj *self, PikaObj* obj, char* name);
|
Arg* PikaStdLib_SysObj_getattr(PikaObj *self, PikaObj* obj, char* name);
|
||||||
char* PikaStdLib_SysObj_hex(PikaObj *self, int val);
|
char* PikaStdLib_SysObj_hex(PikaObj *self, int val);
|
||||||
@ -36,9 +37,8 @@ int PikaStdLib_SysObj_len(PikaObj *self, Arg* arg);
|
|||||||
Arg* PikaStdLib_SysObj_list(PikaObj *self);
|
Arg* PikaStdLib_SysObj_list(PikaObj *self);
|
||||||
PikaObj* PikaStdLib_SysObj_open(PikaObj *self, char* path, char* mode);
|
PikaObj* PikaStdLib_SysObj_open(PikaObj *self, char* path, char* mode);
|
||||||
int PikaStdLib_SysObj_ord(PikaObj *self, char* val);
|
int PikaStdLib_SysObj_ord(PikaObj *self, char* val);
|
||||||
void PikaStdLib_SysObj_print(PikaObj *self, PikaTuple* val);
|
void PikaStdLib_SysObj_print(PikaObj *self, PikaTuple* val, PikaDict* ops);
|
||||||
void PikaStdLib_SysObj_printNoEnd(PikaObj *self, Arg* val);
|
Arg* PikaStdLib_SysObj_range(PikaObj *self, PikaTuple* ax);
|
||||||
Arg* PikaStdLib_SysObj_range(PikaObj *self, int a1, int a2);
|
|
||||||
void PikaStdLib_SysObj_setattr(PikaObj *self, PikaObj* obj, char* name, Arg* val);
|
void PikaStdLib_SysObj_setattr(PikaObj *self, PikaObj* obj, char* name, Arg* val);
|
||||||
char* PikaStdLib_SysObj_str(PikaObj *self, Arg* arg);
|
char* PikaStdLib_SysObj_str(PikaObj *self, Arg* arg);
|
||||||
Arg* PikaStdLib_SysObj_type(PikaObj *self, Arg* arg);
|
Arg* PikaStdLib_SysObj_type(PikaObj *self, Arg* arg);
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include "TinyObj.h"
|
#include "TinyObj.h"
|
||||||
#include "PikaStdData_Utils.h"
|
#include "PikaStdData_Utils.h"
|
||||||
#include "TinyObj.h"
|
#include "TinyObj.h"
|
||||||
|
#include "PikaStdData_dict_items.h"
|
||||||
|
#include "TinyObj.h"
|
||||||
#include "PikaStdData_dict_keys.h"
|
#include "PikaStdData_dict_keys.h"
|
||||||
#include "TinyObj.h"
|
#include "TinyObj.h"
|
||||||
#include "PikaStdLib.h"
|
#include "PikaStdLib.h"
|
||||||
@ -111,7 +113,7 @@ void PikaDebug_DebugerMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaDebug(Args *args){
|
PikaObj *New_PikaDebug(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineConstructor(self, "Debuger()->any", PikaDebug_DebugerMethod);
|
class_defineConstructor(self, "Debuger()", PikaDebug_DebugerMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -185,6 +187,11 @@ void PikaStdData_UtilsMethod(PikaObj *self, Args *args){
|
|||||||
method_returnArg(args, res);
|
method_returnArg(args, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PikaStdData_dict_itemsMethod(PikaObj *self, Args *args){
|
||||||
|
Arg* res = PikaStdData_dict_items(self);
|
||||||
|
method_returnArg(args, res);
|
||||||
|
}
|
||||||
|
|
||||||
void PikaStdData_dict_keysMethod(PikaObj *self, Args *args){
|
void PikaStdData_dict_keysMethod(PikaObj *self, Args *args){
|
||||||
Arg* res = PikaStdData_dict_keys(self);
|
Arg* res = PikaStdData_dict_keys(self);
|
||||||
method_returnArg(args, res);
|
method_returnArg(args, res);
|
||||||
@ -192,14 +199,15 @@ void PikaStdData_dict_keysMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData(Args *args){
|
PikaObj *New_PikaStdData(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineConstructor(self, "ByteArray()->any", PikaStdData_ByteArrayMethod);
|
class_defineConstructor(self, "ByteArray()", PikaStdData_ByteArrayMethod);
|
||||||
class_defineConstructor(self, "Dict()->any", PikaStdData_DictMethod);
|
class_defineConstructor(self, "Dict()", PikaStdData_DictMethod);
|
||||||
class_defineConstructor(self, "FILEIO()->any", PikaStdData_FILEIOMethod);
|
class_defineConstructor(self, "FILEIO()", PikaStdData_FILEIOMethod);
|
||||||
class_defineConstructor(self, "List()->any", PikaStdData_ListMethod);
|
class_defineConstructor(self, "List()", PikaStdData_ListMethod);
|
||||||
class_defineConstructor(self, "String()->any", PikaStdData_StringMethod);
|
class_defineConstructor(self, "String()", PikaStdData_StringMethod);
|
||||||
class_defineConstructor(self, "Tuple()->any", PikaStdData_TupleMethod);
|
class_defineConstructor(self, "Tuple()", PikaStdData_TupleMethod);
|
||||||
class_defineConstructor(self, "Utils()->any", PikaStdData_UtilsMethod);
|
class_defineConstructor(self, "Utils()", PikaStdData_UtilsMethod);
|
||||||
class_defineConstructor(self, "dict_keys()->any", PikaStdData_dict_keysMethod);
|
class_defineConstructor(self, "dict_items()", PikaStdData_dict_itemsMethod);
|
||||||
|
class_defineConstructor(self, "dict_keys()", PikaStdData_dict_keysMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -244,13 +252,13 @@ void PikaStdData_ByteArray_decodeMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_ByteArray(Args *args){
|
PikaObj *New_PikaStdData_ByteArray(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "__getitem__(__key:int)->int", PikaStdData_ByteArray___getitem__Method);
|
class_defineMethod(self, "__getitem__(__key)", PikaStdData_ByteArray___getitem__Method);
|
||||||
class_defineMethod(self, "__init__(bytes:any)", PikaStdData_ByteArray___init__Method);
|
class_defineMethod(self, "__init__(bytes)", PikaStdData_ByteArray___init__Method);
|
||||||
class_defineMethod(self, "__iter__()->any", PikaStdData_ByteArray___iter__Method);
|
class_defineMethod(self, "__iter__()", PikaStdData_ByteArray___iter__Method);
|
||||||
class_defineMethod(self, "__next__()->any", PikaStdData_ByteArray___next__Method);
|
class_defineMethod(self, "__next__()", PikaStdData_ByteArray___next__Method);
|
||||||
class_defineMethod(self, "__setitem__(__key:int,__val:int)", PikaStdData_ByteArray___setitem__Method);
|
class_defineMethod(self, "__setitem__(__key,__val)", PikaStdData_ByteArray___setitem__Method);
|
||||||
class_defineMethod(self, "__str__()->str", PikaStdData_ByteArray___str__Method);
|
class_defineMethod(self, "__str__()", PikaStdData_ByteArray___str__Method);
|
||||||
class_defineMethod(self, "decode()->str", PikaStdData_ByteArray_decodeMethod);
|
class_defineMethod(self, "decode()", PikaStdData_ByteArray_decodeMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,6 +268,12 @@ Arg *PikaStdData_ByteArray(PikaObj *self){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PIKA_MODULE_PIKASTDDATA_DISABLE
|
#ifndef PIKA_MODULE_PIKASTDDATA_DISABLE
|
||||||
|
void PikaStdData_Dict___contains__Method(PikaObj *self, Args *args){
|
||||||
|
Arg* val = args_getArg(args, "val");
|
||||||
|
int res = PikaStdData_Dict___contains__(self, val);
|
||||||
|
method_returnInt(args, res);
|
||||||
|
}
|
||||||
|
|
||||||
void PikaStdData_Dict___del__Method(PikaObj *self, Args *args){
|
void PikaStdData_Dict___del__Method(PikaObj *self, Args *args){
|
||||||
PikaStdData_Dict___del__(self);
|
PikaStdData_Dict___del__(self);
|
||||||
}
|
}
|
||||||
@ -306,6 +320,11 @@ void PikaStdData_Dict_getMethod(PikaObj *self, Args *args){
|
|||||||
method_returnArg(args, res);
|
method_returnArg(args, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PikaStdData_Dict_itemsMethod(PikaObj *self, Args *args){
|
||||||
|
PikaObj* res = PikaStdData_Dict_items(self);
|
||||||
|
method_returnObj(args, res);
|
||||||
|
}
|
||||||
|
|
||||||
void PikaStdData_Dict_keysMethod(PikaObj *self, Args *args){
|
void PikaStdData_Dict_keysMethod(PikaObj *self, Args *args){
|
||||||
PikaObj* res = PikaStdData_Dict_keys(self);
|
PikaObj* res = PikaStdData_Dict_keys(self);
|
||||||
method_returnObj(args, res);
|
method_returnObj(args, res);
|
||||||
@ -324,18 +343,20 @@ void PikaStdData_Dict_setMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_Dict(Args *args){
|
PikaObj *New_PikaStdData_Dict(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
|
class_defineMethod(self, "__contains__(val)", PikaStdData_Dict___contains__Method);
|
||||||
class_defineMethod(self, "__del__()", PikaStdData_Dict___del__Method);
|
class_defineMethod(self, "__del__()", PikaStdData_Dict___del__Method);
|
||||||
class_defineMethod(self, "__getitem__(__key:any)->any", PikaStdData_Dict___getitem__Method);
|
class_defineMethod(self, "__getitem__(__key)", PikaStdData_Dict___getitem__Method);
|
||||||
class_defineMethod(self, "__init__()", PikaStdData_Dict___init__Method);
|
class_defineMethod(self, "__init__()", PikaStdData_Dict___init__Method);
|
||||||
class_defineMethod(self, "__iter__()->any", PikaStdData_Dict___iter__Method);
|
class_defineMethod(self, "__iter__()", PikaStdData_Dict___iter__Method);
|
||||||
class_defineMethod(self, "__len__()->int", PikaStdData_Dict___len__Method);
|
class_defineMethod(self, "__len__()", PikaStdData_Dict___len__Method);
|
||||||
class_defineMethod(self, "__next__()->any", PikaStdData_Dict___next__Method);
|
class_defineMethod(self, "__next__()", PikaStdData_Dict___next__Method);
|
||||||
class_defineMethod(self, "__setitem__(__key:any,__val:any)", PikaStdData_Dict___setitem__Method);
|
class_defineMethod(self, "__setitem__(__key,__val)", PikaStdData_Dict___setitem__Method);
|
||||||
class_defineMethod(self, "__str__()->str", PikaStdData_Dict___str__Method);
|
class_defineMethod(self, "__str__()", PikaStdData_Dict___str__Method);
|
||||||
class_defineMethod(self, "get(key:str)->any", PikaStdData_Dict_getMethod);
|
class_defineMethod(self, "get(key)", PikaStdData_Dict_getMethod);
|
||||||
class_defineMethod(self, "keys()->dict_keys", PikaStdData_Dict_keysMethod);
|
class_defineMethod(self, "items()", PikaStdData_Dict_itemsMethod);
|
||||||
class_defineMethod(self, "remove(key:str)", PikaStdData_Dict_removeMethod);
|
class_defineMethod(self, "keys()", PikaStdData_Dict_keysMethod);
|
||||||
class_defineMethod(self, "set(key:str,arg:any)", PikaStdData_Dict_setMethod);
|
class_defineMethod(self, "remove(key)", PikaStdData_Dict_removeMethod);
|
||||||
|
class_defineMethod(self, "set(key,arg)", PikaStdData_Dict_setMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,14 +419,14 @@ void PikaStdData_FILEIO_writelinesMethod(PikaObj *self, Args *args){
|
|||||||
PikaObj *New_PikaStdData_FILEIO(Args *args){
|
PikaObj *New_PikaStdData_FILEIO(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "close()", PikaStdData_FILEIO_closeMethod);
|
class_defineMethod(self, "close()", PikaStdData_FILEIO_closeMethod);
|
||||||
class_defineMethod(self, "init(path:str,mode:str)->int", PikaStdData_FILEIO_initMethod);
|
class_defineMethod(self, "init(path,mode)", PikaStdData_FILEIO_initMethod);
|
||||||
class_defineMethod(self, "read(size:int)->any", PikaStdData_FILEIO_readMethod);
|
class_defineMethod(self, "read(size)", PikaStdData_FILEIO_readMethod);
|
||||||
class_defineMethod(self, "readline()->str", PikaStdData_FILEIO_readlineMethod);
|
class_defineMethod(self, "readline()", PikaStdData_FILEIO_readlineMethod);
|
||||||
class_defineMethod(self, "readlines()->List", PikaStdData_FILEIO_readlinesMethod);
|
class_defineMethod(self, "readlines()", PikaStdData_FILEIO_readlinesMethod);
|
||||||
class_defineMethod(self, "seek(offset:int,*fromwhere)->int", PikaStdData_FILEIO_seekMethod);
|
class_defineMethod(self, "seek(offset,*fromwhere)", PikaStdData_FILEIO_seekMethod);
|
||||||
class_defineMethod(self, "tell()->int", PikaStdData_FILEIO_tellMethod);
|
class_defineMethod(self, "tell()", PikaStdData_FILEIO_tellMethod);
|
||||||
class_defineMethod(self, "write(s:any)->int", PikaStdData_FILEIO_writeMethod);
|
class_defineMethod(self, "write(s)", PikaStdData_FILEIO_writeMethod);
|
||||||
class_defineMethod(self, "writelines(lines:List)", PikaStdData_FILEIO_writelinesMethod);
|
class_defineMethod(self, "writelines(lines)", PikaStdData_FILEIO_writelinesMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,13 +474,13 @@ void PikaStdData_List_setMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_List(Args *args){
|
PikaObj *New_PikaStdData_List(Args *args){
|
||||||
PikaObj *self = New_PikaStdData_Tuple(args);
|
PikaObj *self = New_PikaStdData_Tuple(args);
|
||||||
class_defineMethod(self, "__add__(others:List)->List", PikaStdData_List___add__Method);
|
class_defineMethod(self, "__add__(others)", PikaStdData_List___add__Method);
|
||||||
class_defineMethod(self, "__init__()", PikaStdData_List___init__Method);
|
class_defineMethod(self, "__init__()", PikaStdData_List___init__Method);
|
||||||
class_defineMethod(self, "__setitem__(__key:any,__val:any)", PikaStdData_List___setitem__Method);
|
class_defineMethod(self, "__setitem__(__key,__val)", PikaStdData_List___setitem__Method);
|
||||||
class_defineMethod(self, "__str__()->str", PikaStdData_List___str__Method);
|
class_defineMethod(self, "__str__()", PikaStdData_List___str__Method);
|
||||||
class_defineMethod(self, "append(arg:any)", PikaStdData_List_appendMethod);
|
class_defineMethod(self, "append(arg)", PikaStdData_List_appendMethod);
|
||||||
class_defineMethod(self, "reverse()", PikaStdData_List_reverseMethod);
|
class_defineMethod(self, "reverse()", PikaStdData_List_reverseMethod);
|
||||||
class_defineMethod(self, "set(i:int,arg:any)", PikaStdData_List_setMethod);
|
class_defineMethod(self, "set(i,arg)", PikaStdData_List_setMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +528,8 @@ void PikaStdData_String___str__Method(PikaObj *self, Args *args){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PikaStdData_String_encodeMethod(PikaObj *self, Args *args){
|
void PikaStdData_String_encodeMethod(PikaObj *self, Args *args){
|
||||||
Arg* res = PikaStdData_String_encode(self);
|
PikaTuple* encoding = args_getTuple(args, "encoding");
|
||||||
|
Arg* res = PikaStdData_String_encode(self, encoding);
|
||||||
method_returnArg(args, res);
|
method_returnArg(args, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,26 +600,26 @@ void PikaStdData_String_stripMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_String(Args *args){
|
PikaObj *New_PikaStdData_String(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "__getitem__(__key:any)->any", PikaStdData_String___getitem__Method);
|
class_defineMethod(self, "__getitem__(__key)", PikaStdData_String___getitem__Method);
|
||||||
class_defineMethod(self, "__init__(s:str)", PikaStdData_String___init__Method);
|
class_defineMethod(self, "__init__(s)", PikaStdData_String___init__Method);
|
||||||
class_defineMethod(self, "__iter__()->any", PikaStdData_String___iter__Method);
|
class_defineMethod(self, "__iter__()", PikaStdData_String___iter__Method);
|
||||||
class_defineMethod(self, "__len__()->int", PikaStdData_String___len__Method);
|
class_defineMethod(self, "__len__()", PikaStdData_String___len__Method);
|
||||||
class_defineMethod(self, "__next__()->any", PikaStdData_String___next__Method);
|
class_defineMethod(self, "__next__()", PikaStdData_String___next__Method);
|
||||||
class_defineMethod(self, "__setitem__(__key:any,__val:any)", PikaStdData_String___setitem__Method);
|
class_defineMethod(self, "__setitem__(__key,__val)", PikaStdData_String___setitem__Method);
|
||||||
class_defineMethod(self, "__str__()->str", PikaStdData_String___str__Method);
|
class_defineMethod(self, "__str__()", PikaStdData_String___str__Method);
|
||||||
class_defineMethod(self, "encode()->bytes", PikaStdData_String_encodeMethod);
|
class_defineMethod(self, "encode(*encoding)", PikaStdData_String_encodeMethod);
|
||||||
class_defineMethod(self, "endswith(suffix:str)->int", PikaStdData_String_endswithMethod);
|
class_defineMethod(self, "endswith(suffix)", PikaStdData_String_endswithMethod);
|
||||||
class_defineMethod(self, "get()->str", PikaStdData_String_getMethod);
|
class_defineMethod(self, "get()", PikaStdData_String_getMethod);
|
||||||
class_defineMethod(self, "isalnum()->int", PikaStdData_String_isalnumMethod);
|
class_defineMethod(self, "isalnum()", PikaStdData_String_isalnumMethod);
|
||||||
class_defineMethod(self, "isalpha()->int", PikaStdData_String_isalphaMethod);
|
class_defineMethod(self, "isalpha()", PikaStdData_String_isalphaMethod);
|
||||||
class_defineMethod(self, "isdigit()->int", PikaStdData_String_isdigitMethod);
|
class_defineMethod(self, "isdigit()", PikaStdData_String_isdigitMethod);
|
||||||
class_defineMethod(self, "islower()->int", PikaStdData_String_islowerMethod);
|
class_defineMethod(self, "islower()", PikaStdData_String_islowerMethod);
|
||||||
class_defineMethod(self, "isspace()->int", PikaStdData_String_isspaceMethod);
|
class_defineMethod(self, "isspace()", PikaStdData_String_isspaceMethod);
|
||||||
class_defineMethod(self, "replace(old:str,new:str)->str", PikaStdData_String_replaceMethod);
|
class_defineMethod(self, "replace(old,new)", PikaStdData_String_replaceMethod);
|
||||||
class_defineMethod(self, "set(s:str)", PikaStdData_String_setMethod);
|
class_defineMethod(self, "set(s)", PikaStdData_String_setMethod);
|
||||||
class_defineMethod(self, "split(s:str)->List", PikaStdData_String_splitMethod);
|
class_defineMethod(self, "split(s)", PikaStdData_String_splitMethod);
|
||||||
class_defineMethod(self, "startswith(prefix:str)->int", PikaStdData_String_startswithMethod);
|
class_defineMethod(self, "startswith(prefix)", PikaStdData_String_startswithMethod);
|
||||||
class_defineMethod(self, "strip()->str", PikaStdData_String_stripMethod);
|
class_defineMethod(self, "strip()", PikaStdData_String_stripMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,6 +629,12 @@ Arg *PikaStdData_String(PikaObj *self){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PIKA_MODULE_PIKASTDDATA_DISABLE
|
#ifndef PIKA_MODULE_PIKASTDDATA_DISABLE
|
||||||
|
void PikaStdData_Tuple___contains__Method(PikaObj *self, Args *args){
|
||||||
|
Arg* val = args_getArg(args, "val");
|
||||||
|
int res = PikaStdData_Tuple___contains__(self, val);
|
||||||
|
method_returnInt(args, res);
|
||||||
|
}
|
||||||
|
|
||||||
void PikaStdData_Tuple___del__Method(PikaObj *self, Args *args){
|
void PikaStdData_Tuple___del__Method(PikaObj *self, Args *args){
|
||||||
PikaStdData_Tuple___del__(self);
|
PikaStdData_Tuple___del__(self);
|
||||||
}
|
}
|
||||||
@ -654,15 +682,16 @@ void PikaStdData_Tuple_lenMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_Tuple(Args *args){
|
PikaObj *New_PikaStdData_Tuple(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
|
class_defineMethod(self, "__contains__(val)", PikaStdData_Tuple___contains__Method);
|
||||||
class_defineMethod(self, "__del__()", PikaStdData_Tuple___del__Method);
|
class_defineMethod(self, "__del__()", PikaStdData_Tuple___del__Method);
|
||||||
class_defineMethod(self, "__getitem__(__key:any)->any", PikaStdData_Tuple___getitem__Method);
|
class_defineMethod(self, "__getitem__(__key)", PikaStdData_Tuple___getitem__Method);
|
||||||
class_defineMethod(self, "__init__()", PikaStdData_Tuple___init__Method);
|
class_defineMethod(self, "__init__()", PikaStdData_Tuple___init__Method);
|
||||||
class_defineMethod(self, "__iter__()->any", PikaStdData_Tuple___iter__Method);
|
class_defineMethod(self, "__iter__()", PikaStdData_Tuple___iter__Method);
|
||||||
class_defineMethod(self, "__len__()->int", PikaStdData_Tuple___len__Method);
|
class_defineMethod(self, "__len__()", PikaStdData_Tuple___len__Method);
|
||||||
class_defineMethod(self, "__next__()->any", PikaStdData_Tuple___next__Method);
|
class_defineMethod(self, "__next__()", PikaStdData_Tuple___next__Method);
|
||||||
class_defineMethod(self, "__str__()->str", PikaStdData_Tuple___str__Method);
|
class_defineMethod(self, "__str__()", PikaStdData_Tuple___str__Method);
|
||||||
class_defineMethod(self, "get(i:int)->any", PikaStdData_Tuple_getMethod);
|
class_defineMethod(self, "get(i)", PikaStdData_Tuple_getMethod);
|
||||||
class_defineMethod(self, "len()->int", PikaStdData_Tuple_lenMethod);
|
class_defineMethod(self, "len()", PikaStdData_Tuple_lenMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,7 +709,7 @@ void PikaStdData_Utils_int_to_bytesMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_Utils(Args *args){
|
PikaObj *New_PikaStdData_Utils(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "int_to_bytes(val:int)->bytes", PikaStdData_Utils_int_to_bytesMethod);
|
class_defineMethod(self, "int_to_bytes(val)", PikaStdData_Utils_int_to_bytesMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,6 +718,41 @@ Arg *PikaStdData_Utils(PikaObj *self){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PIKA_MODULE_PIKASTDDATA_DISABLE
|
||||||
|
void PikaStdData_dict_items___iter__Method(PikaObj *self, Args *args){
|
||||||
|
Arg* res = PikaStdData_dict_items___iter__(self);
|
||||||
|
method_returnArg(args, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PikaStdData_dict_items___len__Method(PikaObj *self, Args *args){
|
||||||
|
int res = PikaStdData_dict_items___len__(self);
|
||||||
|
method_returnInt(args, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PikaStdData_dict_items___next__Method(PikaObj *self, Args *args){
|
||||||
|
Arg* res = PikaStdData_dict_items___next__(self);
|
||||||
|
method_returnArg(args, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PikaStdData_dict_items___str__Method(PikaObj *self, Args *args){
|
||||||
|
char* res = PikaStdData_dict_items___str__(self);
|
||||||
|
method_returnStr(args, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
PikaObj *New_PikaStdData_dict_items(Args *args){
|
||||||
|
PikaObj *self = New_TinyObj(args);
|
||||||
|
class_defineMethod(self, "__iter__()", PikaStdData_dict_items___iter__Method);
|
||||||
|
class_defineMethod(self, "__len__()", PikaStdData_dict_items___len__Method);
|
||||||
|
class_defineMethod(self, "__next__()", PikaStdData_dict_items___next__Method);
|
||||||
|
class_defineMethod(self, "__str__()", PikaStdData_dict_items___str__Method);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
Arg *PikaStdData_dict_items(PikaObj *self){
|
||||||
|
return obj_newObjInPackage(New_PikaStdData_dict_items);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PIKA_MODULE_PIKASTDDATA_DISABLE
|
#ifndef PIKA_MODULE_PIKASTDDATA_DISABLE
|
||||||
void PikaStdData_dict_keys___iter__Method(PikaObj *self, Args *args){
|
void PikaStdData_dict_keys___iter__Method(PikaObj *self, Args *args){
|
||||||
Arg* res = PikaStdData_dict_keys___iter__(self);
|
Arg* res = PikaStdData_dict_keys___iter__(self);
|
||||||
@ -712,10 +776,10 @@ void PikaStdData_dict_keys___str__Method(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdData_dict_keys(Args *args){
|
PikaObj *New_PikaStdData_dict_keys(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "__iter__()->any", PikaStdData_dict_keys___iter__Method);
|
class_defineMethod(self, "__iter__()", PikaStdData_dict_keys___iter__Method);
|
||||||
class_defineMethod(self, "__len__()->int", PikaStdData_dict_keys___len__Method);
|
class_defineMethod(self, "__len__()", PikaStdData_dict_keys___len__Method);
|
||||||
class_defineMethod(self, "__next__()->any", PikaStdData_dict_keys___next__Method);
|
class_defineMethod(self, "__next__()", PikaStdData_dict_keys___next__Method);
|
||||||
class_defineMethod(self, "__str__()->str", PikaStdData_dict_keys___str__Method);
|
class_defineMethod(self, "__str__()", PikaStdData_dict_keys___str__Method);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,14 +811,14 @@ void PikaStdLib_SysObjMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdLib(Args *args){
|
PikaObj *New_PikaStdLib(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineConstructor(self, "MemChecker()->any", PikaStdLib_MemCheckerMethod);
|
class_defineConstructor(self, "MemChecker()", PikaStdLib_MemCheckerMethod);
|
||||||
#if 0
|
#if 0
|
||||||
class_defineConstructor(self, "RangeObj()->any", PikaStdLib_RangeObjMethod);
|
class_defineConstructor(self, "RangeObj()", PikaStdLib_RangeObjMethod);
|
||||||
#endif
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
class_defineConstructor(self, "StringObj()->any", PikaStdLib_StringObjMethod);
|
class_defineConstructor(self, "StringObj()", PikaStdLib_StringObjMethod);
|
||||||
#endif
|
#endif
|
||||||
class_defineConstructor(self, "SysObj()->any", PikaStdLib_SysObjMethod);
|
class_defineConstructor(self, "SysObj()", PikaStdLib_SysObjMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -785,10 +849,10 @@ void PikaStdLib_MemChecker_resetMaxMethod(PikaObj *self, Args *args){
|
|||||||
PikaObj *New_PikaStdLib_MemChecker(Args *args){
|
PikaObj *New_PikaStdLib_MemChecker(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "getMax()->float", PikaStdLib_MemChecker_getMaxMethod);
|
class_defineMethod(self, "getMax()", PikaStdLib_MemChecker_getMaxMethod);
|
||||||
#endif
|
#endif
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "getNow()->float", PikaStdLib_MemChecker_getNowMethod);
|
class_defineMethod(self, "getNow()", PikaStdLib_MemChecker_getNowMethod);
|
||||||
#endif
|
#endif
|
||||||
class_defineMethod(self, "max()", PikaStdLib_MemChecker_maxMethod);
|
class_defineMethod(self, "max()", PikaStdLib_MemChecker_maxMethod);
|
||||||
class_defineMethod(self, "now()", PikaStdLib_MemChecker_nowMethod);
|
class_defineMethod(self, "now()", PikaStdLib_MemChecker_nowMethod);
|
||||||
@ -811,7 +875,7 @@ void PikaStdLib_RangeObj___next__Method(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdLib_RangeObj(Args *args){
|
PikaObj *New_PikaStdLib_RangeObj(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "__next__()->any", PikaStdLib_RangeObj___next__Method);
|
class_defineMethod(self, "__next__()", PikaStdLib_RangeObj___next__Method);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -828,7 +892,7 @@ void PikaStdLib_StringObj___next__Method(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdLib_StringObj(Args *args){
|
PikaObj *New_PikaStdLib_StringObj(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "__next__()->any", PikaStdLib_StringObj___next__Method);
|
class_defineMethod(self, "__next__()", PikaStdLib_StringObj___next__Method);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,6 +961,10 @@ void PikaStdLib_SysObj_execMethod(PikaObj *self, Args *args){
|
|||||||
PikaStdLib_SysObj_exec(self, code);
|
PikaStdLib_SysObj_exec(self, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PikaStdLib_SysObj_exitMethod(PikaObj *self, Args *args){
|
||||||
|
PikaStdLib_SysObj_exit(self);
|
||||||
|
}
|
||||||
|
|
||||||
void PikaStdLib_SysObj_floatMethod(PikaObj *self, Args *args){
|
void PikaStdLib_SysObj_floatMethod(PikaObj *self, Args *args){
|
||||||
Arg* arg = args_getArg(args, "arg");
|
Arg* arg = args_getArg(args, "arg");
|
||||||
double res = PikaStdLib_SysObj_float(self, arg);
|
double res = PikaStdLib_SysObj_float(self, arg);
|
||||||
@ -960,18 +1028,13 @@ void PikaStdLib_SysObj_ordMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
void PikaStdLib_SysObj_printMethod(PikaObj *self, Args *args){
|
void PikaStdLib_SysObj_printMethod(PikaObj *self, Args *args){
|
||||||
PikaTuple* val = args_getTuple(args, "val");
|
PikaTuple* val = args_getTuple(args, "val");
|
||||||
PikaStdLib_SysObj_print(self, val);
|
PikaDict* ops = args_getDict(args, "ops");
|
||||||
}
|
PikaStdLib_SysObj_print(self, val, ops);
|
||||||
|
|
||||||
void PikaStdLib_SysObj_printNoEndMethod(PikaObj *self, Args *args){
|
|
||||||
Arg* val = args_getArg(args, "val");
|
|
||||||
PikaStdLib_SysObj_printNoEnd(self, val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PikaStdLib_SysObj_rangeMethod(PikaObj *self, Args *args){
|
void PikaStdLib_SysObj_rangeMethod(PikaObj *self, Args *args){
|
||||||
int a1 = args_getInt(args, "a1");
|
PikaTuple* ax = args_getTuple(args, "ax");
|
||||||
int a2 = args_getInt(args, "a2");
|
Arg* res = PikaStdLib_SysObj_range(self, ax);
|
||||||
Arg* res = PikaStdLib_SysObj_range(self, a1, a2);
|
|
||||||
method_returnArg(args, res);
|
method_returnArg(args, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -996,61 +1059,63 @@ void PikaStdLib_SysObj_typeMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdLib_SysObj(Args *args){
|
PikaObj *New_PikaStdLib_SysObj(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "__getitem__(obj:any,key:any)->any", PikaStdLib_SysObj___getitem__Method);
|
class_defineMethod(self, "__getitem__(obj,key)", PikaStdLib_SysObj___getitem__Method);
|
||||||
class_defineMethod(self, "__setitem__(obj:any,key:any,val:any)->any", PikaStdLib_SysObj___setitem__Method);
|
class_defineMethod(self, "__setitem__(obj,key,val)", PikaStdLib_SysObj___setitem__Method);
|
||||||
#if PIKA_BUILTIN_STRUCT_ENABLE
|
#if PIKA_BUILTIN_STRUCT_ENABLE
|
||||||
class_defineMethod(self, "__slice__(obj:any,start:any,end:any,step:int)->any", PikaStdLib_SysObj___slice__Method);
|
class_defineMethod(self, "__slice__(obj,start,end,step)", PikaStdLib_SysObj___slice__Method);
|
||||||
#endif
|
#endif
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "bytes(val:any)->bytes", PikaStdLib_SysObj_bytesMethod);
|
class_defineMethod(self, "bytes(val)", PikaStdLib_SysObj_bytesMethod);
|
||||||
#endif
|
#endif
|
||||||
#if PIKA_SYNTAX_FORMAT_ENABLE
|
#if PIKA_SYNTAX_FORMAT_ENABLE
|
||||||
class_defineMethod(self, "cformat(fmt:str,*var)->str", PikaStdLib_SysObj_cformatMethod);
|
class_defineMethod(self, "cformat(fmt,*var)", PikaStdLib_SysObj_cformatMethod);
|
||||||
#endif
|
#endif
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "chr(val:int)->str", PikaStdLib_SysObj_chrMethod);
|
class_defineMethod(self, "chr(val)", PikaStdLib_SysObj_chrMethod);
|
||||||
#endif
|
#endif
|
||||||
#if PIKA_BUILTIN_STRUCT_ENABLE
|
#if PIKA_BUILTIN_STRUCT_ENABLE
|
||||||
class_defineMethod(self, "dict()->any", PikaStdLib_SysObj_dictMethod);
|
class_defineMethod(self, "dict()", PikaStdLib_SysObj_dictMethod);
|
||||||
#endif
|
#endif
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "dir(obj:object)->list", PikaStdLib_SysObj_dirMethod);
|
class_defineMethod(self, "dir(obj)", PikaStdLib_SysObj_dirMethod);
|
||||||
#endif
|
#endif
|
||||||
#if PIKA_EXEC_ENABLE
|
#if PIKA_EXEC_ENABLE
|
||||||
class_defineMethod(self, "exec(code:str)", PikaStdLib_SysObj_execMethod);
|
class_defineMethod(self, "exec(code)", PikaStdLib_SysObj_execMethod);
|
||||||
#endif
|
|
||||||
class_defineMethod(self, "float(arg:any)->float", PikaStdLib_SysObj_floatMethod);
|
|
||||||
#if !PIKA_NANO_ENABLE
|
|
||||||
class_defineMethod(self, "getattr(obj:object,name:str)->any", PikaStdLib_SysObj_getattrMethod);
|
|
||||||
#endif
|
#endif
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "hex(val:int)->str", PikaStdLib_SysObj_hexMethod);
|
class_defineMethod(self, "exit()", PikaStdLib_SysObj_exitMethod);
|
||||||
|
#endif
|
||||||
|
class_defineMethod(self, "float(arg)", PikaStdLib_SysObj_floatMethod);
|
||||||
|
#if !PIKA_NANO_ENABLE
|
||||||
|
class_defineMethod(self, "getattr(obj,name)", PikaStdLib_SysObj_getattrMethod);
|
||||||
#endif
|
#endif
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "id(obj:any)->int", PikaStdLib_SysObj_idMethod);
|
class_defineMethod(self, "hex(val)", PikaStdLib_SysObj_hexMethod);
|
||||||
#endif
|
#endif
|
||||||
class_defineMethod(self, "int(arg:any)->int", PikaStdLib_SysObj_intMethod);
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "iter(arg:any)->any", PikaStdLib_SysObj_iterMethod);
|
class_defineMethod(self, "id(obj)", PikaStdLib_SysObj_idMethod);
|
||||||
class_defineMethod(self, "len(arg:any)->int", PikaStdLib_SysObj_lenMethod);
|
#endif
|
||||||
|
class_defineMethod(self, "int(arg)", PikaStdLib_SysObj_intMethod);
|
||||||
|
class_defineMethod(self, "iter(arg)", PikaStdLib_SysObj_iterMethod);
|
||||||
|
class_defineMethod(self, "len(arg)", PikaStdLib_SysObj_lenMethod);
|
||||||
#if PIKA_BUILTIN_STRUCT_ENABLE
|
#if PIKA_BUILTIN_STRUCT_ENABLE
|
||||||
class_defineMethod(self, "list()->any", PikaStdLib_SysObj_listMethod);
|
class_defineMethod(self, "list()", PikaStdLib_SysObj_listMethod);
|
||||||
#endif
|
#endif
|
||||||
#if PIKA_FILEIO_ENABLE
|
#if PIKA_FILEIO_ENABLE
|
||||||
class_defineMethod(self, "open(path:str,mode:str)->object", PikaStdLib_SysObj_openMethod);
|
class_defineMethod(self, "open(path,mode)", PikaStdLib_SysObj_openMethod);
|
||||||
#endif
|
#endif
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "ord(val:str)->int", PikaStdLib_SysObj_ordMethod);
|
class_defineMethod(self, "ord(val)", PikaStdLib_SysObj_ordMethod);
|
||||||
#endif
|
#endif
|
||||||
class_defineMethod(self, "print(*val)", PikaStdLib_SysObj_printMethod);
|
class_defineMethod(self, "print(*val,**ops)", PikaStdLib_SysObj_printMethod);
|
||||||
|
class_defineMethod(self, "range(*ax)", PikaStdLib_SysObj_rangeMethod);
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "printNoEnd(val:any)", PikaStdLib_SysObj_printNoEndMethod);
|
class_defineMethod(self, "setattr(obj,name,val)", PikaStdLib_SysObj_setattrMethod);
|
||||||
#endif
|
#endif
|
||||||
class_defineMethod(self, "range(a1:int,a2:int)->any", PikaStdLib_SysObj_rangeMethod);
|
class_defineMethod(self, "str(arg)", PikaStdLib_SysObj_strMethod);
|
||||||
#if !PIKA_NANO_ENABLE
|
#if !PIKA_NANO_ENABLE
|
||||||
class_defineMethod(self, "setattr(obj:object,name:str,val:any)", PikaStdLib_SysObj_setattrMethod);
|
class_defineMethod(self, "type(arg)", PikaStdLib_SysObj_typeMethod);
|
||||||
#endif
|
#endif
|
||||||
class_defineMethod(self, "str(arg:any)->str", PikaStdLib_SysObj_strMethod);
|
|
||||||
class_defineMethod(self, "type(arg:any)->any", PikaStdLib_SysObj_typeMethod);
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,7 +1132,7 @@ void PikaStdTask_TaskMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_PikaStdTask(Args *args){
|
PikaObj *New_PikaStdTask(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineConstructor(self, "Task()->any", PikaStdTask_TaskMethod);
|
class_defineConstructor(self, "Task()", PikaStdTask_TaskMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1115,13 +1180,13 @@ PikaObj *New_PikaStdTask_Task(Args *args){
|
|||||||
PikaObj *self = New_PikaStdLib_SysObj(args);
|
PikaObj *self = New_PikaStdLib_SysObj(args);
|
||||||
obj_newObj(self, "calls", "PikaStdData_List", New_PikaStdData_List);
|
obj_newObj(self, "calls", "PikaStdData_List", New_PikaStdData_List);
|
||||||
class_defineMethod(self, "__init__()", PikaStdTask_Task___init__Method);
|
class_defineMethod(self, "__init__()", PikaStdTask_Task___init__Method);
|
||||||
class_defineMethod(self, "call_always(fun_todo:any)", PikaStdTask_Task_call_alwaysMethod);
|
class_defineMethod(self, "call_always(fun_todo)", PikaStdTask_Task_call_alwaysMethod);
|
||||||
class_defineMethod(self, "call_period_ms(fun_todo:any,period_ms:int)", PikaStdTask_Task_call_period_msMethod);
|
class_defineMethod(self, "call_period_ms(fun_todo,period_ms)", PikaStdTask_Task_call_period_msMethod);
|
||||||
class_defineMethod(self, "call_when(fun_todo:any,fun_when:any)", PikaStdTask_Task_call_whenMethod);
|
class_defineMethod(self, "call_when(fun_todo,fun_when)", PikaStdTask_Task_call_whenMethod);
|
||||||
class_defineMethod(self, "platformGetTick()", PikaStdTask_Task_platformGetTickMethod);
|
class_defineMethod(self, "platformGetTick()", PikaStdTask_Task_platformGetTickMethod);
|
||||||
class_defineMethod(self, "run_forever()", PikaStdTask_Task_run_foreverMethod);
|
class_defineMethod(self, "run_forever()", PikaStdTask_Task_run_foreverMethod);
|
||||||
class_defineMethod(self, "run_once()", PikaStdTask_Task_run_onceMethod);
|
class_defineMethod(self, "run_once()", PikaStdTask_Task_run_onceMethod);
|
||||||
class_defineMethod(self, "run_until_ms(until_ms:int)", PikaStdTask_Task_run_until_msMethod);
|
class_defineMethod(self, "run_until_ms(until_ms)", PikaStdTask_Task_run_until_msMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1291,37 +1356,37 @@ void pika_lvgl_timer_create_basicMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl(Args *args){
|
PikaObj *New_pika_lvgl(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineConstructor(self, "ALIGN()->any", pika_lvgl_ALIGNMethod);
|
class_defineConstructor(self, "ALIGN()", pika_lvgl_ALIGNMethod);
|
||||||
class_defineConstructor(self, "ANIM()->any", pika_lvgl_ANIMMethod);
|
class_defineConstructor(self, "ANIM()", pika_lvgl_ANIMMethod);
|
||||||
class_defineConstructor(self, "EVENT()->any", pika_lvgl_EVENTMethod);
|
class_defineConstructor(self, "EVENT()", pika_lvgl_EVENTMethod);
|
||||||
class_defineConstructor(self, "OPA()->any", pika_lvgl_OPAMethod);
|
class_defineConstructor(self, "OPA()", pika_lvgl_OPAMethod);
|
||||||
class_defineConstructor(self, "PALETTE()->any", pika_lvgl_PALETTEMethod);
|
class_defineConstructor(self, "PALETTE()", pika_lvgl_PALETTEMethod);
|
||||||
class_defineConstructor(self, "STATE()->any", pika_lvgl_STATEMethod);
|
class_defineConstructor(self, "STATE()", pika_lvgl_STATEMethod);
|
||||||
class_defineMethod(self, "__init__()", pika_lvgl___init__Method);
|
class_defineMethod(self, "__init__()", pika_lvgl___init__Method);
|
||||||
class_defineConstructor(self, "arc()->any", pika_lvgl_arcMethod);
|
class_defineConstructor(self, "arc()", pika_lvgl_arcMethod);
|
||||||
class_defineConstructor(self, "bar()->any", pika_lvgl_barMethod);
|
class_defineConstructor(self, "bar()", pika_lvgl_barMethod);
|
||||||
class_defineConstructor(self, "btn()->any", pika_lvgl_btnMethod);
|
class_defineConstructor(self, "btn()", pika_lvgl_btnMethod);
|
||||||
class_defineConstructor(self, "checkbox()->any", pika_lvgl_checkboxMethod);
|
class_defineConstructor(self, "checkbox()", pika_lvgl_checkboxMethod);
|
||||||
class_defineConstructor(self, "dropdown()->any", pika_lvgl_dropdownMethod);
|
class_defineConstructor(self, "dropdown()", pika_lvgl_dropdownMethod);
|
||||||
class_defineMethod(self, "indev_get_act()->indev_t", pika_lvgl_indev_get_actMethod);
|
class_defineMethod(self, "indev_get_act()", pika_lvgl_indev_get_actMethod);
|
||||||
class_defineConstructor(self, "indev_t()->any", pika_lvgl_indev_tMethod);
|
class_defineConstructor(self, "indev_t()", pika_lvgl_indev_tMethod);
|
||||||
class_defineConstructor(self, "label()->any", pika_lvgl_labelMethod);
|
class_defineConstructor(self, "label()", pika_lvgl_labelMethod);
|
||||||
class_defineConstructor(self, "lv_color_t()->any", pika_lvgl_lv_color_tMethod);
|
class_defineConstructor(self, "lv_color_t()", pika_lvgl_lv_color_tMethod);
|
||||||
class_defineConstructor(self, "lv_event()->any", pika_lvgl_lv_eventMethod);
|
class_defineConstructor(self, "lv_event()", pika_lvgl_lv_eventMethod);
|
||||||
class_defineConstructor(self, "lv_obj()->any", pika_lvgl_lv_objMethod);
|
class_defineConstructor(self, "lv_obj()", pika_lvgl_lv_objMethod);
|
||||||
class_defineConstructor(self, "lv_timer_t()->any", pika_lvgl_lv_timer_tMethod);
|
class_defineConstructor(self, "lv_timer_t()", pika_lvgl_lv_timer_tMethod);
|
||||||
class_defineMethod(self, "obj(parent:lv_obj)->lv_obj", pika_lvgl_objMethod);
|
class_defineMethod(self, "obj(parent)", pika_lvgl_objMethod);
|
||||||
class_defineMethod(self, "palette_lighten(p:int,lvl:int)->lv_color_t", pika_lvgl_palette_lightenMethod);
|
class_defineMethod(self, "palette_lighten(p,lvl)", pika_lvgl_palette_lightenMethod);
|
||||||
class_defineMethod(self, "palette_main(p:int)->lv_color_t", pika_lvgl_palette_mainMethod);
|
class_defineMethod(self, "palette_main(p)", pika_lvgl_palette_mainMethod);
|
||||||
class_defineConstructor(self, "point_t()->any", pika_lvgl_point_tMethod);
|
class_defineConstructor(self, "point_t()", pika_lvgl_point_tMethod);
|
||||||
class_defineConstructor(self, "roller()->any", pika_lvgl_rollerMethod);
|
class_defineConstructor(self, "roller()", pika_lvgl_rollerMethod);
|
||||||
class_defineMethod(self, "scr_act()->lv_obj", pika_lvgl_scr_actMethod);
|
class_defineMethod(self, "scr_act()", pika_lvgl_scr_actMethod);
|
||||||
class_defineConstructor(self, "slider()->any", pika_lvgl_sliderMethod);
|
class_defineConstructor(self, "slider()", pika_lvgl_sliderMethod);
|
||||||
class_defineConstructor(self, "style_t()->any", pika_lvgl_style_tMethod);
|
class_defineConstructor(self, "style_t()", pika_lvgl_style_tMethod);
|
||||||
class_defineConstructor(self, "switch()->any", pika_lvgl_switchMethod);
|
class_defineConstructor(self, "switch()", pika_lvgl_switchMethod);
|
||||||
class_defineConstructor(self, "table()->any", pika_lvgl_tableMethod);
|
class_defineConstructor(self, "table()", pika_lvgl_tableMethod);
|
||||||
class_defineConstructor(self, "textarea()->any", pika_lvgl_textareaMethod);
|
class_defineConstructor(self, "textarea()", pika_lvgl_textareaMethod);
|
||||||
class_defineMethod(self, "timer_create_basic()->lv_timer_t", pika_lvgl_timer_create_basicMethod);
|
class_defineMethod(self, "timer_create_basic()", pika_lvgl_timer_create_basicMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1528,26 +1593,26 @@ void pika_lvgl_arc_set_valueMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_arc(Args *args){
|
PikaObj *New_pika_lvgl_arc(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_arc___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_arc___init__Method);
|
||||||
class_defineMethod(self, "get_angle_end()->int", pika_lvgl_arc_get_angle_endMethod);
|
class_defineMethod(self, "get_angle_end()", pika_lvgl_arc_get_angle_endMethod);
|
||||||
class_defineMethod(self, "get_angle_start()->int", pika_lvgl_arc_get_angle_startMethod);
|
class_defineMethod(self, "get_angle_start()", pika_lvgl_arc_get_angle_startMethod);
|
||||||
class_defineMethod(self, "get_bg_angle_end()->int", pika_lvgl_arc_get_bg_angle_endMethod);
|
class_defineMethod(self, "get_bg_angle_end()", pika_lvgl_arc_get_bg_angle_endMethod);
|
||||||
class_defineMethod(self, "get_bg_angle_start()->int", pika_lvgl_arc_get_bg_angle_startMethod);
|
class_defineMethod(self, "get_bg_angle_start()", pika_lvgl_arc_get_bg_angle_startMethod);
|
||||||
class_defineMethod(self, "get_max_value()->int", pika_lvgl_arc_get_max_valueMethod);
|
class_defineMethod(self, "get_max_value()", pika_lvgl_arc_get_max_valueMethod);
|
||||||
class_defineMethod(self, "get_min_value()->int", pika_lvgl_arc_get_min_valueMethod);
|
class_defineMethod(self, "get_min_value()", pika_lvgl_arc_get_min_valueMethod);
|
||||||
class_defineMethod(self, "get_mode()->int", pika_lvgl_arc_get_modeMethod);
|
class_defineMethod(self, "get_mode()", pika_lvgl_arc_get_modeMethod);
|
||||||
class_defineMethod(self, "get_value()->int", pika_lvgl_arc_get_valueMethod);
|
class_defineMethod(self, "get_value()", pika_lvgl_arc_get_valueMethod);
|
||||||
class_defineMethod(self, "set_angles(start:int,end:int)", pika_lvgl_arc_set_anglesMethod);
|
class_defineMethod(self, "set_angles(start,end)", pika_lvgl_arc_set_anglesMethod);
|
||||||
class_defineMethod(self, "set_bg_angles(start:int,end:int)", pika_lvgl_arc_set_bg_anglesMethod);
|
class_defineMethod(self, "set_bg_angles(start,end)", pika_lvgl_arc_set_bg_anglesMethod);
|
||||||
class_defineMethod(self, "set_bg_end_angle(angle:int)", pika_lvgl_arc_set_bg_end_angleMethod);
|
class_defineMethod(self, "set_bg_end_angle(angle)", pika_lvgl_arc_set_bg_end_angleMethod);
|
||||||
class_defineMethod(self, "set_bg_start_angle(start:int)", pika_lvgl_arc_set_bg_start_angleMethod);
|
class_defineMethod(self, "set_bg_start_angle(start)", pika_lvgl_arc_set_bg_start_angleMethod);
|
||||||
class_defineMethod(self, "set_change_rate(rate:int)", pika_lvgl_arc_set_change_rateMethod);
|
class_defineMethod(self, "set_change_rate(rate)", pika_lvgl_arc_set_change_rateMethod);
|
||||||
class_defineMethod(self, "set_end_angle(angle:int)", pika_lvgl_arc_set_end_angleMethod);
|
class_defineMethod(self, "set_end_angle(angle)", pika_lvgl_arc_set_end_angleMethod);
|
||||||
class_defineMethod(self, "set_mode(mode:int)", pika_lvgl_arc_set_modeMethod);
|
class_defineMethod(self, "set_mode(mode)", pika_lvgl_arc_set_modeMethod);
|
||||||
class_defineMethod(self, "set_range(min:int,max:int)", pika_lvgl_arc_set_rangeMethod);
|
class_defineMethod(self, "set_range(min,max)", pika_lvgl_arc_set_rangeMethod);
|
||||||
class_defineMethod(self, "set_rotation(rotation:int)", pika_lvgl_arc_set_rotationMethod);
|
class_defineMethod(self, "set_rotation(rotation)", pika_lvgl_arc_set_rotationMethod);
|
||||||
class_defineMethod(self, "set_start_angle(start:int)", pika_lvgl_arc_set_start_angleMethod);
|
class_defineMethod(self, "set_start_angle(start)", pika_lvgl_arc_set_start_angleMethod);
|
||||||
class_defineMethod(self, "set_value(value:int)", pika_lvgl_arc_set_valueMethod);
|
class_defineMethod(self, "set_value(value)", pika_lvgl_arc_set_valueMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1612,16 +1677,16 @@ void pika_lvgl_bar_set_valueMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_bar(Args *args){
|
PikaObj *New_pika_lvgl_bar(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_bar___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_bar___init__Method);
|
||||||
class_defineMethod(self, "get_max_value()->int", pika_lvgl_bar_get_max_valueMethod);
|
class_defineMethod(self, "get_max_value()", pika_lvgl_bar_get_max_valueMethod);
|
||||||
class_defineMethod(self, "get_min_value()->int", pika_lvgl_bar_get_min_valueMethod);
|
class_defineMethod(self, "get_min_value()", pika_lvgl_bar_get_min_valueMethod);
|
||||||
class_defineMethod(self, "get_mode()->int", pika_lvgl_bar_get_modeMethod);
|
class_defineMethod(self, "get_mode()", pika_lvgl_bar_get_modeMethod);
|
||||||
class_defineMethod(self, "get_start_value()->int", pika_lvgl_bar_get_start_valueMethod);
|
class_defineMethod(self, "get_start_value()", pika_lvgl_bar_get_start_valueMethod);
|
||||||
class_defineMethod(self, "get_value()->int", pika_lvgl_bar_get_valueMethod);
|
class_defineMethod(self, "get_value()", pika_lvgl_bar_get_valueMethod);
|
||||||
class_defineMethod(self, "set_mode(mode:int)", pika_lvgl_bar_set_modeMethod);
|
class_defineMethod(self, "set_mode(mode)", pika_lvgl_bar_set_modeMethod);
|
||||||
class_defineMethod(self, "set_range(min:int,max:int)", pika_lvgl_bar_set_rangeMethod);
|
class_defineMethod(self, "set_range(min,max)", pika_lvgl_bar_set_rangeMethod);
|
||||||
class_defineMethod(self, "set_start_value(start_value:int,anim:int)", pika_lvgl_bar_set_start_valueMethod);
|
class_defineMethod(self, "set_start_value(start_value,anim)", pika_lvgl_bar_set_start_valueMethod);
|
||||||
class_defineMethod(self, "set_value(value:int,anim:int)", pika_lvgl_bar_set_valueMethod);
|
class_defineMethod(self, "set_value(value,anim)", pika_lvgl_bar_set_valueMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1638,7 +1703,7 @@ void pika_lvgl_btn___init__Method(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_btn(Args *args){
|
PikaObj *New_pika_lvgl_btn(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_btn___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_btn___init__Method);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1670,10 +1735,10 @@ void pika_lvgl_checkbox_set_text_staticMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_checkbox(Args *args){
|
PikaObj *New_pika_lvgl_checkbox(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_checkbox___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_checkbox___init__Method);
|
||||||
class_defineMethod(self, "get_text()->str", pika_lvgl_checkbox_get_textMethod);
|
class_defineMethod(self, "get_text()", pika_lvgl_checkbox_get_textMethod);
|
||||||
class_defineMethod(self, "set_text(txt:str)", pika_lvgl_checkbox_set_textMethod);
|
class_defineMethod(self, "set_text(txt)", pika_lvgl_checkbox_set_textMethod);
|
||||||
class_defineMethod(self, "set_text_static(txt:str)", pika_lvgl_checkbox_set_text_staticMethod);
|
class_defineMethod(self, "set_text_static(txt)", pika_lvgl_checkbox_set_text_staticMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1789,27 +1854,27 @@ void pika_lvgl_dropdown_set_textMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_dropdown(Args *args){
|
PikaObj *New_pika_lvgl_dropdown(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_dropdown___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_dropdown___init__Method);
|
||||||
class_defineMethod(self, "add_option(option:str,pos:int)", pika_lvgl_dropdown_add_optionMethod);
|
class_defineMethod(self, "add_option(option,pos)", pika_lvgl_dropdown_add_optionMethod);
|
||||||
class_defineMethod(self, "clear_options()", pika_lvgl_dropdown_clear_optionsMethod);
|
class_defineMethod(self, "clear_options()", pika_lvgl_dropdown_clear_optionsMethod);
|
||||||
class_defineMethod(self, "close()", pika_lvgl_dropdown_closeMethod);
|
class_defineMethod(self, "close()", pika_lvgl_dropdown_closeMethod);
|
||||||
class_defineMethod(self, "get_dir()->int", pika_lvgl_dropdown_get_dirMethod);
|
class_defineMethod(self, "get_dir()", pika_lvgl_dropdown_get_dirMethod);
|
||||||
class_defineMethod(self, "get_option_cnt()->int", pika_lvgl_dropdown_get_option_cntMethod);
|
class_defineMethod(self, "get_option_cnt()", pika_lvgl_dropdown_get_option_cntMethod);
|
||||||
class_defineMethod(self, "get_option_index(option:str)->int", pika_lvgl_dropdown_get_option_indexMethod);
|
class_defineMethod(self, "get_option_index(option)", pika_lvgl_dropdown_get_option_indexMethod);
|
||||||
class_defineMethod(self, "get_options()->str", pika_lvgl_dropdown_get_optionsMethod);
|
class_defineMethod(self, "get_options()", pika_lvgl_dropdown_get_optionsMethod);
|
||||||
class_defineMethod(self, "get_selected()->int", pika_lvgl_dropdown_get_selectedMethod);
|
class_defineMethod(self, "get_selected()", pika_lvgl_dropdown_get_selectedMethod);
|
||||||
class_defineMethod(self, "get_selected_highlight()->int", pika_lvgl_dropdown_get_selected_highlightMethod);
|
class_defineMethod(self, "get_selected_highlight()", pika_lvgl_dropdown_get_selected_highlightMethod);
|
||||||
class_defineMethod(self, "get_selected_str()->str", pika_lvgl_dropdown_get_selected_strMethod);
|
class_defineMethod(self, "get_selected_str()", pika_lvgl_dropdown_get_selected_strMethod);
|
||||||
class_defineMethod(self, "get_symbol()->int", pika_lvgl_dropdown_get_symbolMethod);
|
class_defineMethod(self, "get_symbol()", pika_lvgl_dropdown_get_symbolMethod);
|
||||||
class_defineMethod(self, "get_text()->str", pika_lvgl_dropdown_get_textMethod);
|
class_defineMethod(self, "get_text()", pika_lvgl_dropdown_get_textMethod);
|
||||||
class_defineMethod(self, "is_open()->int", pika_lvgl_dropdown_is_openMethod);
|
class_defineMethod(self, "is_open()", pika_lvgl_dropdown_is_openMethod);
|
||||||
class_defineMethod(self, "open()", pika_lvgl_dropdown_openMethod);
|
class_defineMethod(self, "open()", pika_lvgl_dropdown_openMethod);
|
||||||
class_defineMethod(self, "set_dir(dir:int)", pika_lvgl_dropdown_set_dirMethod);
|
class_defineMethod(self, "set_dir(dir)", pika_lvgl_dropdown_set_dirMethod);
|
||||||
class_defineMethod(self, "set_options(options:str)", pika_lvgl_dropdown_set_optionsMethod);
|
class_defineMethod(self, "set_options(options)", pika_lvgl_dropdown_set_optionsMethod);
|
||||||
class_defineMethod(self, "set_selected(sel_opt:int)", pika_lvgl_dropdown_set_selectedMethod);
|
class_defineMethod(self, "set_selected(sel_opt)", pika_lvgl_dropdown_set_selectedMethod);
|
||||||
class_defineMethod(self, "set_selected_hightlight(en:int)", pika_lvgl_dropdown_set_selected_hightlightMethod);
|
class_defineMethod(self, "set_selected_hightlight(en)", pika_lvgl_dropdown_set_selected_hightlightMethod);
|
||||||
class_defineMethod(self, "set_symbol(symbol:str)", pika_lvgl_dropdown_set_symbolMethod);
|
class_defineMethod(self, "set_symbol(symbol)", pika_lvgl_dropdown_set_symbolMethod);
|
||||||
class_defineMethod(self, "set_text(txt:str)", pika_lvgl_dropdown_set_textMethod);
|
class_defineMethod(self, "set_text(txt)", pika_lvgl_dropdown_set_textMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1826,7 +1891,7 @@ void pika_lvgl_indev_t_get_vectMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_indev_t(Args *args){
|
PikaObj *New_pika_lvgl_indev_t(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "get_vect(point:point_t)", pika_lvgl_indev_t_get_vectMethod);
|
class_defineMethod(self, "get_vect(point)", pika_lvgl_indev_t_get_vectMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1864,11 +1929,11 @@ void pika_lvgl_label_set_textMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_label(Args *args){
|
PikaObj *New_pika_lvgl_label(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_label___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_label___init__Method);
|
||||||
class_defineMethod(self, "set_long_mode(mode:int)", pika_lvgl_label_set_long_modeMethod);
|
class_defineMethod(self, "set_long_mode(mode)", pika_lvgl_label_set_long_modeMethod);
|
||||||
class_defineMethod(self, "set_recolor(en:int)", pika_lvgl_label_set_recolorMethod);
|
class_defineMethod(self, "set_recolor(en)", pika_lvgl_label_set_recolorMethod);
|
||||||
class_defineMethod(self, "set_style_text_align(value:int,selector:int)", pika_lvgl_label_set_style_text_alignMethod);
|
class_defineMethod(self, "set_style_text_align(value,selector)", pika_lvgl_label_set_style_text_alignMethod);
|
||||||
class_defineMethod(self, "set_text(txt:str)", pika_lvgl_label_set_textMethod);
|
class_defineMethod(self, "set_text(txt)", pika_lvgl_label_set_textMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1901,8 +1966,8 @@ void pika_lvgl_lv_event_get_targetMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_lv_event(Args *args){
|
PikaObj *New_pika_lvgl_lv_event(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "get_code()->int", pika_lvgl_lv_event_get_codeMethod);
|
class_defineMethod(self, "get_code()", pika_lvgl_lv_event_get_codeMethod);
|
||||||
class_defineMethod(self, "get_target()->lv_obj", pika_lvgl_lv_event_get_targetMethod);
|
class_defineMethod(self, "get_target()", pika_lvgl_lv_event_get_targetMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1979,17 +2044,17 @@ void pika_lvgl_lv_obj_update_layoutMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_lv_obj(Args *args){
|
PikaObj *New_pika_lvgl_lv_obj(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "add_event_cb(event_cb:any,filter:int,user_data:pointer)", pika_lvgl_lv_obj_add_event_cbMethod);
|
class_defineMethod(self, "add_event_cb(event_cb,filter,user_data)", pika_lvgl_lv_obj_add_event_cbMethod);
|
||||||
class_defineMethod(self, "add_state(state:int)", pika_lvgl_lv_obj_add_stateMethod);
|
class_defineMethod(self, "add_state(state)", pika_lvgl_lv_obj_add_stateMethod);
|
||||||
class_defineMethod(self, "add_style(style:style_t,selector:int)", pika_lvgl_lv_obj_add_styleMethod);
|
class_defineMethod(self, "add_style(style,selector)", pika_lvgl_lv_obj_add_styleMethod);
|
||||||
class_defineMethod(self, "align(align:int,x_ofs:int,y_ofs:int)", pika_lvgl_lv_obj_alignMethod);
|
class_defineMethod(self, "align(align,x_ofs,y_ofs)", pika_lvgl_lv_obj_alignMethod);
|
||||||
class_defineMethod(self, "center()", pika_lvgl_lv_obj_centerMethod);
|
class_defineMethod(self, "center()", pika_lvgl_lv_obj_centerMethod);
|
||||||
class_defineMethod(self, "get_x()->int", pika_lvgl_lv_obj_get_xMethod);
|
class_defineMethod(self, "get_x()", pika_lvgl_lv_obj_get_xMethod);
|
||||||
class_defineMethod(self, "get_y()->int", pika_lvgl_lv_obj_get_yMethod);
|
class_defineMethod(self, "get_y()", pika_lvgl_lv_obj_get_yMethod);
|
||||||
class_defineMethod(self, "set_hight(h:int)", pika_lvgl_lv_obj_set_hightMethod);
|
class_defineMethod(self, "set_hight(h)", pika_lvgl_lv_obj_set_hightMethod);
|
||||||
class_defineMethod(self, "set_pos(x:int,y:int)", pika_lvgl_lv_obj_set_posMethod);
|
class_defineMethod(self, "set_pos(x,y)", pika_lvgl_lv_obj_set_posMethod);
|
||||||
class_defineMethod(self, "set_size(size_x:int,size_y:int)", pika_lvgl_lv_obj_set_sizeMethod);
|
class_defineMethod(self, "set_size(size_x,size_y)", pika_lvgl_lv_obj_set_sizeMethod);
|
||||||
class_defineMethod(self, "set_width(w:int)", pika_lvgl_lv_obj_set_widthMethod);
|
class_defineMethod(self, "set_width(w)", pika_lvgl_lv_obj_set_widthMethod);
|
||||||
class_defineMethod(self, "update_layout()", pika_lvgl_lv_obj_update_layoutMethod);
|
class_defineMethod(self, "update_layout()", pika_lvgl_lv_obj_update_layoutMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -2017,8 +2082,8 @@ void pika_lvgl_lv_timer_t_set_periodMethod(PikaObj *self, Args *args){
|
|||||||
PikaObj *New_pika_lvgl_lv_timer_t(Args *args){
|
PikaObj *New_pika_lvgl_lv_timer_t(Args *args){
|
||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "_del()", pika_lvgl_lv_timer_t__delMethod);
|
class_defineMethod(self, "_del()", pika_lvgl_lv_timer_t__delMethod);
|
||||||
class_defineMethod(self, "set_cb(cb:any)", pika_lvgl_lv_timer_t_set_cbMethod);
|
class_defineMethod(self, "set_cb(cb)", pika_lvgl_lv_timer_t_set_cbMethod);
|
||||||
class_defineMethod(self, "set_period(period:int)", pika_lvgl_lv_timer_t_set_periodMethod);
|
class_defineMethod(self, "set_period(period)", pika_lvgl_lv_timer_t_set_periodMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2062,9 +2127,9 @@ void pika_lvgl_roller_set_visible_row_countMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_roller(Args *args){
|
PikaObj *New_pika_lvgl_roller(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_roller___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_roller___init__Method);
|
||||||
class_defineMethod(self, "set_options(options:str,mode:int)", pika_lvgl_roller_set_optionsMethod);
|
class_defineMethod(self, "set_options(options,mode)", pika_lvgl_roller_set_optionsMethod);
|
||||||
class_defineMethod(self, "set_visible_row_count(row_cnt:int)", pika_lvgl_roller_set_visible_row_countMethod);
|
class_defineMethod(self, "set_visible_row_count(row_cnt)", pika_lvgl_roller_set_visible_row_countMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2081,7 +2146,7 @@ void pika_lvgl_slider___init__Method(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_slider(Args *args){
|
PikaObj *New_pika_lvgl_slider(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_slider___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_slider___init__Method);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2148,15 +2213,15 @@ PikaObj *New_pika_lvgl_style_t(Args *args){
|
|||||||
PikaObj *self = New_TinyObj(args);
|
PikaObj *self = New_TinyObj(args);
|
||||||
class_defineMethod(self, "__init__()", pika_lvgl_style_t___init__Method);
|
class_defineMethod(self, "__init__()", pika_lvgl_style_t___init__Method);
|
||||||
class_defineMethod(self, "init()", pika_lvgl_style_t_initMethod);
|
class_defineMethod(self, "init()", pika_lvgl_style_t_initMethod);
|
||||||
class_defineMethod(self, "set_bg_color(color:lv_color_t)", pika_lvgl_style_t_set_bg_colorMethod);
|
class_defineMethod(self, "set_bg_color(color)", pika_lvgl_style_t_set_bg_colorMethod);
|
||||||
class_defineMethod(self, "set_bg_opa(opa:int)", pika_lvgl_style_t_set_bg_opaMethod);
|
class_defineMethod(self, "set_bg_opa(opa)", pika_lvgl_style_t_set_bg_opaMethod);
|
||||||
class_defineMethod(self, "set_outline_color(color:lv_color_t)", pika_lvgl_style_t_set_outline_colorMethod);
|
class_defineMethod(self, "set_outline_color(color)", pika_lvgl_style_t_set_outline_colorMethod);
|
||||||
class_defineMethod(self, "set_outline_pad(pad:int)", pika_lvgl_style_t_set_outline_padMethod);
|
class_defineMethod(self, "set_outline_pad(pad)", pika_lvgl_style_t_set_outline_padMethod);
|
||||||
class_defineMethod(self, "set_outline_width(w:int)", pika_lvgl_style_t_set_outline_widthMethod);
|
class_defineMethod(self, "set_outline_width(w)", pika_lvgl_style_t_set_outline_widthMethod);
|
||||||
class_defineMethod(self, "set_radius(radius:int)", pika_lvgl_style_t_set_radiusMethod);
|
class_defineMethod(self, "set_radius(radius)", pika_lvgl_style_t_set_radiusMethod);
|
||||||
class_defineMethod(self, "set_shadow_color(color:lv_color_t)", pika_lvgl_style_t_set_shadow_colorMethod);
|
class_defineMethod(self, "set_shadow_color(color)", pika_lvgl_style_t_set_shadow_colorMethod);
|
||||||
class_defineMethod(self, "set_shadow_spread(s:int)", pika_lvgl_style_t_set_shadow_spreadMethod);
|
class_defineMethod(self, "set_shadow_spread(s)", pika_lvgl_style_t_set_shadow_spreadMethod);
|
||||||
class_defineMethod(self, "set_shadow_width(w:int)", pika_lvgl_style_t_set_shadow_widthMethod);
|
class_defineMethod(self, "set_shadow_width(w)", pika_lvgl_style_t_set_shadow_widthMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2173,7 +2238,7 @@ void pika_lvgl_switch___init__Method(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_switch(Args *args){
|
PikaObj *New_pika_lvgl_switch(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_switch___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_switch___init__Method);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2197,8 +2262,8 @@ void pika_lvgl_table_set_cell_valueMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_table(Args *args){
|
PikaObj *New_pika_lvgl_table(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_table___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_table___init__Method);
|
||||||
class_defineMethod(self, "set_cell_value(row:int,col:int,txt:str)", pika_lvgl_table_set_cell_valueMethod);
|
class_defineMethod(self, "set_cell_value(row,col,txt)", pika_lvgl_table_set_cell_valueMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2220,8 +2285,8 @@ void pika_lvgl_textarea_set_one_lineMethod(PikaObj *self, Args *args){
|
|||||||
|
|
||||||
PikaObj *New_pika_lvgl_textarea(Args *args){
|
PikaObj *New_pika_lvgl_textarea(Args *args){
|
||||||
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
PikaObj *self = New_pika_lvgl_lv_obj(args);
|
||||||
class_defineMethod(self, "__init__(parent:lv_obj)", pika_lvgl_textarea___init__Method);
|
class_defineMethod(self, "__init__(parent)", pika_lvgl_textarea___init__Method);
|
||||||
class_defineMethod(self, "set_one_line(en:int)", pika_lvgl_textarea_set_one_lineMethod);
|
class_defineMethod(self, "set_one_line(en)", pika_lvgl_textarea_set_one_lineMethod);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ PikaObj *__pikaMain;
|
|||||||
PikaObj *pikaScriptInit(void){
|
PikaObj *pikaScriptInit(void){
|
||||||
__platform_printf("======[pikascript packages installed]======\r\n");
|
__platform_printf("======[pikascript packages installed]======\r\n");
|
||||||
pks_printVersion();
|
pks_printVersion();
|
||||||
__platform_printf("PikaStdLib==v1.10.6\r\n");
|
__platform_printf("PikaStdLib==v1.11.0\r\n");
|
||||||
__platform_printf("pika_lvgl==v0.2.0\r\n");
|
__platform_printf("pika_lvgl==v0.2.0\r\n");
|
||||||
__platform_printf("===========================================\r\n");
|
__platform_printf("===========================================\r\n");
|
||||||
__pikaMain = newRootObj("pikaMain", New_PikaMain);
|
__pikaMain = newRootObj("pikaMain", New_PikaMain);
|
||||||
|
@ -47,12 +47,12 @@ static const uint64_t __talbe_fast_atoi[][10] = {
|
|||||||
{0, 1e9, 2e9, 3e9, 4e9, 5e9, 6e9, 7e9, 8e9, 9e9},
|
{0, 1e9, 2e9, 3e9, 4e9, 5e9, 6e9, 7e9, 8e9, 9e9},
|
||||||
};
|
};
|
||||||
|
|
||||||
int fast_atoi(char* src) {
|
int64_t fast_atoi(char* src) {
|
||||||
const char* p = src;
|
const char* p = src;
|
||||||
uint16_t size = strGetSize(src);
|
uint16_t size = strGetSize(src);
|
||||||
p = p + size - 1;
|
p = p + size - 1;
|
||||||
if (*p) {
|
if (*p) {
|
||||||
int s = 0;
|
int64_t s = 0;
|
||||||
const uint64_t* n = __talbe_fast_atoi[0];
|
const uint64_t* n = __talbe_fast_atoi[0];
|
||||||
while (p != src) {
|
while (p != src) {
|
||||||
s += n[(*p - '0')];
|
s += n[(*p - '0')];
|
||||||
@ -192,13 +192,13 @@ int64_t obj_getInt(PikaObj* self, char* argPath) {
|
|||||||
return -999999999;
|
return -999999999;
|
||||||
}
|
}
|
||||||
char* argName = strPointToLastToken(argPath, '.');
|
char* argName = strPointToLastToken(argPath, '.');
|
||||||
int res = args_getInt(obj->list, argName);
|
int64_t res = args_getInt(obj->list, argName);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg* obj_getArg(PikaObj* self, char* argPath) {
|
Arg* obj_getArg(PikaObj* self, char* argPath) {
|
||||||
PIKA_BOOL isClass = PIKA_FALSE;
|
PIKA_BOOL isClass = PIKA_FALSE;
|
||||||
PikaObj* obj = obj_getHostObjWithIsClass(self, argPath, &isClass);
|
PikaObj* obj = obj_getHostObjWithIsTemp(self, argPath, &isClass);
|
||||||
if (NULL == obj) {
|
if (NULL == obj) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -434,10 +434,33 @@ exit:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PikaObj* _arg_to_obj(Arg* self, PIKA_BOOL* pIsTemp) {
|
||||||
|
if (argType_isObject(arg_getType(self))) {
|
||||||
|
return arg_getPtr(self);
|
||||||
|
}
|
||||||
|
#if !PIKA_NANO_ENABLE
|
||||||
|
if (arg_getType(self) == ARG_TYPE_STRING) {
|
||||||
|
PikaObj* New_PikaStdData_String(Args * args);
|
||||||
|
PikaObj* obj = newNormalObj(New_PikaStdData_String);
|
||||||
|
obj_setStr(obj, "str", arg_getStr(self));
|
||||||
|
*pIsTemp = PIKA_TRUE;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
if (arg_getType(self) == ARG_TYPE_BYTES) {
|
||||||
|
PikaObj* New_PikaStdData_ByteArray(Args * args);
|
||||||
|
PikaObj* obj = newNormalObj(New_PikaStdData_ByteArray);
|
||||||
|
obj_setArg(obj, "raw", self);
|
||||||
|
*pIsTemp = PIKA_TRUE;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static PikaObj* __obj_getObjDirect(PikaObj* self,
|
static PikaObj* __obj_getObjDirect(PikaObj* self,
|
||||||
char* name,
|
char* name,
|
||||||
PIKA_BOOL* pIsClass) {
|
PIKA_BOOL* pIsTemp) {
|
||||||
*pIsClass = PIKA_FALSE;
|
*pIsTemp = PIKA_FALSE;
|
||||||
if (NULL == self) {
|
if (NULL == self) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -451,10 +474,11 @@ static PikaObj* __obj_getObjDirect(PikaObj* self,
|
|||||||
if (argType_isObject(type)) {
|
if (argType_isObject(type)) {
|
||||||
return args_getPtr(self->list, name);
|
return args_getPtr(self->list, name);
|
||||||
}
|
}
|
||||||
|
#if !PIKA_NANO_ENABLE
|
||||||
/* found class */
|
/* found class */
|
||||||
if (type == ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR ||
|
if (type == ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR ||
|
||||||
type == ARG_TYPE_METHOD_CONSTRUCTOR) {
|
type == ARG_TYPE_METHOD_CONSTRUCTOR) {
|
||||||
*pIsClass = PIKA_TRUE;
|
*pIsTemp = PIKA_TRUE;
|
||||||
PikaObj* method_args_obj = New_TinyObj(NULL);
|
PikaObj* method_args_obj = New_TinyObj(NULL);
|
||||||
Arg* cls_obj_arg = obj_runMethodArg(self, method_args_obj,
|
Arg* cls_obj_arg = obj_runMethodArg(self, method_args_obj,
|
||||||
args_getArg(self->list, name));
|
args_getArg(self->list, name));
|
||||||
@ -466,12 +490,13 @@ static PikaObj* __obj_getObjDirect(PikaObj* self,
|
|||||||
arg_deinit(cls_obj_arg);
|
arg_deinit(cls_obj_arg);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return NULL;
|
#endif
|
||||||
|
return _arg_to_obj(args_getArg(self->list, name), pIsTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PikaObj* __obj_getObjWithKeepDeepth(PikaObj* self,
|
static PikaObj* __obj_getObjWithKeepDeepth(PikaObj* self,
|
||||||
char* objPath,
|
char* objPath,
|
||||||
PIKA_BOOL* pIsClass,
|
PIKA_BOOL* pIsTemp,
|
||||||
int32_t keepDeepth) {
|
int32_t keepDeepth) {
|
||||||
char objPath_buff[PIKA_PATH_BUFF_SIZE];
|
char objPath_buff[PIKA_PATH_BUFF_SIZE];
|
||||||
__platform_memcpy(objPath_buff, objPath, strGetSize(objPath) + 1);
|
__platform_memcpy(objPath_buff, objPath, strGetSize(objPath) + 1);
|
||||||
@ -480,7 +505,7 @@ static PikaObj* __obj_getObjWithKeepDeepth(PikaObj* self,
|
|||||||
PikaObj* obj = self;
|
PikaObj* obj = self;
|
||||||
for (int32_t i = 0; i < token_num - keepDeepth; i++) {
|
for (int32_t i = 0; i < token_num - keepDeepth; i++) {
|
||||||
char* token = strPopToken(token_buff, objPath_buff, '.');
|
char* token = strPopToken(token_buff, objPath_buff, '.');
|
||||||
obj = __obj_getObjDirect(obj, token, pIsClass);
|
obj = __obj_getObjDirect(obj, token, pIsTemp);
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@ -500,10 +525,10 @@ PikaObj* obj_getHostObj(PikaObj* self, char* objPath) {
|
|||||||
return __obj_getObjWithKeepDeepth(self, objPath, &isClass, 1);
|
return __obj_getObjWithKeepDeepth(self, objPath, &isClass, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
PikaObj* obj_getHostObjWithIsClass(PikaObj* self,
|
PikaObj* obj_getHostObjWithIsTemp(PikaObj* self,
|
||||||
char* objPath,
|
char* objPath,
|
||||||
PIKA_BOOL* pIsClass) {
|
PIKA_BOOL* pIsTemp) {
|
||||||
return __obj_getObjWithKeepDeepth(self, objPath, pIsClass, 1);
|
return __obj_getObjWithKeepDeepth(self, objPath, pIsTemp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Method methodArg_getPtr(Arg* method_arg) {
|
Method methodArg_getPtr(Arg* method_arg) {
|
||||||
@ -588,18 +613,18 @@ static void obj_saveMethodInfo(PikaObj* self, MethodInfo* method_info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t __class_defineMethodWithType(PikaObj* self,
|
static int32_t __class_defineMethodWithType(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method method_ptr,
|
Method method_ptr,
|
||||||
ArgType method_type,
|
ArgType method_type,
|
||||||
PikaObj* def_context,
|
PikaObj* def_context,
|
||||||
ByteCodeFrame* bytecode_frame) {
|
ByteCodeFrame* bytecode_frame) {
|
||||||
int32_t size = strGetSize(declearation);
|
int32_t size = strGetSize(declareation);
|
||||||
int32_t res = 0;
|
int32_t res = 0;
|
||||||
Args buffs = {0};
|
Args buffs = {0};
|
||||||
char* clean_declearation =
|
char* clean_declareation =
|
||||||
strDeleteChar(args_getBuff(&buffs, size), declearation, ' ');
|
strDeleteChar(args_getBuff(&buffs, size), declareation, ' ');
|
||||||
char* method_path =
|
char* method_path =
|
||||||
strGetFirstToken(args_getBuff(&buffs, size), clean_declearation, '(');
|
strGetFirstToken(args_getBuff(&buffs, size), clean_declareation, '(');
|
||||||
|
|
||||||
PikaObj* method_host = obj_getHostObj(self, method_path);
|
PikaObj* method_host = obj_getHostObj(self, method_path);
|
||||||
MethodInfo method_info = {0};
|
MethodInfo method_info = {0};
|
||||||
@ -610,7 +635,7 @@ static int32_t __class_defineMethodWithType(PikaObj* self,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
method_name = strPointToLastToken(method_path, '.');
|
method_name = strPointToLastToken(method_path, '.');
|
||||||
method_info.dec = clean_declearation;
|
method_info.dec = clean_declareation;
|
||||||
method_info.name = method_name;
|
method_info.name = method_name;
|
||||||
method_info.ptr = (void*)method_ptr;
|
method_info.ptr = (void*)method_ptr;
|
||||||
method_info.type = method_type;
|
method_info.type = method_type;
|
||||||
@ -626,50 +651,50 @@ exit:
|
|||||||
|
|
||||||
/* define a constructor method */
|
/* define a constructor method */
|
||||||
int32_t class_defineConstructor(PikaObj* self,
|
int32_t class_defineConstructor(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr) {
|
Method methodPtr) {
|
||||||
return __class_defineMethodWithType(self, declearation, methodPtr,
|
return __class_defineMethodWithType(self, declareation, methodPtr,
|
||||||
ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR,
|
ARG_TYPE_METHOD_NATIVE_CONSTRUCTOR,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* define a native method as default */
|
/* define a native method as default */
|
||||||
int32_t class_defineMethod(PikaObj* self,
|
int32_t class_defineMethod(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr) {
|
Method methodPtr) {
|
||||||
return __class_defineMethodWithType(self, declearation, methodPtr,
|
return __class_defineMethodWithType(self, declareation, methodPtr,
|
||||||
ARG_TYPE_METHOD_NATIVE, NULL, NULL);
|
ARG_TYPE_METHOD_NATIVE, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* define object method, object method is which startwith (self) */
|
/* define object method, object method is which startwith (self) */
|
||||||
int32_t class_defineRunTimeConstructor(PikaObj* self,
|
int32_t class_defineRunTimeConstructor(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr,
|
Method methodPtr,
|
||||||
PikaObj* def_context,
|
PikaObj* def_context,
|
||||||
ByteCodeFrame* bytecode_frame) {
|
ByteCodeFrame* bytecode_frame) {
|
||||||
return __class_defineMethodWithType(self, declearation, methodPtr,
|
return __class_defineMethodWithType(self, declareation, methodPtr,
|
||||||
ARG_TYPE_METHOD_CONSTRUCTOR,
|
ARG_TYPE_METHOD_CONSTRUCTOR,
|
||||||
def_context, bytecode_frame);
|
def_context, bytecode_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* define object method, object method is which startwith (self) */
|
/* define object method, object method is which startwith (self) */
|
||||||
int32_t class_defineObjectMethod(PikaObj* self,
|
int32_t class_defineObjectMethod(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr,
|
Method methodPtr,
|
||||||
PikaObj* def_context,
|
PikaObj* def_context,
|
||||||
ByteCodeFrame* bytecode_frame) {
|
ByteCodeFrame* bytecode_frame) {
|
||||||
return __class_defineMethodWithType(self, declearation, methodPtr,
|
return __class_defineMethodWithType(self, declareation, methodPtr,
|
||||||
ARG_TYPE_METHOD_OBJECT, def_context,
|
ARG_TYPE_METHOD_OBJECT, def_context,
|
||||||
bytecode_frame);
|
bytecode_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* define a static method as default */
|
/* define a static method as default */
|
||||||
int32_t class_defineStaticMethod(PikaObj* self,
|
int32_t class_defineStaticMethod(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr,
|
Method methodPtr,
|
||||||
PikaObj* def_context,
|
PikaObj* def_context,
|
||||||
ByteCodeFrame* bytecode_frame) {
|
ByteCodeFrame* bytecode_frame) {
|
||||||
return __class_defineMethodWithType(self, declearation, methodPtr,
|
return __class_defineMethodWithType(self, declareation, methodPtr,
|
||||||
ARG_TYPE_METHOD_STATIC, def_context,
|
ARG_TYPE_METHOD_STATIC, def_context,
|
||||||
bytecode_frame);
|
bytecode_frame);
|
||||||
}
|
}
|
||||||
@ -930,7 +955,7 @@ void method_returnStr(Args* args, char* val) {
|
|||||||
args_setStr(args, "return", val);
|
args_setStr(args, "return", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void method_returnInt(Args* args, int32_t val) {
|
void method_returnInt(Args* args, int64_t val) {
|
||||||
args_setInt(args, "return", val);
|
args_setInt(args, "return", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,7 +979,7 @@ void method_returnArg(Args* args, Arg* arg) {
|
|||||||
args_setArg(args, arg);
|
args_setArg(args, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t method_getInt(Args* args, char* argName) {
|
int64_t method_getInt(Args* args, char* argName) {
|
||||||
return args_getInt(args, argName);
|
return args_getInt(args, argName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,11 +1000,16 @@ PikaObj* New_PikaObj(void) {
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg* arg_setRef(Arg* self, char* name, PikaObj* obj) {
|
Arg* arg_setObj(Arg* self, char* name, PikaObj* obj) {
|
||||||
obj_refcntInc(obj);
|
|
||||||
return arg_setPtr(self, name, ARG_TYPE_OBJECT, obj);
|
return arg_setPtr(self, name, ARG_TYPE_OBJECT, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Arg* arg_setRef(Arg* self, char* name, PikaObj* obj) {
|
||||||
|
pika_assert(NULL != obj);
|
||||||
|
obj_refcntInc(obj);
|
||||||
|
return arg_setObj(self, name, obj);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t obj_newDirectObj(PikaObj* self, char* objName, NewFun newFunPtr) {
|
int32_t obj_newDirectObj(PikaObj* self, char* objName, NewFun newFunPtr) {
|
||||||
Arg* new_obj = arg_newDirectObj(newFunPtr);
|
Arg* new_obj = arg_newDirectObj(newFunPtr);
|
||||||
new_obj = arg_setName(new_obj, objName);
|
new_obj = arg_setName(new_obj, objName);
|
||||||
@ -1181,9 +1211,9 @@ void pks_printVersion(void) {
|
|||||||
PIKA_VERSION_MINOR, PIKA_VERSION_MICRO, PIKA_EDIT_TIME);
|
PIKA_VERSION_MINOR, PIKA_VERSION_MICRO, PIKA_EDIT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pks_getVersion(char *buff)
|
void pks_getVersion(char* buff) {
|
||||||
{
|
__platform_sprintf(buff, "%d.%d.%d", PIKA_VERSION_MAJOR, PIKA_VERSION_MINOR,
|
||||||
__platform_sprintf(buff, "%d.%d.%d", PIKA_VERSION_MAJOR, PIKA_VERSION_MINOR, PIKA_VERSION_MICRO);
|
PIKA_VERSION_MICRO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* obj_getStruct(PikaObj* self, char* name) {
|
void* obj_getStruct(PikaObj* self, char* name) {
|
||||||
|
@ -127,7 +127,7 @@ int32_t obj_load(PikaObj* self, Args* args, char* name);
|
|||||||
int32_t obj_addOther(PikaObj* self, char* subObjectName, void* new_projcetFun);
|
int32_t obj_addOther(PikaObj* self, char* subObjectName, void* new_projcetFun);
|
||||||
PikaObj* obj_getObj(PikaObj* self, char* objPath);
|
PikaObj* obj_getObj(PikaObj* self, char* objPath);
|
||||||
PikaObj* obj_getHostObj(PikaObj* self, char* objPath);
|
PikaObj* obj_getHostObj(PikaObj* self, char* objPath);
|
||||||
PikaObj* obj_getHostObjWithIsClass(PikaObj* self,
|
PikaObj* obj_getHostObjWithIsTemp(PikaObj* self,
|
||||||
char* objPath,
|
char* objPath,
|
||||||
PIKA_BOOL* pIsClass);
|
PIKA_BOOL* pIsClass);
|
||||||
|
|
||||||
@ -135,26 +135,26 @@ PikaObj* obj_getHostObjWithIsClass(PikaObj* self,
|
|||||||
int32_t obj_freeObj(PikaObj* self, char* subObjectName);
|
int32_t obj_freeObj(PikaObj* self, char* subObjectName);
|
||||||
|
|
||||||
/* method */
|
/* method */
|
||||||
int32_t class_defineMethod(PikaObj* self, char* declearation, Method methodPtr);
|
int32_t class_defineMethod(PikaObj* self, char* declareation, Method methodPtr);
|
||||||
|
|
||||||
int32_t class_defineObjectMethod(PikaObj* self,
|
int32_t class_defineObjectMethod(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr,
|
Method methodPtr,
|
||||||
PikaObj* def_context,
|
PikaObj* def_context,
|
||||||
ByteCodeFrame* bytecode_frame);
|
ByteCodeFrame* bytecode_frame);
|
||||||
|
|
||||||
int32_t class_defineStaticMethod(PikaObj* self,
|
int32_t class_defineStaticMethod(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr,
|
Method methodPtr,
|
||||||
PikaObj* def_context,
|
PikaObj* def_context,
|
||||||
ByteCodeFrame* bytecode_frame);
|
ByteCodeFrame* bytecode_frame);
|
||||||
|
|
||||||
int32_t class_defineConstructor(PikaObj* self,
|
int32_t class_defineConstructor(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr);
|
Method methodPtr);
|
||||||
|
|
||||||
int32_t class_defineRunTimeConstructor(PikaObj* self,
|
int32_t class_defineRunTimeConstructor(PikaObj* self,
|
||||||
char* declearation,
|
char* declareation,
|
||||||
Method methodPtr,
|
Method methodPtr,
|
||||||
PikaObj* def_context,
|
PikaObj* def_context,
|
||||||
ByteCodeFrame* bytecode_frame);
|
ByteCodeFrame* bytecode_frame);
|
||||||
@ -182,11 +182,11 @@ uint8_t obj_getAnyArg(PikaObj* self,
|
|||||||
Args* targetArgs);
|
Args* targetArgs);
|
||||||
|
|
||||||
void method_returnStr(Args* args, char* val);
|
void method_returnStr(Args* args, char* val);
|
||||||
void method_returnInt(Args* args, int32_t val);
|
void method_returnInt(Args* args, int64_t val);
|
||||||
void method_returnFloat(Args* args, double val);
|
void method_returnFloat(Args* args, double val);
|
||||||
void method_returnPtr(Args* args, void* val);
|
void method_returnPtr(Args* args, void* val);
|
||||||
void method_returnObj(Args* args, void* val);
|
void method_returnObj(Args* args, void* val);
|
||||||
int32_t method_getInt(Args* args, char* argName);
|
int64_t method_getInt(Args* args, char* argName);
|
||||||
double method_getFloat(Args* args, char* argName);
|
double method_getFloat(Args* args, char* argName);
|
||||||
char* method_getStr(Args* args, char* argName);
|
char* method_getStr(Args* args, char* argName);
|
||||||
void method_returnArg(Args* args, Arg* arg);
|
void method_returnArg(Args* args, Arg* arg);
|
||||||
@ -202,7 +202,7 @@ VMParameters* obj_runDirect(PikaObj* self, char* cmd);
|
|||||||
PikaObj* New_PikaObj(void);
|
PikaObj* New_PikaObj(void);
|
||||||
|
|
||||||
/* tools */
|
/* tools */
|
||||||
int fast_atoi(char* src);
|
int64_t fast_atoi(char* src);
|
||||||
char* fast_itoa(char* buf, uint32_t val);
|
char* fast_itoa(char* buf, uint32_t val);
|
||||||
|
|
||||||
/* shell */
|
/* shell */
|
||||||
@ -231,10 +231,10 @@ Arg* obj_newObjInPackage(NewFun newObjFun);
|
|||||||
|
|
||||||
PikaObj* newNormalObj(NewFun newObjFun);
|
PikaObj* newNormalObj(NewFun newObjFun);
|
||||||
Arg* arg_setRef(Arg* self, char* name, PikaObj* obj);
|
Arg* arg_setRef(Arg* self, char* name, PikaObj* obj);
|
||||||
Arg* arg_setWeakRef(Arg* self, char* name, PikaObj* obj);
|
Arg* arg_setObj(Arg* self, char* name, PikaObj* obj);
|
||||||
|
|
||||||
|
#define arg_newObj(obj) arg_setObj(NULL, "", (obj))
|
||||||
#define arg_newRef(obj) arg_setRef(NULL, "", (obj))
|
#define arg_newRef(obj) arg_setRef(NULL, "", (obj))
|
||||||
#define arg_newWeakRef(obj) arg_setWeakRef(NULL, "", (obj))
|
|
||||||
|
|
||||||
PikaObj* obj_importModuleWithByteCodeFrame(PikaObj* self,
|
PikaObj* obj_importModuleWithByteCodeFrame(PikaObj* self,
|
||||||
char* name,
|
char* name,
|
||||||
@ -307,6 +307,8 @@ void* obj_getStruct(PikaObj* self, char* name);
|
|||||||
while (1)
|
while (1)
|
||||||
|
|
||||||
char* obj_cacheStr(PikaObj* self, char* str);
|
char* obj_cacheStr(PikaObj* self, char* str);
|
||||||
|
PikaObj* _arg_to_obj(Arg* self, PIKA_BOOL* pIsTemp);
|
||||||
|
char* __printBytes(PikaObj* self, Arg* arg);
|
||||||
|
|
||||||
#define PIKASCRIPT_VERSION_TO_NUM(majer, minor, micro) \
|
#define PIKASCRIPT_VERSION_TO_NUM(majer, minor, micro) \
|
||||||
majer * 100 * 100 + minor * 100 + micro
|
majer * 100 * 100 + minor * 100 + micro
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -110,6 +110,14 @@ PIKA_WEAK void* __platform_memcpy(void* dir, const void* src, size_t size) {
|
|||||||
return memcpy(dir, src, size);
|
return memcpy(dir, src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PIKA_WEAK int __platform_memcmp(const void* s1, const void* s2, size_t n) {
|
||||||
|
return memcmp(s1, s2, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
PIKA_WEAK void* __platform_memmove(void* s1, void* s2, size_t n) {
|
||||||
|
return memmove(s1, s2, n);
|
||||||
|
}
|
||||||
|
|
||||||
PIKA_WEAK char __platform_getchar(void) {
|
PIKA_WEAK char __platform_getchar(void) {
|
||||||
#if defined(__linux) || defined(_WIN32)
|
#if defined(__linux) || defined(_WIN32)
|
||||||
return getchar();
|
return getchar();
|
||||||
|
@ -137,6 +137,8 @@ void* __platform_malloc(size_t size);
|
|||||||
void __platform_free(void* ptr);
|
void __platform_free(void* ptr);
|
||||||
void* __platform_memset(void* mem, int ch, size_t size);
|
void* __platform_memset(void* mem, int ch, size_t size);
|
||||||
void* __platform_memcpy(void* dir, const void* src, size_t size);
|
void* __platform_memcpy(void* dir, const void* src, size_t size);
|
||||||
|
int __platform_memcmp(const void* s1, const void* s2, size_t n);
|
||||||
|
void* __platform_memmove(void* s1, void* s2, size_t n);
|
||||||
|
|
||||||
void* __user_malloc(size_t size);
|
void* __user_malloc(size_t size);
|
||||||
void __user_free(void* ptr, size_t size);
|
void __user_free(void* ptr, size_t size);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -57,8 +57,8 @@ typedef enum {
|
|||||||
TRY_RESULT_RAISE,
|
TRY_RESULT_RAISE,
|
||||||
} TRY_RESULT;
|
} TRY_RESULT;
|
||||||
|
|
||||||
typedef struct TryInfo TryInfo;
|
typedef struct RunState RunState;
|
||||||
struct TryInfo {
|
struct RunState {
|
||||||
TRY_STATE try_state;
|
TRY_STATE try_state;
|
||||||
TRY_RESULT try_result;
|
TRY_RESULT try_result;
|
||||||
};
|
};
|
||||||
@ -76,9 +76,10 @@ struct VMState {
|
|||||||
uint8_t line_error_code;
|
uint8_t line_error_code;
|
||||||
uint8_t try_error_code;
|
uint8_t try_error_code;
|
||||||
uint32_t ins_cnt;
|
uint32_t ins_cnt;
|
||||||
|
PIKA_BOOL in_super;
|
||||||
PikaObj* lreg[PIKA_REGIST_SIZE];
|
PikaObj* lreg[PIKA_REGIST_SIZE];
|
||||||
PIKA_BOOL ireg[PIKA_REGIST_SIZE];
|
PIKA_BOOL ireg[PIKA_REGIST_SIZE];
|
||||||
TryInfo* try_info;
|
RunState* run_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct OperatorInfo OperatorInfo;
|
typedef struct OperatorInfo OperatorInfo;
|
||||||
@ -97,6 +98,17 @@ struct OperatorInfo {
|
|||||||
VMState* vm;
|
VMState* vm;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum VM_SIGNAL_CTRL {
|
||||||
|
VM_SIGNAL_CTRL_NONE = 0,
|
||||||
|
VM_SIGNAL_CTRL_EXIT,
|
||||||
|
} VM_SIGNAL_CTRL;
|
||||||
|
|
||||||
|
typedef struct VMSignal VMSignal;
|
||||||
|
struct VMSignal {
|
||||||
|
VM_SIGNAL_CTRL signal_ctrl;
|
||||||
|
int vm_cnt;
|
||||||
|
};
|
||||||
|
|
||||||
VMParameters* pikaVM_run(PikaObj* self, char* pyLine);
|
VMParameters* pikaVM_run(PikaObj* self, char* pyLine);
|
||||||
VMParameters* pikaVM_runAsm(PikaObj* self, char* pikaAsm);
|
VMParameters* pikaVM_runAsm(PikaObj* self, char* pikaAsm);
|
||||||
VMParameters* pikaVM_runByteCodeFrame(PikaObj* self,
|
VMParameters* pikaVM_runByteCodeFrame(PikaObj* self,
|
||||||
@ -192,5 +204,8 @@ void __vm_List_append(PikaObj* self, Arg* arg);
|
|||||||
void __vm_List___init__(PikaObj* self);
|
void __vm_List___init__(PikaObj* self);
|
||||||
void __vm_Dict_set(PikaObj* self, Arg* arg, char* key);
|
void __vm_Dict_set(PikaObj* self, Arg* arg, char* key);
|
||||||
void __vm_Dict___init__(PikaObj* self);
|
void __vm_Dict___init__(PikaObj* self);
|
||||||
|
VM_SIGNAL_CTRL VMSignal_getCtrl(void);
|
||||||
|
void pks_vm_exit(void);
|
||||||
|
void pks_vmSignal_setCtrlElear(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#define PIKA_VERSION_MAJOR 1
|
#define PIKA_VERSION_MAJOR 1
|
||||||
#define PIKA_VERSION_MINOR 10
|
#define PIKA_VERSION_MINOR 11
|
||||||
#define PIKA_VERSION_MICRO 6
|
#define PIKA_VERSION_MICRO 0
|
||||||
|
|
||||||
#define PIKA_EDIT_TIME "2022/08/30 18:40:40"
|
#define PIKA_EDIT_TIME "2022/09/16 15:33:53"
|
||||||
|
@ -94,3 +94,5 @@ def_ins(SLC)
|
|||||||
def_ins(ASS)
|
def_ins(ASS)
|
||||||
/* expect */
|
/* expect */
|
||||||
def_ins(EXP)
|
def_ins(EXP)
|
||||||
|
/* jump no zero */
|
||||||
|
def_ins(JNZ)
|
||||||
|
@ -57,6 +57,7 @@ static Arg* arg_init_hash(Hash nameHash,
|
|||||||
self->size = size;
|
self->size = size;
|
||||||
self->name_hash = nameHash;
|
self->name_hash = nameHash;
|
||||||
self->type = type;
|
self->type = type;
|
||||||
|
self->flag = 0;
|
||||||
arg_setSerialized(self, PIKA_TRUE);
|
arg_setSerialized(self, PIKA_TRUE);
|
||||||
arg_setIsKeyword(self, PIKA_FALSE);
|
arg_setIsKeyword(self, PIKA_FALSE);
|
||||||
__platform_memset(arg_getContent(self), 0,
|
__platform_memset(arg_getContent(self), 0,
|
||||||
@ -64,7 +65,7 @@ static Arg* arg_init_hash(Hash nameHash,
|
|||||||
if (NULL != content) {
|
if (NULL != content) {
|
||||||
__platform_memcpy(arg_getContent(self), content, size);
|
__platform_memcpy(arg_getContent(self), content, size);
|
||||||
}
|
}
|
||||||
|
pika_assert(self->flag < ARG_FLAG_MAX);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ void arg_init_stack(Arg* self, uint8_t* buffer, uint32_t size) {
|
|||||||
self->size = size;
|
self->size = size;
|
||||||
self->type = ARG_TYPE_UNDEF;
|
self->type = ARG_TYPE_UNDEF;
|
||||||
self->name_hash = 0;
|
self->name_hash = 0;
|
||||||
|
self->flag = 0;
|
||||||
arg_setSerialized(self, PIKA_FALSE);
|
arg_setSerialized(self, PIKA_FALSE);
|
||||||
arg_setIsKeyword(self, PIKA_FALSE);
|
arg_setIsKeyword(self, PIKA_FALSE);
|
||||||
}
|
}
|
||||||
@ -129,6 +131,7 @@ Arg* arg_setNameHash(Arg* self, Hash nameHash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Arg* arg_setName(Arg* self, char* name) {
|
Arg* arg_setName(Arg* self, char* name) {
|
||||||
|
pika_assert(NULL != name);
|
||||||
return arg_setNameHash(self, hash_time33(name));
|
return arg_setNameHash(self, hash_time33(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +160,7 @@ Arg* arg_setBytes(Arg* self, char* name, uint8_t* src, size_t size) {
|
|||||||
if (NULL != src) {
|
if (NULL != src) {
|
||||||
__platform_memcpy((void*)((uintptr_t)dir + sizeof(size_t)), src, size);
|
__platform_memcpy((void*)((uintptr_t)dir + sizeof(size_t)), src, size);
|
||||||
}
|
}
|
||||||
|
pika_assert(self->flag < ARG_FLAG_MAX);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,14 +174,26 @@ uint8_t* arg_getBytes(Arg* self) {
|
|||||||
return arg_getContent(self) + sizeof(size_t);
|
return arg_getContent(self) + sizeof(size_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void arg_printBytes(Arg* self) {
|
char* __printBytes(PikaObj* self, Arg* arg) {
|
||||||
size_t bytes_size = arg_getBytesSize(self);
|
Args buffs = {0};
|
||||||
uint8_t* bytes = arg_getBytes(self);
|
size_t bytes_size = arg_getBytesSize(arg);
|
||||||
__platform_printf("b\'");
|
uint8_t* bytes = arg_getBytes(arg);
|
||||||
|
Arg* str_arg = arg_newStr("b\'");
|
||||||
for (size_t i = 0; i < bytes_size; i++) {
|
for (size_t i = 0; i < bytes_size; i++) {
|
||||||
__platform_printf("\\x%02x", bytes[i]);
|
char* str_item = strsFormat(&buffs, 16, "\\x%02x", bytes[i]);
|
||||||
|
str_arg = arg_strAppend(str_arg, str_item);
|
||||||
}
|
}
|
||||||
__platform_printf("\'\r\n");
|
str_arg = arg_strAppend(str_arg, "\'");
|
||||||
|
char* str_res = obj_cacheStr(self, arg_getStr(str_arg));
|
||||||
|
strsDeinit(&buffs);
|
||||||
|
arg_deinit(str_arg);
|
||||||
|
return str_res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void arg_printBytes(Arg* self) {
|
||||||
|
PikaObj* obj = New_PikaObj();
|
||||||
|
__platform_printf("%s\r\n", __printBytes(obj, self));
|
||||||
|
obj_deinit(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t arg_getBytesSize(Arg* self) {
|
size_t arg_getBytesSize(Arg* self) {
|
||||||
@ -279,6 +295,9 @@ int64_t arg_getInt(Arg* self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* arg_getPtr(Arg* self) {
|
void* arg_getPtr(Arg* self) {
|
||||||
|
if (arg_getType(self) == ARG_TYPE_NONE) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (NULL == arg_getContent(self)) {
|
if (NULL == arg_getContent(self)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -314,16 +333,18 @@ Arg* arg_copy(Arg* arg_src) {
|
|||||||
if (NULL == arg_src) {
|
if (NULL == arg_src) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
pika_assert(arg_src->flag < ARG_FLAG_MAX);
|
||||||
ArgType arg_type = arg_getType(arg_src);
|
ArgType arg_type = arg_getType(arg_src);
|
||||||
if (ARG_TYPE_OBJECT == arg_type) {
|
if (ARG_TYPE_OBJECT == arg_type) {
|
||||||
obj_refcntInc((PikaObj*)arg_getPtr(arg_src));
|
obj_refcntInc((PikaObj*)arg_getPtr(arg_src));
|
||||||
}
|
}
|
||||||
Arg* argCopied = New_arg(NULL);
|
Arg* arg_dict = New_arg(NULL);
|
||||||
argCopied = arg_setContent(argCopied, arg_getContent(arg_src),
|
arg_dict = arg_setContent(arg_dict, arg_getContent(arg_src),
|
||||||
arg_getContentSize(arg_src));
|
arg_getContentSize(arg_src));
|
||||||
argCopied = arg_setNameHash(argCopied, arg_getNameHash(arg_src));
|
arg_dict = arg_setNameHash(arg_dict, arg_getNameHash(arg_src));
|
||||||
argCopied = arg_setType(argCopied, arg_getType(arg_src));
|
arg_dict = arg_setType(arg_dict, arg_getType(arg_src));
|
||||||
return argCopied;
|
arg_setIsKeyword(arg_dict, arg_getIsKeyword(arg_src));
|
||||||
|
return arg_dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg* arg_copy_noalloc(Arg* arg_src, Arg* arg_dict) {
|
Arg* arg_copy_noalloc(Arg* arg_src, Arg* arg_dict) {
|
||||||
@ -346,6 +367,7 @@ Arg* arg_copy_noalloc(Arg* arg_src, Arg* arg_dict) {
|
|||||||
arg_getContentSize(arg_src));
|
arg_getContentSize(arg_src));
|
||||||
arg_dict = arg_setNameHash(arg_dict, arg_getNameHash(arg_src));
|
arg_dict = arg_setNameHash(arg_dict, arg_getNameHash(arg_src));
|
||||||
arg_dict = arg_setType(arg_dict, arg_getType(arg_src));
|
arg_dict = arg_setType(arg_dict, arg_getType(arg_src));
|
||||||
|
arg_setIsKeyword(arg_dict, arg_getIsKeyword(arg_src));
|
||||||
return arg_dict;
|
return arg_dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,3 +453,27 @@ void arg_deinit(Arg* self) {
|
|||||||
/* free the ref */
|
/* free the ref */
|
||||||
arg_freeContent(self);
|
arg_freeContent(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PIKA_BOOL arg_isEqual(Arg* self, Arg* other) {
|
||||||
|
if (NULL == self || NULL == other) {
|
||||||
|
return PIKA_FALSE;
|
||||||
|
}
|
||||||
|
if (arg_getType(self) != arg_getType(other)) {
|
||||||
|
return PIKA_FALSE;
|
||||||
|
}
|
||||||
|
if (arg_getType(self) == ARG_TYPE_OBJECT) {
|
||||||
|
if (arg_getPtr(self) != arg_getPtr(other)) {
|
||||||
|
return PIKA_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (arg_getType(self) == ARG_TYPE_STRING) {
|
||||||
|
if (strEqu(arg_getStr(self), arg_getStr(other))) {
|
||||||
|
return PIKA_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (0 != __platform_memcmp(arg_getContent(self), arg_getContent(other),
|
||||||
|
arg_getContentSize(self))) {
|
||||||
|
return PIKA_FALSE;
|
||||||
|
}
|
||||||
|
return PIKA_TRUE;
|
||||||
|
}
|
||||||
|
@ -65,8 +65,8 @@ typedef union {
|
|||||||
struct Arg {
|
struct Arg {
|
||||||
_arg_union _;
|
_arg_union _;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint8_t type;
|
ArgType type;
|
||||||
PIKA_BOOL flag;
|
uint8_t flag;
|
||||||
Hash name_hash;
|
Hash name_hash;
|
||||||
uint8_t content[];
|
uint8_t content[];
|
||||||
};
|
};
|
||||||
@ -133,6 +133,7 @@ uint8_t argType_isObject(ArgType type);
|
|||||||
|
|
||||||
#define ARG_FLAG_MASK_SERIALIZED 0x01
|
#define ARG_FLAG_MASK_SERIALIZED 0x01
|
||||||
#define ARG_FLAG_MASK_IsKeyword 0x02
|
#define ARG_FLAG_MASK_IsKeyword 0x02
|
||||||
|
#define ARG_FLAG_MAX 0x04
|
||||||
|
|
||||||
#define arg_getNext(self) ((self)->_.next)
|
#define arg_getNext(self) ((self)->_.next)
|
||||||
#define arg_getSize(self) ((self)->size)
|
#define arg_getSize(self) ((self)->size)
|
||||||
@ -170,3 +171,4 @@ uint8_t argType_isObject(ArgType type);
|
|||||||
arg_init_stack(&__name, __##__name##_buff, __size)
|
arg_init_stack(&__name, __##__name##_buff, __size)
|
||||||
|
|
||||||
void arg_init_stack(Arg* self, uint8_t* buffer, uint32_t size);
|
void arg_init_stack(Arg* self, uint8_t* buffer, uint32_t size);
|
||||||
|
PIKA_BOOL arg_isEqual(Arg* self, Arg* other);
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "dataStrs.h"
|
#include "dataStrs.h"
|
||||||
|
|
||||||
void args_deinit(Args* self) {
|
void args_deinit(Args* self) {
|
||||||
|
pika_assert(self != NULL);
|
||||||
link_deinit(self);
|
link_deinit(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +88,9 @@ PIKA_RES args_setStr(Args* self, char* name, char* strIn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PIKA_RES args_pushArg(Args* self, Arg* arg) {
|
PIKA_RES args_pushArg(Args* self, Arg* arg) {
|
||||||
|
if (NULL == arg) {
|
||||||
|
return PIKA_RES_ERR_ARG_NO_FOUND;
|
||||||
|
}
|
||||||
Arg* new_arg = NULL;
|
Arg* new_arg = NULL;
|
||||||
if (!arg_getSerialized(arg)) {
|
if (!arg_getSerialized(arg)) {
|
||||||
new_arg = arg_copy(arg);
|
new_arg = arg_copy(arg);
|
||||||
@ -368,6 +372,7 @@ Arg* args_getArg_hash(Args* self, Hash nameHash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Arg* args_getArg(Args* self, char* name) {
|
Arg* args_getArg(Args* self, char* name) {
|
||||||
|
pika_assert(NULL != self);
|
||||||
LinkNode* node = args_getNode(self, name);
|
LinkNode* node = args_getNode(self, name);
|
||||||
if (NULL == node) {
|
if (NULL == node) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -582,6 +587,9 @@ void* list_getPtr(PikaList* self, int index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PIKA_RES list_append(PikaList* self, Arg* arg) {
|
PIKA_RES list_append(PikaList* self, Arg* arg) {
|
||||||
|
if (NULL == arg) {
|
||||||
|
return PIKA_RES_ERR_ARG_NO_FOUND;
|
||||||
|
}
|
||||||
int top = args_getInt(&self->super, "top");
|
int top = args_getInt(&self->super, "top");
|
||||||
char buff[11];
|
char buff[11];
|
||||||
char* topStr = fast_itoa(buff, top);
|
char* topStr = fast_itoa(buff, top);
|
||||||
@ -593,10 +601,12 @@ PIKA_RES list_append(PikaList* self, Arg* arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t list_getSize(PikaList* self) {
|
size_t list_getSize(PikaList* self) {
|
||||||
|
pika_assert(NULL != self);
|
||||||
return args_getInt(&self->super, "top");
|
return args_getInt(&self->super, "top");
|
||||||
}
|
}
|
||||||
|
|
||||||
void list_reverse(PikaList* self) {
|
void list_reverse(PikaList* self) {
|
||||||
|
pika_assert(NULL != self);
|
||||||
int top = list_getSize(self);
|
int top = list_getSize(self);
|
||||||
for (int i = 0; i < top / 2; i++) {
|
for (int i = 0; i < top / 2; i++) {
|
||||||
Arg* arg_i = arg_copy(list_getArg(self, i));
|
Arg* arg_i = arg_copy(list_getArg(self, i));
|
||||||
@ -695,12 +705,19 @@ exit:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* tuple */
|
||||||
PikaTuple* args_getTuple(Args* self, char* name) {
|
PikaTuple* args_getTuple(Args* self, char* name) {
|
||||||
PikaObj* tuple_obj = args_getPtr(self, name);
|
PikaObj* tuple_obj = args_getPtr(self, name);
|
||||||
return obj_getPtr(tuple_obj, "list");
|
return obj_getPtr(tuple_obj, "list");
|
||||||
}
|
}
|
||||||
|
|
||||||
char* args_cacheStr(Args* self, char* str){
|
/* dict */
|
||||||
|
PikaDict* args_getDict(Args* self, char* name) {
|
||||||
|
PikaObj* tuple_obj = args_getPtr(self, name);
|
||||||
|
return obj_getPtr(tuple_obj, "dict");
|
||||||
|
}
|
||||||
|
|
||||||
|
char* args_cacheStr(Args* self, char* str) {
|
||||||
args_setStr(self, "__str_cache", str);
|
args_setStr(self, "__str_cache", str);
|
||||||
return args_getStr(self, "__str_cache");
|
return args_getStr(self, "__str_cache");
|
||||||
}
|
}
|
||||||
|
@ -185,6 +185,7 @@ char* strsFormatArg(Args* out_buffs, char* fmt, Arg* arg);
|
|||||||
PikaList* New_list(void);
|
PikaList* New_list(void);
|
||||||
PikaTuple* New_tuple(void);
|
PikaTuple* New_tuple(void);
|
||||||
PikaTuple* args_getTuple(Args* self, char* name);
|
PikaTuple* args_getTuple(Args* self, char* name);
|
||||||
|
PikaDict* args_getDict(Args* self, char* name);
|
||||||
|
|
||||||
char* strsFormatList(Args* out_buffs, char* fmt, PikaList* list);
|
char* strsFormatList(Args* out_buffs, char* fmt, PikaList* list);
|
||||||
char* args_cacheStr(Args* self, char* str);
|
char* args_cacheStr(Args* self, char* str);
|
||||||
|
@ -41,6 +41,7 @@ void __link_deinit_pyload(Link* self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void link_deinit(Link* self) {
|
void link_deinit(Link* self) {
|
||||||
|
pika_assert(self != NULL);
|
||||||
__link_deinit_pyload(self);
|
__link_deinit_pyload(self);
|
||||||
pikaFree(self, sizeof(Link));
|
pikaFree(self, sizeof(Link));
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "dataMemory.h"
|
#include "dataMemory.h"
|
||||||
#include "PikaPlatform.h"
|
#include "PikaPlatform.h"
|
||||||
|
|
||||||
PikaMemInfo pikaMemInfo = {0};
|
volatile PikaMemInfo pikaMemInfo = {0};
|
||||||
|
|
||||||
void* pikaMalloc(uint32_t size) {
|
void* pikaMalloc(uint32_t size) {
|
||||||
/* pika memory lock */
|
/* pika memory lock */
|
||||||
|
@ -60,7 +60,7 @@ int32_t stack_deinit(Stack* stack) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void stack_pushPyload(Stack* stack, Arg* content, size_t size) {
|
void stack_pushPyload(Stack* stack, Arg* in, size_t size) {
|
||||||
size_t stack_size_after_push =
|
size_t stack_size_after_push =
|
||||||
size + (stack->sp - arg_getContent(stack->stack_pyload));
|
size + (stack->sp - arg_getContent(stack->stack_pyload));
|
||||||
if (stack_size_after_push > stack->stack_totle_size) {
|
if (stack_size_after_push > stack->stack_totle_size) {
|
||||||
@ -74,14 +74,14 @@ void stack_pushPyload(Stack* stack, Arg* content, size_t size) {
|
|||||||
while (1) {
|
while (1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arg_getSerialized(content)) {
|
Arg* top = (Arg*)stack->sp;
|
||||||
__platform_memcpy(stack->sp, content, size);
|
if (arg_getSerialized(in)) {
|
||||||
|
__platform_memcpy(top, in, size);
|
||||||
} else {
|
} else {
|
||||||
__platform_memcpy(stack->sp, content, sizeof(Arg));
|
__platform_memcpy(top, in, sizeof(Arg));
|
||||||
__platform_memcpy(stack->sp + sizeof(Arg), content->_.buffer,
|
__platform_memcpy(top->content, in->_.buffer, size - sizeof(Arg));
|
||||||
size - sizeof(Arg));
|
|
||||||
/* transfer to serialized form */
|
/* transfer to serialized form */
|
||||||
arg_setSerialized((Arg*)stack->sp, PIKA_TRUE);
|
arg_setSerialized(top, PIKA_TRUE);
|
||||||
}
|
}
|
||||||
stack->sp += size;
|
stack->sp += size;
|
||||||
}
|
}
|
||||||
@ -144,6 +144,7 @@ Arg* _stack_popArg(Stack* stack, Arg* arg_dict, PIKA_BOOL is_alloc) {
|
|||||||
if (argType_isObject(type)) {
|
if (argType_isObject(type)) {
|
||||||
obj_refcntDec((PikaObj*)arg_getPtr(arg));
|
obj_refcntDec((PikaObj*)arg_getPtr(arg));
|
||||||
}
|
}
|
||||||
|
pika_assert(arg->flag < ARG_FLAG_MAX);
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,12 @@
|
|||||||
#ifndef PIKA_SYNTAX_LEVEL
|
#ifndef PIKA_SYNTAX_LEVEL
|
||||||
#define PIKA_SYNTAX_LEVEL PIKA_SYNTAX_LEVEL_MINIMAL
|
#define PIKA_SYNTAX_LEVEL PIKA_SYNTAX_LEVEL_MINIMAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PIKA_STRING_UTF8_ENABLE
|
||||||
|
#define PIKA_STRING_UTF8_ENABLE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* default optimize */
|
/* default optimize */
|
||||||
@ -290,6 +296,11 @@
|
|||||||
#define PIKA_EXEC_ENABLE 1
|
#define PIKA_EXEC_ENABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* support for UTF-8 in PikaStdData_String */
|
||||||
|
#ifndef PIKA_STRING_UTF8_ENABLE
|
||||||
|
#define PIKA_STRING_UTF8_ENABLE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* configuration validation */
|
/* configuration validation */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "PikaStdData_Dict.h"
|
#include "PikaStdData_Dict.h"
|
||||||
#include "BaseObj.h"
|
#include "BaseObj.h"
|
||||||
#include "PikaObj.h"
|
#include "PikaObj.h"
|
||||||
|
#include "PikaStdData_Tuple.h"
|
||||||
|
#include "PikaStdData_dict_items.h"
|
||||||
#include "PikaStdData_dict_keys.h"
|
#include "PikaStdData_dict_keys.h"
|
||||||
#include "PikaStdLib_SysObj.h"
|
#include "PikaStdLib_SysObj.h"
|
||||||
#include "dataStrs.h"
|
#include "dataStrs.h"
|
||||||
@ -59,7 +61,9 @@ void PikaStdData_Dict___del__(PikaObj* self) {
|
|||||||
PikaDict* dict = obj_getPtr(self, "dict");
|
PikaDict* dict = obj_getPtr(self, "dict");
|
||||||
PikaDict* keys = obj_getPtr(self, "_keys");
|
PikaDict* keys = obj_getPtr(self, "_keys");
|
||||||
dict_deinit(dict);
|
dict_deinit(dict);
|
||||||
dict_deinit(keys);
|
if (NULL != keys) {
|
||||||
|
dict_deinit(keys);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PikaStdData_dict_keys___init__(PikaObj* self, PikaObj* dict) {
|
void PikaStdData_dict_keys___init__(PikaObj* self, PikaObj* dict) {
|
||||||
@ -72,6 +76,12 @@ PikaObj* PikaStdData_Dict_keys(PikaObj* self) {
|
|||||||
return dict_keys;
|
return dict_keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PikaObj* PikaStdData_Dict_items(PikaObj* self) {
|
||||||
|
PikaObj* dict_items = newNormalObj(New_PikaStdData_dict_items);
|
||||||
|
PikaStdData_dict_keys___init__(dict_items, self);
|
||||||
|
return dict_items;
|
||||||
|
}
|
||||||
|
|
||||||
Arg* PikaStdData_dict_keys___iter__(PikaObj* self) {
|
Arg* PikaStdData_dict_keys___iter__(PikaObj* self) {
|
||||||
obj_setInt(self, "__iter_i", 0);
|
obj_setInt(self, "__iter_i", 0);
|
||||||
return arg_newRef(self);
|
return arg_newRef(self);
|
||||||
@ -170,3 +180,77 @@ int PikaStdData_dict_keys___len__(PikaObj* self) {
|
|||||||
PikaDict* keys = obj_getPtr(dictptr, "_keys");
|
PikaDict* keys = obj_getPtr(dictptr, "_keys");
|
||||||
return args_getSize(&keys->super);
|
return args_getSize(&keys->super);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dict_contains(PikaDict* dict, Arg* key) {
|
||||||
|
int i = 0;
|
||||||
|
while (PIKA_TRUE) {
|
||||||
|
Arg* item = args_getArgByidex(&dict->super, i);
|
||||||
|
if (NULL == item) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (arg_isEqual(item, key)) {
|
||||||
|
return PIKA_TRUE;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return PIKA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PikaStdData_Dict___contains__(PikaObj* self, Arg* val) {
|
||||||
|
PikaDict* dict = obj_getPtr(self, "_keys");
|
||||||
|
return dict_contains(dict, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
Arg* PikaStdData_dict_items___iter__(PikaObj* self) {
|
||||||
|
obj_setInt(self, "__iter_i", 0);
|
||||||
|
return arg_newRef(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PikaStdData_dict_items___len__(PikaObj* self) {
|
||||||
|
PikaObj* dictptr = obj_getPtr(self, "dictptr");
|
||||||
|
PikaDict* keys = obj_getPtr(dictptr, "_keys");
|
||||||
|
return args_getSize(&keys->super);
|
||||||
|
}
|
||||||
|
|
||||||
|
Arg* PikaStdData_dict_items___next__(PikaObj* self) {
|
||||||
|
int __iter_i = args_getInt(self->list, "__iter_i");
|
||||||
|
PikaObj* dictptr = obj_getPtr(self, "dictptr");
|
||||||
|
PikaDict* keys = obj_getPtr(dictptr, "_keys");
|
||||||
|
PikaDict* dict = obj_getPtr(dictptr, "dict");
|
||||||
|
Arg* key = args_getArgByidex(&keys->super, __iter_i);
|
||||||
|
Arg* val = args_getArgByidex(&dict->super, __iter_i);
|
||||||
|
if (NULL == key) {
|
||||||
|
return arg_newNull();
|
||||||
|
}
|
||||||
|
PikaObj* tuple = newNormalObj(New_PikaStdData_Tuple);
|
||||||
|
PikaStdData_Tuple___init__(tuple);
|
||||||
|
PikaList* list = obj_getPtr(tuple, "list");
|
||||||
|
list_append(list, key);
|
||||||
|
list_append(list, val);
|
||||||
|
args_setInt(self->list, "__iter_i", __iter_i + 1);
|
||||||
|
return arg_newObj(tuple);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* PikaStdData_dict_items___str__(PikaObj* self) {
|
||||||
|
Arg* str_arg = arg_newStr("dict_items([");
|
||||||
|
int i = 0;
|
||||||
|
obj_setInt(self, "__iter_i", 0);
|
||||||
|
while (PIKA_TRUE) {
|
||||||
|
Arg* item = PikaStdData_dict_items___next__(self);
|
||||||
|
if (arg_getType(item) == ARG_TYPE_NONE) {
|
||||||
|
arg_deinit(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i != 0) {
|
||||||
|
str_arg = arg_strAppend(str_arg, ", ");
|
||||||
|
}
|
||||||
|
char* item_str = PikaStdLib_SysObj_str(self, item);
|
||||||
|
str_arg = arg_strAppend(str_arg, item_str);
|
||||||
|
i++;
|
||||||
|
arg_deinit(item);
|
||||||
|
}
|
||||||
|
str_arg = arg_strAppend(str_arg, "])");
|
||||||
|
obj_setStr(self, "_buf", arg_getStr(str_arg));
|
||||||
|
arg_deinit(str_arg);
|
||||||
|
return obj_getStr(self, "_buf");
|
||||||
|
}
|
||||||
|
@ -3,74 +3,168 @@
|
|||||||
#include "PikaStdData_String_Util.h"
|
#include "PikaStdData_String_Util.h"
|
||||||
#include "dataStrs.h"
|
#include "dataStrs.h"
|
||||||
|
|
||||||
Arg* PikaStdData_String___iter__(PikaObj* self) {
|
char* _strlwr(char *str);
|
||||||
|
|
||||||
|
Arg *PikaStdData_String___iter__(PikaObj *self)
|
||||||
|
{
|
||||||
obj_setInt(self, "__iter_i", 0);
|
obj_setInt(self, "__iter_i", 0);
|
||||||
return arg_newRef(self);
|
return arg_newRef(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PikaStdData_String_set(PikaObj* self, char* s) {
|
void PikaStdData_String_set(PikaObj *self, char *s)
|
||||||
|
{
|
||||||
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
|
int r = _valid_utf8(s, -1);
|
||||||
|
if (r >= 0)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error invaliad character %x\r\n", s[r]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
obj_setStr(self, "str", s);
|
obj_setStr(self, "str", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PikaStdData_String___init__(PikaObj* self, char* s) {
|
void PikaStdData_String___init__(PikaObj *self, char *s)
|
||||||
|
{
|
||||||
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
|
int r = _valid_utf8(s, -1);
|
||||||
|
if (r >= 0)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error invaliad character %x\r\n", s[r]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
PikaStdData_String_set(self, s);
|
PikaStdData_String_set(self, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* PikaStdData_String_get(PikaObj* self) {
|
char *PikaStdData_String_get(PikaObj *self)
|
||||||
|
{
|
||||||
return obj_getStr(self, "str");
|
return obj_getStr(self, "str");
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg* PikaStdData_String___next__(PikaObj* self) {
|
Arg *PikaStdData_String___next__(PikaObj *self)
|
||||||
|
{
|
||||||
int __iter_i = args_getInt(self->list, "__iter_i");
|
int __iter_i = args_getInt(self->list, "__iter_i");
|
||||||
char* str = obj_getStr(self, "str");
|
char *str = obj_getStr(self, "str");
|
||||||
uint16_t len = strGetSize(str);
|
uint16_t len = strGetSize(str);
|
||||||
Arg* res = NULL;
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
|
char char_buff[5];
|
||||||
|
int r = _utf8_get(str, len, __iter_i, char_buff);
|
||||||
|
if (r < 0)
|
||||||
|
{
|
||||||
|
return arg_newNull();
|
||||||
|
}
|
||||||
|
args_setInt(self->list, "__iter_i", __iter_i + 1);
|
||||||
|
return arg_newStr((char *)char_buff);
|
||||||
|
#else
|
||||||
|
Arg *res = NULL;
|
||||||
char char_buff[] = " ";
|
char char_buff[] = " ";
|
||||||
if (__iter_i < len) {
|
if (__iter_i < len)
|
||||||
|
{
|
||||||
char_buff[0] = str[__iter_i];
|
char_buff[0] = str[__iter_i];
|
||||||
res = arg_newStr((char*)char_buff);
|
res = arg_newStr((char *)char_buff);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return arg_newNull();
|
return arg_newNull();
|
||||||
}
|
}
|
||||||
args_setInt(self->list, "__iter_i", __iter_i + 1);
|
args_setInt(self->list, "__iter_i", __iter_i + 1);
|
||||||
return res;
|
return res;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg* PikaStdData_String___getitem__(PikaObj* self, Arg* __key) {
|
Arg *PikaStdData_String___getitem__(PikaObj *self, Arg *__key)
|
||||||
|
{
|
||||||
int key_i = arg_getInt(__key);
|
int key_i = arg_getInt(__key);
|
||||||
char* str = obj_getStr(self, "str");
|
if (key_i < 0){
|
||||||
|
key_i = PikaStdData_String___len__(self) + key_i;
|
||||||
|
}
|
||||||
|
char *str = obj_getStr(self, "str");
|
||||||
uint16_t len = strGetSize(str);
|
uint16_t len = strGetSize(str);
|
||||||
char char_buff[] = " ";
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
if (key_i < len) {
|
char char_buff[5];
|
||||||
char_buff[0] = str[key_i];
|
int r = _utf8_get(str, len, key_i, char_buff);
|
||||||
return arg_newStr((char*)char_buff);
|
if (r < 0)
|
||||||
} else {
|
{
|
||||||
return arg_newNull();
|
return arg_newNull();
|
||||||
}
|
}
|
||||||
|
return arg_newStr((char *)char_buff);
|
||||||
|
#else
|
||||||
|
char char_buff[] = " ";
|
||||||
|
if (key_i < len)
|
||||||
|
{
|
||||||
|
char_buff[0] = str[key_i];
|
||||||
|
return arg_newStr((char *)char_buff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return arg_newNull();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PikaStdData_String___setitem__(PikaObj* self, Arg* __key, Arg* __val) {
|
void PikaStdData_String___setitem__(PikaObj *self, Arg *__key, Arg *__val)
|
||||||
|
{
|
||||||
int key_i = arg_getInt(__key);
|
int key_i = arg_getInt(__key);
|
||||||
char* str = obj_getStr(self, "str");
|
char *str = obj_getStr(self, "str");
|
||||||
char* val = arg_getStr(__val);
|
char *val = arg_getStr(__val);
|
||||||
uint16_t len = strGetSize(str);
|
uint16_t len = strGetSize(str);
|
||||||
if (key_i >= len) {
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
|
int len2 = strlen(val);
|
||||||
|
int is_invalid = _valid_utf8(val, len2);
|
||||||
|
if (is_invalid >= 0)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error String invalid\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int ulen_val = _utf8_strlen(val, len2);
|
||||||
|
if (ulen_val != 1)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error String invalid char\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int char_len;
|
||||||
|
int repl_at = _utf8_get_offset(str, len, key_i, &char_len);
|
||||||
|
if (repl_at < 0)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error String Overflow\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int ok = __str_repl(self, str, len, repl_at, char_len, val, len2);
|
||||||
|
if (ok < 0)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error. Internal error(-%d)\r\n", __LINE__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (key_i >= len)
|
||||||
|
{
|
||||||
obj_setErrorCode(self, 1);
|
obj_setErrorCode(self, 1);
|
||||||
__platform_printf("Error String Overflow\r\n");
|
__platform_printf("Error String Overflow\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
str[key_i] = val[0];
|
str[key_i] = val[0];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char* PikaStdData_String___str__(PikaObj* self) {
|
char *PikaStdData_String___str__(PikaObj *self)
|
||||||
|
{
|
||||||
return obj_getStr(self, "str");
|
return obj_getStr(self, "str");
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdData_String_startswith(PikaObj* self, char* prefix) {
|
int PikaStdData_String_startswith(PikaObj *self, char *prefix)
|
||||||
char* str = obj_getStr(self, "str");
|
{
|
||||||
char* p = prefix;
|
char *str = obj_getStr(self, "str");
|
||||||
|
char *p = prefix;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (*p != '\0') {
|
while (*p != '\0')
|
||||||
|
{
|
||||||
if (*p != str[i])
|
if (*p != str[i])
|
||||||
return 0;
|
return 0;
|
||||||
p++;
|
p++;
|
||||||
@ -79,11 +173,13 @@ int PikaStdData_String_startswith(PikaObj* self, char* prefix) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdData_String_endswith(PikaObj* self, char* suffix) {
|
int PikaStdData_String_endswith(PikaObj *self, char *suffix)
|
||||||
char* str = obj_getStr(self, "str");
|
{
|
||||||
|
char *str = obj_getStr(self, "str");
|
||||||
int len1 = strlen(str);
|
int len1 = strlen(str);
|
||||||
int len2 = strlen(suffix);
|
int len2 = strlen(suffix);
|
||||||
while (len2 >= 1) {
|
while (len2 >= 1)
|
||||||
|
{
|
||||||
if (suffix[len2 - 1] != str[len1 - 1])
|
if (suffix[len2 - 1] != str[len1 - 1])
|
||||||
return 0;
|
return 0;
|
||||||
len2--;
|
len2--;
|
||||||
@ -92,10 +188,12 @@ int PikaStdData_String_endswith(PikaObj* self, char* suffix) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdData_String_isdigit(PikaObj* self) {
|
int PikaStdData_String_isdigit(PikaObj *self)
|
||||||
char* str = obj_getStr(self, "str");
|
{
|
||||||
|
char *str = obj_getStr(self, "str");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (str[i] != '\0') {
|
while (str[i] != '\0')
|
||||||
|
{
|
||||||
if (!isdigit((int)str[i]))
|
if (!isdigit((int)str[i]))
|
||||||
return 0;
|
return 0;
|
||||||
i++;
|
i++;
|
||||||
@ -103,10 +201,12 @@ int PikaStdData_String_isdigit(PikaObj* self) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdData_String_islower(PikaObj* self) {
|
int PikaStdData_String_islower(PikaObj *self)
|
||||||
char* str = obj_getStr(self, "str");
|
{
|
||||||
|
char *str = obj_getStr(self, "str");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (str[i] != '\0') {
|
while (str[i] != '\0')
|
||||||
|
{
|
||||||
if (!islower((int)str[i]))
|
if (!islower((int)str[i]))
|
||||||
return 0;
|
return 0;
|
||||||
i++;
|
i++;
|
||||||
@ -114,10 +214,12 @@ int PikaStdData_String_islower(PikaObj* self) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdData_String_isalnum(PikaObj* self) {
|
int PikaStdData_String_isalnum(PikaObj *self)
|
||||||
char* str = obj_getStr(self, "str");
|
{
|
||||||
|
char *str = obj_getStr(self, "str");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (str[i] != '\0') {
|
while (str[i] != '\0')
|
||||||
|
{
|
||||||
if (!isalnum((int)str[i]))
|
if (!isalnum((int)str[i]))
|
||||||
return 0;
|
return 0;
|
||||||
i++;
|
i++;
|
||||||
@ -125,10 +227,12 @@ int PikaStdData_String_isalnum(PikaObj* self) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdData_String_isalpha(PikaObj* self) {
|
int PikaStdData_String_isalpha(PikaObj *self)
|
||||||
char* str = obj_getStr(self, "str");
|
{
|
||||||
|
char *str = obj_getStr(self, "str");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (str[i] != '\0') {
|
while (str[i] != '\0')
|
||||||
|
{
|
||||||
if (!isalpha((int)str[i]))
|
if (!isalpha((int)str[i]))
|
||||||
return 0;
|
return 0;
|
||||||
i++;
|
i++;
|
||||||
@ -136,10 +240,12 @@ int PikaStdData_String_isalpha(PikaObj* self) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdData_String_isspace(PikaObj* self) {
|
int PikaStdData_String_isspace(PikaObj *self)
|
||||||
char* str = obj_getStr(self, "str");
|
{
|
||||||
|
char *str = obj_getStr(self, "str");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (str[i] != '\0') {
|
while (str[i] != '\0')
|
||||||
|
{
|
||||||
if (!isspace((int)str[i]))
|
if (!isspace((int)str[i]))
|
||||||
return 0;
|
return 0;
|
||||||
i++;
|
i++;
|
||||||
@ -147,22 +253,24 @@ int PikaStdData_String_isspace(PikaObj* self) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PikaObj* PikaStdData_String_split(PikaObj* self, char* s) {
|
PikaObj *PikaStdData_String_split(PikaObj *self, char *s)
|
||||||
|
{
|
||||||
/* 创建 list 对象 */
|
/* 创建 list 对象 */
|
||||||
PikaObj* list = newNormalObj(New_PikaStdData_List);
|
PikaObj *list = newNormalObj(New_PikaStdData_List);
|
||||||
/* 初始化 list */
|
/* 初始化 list */
|
||||||
PikaStdData_List___init__(list);
|
PikaStdData_List___init__(list);
|
||||||
|
|
||||||
Args buffs = {0};
|
Args buffs = {0};
|
||||||
char* str = strsCopy(&buffs, obj_getStr(self, "str"));
|
char *str = strsCopy(&buffs, obj_getStr(self, "str"));
|
||||||
|
|
||||||
char sign = s[0];
|
char sign = s[0];
|
||||||
int token_num = strCountSign(str, sign) + 1;
|
int token_num = strCountSign(str, sign) + 1;
|
||||||
|
|
||||||
for (int i = 0; i < token_num; i++) {
|
for (int i = 0; i < token_num; i++)
|
||||||
char* token = strsPopToken(&buffs, str, sign);
|
{
|
||||||
|
char *token = strsPopToken(&buffs, str, sign);
|
||||||
/* 用 arg_set<type> 的 api 创建 arg */
|
/* 用 arg_set<type> 的 api 创建 arg */
|
||||||
Arg* token_arg = arg_newStr(token);
|
Arg *token_arg = arg_newStr(token);
|
||||||
/* 添加到 list 对象 */
|
/* 添加到 list 对象 */
|
||||||
PikaStdData_List_append(list, token_arg);
|
PikaStdData_List_append(list, token_arg);
|
||||||
/* 销毁 arg */
|
/* 销毁 arg */
|
||||||
@ -173,25 +281,42 @@ PikaObj* PikaStdData_String_split(PikaObj* self, char* s) {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdData_String___len__(PikaObj* self) {
|
int PikaStdData_String___len__(PikaObj *self)
|
||||||
char* str = obj_getStr(self, "str");
|
{
|
||||||
|
char *str = obj_getStr(self, "str");
|
||||||
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
|
int n = _utf8_strlen(str, -1);
|
||||||
|
if (n < 0)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error. Internal error(%d)\r\n", __LINE__);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
#else
|
||||||
return strGetSize(str);
|
return strGetSize(str);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char* PikaStdData_String_strip(PikaObj* self) {
|
char *PikaStdData_String_strip(PikaObj *self)
|
||||||
|
{
|
||||||
Args buffs = {0};
|
Args buffs = {0};
|
||||||
char* str = strsCopy(&buffs, obj_getStr(self, "str"));
|
char *str = strsCopy(&buffs, obj_getStr(self, "str"));
|
||||||
/* strip */
|
/* strip */
|
||||||
char* str_start = str;
|
char *str_start = str;
|
||||||
for (size_t i = 0; i < strGetSize(str); i++) {
|
for (size_t i = 0; i < strGetSize(str); i++)
|
||||||
if (str[i] != ' ') {
|
{
|
||||||
str_start = (char*)(str + i);
|
if (str[i] != ' ')
|
||||||
|
{
|
||||||
|
str_start = (char *)(str + i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = strGetSize(str) - 1; i >= 0; i--) {
|
for (int i = strGetSize(str) - 1; i >= 0; i--)
|
||||||
if (str[i] != ' ') {
|
{
|
||||||
|
if (str[i] != ' ')
|
||||||
|
{
|
||||||
str[i + 1] = '\0';
|
str[i + 1] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -202,17 +327,553 @@ char* PikaStdData_String_strip(PikaObj* self) {
|
|||||||
return obj_getStr(self, "_buf");
|
return obj_getStr(self, "_buf");
|
||||||
}
|
}
|
||||||
|
|
||||||
char* PikaStdData_String_replace(PikaObj* self, char* old, char* new) {
|
char *PikaStdData_String_replace(PikaObj *self, char *old, char *new)
|
||||||
|
{
|
||||||
Args buffs = {0};
|
Args buffs = {0};
|
||||||
char* str = strsCopy(&buffs, obj_getStr(self, "str"));
|
char *str = strsCopy(&buffs, obj_getStr(self, "str"));
|
||||||
str = strsReplace(&buffs, str, old, new);
|
str = strsReplace(&buffs, str, old, new);
|
||||||
obj_setStr(self, "_buf", str);
|
obj_setStr(self, "_buf", str);
|
||||||
strsDeinit(&buffs);
|
strsDeinit(&buffs);
|
||||||
return obj_getStr(self, "_buf");
|
return obj_getStr(self, "_buf");
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg* PikaStdData_String_encode(PikaObj* self) {
|
|
||||||
char* str = obj_getStr(self, "str");
|
Arg *PikaStdData_String_encode(PikaObj *self, PikaTuple *encoding)
|
||||||
Arg* arg = arg_newBytes((uint8_t*)str, strGetSize(str));
|
{
|
||||||
return arg;
|
char *str = obj_getStr(self, "str");
|
||||||
|
|
||||||
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
|
char *to_code = NULL;
|
||||||
|
int argn = tuple_getSize(encoding);
|
||||||
|
if (argn < 1)
|
||||||
|
{
|
||||||
|
return arg_newBytes((uint8_t *)str, strGetSize(str));
|
||||||
|
}
|
||||||
|
Arg *arg_i = tuple_getArg(encoding, 0);
|
||||||
|
if (arg_getType(arg_i) != ARG_TYPE_STRING)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error invaliad arguments\r\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
to_code = arg_getStr(arg_i);
|
||||||
|
_strlwr(to_code);
|
||||||
|
Arg *res = _str_encode(str, to_code);
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
obj_setErrorCode(self, __LINE__);
|
||||||
|
__platform_printf("Error internal error\r\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
#else
|
||||||
|
return arg_newBytes((uint8_t *)str, strGetSize(str));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
|
|
||||||
|
static const uint8_t _pcre_utf8_table4[] = {
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5};
|
||||||
|
|
||||||
|
const char mask1 = 0x80;
|
||||||
|
const char mask2 = 0xc0;
|
||||||
|
const char mask3 = 0xe0;
|
||||||
|
const char mask4 = 0xf0;
|
||||||
|
|
||||||
|
const char nmask1 = 0x3f;
|
||||||
|
const char nmask2 = 0x1f;
|
||||||
|
const char nmask3 = 0x0f;
|
||||||
|
const char nmask4 = 0x07;
|
||||||
|
|
||||||
|
int _valid_utf8(const char *string, int length)
|
||||||
|
{
|
||||||
|
const uint8_t *p;
|
||||||
|
if (length < 0)
|
||||||
|
{
|
||||||
|
length = strlen(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (p = (const uint8_t *)string; length-- > 0; p++)
|
||||||
|
{
|
||||||
|
int ab;
|
||||||
|
int c = *p;
|
||||||
|
if (!(c & 0x80))
|
||||||
|
continue;
|
||||||
|
if (c < 0xc0)
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
ab = _pcre_utf8_table4[c & 0x3f];
|
||||||
|
if (length < ab || ab > 3)
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
length -= ab;
|
||||||
|
if ((*(++p) & 0xc0) != 0x80)
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
switch (ab)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
if ((c & 0x3e) == 0)
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
continue;
|
||||||
|
case 2:
|
||||||
|
if ((c == 0xe0 && (*p & 0x20) == 0) ||
|
||||||
|
(c == 0xed && *p >= 0xa0))
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if ((c == 0xf0 && (*p & 0x30) == 0) ||
|
||||||
|
(c > 0xf4) ||
|
||||||
|
(c == 0xf4 && *p > 0x8f))
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (--ab > 0)
|
||||||
|
{
|
||||||
|
if ((*(++p) & 0xc0) != 0x80)
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int _utf8_get(const char *string, int length, int at, char *out_buf)
|
||||||
|
{
|
||||||
|
const uint8_t *p;
|
||||||
|
int ab, c;
|
||||||
|
if (length < 0)
|
||||||
|
{
|
||||||
|
length = strlen(string);
|
||||||
|
}
|
||||||
|
if (at < 0 || at >= length)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for (p = (const uint8_t *)string; length > 0 && at; p++, at--)
|
||||||
|
{
|
||||||
|
c = *p;
|
||||||
|
if (!(c & 0x80))
|
||||||
|
{
|
||||||
|
length--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ab = _pcre_utf8_table4[c & 0x3f];
|
||||||
|
p += ab++;
|
||||||
|
length -= ab;
|
||||||
|
}
|
||||||
|
if (at || length <= 0)
|
||||||
|
return -2;
|
||||||
|
c = *p;
|
||||||
|
if (!(c & 0x80))
|
||||||
|
{
|
||||||
|
*out_buf = c;
|
||||||
|
out_buf[1] = 0;
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
ab = _pcre_utf8_table4[c & 0x3f] + 1;
|
||||||
|
__platform_memcpy(out_buf, p, ab);
|
||||||
|
out_buf[ab] = '\0';
|
||||||
|
return ab;
|
||||||
|
}
|
||||||
|
int _utf8_get_offset(const char *string, int length, int at, int *out_char_len)
|
||||||
|
{
|
||||||
|
const uint8_t *p;
|
||||||
|
int ab, c;
|
||||||
|
if (length < 0)
|
||||||
|
{
|
||||||
|
length = strlen(string);
|
||||||
|
}
|
||||||
|
if (at < 0 || at >= length)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for (p = (const uint8_t *)string; length > 0 && at; p++, at--)
|
||||||
|
{
|
||||||
|
c = *p;
|
||||||
|
if (!(c & 0x80))
|
||||||
|
{
|
||||||
|
length--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ab = _pcre_utf8_table4[c & 0x3f];
|
||||||
|
p += ab++;
|
||||||
|
length -= ab;
|
||||||
|
}
|
||||||
|
if (at)
|
||||||
|
return -2;
|
||||||
|
c = *p;
|
||||||
|
if (!(c & 0x80))
|
||||||
|
{
|
||||||
|
if (out_char_len)
|
||||||
|
*out_char_len = 1;
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
};
|
||||||
|
ab = _pcre_utf8_table4[c & 0x3f] + 1;
|
||||||
|
if (out_char_len)
|
||||||
|
*out_char_len = ab;
|
||||||
|
return (uintptr_t)p - (uintptr_t)string;
|
||||||
|
}
|
||||||
|
int _utf8_strlen(const char *string, int length)
|
||||||
|
{
|
||||||
|
const uint8_t *p;
|
||||||
|
int i, ab, c;
|
||||||
|
if (length < 0)
|
||||||
|
{
|
||||||
|
length = strlen(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0, p = (const uint8_t *)string; length > 0; i++, p++)
|
||||||
|
{
|
||||||
|
c = *p;
|
||||||
|
if (!(c & 0x80))
|
||||||
|
{
|
||||||
|
length--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ab = _pcre_utf8_table4[c & 0x3f];
|
||||||
|
p += ab++;
|
||||||
|
length -= ab;
|
||||||
|
}
|
||||||
|
if (length < 0)
|
||||||
|
return -1;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __str_repl(PikaObj *self, char *str, int str_len, int repl_at, int repl_len, char *val, int val_len)
|
||||||
|
{
|
||||||
|
if (val_len > repl_len)
|
||||||
|
{
|
||||||
|
str[repl_at] = 0;
|
||||||
|
Arg *s_new = arg_newStr(str);
|
||||||
|
if (!s_new)
|
||||||
|
return -1;
|
||||||
|
s_new = arg_strAppend(s_new, val);
|
||||||
|
s_new = arg_strAppend(s_new, str + repl_at + repl_len);
|
||||||
|
obj_removeArg(self, "str");
|
||||||
|
int rs = obj_setArg(self, "str", s_new);
|
||||||
|
arg_deinit(s_new);
|
||||||
|
if (rs)
|
||||||
|
return -rs;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
char *s = str + repl_at;
|
||||||
|
__platform_memcpy(s, val, val_len);
|
||||||
|
__platform_memmove(s + val_len, s + repl_len, str_len - repl_at - repl_len + 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __utf8_to_utf32_char_LE(const char *utf8, char *out_buf)
|
||||||
|
{
|
||||||
|
char c = *utf8;
|
||||||
|
if (!(c & mask1))
|
||||||
|
{
|
||||||
|
*out_buf = c;
|
||||||
|
out_buf[1] = 0;
|
||||||
|
out_buf[2] = 0;
|
||||||
|
out_buf[3] = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int left_length = _pcre_utf8_table4[c & 0x3f];
|
||||||
|
char a, b, d;
|
||||||
|
switch (left_length)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
a = c & nmask2;
|
||||||
|
b = utf8[1] & nmask1;
|
||||||
|
out_buf[0] = b | a << 6;
|
||||||
|
out_buf[1] = a >> 2;
|
||||||
|
out_buf[2] = 0;
|
||||||
|
out_buf[3] = 0;
|
||||||
|
return 2;
|
||||||
|
case 2:
|
||||||
|
a = c & nmask3;
|
||||||
|
b = utf8[1] & nmask1;
|
||||||
|
c = utf8[2] & nmask1;
|
||||||
|
out_buf[0] = c | b << 6;
|
||||||
|
out_buf[1] = b >> 2 | a << 4;
|
||||||
|
out_buf[2] = 0;
|
||||||
|
out_buf[3] = 0;
|
||||||
|
return 3;
|
||||||
|
case 3:
|
||||||
|
a = c & nmask4;
|
||||||
|
b = utf8[1] & nmask1;
|
||||||
|
c = utf8[2] & nmask1;
|
||||||
|
d = utf8[3] & nmask1;
|
||||||
|
out_buf[0] = d | c << 6;
|
||||||
|
out_buf[1] = c >> 2 | b << 4;
|
||||||
|
out_buf[2] = b >> 4 | a << 2;
|
||||||
|
out_buf[3] = 0;
|
||||||
|
return 4;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int __utf8_to_utf32_LE_noBOM_get_size(const char *utf8, int len)
|
||||||
|
{
|
||||||
|
char *p = (char*) utf8;
|
||||||
|
char buf[4];
|
||||||
|
int space_sum = 0;
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
int size = __utf8_to_utf32_char_LE(p, buf);
|
||||||
|
if (!size)
|
||||||
|
return -1;
|
||||||
|
p += size;
|
||||||
|
len -= size;
|
||||||
|
space_sum++;
|
||||||
|
}
|
||||||
|
return space_sum * 4;
|
||||||
|
}
|
||||||
|
int __utf8_to_utf32_LE_noBOM(const char *utf8, int len, char *out_buf)
|
||||||
|
{
|
||||||
|
char *q = out_buf;
|
||||||
|
char *p = (char*) utf8;
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
int size = __utf8_to_utf32_char_LE(p, q);
|
||||||
|
if (!size)
|
||||||
|
return -1;
|
||||||
|
p += size;
|
||||||
|
len -= size;
|
||||||
|
q += 4;
|
||||||
|
}
|
||||||
|
return q - out_buf;
|
||||||
|
}
|
||||||
|
int __utf8_to_utf32_LE_withBOM(const char *utf8, int len, char *out_buf)
|
||||||
|
{
|
||||||
|
int size = __utf8_to_utf32_LE_noBOM(utf8, len, out_buf + 4);
|
||||||
|
if (size < 0)
|
||||||
|
{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
out_buf[0] = '\xff';
|
||||||
|
out_buf[1] = '\xfe';
|
||||||
|
out_buf[2] = 0;
|
||||||
|
out_buf[3] = 0;
|
||||||
|
return size + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t __utf8_decode(const char *utf8, int left_length)
|
||||||
|
{
|
||||||
|
int ucode = -1;
|
||||||
|
char c = *utf8;
|
||||||
|
if (!(c & mask1))
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
char a, b, d;
|
||||||
|
switch (left_length)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
a = c & nmask2;
|
||||||
|
b = utf8[1] & nmask1;
|
||||||
|
ucode = b | (a & 0x03) << 6;
|
||||||
|
ucode |= (a >> 2) << 8;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
a = c & nmask3;
|
||||||
|
b = utf8[1] & nmask1;
|
||||||
|
c = utf8[2] & nmask1;
|
||||||
|
ucode = c | (b & 0x03) << 6;
|
||||||
|
ucode |= (b >> 2 | a << 4) << 8;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
a = c & nmask4;
|
||||||
|
b = utf8[1] & nmask1;
|
||||||
|
c = utf8[2] & nmask1;
|
||||||
|
d = utf8[3] & nmask1;
|
||||||
|
ucode = d | (c & 0x03) << 6;
|
||||||
|
ucode |= (c >> 2 | (b & 0x0f) << 4) << 8;
|
||||||
|
ucode |= (b >> 4 | a << 2) << 16;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return ucode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __unicode_to_utf16_char_LE(int32_t u, char *out_buf)
|
||||||
|
{
|
||||||
|
if (!(u & 0xffff0000))
|
||||||
|
{
|
||||||
|
out_buf[0] = u & 0xff;
|
||||||
|
out_buf[1] = (u & 0xff00) >> 8;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
int32_t d = u - 0x10000;
|
||||||
|
int32_t L = d & 0x3ff;
|
||||||
|
int32_t U = d >> 10;
|
||||||
|
L = L | 0xdc00;
|
||||||
|
U = U | 0xd800;
|
||||||
|
out_buf[0] = U & 0xff;
|
||||||
|
out_buf[1] = (U & 0xff00) >> 8;
|
||||||
|
out_buf[2] = L & 0xff;
|
||||||
|
out_buf[3] = (L & 0xff00) >> 8;
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
int __utf8_to_utf16_LE_noBOM(const char *utf8, int len, char *out_buf)
|
||||||
|
{
|
||||||
|
char *q = out_buf;
|
||||||
|
char *p = (char*) utf8;
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
char c = *p;
|
||||||
|
int32_t ucode;
|
||||||
|
if (!(c & mask1))
|
||||||
|
{
|
||||||
|
ucode = c;
|
||||||
|
p++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int left_size = _pcre_utf8_table4[c & 0x3f];
|
||||||
|
ucode = __utf8_decode(p, left_size++);
|
||||||
|
if (ucode < 0)
|
||||||
|
return ucode;
|
||||||
|
p += left_size;
|
||||||
|
len -= left_size;
|
||||||
|
}
|
||||||
|
int size = __unicode_to_utf16_char_LE(ucode, q);
|
||||||
|
q += size;
|
||||||
|
}
|
||||||
|
return q - out_buf;
|
||||||
|
}
|
||||||
|
int __utf8_to_utf16_LE_noBOM_get_size(const char *utf8, int len)
|
||||||
|
{
|
||||||
|
char out_buf[4];
|
||||||
|
char *p = (char*) utf8;
|
||||||
|
int need_space = 0;
|
||||||
|
while (len > 0)
|
||||||
|
{
|
||||||
|
char c = *p;
|
||||||
|
int32_t ucode;
|
||||||
|
if (!(c & mask1))
|
||||||
|
{
|
||||||
|
ucode = c;
|
||||||
|
p++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int left_size = _pcre_utf8_table4[c & 0x3f];
|
||||||
|
ucode = __utf8_decode(p, left_size++);
|
||||||
|
if (ucode < 0)
|
||||||
|
return ucode;
|
||||||
|
p += left_size;
|
||||||
|
len -= left_size;
|
||||||
|
}
|
||||||
|
int size = __unicode_to_utf16_char_LE(ucode, out_buf);
|
||||||
|
need_space += size;
|
||||||
|
}
|
||||||
|
return need_space;
|
||||||
|
}
|
||||||
|
int __utf8_to_utf16_LE_withBOM(const char *utf8, int len, char *out_buf)
|
||||||
|
{
|
||||||
|
int size = __utf8_to_utf16_LE_noBOM(utf8, len, out_buf + 2);
|
||||||
|
if (size < 0)
|
||||||
|
{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
out_buf[0] = '\xff';
|
||||||
|
out_buf[1] = '\xfe';
|
||||||
|
return size + 2;
|
||||||
|
}
|
||||||
|
Arg *_str_encode(char *str, char *encoding)
|
||||||
|
{
|
||||||
|
if (strEqu(encoding, "utf-8"))
|
||||||
|
{
|
||||||
|
return arg_newBytes((uint8_t *)str, strGetSize(str));
|
||||||
|
}
|
||||||
|
int len = strlen(str);
|
||||||
|
|
||||||
|
if (strEqu(encoding, "ascii"))
|
||||||
|
{
|
||||||
|
int ulen = _utf8_strlen(str, len);
|
||||||
|
if (ulen == len)
|
||||||
|
{
|
||||||
|
return arg_newBytes((uint8_t *)str, strGetSize(str));
|
||||||
|
}
|
||||||
|
__platform_printf("Warning there is non-ascii characters\r\n");
|
||||||
|
char *b = (char *)pikaMalloc(len + 1);
|
||||||
|
if (!b)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
char *p = str;
|
||||||
|
char *q = b;
|
||||||
|
char c = *p++;
|
||||||
|
while (c)
|
||||||
|
{
|
||||||
|
if (!(c & 0x80))
|
||||||
|
{
|
||||||
|
*q++ = c;
|
||||||
|
}
|
||||||
|
c = *p++;
|
||||||
|
}
|
||||||
|
*q = 0;
|
||||||
|
Arg *arg = arg_newBytes((uint8_t *)b, strGetSize(b));
|
||||||
|
pikaFree(b, len + 1);
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strEqu(encoding, "utf-16"))
|
||||||
|
{
|
||||||
|
int size_needed = __utf8_to_utf16_LE_noBOM_get_size(str, len);
|
||||||
|
if (size_needed <= 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
size_needed += 2;
|
||||||
|
char *b = (char *)pikaMalloc(size_needed);
|
||||||
|
if (!b)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
int ok = __utf8_to_utf16_LE_withBOM(str, len, b);
|
||||||
|
if (ok < 0)
|
||||||
|
{
|
||||||
|
pikaFree(b, size_needed);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
Arg *arg = arg_newBytes((uint8_t *)b, size_needed);
|
||||||
|
pikaFree(b, size_needed);
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strEqu(encoding, "utf-32"))
|
||||||
|
{
|
||||||
|
int size_needed = __utf8_to_utf32_LE_noBOM_get_size(str, len);
|
||||||
|
if (size_needed <= 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
size_needed += 4;
|
||||||
|
char *b = (char *)pikaMalloc(size_needed);
|
||||||
|
if (!b)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
int ok = __utf8_to_utf32_LE_withBOM(str, len, b);
|
||||||
|
if (ok < 0)
|
||||||
|
{
|
||||||
|
pikaFree(b, size_needed);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
Arg *arg = arg_newBytes((uint8_t *)b, size_needed);
|
||||||
|
pikaFree(b, size_needed);
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* _strlwr(char *str)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while (str[i] != '\0')
|
||||||
|
{
|
||||||
|
str[i] = tolower((int)str[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1 +1,20 @@
|
|||||||
#include<ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#if PIKA_STRING_UTF8_ENABLE
|
||||||
|
|
||||||
|
int _valid_utf8(const char *string, int length);
|
||||||
|
int _utf8_get(const char *string, int length, int at, char *out_buf);
|
||||||
|
int _utf8_get_offset(const char *string, int length, int at, int *out_char_len);
|
||||||
|
int _utf8_strlen(const char *string, int length);
|
||||||
|
int __str_repl(PikaObj *self, char *str, int str_len, int repl_at, int repl_len, char *val, int val_len);
|
||||||
|
|
||||||
|
int __utf8_to_utf32_LE_withBOM(const char *utf8, int len, char *out_buf);
|
||||||
|
int __utf8_to_utf32_LE_noBOM(const char *utf8, int len, char *out_buf);
|
||||||
|
int __utf8_to_utf32_LE_noBOM_get_size(const char *utf8, int len);
|
||||||
|
|
||||||
|
int __utf8_to_utf16_LE_withBOM(const char *utf8, int len, char *out_buf);
|
||||||
|
int __utf8_to_utf16_LE_noBOM(const char *utf8, int len, char *out_buf);
|
||||||
|
int __utf8_to_utf16_LE_noBOM_get_size(const char *utf8, int len);
|
||||||
|
Arg* _str_encode(char*str, char*encoding);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -74,3 +74,14 @@ char* PikaStdData_Tuple___str__(PikaObj* self) {
|
|||||||
int PikaStdData_Tuple___len__(PikaObj* self) {
|
int PikaStdData_Tuple___len__(PikaObj* self) {
|
||||||
return PikaStdData_Tuple_len(self);
|
return PikaStdData_Tuple_len(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PikaStdData_Tuple___contains__(PikaObj* self, Arg* val) {
|
||||||
|
PikaList* list = obj_getPtr(self, "list");
|
||||||
|
for (size_t i = 0; i < list_getSize(list); i++) {
|
||||||
|
Arg* arg = list_getArg(list, i);
|
||||||
|
if (arg_isEqual(arg, val)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
#include "PikaObj.h"
|
#include "PikaObj.h"
|
||||||
|
|
||||||
Arg* PikaStdLib_RangeObj___next__(PikaObj* self) {
|
Arg* PikaStdLib_RangeObj___next__(PikaObj* self) {
|
||||||
int a1 = args_getInt(self->list, "a1");
|
int start = args_getInt(self->list, "_start");
|
||||||
int a2 = args_getInt(self->list, "a2");
|
int end = args_getInt(self->list, "_end");
|
||||||
int start = 0;
|
int step = args_getInt(self->list, "_step");
|
||||||
int end = 0;
|
|
||||||
int foot = 1;
|
|
||||||
/* only start and end */
|
/* only start and end */
|
||||||
start = a1;
|
|
||||||
end = a2;
|
|
||||||
/* start */
|
/* start */
|
||||||
int iter_i = args_getInt(self->list, "iter_i");
|
int iter_i = args_getInt(self->list, "iter_i");
|
||||||
/* iter_i is not inited */
|
/* iter_i is not inited */
|
||||||
@ -19,6 +15,6 @@ Arg* PikaStdLib_RangeObj___next__(PikaObj* self) {
|
|||||||
if (iter_i >= end) {
|
if (iter_i >= end) {
|
||||||
return arg_newNull();
|
return arg_newNull();
|
||||||
}
|
}
|
||||||
args_setInt(self->list, "iter_i", iter_i + foot);
|
args_setInt(self->list, "iter_i", iter_i + step);
|
||||||
return arg_newInt(iter_i);
|
return arg_newInt(iter_i);
|
||||||
}
|
}
|
||||||
|
@ -184,11 +184,30 @@ Arg* PikaStdLib_SysObj_iter(PikaObj* self, Arg* arg) {
|
|||||||
return arg_newNull();
|
return arg_newNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Arg* PikaStdLib_SysObj_range(PikaObj* self, int a1, int a2) {
|
Arg* PikaStdLib_SysObj_range(PikaObj* self, PikaTuple* ax) {
|
||||||
/* set template arg to create rangeObj */
|
/* set template arg to create rangeObj */
|
||||||
Arg* obj_arg = arg_newDirectObj(New_PikaStdLib_RangeObj);
|
Arg* obj_arg = arg_newDirectObj(New_PikaStdLib_RangeObj);
|
||||||
obj_setInt(arg_getPtr(obj_arg), "a1", a1);
|
PikaObj* range_obj = arg_getPtr(obj_arg);
|
||||||
obj_setInt(arg_getPtr(obj_arg), "a2", a2);
|
if (tuple_getSize(ax) == 1) {
|
||||||
|
int start = 0;
|
||||||
|
int end = arg_getInt(tuple_getArg(ax, 0));
|
||||||
|
obj_setInt(range_obj, "_start", start);
|
||||||
|
obj_setInt(range_obj, "_end", end);
|
||||||
|
obj_setInt(range_obj, "_step", 1);
|
||||||
|
} else if (tuple_getSize(ax) == 2) {
|
||||||
|
int start = arg_getInt(tuple_getArg(ax, 0));
|
||||||
|
int end = arg_getInt(tuple_getArg(ax, 1));
|
||||||
|
obj_setInt(range_obj, "_start", start);
|
||||||
|
obj_setInt(range_obj, "_end", end);
|
||||||
|
obj_setInt(range_obj, "_step", 1);
|
||||||
|
} else if (tuple_getSize(ax) == 3) {
|
||||||
|
int start = arg_getInt(tuple_getArg(ax, 0));
|
||||||
|
int end = arg_getInt(tuple_getArg(ax, 1));
|
||||||
|
int step = arg_getInt(tuple_getArg(ax, 2));
|
||||||
|
obj_setInt(range_obj, "_start", start);
|
||||||
|
obj_setInt(range_obj, "_end", end);
|
||||||
|
obj_setInt(range_obj, "_step", step);
|
||||||
|
}
|
||||||
return obj_arg;
|
return obj_arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,20 +382,18 @@ Arg* PikaStdLib_SysObj___slice__(PikaObj* self,
|
|||||||
return __vm_slice(self, end, obj, start, step);
|
return __vm_slice(self, end, obj, start, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __print_arg(PikaObj* self, Arg* val) {
|
static char* __print_arg(PikaObj* self, Arg* val) {
|
||||||
obj_setErrorCode(self, 0);
|
obj_setErrorCode(self, 0);
|
||||||
ArgType arg_type = arg_getType(val);
|
ArgType arg_type = arg_getType(val);
|
||||||
if (NULL != val) {
|
if (NULL != val) {
|
||||||
if (arg_getType(val) == ARG_TYPE_BYTES) {
|
if (arg_getType(val) == ARG_TYPE_BYTES) {
|
||||||
arg_printBytes(val);
|
return __printBytes(self, val);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (argType_isObject(arg_type)) {
|
if (argType_isObject(arg_type)) {
|
||||||
char* to_str = obj_toStr(arg_getPtr(val));
|
char* to_str = obj_toStr(arg_getPtr(val));
|
||||||
if (NULL != to_str) {
|
if (NULL != to_str) {
|
||||||
__platform_printf("%s\r\n", to_str);
|
return obj_cacheStr(self, to_str);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Args* print_args = New_args(NULL);
|
Args* print_args = New_args(NULL);
|
||||||
@ -387,51 +404,39 @@ static void __print_arg(PikaObj* self, Arg* val) {
|
|||||||
obj_setSysOut(self, "Error: can not print val");
|
obj_setSysOut(self, "Error: can not print val");
|
||||||
obj_setErrorCode(self, 1);
|
obj_setErrorCode(self, 1);
|
||||||
args_deinit(print_args);
|
args_deinit(print_args);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
obj_setStr(self, "_buf", res);
|
res = obj_cacheStr(self, res);
|
||||||
args_deinit(print_args);
|
args_deinit(print_args);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PikaStdLib_SysObj_print(PikaObj* self, PikaTuple* val) {
|
void PikaStdLib_SysObj_print(PikaObj* self, PikaTuple* val, PikaDict* ops) {
|
||||||
int arg_size = tuple_getSize(val);
|
int arg_size = tuple_getSize(val);
|
||||||
Arg* print_out_arg = arg_newStr("");
|
Arg* print_out_arg = arg_newStr("");
|
||||||
PIKA_BOOL is_get_print = PIKA_FALSE;
|
PIKA_BOOL is_get_print = PIKA_FALSE;
|
||||||
for (int i = 0; i < arg_size; i++) {
|
for (int i = 0; i < arg_size; i++) {
|
||||||
Arg* arg = tuple_getArg(val, i);
|
Arg* arg = tuple_getArg(val, i);
|
||||||
__print_arg(self, arg);
|
char* item = __print_arg(self, arg);
|
||||||
char* item = obj_getStr(self, "_buf");
|
|
||||||
if (NULL != item) {
|
if (NULL != item) {
|
||||||
is_get_print = PIKA_TRUE;
|
is_get_print = PIKA_TRUE;
|
||||||
print_out_arg = arg_strAppend(print_out_arg, item);
|
print_out_arg = arg_strAppend(print_out_arg, item);
|
||||||
if (i < arg_size - 1) {
|
if (i < arg_size - 1) {
|
||||||
print_out_arg = arg_strAppend(print_out_arg, " ");
|
print_out_arg = arg_strAppend(print_out_arg, " ");
|
||||||
}
|
}
|
||||||
obj_removeArg(self, "_buf");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
char* end = dict_getStr(ops, "end");
|
||||||
|
if (NULL == end) {
|
||||||
|
/* default */
|
||||||
|
end = "\r\n";
|
||||||
|
}
|
||||||
if (PIKA_TRUE == is_get_print) {
|
if (PIKA_TRUE == is_get_print) {
|
||||||
__platform_printf("%s\r\n", arg_getStr(print_out_arg));
|
__platform_printf("%s%s", arg_getStr(print_out_arg), end);
|
||||||
}
|
}
|
||||||
arg_deinit(print_out_arg);
|
arg_deinit(print_out_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PikaStdLib_SysObj_printNoEnd(PikaObj* self, Arg* val) {
|
|
||||||
obj_setErrorCode(self, 0);
|
|
||||||
Args* print_args = New_args(NULL);
|
|
||||||
args_setArg(print_args, arg_copy(val));
|
|
||||||
char* res = args_print(print_args, "val");
|
|
||||||
if (NULL == res) {
|
|
||||||
obj_setSysOut(self, "Error: print: can not print val");
|
|
||||||
obj_setErrorCode(self, 1);
|
|
||||||
args_deinit(print_args);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* not empty */
|
|
||||||
__platform_printf("%s", res);
|
|
||||||
args_deinit(print_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* PikaStdLib_SysObj_cformat(PikaObj* self, char* fmt, PikaTuple* var) {
|
char* PikaStdLib_SysObj_cformat(PikaObj* self, char* fmt, PikaTuple* var) {
|
||||||
#if PIKA_SYNTAX_FORMAT_ENABLE
|
#if PIKA_SYNTAX_FORMAT_ENABLE
|
||||||
Args buffs = {0};
|
Args buffs = {0};
|
||||||
@ -533,3 +538,7 @@ void PikaStdLib_SysObj_setattr(PikaObj* self,
|
|||||||
exit:
|
exit:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PikaStdLib_SysObj_exit(PikaObj *self){
|
||||||
|
pks_vm_exit();
|
||||||
|
}
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user