File tree Expand file tree Collapse file tree 5 files changed +53
-1
lines changed Expand file tree Collapse file tree 5 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -13,5 +13,6 @@ add_subdirectory(src/boot/demo02-add)
13
13
add_subdirectory (src/boot/demo03-usart )
14
14
add_subdirectory (src/boot/demo04-usarts )
15
15
add_subdirectory (src/boot/demo05-sysobject )
16
+ add_subdirectory (src/boot/demo06-pikamain )
16
17
add_subdirectory (src/boot/banchmark )
17
18
Original file line number Diff line number Diff line change
1
+ set (BINARY ${CMAKE_PROJECT_NAME} _demo06-pikamain )
2
+ file (GLOB_RECURSE THIS_SOURCES LIST_DIRECTORIES false *.h *.cpp *.c )
3
+ set (SOURCES ${THIS_SOURCES} )
4
+ add_executable (${BINARY} ${THIS_SOURCES} )
5
+ # 链接src生成的lib库和gtest库
6
+ target_link_libraries (${BINARY} PUBLIC
7
+ ${CMAKE_PROJECT_NAME} -core
8
+ )
Original file line number Diff line number Diff line change
1
+ /* this demo shows the usage of method */
2
+ #include "pikaScript.h"
3
+ #include <stdio.h>
4
+
5
+ void obj_runWithInfo (PikaObj * self , char * cmd )
6
+ {
7
+ printf (">>> %s\r\n" , cmd );
8
+ obj_run (self , cmd );
9
+ }
10
+
11
+ int main ()
12
+ {
13
+ PikaObj * pikaMain = pikaScriptInit ();
14
+ /* user input buff */
15
+ char inputBuff [256 ] = {0 };
16
+ /* run the script with check*/
17
+ printf (">>> " );
18
+ while (1 )
19
+ {
20
+ /* get user input */
21
+ fgets (inputBuff , sizeof (inputBuff ), stdin );
22
+
23
+ /* run PikaScript and get res */
24
+ Args * resArgs = obj_runDirect (pikaMain , inputBuff );
25
+
26
+ /* get system output of PikaScript*/
27
+ char * sysOut = args_getSysOut (resArgs );
28
+
29
+ if (!strEqu ("" , sysOut ))
30
+ {
31
+ /* print out the system output */
32
+ printf ("%s\r\n" , sysOut );
33
+ }
34
+ printf (">>> " );
35
+
36
+ /* deinit the res */
37
+ args_deinit (resArgs );
38
+ }
39
+ }
Original file line number Diff line number Diff line change 1
1
import PikaStdLib
2
2
3
3
print ('hello world' )
4
- mem = PikaStdLib .MemChecker ()
4
+ mem = PikaStdLib .MemChecker ()
5
+ print ('mem.max :' )
6
+ mem .max ()
7
+ print ('mem.now :' )
8
+ mem .now ()
You can’t perform that action at this time.
0 commit comments