You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently wanted to get rid of the cruft from my config.h removing all the conditional lines. I instinctively used cpp feeding it patches.h for the macros and telling it to retain comments to get the desired result.
Thanks for the suggestion, and the tip. Yes I think the whole script can be simplified with this so I shall have a closer look at my earliest convenience.
I was actually looking for something like this back when I wrote the finalizer but didn't come across cpp in my searches, hence the rather complicated awk script.
At first glance I don't foresee any complications using cpp for the bulk work.
I have had a closer look and using cpp is not that straightforward as I first thought.
The key is that we will want to preprocess only the directives that are present in patches.h and leave everything else as-is. Using cpp I end up with a dwm.c that has more than 24K lines including everything from /usr/include/X11/Xft/Xft.h and all related libraries.
From the man page:
The cpp command expects two file names as arguments, infile and outfile. The preprocessor reads infile together with any other file s it specifies with #include. All the output generated by the combined input files is written in outfile.
I didn't see any way around this based on the command line options. Possibly it might be possible with another preprocessor tool. I tried m4 but that is not designed for this.
I recently wanted to get rid of the cruft from my config.h removing all the conditional lines. I instinctively used
cpp
feeding it patches.h for the macros and telling it to retain comments to get the desired result.I ran something like this:
cpp config.h.old -imacros patches.h -C -o config.h
I then realized I couldve used this script and out of curiosity I checked the implementation.
IDK if this project is actively developed, but perhaps the ginormous awk program can be shortened with
cpp
?The text was updated successfully, but these errors were encountered: