From 3e793a7b079da1208a3baebd1ea66abe54b7ed49 Mon Sep 17 00:00:00 2001 From: s-over-4 Date: Mon, 11 Sep 2023 14:41:24 -0400 Subject: preprocessor plans --- examples/preprocessor.halk | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/preprocessor.halk (limited to 'examples') 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# -- cgit v1.2.3