[project @ 2005-02-01 16:47:27 by malcolm]
authormalcolm <unknown>
Tue, 1 Feb 2005 16:47:28 +0000 (16:47 +0000)
committermalcolm <unknown>
Tue, 1 Feb 2005 16:47:28 +0000 (16:47 +0000)
Make the cpp directives in NHC.SizedTypes directly usable by
nhc98 with internal cpphs, avoiding ANSI-only string-pasting.

Makefile.nhc98
NHC/SizedTypes.hs [new file with mode: 0644]
NHC/SizedTypes.hs.cpp [deleted file]

index 968800e..9df38cd 100644 (file)
@@ -45,8 +45,6 @@ SRCS  = \
 include ../Makefile.common
 
 # some extra rules
-NHC/SizedTypes.hs: NHC/SizedTypes.hs.cpp
-       $(CC) -E $< >$@
 
 # Here are the dependencies.
 $(OBJDIR)/Data/FiniteMap.$O: $(OBJDIR)/Data/Maybe.$O
diff --git a/NHC/SizedTypes.hs b/NHC/SizedTypes.hs
new file mode 100644 (file)
index 0000000..497b3cc
--- /dev/null
@@ -0,0 +1,49 @@
+module NHC.SizedTypes
+  -- This module just adds instances of Bits for Int/Word[8,16,32,64]
+  ( Int8,  Int16,  Int32,  Int64
+  , Word8, Word16, Word32, Word64
+  ) where
+
+{- Note explicit braces and semicolons here - layout is corrupted by cpp. -}
+
+{
+  import NHC.FFI       (Int8,Int16,Int32,Int64,Word8,Word16,Word32,Word64)
+; import Data.Bits
+
+#define SIZED_TYPE(T,BS,S)     \
+; FOREIGNS(T)                  \
+; INSTANCE_BITS(T,BS,S)
+
+
+#define FOREIGNS(T)    \
+; foreign import ccall nhc_prim/**/T/**/And         :: T -> T   -> T   \
+; foreign import ccall nhc_prim/**/T/**/Or          :: T -> T   -> T   \
+; foreign import ccall nhc_prim/**/T/**/Xor         :: T -> T   -> T   \
+; foreign import ccall nhc_prim/**/T/**/Lsh         :: T -> Int -> T   \
+; foreign import ccall nhc_prim/**/T/**/Rsh         :: T -> Int -> T   \
+; foreign import ccall nhc_prim/**/T/**/Compl       :: T        -> T
+
+
+#define INSTANCE_BITS(T,BS,S)          \
+; instance Bits T where                        \
+    { (.&.)      = nhc_prim/**/T/**/And        \
+    ; (.|.)      = nhc_prim/**/T/**/Or \
+    ; xor        = nhc_prim/**/T/**/Xor        \
+    ; complement = nhc_prim/**/T/**/Compl      \
+    ; shiftL     = nhc_prim/**/T/**/Lsh        \
+    ; shiftR     = nhc_prim/**/T/**/Rsh        \
+    ; bitSize  _ = BS                  \
+    ; isSigned _ = S                   \
+    }
+
+SIZED_TYPE(Int8,8,True)
+SIZED_TYPE(Int16,16,True)
+SIZED_TYPE(Int32,32,True)
+SIZED_TYPE(Int64,64,True)
+
+SIZED_TYPE(Word8,8,False)
+SIZED_TYPE(Word16,16,False)
+SIZED_TYPE(Word32,32,False)
+SIZED_TYPE(Word64,64,False)
+
+}
diff --git a/NHC/SizedTypes.hs.cpp b/NHC/SizedTypes.hs.cpp
deleted file mode 100644 (file)
index 50c3686..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-module NHC.SizedTypes
-  -- This module just adds instances of Bits for Int/Word[8,16,32,64]
-  ( Int8,  Int16,  Int32,  Int64
-  , Word8, Word16, Word32, Word64
-  ) where
-
-{- Note explicit braces and semicolons here - layout is corrupted by cpp. -}
-
-{import NHC.FFI                (Int8,Int16,Int32,Int64,Word8,Word16,Word32,Word64)
-;import Data.Bits
-
-#define SIZED_TYPE(T,BS,S)     \
-; FOREIGNS(T)                  \
-; INSTANCE_BITS(T,BS,S)
-
-
-#define FOREIGNS(T)    \
-; foreign import ccall nhc_prim##T##And         :: T -> T   -> T       \
-; foreign import ccall nhc_prim##T##Or          :: T -> T   -> T       \
-; foreign import ccall nhc_prim##T##Xor         :: T -> T   -> T       \
-; foreign import ccall nhc_prim##T##Lsh         :: T -> Int -> T       \
-; foreign import ccall nhc_prim##T##Rsh         :: T -> Int -> T       \
-; foreign import ccall nhc_prim##T##Compl       :: T        -> T
-
-
-#define INSTANCE_BITS(T,BS,S)          \
-; instance Bits T where                        \
-    { (.&.)      = nhc_prim##T##And    \
-    ; (.|.)      = nhc_prim##T##Or     \
-    ; xor        = nhc_prim##T##Xor    \
-    ; complement = nhc_prim##T##Compl  \
-    ; shiftL     = nhc_prim##T##Lsh    \
-    ; shiftR     = nhc_prim##T##Rsh    \
-    ; bitSize  _ = BS                  \
-    ; isSigned _ = S                   \
-    }
-
-SIZED_TYPE(Int8,8,True)
-SIZED_TYPE(Int16,16,True)
-SIZED_TYPE(Int32,32,True)
-SIZED_TYPE(Int64,64,True)
-
-SIZED_TYPE(Word8,8,False)
-SIZED_TYPE(Word16,16,False)
-SIZED_TYPE(Word32,32,False)
-SIZED_TYPE(Word64,64,False)
-
-}