| 1 | /* Copyright (C) 1989 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | This program 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 2 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program 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 this program; if not, write to the Free Software |
| 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 17 | |
| 18 | /* ANSI and traditional C compatibility macros |
| 19 | |
| 20 | ANSI C is assumed if __STDC__ is #defined. |
| 21 | |
| 22 | Macros |
| 23 | PTR - Generic pointer type |
| 24 | LONG_DOUBLE - `long double' type |
| 25 | CONST - `const' keyword |
| 26 | VOLATILE - `volatile' keyword |
| 27 | SIGNED - `signed' keyword |
| 28 | PTRCONST - Generic const pointer (void *const) |
| 29 | |
| 30 | EXFUN(name, prototype) - declare external function NAME |
| 31 | with prototype PROTOTYPE |
| 32 | DEFUN(name, arglist, args) - define function NAME with |
| 33 | args ARGLIST of types in ARGS |
| 34 | DEFUN_VOID(name) - define function NAME with no args |
| 35 | AND - argument separator for ARGS |
| 36 | NOARGS - null arglist |
| 37 | DOTS - `...' in args |
| 38 | |
| 39 | For example: |
| 40 | extern int EXFUN(printf, (CONST char *format DOTS)); |
| 41 | int DEFUN(fprintf, (stream, format), |
| 42 | FILE *stream AND CONST char *format DOTS) { ... } |
| 43 | void DEFUN_VOID(abort) { ... } |
| 44 | */ |
| 45 | |
| 46 | #ifndef _ANSIDECL_H |
| 47 | |
| 48 | #define _ANSIDECL_H 1 |
| 49 | |
| 50 | |
| 51 | /* Every source file includes this file, |
| 52 | so they will all get the switch for lint. */ |
| 53 | /* LINTLIBRARY */ |
| 54 | |
| 55 | |
| 56 | #ifdef __STDC__ |
| 57 | |
| 58 | #define PTR void * |
| 59 | #define PTRCONST void *CONST |
| 60 | #define LONG_DOUBLE long double |
| 61 | |
| 62 | #define AND , |
| 63 | #define NOARGS void |
| 64 | #define CONST const |
| 65 | #define VOLATILE volatile |
| 66 | #define SIGNED signed |
| 67 | #define DOTS , ... |
| 68 | |
| 69 | #define EXFUN(name, proto) name proto |
| 70 | #define DEFUN(name, arglist, args) name(args) |
| 71 | #define DEFUN_VOID(name) name(NOARGS) |
| 72 | |
| 73 | #else /* Not ANSI C. */ |
| 74 | |
| 75 | #define PTR char * |
| 76 | #define PTRCONST PTR |
| 77 | #define LONG_DOUBLE double |
| 78 | |
| 79 | #define AND ; |
| 80 | #define NOARGS |
| 81 | #define CONST |
| 82 | #define VOLATILE |
| 83 | #define SIGNED |
| 84 | #define DOTS |
| 85 | |
| 86 | #define EXFUN(name, proto) name() |
| 87 | #define DEFUN(name, arglist, args) name arglist args; |
| 88 | #define DEFUN_VOID(name) name() |
| 89 | |
| 90 | #endif /* ANSI C. */ |
| 91 | |
| 92 | |
| 93 | #endif /* ansidecl.h */ |