aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authors-over-42023-09-11 14:41:24 -0400
committers-over-42023-09-11 14:41:24 -0400
commit3e793a7b079da1208a3baebd1ea66abe54b7ed49 (patch)
tree1aff2ad929708c026e08c0404a4f7ff4a5b93ecd /examples
parent3fd9ad7da3c92cf45779828aff27c0ab3bb936c6 (diff)
preprocessor plans
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#