File:  [gforth] / gforth / engine / ansidecl.h
Revision 1.2: download - view: text, annotated - select for diffs
Sat Sep 23 15:47:06 2000 UTC (23 years, 6 months ago) by anton
Branches: MAIN
CVS tags: v0-7-0, v0-6-2, v0-6-1, v0-6-0, v0-5-0, HEAD
changed FSF address in copyright messages

    1: /* Copyright (C) 1991 Free Software Foundation, Inc.
    2: This file is part of the GNU C Library.
    3: 
    4: The GNU C Library is free software; you can redistribute it and/or modify
    5: it under the terms of the GNU General Public License as published by
    6: the Free Software Foundation; either version 1, or (at your option)
    7: any later version.
    8: 
    9: The GNU C Library is distributed in the hope that it will be useful,
   10: but WITHOUT ANY WARRANTY; without even the implied warranty of
   11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12: GNU General Public License for more details.
   13: 
   14: You should have received a copy of the GNU General Public License
   15: along with the GNU C Library; see the file COPYING.  If not, write to
   16: the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111, USA.  */
   17: 
   18: /* ANSI and traditional C compatibility macros
   19: 
   20:    ANSI C is assumed if __STDC__ is #defined.
   21: 
   22:    Macro	ANSI C definition	Traditional C definition
   23:    -----	---- - ----------	----------- - ----------
   24:    PTR		`void *'		`char *'
   25:    LONG_DOUBLE	`long double'		`double'
   26:    CONST	`const'			`'
   27:    VOLATILE	`volatile'		`'
   28:    SIGNED	`signed'		`'
   29:    PTRCONST	`void *const'		`char *'
   30: 
   31:    DEFUN(name, arglist, args)
   32: 
   33: 	Defines function NAME.
   34: 
   35: 	ARGLIST lists the arguments, separated by commas and enclosed in
   36: 	parentheses.  ARGLIST becomes the argument list in traditional C.
   37: 
   38: 	ARGS list the arguments with their types.  It becomes a prototype in
   39: 	ANSI C, and the type declarations in traditional C.  Arguments should
   40: 	be separated with `AND'.  For functions with a variable number of
   41: 	arguments, the last thing listed should be `DOTS'.
   42: 
   43:    DEFUN_VOID(name)
   44: 
   45: 	Defines a function NAME, which takes no arguments.
   46: 
   47:    EXFUN(name, prototype)
   48: 
   49: 	Is used in an external function declaration.
   50: 	In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
   51: 	parentheses).  In traditional C it is `NAME()'.
   52: 	For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
   53: 
   54:     For example:
   55: 	extern int EXFUN(printf, (CONST char *format DOTS));
   56: 	int DEFUN(fprintf, (stream, format),
   57: 		  FILE *stream AND CONST char *format DOTS) { ... }
   58: 	void DEFUN_VOID(abort) { ... }
   59: */
   60: 
   61: #ifndef	_ANSIDECL_H
   62: 
   63: #define	_ANSIDECL_H	1
   64: 
   65: 
   66: /* Every source file includes this file,
   67:    so they will all get the switch for lint.  */
   68: /* LINTLIBRARY */
   69: 
   70: 
   71: #ifdef	__STDC__
   72: 
   73: #define	PTR		void *
   74: #define	PTRCONST	void *CONST
   75: #define	LONG_DOUBLE	long double
   76: 
   77: #define	AND		,
   78: #define	NOARGS		void
   79: #define	CONST		const
   80: #define	VOLATILE	volatile
   81: #define	SIGNED		signed
   82: #define	DOTS		, ...
   83: 
   84: #define	EXFUN(name, proto)		name proto
   85: #define	DEFUN(name, arglist, args)	name(args)
   86: #define	DEFUN_VOID(name)		name(NOARGS)
   87: 
   88: #else	/* Not ANSI C.  */
   89: 
   90: #define	PTR		char *
   91: #define	PTRCONST	PTR
   92: #define	LONG_DOUBLE	double
   93: 
   94: #define	AND		;
   95: #define	NOARGS
   96: #define	CONST
   97: #define	VOLATILE
   98: #define	SIGNED
   99: #define	DOTS
  100: 
  101: #define	EXFUN(name, proto)		name()
  102: #define	DEFUN(name, arglist, args)	name arglist args;
  103: #define	DEFUN_VOID(name)		name()
  104: 
  105: #endif	/* ANSI C.  */
  106: 
  107: 
  108: #endif	/* ansidecl.h	*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>