X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcommon%2Fexprdefs.h;h=50a5a25b6365f61cf5a7fbb7058a378e70246d30;hb=74108cd74fc3ca3ad4f69b743233fa79791106b9;hp=4e95685e6422fb5b3ee5effe94ab2981509deab4;hpb=0dce6a79b6154d71817eb1cf9a1ba04f0e6c9775;p=cc65 diff --git a/src/common/exprdefs.h b/src/common/exprdefs.h index 4e95685e6..50a5a25b6 100644 --- a/src/common/exprdefs.h +++ b/src/common/exprdefs.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998-2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2012, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -56,9 +56,11 @@ /* Leaf node codes */ #define EXPR_LITERAL (EXPR_LEAFNODE | 0x01) #define EXPR_SYMBOL (EXPR_LEAFNODE | 0x02) -#define EXPR_SEGMENT (EXPR_LEAFNODE | 0x03) -#define EXPR_MEMAREA (EXPR_LEAFNODE | 0x04) /* Linker only */ -#define EXPR_ULABEL (EXPR_LEAFNODE | 0x05) /* Assembler only */ +#define EXPR_SECTION (EXPR_LEAFNODE | 0x03) +#define EXPR_SEGMENT (EXPR_LEAFNODE | 0x04) /* Linker only */ +#define EXPR_MEMAREA (EXPR_LEAFNODE | 0x05) /* Linker only */ +#define EXPR_ULABEL (EXPR_LEAFNODE | 0x06) /* Assembler only */ +#define EXPR_BANK (EXPR_LEAFNODE | 0x07) /* Binary operations, left and right hand sides are valid */ #define EXPR_PLUS (EXPR_BINARYNODE | 0x01) @@ -77,24 +79,27 @@ #define EXPR_GT (EXPR_BINARYNODE | 0x0E) #define EXPR_LE (EXPR_BINARYNODE | 0x0F) #define EXPR_GE (EXPR_BINARYNODE | 0x10) -#define EXPR_BAND (EXPR_BINARYNODE | 0x11) -#define EXPR_BOR (EXPR_BINARYNODE | 0x12) -#define EXPR_BXOR (EXPR_BINARYNODE | 0x13) +#define EXPR_BOOLAND (EXPR_BINARYNODE | 0x11) +#define EXPR_BOOLOR (EXPR_BINARYNODE | 0x12) +#define EXPR_BOOLXOR (EXPR_BINARYNODE | 0x13) +#define EXPR_MAX (EXPR_BINARYNODE | 0x14) +#define EXPR_MIN (EXPR_BINARYNODE | 0x15) /* Unary operations, right hand side is empty */ #define EXPR_UNARY_MINUS (EXPR_UNARYNODE | 0x01) #define EXPR_NOT (EXPR_UNARYNODE | 0x02) #define EXPR_SWAP (EXPR_UNARYNODE | 0x03) -#define EXPR_BNOT (EXPR_UNARYNODE | 0x04) -#define EXPR_FORCEWORD (EXPR_UNARYNODE | 0x05) -#define EXPR_FORCEFAR (EXPR_UNARYNODE | 0x06) +#define EXPR_BOOLNOT (EXPR_UNARYNODE | 0x04) +#define EXPR_BANKRAW (EXPR_UNARYNODE | 0x05) /* Assembler only */ #define EXPR_BYTE0 (EXPR_UNARYNODE | 0x08) #define EXPR_BYTE1 (EXPR_UNARYNODE | 0x09) -#define EXPR_BYTE2 (EXPR_UNARYNODE | 0x0A) -#define EXPR_BYTE3 (EXPR_UNARYNODE | 0x0B) -#define EXPR_WORD0 (EXPR_UNARYNODE | 0x0C) -#define EXPR_WORD1 (EXPR_UNARYNODE | 0x0D) +#define EXPR_BYTE2 (EXPR_UNARYNODE | 0x0A) +#define EXPR_BYTE3 (EXPR_UNARYNODE | 0x0B) +#define EXPR_WORD0 (EXPR_UNARYNODE | 0x0C) +#define EXPR_WORD1 (EXPR_UNARYNODE | 0x0D) +#define EXPR_FARADDR (EXPR_UNARYNODE | 0x0E) +#define EXPR_DWORD (EXPR_UNARYNODE | 0x0F) @@ -104,22 +109,26 @@ struct ExprNode { unsigned char Op; /* Operand/Type */ ExprNode* Left; /* Left leaf */ ExprNode* Right; /* Right leaf */ - struct ObjData* Obj; /* Object file reference (linker) */ + struct ObjData* Obj; /* Object file reference (linker) */ union { - long Val; /* If this is a value */ + long IVal; /* If this is a int value */ struct SymEntry* Sym; /* If this is a symbol */ - unsigned SegNum; /* If this is a segment */ - unsigned ImpNum; /* If this is an import */ - struct Memory* MemArea; /* If this is a memory area */ + unsigned SecNum; /* If this is a section and Obj != 0 */ + unsigned ImpNum; /* If this is an import and Obj != 0 */ + struct Import* Imp; /* If this is an import and Obj == 0 */ + struct MemoryArea* Mem; /* If this is a memory area */ + struct Segment* Seg; /* If this is a segment */ + struct Section* Sec; /* If this is a section and Obj == 0 */ } V; }; /* Macros to determine the expression type */ -#define EXPR_IS_LEAF(Op) (((Op) & EXPR_TYPEMASK) == EXPR_LEAFNODE) -#define EXPR_IS_UNARY(Op) (((Op) & EXPR_TYPEMASK) == EXPR_UNARYNODE) -#define EXPR_IS_BINARY(OP) (((Op) & EXPR_TYPEMASK) == EXPR_BINARYNODE) +#define EXPR_NODETYPE(Op) ((Op) & EXPR_TYPEMASK) +#define EXPR_IS_LEAF(Op) (EXPR_NODETYPE (Op) == EXPR_LEAFNODE) +#define EXPR_IS_UNARY(Op) (EXPR_NODETYPE (Op) == EXPR_UNARYNODE) +#define EXPR_IS_BINARY(OP) (EXPR_NODETYPE (Op) == EXPR_BINARYNODE) @@ -129,7 +138,7 @@ struct ExprNode { -void DumpExpr (const ExprNode* Expr); +void DumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym) (const struct SymEntry*)); /* Dump an expression tree to stdout */