3
FWEB version 1.62 (September 25, 1998)
5
Based on version 0.5 of S. Levy's CWEB [copyright (C) 1987 Princeton University]
7
@x-----------------------------------------------------------------------------
9
@ In this header we handle stuff related to function prototypes.
11
@ The |PROTO| macro is used in \.{?\_type.hweb}.
15
@<Operating system-specific...@>=
18
#define PROTO(args) () // Old-style.
20
#define PROTO(args) args // New-style.
21
#endif // |PROTOTYPES|
23
@ Here we deal with variable arguments.
29
@<Operating system...@>=
32
/* Sun's system is hopeless. */
39
#if VARIABLE_ARGUMENTS
40
#define ELLIPSIS ,... /* ANSI standard; VAX allows for old-style
45
#define VA_ALIST(args) (va_alist) // Sun's way.
46
#define VA_DCL(args) va_dcl
47
#define VA_START(a,n) va_start(a)
49
#define VA_ALIST(args) args // ANSI way.
50
#define VA_DCL(args) args
51
#define VA_START(a,n) va_start(a,n)
53
#define VA_LIST(a) va_list a;
55
#define ELLIPSIS /* Not permitted by \.{gcc} for old-style
57
#define VA_ARGS ,arg_ptr
58
#define arg_ptr arg1,arg2,arg3,arg4,arg5,arg6,\
59
arg7,arg8,arg9,arg10,arg11,arg12,arg13
60
#define VA_start outer_char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,\
61
*arg7,*arg8,*arg9,*arg10,*arg11,*arg12,*arg13;
62
#define VA_ALIST(args) args
63
#define VA_DCL(args) args
68
#define va_arg(a,type) (type)"KLUDGE for va_arg"
71
#define vprintf printf
72
#define vsprintf sprintf
73
#endif /* ANSI variable arguments. */
75
@ The compilers have various understandings of |void| and |const|.
77
@f SRTN void /* Identifies functions that return |void|. */
78
@f CONST static /* Identifies things that aren't changed by function calls,
79
or that can be placed in read-only memory. */
81
@<Operating system...@>=
83
#if !NO_VOID /* \.{Machine-dependent}: For machines
84
that understand about |void *| or |void fcn()|. */
88
#define VOID /* For use in function declarations. */
91
#endif /* |void| stuff. */
99
@ The following macros make either old- or new-style function declarations.
107
@<Operating system...@>=
110
/* Old-style declarations. */
111
#define FCN(args) args
114
#define C2(cmnt) ;VA_start
116
/* New-style declarations. To use these macros, function declarations
117
should have form |main FCN((num_args,args))|. See one of the \FWEB\
118
sources for examples of the use of~|C0|, |C1|, and~|C2|. */
121
#define C0(cmnt) , /* Intermediate comments. */
123
#define C1(cmnt) ) /* Comment on last argument. */
125
#define C2(cmnt) ,...) /* Variable args. */
126
#endif // |PROTOTYPES|