summaryrefslogtreecommitdiff
path: root/mcon/U/prototype.U
diff options
context:
space:
mode:
Diffstat (limited to 'mcon/U/prototype.U')
-rw-r--r--mcon/U/prototype.U118
1 files changed, 118 insertions, 0 deletions
diff --git a/mcon/U/prototype.U b/mcon/U/prototype.U
new file mode 100644
index 0000000..35558e8
--- /dev/null
+++ b/mcon/U/prototype.U
@@ -0,0 +1,118 @@
+?RCS: $Id: prototype.U,v 3.0.1.3 1994/05/06 15:11:49 ram Exp $
+?RCS:
+?RCS: Copyright (c) 1991-1993, 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 3.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'
+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*
+