diff --git a/package/PikaDebug/PikaDebug.py b/package/PikaDebug/PikaDebug.py new file mode 100644 index 000000000..c3a412f95 --- /dev/null +++ b/package/PikaDebug/PikaDebug.py @@ -0,0 +1,5 @@ +from PikaObj import * + +class Debuger(TinyObj): + def set_trace(): + pass diff --git a/package/PikaDebug/PikaDebuger_Debuger.c b/package/PikaDebug/PikaDebuger_Debuger.c new file mode 100644 index 000000000..0bcd2ebec --- /dev/null +++ b/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); +} diff --git a/port/linux/.vscode/settings.json b/port/linux/.vscode/settings.json index b4b86e074..734bcd528 100644 --- a/port/linux/.vscode/settings.json +++ b/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" } \ No newline at end of file diff --git a/port/linux/package/pikascript/PikaDebug.py b/port/linux/package/pikascript/PikaDebug.py new file mode 100644 index 000000000..c3a412f95 --- /dev/null +++ b/port/linux/package/pikascript/PikaDebug.py @@ -0,0 +1,5 @@ +from PikaObj import * + +class Debuger(TinyObj): + def set_trace(): + pass diff --git a/port/linux/package/pikascript/main.py b/port/linux/package/pikascript/main.py index 38f2d276f..44bdf3beb 100644 --- a/port/linux/package/pikascript/main.py +++ b/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 diff --git a/port/linux/package/pikascript/pikascript-lib/PikaDebug/PikaDebuger_Debuger.c b/port/linux/package/pikascript/pikascript-lib/PikaDebug/PikaDebuger_Debuger.c new file mode 100644 index 000000000..0bcd2ebec --- /dev/null +++ b/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); +} diff --git a/port/linux/pkg-push.sh b/port/linux/pkg-push.sh index 288b51048..a48b28013 100644 --- a/port/linux/pkg-push.sh +++ b/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