remove lib and api of bytecodegen

This commit is contained in:
pikastech 2022-06-24 16:23:44 +08:00
parent 3e371e9e57
commit f43e0227a1
66 changed files with 11 additions and 2750 deletions

View File

@ -1,4 +1,5 @@
cp package/pikascript/pikascript-core/* ../../src -r
cp package/pikascript/pikascript-core/* ../../tools/pikaByteCodeGen/pikascript/pikascript-core -r
cp package/pikascript/PikaObj.pyi ../../src
git add test/python/*.py
sh std_push.sh PikaStdLib

View File

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

View File

@ -958,13 +958,13 @@ char* Parser_solveBranckets(Args* outBuffs,
}
}
}
char* right_res = NULL;
exit:
/* clean and return */
char* right = strsCopy(outBuffs, arg_getStr(right_arg));
right_res = strsCopy(outBuffs, arg_getStr(right_arg));
arg_deinit(right_arg);
strsDeinit(&buffs);
return right;
return right_res;
}
#endif

View File

@ -8,6 +8,13 @@
#include "dataStrs.h"
#include "libpikabinder.h"
/* fake implement */
PikaObj* __pikaMain;
void New_PikaStdLib_SysObj(void){}
void New_PikaStdData_List(void) {}
void PikaStdData_List___init__(void){}
void PikaStdData_List_append(void){}
void main() {
/* run pika_binder to bind C modules */
pika_binder();

View File

@ -1,10 +0,0 @@
#api
from PikaObj import *
class Debuger(TinyObj):
def __init__(self):
pass
def set_trace(self):
pass

View File

@ -1,19 +0,0 @@
#api
class TinyObj:
pass
class BaseObj(TinyObj):
pass
class pointer:
pass
def print(val: any):
pass
def printNoEnd(val: any):
pass
def taskLoop(task: any):
pass

View File

@ -1,81 +0,0 @@
from PikaObj import *
class List(TinyObj):
def __init__(self): ...
# add an arg after the end of list
def append(self, arg: any): ...
# get an arg by the index
def get(self, i: int) -> any: ...
# set an arg by the index
def set(self, i: int, arg: any): ...
# get the length of list
def len(self) -> int: ...
# support for loop
def __iter__(self) -> any: ...
# support for loop
def __next__(self) -> any: ...
# support list[] = val
def __set__(self, __key: any, __val: any): ...
# support val = list[]
def __get__(self, __key: any) -> any: ...
def __del__(self): ...
def __str__(self) -> str: ...
class Dict(TinyObj):
def __init__(self): ...
# get an arg by the key
def get(self, key: str) -> any: ...
# set an arg by the key
def set(self, key: str, arg: any): ...
# remove an arg by the key
def remove(self, key: str): ...
def __iter__(self) -> any: ...
def __next__(self) -> any: ...
# support dict[] = val
def __set__(self, __key: any, __val: any): ...
# support val = dict[]
def __get__(self, __key: any) -> any: ...
def __del__(self): ...
def __str__(self) -> str: ...
def keys(self) -> dict_keys: ...
class dict_keys(TinyObj):
def __iter__(self) -> any: ...
def __next__(self) -> any: ...
def __str__(self) -> str: ...
class String(TinyObj):
def __init__(self, s: str): ...
def set(self, s: str): ...
def get(self) -> str: ...
def __iter__(self) -> any: ...
def __next__(self) -> any: ...
# support string[] = val
def __set__(self, __key: any, __val: any): ...
# support val = string[]
def __get__(self, __key: any) -> any: ...
# support str()
def __str__(self) -> str: ...
def startwith(self, prefix: str) -> int: ...
def endwith(self, suffix: str) -> int: ...
def isdigit(self) -> int: ...
def islower(self) -> int: ...
def isalnum(self) -> int: ...
def isalpha(self) -> int: ...
def isspace(self) -> int: ...
def split(self, s: str) -> List: ...
class ByteArray(List):
# convert a string to ByteArray
def fromString(self, s: str): ...
class Utils(TinyObj):
# convert a int to bytes
def int_to_bytes(self, val: int) -> bytes: ...

View File

@ -1,45 +0,0 @@
from PikaObj import *
class MemChecker(TinyObj):
def max(self): ...
def now(self): ...
def getMax(self) -> float: ...
def getNow(self) -> float: ...
def resetMax(self): ...
class SysObj(BaseObj):
def type(self, arg: any): ...
def remove(self, argPath: str): ...
def int(self, arg: any) -> int: ...
def float(self, arg: any) -> float: ...
def str(self, arg: any) -> str: ...
def iter(self, arg: any) -> any: ...
def range(self, a1: int, a2: int) -> any: ...
def print(self, *val): ...
def printNoEnd(self, val: any): ...
def __set__(self, obj: any, key: any, val: any) -> any: ...
def __get__(self, obj: any, key: any) -> any: ...
def __slice__(self, obj: any, start: any, end: any, step: int) -> any: ...
def len(self, arg: any) -> int: ...
def list(self) -> any: ...
def dict(self) -> any: ...
def hex(self, val: int) -> str: ...
def ord(self, val: str) -> int: ...
def chr(self, val: int) -> str: ...
def bytes(self, val: any) -> bytes: ...
def cformat(self, fmt: str, *var) -> str: ...
def id(self, obj: any) -> int: ...
class RangeObj(TinyObj):
def __next__(self) -> any: ...
class StringObj(TinyObj):
def __next__(self) -> any: ...
class PikaObj(TinyObj):
...

View File

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

View File

@ -1 +0,0 @@
import PikaStdLib

View File

@ -1,20 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaDebug.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaDebug_DebugerMethod(PikaObj *self, Args *args){
Arg* res = PikaDebug_Debuger(self);
method_returnArg(args, res);
}
PikaObj *New_PikaDebug(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineConstructor(self, "Debuger()->any", PikaDebug_DebugerMethod);
return self;
}

View File

@ -1,14 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaDebug__H
#define __PikaDebug__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaDebug(Args *args);
Arg* PikaDebug_Debuger(PikaObj *self);
#endif

View File

@ -1,27 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaDebug_Debuger.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaDebug_Debuger___init__Method(PikaObj *self, Args *args){
PikaDebug_Debuger___init__(self);
}
void PikaDebug_Debuger_set_traceMethod(PikaObj *self, Args *args){
PikaDebug_Debuger_set_trace(self);
}
PikaObj *New_PikaDebug_Debuger(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "__init__()", PikaDebug_Debuger___init__Method);
class_defineMethod(self, "set_trace()", PikaDebug_Debuger_set_traceMethod);
return self;
}
Arg *PikaDebug_Debuger(PikaObj *self){
return obj_newObjInPackage(New_PikaDebug_Debuger);
}

View File

@ -1,15 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaDebug_Debuger__H
#define __PikaDebug_Debuger__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaDebug_Debuger(Args *args);
void PikaDebug_Debuger___init__(PikaObj *self);
void PikaDebug_Debuger_set_trace(PikaObj *self);
#endif

View File

@ -1,19 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaMain.h"
#include "PikaStdLib_SysObj.h"
#include "PikaStdLib.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
PikaObj *New_PikaMain(Args *args){
PikaObj *self = New_PikaStdLib_SysObj(args);
obj_newObj(self, "PikaStdLib", "PikaStdLib", New_PikaStdLib);
return self;
}
Arg *PikaMain(PikaObj *self){
return obj_newObjInPackage(New_PikaMain);
}

View File

@ -1,13 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaMain__H
#define __PikaMain__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaMain(Args *args);
#endif

View File

@ -1,50 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdData.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdData_ByteArrayMethod(PikaObj *self, Args *args){
Arg* res = PikaStdData_ByteArray(self);
method_returnArg(args, res);
}
void PikaStdData_DictMethod(PikaObj *self, Args *args){
Arg* res = PikaStdData_Dict(self);
method_returnArg(args, res);
}
void PikaStdData_ListMethod(PikaObj *self, Args *args){
Arg* res = PikaStdData_List(self);
method_returnArg(args, res);
}
void PikaStdData_StringMethod(PikaObj *self, Args *args){
Arg* res = PikaStdData_String(self);
method_returnArg(args, res);
}
void PikaStdData_UtilsMethod(PikaObj *self, Args *args){
Arg* res = PikaStdData_Utils(self);
method_returnArg(args, res);
}
void PikaStdData_dict_keysMethod(PikaObj *self, Args *args){
Arg* res = PikaStdData_dict_keys(self);
method_returnArg(args, res);
}
PikaObj *New_PikaStdData(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineConstructor(self, "ByteArray()->any", PikaStdData_ByteArrayMethod);
class_defineConstructor(self, "Dict()->any", PikaStdData_DictMethod);
class_defineConstructor(self, "List()->any", PikaStdData_ListMethod);
class_defineConstructor(self, "String()->any", PikaStdData_StringMethod);
class_defineConstructor(self, "Utils()->any", PikaStdData_UtilsMethod);
class_defineConstructor(self, "dict_keys()->any", PikaStdData_dict_keysMethod);
return self;
}

View File

@ -1,19 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdData__H
#define __PikaStdData__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdData(Args *args);
Arg* PikaStdData_ByteArray(PikaObj *self);
Arg* PikaStdData_Dict(PikaObj *self);
Arg* PikaStdData_List(PikaObj *self);
Arg* PikaStdData_String(PikaObj *self);
Arg* PikaStdData_Utils(PikaObj *self);
Arg* PikaStdData_dict_keys(PikaObj *self);
#endif

View File

@ -1,23 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdData_ByteArray.h"
#include "PikaStdData_List.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdData_ByteArray_fromStringMethod(PikaObj *self, Args *args){
char* s = args_getStr(args, "s");
PikaStdData_ByteArray_fromString(self, s);
}
PikaObj *New_PikaStdData_ByteArray(Args *args){
PikaObj *self = New_PikaStdData_List(args);
class_defineMethod(self, "fromString(s:str)", PikaStdData_ByteArray_fromStringMethod);
return self;
}
Arg *PikaStdData_ByteArray(PikaObj *self){
return obj_newObjInPackage(New_PikaStdData_ByteArray);
}

View File

@ -1,14 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdData_ByteArray__H
#define __PikaStdData_ByteArray__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdData_ByteArray(Args *args);
void PikaStdData_ByteArray_fromString(PikaObj *self, char* s);
#endif

View File

@ -1,79 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdData_Dict.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdData_Dict___del__Method(PikaObj *self, Args *args){
PikaStdData_Dict___del__(self);
}
void PikaStdData_Dict___get__Method(PikaObj *self, Args *args){
Arg* __key = args_getArg(args, "__key");
Arg* res = PikaStdData_Dict___get__(self, __key);
method_returnArg(args, res);
}
void PikaStdData_Dict___init__Method(PikaObj *self, Args *args){
PikaStdData_Dict___init__(self);
}
void PikaStdData_Dict___iter__Method(PikaObj *self, Args *args){
Arg* res = PikaStdData_Dict___iter__(self);
method_returnArg(args, res);
}
void PikaStdData_Dict___next__Method(PikaObj *self, Args *args){
Arg* res = PikaStdData_Dict___next__(self);
method_returnArg(args, res);
}
void PikaStdData_Dict___set__Method(PikaObj *self, Args *args){
Arg* __key = args_getArg(args, "__key");
Arg* __val = args_getArg(args, "__val");
PikaStdData_Dict___set__(self, __key, __val);
}
void PikaStdData_Dict_getMethod(PikaObj *self, Args *args){
char* key = args_getStr(args, "key");
Arg* res = PikaStdData_Dict_get(self, key);
method_returnArg(args, res);
}
void PikaStdData_Dict_keysMethod(PikaObj *self, Args *args){
PikaObj* res = PikaStdData_Dict_keys(self);
method_returnObj(args, res);
}
void PikaStdData_Dict_removeMethod(PikaObj *self, Args *args){
char* key = args_getStr(args, "key");
PikaStdData_Dict_remove(self, key);
}
void PikaStdData_Dict_setMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
char* key = args_getStr(args, "key");
PikaStdData_Dict_set(self, arg, key);
}
PikaObj *New_PikaStdData_Dict(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "__del__()", PikaStdData_Dict___del__Method);
class_defineMethod(self, "__get__(__key:any)->any", PikaStdData_Dict___get__Method);
class_defineMethod(self, "__init__()", PikaStdData_Dict___init__Method);
class_defineMethod(self, "__iter__()->any", PikaStdData_Dict___iter__Method);
class_defineMethod(self, "__next__()->any", PikaStdData_Dict___next__Method);
class_defineMethod(self, "__set__(__key:any,__val:any)", PikaStdData_Dict___set__Method);
class_defineMethod(self, "get(key:str)->any", PikaStdData_Dict_getMethod);
class_defineMethod(self, "keys()->dict_keys", PikaStdData_Dict_keysMethod);
class_defineMethod(self, "remove(key:str)", PikaStdData_Dict_removeMethod);
class_defineMethod(self, "set(key:str,arg:any)", PikaStdData_Dict_setMethod);
return self;
}
Arg *PikaStdData_Dict(PikaObj *self){
return obj_newObjInPackage(New_PikaStdData_Dict);
}

View File

@ -1,23 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdData_Dict__H
#define __PikaStdData_Dict__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdData_Dict(Args *args);
void PikaStdData_Dict___del__(PikaObj *self);
Arg* PikaStdData_Dict___get__(PikaObj *self, Arg* __key);
void PikaStdData_Dict___init__(PikaObj *self);
Arg* PikaStdData_Dict___iter__(PikaObj *self);
Arg* PikaStdData_Dict___next__(PikaObj *self);
void PikaStdData_Dict___set__(PikaObj *self, Arg* __key, Arg* __val);
Arg* PikaStdData_Dict_get(PikaObj *self, char* key);
PikaObj* PikaStdData_Dict_keys(PikaObj *self);
void PikaStdData_Dict_remove(PikaObj *self, char* key);
void PikaStdData_Dict_set(PikaObj *self, Arg* arg, char* key);
#endif

View File

@ -1,79 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdData_List.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdData_List___del__Method(PikaObj *self, Args *args){
PikaStdData_List___del__(self);
}
void PikaStdData_List___get__Method(PikaObj *self, Args *args){
Arg* __key = args_getArg(args, "__key");
Arg* res = PikaStdData_List___get__(self, __key);
method_returnArg(args, res);
}
void PikaStdData_List___init__Method(PikaObj *self, Args *args){
PikaStdData_List___init__(self);
}
void PikaStdData_List___iter__Method(PikaObj *self, Args *args){
Arg* res = PikaStdData_List___iter__(self);
method_returnArg(args, res);
}
void PikaStdData_List___next__Method(PikaObj *self, Args *args){
Arg* res = PikaStdData_List___next__(self);
method_returnArg(args, res);
}
void PikaStdData_List___set__Method(PikaObj *self, Args *args){
Arg* __key = args_getArg(args, "__key");
Arg* __val = args_getArg(args, "__val");
PikaStdData_List___set__(self, __key, __val);
}
void PikaStdData_List_appendMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
PikaStdData_List_append(self, arg);
}
void PikaStdData_List_getMethod(PikaObj *self, Args *args){
int i = args_getInt(args, "i");
Arg* res = PikaStdData_List_get(self, i);
method_returnArg(args, res);
}
void PikaStdData_List_lenMethod(PikaObj *self, Args *args){
int res = PikaStdData_List_len(self);
method_returnInt(args, res);
}
void PikaStdData_List_setMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
int i = args_getInt(args, "i");
PikaStdData_List_set(self, arg, i);
}
PikaObj *New_PikaStdData_List(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "__del__()", PikaStdData_List___del__Method);
class_defineMethod(self, "__get__(__key:any)->any", PikaStdData_List___get__Method);
class_defineMethod(self, "__init__()", PikaStdData_List___init__Method);
class_defineMethod(self, "__iter__()->any", PikaStdData_List___iter__Method);
class_defineMethod(self, "__next__()->any", PikaStdData_List___next__Method);
class_defineMethod(self, "__set__(__key:any,__val:any)", PikaStdData_List___set__Method);
class_defineMethod(self, "append(arg:any)", PikaStdData_List_appendMethod);
class_defineMethod(self, "get(i:int)->any", PikaStdData_List_getMethod);
class_defineMethod(self, "len()->int", PikaStdData_List_lenMethod);
class_defineMethod(self, "set(i:int,arg:any)", PikaStdData_List_setMethod);
return self;
}
Arg *PikaStdData_List(PikaObj *self){
return obj_newObjInPackage(New_PikaStdData_List);
}

View File

@ -1,23 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdData_List__H
#define __PikaStdData_List__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdData_List(Args *args);
void PikaStdData_List___del__(PikaObj *self);
Arg* PikaStdData_List___get__(PikaObj *self, Arg* __key);
void PikaStdData_List___init__(PikaObj *self);
Arg* PikaStdData_List___iter__(PikaObj *self);
Arg* PikaStdData_List___next__(PikaObj *self);
void PikaStdData_List___set__(PikaObj *self, Arg* __key, Arg* __val);
void PikaStdData_List_append(PikaObj *self, Arg* arg);
Arg* PikaStdData_List_get(PikaObj *self, int i);
int PikaStdData_List_len(PikaObj *self);
void PikaStdData_List_set(PikaObj *self, Arg* arg, int i);
#endif

View File

@ -1,118 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdData_String.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdData_String___get__Method(PikaObj *self, Args *args){
Arg* __key = args_getArg(args, "__key");
Arg* res = PikaStdData_String___get__(self, __key);
method_returnArg(args, res);
}
void PikaStdData_String___init__Method(PikaObj *self, Args *args){
char* s = args_getStr(args, "s");
PikaStdData_String___init__(self, s);
}
void PikaStdData_String___iter__Method(PikaObj *self, Args *args){
Arg* res = PikaStdData_String___iter__(self);
method_returnArg(args, res);
}
void PikaStdData_String___next__Method(PikaObj *self, Args *args){
Arg* res = PikaStdData_String___next__(self);
method_returnArg(args, res);
}
void PikaStdData_String___set__Method(PikaObj *self, Args *args){
Arg* __key = args_getArg(args, "__key");
Arg* __val = args_getArg(args, "__val");
PikaStdData_String___set__(self, __key, __val);
}
void PikaStdData_String___str__Method(PikaObj *self, Args *args){
char* res = PikaStdData_String___str__(self);
method_returnStr(args, res);
}
void PikaStdData_String_endwithMethod(PikaObj *self, Args *args){
char* suffix = args_getStr(args, "suffix");
int res = PikaStdData_String_endwith(self, suffix);
method_returnInt(args, res);
}
void PikaStdData_String_getMethod(PikaObj *self, Args *args){
char* res = PikaStdData_String_get(self);
method_returnStr(args, res);
}
void PikaStdData_String_isalnumMethod(PikaObj *self, Args *args){
int res = PikaStdData_String_isalnum(self);
method_returnInt(args, res);
}
void PikaStdData_String_isalphaMethod(PikaObj *self, Args *args){
int res = PikaStdData_String_isalpha(self);
method_returnInt(args, res);
}
void PikaStdData_String_isdigitMethod(PikaObj *self, Args *args){
int res = PikaStdData_String_isdigit(self);
method_returnInt(args, res);
}
void PikaStdData_String_islowerMethod(PikaObj *self, Args *args){
int res = PikaStdData_String_islower(self);
method_returnInt(args, res);
}
void PikaStdData_String_isspaceMethod(PikaObj *self, Args *args){
int res = PikaStdData_String_isspace(self);
method_returnInt(args, res);
}
void PikaStdData_String_setMethod(PikaObj *self, Args *args){
char* s = args_getStr(args, "s");
PikaStdData_String_set(self, s);
}
void PikaStdData_String_splitMethod(PikaObj *self, Args *args){
char* s = args_getStr(args, "s");
PikaObj* res = PikaStdData_String_split(self, s);
method_returnObj(args, res);
}
void PikaStdData_String_startwithMethod(PikaObj *self, Args *args){
char* prefix = args_getStr(args, "prefix");
int res = PikaStdData_String_startwith(self, prefix);
method_returnInt(args, res);
}
PikaObj *New_PikaStdData_String(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "__get__(__key:any)->any", PikaStdData_String___get__Method);
class_defineMethod(self, "__init__(s:str)", PikaStdData_String___init__Method);
class_defineMethod(self, "__iter__()->any", PikaStdData_String___iter__Method);
class_defineMethod(self, "__next__()->any", PikaStdData_String___next__Method);
class_defineMethod(self, "__set__(__key:any,__val:any)", PikaStdData_String___set__Method);
class_defineMethod(self, "__str__()->str", PikaStdData_String___str__Method);
class_defineMethod(self, "endwith(suffix:str)->int", PikaStdData_String_endwithMethod);
class_defineMethod(self, "get()->str", PikaStdData_String_getMethod);
class_defineMethod(self, "isalnum()->int", PikaStdData_String_isalnumMethod);
class_defineMethod(self, "isalpha()->int", PikaStdData_String_isalphaMethod);
class_defineMethod(self, "isdigit()->int", PikaStdData_String_isdigitMethod);
class_defineMethod(self, "islower()->int", PikaStdData_String_islowerMethod);
class_defineMethod(self, "isspace()->int", PikaStdData_String_isspaceMethod);
class_defineMethod(self, "set(s:str)", PikaStdData_String_setMethod);
class_defineMethod(self, "split(s:str)->List", PikaStdData_String_splitMethod);
class_defineMethod(self, "startwith(prefix:str)->int", PikaStdData_String_startwithMethod);
return self;
}
Arg *PikaStdData_String(PikaObj *self){
return obj_newObjInPackage(New_PikaStdData_String);
}

View File

@ -1,29 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdData_String__H
#define __PikaStdData_String__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdData_String(Args *args);
Arg* PikaStdData_String___get__(PikaObj *self, Arg* __key);
void PikaStdData_String___init__(PikaObj *self, char* s);
Arg* PikaStdData_String___iter__(PikaObj *self);
Arg* PikaStdData_String___next__(PikaObj *self);
void PikaStdData_String___set__(PikaObj *self, Arg* __key, Arg* __val);
char* PikaStdData_String___str__(PikaObj *self);
int PikaStdData_String_endwith(PikaObj *self, char* suffix);
char* PikaStdData_String_get(PikaObj *self);
int PikaStdData_String_isalnum(PikaObj *self);
int PikaStdData_String_isalpha(PikaObj *self);
int PikaStdData_String_isdigit(PikaObj *self);
int PikaStdData_String_islower(PikaObj *self);
int PikaStdData_String_isspace(PikaObj *self);
void PikaStdData_String_set(PikaObj *self, char* s);
PikaObj* PikaStdData_String_split(PikaObj *self, char* s);
int PikaStdData_String_startwith(PikaObj *self, char* prefix);
#endif

View File

@ -1,24 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdData_Utils.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdData_Utils_int_to_bytesMethod(PikaObj *self, Args *args){
int val = args_getInt(args, "val");
Arg* res = PikaStdData_Utils_int_to_bytes(self, val);
method_returnArg(args, res);
}
PikaObj *New_PikaStdData_Utils(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "int_to_bytes(val:int)->bytes", PikaStdData_Utils_int_to_bytesMethod);
return self;
}
Arg *PikaStdData_Utils(PikaObj *self){
return obj_newObjInPackage(New_PikaStdData_Utils);
}

View File

@ -1,14 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdData_Utils__H
#define __PikaStdData_Utils__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdData_Utils(Args *args);
Arg* PikaStdData_Utils_int_to_bytes(PikaObj *self, int val);
#endif

View File

@ -1,29 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdData_dict_keys.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdData_dict_keys___iter__Method(PikaObj *self, Args *args){
Arg* res = PikaStdData_dict_keys___iter__(self);
method_returnArg(args, res);
}
void PikaStdData_dict_keys___next__Method(PikaObj *self, Args *args){
Arg* res = PikaStdData_dict_keys___next__(self);
method_returnArg(args, res);
}
PikaObj *New_PikaStdData_dict_keys(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "__iter__()->any", PikaStdData_dict_keys___iter__Method);
class_defineMethod(self, "__next__()->any", PikaStdData_dict_keys___next__Method);
return self;
}
Arg *PikaStdData_dict_keys(PikaObj *self){
return obj_newObjInPackage(New_PikaStdData_dict_keys);
}

View File

@ -1,15 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdData_dict_keys__H
#define __PikaStdData_dict_keys__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdData_dict_keys(Args *args);
Arg* PikaStdData_dict_keys___iter__(PikaObj *self);
Arg* PikaStdData_dict_keys___next__(PikaObj *self);
#endif

View File

@ -1,44 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdLib.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdLib_MemCheckerMethod(PikaObj *self, Args *args){
Arg* res = PikaStdLib_MemChecker(self);
method_returnArg(args, res);
}
void PikaStdLib_PikaObjMethod(PikaObj *self, Args *args){
Arg* res = PikaStdLib_PikaObj(self);
method_returnArg(args, res);
}
void PikaStdLib_RangeObjMethod(PikaObj *self, Args *args){
Arg* res = PikaStdLib_RangeObj(self);
method_returnArg(args, res);
}
void PikaStdLib_StringObjMethod(PikaObj *self, Args *args){
Arg* res = PikaStdLib_StringObj(self);
method_returnArg(args, res);
}
void PikaStdLib_SysObjMethod(PikaObj *self, Args *args){
Arg* res = PikaStdLib_SysObj(self);
method_returnArg(args, res);
}
PikaObj *New_PikaStdLib(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineConstructor(self, "MemChecker()->any", PikaStdLib_MemCheckerMethod);
class_defineConstructor(self, "PikaObj()->any", PikaStdLib_PikaObjMethod);
class_defineConstructor(self, "RangeObj()->any", PikaStdLib_RangeObjMethod);
class_defineConstructor(self, "StringObj()->any", PikaStdLib_StringObjMethod);
class_defineConstructor(self, "SysObj()->any", PikaStdLib_SysObjMethod);
return self;
}

View File

@ -1,18 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdLib__H
#define __PikaStdLib__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdLib(Args *args);
Arg* PikaStdLib_MemChecker(PikaObj *self);
Arg* PikaStdLib_PikaObj(PikaObj *self);
Arg* PikaStdLib_RangeObj(PikaObj *self);
Arg* PikaStdLib_StringObj(PikaObj *self);
Arg* PikaStdLib_SysObj(PikaObj *self);
#endif

View File

@ -1,44 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdLib_MemChecker.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdLib_MemChecker_getMaxMethod(PikaObj *self, Args *args){
double res = PikaStdLib_MemChecker_getMax(self);
method_returnFloat(args, res);
}
void PikaStdLib_MemChecker_getNowMethod(PikaObj *self, Args *args){
double res = PikaStdLib_MemChecker_getNow(self);
method_returnFloat(args, res);
}
void PikaStdLib_MemChecker_maxMethod(PikaObj *self, Args *args){
PikaStdLib_MemChecker_max(self);
}
void PikaStdLib_MemChecker_nowMethod(PikaObj *self, Args *args){
PikaStdLib_MemChecker_now(self);
}
void PikaStdLib_MemChecker_resetMaxMethod(PikaObj *self, Args *args){
PikaStdLib_MemChecker_resetMax(self);
}
PikaObj *New_PikaStdLib_MemChecker(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "getMax()->float", PikaStdLib_MemChecker_getMaxMethod);
class_defineMethod(self, "getNow()->float", PikaStdLib_MemChecker_getNowMethod);
class_defineMethod(self, "max()", PikaStdLib_MemChecker_maxMethod);
class_defineMethod(self, "now()", PikaStdLib_MemChecker_nowMethod);
class_defineMethod(self, "resetMax()", PikaStdLib_MemChecker_resetMaxMethod);
return self;
}
Arg *PikaStdLib_MemChecker(PikaObj *self){
return obj_newObjInPackage(New_PikaStdLib_MemChecker);
}

View File

@ -1,18 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdLib_MemChecker__H
#define __PikaStdLib_MemChecker__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdLib_MemChecker(Args *args);
double PikaStdLib_MemChecker_getMax(PikaObj *self);
double PikaStdLib_MemChecker_getNow(PikaObj *self);
void PikaStdLib_MemChecker_max(PikaObj *self);
void PikaStdLib_MemChecker_now(PikaObj *self);
void PikaStdLib_MemChecker_resetMax(PikaObj *self);
#endif

View File

@ -1,17 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdLib_PikaObj.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
PikaObj *New_PikaStdLib_PikaObj(Args *args){
PikaObj *self = New_TinyObj(args);
return self;
}
Arg *PikaStdLib_PikaObj(PikaObj *self){
return obj_newObjInPackage(New_PikaStdLib_PikaObj);
}

View File

@ -1,13 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdLib_PikaObj__H
#define __PikaStdLib_PikaObj__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdLib_PikaObj(Args *args);
#endif

View File

@ -1,23 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdLib_RangeObj.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdLib_RangeObj___next__Method(PikaObj *self, Args *args){
Arg* res = PikaStdLib_RangeObj___next__(self);
method_returnArg(args, res);
}
PikaObj *New_PikaStdLib_RangeObj(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "__next__()->any", PikaStdLib_RangeObj___next__Method);
return self;
}
Arg *PikaStdLib_RangeObj(PikaObj *self){
return obj_newObjInPackage(New_PikaStdLib_RangeObj);
}

View File

@ -1,14 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdLib_RangeObj__H
#define __PikaStdLib_RangeObj__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdLib_RangeObj(Args *args);
Arg* PikaStdLib_RangeObj___next__(PikaObj *self);
#endif

View File

@ -1,23 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdLib_StringObj.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdLib_StringObj___next__Method(PikaObj *self, Args *args){
Arg* res = PikaStdLib_StringObj___next__(self);
method_returnArg(args, res);
}
PikaObj *New_PikaStdLib_StringObj(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineMethod(self, "__next__()->any", PikaStdLib_StringObj___next__Method);
return self;
}
Arg *PikaStdLib_StringObj(PikaObj *self){
return obj_newObjInPackage(New_PikaStdLib_StringObj);
}

View File

@ -1,14 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdLib_StringObj__H
#define __PikaStdLib_StringObj__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdLib_StringObj(Args *args);
Arg* PikaStdLib_StringObj___next__(PikaObj *self);
#endif

View File

@ -1,166 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdLib_SysObj.h"
#include "BaseObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdLib_SysObj___get__Method(PikaObj *self, Args *args){
Arg* key = args_getArg(args, "key");
Arg* obj = args_getArg(args, "obj");
Arg* res = PikaStdLib_SysObj___get__(self, key, obj);
method_returnArg(args, res);
}
void PikaStdLib_SysObj___set__Method(PikaObj *self, Args *args){
Arg* key = args_getArg(args, "key");
Arg* obj = args_getArg(args, "obj");
char* obj_str = args_getStr(args, "obj_str");
Arg* val = args_getArg(args, "val");
PikaStdLib_SysObj___set__(self, key, obj, obj_str, val);
}
void PikaStdLib_SysObj___slice__Method(PikaObj *self, Args *args){
Arg* end = args_getArg(args, "end");
Arg* obj = args_getArg(args, "obj");
Arg* start = args_getArg(args, "start");
int step = args_getInt(args, "step");
Arg* res = PikaStdLib_SysObj___slice__(self, end, obj, start, step);
method_returnArg(args, res);
}
void PikaStdLib_SysObj_bytesMethod(PikaObj *self, Args *args){
Arg* val = args_getArg(args, "val");
Arg* res = PikaStdLib_SysObj_bytes(self, val);
method_returnArg(args, res);
}
void PikaStdLib_SysObj_cformatMethod(PikaObj *self, Args *args){
char* fmt = args_getStr(args, "fmt");
PikaTuple* var = args_getPtr(args, "var");
char* res = PikaStdLib_SysObj_cformat(self, fmt, var);
method_returnStr(args, res);
}
void PikaStdLib_SysObj_chrMethod(PikaObj *self, Args *args){
int val = args_getInt(args, "val");
char* res = PikaStdLib_SysObj_chr(self, val);
method_returnStr(args, res);
}
void PikaStdLib_SysObj_dictMethod(PikaObj *self, Args *args){
Arg* res = PikaStdLib_SysObj_dict(self);
method_returnArg(args, res);
}
void PikaStdLib_SysObj_floatMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
double res = PikaStdLib_SysObj_float(self, arg);
method_returnFloat(args, res);
}
void PikaStdLib_SysObj_hexMethod(PikaObj *self, Args *args){
int val = args_getInt(args, "val");
char* res = PikaStdLib_SysObj_hex(self, val);
method_returnStr(args, res);
}
void PikaStdLib_SysObj_idMethod(PikaObj *self, Args *args){
Arg* obj = args_getArg(args, "obj");
int res = PikaStdLib_SysObj_id(self, obj);
method_returnInt(args, res);
}
void PikaStdLib_SysObj_intMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
int res = PikaStdLib_SysObj_int(self, arg);
method_returnInt(args, res);
}
void PikaStdLib_SysObj_iterMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
Arg* res = PikaStdLib_SysObj_iter(self, arg);
method_returnArg(args, res);
}
void PikaStdLib_SysObj_lenMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
int res = PikaStdLib_SysObj_len(self, arg);
method_returnInt(args, res);
}
void PikaStdLib_SysObj_listMethod(PikaObj *self, Args *args){
Arg* res = PikaStdLib_SysObj_list(self);
method_returnArg(args, res);
}
void PikaStdLib_SysObj_ordMethod(PikaObj *self, Args *args){
char* val = args_getStr(args, "val");
int res = PikaStdLib_SysObj_ord(self, val);
method_returnInt(args, res);
}
void PikaStdLib_SysObj_printMethod(PikaObj *self, Args *args){
PikaTuple* val = args_getPtr(args, "val");
PikaStdLib_SysObj_print(self, val);
}
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){
int a1 = args_getInt(args, "a1");
int a2 = args_getInt(args, "a2");
Arg* res = PikaStdLib_SysObj_range(self, a1, a2);
method_returnArg(args, res);
}
void PikaStdLib_SysObj_removeMethod(PikaObj *self, Args *args){
char* argPath = args_getStr(args, "argPath");
PikaStdLib_SysObj_remove(self, argPath);
}
void PikaStdLib_SysObj_strMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
char* res = PikaStdLib_SysObj_str(self, arg);
method_returnStr(args, res);
}
void PikaStdLib_SysObj_typeMethod(PikaObj *self, Args *args){
Arg* arg = args_getArg(args, "arg");
PikaStdLib_SysObj_type(self, arg);
}
PikaObj *New_PikaStdLib_SysObj(Args *args){
PikaObj *self = New_BaseObj(args);
class_defineMethod(self, "__get__(obj:any,key:any)->any", PikaStdLib_SysObj___get__Method);
class_defineMethod(self, "__set__(obj:any,key:any,val:any,obj_str:str)", PikaStdLib_SysObj___set__Method);
class_defineMethod(self, "__slice__(obj:any,start:any,end:any,step:int)->any", PikaStdLib_SysObj___slice__Method);
class_defineMethod(self, "bytes(val:any)->bytes", PikaStdLib_SysObj_bytesMethod);
class_defineMethod(self, "cformat(fmt:str,*var)->str", PikaStdLib_SysObj_cformatMethod);
class_defineMethod(self, "chr(val:int)->str", PikaStdLib_SysObj_chrMethod);
class_defineMethod(self, "dict()->any", PikaStdLib_SysObj_dictMethod);
class_defineMethod(self, "float(arg:any)->float", PikaStdLib_SysObj_floatMethod);
class_defineMethod(self, "hex(val:int)->str", PikaStdLib_SysObj_hexMethod);
class_defineMethod(self, "id(obj:any)->int", PikaStdLib_SysObj_idMethod);
class_defineMethod(self, "int(arg:any)->int", PikaStdLib_SysObj_intMethod);
class_defineMethod(self, "iter(arg:any)->any", PikaStdLib_SysObj_iterMethod);
class_defineMethod(self, "len(arg:any)->int", PikaStdLib_SysObj_lenMethod);
class_defineMethod(self, "list()->any", PikaStdLib_SysObj_listMethod);
class_defineMethod(self, "ord(val:str)->int", PikaStdLib_SysObj_ordMethod);
class_defineMethod(self, "print(*val)", PikaStdLib_SysObj_printMethod);
class_defineMethod(self, "printNoEnd(val:any)", PikaStdLib_SysObj_printNoEndMethod);
class_defineMethod(self, "range(a1:int,a2:int)->any", PikaStdLib_SysObj_rangeMethod);
class_defineMethod(self, "remove(argPath:str)", PikaStdLib_SysObj_removeMethod);
class_defineMethod(self, "str(arg:any)->str", PikaStdLib_SysObj_strMethod);
class_defineMethod(self, "type(arg:any)", PikaStdLib_SysObj_typeMethod);
return self;
}
Arg *PikaStdLib_SysObj(PikaObj *self){
return obj_newObjInPackage(New_PikaStdLib_SysObj);
}

View File

@ -1,34 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdLib_SysObj__H
#define __PikaStdLib_SysObj__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdLib_SysObj(Args *args);
Arg* PikaStdLib_SysObj___get__(PikaObj *self, Arg* key, Arg* obj);
void PikaStdLib_SysObj___set__(PikaObj *self, Arg* key, Arg* obj, char* obj_str, Arg* val);
Arg* PikaStdLib_SysObj___slice__(PikaObj *self, Arg* end, Arg* obj, Arg* start, int step);
Arg* PikaStdLib_SysObj_bytes(PikaObj *self, Arg* val);
char* PikaStdLib_SysObj_cformat(PikaObj *self, char* fmt, PikaTuple* var);
char* PikaStdLib_SysObj_chr(PikaObj *self, int val);
Arg* PikaStdLib_SysObj_dict(PikaObj *self);
double PikaStdLib_SysObj_float(PikaObj *self, Arg* arg);
char* PikaStdLib_SysObj_hex(PikaObj *self, int val);
int PikaStdLib_SysObj_id(PikaObj *self, Arg* obj);
int PikaStdLib_SysObj_int(PikaObj *self, Arg* arg);
Arg* PikaStdLib_SysObj_iter(PikaObj *self, Arg* arg);
int PikaStdLib_SysObj_len(PikaObj *self, Arg* arg);
Arg* PikaStdLib_SysObj_list(PikaObj *self);
int PikaStdLib_SysObj_ord(PikaObj *self, char* val);
void PikaStdLib_SysObj_print(PikaObj *self, PikaTuple* val);
void PikaStdLib_SysObj_printNoEnd(PikaObj *self, Arg* val);
Arg* PikaStdLib_SysObj_range(PikaObj *self, int a1, int a2);
void PikaStdLib_SysObj_remove(PikaObj *self, char* argPath);
char* PikaStdLib_SysObj_str(PikaObj *self, Arg* arg);
void PikaStdLib_SysObj_type(PikaObj *self, Arg* arg);
#endif

View File

@ -1,20 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdTask.h"
#include "TinyObj.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdTask_TaskMethod(PikaObj *self, Args *args){
Arg* res = PikaStdTask_Task(self);
method_returnArg(args, res);
}
PikaObj *New_PikaStdTask(Args *args){
PikaObj *self = New_TinyObj(args);
class_defineConstructor(self, "Task()->any", PikaStdTask_TaskMethod);
return self;
}

View File

@ -1,14 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdTask__H
#define __PikaStdTask__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdTask(Args *args);
Arg* PikaStdTask_Task(PikaObj *self);
#endif

View File

@ -1,65 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaStdTask_Task.h"
#include "PikaStdLib_SysObj.h"
#include "PikaStdData_List.h"
#include <stdio.h>
#include <stdlib.h>
#include "BaseObj.h"
void PikaStdTask_Task___init__Method(PikaObj *self, Args *args){
PikaStdTask_Task___init__(self);
}
void PikaStdTask_Task_call_alwaysMethod(PikaObj *self, Args *args){
Arg* fun_todo = args_getArg(args, "fun_todo");
PikaStdTask_Task_call_always(self, fun_todo);
}
void PikaStdTask_Task_call_period_msMethod(PikaObj *self, Args *args){
Arg* fun_todo = args_getArg(args, "fun_todo");
int period_ms = args_getInt(args, "period_ms");
PikaStdTask_Task_call_period_ms(self, fun_todo, period_ms);
}
void PikaStdTask_Task_call_whenMethod(PikaObj *self, Args *args){
Arg* fun_todo = args_getArg(args, "fun_todo");
Arg* fun_when = args_getArg(args, "fun_when");
PikaStdTask_Task_call_when(self, fun_todo, fun_when);
}
void PikaStdTask_Task_platformGetTickMethod(PikaObj *self, Args *args){
PikaStdTask_Task_platformGetTick(self);
}
void PikaStdTask_Task_run_foreverMethod(PikaObj *self, Args *args){
PikaStdTask_Task_run_forever(self);
}
void PikaStdTask_Task_run_onceMethod(PikaObj *self, Args *args){
PikaStdTask_Task_run_once(self);
}
void PikaStdTask_Task_run_until_msMethod(PikaObj *self, Args *args){
int until_ms = args_getInt(args, "until_ms");
PikaStdTask_Task_run_until_ms(self, until_ms);
}
PikaObj *New_PikaStdTask_Task(Args *args){
PikaObj *self = New_PikaStdLib_SysObj(args);
obj_newObj(self, "calls", "PikaStdData_List", New_PikaStdData_List);
class_defineMethod(self, "__init__()", PikaStdTask_Task___init__Method);
class_defineMethod(self, "call_always(fun_todo:any)", 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_when(fun_todo:any,fun_when:any)", PikaStdTask_Task_call_whenMethod);
class_defineMethod(self, "platformGetTick()", PikaStdTask_Task_platformGetTickMethod);
class_defineMethod(self, "run_forever()", PikaStdTask_Task_run_foreverMethod);
class_defineMethod(self, "run_once()", PikaStdTask_Task_run_onceMethod);
class_defineMethod(self, "run_until_ms(until_ms:int)", PikaStdTask_Task_run_until_msMethod);
return self;
}
Arg *PikaStdTask_Task(PikaObj *self){
return obj_newObjInPackage(New_PikaStdTask_Task);
}

View File

@ -1,21 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __PikaStdTask_Task__H
#define __PikaStdTask_Task__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
PikaObj *New_PikaStdTask_Task(Args *args);
void PikaStdTask_Task___init__(PikaObj *self);
void PikaStdTask_Task_call_always(PikaObj *self, Arg* fun_todo);
void PikaStdTask_Task_call_period_ms(PikaObj *self, Arg* fun_todo, int period_ms);
void PikaStdTask_Task_call_when(PikaObj *self, Arg* fun_todo, Arg* fun_when);
void PikaStdTask_Task_platformGetTick(PikaObj *self);
void PikaStdTask_Task_run_forever(PikaObj *self);
void PikaStdTask_Task_run_once(PikaObj *self);
void PikaStdTask_Task_run_until_ms(PikaObj *self, int until_ms);
#endif

View File

@ -1,12 +0,0 @@
#include "PikaPlatform.h"
/* warning: auto generated file, please do not modify */
PIKA_BYTECODE_ALIGN const unsigned char pikaModules_py_a[] = {
0x7f, 0x70, 0x79, 0x61, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x96, 0x01, 0x00, 0x0c, 0x00,
0x00, 0x50, 0x69, 0x6b, 0x61, 0x53, 0x74, 0x64, 0x4c, 0x69, 0x62, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
};

File diff suppressed because one or more lines are too long

View File

@ -1,26 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#include "PikaMain.h"
#include <stdio.h>
#include <stdlib.h>
PikaObj *__pikaMain;
PikaObj *pikaScriptInit(void){
__platform_printf("======[pikascript packages installed]======\r\n");
__platform_printf("PikaStdLib==latest\r\n");
__platform_printf("pikascript-core==latest\r\n");
__platform_printf("===========================================\r\n");
__pikaMain = newRootObj("pikaMain", New_PikaMain);
extern unsigned char pikaModules_py_a[];
obj_linkLibrary(__pikaMain, pikaModules_py_a);
#if PIKA_INIT_STRING_ENABLE
obj_run(__pikaMain,
"import PikaStdLib\n"
"\n");
#else
obj_runModule(__pikaMain, "main");
#endif
return __pikaMain;
}

View File

@ -1,13 +0,0 @@
/* ******************************** */
/* Warning! Don't modify this file! */
/* ******************************** */
#ifndef __pikaScript__H
#define __pikaScript__H
#include <stdio.h>
#include <stdlib.h>
#include "PikaObj.h"
#include "PikaMain.h"
PikaObj * pikaScriptInit(void);
#endif

View File

@ -1,53 +0,0 @@
#include "PikaVM.h"
#include "dataStrs.h"
extern PikaObj* __pikaMain;
static enum shell_state __obj_shellLineHandler_debug(PikaObj* self,
char* input_line) {
/* continue */
if (strEqu("c", input_line)) {
return SHELL_STATE_EXIT;
}
/* next */
if (strEqu("n", input_line)) {
return SHELL_STATE_EXIT;
}
/* launch shell */
if (strEqu("sh", input_line)) {
/* exit pika shell */
pikaScriptShell(__pikaMain);
return SHELL_STATE_CONTINUE;
}
/* quit */
if (strEqu("q", input_line)) {
obj_setInt(self, "enable", 0);
return SHELL_STATE_EXIT;
}
/* print */
if (strIsStartWith(input_line, "p ")) {
char* path = input_line + 2;
Arg* asm_buff = arg_setStr(NULL, "", "B0\n1 REF ");
asm_buff = arg_strAppend(asm_buff, path);
asm_buff = arg_strAppend(asm_buff, "\n0 RUN print\n");
pikaVM_runAsm(__pikaMain, arg_getStr(asm_buff));
arg_deinit(asm_buff);
return SHELL_STATE_CONTINUE;
}
obj_run(__pikaMain, input_line);
return SHELL_STATE_CONTINUE;
}
void PikaDebug_Debuger___init__(PikaObj* self) {
/* global enable contral */
obj_setInt(self, "enable", 1);
}
void PikaDebug_Debuger_set_trace(PikaObj* self) {
if (!obj_getInt(self, "enable")) {
return;
}
struct shell_config cfg = {
.prefix = "(pika-debug) ",
};
obj_shellLineProcess(self, __obj_shellLineHandler_debug, &cfg);
}

View File

@ -1,153 +0,0 @@
#include "PikaStdData_Dict.h"
#include "BaseObj.h"
#include "PikaObj.h"
#include "PikaStdData_dict_keys.h"
#include "PikaStdLib_SysObj.h"
#include "dataStrs.h"
Arg* PikaStdData_Dict_get(PikaObj* self, char* key) {
PikaDict* dict = obj_getPtr(self, "dict");
return arg_copy(dict_getArg(dict, key));
}
void PikaStdData_Dict___init__(PikaObj* self) {
PikaDict* dict = New_dict();
PikaDict* keys = New_dict();
obj_setPtr(self, "dict", dict);
obj_setPtr(self, "_keys", keys);
}
void PikaStdData_Dict_set(PikaObj* self, Arg* arg, char* key) {
PikaDict* dict = obj_getPtr(self, "dict");
PikaDict* keys = obj_getPtr(self, "_keys");
Arg* arg_key = arg_setStr(NULL, key, key);
Arg* arg_new = arg_copy(arg);
arg_setName(arg_new, key);
dict_setArg(dict, arg_new);
dict_setArg(keys, arg_key);
}
void PikaStdData_Dict_remove(PikaObj* self, char* key) {
PikaDict* dict = obj_getPtr(self, "dict");
PikaDict* keys = obj_getPtr(self, "_keys");
dict_removeArg(dict, dict_getArg(dict, key));
dict_removeArg(keys, dict_getArg(keys, key));
}
Arg* PikaStdData_Dict___iter__(PikaObj* self) {
obj_setInt(self, "__iter_i", 0);
return arg_setRef(NULL, "", self);
}
Arg* PikaStdData_Dict___next__(PikaObj* self) {
int __iter_i = args_getInt(self->list, "__iter_i");
PikaDict* dict = obj_getPtr(self, "dict");
Arg* res = arg_copy(args_getArgByidex(&dict->super, __iter_i));
if (NULL == res) {
return arg_setNull(NULL);
}
args_setInt(self->list, "__iter_i", __iter_i + 1);
return res;
}
void PikaStdData_Dict___set__(PikaObj* self, Arg* __key, Arg* __val) {
PikaStdData_Dict_set(self, obj_getArg(self, "__val"),
obj_getStr(self, "__key"));
}
Arg* PikaStdData_Dict___get__(PikaObj* self, Arg* __key) {
return PikaStdData_Dict_get(self, obj_getStr(self, "__key"));
}
void PikaStdData_Dict___del__(PikaObj* self) {
PikaDict* dict = obj_getPtr(self, "dict");
PikaDict* keys = obj_getPtr(self, "_keys");
dict_deinit(dict);
dict_deinit(keys);
}
void PikaStdData_dict_keys___init__(PikaObj* self, PikaObj* dict) {
obj_setPtr(self, "dictptr", dict);
}
PikaObj* PikaStdData_Dict_keys(PikaObj* self) {
PikaObj* dict_keys = newNormalObj(New_PikaStdData_dict_keys);
PikaStdData_dict_keys___init__(dict_keys, self);
return dict_keys;
}
Arg* PikaStdData_dict_keys___iter__(PikaObj* self) {
obj_setInt(self, "__iter_i", 0);
return arg_setRef(NULL, "", self);
}
Arg* PikaStdData_dict_keys___next__(PikaObj* self) {
int __iter_i = args_getInt(self->list, "__iter_i");
PikaObj* dictptr = obj_getPtr(self, "dictptr");
PikaDict* keys = obj_getPtr(dictptr, "_keys");
Arg* res = arg_copy(args_getArgByidex(&keys->super, __iter_i));
if (NULL == res) {
return arg_setNull(NULL);
}
args_setInt(self->list, "__iter_i", __iter_i + 1);
return res;
}
char* PikaStdLib_SysObj_str(PikaObj* self, Arg* arg);
char* PikaStdData_dict_keys___str__(PikaObj* self) {
Arg* str_arg = arg_setStr(NULL, "", "dict_keys([");
PikaObj* dictptr = obj_getPtr(self, "dictptr");
PikaDict* keys = obj_getPtr(dictptr, "_keys");
int i = 0;
while (PIKA_TRUE) {
Arg* item = args_getArgByidex(&keys->super, i);
if (NULL == 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++;
}
str_arg = arg_strAppend(str_arg, "])");
obj_setStr(self, "_buf", arg_getStr(str_arg));
arg_deinit(str_arg);
return obj_getStr(self, "_buf");
}
char* PikaStdData_Dict___str__(PikaObj *self){
Arg* str_arg = arg_setStr(NULL, "", "{");
PikaDict* keys = obj_getPtr(self, "_keys");
PikaDict* dict = obj_getPtr(self, "dict");
int i = 0;
while (PIKA_TRUE) {
Arg* item_key = args_getArgByidex(&keys->super, i);
Arg* item_val = args_getArgByidex(&dict->super, i);
if (NULL == item_key) {
break;
}
if (i != 0) {
str_arg = arg_strAppend(str_arg, ", ");
}
char* key_str = PikaStdLib_SysObj_str(self, item_key);
str_arg = arg_strAppend(str_arg, "'");
str_arg = arg_strAppend(str_arg, key_str);
str_arg = arg_strAppend(str_arg, "'");
str_arg = arg_strAppend(str_arg, ": ");
char* val_str = PikaStdLib_SysObj_str(self, item_val);
str_arg = arg_strAppend(str_arg, val_str);
i++;
}
str_arg = arg_strAppend(str_arg, "}");
obj_setStr(self, "_buf", arg_getStr(str_arg));
arg_deinit(str_arg);
return obj_getStr(self, "_buf");
}

View File

@ -1,108 +0,0 @@
#include "BaseObj.h"
#include "PikaObj.h"
#include "dataStrs.h"
void PikaStdData_List_append(PikaObj* self, Arg* arg) {
PikaList* list = obj_getPtr(self, "list");
list_append(list, arg);
}
int PikaStdData_List_len(PikaObj* self) {
PikaList* list = obj_getPtr(self, "list");
return list_getSize(list);
}
Arg* PikaStdData_List_get(PikaObj* self, int i) {
PikaList* list = obj_getPtr(self, "list");
return arg_copy(list_getArg(list, i));
}
void PikaStdData_List___init__(PikaObj* self) {
if (!obj_isArgExist(self, "list")) {
PikaList* list = New_list();
obj_setPtr(self, "list", list);
}
}
void PikaStdData_List_set(PikaObj* self, Arg* arg, int i) {
PikaList* list = obj_getPtr(self, "list");
if (PIKA_RES_OK != list_setArg(list, i, arg)) {
obj_setErrorCode(self, 1);
obj_setSysOut(self, "[error]: index exceeded lengh of list.");
}
}
Arg* PikaStdData_List___iter__(PikaObj* self) {
obj_setInt(self, "__iter_i", 0);
return arg_setRef(NULL, "", self);
}
Arg* PikaStdData_List___next__(PikaObj* self) {
int __iter_i = args_getInt(self->list, "__iter_i");
Arg* res = PikaStdData_List_get(self, __iter_i);
if (NULL == res) {
return arg_setNull(NULL);
}
args_setInt(self->list, "__iter_i", __iter_i + 1);
return res;
}
Arg* PikaStdData_List___get__(PikaObj* self) {
return PikaStdData_List_get(self, obj_getInt(self, "__key"));
}
void PikaStdData_List___set__(PikaObj* self) {
PikaStdData_List_set(self, obj_getArg(self, "__val"),
obj_getInt(self, "__key"));
}
void PikaStdData_ByteArray_fromString(PikaObj* self, char* s) {
for (uint32_t i = 0; i < strGetSize(s); i++) {
obj_setInt(self, "__val", (int)s[i]);
PIKA_PYTHON_BEGIN
/* clang-format off */
PIKA_PYTHON(
append(__val)
)
/* clang-format on */
const uint8_t bytes[] = {
0x08, 0x00, /* instruct array size */
0x10, 0x81, 0x01, 0x00, 0x00, 0x02, 0x07, 0x00, /* instruct array */
0x0e, 0x00, /* const pool size */
0x00, 0x5f, 0x5f, 0x76, 0x61, 0x6c, 0x00, 0x61,
0x70, 0x70, 0x65, 0x6e, 0x64, 0x00, /* const pool */
};
pikaVM_runByteCode(self, (uint8_t*)bytes);
PIKA_PYTHON_END
}
}
void PikaStdData_List___del__(PikaObj* self) {
Args* list = obj_getPtr(self, "list");
args_deinit(list);
}
char* PikaStdLib_SysObj_str(PikaObj* self, Arg* arg);
char* PikaStdData_List___str__(PikaObj* self) {
Arg* str_arg = arg_setStr(NULL, "", "[");
PikaList* list = obj_getPtr(self, "list");
int i = 0;
while (PIKA_TRUE) {
Arg* item = list_getArg(list, i);
if (NULL == 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++;
}
str_arg = arg_strAppend(str_arg, "]");
obj_setStr(self, "_buf", arg_getStr(str_arg));
arg_deinit(str_arg);
return obj_getStr(self, "_buf");
}

View File

@ -1,174 +0,0 @@
#include "PikaStdData_String.h"
#include "PikaStdData_List.h"
#include "PikaStdData_String_Util.h"
#include "dataStrs.h"
Arg* PikaStdData_String___iter__(PikaObj* self) {
obj_setInt(self, "__iter_i", 0);
return arg_setRef(NULL, "", self);
}
void PikaStdData_String_set(PikaObj* self, char* s) {
obj_setStr(self, "str", s);
}
void PikaStdData_String___init__(PikaObj* self, char* s) {
PikaStdData_String_set(self, s);
}
char* PikaStdData_String_get(PikaObj* self) {
return obj_getStr(self, "str");
}
Arg* PikaStdData_String___next__(PikaObj* self) {
int __iter_i = args_getInt(self->list, "__iter_i");
char* str = obj_getStr(self, "str");
uint16_t len = strGetSize(str);
Arg* res = NULL;
char char_buff[] = " ";
if (__iter_i < len) {
char_buff[0] = str[__iter_i];
res = arg_setStr(NULL, "", (char*)char_buff);
} else {
return arg_setNull(NULL);
}
args_setInt(self->list, "__iter_i", __iter_i + 1);
return res;
}
Arg* PikaStdData_String___get__(PikaObj* self, Arg* __key) {
int key_i = arg_getInt(__key);
char* str = obj_getStr(self, "str");
uint16_t len = strGetSize(str);
char char_buff[] = " ";
if (key_i < len) {
char_buff[0] = str[key_i];
return arg_setStr(NULL, "", (char*)char_buff);
} else {
return arg_setNull(NULL);
}
}
void PikaStdData_String___set__(PikaObj* self, Arg* __key, Arg* __val) {
int key_i = arg_getInt(__key);
char* str = obj_getStr(self, "str");
char* val = arg_getStr(__val);
uint16_t len = strGetSize(str);
if (key_i >= len) {
obj_setErrorCode(self, 1);
__platform_printf("Error String Overflow\r\n");
return;
}
str[key_i] = val[0];
}
char* PikaStdData_String___str__(PikaObj* self) {
return obj_getStr(self, "str");
}
int PikaStdData_String_startwith(PikaObj* self, char* prefix) {
char* str = obj_getStr(self, "str");
char* p = prefix;
int i = 0;
while (*p != '\0') {
if (*p != str[i])
return 0;
p++;
i++;
}
return 1;
}
int PikaStdData_String_endwith(PikaObj* self, char* suffix) {
char* str = obj_getStr(self, "str");
int len1 = strlen(str);
int len2 = strlen(suffix);
while (len2 >= 1) {
if (suffix[len2 - 1] != str[len1 - 1])
return 0;
len2--;
len1--;
}
return 1;
}
int PikaStdData_String_isdigit(PikaObj* self) {
char* str = obj_getStr(self, "str");
int i = 0;
while (str[i] != '\0') {
if (!isdigit((int)str[i]))
return 0;
i++;
}
return 1;
}
int PikaStdData_String_islower(PikaObj* self) {
char* str = obj_getStr(self, "str");
int i = 0;
while (str[i] != '\0') {
if (!islower((int)str[i]))
return 0;
i++;
}
return 1;
}
int PikaStdData_String_isalnum(PikaObj* self) {
char* str = obj_getStr(self, "str");
int i = 0;
while (str[i] != '\0') {
if (!isalnum((int)str[i]))
return 0;
i++;
}
return 1;
}
int PikaStdData_String_isalpha(PikaObj* self) {
char* str = obj_getStr(self, "str");
int i = 0;
while (str[i] != '\0') {
if (!isalpha((int)str[i]))
return 0;
i++;
}
return 1;
}
int PikaStdData_String_isspace(PikaObj* self) {
char* str = obj_getStr(self, "str");
int i = 0;
while (str[i] != '\0') {
if (!isspace((int)str[i]))
return 0;
i++;
}
return 1;
}
PikaObj* PikaStdData_String_split(PikaObj* self, char* s) {
/* 创建 list 对象 */
PikaObj* list = newNormalObj(New_PikaStdData_List);
/* 初始化 list */
PikaStdData_List___init__(list);
Args buffs = {0};
char* str = obj_getStr(self, "str");
char sign = s[0];
int token_num = strCountSign(str, sign) + 1;
for (int i = 0; i < token_num; i++) {
char* token = strsPopToken(&buffs, str, sign);
/* 用 arg_set<type> 的 api 创建 arg */
Arg* token_arg = arg_setStr(NULL, "", token);
/* 添加到 list 对象 */
PikaStdData_List_append(list, token_arg);
/* 销毁 arg */
arg_deinit(token_arg);
}
strsDeinit(&buffs);
return list;
}

View File

@ -1,13 +0,0 @@
#include "PikaStdData_Utils.h"
Arg* PikaStdData_Utils_int_to_bytes(PikaObj* self, int val) {
if (val > 0xFF) {
obj_setErrorCode(self, 1);
__platform_printf(
"OverflowError: cannot convert value larger than 0xFF to "
"bytes\r\n");
return arg_setNull(NULL);
}
uint8_t val_bytes = (uint8_t)val;
return arg_setBytes(NULL, "", &val_bytes, 1);
}

View File

@ -1,23 +0,0 @@
#include "PikaStdLib_MemChecker.h"
#include "BaseObj.h"
#include "dataStrs.h"
void PikaStdLib_MemChecker_max(PikaObj* self) {
__platform_printf("%0.2f kB\r\n", pikaMemMax() / 1024.0);
}
void PikaStdLib_MemChecker_now(PikaObj* self) {
__platform_printf("%0.2f kB\r\n", pikaMemNow() / 1024.0);
}
void PikaStdLib_MemChecker_resetMax(PikaObj* self) {
pikaMemMaxReset();
}
double PikaStdLib_MemChecker_getMax(PikaObj* self) {
return pikaMemMax() / 1024.0;
}
double PikaStdLib_MemChecker_getNow(PikaObj* self) {
return pikaMemNow() / 1024.0;
}

View File

@ -1,24 +0,0 @@
#include "PikaObj.h"
Arg* PikaStdLib_RangeObj___next__(PikaObj* self) {
int a1 = args_getInt(self->list, "a1");
int a2 = args_getInt(self->list, "a2");
int start = 0;
int end = 0;
int foot = 1;
/* only start and end */
start = a1;
end = a2;
/* start */
int iter_i = args_getInt(self->list, "iter_i");
/* iter_i is not inited */
if (-999999999 == iter_i) {
iter_i = start;
}
/* exit */
if (iter_i >= end) {
return arg_setNull(NULL);
}
args_setInt(self->list, "iter_i", iter_i + foot);
return arg_setInt(NULL, "", iter_i);
}

View File

@ -1,5 +0,0 @@
#include "PikaObj.h"
Arg* PikaStdLib_StringObj___next__(PikaObj* self) {
return arg_setNull(NULL);
}

View File

@ -1,518 +0,0 @@
#include "PikaStdLib_SysObj.h"
#include "PikaStdLib_RangeObj.h"
#include "PikaStdLib_StringObj.h"
#include "PikaVM.h"
#include "dataStrs.h"
void PikaStdLib_SysObj_remove(PikaObj* self, char* argPath) {
obj_setErrorCode(self, 0);
int32_t res = obj_removeArg(self, argPath);
if (1 == res) {
obj_setSysOut(self, "[error] del: object no found.");
obj_setErrorCode(self, 1);
return;
}
if (2 == res) {
obj_setSysOut(self, "[error] del: arg not match.");
obj_setErrorCode(self, 2);
return;
}
}
void PikaStdLib_SysObj_type(PikaObj* self, Arg* arg) {
if (NULL == arg) {
obj_setSysOut(self, "[error] type: arg no found.");
obj_setErrorCode(self, 1);
return;
}
ArgType type = arg_getType(arg);
if (ARG_TYPE_INT == type) {
obj_setSysOut(self, "<class 'int'>");
return;
}
if (ARG_TYPE_FLOAT == type) {
obj_setSysOut(self, "<class 'float'>");
return;
}
if (ARG_TYPE_STRING == type) {
obj_setSysOut(self, "<class 'str'>");
return;
}
if (ARG_TYPE_OBJECT == type) {
obj_setSysOut(self, "<class 'object'>");
return;
}
if (ARG_TYPE_OBJECT_META == type) {
obj_setSysOut(self, "<class 'meta object'>");
return;
}
if (ARG_TYPE_BYTES == type) {
obj_setSysOut(self, "<class 'bytes'>");
return;
}
if (ARG_TYPE_METHOD_NATIVE == type) {
obj_setSysOut(self, "<class 'buitin_function_or_method'>");
return;
}
if (ARG_TYPE_METHOD_OBJECT == type) {
obj_setSysOut(self, "<class 'method'>");
return;
}
if (ARG_TYPE_METHOD_STATIC == type) {
obj_setSysOut(self, "<class 'function'>");
return;
}
}
double PikaStdLib_SysObj_float(PikaObj* self, Arg* arg) {
ArgType type = arg_getType(arg);
if (ARG_TYPE_INT == type) {
return (float)arg_getInt(arg);
}
if (ARG_TYPE_FLOAT == type) {
return (float)arg_getFloat(arg);
}
obj_setSysOut(self, "[error] convert to double type faild.");
obj_setErrorCode(self, 1);
return -99999.99999;
}
int PikaStdLib_SysObj_int(PikaObj* self, Arg* arg) {
ArgType type = arg_getType(arg);
if (ARG_TYPE_INT == type) {
return (int)arg_getInt(arg);
}
if (ARG_TYPE_FLOAT == type) {
return (int)arg_getFloat(arg);
}
if (ARG_TYPE_STRING == type) {
return (int)fast_atoi(arg_getStr(arg));
}
if (ARG_TYPE_BYTES == type) {
size_t size = arg_getBytesSize(arg);
if (size != 1) {
obj_setSysOut(self, "ValueError: invalid literal for int()");
obj_setErrorCode(self, 1);
return -999999999;
}
uint8_t val = *arg_getBytes(arg);
return val;
}
obj_setSysOut(self, "[error] convert to int type faild.");
obj_setErrorCode(self, 1);
return -999999999;
}
char* PikaStdLib_SysObj_str(PikaObj* self, Arg* arg) {
ArgType type = arg_getType(arg);
Args buffs = {0};
char* res = NULL;
if (ARG_TYPE_INT == type) {
int val = arg_getInt(arg);
res = strsFormat(&buffs, 11, "%d", val);
goto exit;
}
if (ARG_TYPE_FLOAT == type) {
double val = arg_getFloat(arg);
res = strsFormat(&buffs, 11, "%f", val);
goto exit;
}
if (ARG_TYPE_BYTES == type) {
res = (char*)arg_getBytes(arg);
goto exit;
}
if (ARG_TYPE_STRING == type) {
res = arg_getStr(arg);
}
if (argType_isObject(type)) {
res = obj_toStr(arg_getPtr(arg));
if (NULL != res) {
goto exit;
}
}
exit:
obj_setStr(self, "__buf", res);
strsDeinit(&buffs);
return obj_getStr(self, "__buf");
}
Arg* PikaStdLib_SysObj_iter(PikaObj* self, Arg* arg) {
/* a String, return a StringObj */
if (ARG_TYPE_STRING == arg_getType(arg)) {
obj_setStr(self, "_sobj", arg_getStr(arg));
return arg_newMetaObj(New_PikaStdLib_StringObj);
}
/* a MATE object, return itself */
if (ARG_TYPE_OBJECT_META == arg_getType(arg)) {
return arg_copy(arg);
}
/* object */
if (argType_isObject(arg_getType(arg))) {
PikaObj* arg_obj = arg_getPtr(arg);
NewFun _clsptr = obj_getPtr(arg_obj, "_clsptr");
if (_clsptr == New_PikaStdLib_RangeObj) {
/* found RangeObj, return directly */
return arg_copy(arg);
}
// pikaVM_runAsm(arg_obj,
// "B0\n"
// "0 RUN __iter__\n"
// "0 OUT __res\n");
const uint8_t bytes[] = {
0x08, 0x00, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0a, 0x00, /* instruct array */
0x10, 0x00, /* const pool size */
0x00, 0x5f, 0x5f, 0x69, 0x74, 0x65, 0x72, 0x5f,
0x5f, 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, /* const pool */
};
pikaVM_runByteCode(arg_obj, (uint8_t*)bytes);
Arg* res = arg_copy(args_getArg(arg_obj->list, "__res"));
obj_removeArg(arg_obj, "__res");
return res;
}
return arg_setNull(NULL);
}
Arg* PikaStdLib_SysObj_range(PikaObj* self, int a1, int a2) {
/* set template arg to create rangeObj */
Arg* obj_arg = arg_newDirectObj(New_PikaStdLib_RangeObj);
obj_setInt(arg_getPtr(obj_arg), "a1", a1);
obj_setInt(arg_getPtr(obj_arg), "a2", a2);
return obj_arg;
}
Arg* PikaStdLib_SysObj___get__(PikaObj* self, Arg* key, Arg* obj) {
ArgType obj_type = arg_getType(obj);
int index = 0;
if (ARG_TYPE_INT == arg_getType(key)) {
index = arg_getInt(key);
}
if (ARG_TYPE_STRING == obj_type) {
char* str_pyload = arg_getStr(obj);
char char_buff[] = " ";
if (index < 0) {
index = strGetSize(str_pyload) + index;
}
char_buff[0] = str_pyload[index];
return arg_setStr(NULL, "", char_buff);
}
if (ARG_TYPE_BYTES == obj_type) {
uint8_t* bytes_pyload = arg_getBytes(obj);
uint8_t byte_buff[] = " ";
if (index < 0) {
index = arg_getBytesSize(obj) + index;
}
byte_buff[0] = bytes_pyload[index];
return arg_setBytes(NULL, "", byte_buff, 1);
}
if (argType_isObject(obj_type)) {
PikaObj* arg_obj = arg_getPtr(obj);
obj_setArg(arg_obj, "__key", key);
// pikaVM_runAsm(arg_obj,
// "B0\n"
// "1 REF __key\n"
// "0 RUN __get__\n"
// "0 OUT __res\n");
const uint8_t bytes[] = {
0x0c, 0x00, /* instruct array size */
0x10, 0x81, 0x01, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x04, 0x0f,
0x00,
/* instruct array */
0x15, 0x00, /* const pool size */
0x00, 0x5f, 0x5f, 0x6b, 0x65, 0x79, 0x00, 0x5f, 0x5f, 0x67, 0x65,
0x74, 0x5f, 0x5f, 0x00, 0x5f, 0x5f, 0x72, 0x65, 0x73,
0x00, /* const pool */
};
pikaVM_runByteCode(arg_obj, (uint8_t*)bytes);
return arg_copy(args_getArg(arg_obj->list, "__res"));
}
return arg_setNull(NULL);
}
Arg* PikaStdLib_SysObj___set__(PikaObj* self, Arg* key, Arg* obj, Arg* val) {
ArgType obj_type = arg_getType(obj);
if (ARG_TYPE_STRING == obj_type) {
int index = arg_getInt(key);
char* str_val = arg_getStr(val);
char* str_pyload = arg_getStr(obj);
str_pyload[index] = str_val[0];
return arg_setStr(NULL, "", str_pyload);
}
if (ARG_TYPE_BYTES == obj_type) {
int index = arg_getInt(key);
uint8_t byte_val = 0;
if (ARG_TYPE_BYTES == arg_getType(val)) {
uint8_t* bytes_val = arg_getBytes(val);
byte_val = bytes_val[0];
}
if (ARG_TYPE_INT == arg_getType(val)) {
byte_val = arg_getInt(val);
}
uint8_t* bytes_pyload = arg_getBytes(obj);
size_t bytes_len = arg_getBytesSize(obj);
bytes_pyload[index] = byte_val;
return arg_setBytes(NULL, "", bytes_pyload, bytes_len);
}
if (argType_isObject(obj_type)) {
PikaObj* arg_obj = arg_getPtr(obj);
obj_setArg(arg_obj, "__key", key);
obj_setArg(arg_obj, "__val", val);
// pikaVM_runAsm(arg_obj,
// "B0\n"
// "1 REF __key\n"
// "1 REF __val\n"
// "0 RUN __set__\n");
const uint8_t bytes[] = {
0x0c, 0x00, /* instruct array size */
0x10, 0x81, 0x01, 0x00, 0x10, 0x01, 0x07, 0x00, 0x00, 0x02, 0x0d,
0x00,
/* instruct array */
0x15, 0x00, /* const pool size */
0x00, 0x5f, 0x5f, 0x6b, 0x65, 0x79, 0x00, 0x5f, 0x5f, 0x76, 0x61,
0x6c, 0x00, 0x5f, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x5f,
0x00, /* const pool */
};
pikaVM_runByteCode(arg_obj, (uint8_t*)bytes);
return arg_setRef(NULL, "", arg_obj);
}
return NULL;
}
int PikaStdLib_SysObj_len(PikaObj* self, Arg* arg) {
if (ARG_TYPE_STRING == arg_getType(arg)) {
return strGetSize(arg_getStr(arg));
}
if (ARG_TYPE_BYTES == arg_getType(arg)) {
return arg_getBytesSize(arg);
}
obj_setErrorCode(self, 1);
__platform_printf("[Error] len: arg type not support\r\n");
return -1;
}
Arg* PikaStdLib_SysObj_list(PikaObj* self) {
#if PIKA_BUILTIN_LIST_ENABLE
PikaObj* New_PikaStdData_List(Args * args);
return arg_newDirectObj(New_PikaStdData_List);
#endif
obj_setErrorCode(self, 1);
__platform_printf("[Error] built-in list is not enabled.\r\n");
return arg_setNull(NULL);
}
Arg* PikaStdLib_SysObj_dict(PikaObj* self) {
#if PIKA_BUILTIN_DICT_ENABLE
PikaObj* New_PikaStdData_Dict(Args * args);
return arg_newDirectObj(New_PikaStdData_Dict);
#endif
obj_setErrorCode(self, 1);
__platform_printf("[Error] built-in dist is not enabled.\r\n");
return arg_setNull(NULL);
}
char* PikaStdLib_SysObj_hex(PikaObj* self, int val) {
char buff[PIKA_SPRINTF_BUFF_SIZE] = {0};
if (val > 0) {
__platform_sprintf(buff, "0x%02x", val);
} else {
__platform_sprintf(buff, "-0x%02x", -val);
}
/* load the string from stack to heap */
obj_setStr(self, "__buf", buff);
return obj_getStr(self, "__buf");
}
int PikaStdLib_SysObj_ord(PikaObj* self, char* val) {
return (int)val[0];
}
char* PikaStdLib_SysObj_chr(PikaObj* self, int val) {
char buff[PIKA_SPRINTF_BUFF_SIZE] = {0};
char to_str[] = "0";
to_str[0] = val;
__platform_sprintf(buff, "%s", to_str);
/* load the string from stack to heap */
obj_setStr(self, "__buf", buff);
return obj_getStr(self, "__buf");
}
Arg* PikaStdLib_SysObj_bytes(PikaObj* self, Arg* val) {
ArgType type = arg_getType(val);
if (ARG_TYPE_INT == type) {
int size = arg_getInt(val);
/* src is NULL so the bytes are all '\0' */
Arg* bytes = arg_setBytes(NULL, "", NULL, size);
return bytes;
}
if (ARG_TYPE_BYTES == type) {
return arg_copy(val);
}
if (ARG_TYPE_STRING == type) {
int size = strGetSize(arg_getStr(val));
Arg* bytes = arg_setBytes(NULL, "", (uint8_t*)arg_getStr(val), size);
return bytes;
}
obj_setErrorCode(self, 1);
__platform_printf("Error: input arg type not supported.\r\n");
return arg_setNull(NULL);
}
Arg* PikaStdLib_SysObj___slice__(PikaObj* self,
Arg* end,
Arg* obj,
Arg* start,
int step) {
#if PIKA_SYNTEX_ITEM_SLICE_ENABLE
/* No interger index only support __get__ */
if (!(arg_getType(start) == ARG_TYPE_INT &&
arg_getType(end) == ARG_TYPE_INT)) {
return PikaStdLib_SysObj___get__(self, start, obj);
}
int start_i = arg_getInt(start);
int end_i = arg_getInt(end);
/* __slice__ is equal to __get__ */
if (end_i - start_i == 1) {
return PikaStdLib_SysObj___get__(self, start, obj);
}
if (ARG_TYPE_STRING == arg_getType(obj)) {
size_t len = strGetSize(arg_getStr(obj));
if (start_i < 0) {
start_i += len;
}
if (end_i < 0) {
end_i += len + 1;
}
Arg* sliced_arg = arg_setStr(NULL, "", "");
for (int i = start_i; i < end_i; i++) {
Arg* i_arg = arg_setInt(NULL, "", i);
Arg* item_arg = PikaStdLib_SysObj___get__(self, i_arg, obj);
sliced_arg = arg_strAppend(sliced_arg, arg_getStr(item_arg));
arg_deinit(item_arg);
arg_deinit(i_arg);
}
return sliced_arg;
}
if (ARG_TYPE_BYTES == arg_getType(obj)) {
size_t len = arg_getBytesSize(obj);
if (start_i < 0) {
start_i += len;
}
if (end_i < 0) {
end_i += len + 1;
}
Arg* sliced_arg = arg_setBytes(NULL, "", NULL, 0);
for (int i = start_i; i < end_i; i++) {
Arg* i_arg = arg_setInt(NULL, "", i);
Arg* item_arg = PikaStdLib_SysObj___get__(self, i_arg, obj);
uint8_t* bytes_origin = arg_getBytes(sliced_arg);
size_t size_origin = arg_getBytesSize(sliced_arg);
Arg* sliced_arg_new = arg_setBytes(NULL, "", NULL, size_origin + 1);
__platform_memcpy(arg_getBytes(sliced_arg_new), bytes_origin,
size_origin);
__platform_memcpy(arg_getBytes(sliced_arg_new) + size_origin,
arg_getBytes(item_arg), 1);
arg_deinit(sliced_arg);
sliced_arg = sliced_arg_new;
arg_deinit(item_arg);
arg_deinit(i_arg);
}
return sliced_arg;
}
return arg_setNull(NULL);
#else
return PikaStdLib_SysObj___get__(self, start, obj);
#endif
}
static void __print_arg(PikaObj* self, Arg* val) {
obj_setErrorCode(self, 0);
ArgType arg_type = arg_getType(val);
if (NULL != val) {
if (arg_getType(val) == ARG_TYPE_BYTES) {
arg_printBytes(val);
return;
}
}
if (argType_isObject(arg_type)) {
char* to_str = obj_toStr(arg_getPtr(val));
if (NULL != to_str) {
__platform_printf("%s\r\n", to_str);
return;
}
}
Args* print_args = New_args(NULL);
arg_setName(val, "val");
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;
}
obj_setStr(self, "_buf", res);
args_deinit(print_args);
}
void PikaStdLib_SysObj_print(PikaObj* self, PikaTuple* val) {
int arg_size = tuple_getSize(val);
Arg* print_out_arg = arg_setStr(NULL, "", "");
PIKA_BOOL is_get_print = PIKA_FALSE;
for (int i = 0; i < arg_size; i++) {
Arg* arg = tuple_getArg(val, i);
__print_arg(self, arg);
char* item = obj_getStr(self, "_buf");
if (NULL != item) {
is_get_print = PIKA_TRUE;
print_out_arg = arg_strAppend(print_out_arg, item);
if (i < arg_size - 1) {
print_out_arg = arg_strAppend(print_out_arg, " ");
}
obj_removeArg(self, "_buf");
}
}
if (PIKA_TRUE == is_get_print) {
__platform_printf("%s\r\n", arg_getStr(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) {
Args buffs = {0};
pikaMemMaxReset();
char* res = strsFormatList(&buffs, fmt, &var->super);
obj_setStr(self, "_buf", res);
res = obj_getStr(self, "_buf");
strsDeinit(&buffs);
return res;
}
int PikaStdLib_SysObj_id(PikaObj* self, Arg* obj) {
uintptr_t ptr = 0;
if (argType_isObject(arg_getType(obj))) {
ptr = (uintptr_t)arg_getPtr(obj);
} else {
ptr = (uintptr_t)obj;
}
return ptr & (0x7FFFFFFF);
}

View File

@ -1,228 +0,0 @@
#include "BaseObj.h"
#include "PikaVM.h"
void PikaStdTask_Task___init__(PikaObj* self) {
obj_setInt(self, "is_period", 0);
}
void PikaStdTask_Task_call_always(PikaObj* self, Arg* fun_todo) {
obj_setArg(self, "fun_todo", fun_todo);
PIKA_PYTHON_BEGIN
/* clang-format off */
PIKA_PYTHON(
calls.append('always')
calls.append(fun_todo)
)
/* clang-format on */
const uint8_t bytes[] = {
0x10, 0x00, /* instruct array size */
0x10, 0x83, 0x01, 0x00, 0x00, 0x02, 0x08, 0x00, 0x10, 0x81, 0x15,
0x00, 0x00, 0x02, 0x08, 0x00, /* instruct array */
0x1e, 0x00, /* const pool size */
0x00, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x00, 0x63, 0x61, 0x6c,
0x6c, 0x73, 0x2e, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x00, 0x66,
0x75, 0x6e, 0x5f, 0x74, 0x6f, 0x64, 0x6f, 0x00, /* const pool */
};
PIKA_PYTHON_END
pikaVM_runByteCode(self, (uint8_t*)bytes);
}
void PikaStdTask_Task_call_when(PikaObj* self, Arg* fun_todo, Arg* fun_when) {
obj_setArg(self, "fun_todo", fun_todo);
obj_setArg(self, "fun_when", fun_when);
PIKA_PYTHON_BEGIN
/* clang-format off */
PIKA_PYTHON(
calls.append('when')
calls.append(fun_when)
calls.append(fun_todo)
)
/* clang-format on */
const uint8_t bytes[] = {
0x18, 0x00, /* instruct array size */
0x10, 0x83, 0x01, 0x00, 0x00, 0x02, 0x06, 0x00, 0x10, 0x81, 0x13, 0x00,
0x00, 0x02, 0x06, 0x00, 0x10, 0x81, 0x1c, 0x00, 0x00, 0x02, 0x06, 0x00,
/* instruct array */
0x25, 0x00, /* const pool size */
0x00, 0x77, 0x68, 0x65, 0x6e, 0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e,
0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x00, 0x66, 0x75, 0x6e, 0x5f, 0x77,
0x68, 0x65, 0x6e, 0x00, 0x66, 0x75, 0x6e, 0x5f, 0x74, 0x6f, 0x64, 0x6f,
0x00,
/* const pool */
};
PIKA_PYTHON_END
pikaVM_runByteCode(self, (uint8_t*)bytes);
}
void PikaStdTask_Task_call_period_ms(PikaObj* self,
Arg* fun_todo,
int period_ms) {
obj_setArg(self, "fun_todo", fun_todo);
obj_setInt(self, "period_ms", period_ms);
PIKA_PYTHON_BEGIN
/* clang-format off */
PIKA_PYTHON(
calls.append('period_ms')
calls.append(period_ms)
calls.append(fun_todo)
calls.append(0)
is_period = 1
)
/* clang-format on */
const uint8_t bytes[] =
{
0x28, 0x00, /* instruct array size */
0x10, 0x83, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x00, 0x10, 0x81, 0x01,
0x00, 0x00, 0x02, 0x0b, 0x00, 0x10, 0x81, 0x18, 0x00, 0x00, 0x02,
0x0b, 0x00, 0x10, 0x85, 0x21, 0x00, 0x00, 0x02, 0x0b, 0x00, 0x00,
0x85, 0x23, 0x00, 0x00, 0x04, 0x25, 0x00, /* instruct array */
0x2f, 0x00, /* const pool size */
0x00, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x6d, 0x73, 0x00,
0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e, 0x61, 0x70, 0x70, 0x65, 0x6e,
0x64, 0x00, 0x66, 0x75, 0x6e, 0x5f, 0x74, 0x6f, 0x64, 0x6f, 0x00,
0x30, 0x00, 0x31, 0x00, 0x69, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x69,
0x6f, 0x64, 0x00, /* const pool */
};
PIKA_PYTHON_END
pikaVM_runByteCode(self, (uint8_t*)bytes);
}
void PikaStdTask_Task_run_once(PikaObj* self) {
/* clang-format off */
PIKA_PYTHON(
len = calls.len()
mode = 'none'
info_index = 0
for i in range(0, len):
if len == 0:
break
if info_index == 0:
mode = calls[i]
info_index = 1
elif info_index == 1:
if mode == 'always':
todo = calls[i]
todo()
info_index = 0
elif mode == 'when':
when = calls[i]
info_index = 2
elif mode == 'period_ms':
period_ms = calls[i]
info_index = 2
elif info_index == 2:
if mode == 'when':
if when():
todo = calls[i]
todo()
info_index = 0
elif mode == 'period_ms':
todo = calls[i]
info_index = 3
elif info_index == 3:
if mode == 'period_ms':
if tick > calls[i]:
todo()
calls[i] = tick + period_ms
info_index = 0
)
/* clang-format on */
const uint8_t bytes[] = {
0x60, 0x02, /* instruct array size */
0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x0b, 0x00, 0x00, 0x83, 0x0f, 0x00,
0x00, 0x04, 0x14, 0x00, 0x00, 0x85, 0x19, 0x00, 0x00, 0x04, 0x1b, 0x00,
0x20, 0x85, 0x19, 0x00, 0x20, 0x01, 0x0b, 0x00, 0x10, 0x02, 0x26, 0x00,
0x00, 0x02, 0x2c, 0x00, 0x00, 0x04, 0x31, 0x00, 0x00, 0x82, 0x35, 0x00,
0x00, 0x04, 0x42, 0x00, 0x00, 0x0d, 0x42, 0x00, 0x00, 0x07, 0x44, 0x00,
0x11, 0x81, 0x0b, 0x00, 0x11, 0x05, 0x19, 0x00, 0x01, 0x08, 0x46, 0x00,
0x01, 0x07, 0x49, 0x00, 0x02, 0x8e, 0x00, 0x00, 0x11, 0x81, 0x1b, 0x00,
0x11, 0x05, 0x19, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x4b, 0x00, 0x12, 0x01, 0x42, 0x00, 0x22, 0x01, 0x42, 0x00,
0x22, 0x05, 0x49, 0x00, 0x12, 0x08, 0x51, 0x00, 0x12, 0x05, 0x49, 0x00,
0x02, 0x02, 0x53, 0x00, 0x02, 0x04, 0x14, 0x00, 0x02, 0x85, 0x49, 0x00,
0x02, 0x04, 0x1b, 0x00, 0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00,
0x11, 0x05, 0x49, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x14, 0x00, 0x12, 0x03, 0x5d, 0x00, 0x02, 0x08, 0x46, 0x00,
0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00, 0x13, 0x01, 0x42, 0x00,
0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00, 0x13, 0x08, 0x51, 0x00,
0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00, 0x03, 0x04, 0x64, 0x00,
0x03, 0x82, 0x64, 0x00, 0x03, 0x85, 0x19, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00, 0x12, 0x03, 0x69, 0x00,
0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00,
0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00,
0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00,
0x03, 0x04, 0x69, 0x00, 0x03, 0x85, 0x44, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00, 0x12, 0x03, 0x6e, 0x00,
0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x4b, 0x00,
0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00, 0x23, 0x05, 0x49, 0x00,
0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00, 0x03, 0x02, 0x53, 0x00,
0x03, 0x04, 0x6e, 0x00, 0x03, 0x85, 0x44, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00, 0x11, 0x05, 0x44, 0x00,
0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00, 0x12, 0x81, 0x14, 0x00,
0x12, 0x03, 0x69, 0x00, 0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00,
0x03, 0x82, 0x69, 0x00, 0x03, 0x07, 0x49, 0x00, 0x14, 0x81, 0x4b, 0x00,
0x14, 0x01, 0x42, 0x00, 0x24, 0x01, 0x42, 0x00, 0x24, 0x05, 0x49, 0x00,
0x14, 0x08, 0x51, 0x00, 0x14, 0x05, 0x49, 0x00, 0x04, 0x02, 0x53, 0x00,
0x04, 0x04, 0x64, 0x00, 0x04, 0x82, 0x64, 0x00, 0x03, 0x85, 0x19, 0x00,
0x03, 0x04, 0x1b, 0x00, 0x02, 0x8b, 0x49, 0x00, 0x12, 0x01, 0x14, 0x00,
0x12, 0x03, 0x6e, 0x00, 0x02, 0x08, 0x46, 0x00, 0x02, 0x07, 0x49, 0x00,
0x13, 0x81, 0x4b, 0x00, 0x13, 0x01, 0x42, 0x00, 0x23, 0x01, 0x42, 0x00,
0x23, 0x05, 0x49, 0x00, 0x13, 0x08, 0x51, 0x00, 0x13, 0x05, 0x49, 0x00,
0x03, 0x02, 0x53, 0x00, 0x03, 0x04, 0x64, 0x00, 0x03, 0x85, 0x78, 0x00,
0x03, 0x04, 0x1b, 0x00, 0x01, 0x8b, 0x49, 0x00, 0x11, 0x01, 0x1b, 0x00,
0x11, 0x05, 0x78, 0x00, 0x01, 0x08, 0x46, 0x00, 0x01, 0x07, 0x49, 0x00,
0x12, 0x81, 0x14, 0x00, 0x12, 0x03, 0x6e, 0x00, 0x02, 0x08, 0x46, 0x00,
0x02, 0x07, 0x49, 0x00, 0x13, 0x81, 0x7a, 0x00, 0x23, 0x01, 0x4b, 0x00,
0x23, 0x01, 0x42, 0x00, 0x33, 0x01, 0x42, 0x00, 0x33, 0x05, 0x49, 0x00,
0x23, 0x08, 0x51, 0x00, 0x23, 0x05, 0x49, 0x00, 0x13, 0x02, 0x53, 0x00,
0x03, 0x08, 0x7f, 0x00, 0x03, 0x07, 0x49, 0x00, 0x04, 0x82, 0x64, 0x00,
0x14, 0x81, 0x4b, 0x00, 0x14, 0x01, 0x42, 0x00, 0x24, 0x01, 0x7a, 0x00,
0x24, 0x01, 0x6e, 0x00, 0x14, 0x08, 0x51, 0x00, 0x04, 0x02, 0x81, 0x00,
0x04, 0x04, 0x4b, 0x00, 0x03, 0x85, 0x19, 0x00, 0x03, 0x04, 0x1b, 0x00,
0x00, 0x86, 0x89, 0x00, 0x00, 0x8c, 0x31, 0x00, /* instruct array */
0x8c, 0x00, /* const pool size */
0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2e, 0x6c, 0x65, 0x6e, 0x00, 0x6c,
0x65, 0x6e, 0x00, 0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x6d, 0x6f, 0x64, 0x65,
0x00, 0x30, 0x00, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x69, 0x6e, 0x64, 0x65,
0x78, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x69, 0x74, 0x65, 0x72,
0x00, 0x5f, 0x6c, 0x30, 0x00, 0x5f, 0x6c, 0x30, 0x2e, 0x5f, 0x5f, 0x6e,
0x65, 0x78, 0x74, 0x5f, 0x5f, 0x00, 0x69, 0x00, 0x32, 0x00, 0x3d, 0x3d,
0x00, 0x31, 0x00, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x00, 0x2b, 0x00, 0x5f,
0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x5f, 0x00, 0x61, 0x6c, 0x77,
0x61, 0x79, 0x73, 0x00, 0x74, 0x6f, 0x64, 0x6f, 0x00, 0x77, 0x68, 0x65,
0x6e, 0x00, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x5f, 0x6d, 0x73, 0x00,
0x33, 0x00, 0x74, 0x69, 0x63, 0x6b, 0x00, 0x3e, 0x00, 0x5f, 0x5f, 0x73,
0x65, 0x74, 0x5f, 0x5f, 0x00, 0x2d, 0x31, 0x00, /* const pool */
};
pikaVM_runByteCode(self, (uint8_t*)bytes);
}
void __Task_update_tick(PikaObj* self) {
if (obj_getInt(self, "is_perod")) {
obj_runNativeMethod(self, "platformGetTick", NULL);
}
}
void PikaStdTask_Task_run_forever(PikaObj* self) {
while (1) {
__Task_update_tick(self);
PikaStdTask_Task_run_once(self);
}
}
void PikaStdTask_Task_run_until_ms(PikaObj* self, int until_ms) {
while (1) {
__Task_update_tick(self);
PikaStdTask_Task_run_once(self);
if (obj_getInt(self, "tick") > until_ms) {
return;
}
}
}
void PikaStdTask_Task_platformGetTick(PikaObj* self) {
obj_setErrorCode(self, 1);
obj_setSysOut(self, "[error] platform method need to be override.");
}

View File

@ -1,2 +0,0 @@
pikascript-core==latest
PikaStdLib==latest