1 ?RCS: $Id: prototype.U,v 3.0.1.3 1994/05/06 15:11:49 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: $Log: prototype.U,v $
12 ?RCS: Revision 3.0.1.3 1994/05/06 15:11:49 ram
13 ?RCS: patch23: ensure cc flags used when looking for prototype support
15 ?RCS: Revision 3.0.1.2 1994/01/24 14:15:36 ram
16 ?RCS: patch16: prototype handling macros now appear only when needed
18 ?RCS: Revision 3.0.1.1 1993/08/25 14:03:12 ram
19 ?RCS: patch6: defines were referring to non-existent VOID symbol
21 ?RCS: Revision 3.0 1993/08/18 12:09:36 ram
22 ?RCS: Baseline for dist 3.0 netwide release.
24 ?MAKE:prototype: Myread Oldconfig cat +cc +ccflags rm Setvar i_stdlib
25 ?MAKE: -pick add $@ %<
27 ?S: This variable holds the eventual value of CAN_PROTOTYPE, which
28 ?S: indicates the C compiler can handle funciton prototypes.
30 ?C:CAN_PROTOTYPE ~ %<:
31 ?C: If defined, this macro indicates that the C compiler can handle
32 ?C: function prototypes.
35 ?C: This macro is used to specify the ... in function prototypes which
36 ?C: have arbitrary additional arguments.
39 ?C: This macro is used to separate arguments in the declared argument list.
42 ?C: This macro is used to declare "private" (static) functions.
43 ?C: It takes three arguments: the function type and name, a parenthesized
44 ?C: traditional (comma separated) argument list, and the declared argument
45 ?C: list (in which arguments are separated with NXT_ARG, and additional
46 ?C: arbitrary arguments are specified with DOTS). For example:
48 ?C: P_FUNC(int foo, (bar, baz), int bar NXT_ARG char *baz[])
51 ?C: This macro is used to declare "private" (static) functions that have
52 ?C: no arguments. The macro takes one argument: the function type and name.
55 ?C: P_FUNC_VOID(int subr)
58 ?C: This macro is used to declare "public" (non-static) functions.
59 ?C: It takes three arguments: the function type and name, a parenthesized
60 ?C: traditional (comma separated) argument list, and the declared argument
61 ?C: list (in which arguments are separated with NXT_ARG, and additional
62 ?C: arbitrary arguments are specified with DOTS). For example:
64 ?C: V_FUNC(int main, (argc, argv), int argc NXT_ARG char *argv[])
67 ?C: This macro is used to declare "public" (non-static) functions that have
68 ?C: no arguments. The macro takes one argument: the function type and name.
71 ?C: V_FUNC_VOID(int fork)
74 ?C: This macro is used to declare function parameters for folks who want
75 ?C: to make declarations with prototypes using a different style than
76 ?C: the above macros. Use double parentheses. For example:
78 ?C: int main _((int argc, char *argv[]));
80 ?H:?%<:#$prototype CAN_PROTOTYPE /**/
81 ?H:?_:#ifdef CAN_PROTOTYPE
82 ?H:?NXT_ARG:#define NXT_ARG ,
83 ?H:?DOTS:#define DOTS , ...
84 ?H:?V_FUNC:#define V_FUNC(name, arglist, args)name(args)
85 ?H:?P_FUNC:#define P_FUNC(name, arglist, args)static name(args)
86 ?H:?V_FUNC_VOID:#define V_FUNC_VOID(name)name(void)
87 ?H:?P_FUNC_VOID:#define P_FUNC_VOID(name)static name(void)
88 ?H:?_:#define _(args) args
90 ?H:?NXT_ARG:#define NXT_ARG ;
92 ?H:?V_FUNC:#define V_FUNC(name, arglist, args)name arglist args;
93 ?H:?P_FUNC:#define P_FUNC(name, arglist, args)static name arglist args;
94 ?H:?V_FUNC_VOID:#define V_FUNC_VOID(name)name()
95 ?H:?P_FUNC_VOID:#define P_FUNC_VOID(name)static name()
96 ?H:?_:#define _(args) ()
99 ?W:%<:NXT_ARG DOTS V_FUNC P_FUNC V_FUNC_VOID P_FUNC_VOID _
101 : Cruising for prototypes
103 echo "Checking out function prototypes..." >&4
104 $cat >prototype.c <<EOCP
109 int main(int argc, char *argv[]) {
112 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
113 echo "Your C compiler appears to support function prototypes."
116 echo "Your C compiler doesn't seem to understand function prototypes."