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 -------------------------------------------------------------------------*/
28 typedef struct value {
29 char name[ SDCC_NAME_MAX + 1 ]; /* operand accessing this value */
30 link *type ; /* start of type chain */
31 link *etype; /* end of type chain */
32 symbol *sym ; /* Original Symbol */
33 struct value *next ; /* used in initializer list*/
34 unsigned vArgs : 1 ; /* arg list ended with variable arg */
44 /* initializer lists use this structure */
45 typedef struct initList {
50 struct initList *deep ;
53 struct initList *next ;
56 #define IS_VARG(x) (x->vArgs)
58 /* forward definitions for the symbol table related functions */
61 value *constVal (char * );
62 value *reverseVal (value * );
63 value *reverseValWithType(value * );
64 value *copyValue (value * );
65 value *copyValueChain (value * );
66 value *strVal (char * );
67 value *charVal (char * );
68 value *symbolVal (symbol * );
69 void printVal (value * );
70 double floatFromVal (value * );
71 value *array2Ptr (value * );
72 value *valUnaryPM (value * );
73 value *valComplement (value * );
74 value *valNot (value * );
75 value *valMult (value *, value * );
76 value *valDiv (value *, value * );
77 value *valMod (value *, value * );
78 value *valPlus (value *, value * );
79 value *valMinus (value *, value * );
80 value *valShift (value *, value *,int);
81 value *valCompare (value *, value *,int);
82 value *valBitwise (value *, value *,int);
83 value *valLogicAndOr (value *, value *,int);
84 value *valCastLiteral (link *, double );
85 value *valueFromLit (float );
86 initList *newiList (int , void * );
87 initList *revinit (initList * );
88 initList *copyIlist (initList * );
89 double list2int (initList * );
90 value *list2val (initList * );
91 struct ast *list2expr (initList * );
92 void resolveIvalSym (initList * );
93 value *valFromType (link * );
94 value *constFloatVal (char * );
95 int getNelements (link *, initList * );
96 value *valForArray (struct ast * );
97 value *valForStructElem (struct ast *, struct ast *);
98 value *valForCastAggr (struct ast *, link *, struct ast *, int ) ;