ref: eeac1a81c25a9c4cf9cee92bc4c988c07a15c6c9
parent: 718921b726a379782b191d62fbcd27edd14d2b25
author: Rewbert <krookr@chalmers.se>
date: Fri Sep 22 11:08:17 EDT 2023
two broken tests right now
--- a/lib/Data/Double.hs
+++ b/lib/Data/Double.hs
@@ -64,7 +64,7 @@
-- | this primitive will print doubles with up to 6 decimal points
-- it turns out that doubles are extremely tricky, and just printing them is a
-- herculean task of its own...
-showDouble :: Double -> String
+showDouble :: Double -> [Char]
showDouble = primDoubleShow
--------------------------------
--- a/lib/Primitives.hs
+++ b/lib/Primitives.hs
@@ -10,6 +10,7 @@
data Char
data Handle
data Int
+data Double
data IO a
data Word
@@ -46,7 +47,7 @@
primDoubleGT = primitive "fgt"
primDoubleGE :: Double -> Double -> Bool
primDoubleGE = primitive "fge"
-primDoubleShow :: Double -> String
+primDoubleShow :: Double -> [Char]
primDoubleShow = primitive "fshow"
primWordAdd :: Word -> Word -> Word
--- a/src/MicroHs/Compile.hs
+++ b/src/MicroHs/Compile.hs
@@ -120,7 +120,8 @@
fn = map (\ c -> if eqChar c '.' then '/' else c) (unIdent nm) ++ ".hs"
(pathfn, file) <- liftIO (readFilePath (paths flags) fn)
let mdl@(EModule nmn _ defs) = parseDie pTop pathfn file
- --liftIO $ putStrLn $ showEModule mdl
+ -- liftIO $ putStrLn $ showEModule mdl
+ -- liftIO $ putStrLn $ showEDefs defs
S.when (not (eqIdent nm nmn)) $
error $ "module name does not agree with file name: " ++ showIdent nm ++ " " ++ showIdent nmn
let
--- a/src/MicroHs/Expr.hs
+++ b/src/MicroHs/Expr.hs
@@ -137,7 +137,7 @@
| LPrim String
| LForImp String
--Xderiving (Show, Eq)
---Winstance NFData Lit where rnf (LInt i) = rnf i; rnf (LChar c) = rnf c; rnf (LStr s) = rnf s; rnf (LPrim s) = rnf s; rnf (LForImp s) = rnf s
+--Winstance NFData Lit where rnf (LInt i) = rnf i; rnf (LDouble d) = rnf d; rnf (LChar c) = rnf c; rnf (LStr s) = rnf s; rnf (LPrim s) = rnf s; rnf (LForImp s) = rnf s
eqLit :: Lit -> Lit -> Bool
eqLit (LInt x) (LInt y) = x == y
--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -1608,9 +1608,9 @@
#define ARITHBIN(op) do { OPINT2(r = xi op yi); SETINT(n, r); RET; } while(0) #define ARITHBINU(op) do { OPINT2(r = (value_t)((uvalue_t)xi op (uvalue_t)yi)); SETINT(n, r); RET; } while(0) #define FARITHBIN(op) do { OPDOUBLE2(rd = xd op yd); SETDOUBLE(n, rd); RET; } while(0) // TODO FIXME-#define CMP(op) do { OPINT2(r = xi op yi); GOIND(r ? comTrue : combFalse); } while(0)-#define CMPF(op) do { OPDOUBLE2(r = xd op yd); GOIND(r ? comTrue : combFalse); } while(0)-#define CMPU(op) do { OPINT2(r = (uvalue_t)xi op (uvalue_t)yi); GOIND(r ? comTrue : combFalse); } while(0)+#define CMP(op) do { OPINT2(r = xi op yi); GOIND(r ? combTrue : combFalse); } while(0)+#define CMPF(op) do { OPDOUBLE2(r = xd op yd); GOIND(r ? combTrue : combFalse); } while(0)+#define CMPU(op) do { OPINT2(r = (uvalue_t)xi op (uvalue_t)yi); GOIND(r ? combTrue : combFalse); } while(0) for(;;) {num_reductions++;
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -5,18 +5,6 @@
test:
$(MHS) IOTest && (echo q | $(EVAL) a bb ccc | sed 's/^.ms/1ms/' > IOTest.out) && diff IOTest.ref IOTest.out
$(MHS) StringTest && $(EVAL) > StringTest.out && diff StringTest.ref StringTest.out
-<<<<<<< HEAD
- $(MHS) ListTest && $(EVAL) > ListTest.out && diff ListTest.ref ListTest.out
- $(MHS) Fac && $(EVAL) > Fac.out && diff Fac.ref Fac.out
- $(MHS) Misc && $(EVAL) > Misc.out && diff Misc.ref Misc.out
- $(MHS) Case && $(EVAL) > Case.out && diff Case.ref Case.out
- $(MHS) Arith && $(EVAL) > Arith.out && diff Arith.ref Arith.out
- $(MHS) Guard && $(EVAL) > Guard.out && diff Guard.ref Guard.out
- $(MHS) Newtype && $(EVAL) > Newtype.out && diff Newtype.ref Newtype.out
- $(MHS) LitMatch && $(EVAL) > LitMatch.out && diff LitMatch.ref LitMatch.out
- $(MHS) Word && $(EVAL) > Word.out && diff Word.ref Word.out
- $(MHS) FArith && $(EVAL) > FArith.out && diff FArith.ref FArith.out
-=======
$(MHS) ListTest && $(EVAL) > ListTest.out && diff ListTest.ref ListTest.out
$(MHS) Fac && $(EVAL) > Fac.out && diff Fac.ref Fac.out
$(MHS) Misc && $(EVAL) > Misc.out && diff Misc.ref Misc.out
@@ -32,7 +20,7 @@
$(MHS) LocalPoly && $(EVAL) > LocalPoly.out && diff LocalPoly.ref LocalPoly.out
$(MHS) Rank2 && $(EVAL) > Rank2.out && diff Rank2.ref Rank2.out
$(MHS) Catch && $(EVAL) > Catch.out && diff Catch.ref Catch.out
->>>>>>> augustss-master
+ $(MHS) FArith && $(EVAL) > FArith.out && diff FArith.ref FArith.out
time:
@echo Expect about 10s runtime
--
⑨