Getting prototypes from an old-style C program

Carsten Bormann cabo at tub.UUCP
Mon Feb 29 09:32:14 AEST 1988


Since we needed this for getting C++ include files out of a C program,
I have hacked up a small program to extract ANSI C prototypes from old
style function body definitions.

If you don't need this right now, hit 'n' now.

The catch: I have given myself exactly eight hours to hack this up, so it
is a bletcherous hack, and has a number of limitations (outlined below).
It is also slow.  But if anyone really needs this now (before a real
solution is posted), I'm willing to 
1) send a SINGLE copy to someone in the Americas who then will post a
   message that he/she handles redistribution
2) post it (given sufficient demand); its source code is 16258 bytes.

I will only read messages that DO NOT come in over uunet/unido, as
messages over uunet cost too much real money for me.  So don't use
Reply hastily, use BITNET or the path in the .signature.

The limitations:

1) The program is one big memory leak.  It won't work on a large program
   if you have a small box.  It won't work on a 16-bit box at all.
2) It is full of pointer/integer problems.  You have to fix it.
3) It does not handle array parameters with specified sizes (so, e.g.
   in /usr/lib/lint/llib-lc, it does not handle pipe() correctly).
4) Since it uses cpp output, it turns FILE into struct _iobuf and
   other silly things, so you will have to edit the output by hand.
5) It loses the difference between extern and static functions.
6) You need a working yacc/lex combination (the code is based on the
   C grammar that was posted many moons ago).  You probably need UNIX.
7) Since it is such a bletcherous hack, you are not supposed to
   attribute my name to this code, and won't be able to sue me if
   it fails (which it will).
-- 
Carsten Bormann, <cabo at tub.UUCP> <cabo at db0tui6.BITNET> <cabo at tub.BITNET>
Communications and Operating Systems Research Group
Technical University of Berlin (West, of course...)
Path: ...!pyramid!tub!cabo from the world, ...!unido!tub!cabo from Europe only.



More information about the Comp.lang.c mailing list