aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/preprocessor.halk31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/preprocessor.halk b/examples/preprocessor.halk
new file mode 100644
index 0000000..a9d8987
--- /dev/null
+++ b/examples/preprocessor.halk
@@ -0,0 +1,31 @@
+`
+ #def# #ID# [#VALUE#] set a macro
+ #fed# #ID# unset a macro
+
+ #cde# #VALUE# leave code as is
+
+ #ddo# #ID?# #DIR# if defined, don't skip next directive (Defined DO)
+ #udo# #ID?# #DIR# if undefined, skip next directive (UnDefined Do)
+
+ #inc# #FPATH# include a file
+
+ #ID# call a macro or flag
+`
+
+` example usage: `
+
+#def# #VERSION# #"31.4.1"#
+
+#ddo# #BSD#
+ #inc# #bsd_support.halk#
+
+#udo# #OS#
+ #run# #
+ some-error-func."os not specified";
+ #
+
+#def# #OSTYPE# #
+ os/shell."sysctl kernel.ostype"
+#
+
+io/print.#OSTYPE#