Skip to content

Commit 9c473b2

Browse files
authored
Merge pull request #322 from boriel/bugfix/Command_line_define_values_ignored
Bugfix/command line define values ignored
2 parents 869b2ef + e8a2cf9 commit 9c473b2

15 files changed

Lines changed: 155 additions & 22 deletions

tests/functional/define_val.asm

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
org 32768
2+
__START_PROGRAM:
3+
di
4+
push ix
5+
push iy
6+
exx
7+
push hl
8+
exx
9+
ld hl, 0
10+
add hl, sp
11+
ld (__CALL_BACK__), hl
12+
ei
13+
ld hl, 0
14+
ld b, h
15+
ld c, l
16+
__END_PROGRAM:
17+
di
18+
ld hl, (__CALL_BACK__)
19+
ld sp, hl
20+
exx
21+
pop hl
22+
exx
23+
pop iy
24+
pop ix
25+
ei
26+
ret
27+
__CALL_BACK__:
28+
DEFW 0
29+
ZXBASIC_USER_DATA:
30+
; Defines DATA END --> HEAP size is 0
31+
ZXBASIC_USER_DATA_END:
32+
; Defines USER DATA Length in bytes
33+
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
34+
END

tests/functional/define_val.bas

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
#ifdef MACRO
3+
# if MACRO != VALUE
4+
# error "MACRO should be VALUE"
5+
# endif
6+
#endif
7+
8+

tests/functional/prepro91.bi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
#ifdef MACRO
3+
# if MACRO != VALUE
4+
WRONG
5+
# endif
6+
#else
7+
OK
8+
#endif
9+

tests/functional/prepro91.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#line 1 "prepro91.bi"
2+
#line 7 "prepro91.bi"
3+
OK
4+
#line 9 "prepro91.bi"

tests/functional/prepro92.bi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
REM Checks -D MACRO=VALUE is defined correctly from zxbc commandline
3+
4+
#ifdef MACRO
5+
# error This should not happen
6+
#else
7+
OK
8+
#endif
9+

tests/functional/prepro92.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#line 1 "prepro92.bi"
2+
#line 7 "prepro92.bi"
3+
OK
4+
#line 9 "prepro92.bi"

tests/functional/prepro93.bi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
REM Checks -D MACRO=VALUE is defined correctly from zxbc commandline
3+
4+
#ifdef MACRO
5+
# if MACRO != VALUE
6+
# error This should not happen
7+
# endif
8+
#else
9+
OK
10+
#endif
11+

tests/functional/prepro93.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#line 1 "prepro93.bi"
2+
#line 9 "prepro93.bi"
3+
OK
4+
#line 11 "prepro93.bi"

tests/functional/prepro94.bi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
#ifdef MACRO
4+
# ifndef ANOTHER_MACRO
5+
# error This should not happen
6+
# endif
7+
#else
8+
OK
9+
#endif

tests/functional/prepro94.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#line 1 "prepro94.bi"
2+
#line 8 "prepro94.bi"
3+
OK
4+
#line 10 "prepro94.bi"

0 commit comments

Comments
 (0)