Commit 5be3e310 authored by dnt's avatar dnt

[project @ 1996-11-27 16:52:14 by dnt]

Converted Jmakefiles to GNU Makefiles
Removed various redundant files
Updated some source code work with Haskel 1.3
parent a1d221a2
#define IHaveSubdirs
SUBDIRS = anna \
bspt \
compress \
compress2 \
ebnf2ps \
fluid \
fulsom \
gamteb \
gg \
grep \
hidden \
HMMS \
hpg \
infer \
lift \
maillist \
parser \
pic \
prolog \
reptile \
rsa \
symalg \
veritas
/* mkhprog */
SRCS_HS = BaseDefs.hs MyUtils.hs Utils.hs AbstractVals2.hs \
SuccsAndPreds2.hs AbstractMisc.hs Dependancy.hs \
MakeDomains.hs Parser2.hs PrettyPrint.hs LambdaLift5.hs \
TypeCheck5.hs EtaAbstract.hs DomainExpr.hs AbsConc3.hs Apply.hs \
Inverse.hs BarakiMeet.hs BarakiConc3.hs \
Constructors.hs TExpr2DExpr.hs AbstractEval2.hs \
PrintResults.hs Simplify.hs SmallerLattice.hs \
FrontierMisc2.hs FrontierDATAFN2.hs FrontierGENERIC2.hs \
StrictAn6.hs ReadTable.hs Main.hs
OBJS_O = BaseDefs.o MyUtils.o Utils.o AbstractVals2.o SuccsAndPreds2.o \
AbstractMisc.o Dependancy.o MakeDomains.o Parser2.o \
PrettyPrint.o LambdaLift5.o TypeCheck5.o EtaAbstract.o \
DomainExpr.o AbsConc3.o Apply.o Inverse.o BarakiMeet.o \
BarakiConc3.o Constructors.o TExpr2DExpr.o AbstractEval2.o \
PrintResults.o Simplify.o SmallerLattice.o FrontierMisc2.o \
FrontierDATAFN2.o FrontierGENERIC2.o StrictAn6.o ReadTable.o \
Main.o
NoFibMultiModuleCompileAndRun(anna, -prescript ./anna.prescript -postscript ./anna.postscript -i big.cor -o1 big.sum.out )
NoFibHaskellCompile(anna,BaseDefs,hs)
NoFibHaskellCompile(anna,MyUtils,hs)
NoFibHaskellCompile(anna,Utils,hs)
NoFibHaskellCompile(anna,AbstractVals2,hs)
NoFibHaskellCompile(anna,SuccsAndPreds2,hs)
NoFibHaskellCompile(anna,AbstractMisc,hs)
NoFibHaskellCompile(anna,Dependancy,hs)
NoFibHaskellCompile(anna,MakeDomains,hs)
NoFibHaskellCompile(anna,Parser2,hs)
NoFibHaskellCompile(anna,PrettyPrint,hs)
NoFibHaskellCompile(anna,LambdaLift5,hs)
NoFibHaskellCompile(anna,TypeCheck5,hs)
NoFibHaskellCompile(anna,EtaAbstract,hs)
NoFibHaskellCompile(anna,DomainExpr,hs)
NoFibHaskellCompile(anna,AbsConc3,hs)
NoFibHaskellCompile(anna,Apply,hs)
NoFibHaskellCompile(anna,Inverse,hs)
NoFibHaskellCompile(anna,BarakiMeet,hs)
NoFibHaskellCompile(anna,BarakiConc3,hs)
NoFibHaskellCompile(anna,Constructors,hs)
NoFibHaskellCompile(anna,TExpr2DExpr,hs)
NoFibHaskellCompile(anna,AbstractEval2,hs)
NoFibHaskellCompile(anna,PrintResults,hs)
NoFibHaskellCompile(anna,Simplify,hs)
NoFibHaskellCompile(anna,SmallerLattice,hs)
NoFibHaskellCompile(anna,FrontierMisc2,hs)
NoFibHaskellCompile(anna,FrontierDATAFN2,hs)
NoFibHaskellCompile(anna,FrontierGENERIC2,hs)
NoFibHaskellCompile(anna,StrictAn6,hs)
NoFibHaskellCompile(anna,ReadTable,hs)
NoFibHaskellCompile(anna,Main,hs)
NoFibDependTarget(anna, $(SRCS_HS))
MODS= BaseDefs.hs MyUtils.hs Utils.hs AbstractVals2.hs \
SuccsAndPreds2.hs AbstractMisc.hs Dependancy.hs \
MakeDomains.hs Parser2.hs PrettyPrint.hs LambdaLift5.hs \
TypeCheck5.hs EtaAbstract.hs DomainExpr.hs AbsConc3.hs Apply.hs \
Inverse.hs BarakiMeet.hs BarakiConc3.hs \
Constructors.hs TExpr2DExpr.hs AbstractEval2.hs \
PrintResults.hs Simplify.hs SmallerLattice.hs \
FrontierMisc2.hs FrontierDATAFN2.hs FrontierGENERIC2.hs \
StrictAn6.hs ReadTable.hs Main.hs
INTS=$(MODS:%.hs=%.hi)
OBJS=$(MODS:%.hs=%.o)
ASMS=$(MODS:%.hs=%.o)
HC4=hbc
HC3=/home/carnap/appl/Haskell/NewStuff/Hbc9975-sun3/hbc
HBCFLAGS= -fzap-redex -c -H8000000
KLUDGE= -fno-gen-cmp
PROFILE= -pg
ECONOMY= -fno-gen-read
%.o: %.hs
$(HC4) $(HBCFLAGS) $<
main: $(OBJS)
$(HC4) -o Anna400 $(OBJS)
......@@ -4,16 +4,16 @@
operations thereon.
> ( BSPT(..),Status(..),Point,Region,Line,
> Face,Faces(..),buildBSPT,bsp',bsp'',mkCell, partFaces,
> Face,Faces,buildBSPT,bsp',bsp'',mkCell, partFaces,
> scanLine,countLeaves,classifyPoint,area,
> foldBSPT)
> where
> import EuclidGMS ( Location(..),Partition(..),Region,
> import EuclidGMS ( Location(..),Partition,Region,
> mkPart,getPart,newRegion,location,renderBorder,
> bisect,toBack,findVertices,flip_YORK,
> Point(..),Line,Face(..),Faces(..),Halfspace(..),
> space,convert,triangleArea, Segment(..) )
> Point(..),Line,Face(..),Faces,Halfspace(..),
> space,convert,triangleArea,Segment )
> import GeomNum
> import Stdlib (mapcat,const3)
> import Libfuns
......
......@@ -6,10 +6,8 @@
> ( Point(..),Halfspace(..),Line,
> Face(..),mkFace,getSegment,getMyLine,
> Faces(..),Segment(..),
> eqn,solve,space,
> convert,invert,--UNUSED:parallel,
> triangleArea,
> Faces,Segment,eqn,solve,space,
> convert,invert,triangleArea,
> mkPoint,mkPolygon,drawSegment)
> where
......
......@@ -4,18 +4,17 @@
Operations here are more application based.
> ( Region,mkRegion,getRegion,newRegion,
> Partition(..),mkPart,getPart,
> Partition,mkPart,getPart,
> Location(..),location, flip_YORK,
> bisect,toBack,--UNUSED: toFront,
> section,findVertices,
> bisect,toBack,section,findVertices,
> inScreen,renderBorder,
> -- And the following to reduce imports higher up
> Point(..),Halfspace(..),Line,Face(..),Faces(..),space,convert,
> mkFace,mkPoint,drawSegment,triangleArea, Segment(..))
> Point(..),Halfspace(..),Line,Face(..),Faces,space,convert,
> mkFace,mkPoint,drawSegment,triangleArea, Segment)
> where
> import GeomNum
> import Euclid (Point(..),Line,Halfspace(..),Face(..),Faces(..),Segment(..),
> import Euclid (Point(..),Line,Halfspace(..),Face(..),Faces,Segment,
> mkFace,getMyLine,getSegment,drawSegment,mkPoint,
> space,solve,invert,
> triangleArea,mkPolygon,convert)
......
......@@ -3,7 +3,7 @@
Defines the Geometric Number class and gives instances
for LazyRationals only at present.
> (GeomNumb(..),Numb(..),Rationals,grid,rnd2
> (GeomNumb(..),Numb,Rationals,grid,rnd2
> )
> where
......
......@@ -10,12 +10,12 @@
> clearText,toNoTextRegion,toTextRegion,reset,clearTree)
> import Params (Command(..))
> import Stdlib (mapcat)
> import Euclid (Point(..),mkPolygon,Face,Faces(..))
> import Euclid (Point(..),mkPolygon,Face,Faces)
> import BSPT (BSPT,Status(..),classifyPoint,buildBSPT,area)
> import Render (render,drawBSPT,partitionedDraw,drawFaces,prettyPrintBSPT)
> import GeomNum
> import Merge (union,intersection,subtract_YORK,complement)
> import Interpret (Operation(..),Operations(..))
> import Interpret (Operation,Operations)
modeller: This is the core function of the program
......
......@@ -3,7 +3,7 @@
Module that produces the interpretation of the users input
producing a list of human readable operation specifications
> (Command, Operations(..), Operation(..), interpret)
> (Command, Operations, Operation, interpret)
> where
......
SRCS_LHS=BSPT.lhs Euclid.lhs EuclidGMS.lhs GeomNum.lhs Init.lhs \
Input.lhs Interface.lhs Interpret.lhs Libfuns.lhs MGRlib.lhs \
Main.lhs Merge.lhs Params.lhs Prog.lhs Rationals.lhs \
Render.lhs Stdlib.lhs
OBJS_O=BSPT.o Euclid.o EuclidGMS.o GeomNum.o Init.o Input.o \
Interface.o Interpret.o Libfuns.o MGRlib.o Main.o Merge.o \
Params.o Prog.o Rationals.o Render.o Stdlib.o
NoFibMultiModuleCompileAndRun(bspt,-i bspt.stdin -o1 bspt.stdout)
NoFibHaskellCompile(bspt,BSPT,lhs)
NoFibHaskellCompile(bspt,Euclid,lhs)
NoFibHaskellCompile(bspt,EuclidGMS,lhs)
NoFibHaskellCompile(bspt,GeomNum,lhs)
NoFibHaskellCompile(bspt,Init,lhs)
NoFibHaskellCompile(bspt,Input,lhs)
NoFibHaskellCompile(bspt,Interface,lhs)
NoFibHaskellCompile(bspt,Interpret,lhs)
NoFibHaskellCompile(bspt,Libfuns,lhs)
NoFibHaskellCompile(bspt,MGRlib,lhs)
NoFibHaskellCompile(bspt,Main,lhs)
NoFibHaskellCompile(bspt,Merge,lhs)
NoFibHaskellCompile(bspt,Params,lhs)
NoFibHaskellCompile(bspt,Prog,lhs)
NoFibHaskellCompile(bspt,Rationals,lhs)
NoFibHaskellCompile(bspt,Render,lhs)
NoFibHaskellCompile(bspt,Stdlib,lhs)
NoFibDependTarget(bspt, $(SRCS_LHS))
\begin{code}
module Main where
import Prog (prog)
#ifdef PAR
main = prog
#else
main = do
str <- getContents
putStr (prog str)
#endif
\end{code}
MODULES = Stdlib.hs MGRlib.hs \
GeomNum.hs Rationals.hs \
Euclid.hs EuclidGMS.hs \
BSPT.hs Merge.hs Render.hs \
Interface.hs Interpret.hs Init.hs Input.hs Params.hs \
Main.hs Prog.hs
INTERFACES=$(MODULES:%.hs=%.hi)
YMODS = ${MODULES} Libfuns.hs
YINTS=$(YMODS:%.hs=%.hi)
YOBJS=$(YMODS:%.hs=%.o)
HC=hc
.PRECIOUS: $(YINTS) $(YOBJS)
%.hs : %.lhs
lit2pgm -q -o $@ $<
%.o: %.hs
${HC} ${HFLAGS} -c $<
%.hi: %.o
@if test ! -f $@ ; then \
rm $< ; \
${MAKE} $@ ; \
fi
main: ${YOBJS}
${HC} ${HFLAGS} -o main ${YOBJS}
# extra dependencies
MGRlib.o :
Stdlib.o :
Libfuns.o :
Rationals.o :
GeomNum.o : Rationals.hi Params.hi
Euclid.o : GeomNum.hi Stdlib.hi MGRlib.hi Params.hi
EuclidGMS.o : Euclid.hi GeomNum.hi Stdlib.hi Params.hi
BSPT.o : EuclidGMS.hi GeomNum.hi Stdlib.hi Libfuns.hi
Merge.o : BSPT.hi EuclidGMS.hi GeomNum.hi Libfuns.hi
Render.o : BSPT.hi EuclidGMS.hi GeomNum.hi Stdlib.hi MGRlib.hi Params.hi Libfuns.hi
Interface.o : Interpret.hi Init.hi BSPT.hi Merge.hi Render.hi GeomNum.hi Stdlib.hi Params.hi
Interpret.o : EuclidGMS.hi GeomNum.hi Stdlib.hi Params.hi
Init.o : Stdlib.hi MGRlib.hi Params.hi
Input.o : Interpret.hi Rationals.hi Params.hi
Params.o :
Prog.o : Interface.hi Interpret.hi Init.hi Input.hi BSPT.hi
Main.o : Prog.hi
......@@ -2,7 +2,6 @@
- Encode Mk 2, using a prefix table for the codes
-
- Paul Sanders, Systems Research, British Telecom Laboratories 1992
-
-}
module Encode (encode) where
......@@ -14,41 +13,26 @@ import PTTrees
type CodeTable = PrefixTree Char Int
{- encode sets up the arguments for the real function.
-}
-- encode sets up the arguments for the real function.
encode :: String -> [Int]
encode input
= encode' input first_code initial_table
encode input = encode' input first_code initial_table
{- encode' loops through the input string assembling the codes produced
- by code_string.
- The first character is treated specially in that it is not added to the
- table; its code is simply its ascii value
{-
- encode' loops through the input string assembling the codes produced
- by code_string. The first character is treated specially in that it
- is not added to the table; its code is simply its ascii value.
-}
-- implicit selections with IMPLICIT DW
--#define IMPLICIT
-- explicit selections with EXPLICIT DW
#define EXPLICIT
--encode' :: String -> Int -> CodeTable -> [Int]
encode' [] _ _
= []
= []
encode' input v t
= case (code_string input 0 v t) of { (input', n, t') ->
n : encode' input' (v + 1) t'
}
{- ???
encode' input v t
= n : encode' input' (v + 1) t'
where (input', n, t') = code_string input 0 v t
-}
= case (code_string input 0 v t) of { (input', n, t') ->
n : encode' input' (v + 1) t'
}
{- code_string parses enough of the input string to produce one code and
{-
- code_string parses enough of the input string to produce one code and
- returns the remaining input, the code and a new code table.
-
- The first character is taken and its place found in the code table. The
......@@ -60,98 +44,28 @@ encode' input v t
- character to the current table and assign it the next new code value.
-}
code_string input@(c : input2) old_code next_code (PT p@(PTE k v t) l r)
| c < k = (f1 r1 p r)
| c > k = (f2 r2 p l)
| otherwise = (f3 r3 k v l r)
where
r1 = code_string input old_code next_code l
r2 = code_string input old_code next_code r
r3 = code_string input2 v next_code t
#ifdef IMPLICIT
code_string :: String -> Int -> Int -> CodeTable -> (String, Int, CodeTable)
code_string [] old_code _ _
= ([], old_code, PTNil)
code_string i@(c:cs) old_code next_code PTNil -- found max string, add suffix
= if next_code >= max_entries
then (i, old_code, PTNil)
else (i, old_code, PT (PTE c next_code PTNil) PTNil PTNil)
code_string i@(c:cs) old_code next_code (PT (PTE k v t) l r)
| c < k = (csl, nl, PT (PTE k v t) l' r)
| c > k = (csr, nr, PT (PTE k v t) l r')
| c == k = (cs', n, PT (PTE k v t') l r)
where (csl, nl, l') = code_string i old_code next_code l
(csr, nr, r') = code_string i old_code next_code r
(cs', n, t') = code_string cs v next_code t
#endif
#ifdef EXPLICIT
{- ???
code_string :: String -> Int -> Int -> CodeTable -> (String, Int, CodeTable)
code_string [] old_code _ _
= ([], old_code, PTNil)
code_string ca@(c:_) old_code next_code PTNil = -- found max string, add suffix
if next_code >= max_entries then
(ca, old_code, PTNil)
else
(ca, old_code, PT (PTE c next_code PTNil) PTNil PTNil)
-}
{- partain:ORIG:
code_string ca@(c:_) old_code next_code (PT p@(PTE k _ _) l r)
| c < k = f1 result1 p r
where result1 = code_string ca old_code next_code l
code_string ca@(c:_) old_code next_code (PT p@(PTE k _ _) l r)
| c > k = f2 result2 p l
where result2 = code_string ca old_code next_code r
code_string (_:cs) old_code next_code (PT (PTE k v t) l r)
| otherwise = f3 result3 k v l r
where result3 = code_string cs v next_code t
f1 (csl,nl,l') p r = (csl, nl, PT p l' r)
f2 (csr,nr,r') p l = (csr, nr, PT p l r')
f3 (cs',n,t') k v l r = (cs', n, PT (PTE k v t') l r)
-}
{- ???
code_string ca@(c:cs) old_code next_code (PT p@(PTE k v t) l r)
| c < k = f1 result1 p r
| c > k = f2 result2 p l
| otherwise = f3 result3 k v l r
where
result1 = code_string ca old_code next_code l
result2 = code_string ca old_code next_code r
result3 = code_string cs v next_code t
f1 (csl,nl,l') p r = (csl, nl, PT p l' r)
f2 (csr,nr,r') p l = (csr, nr, PT p l r')
f3 (cs',n,t') k v l r = (cs', n, PT (PTE k v t') l r)
-}
#define CBOX(c) (c)
#define _PTE_(a,b,c) (PTE (a) (b) (c))
#define _TRIP_(a,b,c) (a,b,c)
#define ILIT(i) (i)
#define _GE_ >=
code_string input@(CBOX(c) : input2) old_code next_code (PT p@(PTE k v t) l r)
| CBOX(c) < CBOX(k) = {-_scc_ "cs1"-} (f1 r1 p r)
| CBOX(c) > CBOX(k) = {-_scc_ "cs2"-} (f2 r2 p l)
| otherwise {- CBOX(c) == CBOX(k) -} = {-_scc_ "cs3"-} (f3 r3 k v l r)
where {
r1 = code_string input old_code next_code l;
r2 = code_string input old_code next_code r;
r3 = code_string input2 v next_code t;
f1 _TRIP_(input_l,nl,l2) p r = _TRIP_(input_l,nl,PT p l2 r);
f2 _TRIP_(input_r,nr,r2) p l = _TRIP_(input_r,nr,PT p l r2);
f3 _TRIP_(input2,n,t2) k v l r = _TRIP_(input2, n, PT _PTE_(k, v, t2) l r);
}
f1 (input_l,nl,l2) p r = (input_l,nl,PT p l2 r)
f2 (input_r,nr,r2) p l = (input_r,nr,PT p l r2)
f3 (input2,n,t2) k v l r = (input2, n, PT (PTE k v t2) l r)
code_string input@(CBOX(c) : input_file2) old_code next_code PTNil
= if (next_code _GE_ ILIT(4096))
then {- _scc_ "cs4"-} _TRIP_(input, old_code, PTNil)
else {- _scc_ "cs5"-} _TRIP_(input, old_code, PT _PTE_(c, next_code, PTNil) PTNil PTNil)
code_string input@(c : input_file2) old_code next_code PTNil
| next_code >= 4096 = (input, old_code, PTNil)
| otherwise = (input, old_code, PT (PTE c next_code PTNil) PTNil PTNil)
code_string [] old_code next_code code_table = {-_scc_ "cs6"-} _TRIP_([], old_code, PTNil)
code_string [] old_code next_code code_table
= ([], old_code, PTNil)
#endif
{- We want the inital table to be balanced, but this is expensive to compute
{-
- We want the inital table to be balanced, but this is expensive to compute
- as a rebalance is needed evert two inserts (yuk!). So we do the ordinary
- infix-order binary tree insert but give the keys in such an order as to
- give a balanced tree.
......@@ -161,8 +75,7 @@ code_string [] old_code next_code code_table = {-_scc_ "cs6"-} _TRIP_([], old_co
-}
initial_table :: CodeTable
initial_table
= foldr tab_insert PTNil balanced_list
initial_table = foldr tab_insert PTNil balanced_list
tab_insert n = insert (toEnum n) n
......@@ -189,4 +102,3 @@ bal_list4
231,236,234,233,235,238,237,239,248,244,242,241,243,246,245,247,252]
bal_list5
= [250,249,251,254,253,255]
SRCS_HS = Defaults.hs BinConv.hs PTTrees.hs Encode.hs Main.hs
OBJS_O = Defaults.o BinConv.o PTTrees.o Encode.o Main.o
NoFibMultiModuleCompileAndRun(compress,-i ../../spectral/hartel/listcompr/listcompr.stdout -o1 compress.stdout)
NoFibHaskellCompile(compress,Defaults,hs)
NoFibHaskellCompile(compress,BinConv,hs)
NoFibHaskellCompile(compress,PTTrees,hs)
NoFibHaskellCompile(compress,Encode,hs)
NoFibHaskellCompile(compress,Main,hs)
NoFibDependTarget(compress, $(SRCS_HS))
interface Main where {
main :: Dialogue {-# ARITY main = 1 #-}{-# STRICTNESS main = "T,T" ST #-}
}
TOP = ../../..
PROG = compress
SRCS = Defaults.hs BinConv.hs PTTrees.hs Encode.hs Main.hs
EXTRA_RUNTESTFLAGS = -i ../../spectral/hartel/listcompr/listcompr.stdout
include $(TOP)/nofib/mk/nofib.mk
MODS= Defaults.hs BinConv.hs PTTrees.hs Encode.hs Compress.hs
INTS=$(MODS:%.hs=%.hi)
OBJS=$(MODS:%.hs=%.o)
UOBJS=$(UMODS:%.hs=%.o)
UMODS=Defaults.hs BinConv.hs Decode.hs Uncompress.hs
# HC is the name of the Haskell compiler
HC=hbchp
# REVISION is the Haskell language version number, 1 for 1.1, 0 for 1.0
REVISION=1
# DEC_VERSION is the version of Decode we wish to compile
DEC_VERSION=3
# HCFLAGS are the flags to the compiler.
# -DPAR will compile code for the GRIP machine
HCFLAGS= -M
all: hcz uhcz
hcz: $(OBJS)
$(HC) $(HCFLAGS) -o hcz $(OBJS)
strip hcz
uhcz: $(UOBJS)
$(HC) $(HCFLAGS) -o uhcz $(UOBJS)
strip uhcz
clean:
rm *.o *.hi
realclean: clean
rm hcz uhcz
%.o: %.hs
$(HC) -DREVISION=$(REVISION) -DDEC_VERSION=$(DEC_VERSION) $(HCFLAGS) -c $<
%.hi: %.o
@if test ! -f $@ ; then \
rm $< ; \
$(MAKE) HC=$(HC) $@ ; \
fi
{-
- Arrays.hs
-
- An implementation of arrays using a tree
-
- Version 0.1 10/09/92 PS
- Version 0.2 01/10/92 PS Added force function to //^ to reduce space
- consumption
-
-}
module Arrays (Maybe(..), TArray,
(!^), (//^),
mkTArray, lookup, isUndefined)
where
infixl 9 !^
infixl 9 //^
--data Maybe a = Nothing | Just a deriving Show{-was:Text-}
data TArray a = Tarray Int Int Int (BinTree a) deriving Show{-was:Text-}
data BinTree a = Leaf a | Branch (BinTree a) (BinTree a) | Empty deriving Show{-was:Text-}
data Direction = Left | Right deriving Show{-was:Text-}
mkTArray :: Int -> Int -> TArray a
mkTArray lo hi = Tarray lo hi (maxBits 1) Empty
where maxBits n = if (hi - lo + 1) > 2^n then
maxBits (n+1)
else
n
(!^) :: TArray a -> Int -> Maybe a
(!^) (Tarray lo hi bits t) index
= if (index >= lo) && (index <= hi) then
doLookup (directions bits (index-lo)) t
else error "Array index out of bounds\n"
where
doLookup _ Empty = Nothing
doLookup _ (Leaf n) = Just n
doLookup (Left:ds) (Branch l _) = doLookup ds l
doLookup (Right:ds) (Branch _ r) = doLookup ds r
(//^) :: TArray a -> [Assoc Int a] -> TArray a
(//^) t [] = t
(//^) (Tarray lo hi hiIndex t) ((i := v) : as)
= if (i >= lo) && (i <= hi) then
(//^) t' as
else error "Array: index out of bounds\n"
where