[comp.os.minix] cpp

kjh@pollux.usc.edu (Kenneth J. Hendrickson) (06/05/91)

I've been trying to get a working cpp for Minix-386.  I've been at it
for about 12 hours now.  I'm frustrated.

I got what seems to be DECUS cpp from the plains archive, in the oz
directory.  I compiled it OK with bcc, but it barfs badly when fed any
input.

I got a port of gnu-cpp from earlier this year when Guy Helmer posted
it.  This also compiles just fine with bcc, but it also gags a little
bit on those *.x files in the kernel.

Where can I get a working cpp?  What modifications do I need to do so it
will work on all those *.x files?  What's the big secret?

I've been bashing my head against the wall all night.  It's 6:00 am
local time.  I'm going to bed.  I hope that when I get up some nice
person will have left some mail in my mailbox.  Thank you.

-- 
favourite oxymorons:   student athlete, military justice, mercy killing
Ken Hendrickson N8DGN/6       kjh@usc.edu      ...!uunet!usc!pollux!kjh

kevin@nuchat.sccsi.com (Kevin Brown) (06/05/91)

In article <33354@usc> kjh@pollux.usc.edu (Kenneth J. Hendrickson) writes:
>I've been trying to get a working cpp for Minix-386.  I've been at it
>for about 12 hours now.  I'm frustrated.
>
>I got what seems to be DECUS cpp from the plains archive, in the oz
>directory.  I compiled it OK with bcc, but it barfs badly when fed any
>input.



>
>I got a port of gnu-cpp from earlier this year when Guy Helmer posted
>it.  This also compiles just fine with bcc, but it also gags a little
>bit on those *.x files in the kernel.

This is because it tries to implement the ANSI standard, which says
something about tic marks (') being special somehow.  There are such
marks in the .x files that aren't within C-style comment markers, so
cpp thinks it's a quote mark.  :-(

The quote mark, I *think*, is used to protect a section of text against
macro expansion, so the quote mark parsing has to be global.  :-(

To get DECUS cpp to behave reasonably on the .x files, use the -E flag.
It will still spew forth "errors", but it won't return a nonzero exit
code, so your make won't stop dead on you.

If I recall correctly, gnu-cpp has a -traditional flag that will tell it
to *not* implement the ANSI standard and just be a regular cpp.  I don't
use it, though, because it seems to be bigger than a cpp should be.  :-)

>Where can I get a working cpp?  What modifications do I need to do so it
>will work on all those *.x files?  What's the big secret?

See above.

Obviously you're not a Real Hacker (tm) because if you were you would have
been able to figure the above out by looking at a hex dump of the
executable.  :-)

>I've been bashing my head against the wall all night.  It's 6:00 am
>local time.  I'm going to bed.  I hope that when I get up some nice
>person will have left some mail in my mailbox.  Thank you.

This question is asked often enough that I thought it would be better
to post instead of mail.

>favourite oxymorons:   student athlete, military justice, mercy killing
>Ken Hendrickson N8DGN/6       kjh@usc.edu      ...!uunet!usc!pollux!kjh



--
Kevin Brown						    Disclaimer: huh?
kevin@nuchat.sccsi.com				kevin@taronga.hackercorp.com
...!uunet!nuchat!kevin			      ...!uunet!nuchat!taronga!kevin

Minix -- the Unix[tm] of the 90's.  System V -- the Multics of the 90's.  :-)

ghelmer@dsuvax.uucp (Guy Helmer) (06/06/91)

In <33354@usc> kjh@pollux.usc.edu (Kenneth J. Hendrickson) writes:

>I got a port of gnu-cpp from earlier this year when Guy Helmer posted
>it.  This also compiles just fine with bcc, but it also gags a little
>bit on those *.x files in the kernel.

I wondered when someone would notice :-(.  C preprocessors, or at least
ANSI ones, must know about literal strings and characters in the input.
There are comments in the .x files that have apostraphes in them, and
this C preprocessor doesn't appreciate apostraphes anywhere in the
input unless they are enclosed in C-style /* comments. */

My solution: I took all the apostraphes out of the .x files.  Unfortunately,
I neglected to mention it when I posted the C preprocessor.

>Where can I get a working cpp?  What modifications do I need to do so it
>will work on all those *.x files?  What's the big secret?

>I've been bashing my head against the wall all night.  It's 6:00 am
>local time.  I'm going to bed.  I hope that when I get up some nice
>person will have left some mail in my mailbox.  Thank you.

Hope this helps.

>-- 
>favourite oxymorons:   student athlete, military justice, mercy killing
>Ken Hendrickson N8DGN/6       kjh@usc.edu      ...!uunet!usc!pollux!kjh
-- 
Guy Helmer, Dakota State University Computing Services
helmer@sdnet.bitnet, dsuvax!ghelmer@wunoc.wustl.edu, ghelmer@dsuvax.dsu.edu
"Everybody need a soft filter / Everybody need reverse polarity" - Rush