home *** CD-ROM | disk | FTP | other *** search
- @(#) README 1.1 91/09/01 23:08:31
-
- unproto - ANSI C to old C converter
-
- Purpose:
-
- This is a filter that sits in between the C preprocessor and the next C
- compiler stage. Its purpose is to leave old-style C alone, and to
- de-ANSI-fy function headings, function pointer type declarations (and
- casts), function type declarations, and combinations thereof. Many
- freely-distributable unprotoizers have problems with the latter because
- they are based on a non-recursive algorithm or even make assumptions
- about code layout.
-
- The unprototyper has support for systems that require special tricks
- for variadic functions (many don't). A sample `stdarg.h' file is
- provided.
-
- Restrictions:
-
- Other ANSI-isms are just passed on without modification, such as
- trigraphs, token pasting (##), #pragmas and stringizing (#text).
-
- The unprototyper does not understand declarations of (whatever). The
- result will be a syntax error so this should not go by unnoticed.
-
- Operation:
-
- This package implements an non-default C preprocessor (the output from
- the default C preprocessor being piped through the unprototyper). How
- one tells the C compiler to use an non-default preprocessor program is
- somewhat compiler-dependent:
-
- SunOS 4.x: cc -Qpath directory_with_non-default_cpp ...
-
- SysV Rel2: cc -Bdirectory_with_non-default_cpp/ -tp ...
-
- Your C compiler manual should provide the necessary information.
-
- On some systems the lint(1) command is just a shell script, and writing
- a version that uses the unprototyper should not be too hard. With SunOS
- 4.x, /usr/bin/lint is not a shell script, but it accepts the same
- command syntax as the cc(1) for the specification of a non-default
- compiler pass.
-
- You may have to do some research on the lint command provided with your
- own machine.
-
- Configuration:
-
- Check the contents of the `stdarg.h' file provided with this package.
- This file serves a dual purpose. It should be included by C source file
- that implements ANSI-style variadic functions. It is also used to
- configure the `unproto' program so that it emits the proper magic for
- the `...' construct.
-
- The `stdarg.h' file contains definitions for the sparc architecture and
- for architectures that pass arguments via the stack (usually OK for
- 80*86, mc68k and vax C compilers). Risc processors often need special
- tricks. These are usually found in the file `/usr/include/varargs.h'.
-
- The file `varargs.c' provided with this package can be used to verify
- that the `stdarg.h' file has been set up correctly.
-
- For maximal flexibility, you can use the `cpp' shell script provided
- with this package to set up the pipe between the default C preprocessor
- and the unprototyper command. The script assumes that the unprototyper
- binary is called `unproto'. See the Makefile for details.
-
- The overhead of shell-script interpretation can be avoided by having
- the unprototyper itself open the pipe to the C preprocessor. In this
- case, the `unproto.c' source file should be compiled with the
- `PIPE_THROUGH_CPP' macro defined as the pathname of the C preprocessor
- (usually `/lib/cpp'), and the unprototyper binary should be called
- `cpp'. See the Makefile for details.
-
- Installation:
-
- Install the `stdarg.h' include file and the `unproto.1' manual page in
- suitable places.
-
- If you use the `cpp' shell script to pipe the preprocessor output
- through the unprototyper program, install the `unproto' binary in a
- place where the `cpp' shell script can find it, and install the `cpp'
- shell script in a suitable place.
-
- If the unprototyper itself opens the pipe to the C preprocessor (i.e.
- the unprototyper was built with the `PIPE_THROUGH_CPP' macro defined),
- install the `cpp' unprototyper binary in a suitable place.
-
- Wietse Venema
- wietse@wzv.win.tue.nl
- Eindhoven University of Technology
- The Netherlands
-