general update, updated cimport so it parses struct definitions from imported headers, improved the error reporting, added ifdef and ifndef, added proper support for extern variadic functions, added some new sections and pages to the doc tool and added --check to only check the program corectness and run compile time defs without producing a binary
This commit is contained in:
44
tests/ifdef.sl
Normal file
44
tests/ifdef.sl
Normal file
@@ -0,0 +1,44 @@
|
||||
import stdlib/stdlib.sl
|
||||
import stdlib/io.sl
|
||||
|
||||
# Test ifdef: TESTFLAG is defined via -D TESTFLAG
|
||||
ifdef TESTFLAG
|
||||
word show_flag
|
||||
"flag_on" puts cr
|
||||
end
|
||||
endif
|
||||
|
||||
# Test ifndef: NOPE is NOT defined
|
||||
ifndef NOPE
|
||||
word show_nope
|
||||
"nope_off" puts cr
|
||||
end
|
||||
endif
|
||||
|
||||
# Test ifdef with elsedef
|
||||
ifdef TESTFLAG
|
||||
word branch
|
||||
"yes" puts cr
|
||||
end
|
||||
elsedef
|
||||
word branch
|
||||
"no" puts cr
|
||||
end
|
||||
endif
|
||||
|
||||
# Test nested: inner depends on outer
|
||||
ifdef TESTFLAG
|
||||
ifndef NOPE
|
||||
word nested
|
||||
"nested_ok" puts cr
|
||||
end
|
||||
endif
|
||||
endif
|
||||
|
||||
word main
|
||||
show_flag
|
||||
show_nope
|
||||
branch
|
||||
nested
|
||||
0
|
||||
end
|
||||
Reference in New Issue
Block a user