aboutsummaryrefslogtreecommitdiff
path: root/src/boot/translator.boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/translator.boot')
-rw-r--r--src/boot/translator.boot151
1 files changed, 0 insertions, 151 deletions
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index 377a721a..b0288f08 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -501,158 +501,7 @@ shoeRemoveStringIfNec(str,s)==
n := stringSuffix?(str,s) => subString(s,0,n)
s
--- DEFUSE prints the definitions not used and the words used and
--- not defined in the input file and common lisp.
-
-DEFUSE fn==
- try
- a := inputTextFile strconc(fn,'".boot")
- shoeDfu(a,fn)
- finally closeStream a
-
--%
-$bootDefined := nil
-$bootDefinedTwice := nil
-$bootUsed := nil
-$lispWordTable := nil
-
-shoeDfu(a,fn)==
- a=nil => shoeNotFound fn
- $lispWordTable: local := makeTable function symbolEq?
- DO_-SYMBOLS(i(namespace LISP),tableValue($lispWordTable,i) := true)
- $bootDefined: local := makeTable function symbolEq?
- $bootUsed:local := makeTable function symbolEq?
- $bootDefinedTwice: local := nil
- $bfClamming: local := false
- shoeDefUse shoeTransformStream a
- try
- stream := outputTextFile strconc(fn,'".defuse")
- shoeReport stream
- finally closeStream stream
-
-shoeReport stream==
- shoeFileLine('"DEFINED and not USED",stream)
- a := [i for [i,:b] in entries $bootDefined | not b]
- bootOut(SSORT a,stream)
- shoeFileLine('" ",stream)
- shoeFileLine('"DEFINED TWICE",stream)
- bootOut(SSORT $bootDefinedTwice,stream)
- shoeFileLine('" ",stream)
- shoeFileLine('"USED and not DEFINED",stream)
- a := [i for [i,:b] in entries $bootUsed | not b]
- for i in SSORT a repeat
- b := strconc(symbolName i,'" is used in ")
- bootOutLines( SSORT tableValue($bootUsed,i),stream,b)
-
-shoeDefUse(s)==
- while not bStreamPackageNull s repeat
- defuse([],first s)
- s:=rest s
-
-defuse(e,x)==
- x:=stripm(x,namespace .,namespace BOOTTRAN)
- $used :=nil
- [nee,niens]:=
- x is ['DEFUN,name,bv,:body] => [name,['LAMBDA,bv,:body]]
- x is ['DEFMACRO,name,bv,:body] => [name,['LAMBDA,bv,:body]]
- x is ["EVAL_-WHEN",.,["SETQ",id,exp]]=>[id,exp]
- x is ["SETQ",id,exp]=>[id,exp]
- ["TOP-LEVEL", x]
- if tableValue($bootDefined,nee)
- then
- $bootDefinedTwice:=
- nee="TOP-LEVEL"=> $bootDefinedTwice
- [nee,:$bootDefinedTwice]
- else tableValue($bootDefined,nee) := true
- defuse1 (e,niens)
- for i in $used repeat
- tableValue($bootUsed,i) := [nee,:tableValue($bootUsed,i)]
-
-defuse1(e,y)==
- y isnt [.,:.] =>
- symbol? y =>
- $used:=
- symbolMember?(y,e)=>$used
- symbolMember?(y,$used)=>$used
- defusebuiltin y =>$used
- UNION([y],$used)
- []
- y is ["LAMBDA",a,:b] => defuse1([:unfluidlist a,:e],b)
- y is ["PROG",a,:b]=>
- [dol,ndol]:=defSeparate a
- for i in dol repeat
- tableValue($bootDefined,i) := true
- defuse1([:ndol,:e],b)
- y is ['QUOTE,:a] => []
- y is ["+LINE",:a] => []
- for i in y repeat defuse1(e,i)
-
-defSeparate x==
- x = nil => [[],[]]
- f := first x
- [x1,x2] := defSeparate rest x
- bfBeginsDollar f => [[f,:x1],x2]
- [x1,[f,:x2]]
-
-unfluidlist x==
- x = nil => []
- x isnt [.,:.] => [x]
- x is ["&REST",y]=> [y]
- [first x,:unfluidlist rest x]
-
-defusebuiltin x ==
- tableValue($lispWordTable,x)
-
-bootOut (l,outfn)==
- for i in l repeat shoeFileLine(strconc ('" ",PNAME i),outfn)
-
-CLESSP(s1,s2)==
- not(SHOEGREATERP(s1,s2))
-
-SSORT l ==
- SORT(l,function CLESSP)
-
-bootOutLines(l,outfn,s)==
- l = nil => shoeFileLine(s,outfn)
- a := PNAME first l
- #s + #a > 70 =>
- shoeFileLine(s,outfn)
- bootOutLines(l,outfn,'" ")
- bootOutLines(rest l,outfn,strconc(s,'" ",a))
-
-
--- (xref "fn") produces a cross reference listing in "fn.xref"
--- It contains each name
--- used in "fn.boot", together with a list of functions that use it.
-
-XREF fn==
- try
- a := inputTextFile strconc(fn,'".boot")
- shoeXref(a,fn)
- finally closeStream a
-
-shoeXref(a,fn)==
- a = nil => shoeNotFound fn
- $lispWordTable: local := makeTable function symbolEq?
- DO_-SYMBOLS(i(namespace LISP),tableValue($lispWordTable,i) := true)
- $bootDefined: local := makeTable function symbolEq?
- $bootUsed: local := makeTable function symbolEq?
- $bfClamming: local := false
- shoeDefUse shoeTransformStream a
- out := strconc(fn,'".xref")
- try
- stream := outputTextFile out
- shoeXReport stream
- out
- finally closeStream stream
-
-
-shoeXReport stream==
- shoeFileLine('"USED and where DEFINED",stream)
- c := SSORT [k for [k,:.] in entries $bootUsed]
- for i in c repeat
- a := strconc(symbolName i,'" is used in ")
- bootOutLines( SSORT tableValue($bootUsed,i),stream,a)
shoeItem (str)==
dq:=first str