preprocessor


Generic preprocessor: How to use for any kind of file?


I was wondering if someone uses a generic preprocessor for manipulating text files.
The idea came up, as Java does not have a preprocessor, but I'd like to have conditional code compilation, etc.
Now, taking that idea further, I might as well use a generic preprocessor for any kind of files that need frequent editing, but all edits are in a similar manner.
Now, there's good ol' m4 which I'd like to use as I use the C-preprocessor and there is GPP, that one however, stopped being developed in 2007.
I'd like some suggestions which preprocessor is preferable, if possible, it should take directives the same way C-preprocessor takes them #define SOMETHING.
Since m4 doesn't use sigils or something, it might collide with other code, when m4 is the way to go, I'd need advice on how to prefix every directive with a sigil or a different prefix or something.
Most C/C++ compilers allow you to just run the preprocessor and save the output, and can be used on generic input. (for Visual C++, I blieve the option is /P)
But remember the preprocessors cause as many problems as they solve. The designers of both C++ and Java have tried hard to eliminate the need for using the preprocessor. For example, in Java, code like this:
if (true)
CallThis();
else
DoNotCallThis();
will just generate code for the CallThis() call and not generate code for the condition or the else branch. (This is not a quality of Implementation issue --- it is a requirement of the Java language definition).
For a 'sigil', use m4's command line option -P to add prefix m4_ to all built-in m4 macros. You then have m4_define, m4_divert, etc.

Related Links

Preprocessor assertions in arduino
expanding a macro within a macro definition
GNU-M4: Strip empty lines
Escaping space in OpenCL compiler arguments
Does Corona have preprocessor statements so I can execute Lua code for specific devices?
Preprocessing in C++
Truncate string in cpp (preprocessor)
C++ precompiler conditionally include code
DDK preprocessor directives
Preprocessor, Postprocessor, Geometric Processor and NC processor
Gfortran pre-processor directives for Different Operating systems
Good data set for Pre-processing
IDE inserts incorrect #include statement
Save string in C preprocessor
Fortran preprocessing with Portland compiler
Making a macro expansion dependent on its arguments

Categories

HOME
go
design-patterns
spark-streaming
fftw
jelastic
shiro
gradient
appcelerator
square
limit
vert.x
lanczos
p2p
google-chrome-app
line
jsonpath
selenium-ide
plink
scrolltop
selectize.js
docx
chargify
smartclient
swagger-2.0
ksh
react-toolbox
exploit
scriptella
tiki-wiki
entity-relationship-model
user-defined-functions
uitapgesturerecognizer
userdefaults
kudu
memory-address
instantiation
batching
engine.io
imagenet
flatmap
nohup
z-notation
node-mssql
filesystemwatcher
apns-php
hackintosh
dbnull
tcc
file-sharing
strftime
cnc
facebook-pixel
seq
filenet
pytables
latin
qtplugin
async.js
rspec2
xdoclet
phpwebsocket
invoke-sqlcmd
contentcontrol
iokit
avisynth
vigenere
rpart
avahi
nsurlsessiondatatask
android-broadcast
administration
trdion2011
draw2d-js
amslidemenu
syndicationfeed
solace-mq
script#
pagedown
cardreader
midlet
pyunit
correlated-subquery
subproject
koken
convention
denied
expression-blend-4
matlab-load
fsevents
winmain
ruby-1.8
addchild
purepdf
mathematical-notation
windows-identity
fdf
linfu-dynamicproxy

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App