瀏覽代碼

add PikaDebug

lyon 4 年之前
父節點
當前提交
e4363d03a2

+ 5 - 0
package/PikaDebug/PikaDebug.py

@@ -0,0 +1,5 @@
+from PikaObj import *
+
+class Debuger(TinyObj):
+    def set_trace():
+        pass

+ 17 - 0
package/PikaDebug/PikaDebuger_Debuger.c

@@ -0,0 +1,17 @@
+#include "PikaDebug_Debuger.h"
+
+static enum shell_state __obj_shellLineHandler_obj_run(PikaObj *self, char *input_line){
+    /* exit */
+    if (strEqu("exit()", input_line)) {
+        /* exit pika shell */
+        return SHELL_STATE_EXIT;
+    }
+    /* run single line */
+    obj_run(self, input_line);
+    return SHELL_STATE_CONTINUE;
+}
+
+extern PikaObj* __pikaMain;
+void PikaDebug_Debuger_set_trace(PikaObj* self) {
+    obj_shellLineProcess(__pikaMain, __obj_shellLineHandler_obj_run);
+}

+ 2 - 1
port/linux/.vscode/settings.json

@@ -26,7 +26,8 @@
         "pikaconfigvalid.h": "c",
         "*.cfg": "c",
         "pikastdtask_task.h": "c",
-        "gtesttask_task.h": "c"
+        "gtesttask_task.h": "c",
+        "pikadebug_debuger.h": "c"
     },
     "python.formatting.provider": "autopep8"
 }

+ 5 - 0
port/linux/package/pikascript/PikaDebug.py

@@ -0,0 +1,5 @@
+from PikaObj import *
+
+class Debuger(TinyObj):
+    def set_trace():
+        pass

+ 7 - 9
port/linux/package/pikascript/main.py

@@ -3,16 +3,14 @@ import PikaStdDevice
 import PikaStdData
 import GTestTask
 import PikaMath
+import PikaDebug
 from PikaObj import *
 
+pkdb = PikaDebug.Debuger()
 
-def fun(a,b,c,d,e):
-    print(a)
-    print(b)
-    print(c)
-    print(d)
-    print(e)
+# i = 0
+# while i < 10:
+#     i = i + 1
+#     print('i :' + str(i))
+#     pkdb.set_trace()
 
-fun(10,20,30,40, 'xxx')
-# while True:
-    # pass

+ 17 - 0
port/linux/package/pikascript/pikascript-lib/PikaDebug/PikaDebuger_Debuger.c

@@ -0,0 +1,17 @@
+#include "PikaDebug_Debuger.h"
+
+static enum shell_state __obj_shellLineHandler_obj_run(PikaObj *self, char *input_line){
+    /* exit */
+    if (strEqu("exit()", input_line)) {
+        /* exit pika shell */
+        return SHELL_STATE_EXIT;
+    }
+    /* run single line */
+    obj_run(self, input_line);
+    return SHELL_STATE_CONTINUE;
+}
+
+extern PikaObj* __pikaMain;
+void PikaDebug_Debuger_set_trace(PikaObj* self) {
+    obj_shellLineProcess(__pikaMain, __obj_shellLineHandler_obj_run);
+}

+ 1 - 0
port/linux/pkg-push.sh

@@ -2,4 +2,5 @@ pkg=$1
 cp package/pikascript/pikascript-lib/$pkg ../../package/ -r
 cp package/pikascript/$pkg.py ../../package/$pkg/ 
 git add package/pikascript/pikascript-lib/$pkg
+git add package/pikascript/$pkg.py
 git add ../../package/$pkg