]> git.sur5r.net Git - openldap/blob - build/unproto/unproto.1
Initial revision
[openldap] / build / unproto / unproto.1
1 .TH UNPROTO 1 
2 .ad
3 .fi
4 .SH NAME
5 unproto
6 \-
7 compile ANSI C with traditional UNIX C compiler
8 .SH PACKAGE
9 .na
10 .nf
11 unproto
12 .SH SYNOPSIS
13 .na
14 .nf
15 /somewhere/cpp ...
16
17 cc cflags -E file.c | unproto >file.i; cc cflags -c file.i
18 .SH DESCRIPTION
19 .ad
20 .fi
21 This document describes a filter that sits in between the UNIX
22 C preprocessor and the next UNIX C compiler stage, on the fly rewriting
23 ANSI-style syntax to old-style syntax. Typically, the program is
24 invoked by the native UNIX C compiler as an alternate preprocessor.
25 The unprototyper in turn invokes the native C preprocessor and
26 massages its output. Similar tricks can be used with the lint(1)
27 command.
28
29 Language constructs that are always rewritten:
30 .TP
31 function headings, prototypes, pointer types
32 ANSI-C style function headings, function prototypes, function
33 pointer types and type casts are rewritten to old style.
34 <stdarg.h> support is provided for functions with variable-length
35 argument lists.
36 .TP
37 character and string constants
38 The \\a and \\x escape sequences are rewritten to their (three-digit)
39 octal equivalents.
40
41 Multiple string tokens are concatenated; an arbitrary number of
42 whitespace or comment tokens may appear between successive
43 string tokens.
44
45 Within string constants, octal escape sequences are rewritten to the
46 three-digit \\ddd form, so that string concatenation produces correct
47 results.
48 .TP
49 date and time
50 The __DATE__ and __TIME__ tokens are replaced by string constants
51 of the form "Mmm dd yyyy" and "hh:mm:ss", respectively. The result
52 is subjected to string concatenation, just like any other string
53 constant.
54 .PP
55 Language constructs that are rewritten only if the program has been
56 configured to do so:
57 .TP
58 void types
59 The unprototyper can be configured to rewrite "void *" to "char *",
60 and even to rewrite plain "void" to "int".
61 These features are configurable because many traditional UNIX C
62 compilers do not need them.
63
64 Note: (void) argument lists are always replaced by empty ones.
65 .PP
66 ANSI C constructs that are not rewritten because the traditional
67 UNIX C preprocessor provides suitable workarounds:
68 .TP
69 const and volatile
70 Use the "-Dconst=" and/or "-Dvolatile=" preprocessor directives to
71 get rid of unimplemented keywords.
72 .TP
73 token pasting and stringizing
74 The traditional UNIX C preprocessor provides excellent alternatives.
75 For example:
76
77 .nf
78 .ne 2
79 #define string(bar)     "bar"           /* instead of: # x */
80 #define paste(x,y)      x/**\/y         /* instead of: x##y */
81 .fi
82
83 There is a good reason why the # and ## operators are not implemented
84 in the unprototyper.
85 After program text has gone through a non-ANSI C preprocessor, all
86 information about the grouping of the operands of # and ## is lost.
87 Thus, if the unprototyper were to perform these operations, it would
88 produce correct results only in the most trivial cases. Operands
89 with embedded blanks, operands that expand to null tokens, and nested
90 use of # and/or ## would cause all kinds of obscure problems.
91 .PP
92 Unsupported ANSI features:
93 .TP
94 trigraphs and #pragmas
95 Trigraphs are useful only for systems with broken character sets.
96 If the local compiler chokes on #pragma, insert a blank before the
97 "#" character, and enclose the offending directive between #ifdef
98 and #endif.
99 .SH SEE ALSO
100 .na
101 .nf
102 .ad
103 .fi
104 cc(1), how to specify a non-default C preprocessor.
105 Some versions of the lint(1) command are implemented as a shell
106 script. It should require only minor modification for integration
107 with the unprototyper. Other versions of the lint(1) command accept
108 the same command syntax as the C compiler for the specification of a
109 non-default preprocessor. Some research may be needed.
110 .SH FILES
111 .na
112 .nf
113 /wherever/stdarg.h, provided with the unproto filter.
114 .SH DIAGNOSTICS
115 .ad
116 .fi
117 Problems are reported on the standard error stream.
118 A non-zero exit status means that there was a problem.
119 .SH BUGS
120 .ad
121 .fi
122 The unprototyper should be run on preprocessed source only:
123 unexpanded macros may confuse the program.
124
125 Declarations of (object) are misunderstood and will result in
126 syntax errors: the objects between parentheses disappear.
127
128 Sometimes does not preserve whitespace after parentheses and commas.
129 This is a purely aesthetical matter, and the compiler should not care.
130 Whitespace within string constants is, of course, left intact.
131
132 Does not generate explicit type casts for function-argument
133 expressions.  The lack of explicit conversions between integral
134 and/or pointer argument types should not be a problem in environments
135 where sizeof(int) == sizeof(long) == sizeof(pointer).  A more serious
136 problem is the lack of automatic type conversions between integral and
137 floating-point argument types.  Let lint(1) be your friend.
138 .SH AUTHOR(S)
139 .na
140 .nf
141 Wietse Venema (wietse@wzv.win.tue.nl)
142 Eindhoven University of Technology
143 Department of Mathematics and Computer Science
144 Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
145 .SH LAST MODIFICATION
146 .na
147 .nf
148 93/06/18 22:29:37
149 .SH VERSION/RELEASE
150 .na
151 .nf
152 1.6