1 /*----------------------------------------------------------------------
2 SDCCval.h - value wrapper related header information
3 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1997)
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding!
22 -------------------------------------------------------------------------*/
31 char name[SDCC_NAME_MAX + 1]; /* operand accessing this value */
32 sym_link *type; /* start of type chain */
33 sym_link *etype; /* end of type chain */
34 symbol *sym; /* Original Symbol */
35 struct value *next; /* used in initializer list */
36 unsigned vArgs:1; /* arg list ended with variable arg */
41 typedef struct literalList
45 struct literalList *next;
56 /* initializer lists use this structure */
57 typedef struct initList
65 struct initList *deep;
69 struct initList *next;
73 #define IS_VARG(x) (x->vArgs)
75 /* forward definitions for the symbol table related functions */
78 value *constVal (char *);
79 value *reverseVal (value *);
80 value *reverseValWithType (value *);
81 value *copyValue (value *);
82 value *copyValueChain (value *);
83 value *strVal (char *);
84 value *charVal (char *);
85 value *symbolVal (symbol *);
86 void printVal (value *);
87 double floatFromVal (value *);
88 value *array2Ptr (value *);
89 value *valUnaryPM (value *);
90 value *valComplement (value *);
91 value *valNot (value *);
92 value *valMult (value *, value *);
93 value *valDiv (value *, value *);
94 value *valMod (value *, value *);
95 value *valPlus (value *, value *);
96 value *valMinus (value *, value *);
97 value *valShift (value *, value *, int);
98 value *valCompare (value *, value *, int);
99 value *valBitwise (value *, value *, int);
100 value *valLogicAndOr (value *, value *, int);
101 value *valCastLiteral (sym_link *, double);
102 value *valueFromLit (double);
103 initList *newiList (int, void *);
104 initList *revinit (initList *);
105 initList *copyIlist (initList *);
106 double list2int (initList *);
107 value *list2val (initList *);
108 struct ast *list2expr (initList *);
109 void resolveIvalSym (initList *, sym_link *);
110 value *valFromType (sym_link *);
111 value *constFloatVal (char *);
112 int getNelements (sym_link *, initList *);
113 value *valForArray (struct ast *);
114 value *valForStructElem (struct ast *, struct ast *);
115 value *valForCastAggr (struct ast *, sym_link *, struct ast *, int);
116 value *valForCastArr (struct ast * , sym_link *);
117 bool convertIListToConstList(initList *src, literalList **lList);
118 literalList *copyLiteralList(literalList *src);