/* ANSI and traditional C compatibility macros1Copyright 1991, 1992 Free Software Foundation, Inc.2This file is part of the GNU C Library.34This program is free software; you can redistribute it and/or modify5it under the terms of the GNU General Public License as published by6the Free Software Foundation; either version 2 of the License, or7(at your option) any later version.89This program is distributed in the hope that it will be useful,10but WITHOUT ANY WARRANTY; without even the implied warranty of11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12GNU General Public License for more details.1314You should have received a copy of the GNU General Public License15along with this program; if not, write to the Free Software16Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */1718/* ANSI and traditional C compatibility macros1920ANSI C is assumed if __STDC__ is #defined.2122Macro ANSI C definition Traditional C definition23----- ---- - ---------- ----------- - ----------24PTR `void *' `char *'25LONG_DOUBLE `long double' `double'26VOLATILE `volatile' `'27SIGNED `signed' `'28PTRCONST `void *const' `char *'29ANSI_PROTOTYPES 1 not defined3031CONST is also defined, but is obsolete. Just use const.3233DEFUN (name, arglist, args)3435Defines function NAME.3637ARGLIST lists the arguments, separated by commas and enclosed in38parentheses. ARGLIST becomes the argument list in traditional C.3940ARGS list the arguments with their types. It becomes a prototype in41ANSI C, and the type declarations in traditional C. Arguments should42be separated with `AND'. For functions with a variable number of43arguments, the last thing listed should be `DOTS'.4445DEFUN_VOID (name)4647Defines a function NAME, which takes no arguments.4849obsolete -- EXFUN (name, (prototype)) -- obsolete.5051Replaced by PARAMS. Do not use; will disappear someday soon.52Was used in external function declarations.53In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in54parentheses). In traditional C it is `NAME()'.55For a function that takes no arguments, PROTOTYPE should be `(void)'.5657PARAMS ((args))5859We could use the EXFUN macro to handle prototype declarations, but60the name is misleading and the result is ugly. So we just define a61simple macro to handle the parameter lists, as in:6263static int foo PARAMS ((int, char));6465This produces: `static int foo();' or `static int foo (int, char);'6667EXFUN would have done it like this:6869static int EXFUN (foo, (int, char));7071but the function is not external...and it's hard to visually parse72the function name out of the mess. EXFUN should be considered73obsolete; new code should be written to use PARAMS.7475For example:76extern int printf PARAMS ((CONST char *format DOTS));77int DEFUN(fprintf, (stream, format),78FILE *stream AND CONST char *format DOTS) { ... }79void DEFUN_VOID(abort) { ... }80*/8182#ifndef _ANSIDECL_H8384#define _ANSIDECL_H 1858687/* Every source file includes this file,88so they will all get the switch for lint. */89/* LINTLIBRARY */909192#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32)93/* All known AIX compilers implement these things (but don't always94define __STDC__). The RISC/OS MIPS compiler defines these things95in SVR4 mode, but does not define __STDC__. */9697#define PTR void *98#define PTRCONST void *CONST99#define LONG_DOUBLE long double100101#define AND ,102#define NOARGS void103#define CONST const104#define VOLATILE volatile105#define SIGNED signed106#define DOTS , ...107108#define EXFUN(name, proto) name proto109#define DEFUN(name, arglist, args) name(args)110#define DEFUN_VOID(name) name(void)111112#define PROTO(type, name, arglist) type name arglist113#define PARAMS(paramlist) paramlist114#define ANSI_PROTOTYPES 1115116#else /* Not ANSI C. */117118#define PTR char *119#define PTRCONST PTR120#define LONG_DOUBLE double121122#define AND ;123#define NOARGS124#define CONST125#ifndef const /* some systems define it in header files for non-ansi mode */126#define const127#endif128#define VOLATILE129#define SIGNED130#define DOTS131132#define EXFUN(name, proto) name()133#define DEFUN(name, arglist, args) name arglist args;134#define DEFUN_VOID(name) name()135#define PROTO(type, name, arglist) type name ()136#define PARAMS(paramlist) ()137138#endif /* ANSI C. */139140#endif /* ansidecl.h */141142143