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

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
How to set ISPP defines based on default Inno Setup variables?
standalone C++ preprocessor
Annotations in OCaml
Obtaining the include paths cpp searches
Test for empty macro definition
m4 does not obey expansion?
Detect compilation on Bada OS

Categories

HOME
httparty
ng-idle
themes
requirements
vsm
bing-maps
fosrestbundle
fhir
appcelerator-studio
mautic
keytool
pyramid
digital-signature
delphi-xe5
replication
symbols
object-storage
aggregation
displaytag
jboss6.x
mount
licensing
shared
outliers
paperjs
custom-controls
card.io
getpixel
nested-lists
xajax
verifiable-c
news
tasm
doc
datacachefactory
escpos
ssrs-2014
outputcache
tcc
insight
context-switch
video-conferencing
cpu-cache
django-1.10
swingworker
node-request
spring-cloud-feign
resourcemanager
jboss-tools
jquery-jscrollpane
dimension
nss
thread-sleep
gocql
xvim
zen-cart
sony-lifelog-api
ember-cli-rails
eoferror
telepat
apache-spark-1.3
delayed-execution
dbaccess
execve
imagefilter
encryption-asymmetric
xml-namespaces
renderer
websphere-esb
http-patch
gpars
time.h
actiondispatch
wp7test
server-administration
curb
vfs
garbage
promotion-code
matlab-load
collectionviewsource
svk
commerceserver2007
undefined-index
updatesourcetrigger
maven-1
ajax-polling
request-headers
sifr
application-planning
business-model

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