1 /* Id: defines.h,v 1.15 2008/05/10 07:53:41 ragge Exp */ 2 /* $NetBSD: defines.h,v 1.1.1.2 2010/06/03 18:57:46 plunky Exp $ */ 3 /* 4 * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * Redistributions of source code and documentation must retain the above 11 * copyright notice, this list of conditions and the following disclaimer. 12 * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditionsand the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed or owned by Caldera 18 * International, Inc. 19 * Neither the name of Caldera International, Inc. nor the names of other 20 * contributors may be used to endorse or promote products derived from 21 * this software without specific prior written permission. 22 * 23 * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA 24 * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR 25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 * DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE 28 * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, 32 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 33 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. 35 */ 36 #include <stdio.h> 37 38 #ifdef FCOM 39 #include "pass2.h" 40 #endif 41 #include "ftypes.h" 42 43 #define INTERDATA 2 44 #define GCOS 3 45 #define PDP11 4 46 #define IBM 5 47 #define CMACH 6 48 #define VAX 7 49 50 #define DMR 2 51 #define SCJ 3 52 53 #define BINARY 2 54 #define ASCII 3 55 56 #define PREFIX 2 57 #define POSTFIX 3 58 59 #define M(x) (1<<x) 60 #define ALLOC(x) ckalloc(sizeof(struct x)) 61 #define BALLO() (bigptr)ckalloc(sizeof(struct bigblock)) 62 typedef void *ptr; 63 typedef FILE *FILEP; 64 typedef short flag; 65 typedef long int ftnint; 66 #define LOCAL static 67 68 #define NO 0 69 #define YES 1 70 71 72 73 /* block tag values */ 74 75 #define TNAME 1 76 #define TCONST 2 77 #define TEXPR 3 78 #define TADDR 4 79 #define TPRIM 5 80 #define TLIST 6 81 #define TIMPLDO 7 82 #define TERROR 8 83 84 85 /* parser states */ 86 87 #define OUTSIDE 0 88 #define INSIDE 1 89 #define INDCL 2 90 #define INDATA 3 91 #define INEXEC 4 92 93 /* procedure classes */ 94 95 #define PROCMAIN 1 96 #define PROCBLOCK 2 97 #define PROCSUBR 3 98 #define PROCFUNCT 4 99 100 101 /* storage classes */ 102 103 #define STGUNKNOWN 0 104 #define STGARG 1 105 #define STGAUTO 2 106 #define STGBSS 3 107 #define STGINIT 4 108 #define STGCONST 5 109 #define STGEXT 6 110 #define STGINTR 7 111 #define STGSTFUNCT 8 112 #define STGCOMMON 9 113 #define STGEQUIV 10 114 #define STGREG 11 115 #define STGLENG 12 116 117 /* name classes */ 118 119 #define CLUNKNOWN 0 120 #define CLPARAM 1 121 #define CLVAR 2 122 #define CLENTRY 3 123 #define CLMAIN 4 124 #define CLBLOCK 5 125 #define CLPROC 6 126 127 128 /* vproclass values */ 129 130 #define PUNKNOWN 0 131 #define PEXTERNAL 1 132 #define PINTRINSIC 2 133 #define PSTFUNCT 3 134 #define PTHISPROC 4 135 136 /* control stack codes */ 137 138 #define CTLDO 1 139 #define CTLIF 2 140 #define CTLELSE 3 141 142 143 /* operators */ 144 145 #define OPPLUS 1 146 #define OPMINUS 2 147 #define OPSTAR 3 148 #define OPSLASH 4 149 #define OPPOWER 5 150 #define OPNEG 6 151 #define OPOR 7 152 #define OPAND 8 153 #define OPEQV 9 154 #define OPNEQV 10 155 #define OPNOT 11 156 #define OPCONCAT 12 157 #define OPLT 13 158 #define OPEQ 14 159 #define OPGT 15 160 #define OPLE 16 161 #define OPNE 17 162 #define OPGE 18 163 #define OPCALL 19 164 #define OPCCALL 20 165 #define OPASSIGN 21 166 /* #define OPPLUSEQ 22 */ 167 /* #define OPSTAREQ 23 */ 168 #define OPCONV 24 169 #define OPLSHIFT 25 170 #define OPMOD 26 171 #define OPCOMMA 27 172 /* #define OPQUEST 28 */ 173 /* #define OPCOLON 29 */ 174 #define OPABS 30 175 #define OPMIN 31 176 #define OPMAX 32 177 #define OPADDR 33 178 #define OPINDIRECT 34 179 #define OPBITOR 35 180 #define OPBITAND 36 181 #define OPBITXOR 37 182 #define OPBITNOT 38 183 #define OPRSHIFT 39 184 185 186 /* memory regions */ 187 188 #define REGARG 1 189 #define REGAUTO 2 190 #define REGBSS 3 191 #define REGINIT 4 192 #define REGCONST 5 193 #define REGEXT 6 194 #define REGPROG 7 195 196 /* label type codes */ 197 198 #define LABUNKNOWN 0 199 #define LABEXEC 1 200 #define LABFORMAT 2 201 #define LABOTHER 3 202 203 204 /* INTRINSIC function codes*/ 205 206 #define INTREND 0 207 #define INTRCONV 1 208 #define INTRMIN 2 209 #define INTRMAX 3 210 #define INTRGEN 4 211 #define INTRSPEC 5 212 #define INTRBOOL 6 213 #define INTRCNST 7 214 215 216 /* I/O statement codes */ 217 218 #define IOSTDIN MKICON(5) 219 #define IOSTDOUT MKICON(6) 220 221 #define IOSBAD (-1) 222 #define IOSPOSITIONAL 0 223 #define IOSUNIT 1 224 #define IOSFMT 2 225 226 #define IOINQUIRE 1 227 #define IOOPEN 2 228 #define IOCLOSE 3 229 #define IOREWIND 4 230 #define IOBACKSPACE 5 231 #define IOENDFILE 6 232 #define IOREAD 7 233 #define IOWRITE 8 234 235 236 /* type masks */ 237 238 #define MSKLOGICAL M(TYLOGICAL) 239 #define MSKADDR M(TYADDR) 240 #define MSKCHAR M(TYCHAR) 241 #define MSKINT M(TYSHORT)|M(TYLONG) 242 #define MSKREAL M(TYREAL)|M(TYDREAL) 243 #define MSKCOMPLEX M(TYCOMPLEX)|M(TYDCOMPLEX) 244 245 /* miscellaneous macros */ 246 247 #define ONEOF(x,y) (M(x) & (y)) 248 #define ISCOMPLEX(z) ONEOF(z, MSKCOMPLEX) 249 #define ISREAL(z) ONEOF(z, MSKREAL) 250 #define ISNUMERIC(z) ONEOF(z, MSKINT|MSKREAL|MSKCOMPLEX) 251 #define ISICON(z) (z->tag==TCONST && ISINT(z->vtype)) 252 #define ISCHAR(z) (z->vtype==TYCHAR) 253 #define ISINT(z) ONEOF(z, MSKINT) 254 #define ISCONST(z) (z->tag==TCONST) 255 #define ISERROR(z) (z->tag==TERROR) 256 #define ISPLUSOP(z) (z->tag==TEXPR && z->b_expr.opcode==OPPLUS) 257 #define ISSTAROP(z) (z->tag==TEXPR && z->b_expr.opcode==OPSTAR) 258 #define ISONE(z) (ISICON(z) && z->b_const.fconst.ci==1) 259 /* #define INT(z) ONEOF(z, MSKINT|MSKCHAR) */ 260 #define MKICON(z) mkintcon( (ftnint)(z) ) 261 #define CHCON(z) mkstrcon(strlen(z), z) 262 263 /* round a up to a multiple of b */ 264 #define roundup(a,b) ( b * ( (a+b-1)/b) ) 265 266 /* prototypes for cpu-specific functions */ 267 void prchars(int *); 268 269