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