* as/hc08/lkaomf51.c (OutputName),
[fw/sdcc] / src / SDCCval.h
index 17c4ba4a3df5597857a05dca0383bdc2d0ede3c1..27950882065d6d31391d0ec78c9920b0d20a5906 100644 (file)
   You are forbidden to forbid anyone else to use, share and improve
   what you give them.   Help stamp out software-hoarding!  
 -------------------------------------------------------------------------*/
-#include "SDCCsymt.h"
 #ifndef SDCCVAL_H
 #define SDCCVAL_H
 
+#include "SDCCsymt.h"
+
 /* value wrapper */
 typedef struct value
   {
@@ -37,6 +38,14 @@ typedef struct value
   }
 value;
 
+typedef struct literalList
+{
+    double    literalValue;
+    unsigned  count;
+    struct literalList *next;
+} literalList;
+
+
 enum
   {
     INIT_NODE,
@@ -49,6 +58,7 @@ typedef struct initList
   {
     int type;
     int lineno;
+    char *filename;
     union
       {
        struct ast *node;
@@ -60,6 +70,16 @@ typedef struct initList
   }
 initList;
 
+/* return values from checkConstantRange */
+typedef enum
+  {
+    CCR_OK,           /* evaluate at runtime */
+    CCR_OVL,
+    CCR_ALWAYS_FALSE,
+    CCR_ALWAYS_TRUE
+  }
+CCR_RESULT;
+
 #define  IS_VARG(x)            (x->vArgs)
 
 /* forward definitions for the symbol table related functions */
@@ -75,6 +95,14 @@ value *charVal (char *);
 value *symbolVal (symbol *);
 void printVal (value *);
 double floatFromVal (value *);
+
+/* convert a fixed16x16 type to double */
+double doubleFromFixed16x16(TYPE_TARGET_ULONG value);
+
+/* convert a double type to fixed16x16 */
+TYPE_TARGET_ULONG fixed16x16FromDouble(double value);
+
+CCR_RESULT checkConstantRange (sym_link *var, sym_link *lit, int op, bool exchangeOps);
 value *array2Ptr (value *);
 value *valUnaryPM (value *);
 value *valComplement (value *);
@@ -96,12 +124,15 @@ initList *copyIlist (initList *);
 double list2int (initList *);
 value *list2val (initList *);
 struct ast *list2expr (initList *);
-void resolveIvalSym (initList *);
+void resolveIvalSym (initList *, sym_link *);
 value *valFromType (sym_link *);
 value *constFloatVal (char *);
+value *constFixed16x16Val (char *);
 int getNelements (sym_link *, initList *);
 value *valForArray (struct ast *);
 value *valForStructElem (struct ast *, struct ast *);
 value *valForCastAggr (struct ast *, sym_link *, struct ast *, int);
 value *valForCastArr (struct ast * , sym_link *);
+bool convertIListToConstList(initList *src, literalList **lList);
+literalList *copyLiteralList(literalList *src);
 #endif