Browse Source

clear bsp

lyon 4 years ago
parent
commit
f90e485f33
63 changed files with 1 additions and 6958 deletions
  1. 0 14
      bsp/TC264D/PikaScript/PikaObj.py
  2. 0 60
      bsp/TC264D/PikaScript/PikaStdLib.py
  3. 0 19
      bsp/TC264D/PikaScript/pikascript-api/PikaMain-api.c
  4. 0 13
      bsp/TC264D/PikaScript/pikascript-api/PikaMain.h
  5. 0 38
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib-api.c
  6. 0 17
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib.h
  7. 0 44
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_MemChecker-api.c
  8. 0 18
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_MemChecker.h
  9. 0 23
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_RangeObj-api.c
  10. 0 14
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_RangeObj.h
  11. 0 23
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_StringObj-api.c
  12. 0 14
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_StringObj.h
  13. 0 89
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_SysObj-api.c
  14. 0 23
      bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_SysObj.h
  15. 0 0
      bsp/TC264D/PikaScript/pikascript-api/compiler-info.txt
  16. 0 15
      bsp/TC264D/PikaScript/pikascript-api/pikaScript.c
  17. 0 13
      bsp/TC264D/PikaScript/pikascript-api/pikaScript.h
  18. 0 97
      bsp/TC264D/PikaScript/pikascript-core/BaseObj.c
  19. 0 44
      bsp/TC264D/PikaScript/pikascript-core/BaseObj.h
  20. 0 708
      bsp/TC264D/PikaScript/pikascript-core/PikaObj.c
  21. 0 165
      bsp/TC264D/PikaScript/pikascript-core/PikaObj.h
  22. 0 14
      bsp/TC264D/PikaScript/pikascript-core/PikaObj.py
  23. 0 1290
      bsp/TC264D/PikaScript/pikascript-core/PikaParser.c
  24. 0 47
      bsp/TC264D/PikaScript/pikascript-core/PikaParser.h
  25. 0 117
      bsp/TC264D/PikaScript/pikascript-core/PikaPlatform.c
  26. 0 105
      bsp/TC264D/PikaScript/pikascript-core/PikaPlatform.h
  27. 0 787
      bsp/TC264D/PikaScript/pikascript-core/PikaVM.c
  28. 0 49
      bsp/TC264D/PikaScript/pikascript-core/PikaVM.h
  29. 0 1
      bsp/TC264D/PikaScript/pikascript-core/README.md
  30. 0 41
      bsp/TC264D/PikaScript/pikascript-core/TinyObj.c
  31. 0 32
      bsp/TC264D/PikaScript/pikascript-core/TinyObj.h
  32. 0 47
      bsp/TC264D/PikaScript/pikascript-core/__instruction_def.h
  33. 0 45
      bsp/TC264D/PikaScript/pikascript-core/__instruction_table.cfg
  34. 0 34
      bsp/TC264D/PikaScript/pikascript-core/__pika_ooc.h
  35. 0 379
      bsp/TC264D/PikaScript/pikascript-core/dataArg.c
  36. 0 101
      bsp/TC264D/PikaScript/pikascript-core/dataArg.h
  37. 0 421
      bsp/TC264D/PikaScript/pikascript-core/dataArgs.c
  38. 0 103
      bsp/TC264D/PikaScript/pikascript-core/dataArgs.h
  39. 0 110
      bsp/TC264D/PikaScript/pikascript-core/dataLink.c
  40. 0 45
      bsp/TC264D/PikaScript/pikascript-core/dataLink.h
  41. 0 42
      bsp/TC264D/PikaScript/pikascript-core/dataLinkNode.c
  42. 0 37
      bsp/TC264D/PikaScript/pikascript-core/dataLinkNode.h
  43. 0 282
      bsp/TC264D/PikaScript/pikascript-core/dataMemory.c
  44. 0 68
      bsp/TC264D/PikaScript/pikascript-core/dataMemory.h
  45. 0 87
      bsp/TC264D/PikaScript/pikascript-core/dataQueue.c
  46. 0 46
      bsp/TC264D/PikaScript/pikascript-core/dataQueue.h
  47. 0 125
      bsp/TC264D/PikaScript/pikascript-core/dataQueueObj.c
  48. 0 48
      bsp/TC264D/PikaScript/pikascript-core/dataQueueObj.h
  49. 0 61
      bsp/TC264D/PikaScript/pikascript-core/dataStack.c
  50. 0 38
      bsp/TC264D/PikaScript/pikascript-core/dataStack.h
  51. 0 294
      bsp/TC264D/PikaScript/pikascript-core/dataString.c
  52. 0 60
      bsp/TC264D/PikaScript/pikascript-core/dataString.h
  53. 0 171
      bsp/TC264D/PikaScript/pikascript-core/dataStrs.c
  54. 0 44
      bsp/TC264D/PikaScript/pikascript-core/dataStrs.h
  55. 0 44
      bsp/TC264D/PikaScript/pikascript-core/pikaConfigValid.h
  56. 0 60
      bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib.py
  57. 0 23
      bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib_MemChecker.c
  58. 0 27
      bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib_RangeObj.c
  59. 0 5
      bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib_StringObj.c
  60. 0 176
      bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib_SysObj.c
  61. BIN
      bsp/TC264D/PikaScript/rust-msc-latest-win10.exe
  62. 1 1
      bsp/simulation-rtt-qemu-arm2d/pikascript/requestment.txt
  63. 0 0
      port/linux/api-make-linux.sh

+ 0 - 14
bsp/TC264D/PikaScript/PikaObj.py

@@ -1,14 +0,0 @@
-class TinyObj:
-    pass
-
-
-class BaseObj(TinyObj):
-    pass
-
-
-def print(val: any):
-    pass
-
-
-def set(argPath: str, val: any):
-    pass

+ 0 - 60
bsp/TC264D/PikaScript/PikaStdLib.py

@@ -1,60 +0,0 @@
-from PikaObj import *
-
-
-class MemChecker(TinyObj):
-    def max():
-        pass
-
-    def now():
-        pass
-
-    def getMax() -> float:
-        pass
-
-    def getNow() -> float:
-        pass
-
-    def resetMax():
-        pass
-
-
-class SysObj(BaseObj):
-    def type(arg: any):
-        pass
-
-    def remove(argPath: str):
-        pass
-
-    def int(arg: any) -> int:
-        pass
-
-    def float(arg: any) -> float:
-        pass
-
-    def str(arg: any) -> str:
-        pass
-
-    def iter(arg: any) -> any:
-        pass
-
-    def next(arg: any) -> any:
-        pass
-
-    def range(a1: int, a2: int, a3: int) -> any:
-        pass
-
-    def __set__(obj: any, key: any, val: any):
-        pass
-
-    def __get__(obj: any, key: any) -> any:
-        pass
-
-
-class RangeObj(TinyObj):
-    def __next__() -> any:
-        pass
-
-
-class StringObj(TinyObj):
-    def __next__() -> any:
-        pass

+ 0 - 19
bsp/TC264D/PikaScript/pikascript-api/PikaMain-api.c

@@ -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 arg_setMetaObj("", "PikaMain", New_PikaMain);
-}

+ 0 - 13
bsp/TC264D/PikaScript/pikascript-api/PikaMain.h

@@ -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

+ 0 - 38
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib-api.c

@@ -1,38 +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_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_defineMethod(self, "MemChecker()->any", PikaStdLib_MemCheckerMethod);
-    class_defineMethod(self, "RangeObj()->any", PikaStdLib_RangeObjMethod);
-    class_defineMethod(self, "StringObj()->any", PikaStdLib_StringObjMethod);
-    class_defineMethod(self, "SysObj()->any", PikaStdLib_SysObjMethod);
-    return self;
-}
-

+ 0 - 17
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib.h

@@ -1,17 +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_RangeObj(PikaObj *self);
-Arg * PikaStdLib_StringObj(PikaObj *self);
-Arg * PikaStdLib_SysObj(PikaObj *self);
-
-#endif

+ 0 - 44
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_MemChecker-api.c

@@ -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){
-    float res = PikaStdLib_MemChecker_getMax(self);
-    method_returnFloat(args, res);
-}
-
-void PikaStdLib_MemChecker_getNowMethod(PikaObj *self, Args *args){
-    float 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 arg_setMetaObj("", "PikaStdLib_MemChecker", New_PikaStdLib_MemChecker);
-}

+ 0 - 18
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_MemChecker.h

@@ -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);
-
-float PikaStdLib_MemChecker_getMax(PikaObj *self);
-float PikaStdLib_MemChecker_getNow(PikaObj *self);
-void PikaStdLib_MemChecker_max(PikaObj *self);
-void PikaStdLib_MemChecker_now(PikaObj *self);
-void PikaStdLib_MemChecker_resetMax(PikaObj *self);
-
-#endif

+ 0 - 23
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_RangeObj-api.c

@@ -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 arg_setMetaObj("", "PikaStdLib_RangeObj", New_PikaStdLib_RangeObj);
-}

+ 0 - 14
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_RangeObj.h

@@ -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

+ 0 - 23
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_StringObj-api.c

@@ -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 arg_setMetaObj("", "PikaStdLib_StringObj", New_PikaStdLib_StringObj);
-}

+ 0 - 14
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_StringObj.h

@@ -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

+ 0 - 89
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_SysObj-api.c

@@ -1,89 +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");
-    Arg * val = args_getArg(args, "val");
-    PikaStdLib_SysObj___set__(self, key, obj, val);
-}
-
-void PikaStdLib_SysObj_floatMethod(PikaObj *self, Args *args){
-    Arg * arg = args_getArg(args, "arg");
-    float res = PikaStdLib_SysObj_float(self, arg);
-    method_returnFloat(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_nextMethod(PikaObj *self, Args *args){
-    Arg * arg = args_getArg(args, "arg");
-    Arg * res = PikaStdLib_SysObj_next(self, arg);
-    method_returnArg(args, res);
-}
-
-void PikaStdLib_SysObj_rangeMethod(PikaObj *self, Args *args){
-    int a1 = args_getInt(args, "a1");
-    int a2 = args_getInt(args, "a2");
-    int a3 = args_getInt(args, "a3");
-    Arg * res = PikaStdLib_SysObj_range(self, a1, a2, a3);
-    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)", PikaStdLib_SysObj___set__Method);
-    class_defineMethod(self, "float(arg:any)->float", PikaStdLib_SysObj_floatMethod);
-    class_defineMethod(self, "int(arg:any)->int", PikaStdLib_SysObj_intMethod);
-    class_defineMethod(self, "iter(arg:any)->any", PikaStdLib_SysObj_iterMethod);
-    class_defineMethod(self, "next(arg:any)->any", PikaStdLib_SysObj_nextMethod);
-    class_defineMethod(self, "range(a1:int,a2:int,a3: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 arg_setMetaObj("", "PikaStdLib_SysObj", New_PikaStdLib_SysObj);
-}

+ 0 - 23
bsp/TC264D/PikaScript/pikascript-api/PikaStdLib_SysObj.h

@@ -1,23 +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, Arg * val);
-float PikaStdLib_SysObj_float(PikaObj *self, Arg * arg);
-int PikaStdLib_SysObj_int(PikaObj *self, Arg * arg);
-Arg * PikaStdLib_SysObj_iter(PikaObj *self, Arg * arg);
-Arg * PikaStdLib_SysObj_next(PikaObj *self, Arg * arg);
-Arg * PikaStdLib_SysObj_range(PikaObj *self, int a1, int a2, int a3);
-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

File diff suppressed because it is too large
+ 0 - 0
bsp/TC264D/PikaScript/pikascript-api/compiler-info.txt


+ 0 - 15
bsp/TC264D/PikaScript/pikascript-api/pikaScript.c

@@ -1,15 +0,0 @@
-/* ******************************** */
-/* Warning! Don't modify this file! */
-/* ******************************** */
-#include "PikaMain.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-PikaObj * pikaScriptInit(void){
-    PikaObj * pikaMain = newRootObj("pikaMain", New_PikaMain);
-    obj_run(pikaMain,
-            "print('hello PikaScript  @TC264')\n"
-            "\n");
-    return pikaMain;
-}
-

+ 0 - 13
bsp/TC264D/PikaScript/pikascript-api/pikaScript.h

@@ -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

+ 0 - 97
bsp/TC264D/PikaScript/pikascript-core/BaseObj.c

@@ -1,97 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define __PIKA_OBJ_CLASS_IMPLEMENT
-
-#include "BaseObj.h"
-#include "PikaObj.h"
-#include "TinyObj.h"
-#include "dataMemory.h"
-#include "dataString.h"
-#include "dataStrs.h"
-
-Arg* arg_setMetaObj(char* objName, char* className, NewFun objPtr) {
-    Args* buffs = New_strBuff();
-    Arg* argNew = New_arg(NULL);
-    /* m means mate-object */
-    argNew = arg_setPtr(argNew, objName, TYPE_MATE_OBJECT, (void*)objPtr);
-    args_deinit(buffs);
-    return argNew;
-}
-
-int32_t obj_newObj(PikaObj* self,
-                   char* objName,
-                   char* className,
-                   NewFun newFunPtr) {
-    /* add mate Obj, no inited */
-    Arg* mateObj = arg_setMetaObj(objName, className, newFunPtr);
-    args_setArg(self->list, mateObj);
-    return 0;
-}
-
-static void print_no_end(PikaObj* self, Args* args){
-    obj_setErrorCode(self, 0);
-    char* res = args_print(args, "val");
-    if (NULL == res) {
-        obj_setSysOut(self, "[error] print: can not print val");
-        obj_setErrorCode(self, 1);
-        return;
-    }
-    /* not empty */
-    if (strIsContain(res, '\\')) {
-        res = strsReplace(args, res, "\\n", "\n");
-        res = strsReplace(args, res, "\\r", "\r");
-        res = strsReplace(args, res, "\\t", "\t");
-    }
-    __platform_printf("%s", res);
-    // obj_setSysOut(self, res);
-}
-
-static void print(PikaObj* self, Args* args) {
-    obj_setErrorCode(self, 0);
-    char* res = args_print(args, "val");
-    if (NULL == res) {
-        obj_setSysOut(self, "[error] print: can not print val");
-        obj_setErrorCode(self, 1);
-        return;
-    }
-    /* not empty */
-    if (strIsContain(res, '\\')) {
-        res = strsReplace(args, res, "\\n", "\n");
-        res = strsReplace(args, res, "\\r", "\r");
-        res = strsReplace(args, res, "\\t", "\t");
-    }
-    __platform_printf("%s\r\n", res);
-    // obj_setSysOut(self, res);
-}
-
-PikaObj* New_BaseObj(Args* args) {
-    PikaObj* self = New_TinyObj(args);
-    class_defineMethod(self, "print(val:any)", print);
-    class_defineMethod(self, "printNoEnd(val:any)", print_no_end);
-    return self;
-}

+ 0 - 44
bsp/TC264D/PikaScript/pikascript-core/BaseObj.h

@@ -1,44 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _PikaObj_baseObj__H
-#define _PikaObj_baseObj__H
-#include "PikaObj.h"
-#include "TinyObj.h"
-#include "dataMemory.h"
-#include "PikaVM.h"
-PikaObj* New_BaseObj(Args* args);
-int32_t obj_newObjFromClassLoader(PikaObj* self,
-                                  char* objPath,
-                                  char* classPath);
-int32_t obj_import(PikaObj* self, char* className, NewFun classPtr);
-int32_t obj_newObj(PikaObj* self,
-                   char* objName,
-                   char* className,
-                   NewFun newFunPtr);
-Arg* arg_setMetaObj(char* objName, char* className, NewFun objPtr);
-#endif

+ 0 - 708
bsp/TC264D/PikaScript/pikascript-core/PikaObj.c

@@ -1,708 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define __PIKA_OBJ_CLASS_IMPLEMENT
-#include "PikaObj.h"
-#include "BaseObj.h"
-#include "PikaPlatform.h"
-#include "dataArgs.h"
-#include "dataMemory.h"
-#include "dataString.h"
-#include "dataStrs.h"
-
-int fast_atoi(char* src) {
-    const char* p = src;
-    static const uint64_t a[][10] = {
-        {0, 1e0, 2e0, 3e0, 4e0, 5e0, 6e0, 7e0, 8e0, 9e0},
-        {0, 1e1, 2e1, 3e1, 4e1, 5e1, 6e1, 7e1, 8e1, 9e1},
-        {0, 1e2, 2e2, 3e2, 4e2, 5e2, 6e2, 7e2, 8e2, 9e2},
-        {0, 1e3, 2e3, 3e3, 4e3, 5e3, 6e3, 7e3, 8e3, 9e3},
-        {0, 1e4, 2e4, 3e4, 4e4, 5e4, 6e4, 7e4, 8e4, 9e4},
-        {0, 1e5, 2e5, 3e5, 4e5, 5e5, 6e5, 7e5, 8e5, 9e5},
-        {0, 1e6, 2e6, 3e6, 4e6, 5e6, 6e6, 7e6, 8e6, 9e6},
-        {0, 1e7, 2e7, 3e7, 4e7, 5e7, 6e7, 7e7, 8e7, 9e7},
-        {0, 1e8, 2e8, 3e8, 4e8, 5e8, 6e8, 7e8, 8e8, 9e8},
-        {0, 1e9, 2e9, 3e9, 4e9, 5e9, 6e9, 7e9, 8e9, 9e9},
-    };
-    uint16_t size = strGetSize(src);
-    p = p + size - 1;
-    if (*p) {
-        int s = 0;
-        const uint64_t* n = a[0];
-        while (p != src) {
-            s += n[(*p - '0')];
-            n += 10;
-            p--;
-        }
-        if (*p == '-') {
-            return -s;
-        }
-        return s + n[(*p - '0')];
-    }
-    return 0;
-}
-
-static uint16_t const str100p[100] = {
-    0x3030, 0x3130, 0x3230, 0x3330, 0x3430, 0x3530, 0x3630, 0x3730, 0x3830,
-    0x3930, 0x3031, 0x3131, 0x3231, 0x3331, 0x3431, 0x3531, 0x3631, 0x3731,
-    0x3831, 0x3931, 0x3032, 0x3132, 0x3232, 0x3332, 0x3432, 0x3532, 0x3632,
-    0x3732, 0x3832, 0x3932, 0x3033, 0x3133, 0x3233, 0x3333, 0x3433, 0x3533,
-    0x3633, 0x3733, 0x3833, 0x3933, 0x3034, 0x3134, 0x3234, 0x3334, 0x3434,
-    0x3534, 0x3634, 0x3734, 0x3834, 0x3934, 0x3035, 0x3135, 0x3235, 0x3335,
-    0x3435, 0x3535, 0x3635, 0x3735, 0x3835, 0x3935, 0x3036, 0x3136, 0x3236,
-    0x3336, 0x3436, 0x3536, 0x3636, 0x3736, 0x3836, 0x3936, 0x3037, 0x3137,
-    0x3237, 0x3337, 0x3437, 0x3537, 0x3637, 0x3737, 0x3837, 0x3937, 0x3038,
-    0x3138, 0x3238, 0x3338, 0x3438, 0x3538, 0x3638, 0x3738, 0x3838, 0x3938,
-    0x3039, 0x3139, 0x3239, 0x3339, 0x3439, 0x3539, 0x3639, 0x3739, 0x3839,
-    0x3939,
-};
-
-char* fast_itoa(char* buf, uint32_t val) {
-    char* p = &buf[10];
-
-    *p = '\0';
-
-    while (val >= 100) {
-        uint32_t const old = val;
-
-        p -= 2;
-        val /= 100;
-        __platform_memcpy(p, &str100p[old - (val * 100)], sizeof(uint16_t));
-    }
-
-    p -= 2;
-    __platform_memcpy(p, &str100p[val], sizeof(uint16_t));
-
-    return &p[val < 10];
-}
-
-int32_t deinitEachSubObj(Arg* argEach, Args* handleArgs) {
-    if (NULL != handleArgs) {
-        /* error: tOhis handle not need handle args */
-        return 1;
-    }
-    ArgType type = arg_getType(argEach);
-    /* deinit sub object */
-    if (type == TYPE_OBJECT) {
-        PikaObj* subObj = arg_getPtr(argEach);
-        obj_deinit(subObj);
-    }
-    return 0;
-}
-
-void deinitAllSubObj(PikaObj* self) {
-    Args* args = self->list;
-    args_foreach(args, deinitEachSubObj, NULL);
-}
-
-int32_t obj_deinit(PikaObj* self) {
-    deinitAllSubObj(self);
-    args_deinit(self->list);
-    // DynMemPut(self->mem);
-    pikaFree(self, sizeof(PikaObj));
-    self = NULL;
-    return 0;
-}
-
-int32_t obj_enable(PikaObj* self) {
-    obj_setInt(self, "isEnable", 1);
-    return 0;
-}
-
-int32_t obj_disable(PikaObj* self) {
-    obj_setInt(self, "isEnable", 0);
-    return 0;
-}
-
-int32_t obj_setInt(PikaObj* self, char* argPath, int64_t val) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        /* [error] object no found */
-        return 1;
-    }
-    Args* buffs = New_strBuff();
-    char* name = strsGetLastToken(buffs, argPath, '.');
-    args_setInt(obj->list, name, val);
-    args_deinit(buffs);
-    return 0;
-}
-
-int32_t obj_setPtr(PikaObj* self, char* argPath, void* pointer) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        return 1;
-    }
-    Args* buffs = New_strBuff();
-    char* name = strsGetLastToken(buffs, argPath, '.');
-    args_setPtr(obj->list, name, pointer);
-    args_deinit(buffs);
-    return 0;
-}
-
-int32_t obj_setFloat(PikaObj* self, char* argPath, float value) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        return 1;
-    }
-    Args* buffs = New_strBuff();
-    char* name = strsGetLastToken(buffs, argPath, '.');
-    args_setFloat(obj->list, name, value);
-    args_deinit(buffs);
-    return 0;
-}
-
-int32_t obj_setStr(PikaObj* self, char* argPath, char* str) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        return 1;
-    }
-    Args* buffs = New_strBuff();
-    char* name = strsGetLastToken(buffs, argPath, '.');
-    args_setStr(obj->list, name, str);
-    args_deinit(buffs);
-    return 0;
-}
-
-int64_t obj_getInt(PikaObj* self, char* argPath) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        return -999999999;
-    }
-    Args* buffs = New_strBuff();
-    char* argName = strsGetLastToken(buffs, argPath, '.');
-    int res = args_getInt(obj->list, argName);
-    args_deinit(buffs);
-    return res;
-}
-
-Arg* obj_getArg(PikaObj* self, char* argPath) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        return NULL;
-    }
-    Args* buffs = New_strBuff();
-    char* argName = strsGetLastToken(buffs, argPath, '.');
-    Arg* res = args_getArg(obj->list, argName);
-    args_deinit(buffs);
-    return res;
-}
-
-int32_t obj_setArg(PikaObj* self, char* argPath, Arg* arg) {
-    /* setArg would copy arg */
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        /* object no found */
-        return 1;
-    }
-    Args* buffs = New_strBuff();
-    char* argName = strsGetLastToken(buffs, argPath, '.');
-    Arg* newArg = arg_copy(arg);
-    newArg = arg_setName(newArg, argName);
-    args_deinit(buffs);
-    args_setArg(obj->list, newArg);
-    return 0;
-}
-
-void* obj_getPtr(PikaObj* self, char* argPath) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        return NULL;
-    }
-    Args* buffs = New_strBuff();
-    char* argName = strsGetLastToken(buffs, argPath, '.');
-    void* res = args_getPtr(obj->list, argName);
-    args_deinit(buffs);
-    return res;
-}
-
-float obj_getFloat(PikaObj* self, char* argPath) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        return -999.999;
-    }
-    Args* buffs = New_strBuff();
-    char* argName = strsGetLastToken(buffs, argPath, '.');
-    float res = args_getFloat(obj->list, argName);
-    args_deinit(buffs);
-    return res;
-}
-
-char* obj_getStr(PikaObj* self, char* argPath) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    if (NULL == obj) {
-        return NULL;
-    }
-    Args* buffs = New_strBuff();
-    char* argName = strsGetLastToken(buffs, argPath, '.');
-    char* res = args_getStr(obj->list, argName);
-    args_deinit(buffs);
-    return res;
-}
-
-int32_t obj_load(PikaObj* self, Args* args, char* name) {
-    args_copyArgByName(args, name, self->list);
-    return 0;
-}
-
-int32_t obj_addOther(PikaObj* self, char* subObjectName, void* new_ObjectFun) {
-    Args* initArgs = New_args(NULL);
-    void* (*new_Object)(Args * initArgs) = (void* (*)(Args*))new_ObjectFun;
-    void* subObject = new_Object(initArgs);
-    obj_setPtr(self, subObjectName, subObject);
-    args_deinit(initArgs);
-    return 0;
-}
-
-int32_t obj_freeObj(PikaObj* self, char* objPath) {
-    PikaObj* obj = obj_getPtr(self, objPath);
-    obj_deinit(obj);
-    return 0;
-}
-
-char* obj_print(PikaObj* self, char* name) {
-    if (NULL == self) {
-        return NULL;
-    }
-    return args_print(self->list, name);
-}
-
-PikaObj* obj_getClassObjByNewFun(PikaObj* context,
-                                 char* name,
-                                 NewFun newClassFun) {
-    Args* initArgs = New_args(NULL);
-    PikaObj* thisClass = newClassFun(initArgs);
-    obj_setPtr(thisClass, "_clsptr", (void*)newClassFun);
-    args_deinit(initArgs);
-    return thisClass;
-}
-
-Arg* obj_getMethod(PikaObj* obj, char* methodPath) {
-    Arg* method = NULL;
-    Args* buffs = New_strBuff();
-    char* methodName = strsGetLastToken(buffs, methodPath, '.');
-    method = obj_getArg(obj, methodName);
-    PikaObj* methodHostClass;
-    if (NULL != method) {
-        method = arg_copy(method);
-        goto exit;
-    }
-    methodHostClass = obj_getClassObj(obj);
-    method = arg_copy(obj_getArg(methodHostClass, methodName));
-    obj_deinit(methodHostClass);
-exit:
-    args_deinit(buffs);
-    return method;
-}
-
-PikaObj* obj_getClassObj(PikaObj* obj) {
-    NewFun classPtr = (NewFun)obj_getPtr(obj, "_clsptr");
-    PikaObj* classObj = obj_getClassObjByNewFun(obj, "", classPtr);
-    return classObj;
-}
-
-void* getNewClassObjFunByName(PikaObj* obj, char* name) {
-    char* classPath = name;
-    /* init the subprocess */
-    void* newClassObjFun = args_getPtr(obj->list, classPath);
-    return newClassObjFun;
-}
-
-int32_t __foreach_removeMethodInfo(Arg* argNow, Args* argList) {
-    if (arg_getType(argNow) == TYPE_METHOD) {
-        args_removeArg(argList, argNow);
-        return 0;
-    }
-    return 0;
-}
-
-PikaObj* removeMethodInfo(PikaObj* thisClass) {
-    args_foreach(thisClass->list, __foreach_removeMethodInfo, thisClass->list);
-    return thisClass;
-}
-
-PikaObj* newRootObj(char* name, NewFun newObjFun) {
-    PikaObj* thisClass = obj_getClassObjByNewFun(NULL, name, newObjFun);
-    PikaObj* newObj = removeMethodInfo(thisClass);
-    return newObj;
-}
-
-static PikaObj* __initObj(PikaObj* obj, char* name) {
-    PikaObj* res = NULL;
-    NewFun newObjFun = (NewFun)getNewClassObjFunByName(obj, name);
-    Args* buffs = New_args(NULL);
-    PikaObj* thisClass;
-    PikaObj* newObj;
-    if (NULL == newObjFun) {
-        /* no such object */
-        res = NULL;
-        goto exit;
-    }
-    thisClass = obj_getClassObjByNewFun(obj, name, newObjFun);
-    newObj = removeMethodInfo(thisClass);
-
-    args_setPtrWithType(obj->list, name, TYPE_OBJECT, newObj);
-    res = obj_getPtr(obj, name);
-    goto exit;
-exit:
-    args_deinit(buffs);
-    return res;
-}
-
-PikaObj* obj_getObjDirect(PikaObj* self, char* name) {
-    if (NULL == self) {
-        return NULL;
-    }
-    /* finded object, check type*/
-    ArgType type = args_getType(self->list, name);
-    /* found mate Object */
-    if (type == TYPE_MATE_OBJECT) {
-        return __initObj(self, name);
-    }
-    /* found Objcet */
-    if (type == TYPE_OBJECT || type == TYPE_POINTER) {
-        return args_getPtr(self->list, name);
-    }
-    return NULL;
-}
-
-PikaObj* obj_getObj(PikaObj* self, char* objPath, int32_t keepDeepth) {
-    char objPath_buff[64];
-    __platform_memcpy(objPath_buff, objPath, sizeof(objPath_buff));
-    char token_buff[32] = {0};
-    int32_t token_num = strGetTokenNum(objPath, '.');
-    PikaObj* obj = self;
-    for (int32_t i = 0; i < token_num - keepDeepth; i++) {
-        char* token = strPopToken(token_buff, objPath_buff, '.');
-        obj = obj_getObjDirect(obj, token);
-        if (obj == NULL) {
-            goto exit;
-        }
-    }
-    goto exit;
-exit:
-    return obj;
-}
-
-void* methodArg_getPtr(Arg* method_arg) {
-    uint32_t size_ptr = sizeof(void*);
-    void* info = arg_getContent(method_arg);
-    void* ptr = NULL;
-    __platform_memcpy(&ptr, info, size_ptr);
-    return ptr;
-}
-
-char* methodArg_getDec(Arg* method_arg) {
-    uint32_t size_ptr = sizeof(void*);
-    void* info = arg_getContent(method_arg);
-    return (char*)((uintptr_t)info + size_ptr);
-}
-
-void obj_saveMethodInfo(PikaObj* self,
-                        char* method_name,
-                        char* method_dec,
-                        void* method_ptr) {
-    Args* buffs = New_strBuff();
-    char* pars = strsRemovePrefix(buffs, method_dec, method_name);
-    Arg* arg = New_arg(NULL);
-    uint32_t size_ptr = sizeof(void*);
-    uint32_t size_pars = strGetSize(pars);
-    uint32_t size_info = size_ptr + size_pars + 1;
-    void* info = args_getBuff(buffs, size_info);
-    __platform_memcpy(info, &method_ptr, size_ptr);
-    /* +1 to add \0 */
-    __platform_memcpy((void*)((uintptr_t)info + size_ptr), pars, size_pars + 1);
-    arg = arg_setName(arg, method_name);
-    arg = arg_setType(arg, TYPE_METHOD);
-    arg = arg_setContent(arg, info, size_info);
-
-    args_setArg(self->list, arg);
-    args_deinit(buffs);
-}
-
-int32_t class_defineMethod(PikaObj* self,
-                           char* declearation,
-                           Method methodPtr) {
-    int32_t size = strGetSize(declearation);
-    int32_t res = 0;
-    Args* buffs = New_strBuff();
-    char* cleanDeclearation =
-        strDeleteChar(args_getBuff(buffs, size), declearation, ' ');
-    char* methodPath =
-        strGetFirstToken(args_getBuff(buffs, size), cleanDeclearation, '(');
-
-    PikaObj* methodHost = obj_getObj(self, methodPath, 1);
-    char* methodName;
-    if (NULL == methodHost) {
-        /* no found method object */
-        res = 1;
-        goto exit;
-    }
-    methodName = strsGetLastToken(buffs, methodPath, '.');
-
-    obj_saveMethodInfo(methodHost, methodName, cleanDeclearation,
-                       (void*)methodPtr);
-    res = 0;
-    goto exit;
-exit:
-    args_deinit(buffs);
-    return res;
-}
-
-PIKA_WEAK int __runExtern_contral(PikaObj* self, char* cmd) {
-    return 0;
-}
-
-VM_Parameters* obj_runDirect(PikaObj* self, char* cmd) {
-    VM_Parameters* globals = NULL;
-
-    globals = pikaVM_run(self, cmd);
-    goto exit;
-
-exit:
-    return globals;
-}
-
-int32_t obj_removeArg(PikaObj* self, char* argPath) {
-    PikaObj* objHost = obj_getObj(self, argPath, 1);
-    Arg* obj_arg = obj_getArg(self, argPath);
-    Args* buffs = New_strBuff();
-    char* argName;
-    int32_t res;
-    if (TYPE_OBJECT == arg_getType(obj_arg)) {
-        obj_deinit(arg_getPtr(obj_arg));
-    }
-    int32_t err = 0;
-    if (NULL == objHost) {
-        /* [error] object no found */
-        err = 1;
-        goto exit;
-    }
-    argName = strsGetLastToken(buffs, argPath, '.');
-    res = args_removeArg(objHost->list, args_getArg(objHost->list, argName));
-    if (1 == res) {
-        /*[error] not found arg*/
-        err = 2;
-        goto exit;
-    }
-    goto exit;
-exit:
-    args_deinit(buffs);
-    return err;
-}
-
-int32_t obj_isArgExist(PikaObj* self, char* argPath) {
-    PikaObj* obj = obj_getObj(self, argPath, 1);
-    Args* buffs = New_strBuff();
-    int32_t res = 0;
-    char* argName;
-    Arg* arg;
-    if (NULL == obj) {
-        /* [error] object no found */
-        res = 1;
-        goto exit;
-    }
-    argName = strsGetLastToken(buffs, argPath, '.');
-    arg = args_getArg(obj->list, argName);
-    if (NULL == arg) {
-        /* no found arg */
-        res = 0;
-        goto exit;
-    }
-    /* found arg */
-    res = 1;
-    goto exit;
-
-exit:
-    args_deinit(buffs);
-    return res;
-}
-
-void obj_runNoRes(PikaObj* slef, char* cmd) {
-    /* unsafe, nothing would happend when error occord */
-    obj_runDirect(slef, cmd);
-}
-
-void obj_run(PikaObj* self, char* cmd) {
-    /* safe, stop when error occord and error info would be print32_t */
-    obj_runDirect(self, cmd);
-    // obj_deinit(globals);
-}
-
-char rxBuff[PIKA_SHELL_LINE_BUFF_SIZE] = {0};
-char rx_char = 0;
-static void clearBuff(char* buff, int size) {
-    for (int i = 0; i < size; i++) {
-        buff[i] = 0;
-    }
-}
-
-volatile uint8_t is_in_block = 0;
-void pikaScriptShell(PikaObj* self) {
-    __platform_printf(">>> ");
-    while (1) {
-        char inputChar = __platform_getchar();
-        __platform_printf("%c", inputChar);
-        if ((inputChar == '\b') || (inputChar == 127)) {
-            uint32_t size = strGetSize(rxBuff);
-            if (size == 0) {
-                __platform_printf(" ");
-                continue;
-            }
-            __platform_printf(" \b");
-            rxBuff[size - 1] = 0;
-            continue;
-        }
-        if (inputChar != '\r' && inputChar != '\n') {
-            strAppendWithSize(rxBuff, &inputChar, 1);
-            continue;
-        }
-        if ((inputChar == '\r') || (inputChar == '\n')) {
-            __platform_printf("\r\n");
-            /* still in block */
-            if (is_in_block) {
-                /* load new line into buff */
-                Args* buffs = New_strBuff();
-                char _n = '\n';
-                strAppendWithSize(rxBuff, &_n, 1);
-                char* shell_buff_new = strsAppend(buffs, obj_getStr(self, "shell_buff"), rxBuff);
-                obj_setStr(self, "shell_buff", shell_buff_new);
-                args_deinit(buffs);
-                /* go out from block */
-                if(rxBuff[0] != ' '){
-                    is_in_block = 0;
-                    obj_run(self, obj_getStr(self, "shell_buff"));
-                    __platform_printf(">>> ");
-                }else{
-                    __platform_printf("... ");
-                }
-                clearBuff(rxBuff, PIKA_SHELL_LINE_BUFF_SIZE);
-                continue;
-            }
-            /* go in block */
-            if (rxBuff[strGetSize(rxBuff) - 1] == ':') {
-                is_in_block = 1;
-                char _n = '\n';
-                strAppendWithSize(rxBuff, &_n, 1);
-                obj_setStr(self, "shell_buff", rxBuff);
-                clearBuff(rxBuff, PIKA_SHELL_LINE_BUFF_SIZE);
-                __platform_printf("... ");
-                continue;
-            }
-            /* exit */
-            if (strEqu("exit()", rxBuff)) {
-                /* exit pika shell */
-                break;
-            }
-            /* run single line */
-            obj_run(self, rxBuff);
-            __platform_printf(">>> ");
-            clearBuff(rxBuff, PIKA_SHELL_LINE_BUFF_SIZE);
-            continue;
-        }
-    }
-}
-
-void obj_setErrorCode(PikaObj* self, int32_t errCode) {
-    obj_setInt(self, "__errCode", errCode);
-}
-
-int32_t obj_getErrorCode(PikaObj* self) {
-    if (!obj_isArgExist(self, "__errCode")) {
-        return 0;
-    }
-    return obj_getInt(self, "__errCode");
-}
-
-void args_setErrorCode(Args* args, int32_t errCode) {
-    args_setInt(args, "__errCode", errCode);
-}
-
-int32_t args_getErrorCode(Args* args) {
-    if (!args_isArgExist(args, "__errCode")) {
-        return 0;
-    }
-    return args_getInt(args, "__errCode");
-}
-
-void obj_setSysOut(PikaObj* self, char* str) {
-    obj_setStr(self, "__sysOut", str);
-}
-
-char* obj_getSysOut(PikaObj* self) {
-    return obj_getStr(self, "__sysOut");
-}
-
-char* args_getSysOut(Args* args) {
-    return args_getStr(args, "__sysOut");
-}
-
-void args_setSysOut(Args* args, char* str) {
-    args_setStr(args, "__sysOut", str);
-}
-
-void obj_sysPrintf(PikaObj* self, char* fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    char sysOut[128] = {0};
-    __platform_vsprintf(sysOut, fmt, args);
-    obj_setSysOut(self, sysOut);
-    va_end(args);
-}
-
-void method_returnStr(Args* args, char* val) {
-    args_setStr(args, "return", val);
-}
-void method_returnInt(Args* args, int32_t val) {
-    args_setInt(args, "return", val);
-}
-void method_returnFloat(Args* args, float val) {
-    args_setFloat(args, "return", val);
-}
-void method_returnPtr(Args* args, void* val) {
-    args_setPtr(args, "return", val);
-}
-void method_returnArg(Args* args, Arg* arg) {
-    arg = arg_setName(arg, "return");
-    args_setArg(args, arg);
-}
-
-int32_t method_getInt(Args* args, char* argName) {
-    return args_getInt(args, argName);
-}
-float method_getFloat(Args* args, char* argName) {
-    return args_getFloat(args, argName);
-}
-char* method_getStr(Args* args, char* argName) {
-    return args_getStr(args, argName);
-}
-
-PikaObj* New_PikaObj(void) {
-    PikaObj* self = pikaMalloc(sizeof(PikaObj));
-    /* List */
-    self->list = New_args(NULL);
-    return self;
-}

+ 0 - 165
bsp/TC264D/PikaScript/pikascript-core/PikaObj.h

@@ -1,165 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _Process__H
-#define _Process__H
-
-
-
-/*! \NOTE: Make sure #include "plooc_class.h" is close to the class definition 
- */
-//#define __PLOOC_CLASS_USE_STRICT_TEMPLATE__
-   
-#if     defined(__PIKA_OBJ_CLASS_IMPLEMENT)
-#   define __PLOOC_CLASS_IMPLEMENT__
-#elif   defined(__PIKA_OBJ_CLASS_INHERIT__)
-#   define __PLOOC_CLASS_INHERIT__
-#endif   
-
-#include "__pika_ooc.h"
-
-#include "dataArgs.h"
-#include "dataLink.h"
-#include "dataMemory.h"
-
-// dcl_class(PikaObj);
-typedef struct PikaObj_t PikaObj;
-
-typedef PikaObj* (*NewFun)(Args* args);
-typedef PikaObj* (*InitFun)(PikaObj* self, Args* args);
-typedef PikaObj VM_Parameters;
-typedef void (*Method)(PikaObj* self, Args* args);
-
-struct PikaObj_t {
-    /* list */
-    Args* list;
-};
-
-
-// def_class(PikaObj,
-    
-//     private_member(
-//         /* list */
-//         Args* list;
-//    )
-// )
-/* operation */
-int32_t obj_deinit(PikaObj* self);
-int32_t obj_init(PikaObj* self, Args* args);
-int32_t obj_update(PikaObj* self);
-int32_t obj_enable(PikaObj* self);
-int32_t obj_disable(PikaObj* self);
-
-// arg type operations
-int32_t obj_setInt(PikaObj* self, char* argPath, int64_t val);
-int32_t obj_setPtr(PikaObj* self, char* argPath, void* pointer);
-int32_t obj_setFloat(PikaObj* self, char* argPath, float value);
-int32_t obj_setStr(PikaObj* self, char* argPath, char* str);
-int32_t obj_setArg(PikaObj* self, char* argPath, Arg* arg);
-
-void* obj_getPtr(PikaObj* self, char* argPath);
-float obj_getFloat(PikaObj* self, char* argPath);
-char* obj_getStr(PikaObj* self, char* argPath);
-int64_t obj_getInt(PikaObj* self, char* argPath);
-Arg* obj_getArg(PikaObj* self, char* argPath);
-
-// arg general operations
-int32_t obj_bind(PikaObj* self, char* type, char* name, void* pointer);
-int32_t obj_set(PikaObj* self, char* name, char* valStr);
-
-int32_t obj_bindInt(PikaObj* self, char* name, int32_t* valPtr);
-int32_t obj_bindFloat(PikaObj* self, char* name, float* valPtr);
-int32_t obj_bindString(PikaObj* self, char* name, char** valPtr);
-
-char* obj_print(PikaObj* self, char* name);
-
-// args operations
-int32_t obj_load(PikaObj* self, Args* args, char* name);
-
-// subObject
-int32_t obj_addOther(PikaObj* self, char* subObjectName, void* new_projcetFun);
-int32_t obj_setObjWithoutClass(PikaObj* self,
-                               char* subObjectName,
-                               void* new_projcetFun);
-PikaObj* obj_getObjDirect(PikaObj* self, char* name);
-PikaObj* obj_getObj(PikaObj* self, char* processPathectory, int32_t deepth);
-
-// subProcess
-int32_t obj_freeObj(PikaObj* self, char* subObjectName);
-
-/* method */
-int32_t class_defineMethod(PikaObj* self, char* declearation, Method methodPtr);
-
-int32_t obj_removeArg(PikaObj* self, char* argPath);
-int32_t obj_isArgExist(PikaObj* self, char* argPath);
-PikaObj* obj_getClassObjByNewFun(PikaObj* self, char* name, NewFun newClassFun);
-PikaObj* newRootObj(char* name, NewFun newObjFun);
-PikaObj* obj_getClassObj(PikaObj* obj);
-Arg* obj_getMethod(PikaObj* obj, char* methodPath);
-
-void obj_setErrorCode(PikaObj* self, int32_t errCode);
-int32_t obj_getErrorCode(PikaObj* self);
-void obj_setSysOut(PikaObj* self, char* str);
-char* args_getSysOut(Args* args);
-void args_setErrorCode(Args* args, int32_t errCode);
-int32_t args_getErrorCode(Args* args);
-void args_setSysOut(Args* args, char* str);
-char* obj_getSysOut(PikaObj* self);
-void obj_sysPrintf(PikaObj* self, char* fmt, ...);
-uint8_t obj_getRefArg(PikaObj* self,
-                      char* targetArgName,
-                      char* sourceArgPath,
-                      Args* targetArgs);
-uint8_t obj_getAnyArg(PikaObj* self,
-                      char* targetArgName,
-                      char* sourceArgPath,
-                      Args* targetArgs);
-
-void method_returnStr(Args* args, char* val);
-void method_returnInt(Args* args, int32_t val);
-void method_returnFloat(Args* args, float val);
-void method_returnPtr(Args* args, void* val);
-int32_t method_getInt(Args* args, char* argName);
-float method_getFloat(Args* args, char* argName);
-char* method_getStr(Args* args, char* argName);
-void method_returnArg(Args* args, Arg* arg);
-char* methodArg_getDec(Arg* method_arg);
-void* methodArg_getPtr(Arg* method_arg);
-
-void obj_runNoRes(PikaObj* slef, char* cmd);
-void obj_run(PikaObj* self, char* cmd);
-VM_Parameters* obj_runDirect(PikaObj* self, char* cmd);
-PikaObj* New_PikaObj(void);
-
-/* tools */
-int fast_atoi(char* src);
-char* fast_itoa(char* buf, uint32_t val);
-
-/* shell */
-void pikaScriptShell(PikaObj *self);
-
-#endif

+ 0 - 14
bsp/TC264D/PikaScript/pikascript-core/PikaObj.py

@@ -1,14 +0,0 @@
-class TinyObj:
-    pass
-
-
-class BaseObj(TinyObj):
-    pass
-
-
-def print(val: any):
-    pass
-
-
-def set(argPath: str, val: any):
-    pass

+ 0 - 1290
bsp/TC264D/PikaScript/pikascript-core/PikaParser.c

@@ -1,1290 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "PikaParser.h"
-#include "BaseObj.h"
-#include "PikaObj.h"
-#include "dataQueue.h"
-#include "dataQueueObj.h"
-#include "dataStack.h"
-#include "dataStrs.h"
-
-char* strsPopTokenWithSkip_byStr(Args* buffs,
-                                 char* stmts,
-                                 char* str,
-                                 char skipStart,
-                                 char skipEnd) {
-    int32_t str_size = strGetSize(str);
-    int32_t size = strGetSize(stmts);
-    if (0 == size) {
-        return NULL;
-    }
-    char* strOut = args_getBuff(buffs, size);
-    int32_t stmtEnd = 0;
-    uint8_t isGetSign = 0;
-    int32_t parentheseDeepth = 0;
-    for (int32_t i = 0; i < size; i++) {
-        if (skipStart == stmts[i]) {
-            parentheseDeepth++;
-        }
-        if (skipEnd == stmts[i]) {
-            parentheseDeepth--;
-        }
-        if (parentheseDeepth == 0) {
-            if (0 == strncmp(stmts + i, str, str_size)) {
-                stmtEnd = i;
-                isGetSign = 1;
-                break;
-            }
-        }
-    }
-    if (!isGetSign) {
-        stmtEnd = size;
-    }
-    for (int32_t i = 0; i < stmtEnd; i++) {
-        strOut[i] = stmts[i];
-    }
-    memmove(stmts, stmts + stmtEnd + str_size, size);
-    strOut[stmtEnd] = 0;
-    return strOut;
-}
-
-char* strsPopTokenWithSkip(Args* buffs,
-                           char* stmts,
-                           char sign,
-                           char skipStart,
-                           char skipEnd) {
-    char str_buff[2] = {0};
-    str_buff[0] = sign;
-    return strsPopTokenWithSkip_byStr(buffs, stmts, str_buff, skipStart,
-                                      skipEnd);
-}
-
-char* strsGetCleanCmd(Args* outBuffs, char* cmd) {
-    int32_t size = strGetSize(cmd);
-    Args* buffs = New_strBuff();
-    char* tokens = Lexer_getTokens(buffs, cmd);
-    uint16_t token_size = strCountSign(tokens, 0x1F) + 1;
-    char* strOut = args_getBuff(outBuffs, size);
-    int32_t iOut = 0;
-    for (uint16_t i = 0; i < token_size; i++) {
-        char* token = strsPopToken(buffs, tokens, 0x1F);
-        for (uint16_t k = 0; k < strGetSize(token + 1); k++) {
-            strOut[iOut] = token[k + 1];
-            iOut++;
-        }
-    }
-    /* add \0 */
-    strOut[iOut] = 0;
-    args_deinit(buffs);
-    return strOut;
-}
-
-enum TokenType {
-    TOKEN_strEnd = 0,
-    TOKEN_symbol,
-    TOKEN_keyword,
-    TOKEN_operator,
-    TOKEN_devider,
-    TOKEN_literal,
-};
-
-enum StmtType {
-    STMT_reference,
-    STMT_string,
-    STMT_number,
-    STMT_method,
-    STMT_operator,
-    STMT_none,
-};
-
-char* strsDeleteBetween(Args* buffs, char* strIn, char begin, char end) {
-    int32_t size = strGetSize(strIn);
-    char* strOut = args_getBuff(buffs, size);
-    uint8_t deepth = 0;
-    uint32_t iOut = 0;
-    for (int i = 0; i < size; i++) {
-        if (end == strIn[i]) {
-            deepth--;
-        }
-        if (0 == deepth) {
-            strOut[iOut] = strIn[i];
-            iOut++;
-        }
-        if (begin == strIn[i]) {
-            deepth++;
-        }
-    }
-    strOut[iOut] = 0;
-    return strOut;
-}
-
-static uint8_t Lexer_isError(char* line) {
-    Args* buffs = New_strBuff();
-    uint8_t res = 0; /* not error */
-    char* tokens = Lexer_getTokens(buffs, line);
-    if (NULL == tokens) {
-        res = 1; /* lex error */
-        goto exit;
-    }
-    goto exit;
-exit:
-    args_deinit(buffs);
-    return res;
-}
-
-static enum StmtType Lexer_matchStmtType(char* right) {
-    Args* buffs = New_strBuff();
-    enum StmtType stmtType = STMT_none;
-    char* rightWithoutSubStmt = strsDeleteBetween(buffs, right, '(', ')');
-    char* tokens = Lexer_getTokens(buffs, rightWithoutSubStmt);
-    uint16_t token_size = strCountSign(tokens, 0x1F) + 1;
-    uint8_t is_get_operator = 0;
-    uint8_t is_get_method = 0;
-    uint8_t is_get_string = 0;
-    uint8_t is_get_number = 0;
-    uint8_t is_get_symbol = 0;
-    for (int i = 0; i < token_size; i++) {
-        char* token = strsPopToken(buffs, tokens, 0x1F);
-        enum TokenType token_type = (enum TokenType)token[0];
-        /* collect type */
-        if (token_type == TOKEN_operator) {
-            is_get_operator = 1;
-            continue;
-        }
-        if (token_type == TOKEN_devider) {
-            is_get_method = 1;
-            continue;
-        }
-        if (token_type == TOKEN_literal) {
-            if (token[1] == '\'' || token[1] == '"') {
-                is_get_string = 1;
-                continue;
-            }
-            is_get_number = 1;
-            continue;
-        }
-        if (token_type == TOKEN_symbol) {
-            is_get_symbol = 1;
-            continue;
-        }
-    }
-    if (is_get_operator) {
-        stmtType = STMT_operator;
-        goto exit;
-    }
-    if (is_get_method) {
-        stmtType = STMT_method;
-        goto exit;
-    }
-    if (is_get_string) {
-        stmtType = STMT_string;
-        goto exit;
-    }
-    if (is_get_number) {
-        stmtType = STMT_number;
-        goto exit;
-    }
-    if (is_get_symbol) {
-        stmtType = STMT_reference;
-        goto exit;
-    }
-exit:
-    args_deinit(buffs);
-    return stmtType;
-}
-
-uint8_t Parser_checkIsDirect(char* str) {
-    /* include '0' */
-    uint32_t size = strGetSize(str) + 1;
-    for (uint32_t i = 1; i + 1 < size; i++) {
-        if ((str[i - 1] != '%') && (str[i - 1] != '!') && (str[i - 1] != '<') &&
-            (str[i - 1] != '>') && (str[i - 1] != '=') && (str[i - 1] != '+') &&
-            (str[i - 1] != '-') && (str[i - 1] != '*') && (str[i - 1] != '/') &&
-            (str[i + 1] != '=') && (str[i] == '=')) {
-            return 1;
-        }
-    }
-    return 0;
-}
-
-char* Lexer_printTokens(Args* outBuffs, char* tokens) {
-    /* init */
-    Args* buffs = New_strBuff();
-    char* printOut = strsCopy(buffs, "");
-
-    /* process */
-    uint16_t tokenSize = strCountSign(tokens, 0x1F) + 1;
-    for (uint16_t i = 0; i < tokenSize; i++) {
-        char* token = strsPopToken(buffs, tokens, 0x1F);
-        if (token[0] == TOKEN_operator) {
-            printOut = strsAppend(buffs, printOut, "{opt}");
-            printOut = strsAppend(buffs, printOut, token + 1);
-        }
-        if (token[0] == TOKEN_devider) {
-            printOut = strsAppend(buffs, printOut, "{dvd}");
-            printOut = strsAppend(buffs, printOut, token + 1);
-        }
-        if (token[0] == TOKEN_symbol) {
-            printOut = strsAppend(buffs, printOut, "{sym}");
-            printOut = strsAppend(buffs, printOut, token + 1);
-        }
-        if (token[0] == TOKEN_literal) {
-            printOut = strsAppend(buffs, printOut, "{lit}");
-            printOut = strsAppend(buffs, printOut, token + 1);
-        }
-    }
-    /* out put */
-    printOut = strsCopy(outBuffs, printOut);
-    args_deinit(buffs);
-    return printOut;
-}
-
-Arg* Lexer_setToken(Arg* tokens_arg,
-                    enum TokenType token_type,
-                    char*
-                    operator) {
-    Args* buffs = New_strBuff();
-    char token_type_buff[3] = {0};
-    token_type_buff[0] = 0x1F;
-    token_type_buff[1] = token_type;
-    char* tokens = arg_getStr(tokens_arg);
-    tokens = strsAppend(buffs, tokens, token_type_buff);
-    tokens = strsAppend(buffs, tokens, operator);
-    Arg* new_tokens_arg = arg_setStr(tokens_arg, "", tokens);
-    arg_deinit(tokens_arg);
-    args_deinit(buffs);
-    return new_tokens_arg;
-}
-
-Arg* Lexer_setSymbel(Arg* tokens_arg,
-                     char* stmt,
-                     int32_t i,
-                     int32_t* symbol_start_index) {
-    Args* buffs = New_strBuff();
-    char* symbol_buff = NULL;
-    /* nothing to add symbel */
-    if (i == *symbol_start_index) {
-        *symbol_start_index = -1;
-        goto exit;
-    }
-    symbol_buff = args_getBuff(buffs, i - *symbol_start_index);
-    __platform_memcpy(symbol_buff, stmt + *symbol_start_index,
-                      i - *symbol_start_index);
-    /* literal */
-    if ((symbol_buff[0] == '-') || (symbol_buff[0] == '\'') ||
-        (symbol_buff[0] == '"') ||
-        ((symbol_buff[0] >= '0') && (symbol_buff[0] <= '9'))) {
-        tokens_arg = Lexer_setToken(tokens_arg, TOKEN_literal, symbol_buff);
-    } else {
-        /* symbol */
-        tokens_arg = Lexer_setToken(tokens_arg, TOKEN_symbol, symbol_buff);
-    }
-    *symbol_start_index = -1;
-exit:
-    args_deinit(buffs);
-    return tokens_arg;
-}
-
-/* tokens is devided by space */
-/* a token is [TOKENTYPE|(CONTENT)] */
-char* Lexer_getTokens(Args* outBuffs, char* stmt) {
-    /* init */
-    Arg* tokens_arg = New_arg(NULL);
-    tokens_arg = arg_setStr(tokens_arg, "", "");
-    int32_t size = strGetSize(stmt);
-    uint8_t bracket_deepth = 0;
-    uint8_t c0 = 0;
-    uint8_t c1 = 0;
-    uint8_t c2 = 0;
-    uint8_t c3 = 0;
-    int32_t symbol_start_index = -1;
-    int is_in_string = 0;
-    char* tokens;
-
-    /* process */
-    for (int32_t i = 0; i < size; i++) {
-        /* update char */
-        c0 = stmt[i];
-        if (i + 1 < size) {
-            c1 = stmt[i + 1];
-        }
-        if (i + 2 < size) {
-            c2 = stmt[i + 2];
-        }
-        if (i + 3 < size) {
-            c3 = stmt[i + 3];
-        }
-        if (-1 == symbol_start_index) {
-            symbol_start_index = i;
-        }
-
-        /* solve string */
-        if (0 == is_in_string) {
-            if ('\'' == c0) {
-                /* in ' */
-                is_in_string = 1;
-                continue;
-            }
-            if ('"' == c0) {
-                /* in "" */
-                is_in_string = 2;
-                continue;
-            }
-        }
-
-        if (1 == is_in_string) {
-            if ('\'' == c0) {
-                is_in_string = 0;
-                tokens_arg = Lexer_setSymbel(tokens_arg, stmt, i + 1,
-                                             &symbol_start_index);
-            }
-            continue;
-        }
-        if (2 == is_in_string) {
-            if ('"' == c0) {
-                is_in_string = 0;
-                tokens_arg = Lexer_setSymbel(tokens_arg, stmt, i + 1,
-                                             &symbol_start_index);
-            }
-            continue;
-        }
-
-        /* match devider*/
-        if (('(' == c0) || (')' == c0) || (',' == c0) || ('[' == c0) ||
-            (']' == c0) || (':' == c0)) {
-            tokens_arg =
-                Lexer_setSymbel(tokens_arg, stmt, i, &symbol_start_index);
-            char content[2] = {0};
-            content[0] = c0;
-            tokens_arg = Lexer_setToken(tokens_arg, TOKEN_devider, content);
-            if (c0 == '(') {
-                bracket_deepth++;
-            }
-            if (c0 == ')') {
-                bracket_deepth--;
-            }
-            continue;
-        }
-        /* match operator */
-        if (('>' == c0) || ('<' == c0) || ('*' == c0) || ('/' == c0) ||
-            ('+' == c0) || ('-' == c0) || ('!' == c0) || ('=' == c0) ||
-            ('%' == c0) || ('&' == c0) || ('|' == c0) || ('^' == c0) ||
-            ('~' == c0)) {
-            if (('*' == c0) || ('/' == c0)) {
-                /*
-                     //=, **=
-                */
-                if ((c0 == c1) && ('=' == c2)) {
-                    char content[4] = {0};
-                    content[0] = c0;
-                    content[1] = c1;
-                    content[2] = '=';
-                    tokens_arg = Lexer_setSymbel(tokens_arg, stmt, i,
-                                                 &symbol_start_index);
-                    tokens_arg =
-                        Lexer_setToken(tokens_arg, TOKEN_operator, content);
-                    i = i + 2;
-                    continue;
-                }
-            }
-            /*
-                >>, <<, **, //
-            */
-            if (('>' == c0) || ('<' == c0) || ('*' == c0) || ('/' == c0)) {
-                if (c0 == c1) {
-                    char content[3] = {0};
-                    content[0] = c0;
-                    content[1] = c1;
-                    tokens_arg = Lexer_setSymbel(tokens_arg, stmt, i,
-                                                 &symbol_start_index);
-                    tokens_arg =
-                        Lexer_setToken(tokens_arg, TOKEN_operator, content);
-                    i = i + 1;
-                    continue;
-                }
-            }
-            /*
-                >=, <=, *=, /=, +=, -=, !=, ==, %=
-            */
-            if (('>' == c0) || ('<' == c0) || ('*' == c0) || ('/' == c0) ||
-                ('+' == c0) || ('-' == c0) || ('!' == c0) || ('=' == c0) ||
-                ('%' == c0)) {
-                if ('=' == c1) {
-                    char content[3] = {0};
-                    content[0] = c0;
-                    content[1] = c1;
-                    tokens_arg = Lexer_setSymbel(tokens_arg, stmt, i,
-                                                 &symbol_start_index);
-                    tokens_arg =
-                        Lexer_setToken(tokens_arg, TOKEN_operator, content);
-                    i = i + 1;
-                    continue;
-                }
-            }
-            /* single */
-            char content[2] = {0};
-            content[0] = c0;
-            if ('-' != c0) {
-                tokens_arg =
-                    Lexer_setSymbel(tokens_arg, stmt, i, &symbol_start_index);
-                tokens_arg =
-                    Lexer_setToken(tokens_arg, TOKEN_operator, content);
-                continue;
-            }
-            /* when c0 is '-' */
-            if (!((c1 >= '0') && (c1 <= '9'))) {
-                /* is a '-' */
-                tokens_arg =
-                    Lexer_setSymbel(tokens_arg, stmt, i, &symbol_start_index);
-                tokens_arg =
-                    Lexer_setToken(tokens_arg, TOKEN_operator, content);
-                continue;
-            }
-            if (i != symbol_start_index) {
-                /* is a '-' */
-                tokens_arg =
-                    Lexer_setSymbel(tokens_arg, stmt, i, &symbol_start_index);
-                tokens_arg =
-                    Lexer_setToken(tokens_arg, TOKEN_operator, content);
-                continue;
-            }
-            /* is a symbel */
-            continue;
-        }
-        /* not */
-        if ('n' == c0) {
-            if (('o' == c1) && ('t' == c2) && (' ' == c3)) {
-                tokens_arg =
-                    Lexer_setSymbel(tokens_arg, stmt, i, &symbol_start_index);
-                tokens_arg =
-                    Lexer_setToken(tokens_arg, TOKEN_operator, " not ");
-                i = i + 3;
-                continue;
-            }
-        }
-        /* and */
-        if ('a' == c0) {
-            if (('n' == c1) && ('d' == c2) && (' ' == c3)) {
-                tokens_arg =
-                    Lexer_setSymbel(tokens_arg, stmt, i, &symbol_start_index);
-                tokens_arg =
-                    Lexer_setToken(tokens_arg, TOKEN_operator, " and ");
-                i = i + 3;
-                continue;
-            }
-        }
-        /* or */
-        if ('o' == c0) {
-            if (('r' == c1) && (' ' == c2)) {
-                tokens_arg =
-                    Lexer_setSymbel(tokens_arg, stmt, i, &symbol_start_index);
-                tokens_arg = Lexer_setToken(tokens_arg, TOKEN_operator, " or ");
-                i = i + 2;
-                continue;
-            }
-        }
-        /* skip spaces */
-        if (' ' == c0) {
-            /* not get symbal */
-            if (i == symbol_start_index) {
-                symbol_start_index++;
-            } else {
-                /* already get symbal */
-                tokens_arg =
-                    Lexer_setSymbel(tokens_arg, stmt, i, &symbol_start_index);
-            }
-        }
-        if (i == size - 1) {
-            /* last check symbel */
-            tokens_arg =
-                Lexer_setSymbel(tokens_arg, stmt, size, &symbol_start_index);
-        }
-    }
-    if (0 != bracket_deepth) {
-        /* bracket match error */
-        tokens = NULL;
-        goto exit;
-    }
-    /* output */
-    tokens = arg_getStr(tokens_arg);
-    tokens = strsCopy(outBuffs, tokens);
-exit:
-    arg_deinit(tokens_arg);
-    return tokens;
-}
-
-char* Lexer_popToken(Args* buffs, char* tokens_buff) {
-    return strsPopToken(buffs, tokens_buff, 0x1F);
-}
-
-uint16_t Lexer_getTokenSize(char* tokens) {
-    return strCountSign(tokens, 0x1F) + 1;
-}
-
-enum TokenType Lexer_getTokenType(char* token) {
-    return token[0];
-}
-
-char* Lexer_getTokenPyload(char* token) {
-    return (char*)((uintptr_t)token + 1);
-}
-
-uint8_t Lexer_isContain(char* tokens, enum TokenType token_type, char* pyload) {
-    Args* buffs = New_strBuff();
-    char* tokens_buff = strsCopy(buffs, tokens);
-    uint8_t res = 0;
-    uint16_t token_size = Lexer_getTokenSize(tokens);
-    for (int i = 0; i < token_size; i++) {
-        char* token = Lexer_popToken(buffs, tokens_buff);
-        if (token_type == Lexer_getTokenType(token)) {
-            if (strEqu(Lexer_getTokenPyload(token), pyload)) {
-                res = 1;
-                goto exit;
-            }
-        }
-    }
-exit:
-    args_deinit(buffs);
-    return res;
-}
-
-char* Lexer_getOperator(Args* outBuffs, char* stmt) {
-    Args* buffs = New_strBuff();
-    char* tokens = Lexer_getTokens(buffs, stmt);
-    char* operator= NULL;
-    const char operators[][6] = {
-        "**", "~",   "*",  "/",  "%",  "//",  "+",     "-",     ">>",  "<<",
-        "&",  "^",   "|",  "<",  "<=", ">",   ">=",    "!=",    "==",  "%=",
-        "/=", "//=", "-=", "+=", "*=", "**=", " not ", " and ", " or "};
-    for (uint32_t i = 0; i < sizeof(operators) / 6; i++) {
-        if (Lexer_isContain(tokens, TOKEN_operator, (char*)operators[i])) {
-            operator= strsCopy(buffs, (char*)operators[i]);
-        }
-    }
-    /* out put */
-    operator= strsCopy(outBuffs, operator);
-    args_deinit(buffs);
-    return operator;
-}
-
-char* Parser_solveBranckets(Args* outBuffs,
-                            char* content,
-                            char* stmt,
-                            char* mode) {
-    Args* buffs = New_args(NULL);
-    char* tokens = NULL;
-    char *token1, *token2 = NULL;
-    char *pyload1, *pyload2 = NULL;
-    Arg* right_arg = arg_setStr(NULL, "", "");
-    Arg* token1_arg = NULL;
-    uint8_t is_in_brancket = 0;
-    args_setStr(buffs, "index", "");
-    enum TokenType token_type1, token_type2;
-    do {
-        if (NULL == content) {
-            arg_deinit(right_arg);
-            right_arg = arg_setStr(right_arg, "", stmt);
-            break;
-        }
-        tokens = Lexer_getTokens(buffs, content);
-        if (!Lexer_isContain(tokens, TOKEN_devider, "[")) {
-            /* not contain '[', return origin */
-            arg_deinit(right_arg);
-            if (strEqu(mode, "right")) {
-                right_arg = arg_setStr(right_arg, "", content);
-            } else if (strEqu(mode, "left")) {
-                right_arg = arg_setStr(right_arg, "", stmt);
-            }
-            break;
-        }
-        uint16_t len = Lexer_getTokenSize(tokens);
-        Lexer_popToken(buffs, tokens);
-        token1_arg = arg_setStr(NULL, "", Lexer_popToken(buffs, tokens));
-        for (int i = 0; i < len; i++) {
-            Args* token_buffs = New_strBuff();
-            token1 = strsCopy(token_buffs, arg_getStr(token1_arg));
-            arg_deinit(token1_arg);
-            token2 = Lexer_popToken(token_buffs, tokens);
-            token1_arg = arg_setStr(NULL, "", token2);
-            token_type1 = Lexer_getTokenType(token1);
-            token_type2 = Lexer_getTokenType(token2);
-            pyload1 = Lexer_getTokenPyload(token1);
-            pyload2 = Lexer_getTokenPyload(token2);
-
-            /* matched [] */
-            if ((TOKEN_devider == token_type2) && (strEqu(pyload2, "["))) {
-                args_setStr(buffs, "obj", pyload1);
-                is_in_brancket = 1;
-            } else if ((TOKEN_devider == token_type2) &&
-                       (strEqu(pyload2, "]"))) {
-                is_in_brancket = 0;
-                char* index = args_getStr(buffs, "index");
-                Arg* index_arg = arg_setStr(NULL, "", index);
-                index_arg = arg_strAppend(index_arg, pyload1);
-                args_setStr(buffs, "index", arg_getStr(index_arg));
-                arg_deinit(index_arg);
-
-                if (strEqu(mode, "right")) {
-                    right_arg = arg_strAppend(right_arg, "__get__(");
-                } else if (strEqu(mode, "left")) {
-                    right_arg = arg_strAppend(right_arg, "__set__(");
-                }
-                right_arg = arg_strAppend(right_arg, args_getStr(buffs, "obj"));
-                right_arg = arg_strAppend(right_arg, ",");
-                right_arg =
-                    arg_strAppend(right_arg, args_getStr(buffs, "index"));
-                if (strEqu(mode, "left")) {
-                    right_arg = arg_strAppend(right_arg, ",");
-                    right_arg = arg_strAppend(right_arg, stmt);
-                }
-                right_arg = arg_strAppend(right_arg, ")");
-                args_setStr(buffs, "index", "");
-            } else if (is_in_brancket && (!strEqu(pyload1, "["))) {
-                char* index = args_getStr(buffs, "index");
-                Arg* index_arg = arg_setStr(NULL, "", index);
-                index_arg = arg_strAppend(index_arg, pyload1);
-                args_setStr(buffs, "index", arg_getStr(index_arg));
-                arg_deinit(index_arg);
-            } else if (!is_in_brancket && (!strEqu(pyload1, "]"))) {
-                right_arg = arg_strAppend(right_arg, pyload1);
-            }
-            args_deinit(token_buffs);
-        }
-        arg_deinit(token1_arg);
-    } while (0);
-
-    /* clean and retur */
-    content = strsCopy(outBuffs, arg_getStr(right_arg));
-    arg_deinit(right_arg);
-    args_deinit(buffs);
-    return content;
-}
-
-char* Parser_solveRightBranckets(Args* outBuffs, char* right) {
-    return Parser_solveBranckets(outBuffs, right, NULL, "right");
-}
-
-char* Parser_solveLeftBranckets(Args* outBuffs, char* right, char* left) {
-    return Parser_solveBranckets(outBuffs, left, right, "left");
-}
-
-AST* AST_parseStmt(AST* ast, char* stmt) {
-    Args* buffs = New_strBuff();
-    char* assignment = strsGetFirstToken(buffs, stmt, '(');
-    char* method = NULL;
-    char* ref = NULL;
-    char* str = NULL;
-    char* num = NULL;
-    char* left = NULL;
-    char* right = NULL;
-    /* solve left */
-    uint8_t isLeftExist = 0;
-    if (Parser_checkIsDirect(assignment)) {
-        isLeftExist = 1;
-    }
-    if (isLeftExist) {
-        left = strsGetFirstToken(buffs, assignment, '=');
-    }
-    /* solve right stmt */
-    if (isLeftExist) {
-        right = strsGetLastToken(buffs, stmt, '=');
-    } else {
-        right = stmt;
-    }
-    /* solve the [] stmt */
-    right = Parser_solveRightBranckets(buffs, right);
-    char* right_new = Parser_solveLeftBranckets(buffs, right, left);
-    /* left is contain the '[]' */
-    if (!strEqu(right_new, right)) {
-        /* update new right */
-        right = right_new;
-        /* cancel left */
-        isLeftExist = 0;
-    }
-    if (isLeftExist) {
-        obj_setStr(ast, (char*)"left", left);
-    }
-    /* match statment type */
-    enum StmtType stmtType = Lexer_matchStmtType(right);
-    /* solve operator stmt */
-    if (STMT_operator == stmtType) {
-        char* rightWithoutSubStmt = strsDeleteBetween(buffs, right, '(', ')');
-        char* operator= Lexer_getOperator(buffs, rightWithoutSubStmt);
-        obj_setStr(ast, (char*)"operator", operator);
-        char* rightBuff = strsCopy(buffs, right);
-        char* subStmt1 =
-            strsPopTokenWithSkip_byStr(buffs, rightBuff, operator, '(', ')');
-        char* subStmt2 = rightBuff;
-        queueObj_pushObj(ast, (char*)"stmt");
-        AST_parseStmt(queueObj_getCurrentObj(ast), subStmt1);
-        queueObj_pushObj(ast, (char*)"stmt");
-        AST_parseStmt(queueObj_getCurrentObj(ast), subStmt2);
-        goto exit;
-    }
-    /* solve method stmt */
-    if (STMT_method == stmtType) {
-        method = strsGetFirstToken(buffs, right, '(');
-        obj_setStr(ast, (char*)"method", method);
-        char* subStmts = strsCut(buffs, right, '(', ')');
-        while (1) {
-            char* subStmt =
-                strsPopTokenWithSkip(buffs, subStmts, ',', '(', ')');
-            if (NULL == subStmt) {
-                break;
-            }
-            queueObj_pushObj(ast, (char*)"stmt");
-            AST_parseStmt(queueObj_getCurrentObj(ast), subStmt);
-        }
-        goto exit;
-    }
-    /* solve reference stmt */
-    if (STMT_reference == stmtType) {
-        ref = right;
-        obj_setStr(ast, (char*)"ref", ref);
-        goto exit;
-    }
-    /* solve str stmt */
-    if (STMT_string == stmtType) {
-        str = right;
-        str = strsDeleteChar(buffs, str, '\'');
-        str = strsDeleteChar(buffs, str, '\"');
-        obj_setStr(ast, (char*)"string", str);
-        goto exit;
-    }
-    /* solve number stmt */
-    if (STMT_number == stmtType) {
-        num = right;
-        obj_setStr(ast, (char*)"num", num);
-        goto exit;
-    }
-exit:
-    args_deinit(buffs);
-    return ast;
-}
-
-static int32_t Parser_getPyLineBlockDeepth(char* line) {
-    uint32_t size = strGetSize(line);
-    for (uint32_t i = 0; i < size; i++) {
-        if (line[i] != ' ') {
-            uint32_t spaceNum = i;
-            if (0 == spaceNum % 4) {
-                return spaceNum / 4;
-            }
-            /* space Num is not 4N, error*/
-            return -1;
-        }
-    }
-    return 0;
-}
-
-char* Parser_removeAnnotation(char* line) {
-    uint8_t is_annotation_exit = 0;
-    for (uint32_t i = 0; i < strGetSize(line); i++) {
-        if ('#' == line[i]) {
-            /* end the line */
-            line[i] = 0;
-            is_annotation_exit = 1;
-            break;
-        }
-    }
-    /* no annotation, exit */
-    if (!is_annotation_exit) {
-        return line;
-    }
-    /* check empty line */
-    for (uint32_t i = 0; i < strGetSize(line); i++) {
-        if (' ' != line[i]) {
-            return line;
-        }
-    }
-    /* is an emply line */
-    line[0] = '#';
-    line[1] = 0;
-    return line;
-}
-
-AST* AST_parseLine(char* line, Stack* blockStack) {
-    AST* ast = New_queueObj();
-    Args* buffs = New_strBuff();
-    line = strsDeleteChar(buffs, line, '\r');
-    line = Parser_removeAnnotation(line);
-    uint8_t blockDeepth;
-    uint8_t blockDeepthLast;
-    char* lineStart;
-    char* stmt;
-    if (strEqu("#", line)) {
-        obj_setStr(ast, "annotation", "annotation");
-        goto exit;
-    }
-    /* get block deepth */
-    blockDeepth = Parser_getPyLineBlockDeepth(line);
-    blockDeepthLast = blockDeepth;
-    /* in block */
-    if (NULL != blockStack) {
-        blockDeepthLast = args_getInt(blockStack, "top");
-        /* check if exit block */
-        for (int i = 0; i < blockDeepthLast - blockDeepth; i++) {
-            QueueObj* exitBlock = obj_getObj(ast, "exitBlock", 0);
-            if (NULL == exitBlock) {
-                obj_newObj(ast, "exitBlock", "", New_TinyObj);
-                exitBlock = obj_getObj(ast, "exitBlock", 0);
-                queueObj_init(exitBlock);
-            }
-            char buff[10] = {0};
-            char* blockType = stack_popStr(blockStack, buff);
-            queueObj_pushStr(exitBlock, blockType);
-        }
-    }
-    /* set block deepth */
-    obj_setInt(ast, "blockDeepth", blockDeepth);
-    lineStart = line + blockDeepth * 4;
-    stmt = lineStart;
-    /* match block start */
-    if (0 == strncmp(lineStart, (char*)"while ", 6)) {
-        stmt = strsCut(buffs, lineStart, ' ', ':');
-        obj_setStr(ast, "block", "while");
-        if (NULL != blockStack) {
-            stack_pushStr(blockStack, "while");
-        }
-        goto block_matched;
-    }
-    if (0 == strncmp(lineStart, (char*)"for ", 4)) {
-        Args* list_buffs = New_strBuff();
-        char* line_buff = strsCopy(list_buffs, lineStart + 4);
-        char* arg_in = strsPopToken(list_buffs, line_buff, ' ');
-        obj_setStr(ast, "arg_in", arg_in);
-        strsPopToken(list_buffs, line_buff, ' ');
-        if (strIsStartWith(line_buff, "range(")) {
-            obj_setInt(ast, "isRange", 1);
-        }
-        char* list_in = strsPopToken(list_buffs, line_buff, ':');
-        list_in = strsAppend(list_buffs, "iter(", list_in);
-        list_in = strsAppend(list_buffs, list_in, ")");
-        list_in = strsCopy(buffs, list_in);
-        args_deinit(list_buffs);
-        obj_setStr(ast, "block", "for");
-        obj_setStr(ast, "list_in", list_in);
-        if (NULL != blockStack) {
-            stack_pushStr(blockStack, "for");
-        }
-        stmt = list_in;
-        goto block_matched;
-    }
-    if (0 == strncmp(lineStart, (char*)"if ", 3)) {
-        stmt = strsCut(buffs, lineStart, ' ', ':');
-        obj_setStr(ast, "block", "if");
-        if (NULL != blockStack) {
-            stack_pushStr(blockStack, "if");
-        }
-        goto block_matched;
-    }
-    if (0 == strncmp(lineStart, (char*)"elif ", 5)) {
-        stmt = strsCut(buffs, lineStart, ' ', ':');
-        obj_setStr(ast, "block", "elif");
-        if (NULL != blockStack) {
-            stack_pushStr(blockStack, "elif");
-        }
-        goto block_matched;
-    }
-    if (0 == strncmp(lineStart, (char*)"else", 4)) {
-        if ((lineStart[4] == ' ') || (lineStart[4] == ':')) {
-            stmt = "";
-            obj_setStr(ast, "block", "else");
-            if (NULL != blockStack) {
-                stack_pushStr(blockStack, "else");
-            }
-        }
-        goto block_matched;
-    }
-    if (0 == strncmp(lineStart, (char*)"break", 5)) {
-        if ((lineStart[5] == ' ') || (lineStart[5] == 0)) {
-            obj_setStr(ast, "break", "");
-            stmt = "";
-            goto block_matched;
-        }
-    }
-    if (0 == strncmp(lineStart, (char*)"continue", 8)) {
-        if ((lineStart[8] == ' ') || (lineStart[8] == 0)) {
-            obj_setStr(ast, "continue", "");
-            stmt = "";
-            goto block_matched;
-        }
-    }
-    if (strEqu(lineStart, (char*)"return")) {
-        obj_setStr(ast, "return", "");
-        stmt = "";
-        goto block_matched;
-    }
-    if (0 == strncmp(lineStart, (char*)"return ", 7)) {
-        char* lineBuff = strsCopy(buffs, lineStart);
-        strsPopToken(buffs, lineBuff, ' ');
-        stmt = lineBuff;
-        obj_setStr(ast, "return", "");
-        goto block_matched;
-    }
-    if (0 == strncmp(lineStart, (char*)"def ", 4)) {
-        stmt = "";
-        char* declear = strsCut(buffs, lineStart, ' ', ':');
-        declear = strsGetCleanCmd(buffs, declear);
-        obj_setStr(ast, "block", "def");
-        obj_setStr(ast, "declear", declear);
-        if (NULL != blockStack) {
-            stack_pushStr(blockStack, "def");
-        }
-        goto block_matched;
-    }
-block_matched:
-    stmt = strsGetCleanCmd(buffs, stmt);
-    ast = AST_parseStmt(ast, stmt);
-    goto exit;
-exit:
-    args_deinit(buffs);
-    return ast;
-}
-
-char* Parser_LineToAsm(Args* buffs, char* line, Stack* blockStack) {
-    char* pikaAsm = NULL;
-    AST* ast = NULL;
-    if (Lexer_isError(line)) {
-        pikaAsm = NULL;
-        goto exit;
-    }
-    ast = AST_parseLine(line, blockStack);
-    if (obj_isArgExist(ast, "annotation")) {
-        pikaAsm = strsCopy(buffs, "");
-        goto exit;
-    }
-    pikaAsm = AST_toPikaAsm(ast, buffs);
-exit:
-    if (NULL != ast) {
-        AST_deinit(ast);
-    }
-    return pikaAsm;
-}
-
-static Arg* ASM_saveSingleAsm(Args* buffs,
-                              Arg* pikaAsmBuff,
-                              char* singleAsm,
-                              uint8_t isToFlash) {
-    if (isToFlash) {
-        uint8_t saveErr = __platform_save_pikaAsm(singleAsm);
-        if (0 == saveErr) {
-            if (NULL != pikaAsmBuff) {
-                arg_deinit(pikaAsmBuff);
-            }
-            return NULL;
-        }
-    }
-
-    char* pikaAsm = arg_getStr(pikaAsmBuff);
-    pikaAsm = strsAppend(buffs, pikaAsm, singleAsm);
-    arg_deinit(pikaAsmBuff);
-    pikaAsmBuff = arg_setStr(NULL, "", pikaAsm);
-    return pikaAsmBuff;
-}
-
-static char* ASM_getOutAsm(Args* outBuffs,
-                           Arg* pikaAsmBuff,
-                           uint8_t isToFlash) {
-    if (isToFlash) {
-        return __platform_load_pikaAsm();
-    }
-    return strsCopy(outBuffs, arg_getStr(pikaAsmBuff));
-}
-
-char* Parser_multiLineToAsm(Args* outBuffs, char* multiLine) {
-    Stack* blockStack = New_Stack();
-    Arg* pikaAsmBuff = arg_setStr(NULL, "", "");
-    uint32_t lineOffset = 0;
-    uint32_t multiLineSize = strGetSize(multiLine);
-    uint8_t isToFlash = __platform_Asm_is_to_flash(multiLine);
-    char* outAsm = NULL;
-    while (1) {
-        Args* singleRunBuffs = New_strBuff();
-        char* line =
-            strsGetFirstToken(singleRunBuffs, multiLine + lineOffset, '\n');
-        uint32_t lineSize = strGetSize(line);
-        lineOffset = lineOffset + lineSize + 1;
-        char* singleAsm = Parser_LineToAsm(singleRunBuffs, line, blockStack);
-        if (NULL == singleAsm) {
-            outAsm = NULL;
-            args_deinit(singleRunBuffs);
-            goto exit;
-        }
-        pikaAsmBuff = ASM_saveSingleAsm(singleRunBuffs, pikaAsmBuff, singleAsm,
-                                        isToFlash);
-        args_deinit(singleRunBuffs);
-        if (lineOffset >= multiLineSize) {
-            break;
-        }
-    }
-    if (isToFlash) {
-        __platform_save_pikaAsm_EOF();
-    }
-    outAsm = ASM_getOutAsm(outBuffs, pikaAsmBuff, isToFlash);
-    goto exit;
-exit:
-    if (NULL != pikaAsmBuff) {
-        arg_deinit(pikaAsmBuff);
-    }
-    stack_deinit(blockStack);
-    return outAsm;
-}
-
-char* AST_appandPikaAsm(AST* ast, AST* subAst, Args* buffs, char* pikaAsm) {
-    int deepth = obj_getInt(ast, "deepth");
-    while (1) {
-        QueueObj* subStmt = queueObj_popObj(subAst);
-        if (NULL == subStmt) {
-            break;
-        }
-        obj_setInt(ast, "deepth", deepth + 1);
-        pikaAsm = AST_appandPikaAsm(ast, subStmt, buffs, pikaAsm);
-    }
-    char* method = obj_getStr(subAst, "method");
-    char* operator= obj_getStr(subAst, "operator");
-    char* ref = obj_getStr(subAst, "ref");
-    char* left = obj_getStr(subAst, "left");
-    char* str = obj_getStr(subAst, "string");
-    char* num = obj_getStr(subAst, "num");
-    if (NULL != ref) {
-        char buff[32] = {0};
-        __platform_sprintf(buff, "%d REF %s\n", deepth, ref);
-        pikaAsm = strsAppend(buffs, pikaAsm, buff);
-    }
-    if (NULL != operator) {
-        char buff[32] = {0};
-        __platform_sprintf(buff, "%d OPT %s\n", deepth, operator);
-        pikaAsm = strsAppend(buffs, pikaAsm, buff);
-    }
-    if (NULL != method) {
-        char buff[32] = {0};
-        __platform_sprintf(buff, "%d RUN %s\n", deepth, method);
-        pikaAsm = strsAppend(buffs, pikaAsm, buff);
-    }
-    if (NULL != str) {
-        char buff[32] = {0};
-        __platform_sprintf(buff, "%d STR %s\n", deepth, str);
-        pikaAsm = strsAppend(buffs, pikaAsm, buff);
-    }
-    if (NULL != num) {
-        char buff[32] = {0};
-        __platform_sprintf(buff, "%d NUM %s\n", deepth, num);
-        pikaAsm = strsAppend(buffs, pikaAsm, buff);
-    }
-
-    if (NULL != left) {
-        char buff[32] = {0};
-        __platform_sprintf(buff, "%d OUT %s\n", deepth, left);
-        pikaAsm = strsAppend(buffs, pikaAsm, buff);
-    }
-    obj_setInt(ast, "deepth", deepth - 1);
-    return pikaAsm;
-}
-
-static char* ASM_addBlockDeepth(AST* ast,
-                                Args* buffs,
-                                char* pikaAsm,
-                                uint8_t deepthOffset) {
-    pikaAsm = strsAppend(buffs, pikaAsm, (char*)"B");
-    char buff[11];
-    pikaAsm = strsAppend(
-        buffs, pikaAsm,
-        fast_itoa(buff, obj_getInt(ast, "blockDeepth") + deepthOffset));
-    pikaAsm = strsAppend(buffs, pikaAsm, (char*)"\n");
-    return pikaAsm;
-}
-
-char* AST_toPikaAsm(AST* ast, Args* buffs) {
-    Args* runBuffs = New_strBuff();
-    char* pikaAsm = strsCopy(runBuffs, "");
-    QueueObj* exitBlock = obj_getObj(ast, "exitBlock", 0);
-    /* exiting from block */
-    if (exitBlock != NULL) {
-        while (1) {
-            uint8_t blockTypeNum = obj_getInt(exitBlock, "top") -
-                                   obj_getInt(exitBlock, "bottom") - 1;
-            char* blockType = queueObj_popStr(exitBlock);
-            if (NULL == blockType) {
-                break;
-            }
-            /* goto the while start when exit while block */
-            if (strEqu(blockType, "while")) {
-                pikaAsm = ASM_addBlockDeepth(ast, buffs, pikaAsm, blockTypeNum);
-                pikaAsm = strsAppend(buffs, pikaAsm, (char*)"0 JMP -1\n");
-            }
-            /* goto the while start when exit while block */
-            if (strEqu(blockType, "for")) {
-                pikaAsm = ASM_addBlockDeepth(ast, buffs, pikaAsm, blockTypeNum);
-                pikaAsm = strsAppend(buffs, pikaAsm, (char*)"0 JMP -1\n");
-                /* garbage collect for the list */
-                pikaAsm = ASM_addBlockDeepth(ast, buffs, pikaAsm, blockTypeNum);
-                char _l_x[] = "_lx";
-                char block_deepth_char =
-                    obj_getInt(ast, "blockDeepth") + blockTypeNum + '0';
-                _l_x[sizeof(_l_x) - 2] = block_deepth_char;
-                pikaAsm = strsAppend(buffs, pikaAsm, (char*)"0 DEL ");
-                pikaAsm = strsAppend(buffs, pikaAsm, (char*)_l_x);
-                pikaAsm = strsAppend(buffs, pikaAsm, (char*)"\n");
-            }
-            /* return when exit method */
-            if (strEqu(blockType, "def")) {
-                pikaAsm = strsAppend(buffs, pikaAsm, (char*)"0 RET\n");
-            }
-        }
-    }
-    /* add block deepth */
-    /* example: B0 */
-    pikaAsm = ASM_addBlockDeepth(ast, buffs, pikaAsm, 0);
-
-    /* "deepth" is invoke deepth, not the blockDeepth */
-    obj_setInt(ast, "deepth", 0);
-
-    /* match block */
-    uint8_t is_block_matched = 0;
-    if (strEqu(obj_getStr(ast, "block"), "for")) {
-        /* for "for" iter */
-        char* arg_in = obj_getStr(ast, "arg_in");
-        Arg* newAsm_arg = arg_setStr(NULL, "", "");
-        char _l_x[] = "_lx";
-        char block_deepth_char = '0';
-        block_deepth_char += obj_getInt(ast, "blockDeepth");
-        _l_x[sizeof(_l_x) - 2] = block_deepth_char;
-        /* init iter */
-        /*     get the iter(_l<x>) */
-        pikaAsm = AST_appandPikaAsm(ast, ast, runBuffs, pikaAsm);
-        newAsm_arg = arg_strAppend(newAsm_arg, "0 OUT ");
-        newAsm_arg = arg_strAppend(newAsm_arg, _l_x);
-        newAsm_arg = arg_strAppend(newAsm_arg, "\n");
-        if (1 == obj_getInt(ast, "isRange")) {
-            newAsm_arg = arg_strAppend(newAsm_arg, "0 REF _r1\n");
-            newAsm_arg = arg_strAppend(newAsm_arg, "0 REF _r2\n");
-            newAsm_arg = arg_strAppend(newAsm_arg, "0 REF _r3\n");
-            newAsm_arg = arg_strAppend(newAsm_arg, "0 OUT ");
-            newAsm_arg = arg_strAppend(newAsm_arg, _l_x);
-            newAsm_arg = arg_strAppend(newAsm_arg, ".a1\n");
-            newAsm_arg = arg_strAppend(newAsm_arg, "0 OUT ");
-            newAsm_arg = arg_strAppend(newAsm_arg, _l_x);
-            newAsm_arg = arg_strAppend(newAsm_arg, ".a2\n");
-            newAsm_arg = arg_strAppend(newAsm_arg, "0 OUT ");
-            newAsm_arg = arg_strAppend(newAsm_arg, _l_x);
-            newAsm_arg = arg_strAppend(newAsm_arg, ".a3\n");
-        }
-        pikaAsm = strsAppend(runBuffs, pikaAsm, arg_getStr(newAsm_arg));
-        arg_deinit(newAsm_arg);
-        newAsm_arg = arg_setStr(NULL, "", "");
-        /* get next */
-        /*     run next(_l<x>) */
-        /*     check item is exist */
-        pikaAsm = ASM_addBlockDeepth(ast, buffs, pikaAsm, 0);
-        newAsm_arg = arg_strAppend(newAsm_arg, "0 RUN ");
-        newAsm_arg = arg_strAppend(newAsm_arg, _l_x);
-        newAsm_arg = arg_strAppend(newAsm_arg, ".__next__\n");
-        newAsm_arg = arg_strAppend(newAsm_arg, "0 OUT ");
-        newAsm_arg = arg_strAppend(newAsm_arg, arg_in);
-        newAsm_arg = arg_strAppend(newAsm_arg, "\n");
-        newAsm_arg = arg_strAppend(newAsm_arg, "0 EST ");
-        newAsm_arg = arg_strAppend(newAsm_arg, arg_in);
-        newAsm_arg = arg_strAppend(newAsm_arg, "\n0 JEZ 2\n");
-        pikaAsm = strsAppend(runBuffs, pikaAsm, arg_getStr(newAsm_arg));
-        arg_deinit(newAsm_arg);
-        is_block_matched = 1;
-        goto exit;
-    }
-    if (strEqu(obj_getStr(ast, "block"), "while")) {
-        /* parse stmt ast */
-        pikaAsm = AST_appandPikaAsm(ast, ast, runBuffs, pikaAsm);
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 JEZ 2\n");
-        is_block_matched = 1;
-        goto exit;
-    }
-    if (strEqu(obj_getStr(ast, "block"), "if")) {
-        /* parse stmt ast */
-        pikaAsm = AST_appandPikaAsm(ast, ast, runBuffs, pikaAsm);
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 JEZ 1\n");
-        is_block_matched = 1;
-        goto exit;
-    }
-    if (strEqu(obj_getStr(ast, "block"), "else")) {
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 NEL 1\n");
-        goto exit;
-    }
-    if (strEqu(obj_getStr(ast, "block"), "elif")) {
-        /* skip if __else is 0 */
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 NEL 1\n");
-        /* parse stmt ast */
-        pikaAsm = AST_appandPikaAsm(ast, ast, runBuffs, pikaAsm);
-        /* skip if stmt is 0 */
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 JEZ 1\n");
-        is_block_matched = 1;
-        goto exit;
-    }
-    if (strEqu(obj_getStr(ast, "block"), "def")) {
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 DEF ");
-        pikaAsm = strsAppend(runBuffs, pikaAsm, obj_getStr(ast, "declear"));
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "\n");
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 JMP 1\n");
-        is_block_matched = 1;
-        goto exit;
-    }
-    if (obj_isArgExist(ast, "return")) {
-        /* parse stmt ast */
-        pikaAsm = AST_appandPikaAsm(ast, ast, runBuffs, pikaAsm);
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 RET\n");
-        is_block_matched = 1;
-        goto exit;
-    }
-    if (obj_isArgExist(ast, "break")) {
-        /* parse stmt ast */
-        pikaAsm = AST_appandPikaAsm(ast, ast, runBuffs, pikaAsm);
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 BRK\n");
-        is_block_matched = 1;
-        goto exit;
-    }
-    if (obj_isArgExist(ast, "continue")) {
-        /* parse stmt ast */
-        pikaAsm = AST_appandPikaAsm(ast, ast, runBuffs, pikaAsm);
-        pikaAsm = strsAppend(runBuffs, pikaAsm, "0 CTN\n");
-        is_block_matched = 1;
-        goto exit;
-    }
-exit:
-    if (!is_block_matched) {
-        /* parse stmt ast */
-        pikaAsm = AST_appandPikaAsm(ast, ast, runBuffs, pikaAsm);
-    }
-
-    /* output pikaAsm */
-    pikaAsm = strsCopy(buffs, pikaAsm);
-    args_deinit(runBuffs);
-    return pikaAsm;
-}
-
-int32_t AST_deinit(AST* ast) {
-    return obj_deinit(ast);
-}

+ 0 - 47
bsp/TC264D/PikaScript/pikascript-core/PikaParser.h

@@ -1,47 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __PIKA__PARSER__H
-#define __PIKA__PARSER__H
-#include "dataQueueObj.h"
-#include "dataStack.h"
-
-typedef QueueObj AST;
-AST* AST_parseLine(char* line, Stack* blockStack);
-char* Parser_LineToAsm(Args* buffs, char* line, Stack* blockStack);
-int32_t AST_deinit(AST* ast);
-char* AST_toPikaAsm(AST* ast, Args* buffs);
-char* Parser_multiLineToAsm(Args* outBuffs, char* multiLine);
-char* Lexer_getTokens(Args* outBuffs, char* stmt);
-char* Lexer_printTokens(Args* outBuffs, char* tokens);
-char* strsPopTokenWithSkip_byStr(Args* buffs,
-                                 char* stmts,
-                                 char* str,
-                                 char skipStart,
-                                 char skipEnd);
-char* Lexer_popToken(Args* buffs, char* tokens_buff);
-#endif

+ 0 - 117
bsp/TC264D/PikaScript/pikascript-core/PikaPlatform.c

@@ -1,117 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "PikaPlatform.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-PIKA_WEAK void __platform_disable_irq_handle(void) {
-    /* disable irq to support thread */
-}
-PIKA_WEAK void __platform_enable_irq_handle(void) {
-    /* disable irq to support thread */
-}
-PIKA_WEAK void* __platform_malloc(size_t size) {
-    return malloc(size);
-}
-PIKA_WEAK void __platform_free(void* ptr) {
-    free(ptr);
-}
-PIKA_WEAK void* __impl_pikaMalloc(size_t size) {
-    return __platform_malloc(size);
-}
-PIKA_WEAK void __impl_pikaFree(void* ptrm, size_t size) {
-    __platform_free(ptrm);
-}
-PIKA_WEAK void __platform_pool_init(void) {}
-PIKA_WEAK uint8_t __is_quick_malloc(void) {
-    return 0;
-}
-PIKA_WEAK void __quick_malloc_enable(void) {}
-PIKA_WEAK void __quick_malloc_disable(void) {}
-PIKA_WEAK uint8_t __is_locked_pikaMemory(void) {
-    return 0;
-}
-
-#ifndef __platform_printf
-PIKA_WEAK void __platform_printf(char* fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    vprintf(fmt, args);
-    va_end(args);
-}
-#endif
-
-PIKA_WEAK int __platform_sprintf(char* buff, char* fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    int res = vsprintf(buff, fmt, args);
-    va_end(args);
-    return res;
-}
-
-PIKA_WEAK int __platform_vsprintf(char* buff, char* fmt, va_list args) {
-    return vsprintf(buff, fmt, args);
-}
-
-PIKA_WEAK int __platform_vsnprintf(char* buff,
-                                   size_t size,
-                                   const char* fmt,
-                                   va_list args) {
-    return vsnprintf(buff, size, fmt, args);
-}
-
-PIKA_WEAK char* __platform_load_pikaAsm(void) {
-    /* faild */
-    return NULL;
-}
-PIKA_WEAK int32_t __platform_save_pikaAsm(char* PikaAsm) {
-    /* faild */
-    return 1;
-}
-PIKA_WEAK uint8_t __platform_Asm_is_to_flash(char* pyMultiLine) {
-    /* not to flash */
-    return 0;
-}
-PIKA_WEAK int32_t __platform_save_pikaAsm_EOF(void) {
-    return 1;
-}
-PIKA_WEAK void __platform_wait(void) {
-    while (1) {
-    };
-}
-PIKA_WEAK void* __platform_memset(void* mem, int ch, size_t size) {
-    return memset(mem, ch, size);
-}
-
-PIKA_WEAK void* __platform_memcpy(void* dir, const void* src, size_t size) {
-    return memcpy(dir, src, size);
-}
-
-PIKA_WEAK char __platform_getchar(void) {
-    return getchar();
-}

+ 0 - 105
bsp/TC264D/PikaScript/pikascript-core/PikaPlatform.h

@@ -1,105 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* micro pika configuration */
-#include "./pikaConfigValid.h"
-
-#ifndef __PIKA_PALTFORM__H
-#define __PIKA_PALTFORM__H
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Compiler */
-#if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM Compiler */
-#define PIKA_WEAK __attribute__((weak))
-#elif defined(__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
-#define PIKA_WEAK __weak
-#elif defined(__GNUC__) /* GNU GCC Compiler */
-#define PIKA_WEAK __attribute__((weak))
-#endif
-/* default PIKA_WEAK */
-#ifndef PIKA_WEAK
-#define PIKA_WEAK __attribute__((weak))
-#endif
-
-/* OS */
-#ifdef __RTTHREAD__
-#include <rtthread.h>
-#define __platform_printf(...)  rt_kprintf(__VA_ARGS__)
-#endif
-
-
-/* 
-    [Note]:
-    Create a pika_config.c to override the following weak functions to config PikaScript.
-    [Example]:
-    1. https://gitee.com/Lyon1998/pikascript/blob/master/package/STM32G030Booter/pika_config.c
-    2. https://gitee.com/Lyon1998/pikascript/blob/master/package/pikaRTBooter/pika_config.c
-*/
-
-/* interrupt config */
-void    __platform_enable_irq_handle(void);
-void    __platform_disable_irq_handle(void);
-
-/* printf family config */
-#ifndef __platform_printf
-void    __platform_printf(char* fmt, ...);
-#endif
-int     __platform_sprintf(char* buff, char* fmt, ...);
-int     __platform_vsprintf(char* buff, char* fmt, va_list args);
-int     __platform_vsnprintf(char* buff,
-                        size_t size,
-                        const char* fmt,
-                        va_list args);
-
-/* libc config */
-void*   __platform_malloc(size_t size);
-void    __platform_free(void* ptr);
-void*   __platform_memset(void *mem, int ch, size_t size);
-void*   __platform_memcpy(void* dir, const void* src, size_t size);
-
-/* pika memory pool config */
-void    __platform_pool_init(void);
-void    __platform_wait(void);
-void*   __impl_pikaMalloc(size_t size);
-void    __impl_pikaFree(void* ptrm, size_t size);
-uint8_t __is_locked_pikaMemory(void);
-uint8_t __is_quick_malloc(void);
-void    __quick_malloc_enable(void);
-void    __quick_malloc_disable(void);
-#endif
-
-/* pika asm config */
-int32_t __platform_save_pikaAsm(char* PikaAsm);
-uint8_t __platform_Asm_is_to_flash(char* pyMultiLine);
-int32_t __platform_save_pikaAsm_EOF(void);
-char*   __platform_load_pikaAsm(void);
-
-/* support shell */
-char __platform_getchar(void);

+ 0 - 787
bsp/TC264D/PikaScript/pikascript-core/PikaVM.c

@@ -1,787 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define __PIKA_OBJ_CLASS_IMPLEMENT
-#include "PikaVM.h"
-#include "BaseObj.h"
-#include "PikaObj.h"
-#include "PikaParser.h"
-#include "PikaPlatform.h"
-#include "dataQueue.h"
-#include "dataQueueObj.h"
-#include "dataStrs.h"
-
-struct VM_State_t {
-    VM_Parameters* locals;
-    VM_Parameters* globals;
-    Queue* q0;
-    Queue* q1;
-    int32_t jmp;
-    char* pc;
-    char* ASM_start;
-};
-typedef struct VM_State_t VM_State;
-
-static int32_t getLineSize(char* str) {
-    int i = 0;
-    while (1) {
-        if (str[i] == '\n') {
-            return i;
-        }
-        i++;
-    }
-}
-
-enum Instruct {
-
-#define __INS_ENUM
-#include "__instruction_table.cfg"
-    __INSTRCUTION_CNT,
-};
-
-typedef Arg* (*VM_instruct_handler)(PikaObj* self,
-                                    struct VM_State_t* vmState,
-                                    char* data);
-
-static Arg* VM_instruction_handler_NON(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_REF(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    if (strEqu(data, (char*)"True")) {
-        return arg_setInt(NULL, "", 1);
-    }
-    if (strEqu(data, (char*)"False")) {
-        return arg_setInt(NULL, "", 0);
-    }
-    /* find in local list first */
-    Arg* arg = arg_copy(obj_getArg(vmState->locals, data));
-    if (NULL == arg) {
-        /* find in global list second */
-        arg = arg_copy(obj_getArg(vmState->globals, data));
-    }
-    ArgType arg_type = arg_getType(arg);
-    if (TYPE_OBJECT == arg_type) {
-        arg = arg_setType(arg, TYPE_POINTER);
-    }
-    return arg;
-}
-
-static Arg* VM_instruction_handler_RUN(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    Args* buffs = New_strBuff();
-    Arg* returnArg = NULL;
-    VM_Parameters* subLocals = NULL;
-    char* methodPath = data;
-    PikaObj* methodHostObj;
-    Arg* method_arg;
-    Method methodPtr;
-    char* methodDec;
-    char* typeList;
-    char* methodCode;
-    char* sysOut;
-    /* return arg directly */
-    if (strEqu(data, "")) {
-        returnArg = arg_copy(queue_popArg(vmState->q1));
-        goto RUN_exit;
-    }
-
-    /* get method host obj */
-    methodHostObj = obj_getObj(self, methodPath, 1);
-    if (NULL == methodHostObj) {
-        methodHostObj = obj_getObj(vmState->locals, methodPath, 1);
-    }
-    if (NULL == methodHostObj) {
-        /* error, not found object */
-        args_setErrorCode(vmState->locals->list, 1);
-        args_setSysOut(vmState->locals->list,
-                       "[error] runner: object no found.");
-        goto RUN_exit;
-    }
-    /* get method */
-    method_arg = obj_getMethod(methodHostObj, methodPath);
-    /* assert method*/
-    if (NULL == method_arg) {
-        /* error, method no found */
-        args_setErrorCode(vmState->locals->list, 2);
-        args_setSysOut(vmState->locals->list,
-                       "[error] runner: method no found.");
-        goto RUN_exit;
-    }
-    /* get method Ptr */
-    methodPtr = (Method)methodArg_getPtr(method_arg);
-    /* get method Decleartion */
-    methodDec = strsCopy(buffs, methodArg_getDec(method_arg));
-    arg_deinit(method_arg);
-
-    /* get type list */
-    typeList = strsCut(buffs, methodDec, '(', ')');
-
-    if (typeList == NULL) {
-        /* typeList no found */
-        args_setErrorCode(vmState->locals->list, 3);
-        args_setSysOut(vmState->locals->list,
-                       "[error] runner: type list no found.");
-        goto RUN_exit;
-    }
-
-    subLocals = New_PikaObj();
-    while (1) {
-        Arg* methodArg = arg_copy(queue_popArg(vmState->q1));
-        if (NULL == methodArg) {
-            break;
-        }
-        char* argDef = strsPopToken(buffs, typeList, ',');
-        char* argName = strsGetFirstToken(buffs, argDef, ':');
-        methodArg = arg_setName(methodArg, argName);
-        args_setArg(subLocals->list, methodArg);
-    }
-
-    obj_setErrorCode(methodHostObj, 0);
-    obj_setSysOut(methodHostObj, "");
-
-    /* run method */
-    methodCode = (char*)methodPtr;
-    if (methodCode[0] == 'B' && methodCode[2] == '\n') {
-        /* VM method */
-        subLocals = pikaVM_runAsmWithPars(methodHostObj, subLocals,
-                                          vmState->globals, methodCode);
-        /* get method return */
-        returnArg = arg_copy(args_getArg(subLocals->list, (char*)"return"));
-    } else {
-        /* native method */
-        methodPtr(methodHostObj, subLocals->list);
-        /* get method return */
-        returnArg = arg_copy(args_getArg(subLocals->list, (char*)"return"));
-    }
-
-    /* transfer sysOut */
-    sysOut = obj_getSysOut(methodHostObj);
-    if (NULL != sysOut) {
-        args_setSysOut(vmState->locals->list, sysOut);
-    }
-    /* transfer errCode */
-    if (0 != obj_getErrorCode(methodHostObj)) {
-        /* method error */
-        args_setErrorCode(vmState->locals->list, 6);
-    }
-
-    goto RUN_exit;
-RUN_exit:
-    if (NULL != subLocals) {
-        obj_deinit(subLocals);
-    }
-    args_deinit(buffs);
-    return returnArg;
-}
-
-static Arg* VM_instruction_handler_STR(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    Arg* strArg = New_arg(NULL);
-    return arg_setStr(strArg, "", data);
-}
-
-static Arg* VM_instruction_handler_OUT(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    Arg* outArg = arg_copy(queue_popArg(vmState->q0));
-    obj_setArg(vmState->locals, data, outArg);
-    if (TYPE_MATE_OBJECT == arg_getType(outArg)) {
-        /* init all object */
-        PikaObj* new_obj = obj_getObj(self, data, 0);
-        /* run __init__() when init obj */
-        Arg* methodArg = NULL;
-        methodArg = obj_getMethod(new_obj, "__init__");
-        if (NULL != methodArg) {
-            arg_deinit(methodArg);
-            pikaVM_runAsm(new_obj,
-                          "B0\n"
-                          "0 RUN __init__\n");
-        }
-    }
-    arg_deinit(outArg);
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_NUM(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    Arg* numArg = New_arg(NULL);
-    if (strIsContain(data, '.')) {
-        return arg_setFloat(numArg, "", atof(data));
-    }
-    return arg_setInt(numArg, "", fast_atoi(data));
-}
-
-static Arg* VM_instruction_handler_JMP(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    vmState->jmp = fast_atoi(data);
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_JEZ(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    int offset = 0;
-    int thisBlockDeepth =
-        getThisBlockDeepth(vmState->ASM_start, vmState->pc, &offset);
-    Arg* assertArg = arg_copy(queue_popArg(vmState->q0));
-    int assert = arg_getInt(assertArg);
-    arg_deinit(assertArg);
-    char __else[] = "__else0";
-    __else[6] = '0' + thisBlockDeepth;
-    args_setInt(self->list, __else, !assert);
-    if (0 == assert) {
-        /* set __else flag */
-        vmState->jmp = fast_atoi(data);
-    }
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_OPT(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    Arg* outArg = NULL;
-    Arg* arg1 = arg_copy(queue_popArg(vmState->q1));
-    Arg* arg2 = arg_copy(queue_popArg(vmState->q1));
-    ArgType type_arg1 = arg_getType(arg1);
-    ArgType type_arg2 = arg_getType(arg2);
-    int num1_i = 0;
-    int num2_i = 0;
-    float num1_f = 0.0;
-    float num2_f = 0.0;
-    /* get int and float num */
-    if (type_arg1 == TYPE_INT) {
-        num1_i = arg_getInt(arg1);
-        num1_f = (float)num1_i;
-    } else if (type_arg1 == TYPE_FLOAT) {
-        num1_f = arg_getFloat(arg1);
-        num1_i = (int)num1_f;
-    }
-    if (type_arg2 == TYPE_INT) {
-        num2_i = arg_getInt(arg2);
-        num2_f = (float)num2_i;
-    } else if (type_arg2 == TYPE_FLOAT) {
-        num2_f = arg_getFloat(arg2);
-        num2_i = (int)num2_f;
-    }
-    if (strEqu("+", data)) {
-        if ((type_arg1 == TYPE_STRING) && (type_arg2 == TYPE_STRING)) {
-            char* num1_s = NULL;
-            char* num2_s = NULL;
-            Args* str_opt_buffs = New_strBuff();
-            num1_s = arg_getStr(arg1);
-            num2_s = arg_getStr(arg2);
-            char* opt_str_out = strsAppend(str_opt_buffs, num1_s, num2_s);
-            outArg = arg_setStr(outArg, "", opt_str_out);
-            args_deinit(str_opt_buffs);
-            goto OPT_exit;
-        }
-        /* match float */
-        if ((type_arg1 == TYPE_FLOAT) || type_arg2 == TYPE_FLOAT) {
-            outArg = arg_setFloat(outArg, "", num1_f + num2_f);
-            goto OPT_exit;
-        }
-        /* int is default */
-        outArg = arg_setInt(outArg, "", num1_i + num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu("-", data)) {
-        if ((type_arg1 == TYPE_FLOAT) || type_arg2 == TYPE_FLOAT) {
-            outArg = arg_setFloat(outArg, "", num1_f - num2_f);
-            goto OPT_exit;
-        }
-        outArg = arg_setInt(outArg, "", num1_i - num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu("*", data)) {
-        if ((type_arg1 == TYPE_FLOAT) || type_arg2 == TYPE_FLOAT) {
-            outArg = arg_setFloat(outArg, "", num1_f * num2_f);
-            goto OPT_exit;
-        }
-        outArg = arg_setInt(outArg, "", num1_i * num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu("/", data)) {
-        outArg = arg_setFloat(outArg, "", num1_f / num2_f);
-        goto OPT_exit;
-    }
-    if (strEqu("<", data)) {
-        outArg = arg_setInt(outArg, "", num1_f < num2_f);
-        goto OPT_exit;
-    }
-    if (strEqu(">", data)) {
-        outArg = arg_setInt(outArg, "", num1_f > num2_f);
-        goto OPT_exit;
-    }
-    if (strEqu("%", data)) {
-        outArg = arg_setInt(outArg, "", num1_i % num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu("**", data)) {
-        float res = 1;
-        for (int i = 0; i < num2_i; i++) {
-            res = res * num1_f;
-        }
-        outArg = arg_setFloat(outArg, "", res);
-        goto OPT_exit;
-    }
-    if (strEqu("//", data)) {
-        outArg = arg_setInt(outArg, "", num1_i / num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu("==", data)) {
-        /* string compire */
-        if ((type_arg1 == TYPE_STRING) && (type_arg2 == TYPE_STRING)) {
-            outArg = arg_setInt(outArg, "",
-                                strEqu(arg_getStr(arg1), arg_getStr(arg2)));
-            goto OPT_exit;
-        }
-        /* default: int and float */
-        outArg =
-            arg_setInt(outArg, "",
-                       (num1_f - num2_f) * (num1_f - num2_f) < (float)0.000001);
-        goto OPT_exit;
-    }
-    if (strEqu("!=", data)) {
-        outArg = arg_setInt(
-            outArg, "",
-            !((num1_f - num2_f) * (num1_f - num2_f) < (float)0.000001));
-        goto OPT_exit;
-    }
-    if (strEqu(">=", data)) {
-        outArg = arg_setInt(
-            outArg, "",
-            (num1_f > num2_f) ||
-                ((num1_f - num2_f) * (num1_f - num2_f) < (float)0.000001));
-        goto OPT_exit;
-    }
-    if (strEqu("<=", data)) {
-        outArg = arg_setInt(
-            outArg, "",
-            (num1_f < num2_f) ||
-                ((num1_f - num2_f) * (num1_f - num2_f) < (float)0.000001));
-        goto OPT_exit;
-    }
-    if (strEqu("&", data)) {
-        outArg = arg_setInt(outArg, "", num1_i & num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu("|", data)) {
-        outArg = arg_setInt(outArg, "", num1_i | num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu("~", data)) {
-        outArg = arg_setInt(outArg, "", ~num1_i);
-        goto OPT_exit;
-    }
-    if (strEqu(">>", data)) {
-        outArg = arg_setInt(outArg, "", num1_i >> num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu("<<", data)) {
-        outArg = arg_setInt(outArg, "", num1_i << num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu(" and ", data)) {
-        outArg = arg_setInt(outArg, "", num1_i && num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu(" or ", data)) {
-        outArg = arg_setInt(outArg, "", num1_i || num2_i);
-        goto OPT_exit;
-    }
-    if (strEqu(" not ", data)) {
-        outArg = arg_setInt(outArg, "", !num1_i);
-        goto OPT_exit;
-    }
-OPT_exit:
-    arg_deinit(arg1);
-    arg_deinit(arg2);
-    if (NULL != outArg) {
-        return outArg;
-    }
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_DEF(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    char* methodPtr = vmState->pc;
-    int offset = 0;
-    int thisBlockDeepth =
-        getThisBlockDeepth(vmState->ASM_start, vmState->pc, &offset);
-    while (1) {
-        if ((methodPtr[0] == 'B') &&
-            (methodPtr[1] - '0' == thisBlockDeepth + 1)) {
-            class_defineMethod(self, data, (Method)methodPtr);
-            break;
-        }
-        offset += gotoNextLine(methodPtr);
-        methodPtr = vmState->pc + offset;
-    }
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_RET(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    /* exit jmp signal */
-    vmState->jmp = -999;
-    Arg* returnArg = arg_copy(queue_popArg(vmState->q0));
-    method_returnArg(vmState->locals->list, returnArg);
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_NEL(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    int offset = 0;
-    int thisBlockDeepth =
-        getThisBlockDeepth(vmState->ASM_start, vmState->pc, &offset);
-    char __else[] = "__else0";
-    __else[6] = '0' + thisBlockDeepth;
-    if (0 == args_getInt(self->list, __else)) {
-        /* set __else flag */
-        vmState->jmp = fast_atoi(data);
-    }
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_DEL(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    obj_removeArg(vmState->locals, data);
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_EST(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    Arg* arg = obj_getArg(vmState->locals, data);
-    if (arg == NULL) {
-        return arg_setInt(NULL, "", 0);
-    }
-    if (TYPE_NULL == arg_getType(arg)) {
-        return arg_setInt(NULL, "", 0);
-    }
-    return arg_setInt(NULL, "", 1);
-}
-
-static Arg* VM_instruction_handler_BRK(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    /* break jmp signal */
-    vmState->jmp = -998;
-    return NULL;
-}
-
-static Arg* VM_instruction_handler_CTN(PikaObj* self,
-                                       struct VM_State_t* vmState,
-                                       char* data) {
-    /* continue jmp signal */
-    vmState->jmp = -997;
-    return NULL;
-}
-
-const VM_instruct_handler VM_instruct_handler_table[__INSTRCUTION_CNT] = {
-
-#define __INS_TABLE
-#include "__instruction_table.cfg"
-};
-
-static char* strs_getLine(Args* buffs, char* code) {
-    int32_t lineSize = getLineSize(code);
-    char* line = args_getBuff(buffs, lineSize + 1);
-    __platform_memcpy(line, code, lineSize);
-    line[lineSize + 1] = 0;
-    return line;
-}
-
-static enum Instruct getInstruct(char* line) {
-#define __INS_COMPIRE
-#include "__instruction_table.cfg"
-    return NON;
-}
-
-int32_t __clearInvokeQueues(VM_Parameters* locals) {
-    for (char deepthChar = '0'; deepthChar < '9'; deepthChar++) {
-        char deepth[2] = {0};
-        deepth[0] = deepthChar;
-        Queue* queue = (Queue*)args_getPtr(locals->list, deepth);
-        if (NULL != queue) {
-            args_deinit(queue);
-            args_removeArg(locals->list, args_getArg(locals->list, deepth));
-        }
-    }
-    return 0;
-}
-
-int32_t gotoNextLine(char* code) {
-    int offset = 0;
-    while (1) {
-        if (code[offset] == '\n') {
-            break;
-        }
-        offset++;
-    }
-    return offset + 1;
-}
-
-int32_t gotoLastLine(char* start, char* code) {
-    int offset = -2;
-    while (1) {
-        char* codeNow = code + offset;
-        if (codeNow == start) {
-            offset--;
-            break;
-        }
-        if (codeNow[0] == '\n') {
-            break;
-        }
-        offset--;
-    }
-    return offset + 1;
-}
-
-int getThisBlockDeepth(char* start, char* code, int* offset) {
-    int thisBlockDeepth = -1;
-    char* codeNow = code + *offset;
-    while (1) {
-        *offset += gotoLastLine(start, codeNow);
-        codeNow = code + *offset;
-        if (codeNow[0] == 'B') {
-            thisBlockDeepth = codeNow[1] - '0';
-            break;
-        }
-    }
-    return thisBlockDeepth;
-}
-
-int32_t getAddrOffsetOfJUM(char* code) {
-    int offset = 0;
-    char* codeNow = code + offset;
-    while (1) {
-        offset += gotoNextLine(codeNow);
-        codeNow = code + offset;
-        if (0 == strncmp(codeNow, "0 JMP -1", 8)) {
-            return offset;
-        }
-    }
-}
-
-int32_t getAddrOffsetFromJmp(char* start, char* code, int32_t jmp) {
-    int offset = 0;
-    int thisBlockDeepth = getThisBlockDeepth(start, code, &offset);
-    char* codeNow = code + offset;
-    int8_t blockNum = 0;
-    if (jmp > 0) {
-        offset = 0;
-        codeNow = code + offset;
-        while (1) {
-            offset += gotoNextLine(codeNow);
-            codeNow = code + offset;
-            if (codeNow[0] == 'B') {
-                uint8_t blockDeepth = codeNow[1] - '0';
-                if (blockDeepth <= thisBlockDeepth) {
-                    blockNum++;
-                }
-            }
-            if (blockNum >= jmp) {
-                break;
-            }
-        }
-    }
-    if (jmp < 0) {
-        while (1) {
-            offset += gotoLastLine(start, codeNow);
-            codeNow = code + offset;
-            if (codeNow[0] == 'B') {
-                uint8_t blockDeepth = codeNow[1] - '0';
-                if (blockDeepth == thisBlockDeepth) {
-                    blockNum--;
-                }
-            }
-            if (blockNum <= jmp) {
-                break;
-            }
-        }
-    }
-    return offset;
-}
-
-int32_t pikaVM_runAsmLine(PikaObj* self,
-                          VM_Parameters* locals,
-                          VM_Parameters* globals,
-                          char* pikaAsm,
-                          int32_t lineAddr) {
-    Args* buffs = New_strBuff();
-    VM_State vmState = {
-        .locals = locals,
-        .globals = globals,
-        .q0 = NULL,
-        .q1 = NULL,
-        .jmp = 0,
-        .pc = pikaAsm + lineAddr,
-        .ASM_start = pikaAsm,
-    };
-    char* line = strs_getLine(buffs, vmState.pc);
-    int32_t nextAddr = lineAddr + strGetSize(line) + 1;
-    enum Instruct instruct;
-    char invokeDeepth0[2] = {0}, invokeDeepth1[2] = {0};
-    char* data;
-    Arg* resArg;
-
-    /* Found new script Line, clear the queues*/
-    if ('B' == line[0]) {
-        args_setErrorCode(locals->list, 0);
-        args_setSysOut(locals->list, (char*)"");
-        __clearInvokeQueues(locals);
-        goto nextLine;
-    }
-    invokeDeepth0[0] = line[0];
-    invokeDeepth1[0] = line[0] + 1;
-    instruct = getInstruct(line);
-    data = line + 6;
-
-    vmState.q0 = args_getPtr(locals->list, invokeDeepth0);
-    vmState.q1 = args_getPtr(locals->list, invokeDeepth1);
-    if (NULL == vmState.q0) {
-        vmState.q0 = New_queue();
-        args_setPtr(locals->list, invokeDeepth0, vmState.q0);
-    }
-    if (NULL == vmState.q1) {
-        vmState.q1 = New_queue();
-        args_setPtr(locals->list, invokeDeepth1, vmState.q1);
-    }
-    /* run instruct */
-    resArg = VM_instruct_handler_table[instruct](self, &vmState, data);
-    if (NULL != resArg) {
-        queue_pushArg(vmState.q0, resArg);
-    }
-    goto nextLine;
-nextLine:
-    args_deinit(buffs);
-    /* exit */
-    if (-999 == vmState.jmp) {
-        return -99999;
-    }
-    /* break or continue */
-    if ((-998 == vmState.jmp) || (-997 == vmState.jmp)) {
-        int32_t loop_end_addr = getAddrOffsetOfJUM(vmState.pc);
-        /* break */
-        if (-998 == vmState.jmp) {
-            loop_end_addr += gotoNextLine(vmState.pc + loop_end_addr);
-            return lineAddr + loop_end_addr;
-        }
-        if (-997 == vmState.jmp) {
-            loop_end_addr += gotoLastLine(pikaAsm, vmState.pc + loop_end_addr);
-            return lineAddr + loop_end_addr;
-        }
-    }
-    if (vmState.jmp != 0) {
-        return lineAddr +
-               getAddrOffsetFromJmp(pikaAsm, vmState.pc, vmState.jmp);
-    }
-    return nextAddr;
-}
-
-char* useFlashAsBuff(char* pikaAsm, Args* buffs) {
-    /* not write flash when asm is old */
-    if (strEqu(pikaAsm, __platform_load_pikaAsm())) {
-        args_deinit(buffs);
-        buffs = NULL;
-        return __platform_load_pikaAsm();
-    }
-    /* write flash */
-    if (0 == __platform_save_pikaAsm(pikaAsm)) {
-        args_deinit(buffs);
-        buffs = NULL;
-        return __platform_load_pikaAsm();
-    }
-    return pikaAsm;
-}
-
-VM_Parameters* pikaVM_runAsmWithPars(PikaObj* self,
-                                     VM_Parameters* locals,
-                                     VM_Parameters* globals,
-                                     char* pikaAsm) {
-    int lineAddr = 0;
-    int size = strGetSize(pikaAsm);
-    args_setErrorCode(locals->list, 0);
-    args_setSysOut(locals->list, (char*)"");
-    while (lineAddr < size) {
-        if (lineAddr == -99999) {
-            break;
-        }
-        char* thisLine = pikaAsm + lineAddr;
-        lineAddr = pikaVM_runAsmLine(self, locals, globals, pikaAsm, lineAddr);
-        char* sysOut = args_getSysOut(locals->list);
-        uint8_t errcode = args_getErrorCode(locals->list);
-        if (!strEqu("", sysOut)) {
-            __platform_printf("%s\r\n", sysOut);
-        }
-        if (0 != errcode) {
-            Args* buffs = New_strBuff();
-            char* onlyThisLine = strsGetFirstToken(buffs, thisLine, '\n');
-            __platform_printf("[info] input commond: %s\r\n", onlyThisLine);
-            args_deinit(buffs);
-        }
-    }
-    __clearInvokeQueues(locals);
-
-    return locals;
-}
-
-VM_Parameters* pikaVM_runAsm(PikaObj* self, char* pikaAsm) {
-    return pikaVM_runAsmWithPars(self, self, self, pikaAsm);
-}
-
-VM_Parameters* pikaVM_run(PikaObj* self, char* multiLine) {
-    Args* buffs = New_strBuff();
-    VM_Parameters* globals = NULL;
-    char* pikaAsm = Parser_multiLineToAsm(buffs, multiLine);
-    if (NULL == pikaAsm) {
-        __platform_printf("[error]: Syntax error.\r\n");
-        globals = NULL;
-        goto exit;
-    }
-    globals = pikaVM_runAsm(self, pikaAsm);
-    goto exit;
-exit:
-    if (NULL != buffs) {
-        args_deinit(buffs);
-    }
-    return globals;
-}

+ 0 - 49
bsp/TC264D/PikaScript/pikascript-core/PikaVM.h

@@ -1,49 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __PIKA__VM__H
-#define __PIKA__VM__H
-#include "PikaObj.h"
-
-VM_Parameters* pikaVM_run(PikaObj* self, char* pyLine);
-VM_Parameters* pikaVM_runAsm(PikaObj* self, char* pikaAsm);
-VM_Parameters* pikaVM_runAsmWithPars(PikaObj* self,
-                                  VM_Parameters* locals,
-                                  VM_Parameters* globals,
-                                  char* pikaAsm);
-
-int32_t __clearInvokeQueues(VM_Parameters* locals);
-char* useFlashAsBuff(char* pikaAsm, Args* buffs);
-int32_t gotoNextLine(char* code);
-int32_t gotoLastLine(char* start, char* code);
-int getThisBlockDeepth(char* start, char* code, int* offset);
-int32_t pikaVM_runAsmLine(PikaObj* self,
-                          VM_Parameters* locals,
-                          VM_Parameters* globals,
-                          char* pikaAsm,
-                          int32_t lineAddr);
-#endif

+ 0 - 1
bsp/TC264D/PikaScript/pikascript-core/README.md

@@ -1 +0,0 @@
-# PikaScript 运行时内核

+ 0 - 41
bsp/TC264D/PikaScript/pikascript-core/TinyObj.c

@@ -1,41 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "PikaObj.h"
-
-void _UpdateHandle(PikaObj* self) {
-    // override the handle function here
-}
-
-void _beforDinit(PikaObj* self) {
-    /* override in user code */
-}
-
-PikaObj* New_TinyObj(Args* args) {
-    PikaObj* self = New_PikaObj();
-    return self;
-}

+ 0 - 32
bsp/TC264D/PikaScript/pikascript-core/TinyObj.h

@@ -1,32 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __TYNYOBJ__H
-#define __TYNYOBJ__H
-#include "PikaObj.h"
-PikaObj* New_TinyObj(Args* args);
-#endif

+ 0 - 47
bsp/TC264D/PikaScript/pikascript-core/__instruction_def.h

@@ -1,47 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 GorgonMeducer ?? embedded_zhuoran@hotmail.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#undef def_ins
-
-#if defined(__INS_ENUM)
-#define def_ins(__INS_NAME) __INS_NAME,
-#endif
-
-#if defined(__INS_TABLE)
-#define def_ins(__INS_NAME) [__INS_NAME] = &VM_instruction_handler_##__INS_NAME,
-#endif
-
-#if defined(__INS_COMPIRE)
-#define def_ins(__INS_NAME) \
-    if (0 == strncmp(line + 2, ""#__INS_NAME"", 3)) { \
-        return __INS_NAME; \
-    } 
-#endif
-
-#undef __INS_ENUM
-#undef __INS_IMPL
-#undef __INS_TABLE

+ 0 - 45
bsp/TC264D/PikaScript/pikascript-core/__instruction_table.cfg

@@ -1,45 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 GorgonMeducer ?? embedded_zhuoran@hotmail.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "__instruction_def.h"
- 
-def_ins(NON)
-def_ins(REF)
-def_ins(RUN)
-def_ins(STR)
-def_ins(OUT)
-def_ins(NUM)
-def_ins(JMP)
-def_ins(JEZ)
-def_ins(OPT)
-def_ins(DEF)
-def_ins(RET)
-def_ins(NEL)
-def_ins(DEL)
-def_ins(EST)
-def_ins(BRK)
-def_ins(CTN)

+ 0 - 34
bsp/TC264D/PikaScript/pikascript-core/__pika_ooc.h

@@ -1,34 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon ?? liang6516@outlook.com
- * Copyright (c) 2021 Gorgon Meducer ?? embedded_zhuoran@hotmail.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __PIKA_OOC_H__
-#define __PIKA_OOC_H__
-
-// #include "./3rd-party/PLOOC/plooc_class.h"
-
-#endif

+ 0 - 379
bsp/TC264D/PikaScript/pikascript-core/dataArg.c

@@ -1,379 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataArg.h"
-#include "dataArgs.h"
-#include "dataMemory.h"
-#include "dataString.h"
-#include "stdlib.h"
-
-void arg_deinit(Arg* self) {
-    arg_freeContent(self);
-}
-
-uint16_t arg_getTotleSize(Arg* self) {
-    return content_totleSize(self);
-}
-
-uint16_t content_sizeOffset(uint8_t* self) {
-    const uint8_t nextLength = sizeof(uint8_t*);
-    return nextLength;
-}
-
-uint16_t content_getSize(uint8_t* self) {
-    uint32_t* p_size =
-        (uint32_t*)((uintptr_t)self + (uintptr_t)content_sizeOffset(self));
-    return (uint16_t)*p_size;
-}
-
-void content_setNext(uint8_t* self, uint8_t* next) {
-    uint8_t* nextDir = self + content_nextOffset(self);
-    uintptr_t* p_next = (uintptr_t*)nextDir;
-    *p_next = (uintptr_t)next;
-}
-
-/**
- * time33 hash
- */
-Hash hash_time33(char* str) {
-    Hash hash = 5381;
-    while (*str) {
-        hash += (hash << 5) + (*str++);
-    }
-    return (hash & 0x7FFFFFFF);
-}
-
-uint8_t* content_init_hash(Hash nameHash,
-                           ArgType type,
-                           uint8_t* content,
-                           uint32_t size,
-                           uint8_t* next) {
-    const uint8_t nextLength = sizeof(uint8_t*);
-    const uint8_t sizeLength = sizeof(uint32_t);
-    uint16_t nameSize = sizeof(Hash);     // use hash
-    uint16_t typeSize = sizeof(ArgType);  // use enum
-    uint8_t* self = (uint8_t*)pikaMalloc(nextLength + sizeLength + nameSize +
-                                         size + typeSize);
-
-    uint8_t* nextDir = self;
-    uint8_t* sizeDir = nextDir + nextLength;
-    uint8_t* nameDir = sizeDir + sizeLength;
-    uint8_t* contentDir = nameDir + nameSize;
-    uint8_t* typeDir = contentDir + size;
-
-    // __platform_memcpy(nameDir, &nameHash, nameSize);  // use hash
-    *(Hash*)nameDir = nameHash;
-    __platform_memcpy(typeDir, &type, typeSize);
-    uint32_t* p_size = (uint32_t*)sizeDir;
-    *p_size = size;
-    if (NULL != content) {
-        __platform_memcpy(contentDir, content, size);
-    } else {
-        __platform_memset(contentDir, 0, size);
-    }
-
-    uintptr_t* p_next = (uintptr_t*)nextDir;
-    *p_next = (uintptr_t)next;
-    return self;
-}
-
-uint8_t* content_init(char* name,
-                      ArgType type,
-                      uint8_t* content,
-                      uint16_t size,
-                      uint8_t* next) {
-    Hash nameHash = hash_time33(name);
-    return content_init_hash(nameHash, type, content, size, next);
-}
-
-uint16_t content_totleSize(uint8_t* self) {
-    const uint8_t size_size = sizeof(uint32_t);
-    const uint8_t size_next = sizeof(uint8_t*);
-    const uint8_t size_type = sizeof(ArgType);
-    const uint8_t size_hash = sizeof(Hash);
-    uint16_t size_content = content_getSize(self);
-    return size_content + size_hash + size_type + size_size + size_next;
-}
-
-void arg_freeContent(Arg* self) {
-    if (NULL != self) {
-        content_deinit(self);
-    }
-}
-
-uint8_t content_nameOffset(uint8_t* self) {
-    const uint8_t nextLength = sizeof(uint8_t*);
-    const uint8_t sizeLength = sizeof(uint32_t);
-    return nextLength + sizeLength;
-}
-
-Hash content_getNameHash(uint8_t* self) {
-    return *(Hash*)((uintptr_t)self + (uintptr_t)content_nameOffset(self));
-}
-
-uint8_t* content_deinit(uint8_t* self) {
-    uint16_t totleSize = content_totleSize(self);
-    pikaFree(self, totleSize);
-    return 0;
-}
-
-uint8_t* content_setContent(uint8_t* self, uint8_t* content, uint16_t size) {
-    if (NULL == self) {
-        return content_init("", TYPE_NONE, content, size, NULL);
-    }
-    Hash nameHash = content_getNameHash(self);
-    ArgType type = content_getType(self);
-    uint8_t* next = content_getNext(self);
-    uint8_t* newContent =
-        content_init_hash(nameHash, type, content, size, next);
-    content_deinit(self);
-    return newContent;
-}
-
-uint8_t* content_setNameHash(uint8_t* self, Hash nameHash) {
-    if (NULL == self) {
-        return content_init_hash(nameHash, TYPE_NONE, NULL, 0, NULL);
-    }
-    ArgType type = content_getType(self);
-    uint8_t* content = content_getContent(self);
-    uint16_t size = content_getSize(self);
-    uint8_t* next = content_getNext(self);
-    uint8_t* newContent =
-        content_init_hash(nameHash, type, content, size, next);
-    content_deinit(self);
-    return newContent;
-}
-
-uint8_t* content_setName(uint8_t* self, char* name) {
-    if (NULL == self) {
-        return content_init(name, TYPE_NONE, NULL, 0, NULL);
-    }
-    ArgType type = content_getType(self);
-    uint8_t* content = content_getContent(self);
-    uint16_t size = content_getSize(self);
-    uint8_t* next = content_getNext(self);
-    uint8_t* newContent = content_init(name, type, content, size, next);
-    content_deinit(self);
-    return newContent;
-}
-
-uint8_t* content_setType(uint8_t* self, ArgType type) {
-    if (NULL == self) {
-        return content_init("", type, NULL, 0, NULL);
-    }
-    Hash nameHash = content_getNameHash(self);
-    uint8_t* content = content_getContent(self);
-    uint16_t size = content_getSize(self);
-    uint8_t* next = content_getNext(self);
-    uint8_t* newContent =
-        content_init_hash(nameHash, type, content, size, next);
-    content_deinit(self);
-    return newContent;
-}
-
-Arg* arg_newContent(Arg* self, uint32_t size) {
-    uint8_t* newContent = content_init("", TYPE_NONE, NULL, size, NULL);
-    arg_freeContent(self);
-    return newContent;
-}
-
-Arg* arg_setContent(Arg* self, uint8_t* content, uint32_t size) {
-    return content_setContent(self, content, size);
-}
-
-Arg* arg_setName(Arg* self, char* name) {
-    return content_setName(self, name);
-}
-
-Arg* arg_setNameHash(Arg* self, Hash nameHash) {
-    return content_setNameHash(self, nameHash);
-}
-
-Arg* arg_setType(Arg* self, ArgType type) {
-    return content_setType(self, type);
-}
-
-ArgType content_getType(uint8_t* self) {
-    void* type_ptr = (uint8_t*)self + content_typeOffset(self);
-    ArgType type;
-    __platform_memcpy(&type, type_ptr, sizeof(ArgType));
-    return type;
-}
-
-uint16_t content_contentOffset(uint8_t* self) {
-    const uint8_t nextLength = sizeof(uint8_t*);
-    const uint8_t sizeLength = sizeof(uint32_t);
-    return nextLength + sizeLength + sizeof(Hash);
-}
-
-uint16_t content_nextOffset(uint8_t* self) {
-    return 0;
-}
-
-uint8_t* content_getNext(uint8_t* self) {
-    uintptr_t* nextDir =
-        (uintptr_t*)((uintptr_t)self + (uintptr_t)content_nextOffset(self));
-    return (uint8_t*)*nextDir;
-}
-
-uint8_t* content_getContent(uint8_t* self) {
-    return self + content_contentOffset(self);
-}
-
-uint8_t* arg_getContent(Arg* self) {
-    return content_getContent(self);
-}
-
-Arg* arg_setInt(Arg* self, char* name, int64_t val) {
-    int64_t int64Temp = val;
-    uint8_t contentBuff[8];
-    for (uint32_t i = 0; i < 4; i++) {
-        // add 0x30 to void \0
-        contentBuff[i] = int64Temp;
-        int64Temp = int64Temp >> 8;
-    }
-    return content_init(name, TYPE_INT, contentBuff, 4, NULL);
-}
-
-Arg* arg_setNull(Arg* self) {
-    return content_init("", TYPE_NULL, NULL, 0, NULL);
-}
-
-Arg* arg_setFloat(Arg* self, char* name, float val) {
-    uint8_t contentBuff[4];
-    uint8_t* valPtr = (uint8_t*)&val;
-    for (uint32_t i = 0; i < 4; i++) {
-        // add 0x30 to void \0
-        contentBuff[i] = valPtr[i];
-    }
-    return content_init(name, TYPE_FLOAT, contentBuff, 4, NULL);
-}
-
-float arg_getFloat(Arg* self) {
-    if (NULL == arg_getContent(self)) {
-        return -999.999;
-    }
-
-    float valOut = 0;
-    uint8_t* valOutPtr = (uint8_t*)(&valOut);
-    uint8_t* valPtr = arg_getContent(self);
-    for (uint32_t i = 0; i < 4; i++) {
-        valOutPtr[i] = valPtr[i];
-    }
-    return valOut;
-}
-
-Arg* arg_setPtr(Arg* self, char* name, ArgType type, void* pointer) {
-    uint64_t pointerTemp = (uintptr_t)pointer;
-    uint8_t contentBuff[8];
-    for (uint32_t i = 0; i < sizeof(uint8_t*); i++) {
-        // aboid \0
-        contentBuff[i] = pointerTemp;
-        pointerTemp = pointerTemp >> 8;
-    }
-    return content_init(name, type, contentBuff, sizeof(uint8_t*), NULL);
-}
-
-Arg* arg_setStr(Arg* self, char* name, char* string) {
-    return content_init(name, TYPE_STRING, (uint8_t*)string,
-                        strGetSize(string) + 1, NULL);
-}
-
-int64_t arg_getInt(Arg* self) {
-    if (NULL == arg_getContent(self)) {
-        return -999999;
-    }
-    int64_t int64Temp = 0;
-    for (int32_t i = 3; i > -1; i--) {
-        // add 0x30 to avoid 0
-        int64Temp = (int64Temp << 8);
-        int64Temp += arg_getContent(self)[i];
-    }
-    return int64Temp;
-}
-
-void* arg_getPtr(Arg* self) {
-    void* pointer = NULL;
-    uint64_t pointerTemp = 0;
-    if (NULL == arg_getContent(self)) {
-        return NULL;
-    }
-    uint8_t* content = arg_getContent(self);
-    for (int32_t i = sizeof(uint8_t*) - 1; i > -1; i--) {
-        // avoid \0
-        uint8_t val = content[i];
-        pointerTemp = (pointerTemp << 8);
-        pointerTemp += val;
-    }
-    pointer = (void*)(uintptr_t)pointerTemp;
-    return pointer;
-}
-char* arg_getStr(Arg* self) {
-    return (char*)arg_getContent(self);
-}
-
-uint16_t content_typeOffset(uint8_t* self) {
-    const uint8_t nextLength = sizeof(uint8_t*);
-    const uint8_t sizeLength = sizeof(uint32_t);
-    uint16_t size = content_getSize(self);
-    uint16_t nameSize = sizeof(Hash);
-    return nextLength + sizeLength + nameSize + size;
-}
-
-Hash arg_getNameHash(Arg* self) {
-    if (NULL == self) {
-        return 999999;
-    }
-    return content_getNameHash(self);
-}
-
-ArgType arg_getType(Arg* self) {
-    if (NULL == self) {
-        return TYPE_NONE;
-    }
-    return content_getType(self);
-}
-
-uint16_t arg_getContentSize(Arg* self) {
-    return content_getSize(self);
-}
-
-Arg* New_arg(void* voidPointer) {
-    return NULL;
-}
-
-Arg* arg_copy(Arg* argToBeCopy) {
-    if (NULL == argToBeCopy) {
-        return NULL;
-    }
-    Arg* argCopied = New_arg(NULL);
-    argCopied = arg_setContent(argCopied, arg_getContent(argToBeCopy),
-                               arg_getContentSize(argToBeCopy));
-    argCopied = arg_setNameHash(argCopied, arg_getNameHash(argToBeCopy));
-    argCopied = arg_setType(argCopied, arg_getType(argToBeCopy));
-    return argCopied;
-}

+ 0 - 101
bsp/TC264D/PikaScript/pikascript-core/dataArg.h

@@ -1,101 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _arg__H
-#define _arg__H
-#include "dataMemory.h"
-
-typedef uint8_t Arg;
-typedef uint32_t Hash;
-typedef enum {
-    TYPE_NONE,
-    TYPE_OBJECT,
-    TYPE_INT,
-    TYPE_FLOAT,
-    TYPE_METHOD,
-    TYPE_POINTER,
-    TYPE_MATE_OBJECT,
-    TYPE_STRING,
-    TYPE_NULL,
-} ArgType;
-
-uint16_t content_typeOffset(uint8_t* content);
-uint16_t content_contentOffset(uint8_t* content);
-uint16_t content_sizeOffset(uint8_t* self);
-uint16_t content_contentOffset(uint8_t* self);
-uint16_t content_nextOffset(uint8_t* self);
-uint8_t content_nameOffset(uint8_t* self);
-
-uint32_t content_getNameHash(uint8_t* content);
-ArgType content_getType(uint8_t* self);
-uint8_t* content_getNext(uint8_t* self);
-uint16_t content_getSize(uint8_t* self);
-uint8_t* content_getContent(uint8_t* content);
-
-uint16_t content_totleSize(uint8_t* self);
-
-uint8_t* content_init(char* name,
-                      ArgType type,
-                      uint8_t* content,
-                      uint16_t size,
-                      uint8_t* next);
-uint8_t* content_deinit(uint8_t* self);
-uint8_t* content_setName(uint8_t* self, char* name);
-uint8_t* content_setType(uint8_t* self, ArgType type);
-uint8_t* content_setContent(uint8_t* self, uint8_t* content, uint16_t size);
-void content_setNext(uint8_t* self, uint8_t* next);
-
-uint16_t arg_getTotleSize(Arg* self);
-void arg_freeContent(Arg* self);
-
-Arg* arg_setName(Arg* self, char* name);
-Arg* arg_setContent(Arg* self, uint8_t* content, uint32_t size);
-Arg* arg_newContent(Arg* self, uint32_t size);
-Arg* arg_setType(Arg* self, ArgType type);
-Hash arg_getNameHash(Arg* self);
-ArgType arg_getType(Arg* self);
-uint8_t* arg_getContent(Arg* self);
-uint16_t arg_getContentSize(Arg* self);
-Hash hash_time33(char* str);
-
-Arg* arg_setInt(Arg* self, char* name, int64_t val);
-Arg* arg_setFloat(Arg* self, char* name, float val);
-Arg* arg_setPtr(Arg* self, char* name, ArgType type, void* pointer);
-Arg* arg_setStr(Arg* self, char* name, char* string);
-Arg* arg_setNull(Arg* self);
-
-int64_t arg_getInt(Arg* self);
-float arg_getFloat(Arg* self);
-void* arg_getPtr(Arg* self);
-char* arg_getStr(Arg* self);
-Arg* arg_copy(Arg* argToBeCopy);
-
-Arg* arg_init(Arg* self, void* voidPointer);
-void arg_deinit(Arg* self);
-
-Arg* New_arg(void* voidPointer);
-#endif

+ 0 - 421
bsp/TC264D/PikaScript/pikascript-core/dataArgs.c

@@ -1,421 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataArgs.h"
-#include "PikaObj.h"
-#include "PikaPlatform.h"
-#include "dataLink.h"
-#include "dataMemory.h"
-#include "dataString.h"
-#include "dataStrs.h"
-
-void args_deinit(Args* self) {
-    link_deinit(self);
-}
-
-int32_t args_setFloat(Args* self, char* name, float argFloat) {
-    Arg* argNew = New_arg(NULL);
-    argNew = arg_setFloat(argNew, name, argFloat);
-    args_setArg(self, argNew);
-    return 0;
-}
-
-void* args_getPtr(Args* self, char* name) {
-    void* pointer = NULL;
-    Arg* arg = args_getArg(self, name);
-    if (NULL == arg) {
-        return NULL;
-    }
-
-    pointer = arg_getPtr(arg);
-    return pointer;
-}
-
-int32_t args_setPtr(Args* self, char* name, void* argPointer) {
-    int32_t errCode = 0;
-    Arg* argNew = New_arg(NULL);
-    argNew = arg_setPtr(argNew, name, TYPE_POINTER, argPointer);
-    args_setArg(self, argNew);
-    return errCode;
-}
-
-int32_t args_setStr(Args* self, char* name, char* strIn) {
-    int32_t errCode = 0;
-    Arg* argNew = New_arg(NULL);
-    argNew = arg_setStr(argNew, name, strIn);
-    args_setArg(self, argNew);
-    return errCode;
-}
-
-int args_pushArg(Args* self, Arg* arg) {
-    link_addNode(self, arg);
-    return 0;
-}
-
-char* args_getBuff(Args* self, int32_t size) {
-    Arg* argNew = New_arg(NULL);
-    argNew = arg_newContent(argNew, size + 1);
-    args_pushArg(self, argNew);
-    return (char*)arg_getContent(argNew);
-}
-
-char* args_getStr(Args* self, char* name) {
-    if (NULL == self) {
-        return NULL;
-    }
-    Arg* arg = args_getArg(self, name);
-    if (NULL == arg) {
-        return NULL;
-    }
-    if (NULL == arg_getContent(arg)) {
-        return NULL;
-    }
-    return (char*)arg_getContent(arg);
-}
-
-int32_t args_setInt(Args* self, char* name, int64_t int64In) {
-    Arg* argNew = New_arg(NULL);
-    argNew = arg_setInt(argNew, name, int64In);
-    args_setArg(self, argNew);
-    return 0;
-}
-
-int64_t args_getInt(Args* self, char* name) {
-    Arg* arg = args_getArg(self, name);
-    if (NULL == arg) {
-        return -999999999;
-    }
-    ArgType arg_type = arg_getType(arg);
-    if (arg_type == TYPE_INT) {
-        return arg_getInt(arg);
-    } else if (arg_type == TYPE_FLOAT) {
-        return (int)arg_getFloat(arg);
-    }
-    return -999999999;
-}
-
-int32_t args_getSize(Args* self) {
-    return link_getSize(self);
-}
-
-ArgType args_getType(Args* self, char* name) {
-    Arg* arg = NULL;
-    arg = args_getArg(self, name);
-    if (NULL == arg) {
-        return TYPE_NONE;
-    }
-    return arg_getType(arg);
-}
-
-float args_getFloat(Args* self, char* name) {
-    Arg* arg = args_getArg(self, name);
-    if (NULL == arg) {
-        return -999999999.0;
-    }
-    ArgType arg_type = arg_getType(arg);
-    if (arg_type == TYPE_FLOAT) {
-        return arg_getFloat(arg);
-    } else if (arg_type == TYPE_INT) {
-        return (float)arg_getInt(arg);
-    }
-    return -999999999.0;
-}
-
-int32_t args_copyArg(Args* self, Arg* argToBeCopy) {
-    if (NULL == argToBeCopy) {
-        return 1;
-    }
-    Arg* argCopied = arg_copy(argToBeCopy);
-    args_setArg(self, argCopied);
-
-    return 0;
-}
-
-int32_t args_setStruct(Args* self,
-                       char* name,
-                       void* struct_ptr,
-                       uint32_t struct_size) {
-    if (NULL == struct_ptr) {
-        return 1;
-    }
-    Arg* struct_arg = arg_setContent(NULL, (uint8_t*)struct_ptr, struct_size);
-    struct_arg = arg_setName(struct_arg, name);
-    args_setArg(self, struct_arg);
-    return 0;
-}
-
-void* args_getStruct(Args* self, char* name, void* struct_out) {
-    Arg* struct_arg = args_getArg(self, name);
-    uint32_t struct_size = arg_getContentSize(struct_arg);
-    return __platform_memcpy(struct_out, arg_getContent(struct_arg),
-                             struct_size);
-}
-
-int32_t args_copyArgByName(Args* self, char* name, Args* directArgs) {
-    Arg* argToBeCopy = args_getArg(self, name);
-    args_copyArg(directArgs, argToBeCopy);
-    return 0;
-}
-
-int32_t args_isArgExist_hash(Args* self, Hash nameHash) {
-    if (NULL != args_getArg_hash(self, nameHash)) {
-        return 1;
-    }
-    return 0;
-}
-
-int32_t args_isArgExist(Args* self, char* name) {
-    if (NULL != args_getArg(self, name)) {
-        return 1;
-    }
-    return 0;
-}
-
-int32_t __updateArg(Args* self, Arg* argNew) {
-    LinkNode* nodeToUpdate = NULL;
-    LinkNode* nodeNow = self->firstNode;
-    LinkNode* priorNode = NULL;
-    Hash nameHash = arg_getNameHash(argNew);
-    while (1) {
-        if (content_getNameHash(nodeNow) == nameHash) {
-            nodeToUpdate = nodeNow;
-            break;
-        }
-        if (content_getNext(nodeNow) == NULL) {
-            // error, node no found
-            goto exit;
-        }
-        priorNode = nodeNow;
-        nodeNow = content_getNext(nodeNow);
-    }
-    /* free the object */
-    if (TYPE_OBJECT == arg_getType(nodeToUpdate)) {
-        PikaObj* obj = arg_getPtr(nodeToUpdate);
-        obj_deinit(obj);
-    }
-    nodeToUpdate = arg_setContent(nodeToUpdate, arg_getContent(argNew),
-                                  arg_getContentSize(argNew));
-
-    nodeToUpdate = arg_setType(nodeToUpdate, arg_getType(argNew));
-    // update privior link, because arg_getContent would free origin pointer
-    if (NULL == priorNode) {
-        self->firstNode = nodeToUpdate;
-        goto exit;
-    }
-
-    content_setNext(priorNode, nodeToUpdate);
-    goto exit;
-exit:
-    arg_deinit(argNew);
-    return 0;
-}
-
-int32_t args_setArg(Args* self, Arg* arg) {
-    Hash nameHash = arg_getNameHash(arg);
-    if (!args_isArgExist_hash(self, nameHash)) {
-        args_pushArg(self, arg);
-        return 0;
-    }
-    __updateArg(self, arg);
-    return 0;
-}
-
-LinkNode* args_getNode_hash(Args* self, Hash nameHash) {
-    LinkNode* nodeNow = self->firstNode;
-    if (NULL == nodeNow) {
-        return NULL;
-    }
-    while (1) {
-        Arg* arg = nodeNow;
-        Hash thisNameHash = arg_getNameHash(arg);
-        if (thisNameHash == nameHash) {
-            return nodeNow;
-        }
-        if (NULL == content_getNext(nodeNow)) {
-            return NULL;
-        }
-        nodeNow = content_getNext(nodeNow);
-    }
-}
-
-LinkNode* args_getNode(Args* self, char* name) {
-    return args_getNode_hash(self, hash_time33(name));
-}
-
-Arg* args_getArg_hash(Args* self, Hash nameHash) {
-    LinkNode* node = args_getNode_hash(self, nameHash);
-    if (NULL == node) {
-        return NULL;
-    }
-    return node;
-}
-
-Arg* args_getArg(Args* self, char* name) {
-    LinkNode* node = args_getNode(self, name);
-    if (NULL == node) {
-        return NULL;
-    }
-    return node;
-}
-
-Arg* args_getArg_index(Args* self, int index) {
-    LinkNode* nodeNow = self->firstNode;
-    if (NULL == nodeNow) {
-        return NULL;
-    }
-    for (int i = 0; i < index; i++) {
-        nodeNow = content_getNext(nodeNow);
-    }
-    return nodeNow;
-}
-
-char* getPrintSring(Args* self, char* name, char* valString) {
-    Args* buffs = New_strBuff();
-    char* printName = strsFormat(buffs, 128, "[printBuff]%s", name);
-    char* printString = strsCopy(buffs, valString);
-    args_setStr(self, printName, printString);
-    char* res = args_getStr(self, printName);
-    args_deinit(buffs);
-    return res;
-}
-
-char* getPrintStringFromInt(Args* self, char* name, int32_t val) {
-    Args* buffs = New_strBuff();
-    char* res = NULL;
-    char* valString = strsFormat(buffs, 32, "%d", val);
-    res = getPrintSring(self, name, valString);
-    args_deinit(buffs);
-    return res;
-}
-
-char* getPrintStringFromFloat(Args* self, char* name, float val) {
-    Args* buffs = New_strBuff();
-    char* res = NULL;
-    char* valString = strsFormat(buffs, 32, "%f", val);
-    res = getPrintSring(self, name, valString);
-    args_deinit(buffs);
-    return res;
-}
-
-char* getPrintStringFromPtr(Args* self, char* name, void* val) {
-    Args* buffs = New_strBuff();
-    char* res = NULL;
-    uint64_t intVal = (uintptr_t)val;
-    char* valString = strsFormat(buffs, 32, "0x%llx", intVal);
-    res = getPrintSring(self, name, valString);
-    args_deinit(buffs);
-    return res;
-}
-
-char* args_print(Args* self, char* name) {
-    char* res = NULL;
-    ArgType type = args_getType(self, name);
-    Args* buffs = New_strBuff();
-    if (TYPE_NONE == type) {
-        /* can not get arg */
-        res = NULL;
-        goto exit;
-    }
-
-    if (type == TYPE_INT) {
-        int32_t val = args_getInt(self, name);
-        res = getPrintStringFromInt(self, name, val);
-        goto exit;
-    }
-
-    if (type == TYPE_FLOAT) {
-        float val = args_getFloat(self, name);
-        res = getPrintStringFromFloat(self, name, val);
-        goto exit;
-    }
-
-    if (type == TYPE_STRING) {
-        res = args_getStr(self, name);
-        goto exit;
-    }
-
-    if (type == TYPE_POINTER) {
-        void* val = args_getPtr(self, name);
-        res = getPrintStringFromPtr(self, name, val);
-        goto exit;
-    }
-
-    /* can not match type */
-    res = NULL;
-    goto exit;
-
-exit:
-    args_deinit(buffs);
-    return res;
-}
-
-int32_t args_setPtrWithType(Args* self,
-                            char* name,
-                            ArgType type,
-                            void* objPtr) {
-    Arg* argNew = New_arg(NULL);
-    argNew = arg_setPtr(argNew, name, type, objPtr);
-    args_setArg(self, argNew);
-    return 0;
-}
-
-int32_t args_foreach(Args* self,
-                     int32_t (*eachHandle)(Arg* argEach, Args* handleArgs),
-                     Args* handleArgs) {
-    if (NULL == self->firstNode) {
-        return 0;
-    }
-    LinkNode* nodeNow = self->firstNode;
-    while (1) {
-        Arg* argNow = nodeNow;
-        if (NULL == argNow) {
-            continue;
-        }
-        LinkNode* nextNode = content_getNext(nodeNow);
-        eachHandle(argNow, handleArgs);
-
-        if (NULL == nextNode) {
-            break;
-        }
-        nodeNow = nextNode;
-    }
-    return 0;
-}
-
-int32_t args_removeArg(Args* self, Arg* argNow) {
-    if (NULL == argNow) {
-        /* can not found arg */
-        return 1;
-    }
-    link_removeNode(self, argNow);
-    return 0;
-}
-
-Args* New_args(Args* args) {
-    Args* self = New_link(NULL);
-    return self;
-}

+ 0 - 103
bsp/TC264D/PikaScript/pikascript-core/dataArgs.h

@@ -1,103 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _dataArgs__H
-#define _dataArgs__H
-#include "dataArg.h"
-#include "dataLink.h"
-#include "dataMemory.h"
-#include "dataString.h"
-
-typedef Link Args;
-
-/* operation */
-void args_deinit(Args* self);
-void args_init(Args* self, Args* args);
-int32_t args_getSize(Args* self);
-LinkNode* args_getNode(Args* self, char* name);
-
-Arg* args_getArgByIndex(Args* self, int32_t index);
-Arg* args_getArg(Args* self, char* name);
-int32_t args_removeArg(Args* self, Arg* argNow);
-Arg* args_getArg_hash(Args* self, Hash nameHash);
-
-int32_t args_setArg(Args* self, Arg* arg);
-
-int32_t args_copyArgByName(Args* self, char* name, Args* directList);
-int32_t args_copyArg(Args* self, Arg* argToBeCopy);
-
-ArgType args_getType(Args* self, char* name);
-int32_t args_isArgExist_hash(Args* self, Hash nameHash);
-int32_t args_isArgExist(Args* self, char* name);
-
-int32_t args_setStr(Args* self, char* name, char* strIn);
-int32_t args_setStrWithDefaultName(Args* self, char* strIn);
-char* args_getStr(Args* self, char* name);
-
-int32_t args_setFloatWithDefaultName(Args* self, float argFloat);
-int32_t args_setFloat(Args* self, char* name, float argFloat);
-float args_getFloat(Args* self, char* name);
-
-int32_t args_setPtr(Args* self, char* name, void* argPointer);
-void* args_getPtr(Args* self, char* name);
-
-int32_t args_setInt(Args* self, char* name, int64_t int64In);
-int64_t args_getInt(Args* self, char* name);
-
-void args_bindInt(Args* self, char* name, int32_t* intPtr);
-void args_bindFloat(Args* self, char* name, float* floatPtr);
-void args_bindStr(Args* self, char* name, char** stringPtr);
-/* arg general opeartion */
-void args_bind(Args* self, char* type, char* name, void* pointer);
-char* args_print(Args* self, char* name);
-
-int32_t args_setStruct(Args* self,
-                       char* name,
-                       void* struct_ptr,
-                       uint32_t struct_size);
-void* args_getStruct(Args* self, char* name, void* struct_out);
-
-int32_t args_set(Args* self, char* name, char* valueStr);
-int32_t args_setObjectWithClass(Args* self,
-                                char* objectName,
-                                char* className,
-                                void* objectPtr);
-int32_t args_setPtrWithType(Args* self,
-                            char* name,
-                            ArgType type,
-                            void* objPtr);
-int32_t args_foreach(Args* self,
-                     int32_t (*eachHandle)(Arg* argEach, Args* handleArgs),
-                     Args* handleArgs);
-
-char* args_getBuff(Args* self, int32_t size);
-uint8_t args_setLiteral(Args* self, char* targetArgName, char* literal);
-int args_pushArg(Args* self, Arg* arg);
-Arg* args_getArg_index(Args* self, int index);
-
-Args* New_args(Args* args);
-#endif

+ 0 - 110
bsp/TC264D/PikaScript/pikascript-core/dataLink.c

@@ -1,110 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataLink.h"
-#include "dataArg.h"
-#include "dataLinkNode.h"
-#include "dataMemory.h"
-
-void link_deinit(Link* self) {
-    LinkNode* nowNode = self->firstNode;
-    while (NULL != nowNode) {
-        LinkNode* nodeNext = content_getNext(nowNode);
-        linkNode_deinit(nowNode);
-        nowNode = nodeNext;
-    }
-    // DynMemPut(self->mem);
-    pikaFree(self, sizeof(Link));
-    self = NULL;
-}
-
-void link_addNode(Link* self, void* content) {
-    // old first node become new second node
-    LinkNode* secondNode = self->firstNode;
-
-    self->firstNode = content;
-    // change the first node to new node
-    content_setNext(content, secondNode);
-}
-
-void link_removeNode(Link* self, void* content) {
-    LinkNode* nodeToDelete = NULL;
-    LinkNode* nodeNow = self->firstNode;
-    LinkNode* priorNode = NULL;
-    LinkNode* nextNode;
-    while (1) {
-        if (nodeNow == content) {
-            nodeToDelete = nodeNow;
-            break;
-        }
-        if (nodeNow == NULL) {
-            // error, node no found
-            goto exit;
-        }
-        priorNode = nodeNow;
-        nodeNow = content_getNext(nodeNow);
-    }
-
-    nextNode = content_getNext(nodeToDelete);
-    if (nodeToDelete == self->firstNode) {
-        self->firstNode = content_getNext(nodeToDelete);
-    }
-
-    if (NULL == priorNode) {
-        self->firstNode = nextNode;
-        goto exit;
-    }
-
-    content_setNext(priorNode, nextNode);
-    goto exit;
-
-// deinit the node
-exit:
-    linkNode_deinit(nodeToDelete);
-    return;
-}
-
-int32_t link_getSize(Link* self) {
-    LinkNode* NowNode;
-    int32_t size = 0;
-    NowNode = self->firstNode;
-    while (NULL != NowNode) {
-        size++;
-        NowNode = content_getNext(NowNode);
-    }
-    return size;
-}
-
-void link_init(Link* self, void* args) {
-    self->firstNode = NULL;
-}
-
-Link* New_link(void* args) {
-    Link* self = pikaMalloc(sizeof(Link));
-    link_init(self, args);
-    return self;
-}

+ 0 - 45
bsp/TC264D/PikaScript/pikascript-core/dataLink.h

@@ -1,45 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _link2__H
-#define _link2__H
-#include "dataLinkNode.h"
-#include "dataMemory.h"
-
-typedef struct Class_link Link;
-struct Class_link {
-    LinkNode* firstNode;
-};
-
-void link_deinit(Link* self);
-void link_init(Link* self, void* args);
-void link_addNode(Link* self, void* content);
-void link_removeNode(Link* self, void* content);
-LinkNode* link_getNode(Link* self, int64_t id);
-int32_t link_getSize(Link* self);
-Link* New_link(void* args);
-#endif

+ 0 - 42
bsp/TC264D/PikaScript/pikascript-core/dataLinkNode.c

@@ -1,42 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataLinkNode.h"
-#include "dataArg.h"
-#include "dataMemory.h"
-
-void linkNode_deinit(LinkNode* self) {
-    arg_deinit(self);
-}
-
-void linkNode_init(LinkNode* self, void* args) {
-    /* attribute */
-}
-
-LinkNode* New_linkNode(void* args) {
-    return NULL;
-}

+ 0 - 37
bsp/TC264D/PikaScript/pikascript-core/dataLinkNode.h

@@ -1,37 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _linkNode__H
-#define _linkNode__H
-#include "dataMemory.h"
-typedef uint8_t LinkNode;
-
-void linkNode_deinit(LinkNode* self);
-void linkNode_init(LinkNode* self, void* args);
-
-LinkNode* New_linkNode(void* args);
-#endif

+ 0 - 282
bsp/TC264D/PikaScript/pikascript-core/dataMemory.c

@@ -1,282 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataMemory.h"
-#include "PikaPlatform.h"
-
-PikaMemInfo pikaMemInfo = {0};
-
-void* pikaMalloc(uint32_t size) {
-    /* pika memory lock */
-    if (0 != __is_locked_pikaMemory()) {
-        __platform_wait();
-    }
-    pikaMemInfo.heapUsed += size;
-    if (pikaMemInfo.heapUsedMax < pikaMemInfo.heapUsed) {
-        pikaMemInfo.heapUsedMax = pikaMemInfo.heapUsed;
-    }
-    __platform_disable_irq_handle();
-    void* mem = __impl_pikaMalloc(size);
-    __platform_enable_irq_handle();
-    if (NULL == mem) {
-        __platform_printf(
-            "[error]: No heap space! Please reset the device.\r\n");
-        while (1) {
-        }
-    }
-    return mem;
-}
-
-void pikaFree(void* mem, uint32_t size) {
-    if (0 != __is_locked_pikaMemory()) {
-        __platform_wait();
-    }
-    __platform_disable_irq_handle();
-    __impl_pikaFree(mem, size);
-    __platform_enable_irq_handle();
-    pikaMemInfo.heapUsed -= size;
-}
-
-uint16_t pikaMemNow(void) {
-    return pikaMemInfo.heapUsed;
-    // return 0;
-}
-
-uint16_t pikaMemMax(void) {
-    return pikaMemInfo.heapUsedMax;
-}
-
-void pikaMemMaxReset(void) {
-    pikaMemInfo.heapUsedMax = 0;
-}
-
-uint32_t pool_getBlockIndex_byMemSize(Pool* pool, uint32_t size) {
-    if (0 == size) {
-        return 0;
-    }
-    return (size - 1) / pool->aline + 1;
-}
-
-uint32_t pool_aline(Pool* pool, uint32_t size) {
-    return pool_getBlockIndex_byMemSize(pool, size) * pool->aline;
-}
-
-Pool pool_init(uint32_t size, uint8_t aline) {
-    Pool pool;
-    pool.aline = aline;
-    uint32_t block_size = pool_getBlockIndex_byMemSize(&pool, size);
-    pool.size = pool_aline(&pool, size);
-    pool.bitmap = bitmap_init(block_size);
-    pool.mem = __platform_malloc(pool_aline(&pool, pool.size));
-    pool.first_free_block = 0;
-    pool.purl_free_block_start = 0;
-    return pool;
-}
-
-void pool_deinit(Pool* pool) {
-    __platform_free(pool->mem);
-    pool->mem = NULL;
-    bitmap_deinit(pool->bitmap);
-}
-
-void* pool_getMem_byBlockIndex(Pool* pool, uint32_t block_index) {
-    return pool->mem + block_index * pool->aline;
-}
-
-uint32_t pool_getBlockIndex_byMem(Pool* pool, void* mem) {
-    uint32_t mem_size = (uintptr_t)mem - (uintptr_t)pool->mem;
-    return pool_getBlockIndex_byMemSize(pool, mem_size);
-}
-
-void pool_printBlocks(Pool* pool, uint32_t size_min, uint32_t size_max) {
-    uint32_t block_index_min = pool_getBlockIndex_byMemSize(pool, size_min);
-    uint32_t block_index_max = pool_getBlockIndex_byMemSize(pool, size_max);
-    __platform_printf("[bitmap]\r\n");
-    uint8_t is_end = 0;
-    for (uint32_t i = block_index_min; i < block_index_max; i += 16) {
-        if (is_end) {
-            break;
-        }
-        __platform_printf("0x%x\t: ", i * pool->aline, (i + 15) * pool->aline);
-        for (uint32_t j = i; j < i + 16; j += 4) {
-            if (is_end) {
-                break;
-            }
-            for (uint32_t k = j; k < j + 4; k++) {
-                if (k >= block_index_max) {
-                    is_end = 1;
-                    break;
-                }
-                __platform_printf("%d", bitmap_get(pool->bitmap, k));
-            }
-            __platform_printf(" ");
-        }
-        __platform_printf("\r\n");
-    }
-}
-
-void* pool_malloc(Pool* pool, uint32_t size) {
-    uint32_t block_index_max = pool_getBlockIndex_byMemSize(pool, pool->size);
-    uint32_t block_num_need = pool_getBlockIndex_byMemSize(pool, size);
-    uint32_t block_num_found = 0;
-    uint8_t found_first_free = 0;
-    uint32_t block_index;
-    if (__is_quick_malloc()) {
-        /* high speed malloc */
-        block_index = pool->purl_free_block_start + block_num_need - 1;
-        if (block_index < block_index_max) {
-            goto found;
-        }
-    }
-
-    /* low speed malloc */
-    for (block_index = pool->first_free_block;
-         block_index < pool->purl_free_block_start; block_index++) {
-        /* 8 bit is not free */
-        uint8_t bitmap_byte = bitmap_getByte(pool->bitmap, block_index);
-        if (0xFF == bitmap_byte) {
-            block_index = 8 * (block_index / 8) + 7;
-            block_num_found = 0;
-            continue;
-        }
-        /* found a free block */
-        if (0 == bitmap_get(pool->bitmap, block_index)) {
-            /* save the first free */
-            if (!found_first_free) {
-                pool->first_free_block = block_index;
-                found_first_free = 1;
-            }
-            block_num_found++;
-        } else {
-            /* a used block appeared, find again */
-            block_num_found = 0;
-        }
-        /* found all request blocks */
-        if (block_num_found >= block_num_need) {
-            goto found;
-        }
-    }
-    /* malloc for purl free blocks */
-    block_index = pool->purl_free_block_start + block_num_need - 1;
-    if (block_index < block_index_max) {
-        goto found;
-    }
-
-    /* no found */
-    return NULL;
-found:
-    /* set 1 for found blocks */
-    for (uint32_t i = 0; i < block_num_need; i++) {
-        bitmap_set(pool->bitmap, block_index - i, 1);
-    }
-    /* save last used block */
-    if (block_index >= pool->purl_free_block_start) {
-        pool->purl_free_block_start = block_index + 1;
-    }
-    /* return mem by block index */
-    return pool_getMem_byBlockIndex(pool, block_index - block_num_need + 1);
-}
-
-void pool_free(Pool* pool, void* mem, uint32_t size) {
-    uint32_t block_num = pool_getBlockIndex_byMemSize(pool, size);
-    uint32_t block_index = pool_getBlockIndex_byMem(pool, mem);
-    for (uint32_t i = 0; i < block_num; i++) {
-        bitmap_set(pool->bitmap, block_index + i, 0);
-    }
-    /* save min free block index to add speed */
-    if (block_index < pool->first_free_block) {
-        pool->first_free_block = block_index;
-    }
-    /* save last free block index to add speed */
-    uint32_t block_end = block_index + block_num - 1;
-    if (block_end == pool->purl_free_block_start - 1) {
-        uint32_t first_pure_free_block = block_index;
-        /* back to first used block */
-        if (0 != first_pure_free_block) {
-            while (0 == bitmap_get(pool->bitmap, first_pure_free_block - 1)) {
-                first_pure_free_block--;
-                if (0 == first_pure_free_block) {
-                    break;
-                }
-            }
-        }
-        pool->purl_free_block_start = first_pure_free_block;
-    }
-    return;
-}
-
-uint32_t aline_by(uint32_t size, uint32_t aline) {
-    if (size == 0) {
-        return 0;
-    }
-    return ((size - 1) / aline + 1) * aline;
-}
-
-BitMap bitmap_init(uint32_t size) {
-    BitMap mem_bit_map =
-        (BitMap)__platform_malloc(((size - 1) / 8 + 1) * sizeof(char));
-    if (mem_bit_map == NULL){
-        return NULL;
-    }
-    uint32_t size_mem_bit_map = (size - 1) / 8 + 1;
-    __platform_memset(mem_bit_map, 0x0, size_mem_bit_map);
-    return mem_bit_map;
-}
-
-void bitmap_set(BitMap bitmap, uint32_t index, uint8_t bit) {
-    uint32_t index_byte = index / 8;
-    uint8_t index_bit = index % 8;
-    uint8_t x = (0x1 << index_bit);
-    /* set 1 */
-    if (bit) {
-        bitmap[index_byte] |= x;
-        return;
-    }
-    /* set 0 */
-    bitmap[index_byte] &= ~x;
-    return;
-}
-
-uint8_t bitmap_getByte(BitMap bitmap, uint32_t index) {
-    uint32_t index_byte = (index) / 8;
-    uint8_t byte;
-    byte = bitmap[index_byte];
-    return byte;
-}
-
-uint8_t bitmap_get(BitMap bitmap, uint32_t index) {
-    uint32_t index_byte = (index) / 8;
-    uint8_t index_bit = (index) % 8;
-    uint8_t x = (0x1 << index_bit);
-    uint8_t bit;
-    bit = bitmap[index_byte] & x;
-    return bit > 0 ? 1 : 0;
-}
-
-void bitmap_deinit(BitMap bitmap) {
-    __platform_free(bitmap);
-}

+ 0 - 68
bsp/TC264D/PikaScript/pikascript-core/dataMemory.h

@@ -1,68 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __MEMORY_H__
-#define __MEMORY_H__
-
-#include "PikaPlatform.h"
-
-typedef struct {
-    uint32_t heapUsed;
-    uint32_t heapUsedMax;
-} PikaMemInfo;
-
-typedef uint8_t* BitMap;
-
-typedef struct {
-    BitMap bitmap;
-    uint8_t* mem;
-    uint8_t aline;
-    uint32_t size;
-    uint32_t first_free_block;
-    uint32_t purl_free_block_start;
-} Pool;
-
-void pikaFree(void* mem, uint32_t size);
-void* pikaMalloc(uint32_t size);
-uint16_t pikaMemNow(void);
-uint16_t pikaMemMax(void);
-void pikaMemMaxReset(void);
-
-uint32_t aline_by(uint32_t size, uint32_t aline);
-
-BitMap bitmap_init(uint32_t size);
-void bitmap_set(BitMap bitmap, uint32_t index, uint8_t bit);
-uint8_t bitmap_get(BitMap bitmap, uint32_t index);
-uint8_t bitmap_getByte(BitMap bitmap, uint32_t index);
-void bitmap_deinit(BitMap bitmap);
-
-Pool pool_init(uint32_t size, uint8_t aline);
-void* pool_malloc(Pool* pool, uint32_t size);
-void pool_free(Pool* pool, void* mem, uint32_t size);
-void pool_deinit(Pool* pool);
-void pool_printBlocks(Pool* pool, uint32_t block_min, uint32_t block_max);
-#endif

+ 0 - 87
bsp/TC264D/PikaScript/pikascript-core/dataQueue.c

@@ -1,87 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataQueue.h"
-#include "PikaPlatform.h"
-#include "dataArgs.h"
-
-Queue* New_queue(void) {
-    Args* args = New_args(NULL);
-    args_setInt(args, "_", 0);
-    Queue* queue = args;
-    return queue;
-}
-
-int32_t queue_deinit(Queue* queue) {
-    Args* args = queue;
-    args_deinit(args);
-    return 0;
-}
-
-int32_t queue_pushArg(Queue* queue, Arg* arg) {
-    Args* args = queue;
-    int offset = args_getInt(args, "_");
-    /* add top */
-    args_setInt(args, "_", offset + 1);
-    return args_pushArg(args, arg);
-}
-
-Arg* queue_popArg(Queue* queue) {
-    Args* args = queue;
-    int offset = args_getInt(args, "_");
-    if (offset - 1 < 0) {
-        return NULL;
-    }
-    /* add bottom */
-    args_setInt(args, "_", offset - 1);
-    Arg* res = args_getArg_index(args, offset - 1);
-    return res;
-}
-
-int32_t queue_pushInt(Queue* queue, int val) {
-    return queue_pushArg(queue, arg_setInt(NULL, "", val));
-}
-
-int64_t queue_popInt(Queue* queue) {
-    return arg_getInt(queue_popArg(queue));
-}
-
-int32_t queue_pushFloat(Queue* queue, float val) {
-    return queue_pushArg(queue, arg_setFloat(NULL, "", val));
-}
-
-float queue_popFloat(Queue* queue) {
-    return arg_getFloat(queue_popArg(queue));
-}
-
-int32_t queue_pushStr(Queue* queue, char* str) {
-    return queue_pushArg(queue, arg_setStr(NULL, "", str));
-}
-
-char* queue_popStr(Queue* queue) {
-    return arg_getStr(queue_popArg(queue));
-}

+ 0 - 46
bsp/TC264D/PikaScript/pikascript-core/dataQueue.h

@@ -1,46 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __DATA_QUEUE__H
-#define __DATA_QUEUE__H
-#include "dataArgs.h"
-
-typedef Args Queue;
-Queue* New_queue(void);
-
-int32_t queue_deinit(Queue* queue);
-int32_t queue_pushInt(Queue* queue, int val);
-int32_t queue_pushFloat(Queue* queue, float val);
-int32_t queue_pushStr(Queue* queue, char* str);
-int32_t queue_pushArg(Queue* queue, Arg* arg);
-char *fast_itoa(char *buf, uint32_t val);
-
-int64_t queue_popInt(Queue* queue);
-float queue_popFloat(Queue* queue);
-char* queue_popStr(Queue* queue);
-Arg* queue_popArg(Queue* queue);
-#endif

+ 0 - 125
bsp/TC264D/PikaScript/pikascript-core/dataQueueObj.c

@@ -1,125 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataQueueObj.h"
-#include "BaseObj.h"
-#include "dataQueue.h"
-QueueObj* New_queueObj(void) {
-    PikaObj* self = New_PikaObj();
-    queueObj_init(self);
-    return self;
-}
-
-int32_t queueObj_init(QueueObj* self) {
-    obj_setInt(self, "top", 0);
-    obj_setInt(self, "bottom", 0);
-    return 0;
-}
-
-int32_t queueObj_pushObj(QueueObj* self, char* className) {
-    uint64_t top = obj_getInt(self, "top");
-    char buff[11];
-    char* topStr = fast_itoa(buff, top);
-    /* add top */
-    obj_setInt(self, "top", top + 1);
-    return obj_newObj(self, topStr, className, New_TinyObj);
-}
-
-PikaObj* queueObj_getCurrentObj(QueueObj* self) {
-    uint64_t current = obj_getInt(self, "top") - 1;
-    char buff[11];
-    char* currentStr = fast_itoa(buff, current);
-    return obj_getObj(self, currentStr, 0);
-}
-
-PikaObj* queueObj_popObj(QueueObj* self) {
-    uint64_t bottom = obj_getInt(self, "bottom");
-    char buff[11];
-    char* bottomStr = fast_itoa(buff, bottom);
-    /* add bottom */
-    obj_setInt(self, "bottom", bottom + 1);
-    PikaObj* res = obj_getObj(self, bottomStr, 0);
-    return res;
-}
-
-int32_t queueObj_pushInt(QueueObj* self, int val) {
-    uint64_t top = obj_getInt(self, "top");
-    char buff[11];
-    char* topStr = fast_itoa(buff, top);
-    /* add top */
-    obj_setInt(self, "top", top + 1);
-    return obj_setInt(self, topStr, val);
-}
-
-int64_t queueObj_popInt(QueueObj* self) {
-    uint64_t bottom = obj_getInt(self, "bottom");
-    char buff[11];
-    char* bottomStr = fast_itoa(buff, bottom);
-    /* add bottom */
-    obj_setInt(self, "bottom", bottom + 1);
-    int64_t res = obj_getInt(self, bottomStr);
-    obj_removeArg(self, bottomStr);
-    return res;
-}
-
-int32_t queueObj_pushFloat(QueueObj* self, float val) {
-    uint64_t top = obj_getInt(self, "top");
-    char buff[11];
-    char* topStr = fast_itoa(buff, top);
-    /* add top */
-    obj_setInt(self, "top", top + 1);
-    return obj_setFloat(self, topStr, val);
-}
-
-float queueObj_popFloat(QueueObj* self) {
-    uint64_t bottom = obj_getInt(self, "bottom");
-    char buff[11];
-    char* bottomStr = fast_itoa(buff, bottom);
-    /* add bottom */
-    obj_setInt(self, "bottom", bottom + 1);
-    float res = obj_getFloat(self, bottomStr);
-    obj_removeArg(self, bottomStr);
-    return res;
-}
-
-int32_t queueObj_pushStr(QueueObj* self, char* str) {
-    uint64_t top = obj_getInt(self, "top");
-    char buff[11];
-    char* topStr = fast_itoa(buff, top);
-    /* add top */
-    obj_setInt(self, "top", top + 1);
-    return obj_setStr(self, topStr, str);
-}
-
-char* queueObj_popStr(QueueObj* self) {
-    uint64_t bottom = obj_getInt(self, "bottom");
-    char buff[11];
-    char* bottomStr = fast_itoa(buff, bottom);
-    /* add bottom */
-    obj_setInt(self, "bottom", bottom + 1);
-    return obj_getStr(self, bottomStr);
-}

+ 0 - 48
bsp/TC264D/PikaScript/pikascript-core/dataQueueObj.h

@@ -1,48 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __DATA_QUEUE_OBJ__H
-#define __DATA_QUEUE_OBJ__H
-#include "PikaObj.h"
-typedef PikaObj QueueObj;
-
-QueueObj* New_queueObj(void);
-int32_t queueObj_init(QueueObj* self);
-
-int32_t queueObj_pushInt(QueueObj* self, int val);
-int32_t queueObj_pushFloat(QueueObj* self, float val);
-int32_t queueObj_pushStr(QueueObj* self, char* str);
-int32_t queueObj_pushObj(QueueObj* self, char* className);
-
-int64_t queueObj_popInt(QueueObj* self);
-float queueObj_popFloat(QueueObj* self);
-char* queueObj_popStr(QueueObj* self);
-PikaObj* queueObj_popObj(QueueObj* self);
-
-PikaObj* queueObj_getCurrentObj(QueueObj* self);
-
-#endif

+ 0 - 61
bsp/TC264D/PikaScript/pikascript-core/dataStack.c

@@ -1,61 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataStack.h"
-#include "dataQueue.h"
-
-Stack* New_Stack(void) {
-    Args* args = New_args(NULL);
-    args_setInt(args, "top", 0);
-    Stack* stack = args;
-    return stack;
-}
-int32_t stack_deinit(Stack* stack) {
-    Args* args = stack;
-    args_deinit(args);
-    return 0;
-}
-int32_t stack_pushStr(Stack* stack, char* str) {
-    Args* args = stack;
-    uint64_t top = args_getInt(args, "top");
-    char buff[11];
-    /* add top */
-    char* topStr = fast_itoa(buff, top);
-    args_setInt(args, "top", top + 1);
-    return args_setStr(args, topStr, str);
-}
-char* stack_popStr(Stack* queue, char* outBuff) {
-    Args* args = queue;
-    uint64_t top = args_getInt(args, "top") - 1;
-    char buff[11];
-    /* sub top */
-    args_setInt(args, "top", top);
-    char* topStr = fast_itoa(buff, top);
-    strcpy(outBuff, args_getStr(args, topStr));
-    args_removeArg(args, args_getArg(args, topStr));
-    return outBuff;
-}

+ 0 - 38
bsp/TC264D/PikaScript/pikascript-core/dataStack.h

@@ -1,38 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __DATA_STACK__H
-#define __DATA_STACK__H
-#include "dataArgs.h"
-
-typedef Args Stack;
-Stack* New_Stack(void);
-int32_t stack_deinit(Stack* stack);
-
-int32_t stack_pushStr(Stack* stack, char* str);
-char* stack_popStr(Stack* queue, char* outBuff);
-#endif

+ 0 - 294
bsp/TC264D/PikaScript/pikascript-core/dataString.c

@@ -1,294 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataString.h"
-#include "PikaPlatform.h"
-
-char* strAppendWithSize_unlimited(char* strOut, char* pData, int32_t Size) {
-    int32_t strOut_i = strGetSize(strOut);
-    for (int32_t i = 0; i < Size; i++) {
-        strOut[strOut_i + i] = pData[i];
-    }
-    strOut_i += Size;
-    // add \0 to the end of strOut
-    strOut[strOut_i] = 0;
-
-    return strOut;
-}
-
-char* strCut(char* strOut, char* strIn, char startSign, char endSign) {
-    int32_t Size = strGetSize(strIn);
-    int32_t iStart = 0;
-    int32_t iEnd = Size;
-    uint8_t isStart = 0;
-    uint8_t isEnd = 0;
-    for (int32_t i = 0; i < Size; i++) {
-        if (strIn[i] == startSign) {
-            iStart = i;
-            isStart = 1;
-            break;
-        }
-    }
-    for (int32_t i = Size - 1; i >= 0; i--) {
-        if (strIn[i] == endSign) {
-            iEnd = i;
-            isEnd = 1;
-            break;
-        }
-    }
-    int outi = 0;
-    for (int32_t i = iStart + 1; i < iEnd; i++) {
-        strOut[outi] = strIn[i];
-        outi++;
-    }
-    /* add \0 */
-    strOut[outi] = 0;
-    if (isStart && isEnd) {
-        /* succeed */
-        return strOut;
-    }
-    /* faild */
-    return NULL;
-}
-
-char* strDeleteChar(char* strOut, char* strIn, char ch) {
-    int32_t iOut = 0;
-    for (uint32_t i = 0; i < strGetSize(strIn); i++) {
-        if (ch == strIn[i]) {
-            continue;
-        }
-        strOut[iOut] = strIn[i];
-        iOut++;
-    }
-    /* add \0 */
-    strOut[iOut] = 0;
-    return strOut;
-}
-
-char* strDeleteEnter(char* str) {
-    return strDeleteChar(str, str, '\n');
-}
-
-char* strAppendWithSize(char* strOut, char* pData, int32_t Size) {
-    int32_t strOut_i = strGetSize(strOut);
-    for (int32_t i = 0; i < Size; i++) {
-        strOut[strOut_i + i] = pData[i];
-    }
-    strOut_i += Size;
-    // add \0 to the end of strOut
-    strOut[strOut_i] = 0;
-
-    return strOut;
-}
-
-int32_t strCountSign(char* strIn, char sign) {
-    int32_t count = 0;
-    for (uint32_t i = 0; i < strGetSize(strIn); i++) {
-        if (sign == strIn[i]) {
-            count++;
-        }
-    }
-    return count;
-}
-
-int32_t strGetTokenNum(char* strIn, char sign) {
-    return strCountSign(strIn, sign) + 1;
-}
-
-uint32_t strGetSize(char* pData) {
-    return strlen(pData);
-}
-
-char* strAppend_unlimited(char* strOut, char* pData) {
-    uint32_t Size = 0;
-    Size = strGetSize(pData);
-    return strAppendWithSize_unlimited(strOut, pData, Size);
-}
-
-char* strGetLastLine(char* strOut, char* strIn) {
-    int32_t size = strGetSize(strIn);
-    char sign = '\n';
-    uint32_t beginIndex = 0;
-
-    /* skip the latest '\n' */
-    for (int32_t i = size - 2; i > -1; i--) {
-        if (strIn[i] == sign) {
-            beginIndex = i + 1;
-            break;
-        }
-    }
-
-    __platform_memcpy(strOut, strIn + beginIndex, size - beginIndex);
-    strOut[size - beginIndex + 1] = 0;
-    return strOut;
-}
-
-char* strGetLastToken(char* strOut, char* strIn, char sign) {
-    int32_t size = strGetSize(strIn);
-    int32_t buffSize = 0;
-    for (int32_t i = size - 1; i > -1; i--) {
-        if (strIn[i] != sign) {
-            strOut[size - i - 1] = strIn[i];
-            buffSize++;
-        }
-        if (strIn[i] == sign) {
-            break;
-        }
-    }
-    int32_t i = 0;
-    for (i = 0; i < buffSize / 2; i++) {
-        char buff = strOut[i];
-        strOut[i] = strOut[buffSize - i - 1];
-        strOut[buffSize - i - 1] = buff;
-    }
-    strOut[buffSize] = 0;
-    return strOut;
-}
-
-char* strPopToken(char* strOut, char* strIn, char sign) {
-    int32_t getSign = 0;
-    int32_t iPoped = 0;
-    int32_t iOut = 0;
-    int32_t size = strGetSize(strIn);
-    int32_t i = 0;
-    for (i = 0; i < size; i++) {
-        if (getSign) {
-            strIn[iPoped] = strIn[i];
-            iPoped++;
-            continue;
-        }
-        if (strIn[i] != sign) {
-            strOut[iOut++] = strIn[i];
-            continue;
-        }
-        if (strIn[i] == sign) {
-            getSign = 1;
-            continue;
-        }
-    }
-    strOut[iOut] = 0;
-    strIn[iPoped] = 0;
-    return strOut;
-}
-
-char* strGetFirstToken(char* strOut, char* strIn, char sign) {
-    int32_t size = strGetSize(strIn);
-    for (int32_t i = 0; i < size; i++) {
-        if (strIn[i] != sign) {
-            strOut[i] = strIn[i];
-        }
-        if (strIn[i] == sign) {
-            break;
-        }
-    }
-    return strOut;
-}
-
-int32_t strGetToken(char* string, char** argv, char sign) {
-    int32_t argc = 0;
-    uint32_t i = 0;
-    // arg_i point32_t to the arg operated now
-    int32_t arg_i = 0;
-    // if not found ' ', then put chars from CMD to argv_tem
-    int32_t char_i = 0;
-    for (i = 0; i < strGetSize(string); i++) {
-        if (string[i] != sign) {
-            argv[arg_i][char_i] = string[i];
-            char_i++;
-        }
-        if (string[i] == sign) {
-            // write '\0' to the end of argv
-            argv[arg_i][char_i] = 0;
-            arg_i++;
-            char_i = 0;
-        }
-        // write '\0' to the end of last argv
-        argv[arg_i][char_i] = 0;
-    }
-    argc = arg_i + 1;
-    return argc;
-}
-
-char* strAppend(char* strOut, char* pData) {
-    uint32_t Size = 0;
-    Size = strGetSize(pData);
-    return strAppendWithSize(strOut, pData, Size);
-}
-
-int32_t strIsStartWith(char* str, char* strStart) {
-    if (NULL == str || NULL == strStart) {
-        /* input is null */
-        return 0;
-    }
-    uint32_t size = strGetSize(strStart);
-    uint32_t CMDName_get = 1;
-    for (uint32_t i = 0; i < size; i++) {
-        if (str[i] != strStart[i]) {
-            CMDName_get = 0;
-        }
-    }
-    return CMDName_get;
-}
-
-int32_t strEqu(char* str1, char* str2) {
-    if (NULL == str1 || NULL == str2) {
-        return 0;
-    }
-    return !strcmp(str1, str2);
-}
-
-char* strRemovePrefix(char* inputStr, char* prefix, char* outputStr) {
-    if (!strIsStartWith(inputStr, prefix)) {
-        return NULL;
-    }
-
-    for (uint32_t i = strGetSize(prefix); i < strGetSize(inputStr); i++) {
-        outputStr[i - strGetSize(prefix)] = inputStr[i];
-    }
-    return outputStr;
-}
-
-char* strClear(char* str) {
-    for (uint32_t i = 0; i < sizeof(str); i++) {
-        str[i] = 0;
-    }
-    return str;
-}
-
-int32_t strIsContain(char* str, char ch) {
-    for (uint32_t i = 0; i < strGetSize(str); i++) {
-        if (str[i] == ch) {
-            return 1;
-        }
-    }
-    return 0;
-}
-
-char* strCopy(char* strBuff, char* strIn) {
-    __platform_memcpy(strBuff, strIn, strGetSize(strIn));
-    return strBuff;
-}

+ 0 - 60
bsp/TC264D/PikaScript/pikascript-core/dataString.h

@@ -1,60 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __MY_TEST_TOOLS_H
-#define __MY_TEST_TOOLS_H
-#include "PikaPlatform.h"
-
-/* size */
-uint32_t strGetSize(char* pData);
-/* append */
-char* strAppend(char* strOut, char* pData);
-char* strAppend_unlimited(char* strOut, char* pData);
-char* strAppendWithSize(char* strOut, char* pData, int32_t Size);
-/* cut */
-char* strCut(char* strOut, char* strIn, char startSign, char endSign);
-/* assert */
-int32_t strIsStartWith(char* str, char* strStart);
-int32_t strEqu(char* str1, char* str2);
-/* delete */
-char* strDeleteEnter(char* str);
-char* strDeleteChar(char* strOut, char* strIn, char ch);
-/* prefix */
-char* strRemovePrefix(char* inputStr, char* prefix, char* outputStr);
-/* token */
-int32_t strGetToken(char* string, char** argv, char sign);
-char* strPopToken(char* strOut, char* strIn, char sign);
-int32_t strCountSign(char* strIn, char sign);
-int32_t strGetTokenNum(char* strIn, char sign);
-char* strGetFirstToken(char* strOut, char* strIn, char sign);
-char* strGetLastToken(char* strOut, char* strIn, char sign);
-char* strClear(char* str);
-int32_t strIsContain(char* str, char ch);
-char* strCopy(char* strBuff, char* strIn);
-char* strGetLastLine(char *strOut, char *strIn);
-
-#endif

+ 0 - 171
bsp/TC264D/PikaScript/pikascript-core/dataStrs.c

@@ -1,171 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "dataStrs.h"
-#include "PikaPlatform.h"
-#include "dataString.h"
-
-Args* New_strBuff(void) {
-    return New_args(NULL);
-}
-
-char* strsRemovePrefix(Args* buffs, char* inputStr, char* prefix) {
-    int32_t size = strGetSize(inputStr);
-    char* buff = args_getBuff(buffs, size);
-    return strRemovePrefix(inputStr, prefix, buff);
-}
-
-char* strsGetDirectStr(Args* buffs, char* argPath) {
-    char* directStr = NULL;
-    directStr = strsCut(buffs, argPath, '"', '"');
-    if (NULL != directStr) {
-        return directStr;
-    }
-    directStr = strsCut(buffs, argPath, '\'', '\'');
-    if (NULL != directStr) {
-        return directStr;
-    }
-    return NULL;
-}
-
-char* strsAppend(Args* buffs, char* strOrigin, char* strToAppend) {
-    int32_t size = strGetSize(strOrigin) + strGetSize(strToAppend);
-    char* buff = args_getBuff(buffs, size);
-    char* strOut = strCopy(buff, strOrigin);
-    strAppend(strOut, strToAppend);
-    return strOut;
-}
-
-char* strsGetLastToken(Args* buffs, char* argPath, char sign) {
-    int32_t size = strGetSize(argPath);
-    char* buff = args_getBuff(buffs, size);
-    return strGetLastToken(buff, argPath, sign);
-}
-
-char* strsCut(Args* buffs, char* strIn, char startSign, char endSign) {
-    int32_t size = strGetSize(strIn);
-    char* buff = args_getBuff(buffs, size);
-    return strCut(buff, strIn, startSign, endSign);
-}
-
-char* strsDeleteChar(Args* buffs, char* strIn, char ch) {
-    int32_t size = strGetSize(strIn);
-    return strDeleteChar(args_getBuff(buffs, size), strIn, ch);
-}
-
-static uint32_t getSizeOfFirstToken(char* str, char sign) {
-    uint32_t size = strGetSize(str);
-    for (uint32_t i = 0; i < size; i++) {
-        if (str[i] == sign) {
-            return i;
-        }
-    }
-    return size;
-}
-
-char* strsGetFirstToken(Args* buffs, char* strIn, char sign) {
-    int32_t size = getSizeOfFirstToken(strIn, sign);
-    return strGetFirstToken(args_getBuff(buffs, size), strIn, sign);
-}
-
-char* strsPopToken(Args* buffs, char* tokens, char sign) {
-    int32_t size = strGetSize(tokens);
-    char* buff = args_getBuff(buffs, size);
-    return strPopToken(buff, tokens, sign);
-}
-
-char* strsCopy(Args* buffs, char* source) {
-    int32_t size = strGetSize(source);
-    char* buff = args_getBuff(buffs, size);
-    return strCopy(buff, source);
-}
-
-char* strsFormat(Args* buffs, uint16_t buffSize, const char* fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    char* res = args_getBuff(buffs, buffSize);
-    __platform_vsnprintf(res, buffSize, fmt, args);
-    va_end(args);
-    return res;
-}
-
-Arg* arg_strAppend(Arg* arg_in, char* str_to_append) {
-    Args* buffs = New_strBuff();
-    char* str_out = strsAppend(buffs, arg_getStr(arg_in), str_to_append);
-    Arg* arg_out = arg_setStr(arg_in, "", str_out);
-    arg_deinit(arg_in);
-    args_deinit(buffs);
-    return arg_out;
-}
-
-char* strsReplace(Args* buffs, char* orig, char* rep, char* with) {
-    char* result;   // the return string
-    char* ins;      // the next insert point
-    char* tmp;      // varies
-    int len_rep;    // length of rep (the string to remove)
-    int len_with;   // length of with (the string to replace rep with)
-    int len_front;  // distance between rep and end of last rep
-    int count;      // number of replacements
-
-    // sanity checks and initialization
-    if (!orig || !rep)
-        return NULL;
-    len_rep = strlen(rep);
-    if (len_rep == 0)
-        return NULL;  // empty rep causes infinite loop during count
-    if (!with)
-        with = "";
-    len_with = strlen(with);
-    // count the number of replacements needed
-    ins = orig;
-    tmp = strstr(ins, rep);
-    count = 0;
-    while (tmp) {
-        count++;
-        ins = tmp + len_rep;
-        tmp = strstr(ins, rep);
-    }
-    tmp = args_getBuff(buffs, strlen(orig) + (len_with - len_rep) * count + 1);
-    result = tmp;
-    if (NULL == result) {
-        return NULL;
-    }
-    // first time through the loop, all the variable are set correctly
-    // from here on,
-    //    tmp points to the end of the result string
-    //    ins points to the next occurrence of rep in orig
-    //    orig points to the remainder of orig after "end of rep"
-    while (count--) {
-        ins = strstr(orig, rep);
-        len_front = ins - orig;
-        tmp = strncpy(tmp, orig, len_front) + len_front;
-        tmp = strcpy(tmp, with) + len_with;
-        orig += len_front + len_rep;  // move to next "end of rep"
-    }
-    strcpy(tmp, orig);
-    return result;
-}

+ 0 - 44
bsp/TC264D/PikaScript/pikascript-core/dataStrs.h

@@ -1,44 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __STR_ARGS__H
-#define __STR_ARGS__H
-#include "dataArgs.h"
-Args* New_strBuff(void);
-char* strsGetFirstToken(Args* buffs, char* strIn, char sign);
-char* strsGetLastToken(Args* buffs, char* arg_Path, char sign);
-char* strsPopToken(Args* buffs, char* tokens, char sign);
-char* strsCopy(Args* buffs, char* source);
-char* strsDeleteChar(Args* buff, char* strIn, char ch);
-char* strsCut(Args* buffs, char* strIn, char startSign, char endSign);
-char* strsRemovePrefix(Args* buffs, char* inputStr, char* prefix);
-char* strsAppend(Args* buffs, char* strOrigin, char* strAppend);
-char* strsFormat(Args* buffs, uint16_t buffSize, const char* fmt, ...);
-char* strsGetDirectStr(Args* buffs, char* argPath);
-Arg* arg_strAppend(Arg* arg_in, char* str_to_append);
-char* strsReplace(Args* buffs, char* orig, char* rep, char* with);
-#endif

+ 0 - 44
bsp/TC264D/PikaScript/pikascript-core/pikaConfigValid.h

@@ -1,44 +0,0 @@
-/*
- * This file is part of the PikaScript project.
- * http://github.com/pikastech/pikascript
- *
- * MIT License
- *
- * Copyright (c) 2021 lyon 李昂 liang6516@outlook.com
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __PIKA_CFG_VALID_H__
-#define __PIKA_CFG_VALID_H__
-
-#ifdef __PIKA_USER_CONFIC_INCLUDE__
-#   include __PIKA_USER_CONFIC_INCLUDE__
-#else
-
-/* default configuration  */
-#define PIKA_SHELL_LINE_BUFF_SIZE 128
-
-#endif
-
-
-/* configuration validation */
-
-
-#endif

+ 0 - 60
bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib.py

@@ -1,60 +0,0 @@
-from PikaObj import *
-
-
-class MemChecker(TinyObj):
-    def max():
-        pass
-
-    def now():
-        pass
-
-    def getMax() -> float:
-        pass
-
-    def getNow() -> float:
-        pass
-
-    def resetMax():
-        pass
-
-
-class SysObj(BaseObj):
-    def type(arg: any):
-        pass
-
-    def remove(argPath: str):
-        pass
-
-    def int(arg: any) -> int:
-        pass
-
-    def float(arg: any) -> float:
-        pass
-
-    def str(arg: any) -> str:
-        pass
-
-    def iter(arg: any) -> any:
-        pass
-
-    def next(arg: any) -> any:
-        pass
-
-    def range(a1: int, a2: int, a3: int) -> any:
-        pass
-
-    def __set__(obj: any, key: any, val: any):
-        pass
-
-    def __get__(obj: any, key: any) -> any:
-        pass
-
-
-class RangeObj(TinyObj):
-    def __next__() -> any:
-        pass
-
-
-class StringObj(TinyObj):
-    def __next__() -> any:
-        pass

+ 0 - 23
bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib_MemChecker.c

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

+ 0 - 27
bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib_RangeObj.c

@@ -1,27 +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 a3 = args_getInt(self->list, "a3");
-    int start = 0;
-    int end = 0;
-    int foot = 1;
-    /* only start and end */
-    if (-999999999 == a3) {
-        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);
-}

+ 0 - 5
bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib_StringObj.c

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

+ 0 - 176
bsp/TC264D/PikaScript/pikascript-lib/PikaStdLib/PikaStdLib_SysObj.c

@@ -1,176 +0,0 @@
-#include "BaseObj.h"
-#include "PikaStdLib_RangeObj.h"
-#include "PikaStdLib_StringObj.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 (TYPE_INT == type) {
-        obj_setSysOut(self, "int");
-        return;
-    }
-    if (TYPE_FLOAT == type) {
-        obj_setSysOut(self, "float");
-        return;
-    }
-    if (TYPE_STRING == type) {
-        obj_setSysOut(self, "string");
-        return;
-    }
-    if (TYPE_POINTER == type) {
-        obj_setSysOut(self, "pointer");
-        return;
-    }
-    if (TYPE_MATE_OBJECT == type) {
-        obj_setSysOut(self, "mate_object");
-        return;
-    }
-    if (TYPE_METHOD == type) {
-        obj_setSysOut(self, "method");
-        return;
-    }
-}
-
-float PikaStdLib_SysObj_float(PikaObj* self, Arg* arg) {
-    ArgType type = arg_getType(arg);
-    if (TYPE_INT == type) {
-        return (float)arg_getInt(arg);
-    }
-    if (TYPE_FLOAT == type) {
-        return (float)arg_getFloat(arg);
-    }
-    obj_setSysOut(self, "[error] convert to float type faild.");
-    obj_setErrorCode(self, 1);
-    return -99999.99999;
-}
-
-int PikaStdLib_SysObj_int(PikaObj* self, Arg* arg) {
-    ArgType type = arg_getType(arg);
-    if (TYPE_INT == type) {
-        return (int)arg_getInt(arg);
-    }
-    if (TYPE_FLOAT == type) {
-        return (int)arg_getFloat(arg);
-    }
-    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 = New_strBuff();
-    char* res = NULL;
-    do {
-        if (TYPE_INT == type) {
-            int val = arg_getInt(arg);
-            res = strsFormat(buffs, 11, "%d", val);
-            break;
-        }
-        if (TYPE_FLOAT == type) {
-            float val = arg_getFloat(arg);
-            res = strsFormat(buffs, 11, "%f", val);
-            break;
-        }
-    } while (0);
-    obj_setStr(self, "__strtmp", res);
-    args_deinit(buffs);
-    return obj_getStr(self, "__strtmp");
-}
-
-Arg* PikaStdLib_SysObj_iter(PikaObj* self, Arg* arg) {
-    /* a String, return a StringObj */
-    if (TYPE_STRING == arg_getType(arg)) {
-        obj_setStr(self, "_sobj", arg_getStr(arg));
-        return arg_setMetaObj("", "PikaStdLib_StringObj",
-                              New_PikaStdLib_StringObj);
-    }
-    /* a MATE object, return itself */
-    if (TYPE_MATE_OBJECT == arg_getType(arg)) {
-        return arg_copy(arg);
-    }
-    /* object */
-    if (TYPE_POINTER == arg_getType(arg)) {
-        PikaObj* arg_obj = arg_getPtr(arg);
-        pikaVM_runAsm(arg_obj,
-                      "B0\n"
-                      "0 RUN __iter__\n"
-                      "0 OUT __res\n");
-        return arg_copy(args_getArg(arg_obj->list, "__res"));
-    }
-    return arg_setNull(NULL);
-}
-
-Arg* PikaStdLib_SysObj_next(PikaObj* self, Arg* arg) {
-    PikaObj* arg_obj = arg_getPtr(arg);
-    pikaVM_runAsm(arg_obj,
-                  "B0\n"
-                  "0 RUN __next__\n"
-                  "0 OUT __res\n");
-    return arg_copy(args_getArg(arg_obj->list, "__res"));
-}
-
-Arg* PikaStdLib_SysObj_range(PikaObj* self, int a1, int a2, int a3) {
-    /* set template arg to create rangeObj */
-    obj_setInt(self, "_r1", a1);
-    obj_setInt(self, "_r2", a2);
-    obj_setInt(self, "_r3", a3);
-    return arg_setMetaObj("", "PikaStdLib_RangeObj", New_PikaStdLib_RangeObj);
-}
-
-void __Sys_initObj(PikaObj* self, Arg* mate_obj) {
-    if (TYPE_MATE_OBJECT != arg_getType(mate_obj)) {
-        return;
-    }
-    Hash arg_hash = arg_getNameHash(mate_obj);
-}
-
-Arg* PikaStdLib_SysObj___get__(PikaObj* self, Arg* key, Arg* obj) {
-    ArgType obj_type = arg_getType(obj);
-    if ((TYPE_OBJECT == obj_type) || (TYPE_POINTER == 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");
-        return arg_copy(args_getArg(arg_obj->list, "__res"));
-    }
-    return arg_setNull(NULL);
-}
-
-void PikaStdLib_SysObj___set__(PikaObj* self, Arg* key, Arg* obj, Arg* val) {
-    ArgType obj_type = arg_getType(obj);
-    __Sys_initObj(self, obj);
-    if ((TYPE_OBJECT == obj_type) || (TYPE_POINTER == 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");
-    }
-}

BIN
bsp/TC264D/PikaScript/rust-msc-latest-win10.exe


+ 1 - 1
bsp/simulation-rtt-qemu-arm2d/pikascript/requestment.txt

@@ -1,4 +1,4 @@
 pikascript-core==v1.3.2
 PikaStdLib==v1.3.2
-Arm2D==v0.3.0
+Arm2D==v0.3.1
 Arm2DqemuBooter==latest

+ 0 - 0
port/linux/api-make-linux.sh


Some files were not shown because too many files changed in this diff