L1VM - preprocessor macros
L1VM - preprocessor macros
I did change the preprocessor to make it possible to write macros function like. So now you can write:
// Is this a function or a macro? ;)
(textvar :print_s !)
or, the other way as:
print_s (textvar)
Here is a full example of the new macros called as functions:
// hello-func.l1com
//
// new macro called as functions example!
//
#include <intr.l1h>
// define macro
#func square (X, SQUARE) :{SQUARE = X * X}
(main func)
(set int64 1 zero 0)
(set int64 1 x 23)
(set int64 1 y 42)
(set int64 1 a 0)
(set int64 1 sq 0)
(set string s hello "Hello world!")
// print string
(hello :print_s !)
(:print_n !)
((x y *) a =)
(a :print_i !)
(:print_n !)
(y sq :square !)
(sq :print_i !)
(:print_n !)
(zero :exit !)
(funcend)
Have fun!