Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #152 > unrolled thread

C or Similar Preprocessor for General Use

Started byGene Wirchenko <genew@ocis.net>
First post2011-06-16 14:23 -0700
Last post2011-06-17 12:56 -0400
Articles 7 — 7 participants

Back to article view | Back to comp.compilers


Contents

  C or Similar Preprocessor for General Use Gene Wirchenko <genew@ocis.net> - 2011-06-16 14:23 -0700
    Re: C or Similar Preprocessor for General Use Gene <gene.ressler@gmail.com> - 2011-06-16 19:03 -0700
    Re: C or Similar Preprocessor for General Use BGB <cr88192@hotmail.com> - 2011-06-16 23:27 -0700
    C or Similar Preprocessor for General Use ray roth <rayroth@pacbell.net> - 2011-06-17 00:03 -0700
    Re: C or Similar Preprocessor for General Use Robbert Haarman <comp.compilers@inglorion.net> - 2011-06-17 10:25 +0200
    Re: C or Similar Preprocessor for General Use Roberto Waltman <usenet@rwaltman.com> - 2011-06-17 12:03 -0400
    Re: C or Similar Preprocessor for General Use "Akakima" <akakima33@gmail.com> - 2011-06-17 12:56 -0400

#152 — C or Similar Preprocessor for General Use

FromGene Wirchenko <genew@ocis.net>
Date2011-06-16 14:23 -0700
SubjectC or Similar Preprocessor for General Use
Message-ID<11-06-026@comp.compilers>
Dear Compiler-Types:

     I am looking for a CLI-driven preprocessor that I can use on a
Windows system for preprocessing text files (not C programs, BTW). The
C preprocessor has about the features I need.

     Web searches for something to do the job have not been very
fruitful.

     Does anyone know of something simple that will do the job?

     (In the meantime, I am slowly putting something together with not
as many features, but that will work I hope.)

Sincerely,

Gene Wirchenko
[I pointed him at a Windows port of Gnu m4 -John]

[toc] | [next] | [standalone]


#153

FromGene <gene.ressler@gmail.com>
Date2011-06-16 19:03 -0700
Message-ID<11-06-027@comp.compilers>
In reply to#152
As John says, M4 works fine under Windows. You can also install any of
the several versions of gcc for Windows (see the FAQ) and use the -E
option.  It's not terribly hard to build a simple preprocessor with a
scripting language like Perl.  I have looked at mcpp in the past (see
Source Forge).  It looks pretty good and works on Windows.
http://mcpp.sourceforge.net/download.html

[toc] | [prev] | [next] | [standalone]


#154

FromBGB <cr88192@hotmail.com>
Date2011-06-16 23:27 -0700
Message-ID<11-06-028@comp.compilers>
In reply to#152
On 6/16/2011 2:23 PM, Gene Wirchenko wrote:

>       I am looking for a CLI-driven preprocessor that I can use on a
> Windows system for preprocessing text files (not C programs, BTW). The
> C preprocessor has about the features I need.

> Gene Wirchenko
> [I pointed him at a Windows port of Gnu m4 -John]


fair enough...


just in-case he wants a preprocessor with much more C like syntax (IMHO
m4 is a bit... weird...), I have put mine up on my server:
http://cr88192.dyndns.org/bgb_sapp.c

my server is not always up, as this is a personally-run server (at my
house, behind an ADSL connection).


was going to slap an MIT style license on it, but I noted I had already
put it under public domain, either way, it is free to use it however.

it does support a number of extensions though from the standard C
preprocessor, such as:
delayed expansion (via "##"/"###"/... directives);
block macros ("#macro name(args) ... #endmacro" IIRC);
in-place substitution ("$(name)");
...

but, sadly, these features are not really documented.

but, hell, in case it might be helpful, I am putting it up.

[toc] | [prev] | [next] | [standalone]


#155

Fromray roth <rayroth@pacbell.net>
Date2011-06-17 00:03 -0700
Message-ID<11-06-029@comp.compilers>
In reply to#152
if you have visual studio, you can run it in command-line mode.
it has /E switch which is equivalent to -E on most cc drivers.
ie,  copies preprocessor output to standard output

here is is the url documenting visual studio compiler options:
http://msdn.microsoft.com/en-us/library/fwkeyyhe%28v=vs.80%29.aspx
and this is how to compiler programs from the command line:
http://msdn.microsoft.com/en-us/library/ms235639%28v=vs.80%29.aspx

there is always cygwin....

if you go this route, just use cpp directly.

ray roth

[toc] | [prev] | [next] | [standalone]


#156

FromRobbert Haarman <comp.compilers@inglorion.net>
Date2011-06-17 10:25 +0200
Message-ID<11-06-030@comp.compilers>
In reply to#152
Hi Gene,

On Thu, Jun 16, 2011 at 02:23:51PM -0700, Gene Wirchenko wrote:
>      I am looking for a CLI-driven preprocessor that I can use on a
> Windows system for preprocessing text files (not C programs, BTW). The
> C preprocessor has about the features I need.

Have you taken a look at GPP (http://en.nothingisreal.com/wiki/GPP)?

Cheers,

Bob

[toc] | [prev] | [next] | [standalone]


#157

FromRoberto Waltman <usenet@rwaltman.com>
Date2011-06-17 12:03 -0400
Message-ID<11-06-031@comp.compilers>
In reply to#152
Gene Wirchenko wrote:

>Dear Compiler-Types:

Sorry, I am typeless...

>     I am looking for a CLI-driven preprocessor that I can use on a
>Windows system for preprocessing text files (not C programs, BTW). The
>C preprocessor has about the features I need.
>     Web searches for something to do the job have not been very
>fruitful.
>     Does anyone know of something simple that will do the job?

Gema?   http://gema.sourceforge.net/new/index.shtml
--
Roberto Waltman

[toc] | [prev] | [next] | [standalone]


#158

From"Akakima" <akakima33@gmail.com>
Date2011-06-17 12:56 -0400
Message-ID<11-06-032@comp.compilers>
In reply to#152
> C Preprocessor

I worked on this, part time, for some time now.

I finally have something which is usable.

I need it to preprocess Yacc grammars.

Started with the C preprocessor of Plan 9.
http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/cpp/

I have some code cleanup to do, and will publish the result next week.
I would also like to write a man page.

I made some small modifications to the original code.
Replaced the lexer with a flex generated one.
The new lexer is marginally faster and easier to modify.
Replaced the hash function with a faster (real faster) one found on the net.

Works on windows. Compiled with gcc (Cygwin, Mingw)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.compilers


csiph-web