Skip to content

Commit 2a538af

Browse files
authored
Merge pull request #1 from jgOhYeah/master
Update for Python3 and add the option to automatically call the compiler once preprocessed for syntax checking or uploading.
2 parents d7cff1f + 1733db8 commit 2a538af

6 files changed

Lines changed: 319 additions & 35 deletions

File tree

1.bas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ goto init
66
#define testing
77
#define message sertxd("New Define")
88

9+
'the following line demonstrates specifiying a picaxe variant in-line
10+
'#picaxe 18M2
11+
912
init:
1013
toggle 1
1114
main:

2.bas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#DEFINE SetBackLedOn b0 =255 : toggle 2
55

6+
#include "4.bas"
67

78
#MACRO SerialMacro(leaf)
89

4.bas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Gosub SendHeadingSpeed
88
#ENDMACRO
99

10+
#cOm /dev/null
1011

1112
SendHeadingSpeed:
1213
return

compiled.bas

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
'-----PREPROCESSED BY picaxepreprocess.py-----
2+
'----UPDATED AT 01:32PM, December 13, 2020----
3+
'----SAVING AS compiled.bas ----
4+
5+
'---BEGIN main.bas ---
6+
'main.bas is the default file included if no input argument passed
7+
'---BEGIN 1.bas ---
8+
9+
goto init
10+
'---BEGIN 2.bas ---
11+
12+
#define MAGIC_NUMBER "83838838" 'DEFINITION PARSED
13+
14+
#DEFINE SetBackLedOn b0 =255 : toggle 2 'DEFINITION PARSED
15+
16+
'---BEGIN 4.bas ---
17+
toggle 2
18+
pause 500
19+
20+
'PARSED MACRO SetHeadingSpeed
21+
#cOm /dev/null 'SERIAL PORT PARSED
22+
23+
SendHeadingSpeed:
24+
return
25+
'---END 4.bas---
26+
27+
'PARSED MACRO SerialMacro
28+
'PARSED MACRO Assign
29+
'--START OF MACRO: Assign
30+
Let w0 = 1 * 2 + 3
31+
'--END OF MACRO: Assign( w0, 1 * 2 + 3 )
32+
33+
testloop:
34+
sertxd("83838838") 'DEFINE: "83838838" SUBSTITUTED FOR MAGIC_NUMBER
35+
b0 =255 : toggle 2 'DEFINE: b0 =255 : toggle 2 SUBSTITUTED FOR SetBackLedOn
36+
'--START OF MACRO: SerialMacro
37+
38+
sertxd("this is a macro :)", "37")
39+
40+
'--END OF MACRO: SerialMacro("37")
41+
pause 1000
42+
toggle 1
43+
return
44+
'---END 2.bas---
45+
'the following line demonstrates absolute paths. uncomment and set to an absolute path that exists on your system to test.
46+
'#include "/Users/patrickleiser/Documents/Programming/Robotics Club/PicaxeInclude/4.bas
47+
#define testing 'DEFINITION PARSED
48+
#define message sertxd("New Define") 'DEFINITION PARSED
49+
50+
#picaxe 18M2 'CHIP VERSION PARSED
51+
52+
init:
53+
toggle 1
54+
main:
55+
gosub testloop
56+
toggle 2
57+
'--START OF MACRO: SetHeadingSpeed
58+
w1 = 23
59+
b0 = 7
60+
Gosub SendHeadingSpeed
61+
'--END OF MACRO: SetHeadingSpeed(23, 7)
62+
pause 500
63+
'--START OF MACRO: SetHeadingSpeed
64+
w1 = 92
65+
b0 = 34
66+
Gosub SendHeadingSpeed
67+
'--END OF MACRO: SetHeadingSpeed(92,34)
68+
69+
#ifdef testing
70+
sertxd("Old Defines Still Work")
71+
#endif
72+
sertxd("New Define") 'DEFINE: sertxd("New Define") SUBSTITUTED FOR message
73+
74+
goto main
75+
76+
'---END 1.bas---
77+
sertxd ("ending main.bas")
78+
79+
'---END main.bas---

compiled.err

Whitespace-only changes.

0 commit comments

Comments
 (0)