[9089] | 1 | /* |
---|
| 2 | protos.h |
---|
| 3 | |
---|
| 4 | Original version: Ed McCreight: 30 Oct 90 |
---|
| 5 | Edit History: |
---|
| 6 | Ed McCreight: 30 Oct 90 |
---|
| 7 | End Edit History. |
---|
| 8 | |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
| 12 | * |
---|
| 13 | * This source code is provided to you by Adobe on a non-exclusive, |
---|
| 14 | * royalty-free basis to facilitate your development of PostScript |
---|
| 15 | * language programs. You may incorporate it into your software as is |
---|
| 16 | * or modified, provided that you include the following copyright |
---|
| 17 | * notice with every copy of your software containing any portion of |
---|
| 18 | * this source code. |
---|
| 19 | * |
---|
| 20 | * Copyright 1990 Adobe Systems Incorporated. All Rights Reserved. |
---|
| 21 | * |
---|
| 22 | * Adobe does not warrant or guarantee that this source code will |
---|
| 23 | * perform in any manner. You alone assume any risks and |
---|
| 24 | * responsibilities associated with implementing, using or |
---|
| 25 | * incorporating this source code into your software. |
---|
| 26 | * |
---|
| 27 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
---|
| 28 | |
---|
| 29 | #ifndef PROTOS_H |
---|
| 30 | #define PROTOS_H |
---|
| 31 | |
---|
| 32 | #ifndef PROTOTYPES |
---|
| 33 | #ifdef __STDC__ |
---|
| 34 | #define PROTOTYPES __STDC__ |
---|
| 35 | #else /* __STDC__ */ |
---|
| 36 | #define PROTOTYPES 0 |
---|
| 37 | #endif /* __STDC__ */ |
---|
| 38 | #endif /* PROTOTYPES */ |
---|
| 39 | |
---|
| 40 | /* |
---|
| 41 | * PROTOTYPES indicates whether or not ANSI function prototypes |
---|
| 42 | * are to be generated (or else ignored as comments) in compiling the |
---|
| 43 | * product. Such function prototype macros should look something like this: |
---|
| 44 | */ |
---|
| 45 | |
---|
| 46 | #if 0 /* * * B e g i n c o m m e n t * * */ |
---|
| 47 | |
---|
| 48 | /* ... in foozle.h: */ |
---|
| 49 | |
---|
| 50 | extern procedure foo ARGDECL2(integer, arg1, char *, arg2); |
---|
| 51 | /* if PROTOTYPES, expands to |
---|
| 52 | |
---|
| 53 | extern procedure foo (integer arg1, char * arg2); |
---|
| 54 | |
---|
| 55 | if not, expands to |
---|
| 56 | |
---|
| 57 | extern procedure foo (); |
---|
| 58 | */ |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | /* ... in foozle.c: */ |
---|
| 62 | |
---|
| 63 | public procedure foo ARGDEF2(integer, arg1, char *, arg2) |
---|
| 64 | /* if PROTOTYPES, expands to |
---|
| 65 | |
---|
| 66 | public procedure foo (integer arg1, char * arg2) |
---|
| 67 | |
---|
| 68 | if not, expands to |
---|
| 69 | |
---|
| 70 | public procedure foo (arg1, arg2) |
---|
| 71 | integer arg1; |
---|
| 72 | char * arg2; |
---|
| 73 | */ |
---|
| 74 | { |
---|
| 75 | ... |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | #endif /* * * E n d c o m m e n t * * */ |
---|
| 79 | |
---|
| 80 | /* |
---|
| 81 | * In a non-ANSI system prototypes are good documentation. |
---|
| 82 | * They also help ANSI compilers catch type-mismatch errors. |
---|
| 83 | * |
---|
| 84 | * Portability warning: Prototypes alter the rules for function argument |
---|
| 85 | * type conversions. Be sure that all references |
---|
| 86 | * to prototype-defined functions are in the scope of prototype |
---|
| 87 | * declarations, and that any function that is prototype-declared |
---|
| 88 | * is also prototype-defined. The latter can be checked by the compiler, |
---|
| 89 | * but the former generally cannot. Since a prototyped definition |
---|
| 90 | * serve as a prototyped declaration, a private function does not |
---|
| 91 | * need a separate declaration if its definition textually precedes |
---|
| 92 | * its first use. This definition-before-use order is natural to |
---|
| 93 | * Pascal programmers. |
---|
| 94 | */ |
---|
| 95 | |
---|
| 96 | #if PROTOTYPES |
---|
| 97 | |
---|
| 98 | #define ARGDEF0() \ |
---|
| 99 | (void) |
---|
| 100 | #define ARGDEF1(t1,v1) \ |
---|
| 101 | (t1 v1) |
---|
| 102 | #define ARGDEF2(t1,v1,t2,v2) \ |
---|
| 103 | (t1 v1,t2 v2) |
---|
| 104 | #define ARGDEF3(t1,v1,t2,v2,t3,v3) \ |
---|
| 105 | (t1 v1,t2 v2,t3 v3) |
---|
| 106 | #define ARGDEF4(t1,v1,t2,v2,t3,v3,t4,v4) \ |
---|
| 107 | (t1 v1,t2 v2,t3 v3,t4 v4) |
---|
| 108 | #define ARGDEF5(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ |
---|
| 109 | (t1 v1,t2 v2,t3 v3,t4 v4,t5 v5) |
---|
| 110 | #define ARGDEF6(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ |
---|
| 111 | (t1 v1,t2 v2,t3 v3,t4 v4,t5 v5,t6 v6) |
---|
| 112 | #define ARGDEF7(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ |
---|
| 113 | (t1 v1,t2 v2,t3 v3,t4 v4,t5 v5,t6 v6,t7 v7) |
---|
| 114 | #define ARGDEF8(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8) \ |
---|
| 115 | (t1 v1,t2 v2,t3 v3,t4 v4,t5 v5,t6 v6,t7 v7,t8 v8) |
---|
| 116 | #define ARGDEF9(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9) \ |
---|
| 117 | (t1 v1,t2 v2,t3 v3,t4 v4,t5 v5,t6 v6,t7 v7,t8 v8,t9 v9) |
---|
| 118 | #define ARGDEF10(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10) \ |
---|
| 119 | (t1 v1,t2 v2,t3 v3,t4 v4,t5 v5,t6 v6,t7 v7,t8 v8,t9 v9,t10 v10) |
---|
| 120 | |
---|
| 121 | #define ARGDEFV1(t1,v1) \ |
---|
| 122 | (t1 v1, ...) |
---|
| 123 | #define ARGDEFV2(t1,v1,t2,v2) \ |
---|
| 124 | (t1 v1,t2 v2, ...) |
---|
| 125 | #define ARGDEFV3(t1,v1,t2,v2,t3,v3) \ |
---|
| 126 | (t1 v1,t2 v2,t3 v3, ...) |
---|
| 127 | |
---|
| 128 | #define ARGDECL0 ARGDEF0 |
---|
| 129 | #define ARGDECL1 ARGDEF1 |
---|
| 130 | #define ARGDECL2 ARGDEF2 |
---|
| 131 | #define ARGDECL3 ARGDEF3 |
---|
| 132 | #define ARGDECL4 ARGDEF4 |
---|
| 133 | #define ARGDECL5 ARGDEF5 |
---|
| 134 | #define ARGDECL6 ARGDEF6 |
---|
| 135 | #define ARGDECL7 ARGDEF7 |
---|
| 136 | #define ARGDECL8 ARGDEF8 |
---|
| 137 | #define ARGDECL9 ARGDEF9 |
---|
| 138 | |
---|
| 139 | #define ARGDECLV1 ARGDEFV1 |
---|
| 140 | #define ARGDECLV2 ARGDEFV2 |
---|
| 141 | #define ARGDECLV3 ARGDEFV3 |
---|
| 142 | |
---|
| 143 | #else /* PROTOTYPES */ |
---|
| 144 | |
---|
| 145 | #define ARGDEF0() \ |
---|
| 146 | () |
---|
| 147 | #define ARGDEF1(t1,v1) \ |
---|
| 148 | (v1) t1 v1; |
---|
| 149 | #define ARGDEF2(t1,v1,t2,v2) \ |
---|
| 150 | (v1,v2) t1 v1; t2 v2; |
---|
| 151 | #define ARGDEF3(t1,v1,t2,v2,t3,v3) \ |
---|
| 152 | (v1,v2,v3) t1 v1; t2 v2; t3 v3; |
---|
| 153 | #define ARGDEF4(t1,v1,t2,v2,t3,v3,t4,v4) \ |
---|
| 154 | (v1,v2,v3,v4) t1 v1; t2 v2; t3 v3; t4 v4; |
---|
| 155 | #define ARGDEF5(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ |
---|
| 156 | (v1,v2,v3,v4,v5) t1 v1; t2 v2; t3 v3; t4 v4; t5 v5; |
---|
| 157 | #define ARGDEF6(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ |
---|
| 158 | (v1,v2,v3,v4,v5,v6) t1 v1; t2 v2; t3 v3; t4 v4; t5 v5; t6 v6; |
---|
| 159 | #define ARGDEF7(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ |
---|
| 160 | (v1,v2,v3,v4,v5,v6,v7) \ |
---|
| 161 | t1 v1; t2 v2; t3 v3; t4 v4; t5 v5; t6 v6; t7 v7; |
---|
| 162 | #define ARGDEF8(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8) \ |
---|
| 163 | (v1,v2,v3,v4,v5,v6,v7,v8) \ |
---|
| 164 | t1 v1; t2 v2; t3 v3; t4 v4; t5 v5; t6 v6; t7 v7; t8 v8; |
---|
| 165 | #define ARGDEF9(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9) \ |
---|
| 166 | (v1,v2,v3,v4,v5,v6,v7,v8,v9) \ |
---|
| 167 | t1 v1; t2 v2; t3 v3; t4 v4; t5 v5; t6 v6; t7 v7; t8 v8; t9 v9; |
---|
| 168 | #define ARGDEF10(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10) \ |
---|
| 169 | (v1,v2,v3,v4,v5,v6,v7,v8,v9,v10) \ |
---|
| 170 | t1 v1; t2 v2; t3 v3; t4 v4; t5 v5; t6 v6; t7 v7; t8 v8; t9 v9; t10 v10; |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | #define ARGDEFV1(t1,v1) \ |
---|
| 174 | (v1, ...) t1 v1; |
---|
| 175 | #define ARGDEFV2(t1,v1,t2,v2) \ |
---|
| 176 | (v1,v2, ...) t1 v1; t2 v2; |
---|
| 177 | #define ARGDEFV3(t1,v1,t2,v2,t3,v3) \ |
---|
| 178 | (v1,v2,v3, ...) t1 v1; t2 v2; t3 v3; |
---|
| 179 | |
---|
| 180 | #define ARGDECL0() \ |
---|
| 181 | () |
---|
| 182 | #define ARGDECL1(t1,v1) \ |
---|
| 183 | () |
---|
| 184 | #define ARGDECL2(t1,v1,t2,v2) \ |
---|
| 185 | () |
---|
| 186 | #define ARGDECL3(t1,v1,t2,v2,t3,v3) \ |
---|
| 187 | () |
---|
| 188 | #define ARGDECL4(t1,v1,t2,v2,t3,v3,t4,v4) \ |
---|
| 189 | () |
---|
| 190 | #define ARGDECL5(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ |
---|
| 191 | () |
---|
| 192 | #define ARGDECL6(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ |
---|
| 193 | () |
---|
| 194 | #define ARGDECL7(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ |
---|
| 195 | () |
---|
| 196 | #define ARGDECL8(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8) \ |
---|
| 197 | () |
---|
| 198 | #define ARGDECL9(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9) \ |
---|
| 199 | () |
---|
| 200 | #define ARGDECL10(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7,t8,v8,t9,v9,t10,v10) \ |
---|
| 201 | () |
---|
| 202 | |
---|
| 203 | #define ARGDECLV1(t1,v1) \ |
---|
| 204 | () |
---|
| 205 | #define ARGDECLV2(t1,v1,t2,v2) \ |
---|
| 206 | () |
---|
| 207 | #define ARGDECLV3(t1,v1,t2,v2,t3,v3) \ |
---|
| 208 | () |
---|
| 209 | |
---|
| 210 | #endif /* PROTOTYPES */ |
---|
| 211 | |
---|
| 212 | #endif /* PROTOS_H */ |
---|