3 ms·
I was considering doing something like this just the other day. It had a gnuplot script and it seemed to me that it would be so much more versatile if I could u
by _benj 2y ago
I was considering doing something like this just the other day. It had a gnuplot script and it seemed to me that it would be so much more versatile if I could use #ifdefine and #include in it.
I ended up using a Perl preprocessor, but it seems like cpp would work ok-ish for certain use cases that don’t require, say, strict tabs like Python among a few other things mentioned on the cpp manual.
- webstrand 2y agoCheck out https://github.com/logological/gpp https://github.com/logological/gpp it's what I use when I feel like I need a preprocessor. It's more flexible in syntax and operation than cpp. I've used it in the past for wrangling the definitions of a multitude of SQL triggers I was using to generate a real-time materialized view. The fact that you can modify its syntax is very helpful for making it work with non-C syntaxes (like SQL or even LaTeX). It even has an HTML mode built-in, which you can customize to your needs, but looks like: <#define x|y> <#macro arg|...> which works better for certain WYSIWYG editors. You could modify the syntax to be <!--#define x y--> <!--#macro(arg, ...)-->
- _benj 2y agoThanks for sharing! Looks just like what I need :-)