[project @ 1999-03-16 13:20:07 by simonm]
[ghc-hetmet.git] / ghc / interpreter / storage.h
index 6c0d89a..2f80257 100644 (file)
@@ -9,8 +9,8 @@
  * in the distribution for details.
  *
  * $RCSfile: storage.h,v $
- * $Revision: 1.3 $
- * $Date: 1999/02/03 17:08:41 $
+ * $Revision: 1.5 $
+ * $Date: 1999/03/09 14:51:14 $
  * ------------------------------------------------------------------------*/
 
 /* --------------------------------------------------------------------------
@@ -186,32 +186,14 @@ extern  Bool            isQCon      Args((Cell));
 extern  Bool            isQualIdent Args((Cell));
 extern  Bool            isIdent     Args((Cell));
 
-#if 0
-Originally ...
-#define isFloat(c)      (isPair(c) && fst(c)==FLOATCELL)
-extern  Cell            mkFloat         Args((FloatPro));
-extern  FloatPro        floatOf         Args((Cell));
-extern  String          floatToString   Args((FloatPro));
-extern  FloatPro        stringToFloat   Args((String));
-#else
-#define isFloat(c)       (isPair(c) && fst(c)==FLOATCELL)
-#define stringToFloat(s) pair(FLOATCELL,findText(s))
-#define floatToString(f) textToStr(snd(f))
-#define floatEq(f1,f2)   (snd(f1) == snd(f2))
-#define floatNegate(f)   stringToFloat(stringNegate(floatToString(f)))
-#define floatOf(f)       atof(floatToString(f))
-#endif
-
-
-
+extern  String           stringNegate Args((String));
 
 #define isFloat(c)       (isPair(c) && fst(c)==FLOATCELL)
 #define stringToFloat(s) pair(FLOATCELL,findText(s))
 #define floatToString(f) textToStr(snd(f))
-#define floatEq(f1,f2)   (snd(f1) == snd(f2))
-#define floatNegate(f)   stringToFloat(stringNegate(floatToString(f)))
 #define floatOf(f)       atof(floatToString(f))
 #define mkFloat(f)       (f)  /* ToDo: is this right? */
+#define floatNegate(f)   stringToFloat(stringNegate(floatToString(f)))
 
 #define bignumToString(b) textToStr(snd(b))
 
@@ -304,7 +286,6 @@ extern  Ptr             ptrOf           Args((Cell));
 #define STGPRIM      94           /* STGPRIM    snd :: (PrimOp,[Arg])      */
 #define STGCON       95           /* STGCON     snd :: (StgCon,[Arg])      */
 #define PRIMCASE     96           /* PRIMCASE   snd :: (Expr,[PrimAlt])    */
-
 /* Last constructor tag must be less than SPECMIN */
 
 /* --------------------------------------------------------------------------
@@ -461,6 +442,8 @@ struct strTycon {
     Kind  kind;                         /* kind (includes arity) of Tycon  */
     Cell  what;                         /* DATATYPE/SYNONYM/RESTRICTSYN... */
     Cell  defn;
+    Name  conToTag;                     /* used in derived code            */
+    Name  tagToCon;
     Tycon nextTyconHash;
 };
 
@@ -535,12 +518,13 @@ extern struct strName DECTABLE(tabName);
 #define mfunOf(n)       ((-1)-name(n).number)
 #define mfunNo(i)       ((-1)-(i))
 
-extern Name   newName      Args((Text,Cell));
-extern Name   findName     Args((Text));
-extern Name   addName      Args((Name));
-extern Name   findQualName Args((Cell));
-extern Name   addPrimCfun  Args((Text,Int,Int,Int));
-extern Int    sfunPos      Args((Name,Name));
+extern Name   newName         Args((Text,Cell));
+extern Name   findName        Args((Text));
+extern Name   addName         Args((Name));
+extern Name   findQualName    Args((Cell));
+extern Name   addPrimCfun     Args((Text,Int,Int,Cell));
+extern Name   addPrimCfunREP  Args((Text,Int,Int,Int));
+extern Int    sfunPos         Args((Name,Name));
 
 /* --------------------------------------------------------------------------
  * Type class values:
@@ -555,7 +539,7 @@ extern Int    sfunPos      Args((Name,Name));
 struct strInst {
     Class c;                            /* class C                         */
     Int   line;
-    Module mod;                         /* module that defines it          */
+  //Module mod;                         /* module that defines it          */
     Kinds kinds;                        /* Kinds of variables in head      */
     Cell  head;                         /* :: Pred                         */
     List  specifics;                    /* :: [Pred]                       */
@@ -665,6 +649,7 @@ extern  List         dupOnto      Args((List,List));
 extern  List         dupList      Args((List));
 extern  List         revOnto      Args((List, List));   /* destructive     */
 #define rev(xs)      revOnto((xs),NIL)                  /* destructive     */
+#define reverse(xs)  revOnto(dupList(xs),NIL)           /* non-destructive */
 extern  Cell         cellIsMember Args((Cell,List));
 extern  Cell         cellAssoc    Args((Cell,List));
 extern  Cell         cellRevAssoc Args((Cell,List));
@@ -679,6 +664,7 @@ extern  List         take         Args((Int,List));     /* destructive     */
 extern  List         splitAt      Args((Int,List));     /* non-destructive */
 extern  Cell         nth          Args((Int,List));
 extern  List         removeCell   Args((Cell,List));    /* destructive     */
+extern  List         dupListOnto  Args((List,List));    /* non-destructive */ 
 
 /* The following macros provide `inline expansion' of some common ways of
  * traversing, using and modifying lists: