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