diff options
author | Robert de Bath <rdebath@poboxes.com> | 1997-02-25 20:42:19 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:38:07 +0200 |
commit | 4c36e9a0c125ccfff37aa440dab2cf58c4152fff (patch) | |
tree | a5d9c84ba2661029ddb2223dacd50529a361c3d5 /unproto/unproto.1 | |
parent | f8de35da65c5d93bb733073cf40da154bc1c0748 (diff) | |
parent | 9696d7b0e1f3a1b0f5fd4a0428eb75afe8ad4ed6 (diff) | |
download | dev86-4c36e9a0c125ccfff37aa440dab2cf58c4152fff.tar.gz |
Import Dev86src-0.0.11.tar.gzv0.0.11
Diffstat (limited to 'unproto/unproto.1')
-rw-r--r-- | unproto/unproto.1 | 137 |
1 files changed, 105 insertions, 32 deletions
diff --git a/unproto/unproto.1 b/unproto/unproto.1 index 671e917..31490c3 100644 --- a/unproto/unproto.1 +++ b/unproto/unproto.1 @@ -4,7 +4,7 @@ .SH NAME unproto \- -ANSI C to old C converter +compile ANSI C with traditional UNIX C compiler .SH PACKAGE .na .nf @@ -12,56 +12,129 @@ unproto .SH SYNOPSIS .na .nf -/lib/cpp ... | unproto - /somewhere/cpp ... + +cc cflags -E file.c | unproto >file.i; cc cflags -c file.i .SH DESCRIPTION .ad .fi -This document describes a filter that sits between the -C preprocessor (usually \fI/lib/cpp\fP) and the next C compiler -pass. It rewrites ANSI-C style function headers, function type -declarations, function pointer types, and function pointer casts -to old style. Other ANSI-isms are passed on without modification -(token pasting, pragmas, etcetera). +This document describes a filter that sits in between the UNIX +C preprocessor and the next UNIX C compiler stage, on the fly rewriting +ANSI-style syntax to old-style syntax. Typically, the program is +invoked by the native UNIX C compiler as an alternate preprocessor. +The unprototyper in turn invokes the native C preprocessor and +massages its output. Similar tricks can be used with the lint(1) +command. + +Language constructs that are always rewritten: +.TP +function headings, prototypes, pointer types +ANSI-C style function headings, function prototypes, function +pointer types and type casts are rewritten to old style. +<stdarg.h> support is provided for functions with variable-length +argument lists. +.TP +character and string constants +The \\a and \\x escape sequences are rewritten to their (three-digit) +octal equivalents. + +Multiple string tokens are concatenated; an arbitrary number of +whitespace or comment tokens may appear between successive +string tokens. + +Within string constants, octal escape sequences are rewritten to the +three-digit \\ddd form, so that string concatenation produces correct +results. +.TP +date and time +The __DATE__ and __TIME__ tokens are replaced by string constants +of the form "Mmm dd yyyy" and "hh:mm:ss", respectively. The result +is subjected to string concatenation, just like any other string +constant. +.PP +Language constructs that are rewritten only if the program has been +configured to do so: +.TP +void types +The unprototyper can be configured to rewrite "void *" to "char *", +and even to rewrite plain "void" to "int". +These features are configurable because many traditional UNIX C +compilers do not need them. + +Note: (void) argument lists are always replaced by empty ones. +.PP +ANSI C constructs that are not rewritten because the traditional +UNIX C preprocessor provides suitable workarounds: +.TP +const and volatile +Use the "-Dconst=" and/or "-Dvolatile=" preprocessor directives to +get rid of unimplemented keywords. +.TP +token pasting and stringizing +The traditional UNIX C preprocessor provides excellent alternatives. +For example: -For maximal flexibility, the "cpp | unproto" pipeline can be -packaged as an executable shell script named "/somewhere/cpp". -This script should then be specified to the C compiler as a -non-default preprocessor. +.nf +.ne 2 +#define string(bar) "bar" /* instead of: # x */ +#define paste(x,y) x/**\/y /* instead of: x##y */ +.fi -The overhead of shell script interpretation can be avoided by -having the unprototyper itself open the pipe to the preprocessor. -In that case, the source should be compiled with the PIPE_THROUGH_CPP -macro defined (usually as "/lib/cpp"), and the resulting binary -should be installed as "/somewhere/cpp". +There is a good reason why the # and ## operators are not implemented +in the unprototyper. +After program text has gone through a non-ANSI C preprocessor, all +information about the grouping of the operands of # and ## is lost. +Thus, if the unprototyper were to perform these operations, it would +produce correct results only in the most trivial cases. Operands +with embedded blanks, operands that expand to null tokens, and nested +use of # and/or ## would cause all kinds of obscure problems. +.PP +Unsupported ANSI features: +.TP +trigraphs and #pragmas +Trigraphs are useful only for systems with broken character sets. +If the local compiler chokes on #pragma, insert a blank before the +"#" character, and enclose the offending directive between #ifdef +and #endif. .SH SEE ALSO .na .nf .ad .fi cc(1), how to specify a non-default C preprocessor. - -Some versions of the lint command are implemented as a shell +Some versions of the lint(1) command are implemented as a shell script. It should require only minor modification for integration -with the unprotoizer. Other versions of the lint command accept the same -command syntax as the C compiler for the specification of a non-default -preprocessor. Some research may be needed. +with the unprototyper. Other versions of the lint(1) command accept +the same command syntax as the C compiler for the specification of a +non-default preprocessor. Some research may be needed. +.SH FILES +.na +.nf +/wherever/stdarg.h, provided with the unproto filter. .SH DIAGNOSTICS .ad .fi -The progam will complain if it unexpectedly -reaches the end of input. +Problems are reported on the standard error stream. +A non-zero exit status means that there was a problem. .SH BUGS .ad .fi -Should be run on preprocessed source only, i.e. after macro expansion. +The unprototyper should be run on preprocessed source only: +unexpanded macros may confuse the program. + +Declarations of (object) are misunderstood and will result in +syntax errors: the objects between parentheses disappear. -Declarations of (whatever) are misunderstood and will result in -syntax errors. +Sometimes does not preserve whitespace after parentheses and commas. +This is a purely aesthetical matter, and the compiler should not care. +Whitespace within string constants is, of course, left intact. -Does not generate explicit type casts for function argument -expressions. +Does not generate explicit type casts for function-argument +expressions. The lack of explicit conversions between integral +and/or pointer argument types should not be a problem in environments +where sizeof(int) == sizeof(long) == sizeof(pointer). A more serious +problem is the lack of automatic type conversions between integral and +floating-point argument types. Let lint(1) be your friend. .SH AUTHOR(S) .na .nf @@ -72,8 +145,8 @@ Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands .SH LAST MODIFICATION .na .nf -91/09/22 21:21:35 +93/06/18 22:29:37 .SH VERSION/RELEASE .na .nf -1.2 +1.6 |