diff options
author | dos-reis <gdr@axiomatics.org> | 2011-04-30 14:27:31 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-04-30 14:27:31 +0000 |
commit | bd5f5b0df93361d31592738fb18d77a275f04bc9 (patch) | |
tree | e2b46b5d5ded0265990ef24f4bf2ddb9640e7fc4 /src/interp | |
parent | 6661a9aa8e79dc934bde807293857f2dfc0eca6f (diff) | |
download | open-axiom-bd5f5b0df93361d31592738fb18d77a275f04bc9.tar.gz |
more cleanup
Diffstat (limited to 'src/interp')
31 files changed, 145 insertions, 143 deletions
diff --git a/src/interp/as.boot b/src/interp/as.boot index d85b4743..f3522d20 100644 --- a/src/interp/as.boot +++ b/src/interp/as.boot @@ -44,9 +44,9 @@ $asyPrint := false asList() == removeFile '"temp.text" OBEY '"ls as/*.asy > temp.text" - instream := OPEN '"temp.text" + instream := inputTextFile '"temp.text" lines := [READLINE instream while not EOFP instream] - CLOSE instream + closeFile instream lines asAll lines == @@ -416,7 +416,7 @@ asyAncestorList x == [asyAncestors y for y in x] asytran fn == --put operations into table format for browser: -- <sig pred origin exposed? comments> - inStream := OPEN fn + inStream := inputTextFile fn sayBrightly ['" Reading ",fn] u := VMREAD inStream $niladics := mkNiladics u @@ -428,7 +428,7 @@ asytran fn == asytranDeclaration(d,'(top),nil,false) if null name then hohohoho() HPUT($docHash,name,$docHashLocal) - CLOSE inStream + closeFile inStream 'done mkNiladics u == diff --git a/src/interp/ax.boot b/src/interp/ax.boot index beca359f..5d94dfb7 100644 --- a/src/interp/ax.boot +++ b/src/interp/ax.boot @@ -73,7 +73,7 @@ makeAxFile(filename, constructors) == ['Import, [], 'AxiomLib], ['Import, [], 'Boolean], :axForms] st := MAKE_-OUTSTREAM(filename) PPRINT(axForm,st) - CLOSE st + closeFile st makeAxExportForm(filename, constructors) == $defaultFlag : local := false diff --git a/src/interp/br-con.boot b/src/interp/br-con.boot index 93ee91ea..0a1c5c8a 100644 --- a/src/interp/br-con.boot +++ b/src/interp/br-con.boot @@ -254,8 +254,8 @@ mkDomTypeForm(typeForm,conform,domname) == --called by kargPage domainDescendantsOf(conform,domform) == main where --called by kargPage main() == conform is [op,:r] => - op = 'Join => jfn(delete('(Type Object),r),delete('(Type Object),IFCDR domform)) - op = 'CATEGORY => nil + op is 'Join => jfn(remove(r,'Object),remove(IFCDR domform,'Object)) + op is 'CATEGORY => nil domainsOf(conform,domform) domainsOf(conform,domform) jfn([y,:r],domlist) == --keep only those domains that appear in ALL parts of Join diff --git a/src/interp/br-prof.boot b/src/interp/br-prof.boot index f0117bd6..8cb80ce6 100644 --- a/src/interp/br-prof.boot +++ b/src/interp/br-prof.boot @@ -256,9 +256,9 @@ getInfoAlist conname == abb := getConstructorAbbreviationFromDB conname or return '"not a constructor" fs := strconc(symbolName abb,'".NRLIB/info") inStream := - PROBE_-FILE fs => OPEN fs + PROBE_-FILE fs => inputTextFile fs filename := strconc('"/spad/int/algebra/",symbolName abb,'".NRLIB/info") - PROBE_-FILE filename => OPEN filename + PROBE_-FILE filename => inputTextFile filename return nil alist := mySort READ inStream if cat? then diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot index 4c49a8db..57969906 100644 --- a/src/interp/br-search.boot +++ b/src/interp/br-search.boot @@ -210,7 +210,7 @@ isFilterDelimiter? c == grepSplit(lines,doc?) == if doc? then - instream2 := OPEN strconc(systemRootDirectory(),'"/algebra/libdb.text") + instream2 := inputTextFile strconc(systemRootDirectory(),'"/algebra/libdb.text") cons := atts := doms := nil while lines is [line, :lines] repeat if doc? then @@ -230,7 +230,7 @@ grepSplit(lines,doc?) == kind = char "o" => ops := insert(line,ops) kind = char "-" => 'skip --for now systemError 'kind - if doc? then CLOSE instream2 + if doc? then closeFile instream2 [['"attribute",:reverse! atts], ['"operation",:reverse! ops], ['"category",:reverse! cats], @@ -930,9 +930,9 @@ dbWriteLines(s, :options) == pathname dbReadLines target == --AIX only--called by grepFile - instream := OPEN target + instream := inputTextFile target lines := [READLINE instream while not EOFP instream] - CLOSE instream + closeFile instream lines dbGetCommentOrigin line == @@ -942,10 +942,10 @@ dbGetCommentOrigin line == firstPart := dbPart(line,1,-1) key := makeSymbol subString(firstPart,0,1) --extract this and throw away address := subString(firstPart, 1) --address in libdb - instream := OPEN grepSource key --this always returns libdb now + instream := inputTextFile grepSource key --this always returns libdb now FILE_-POSITION(instream,readInteger address) line := READLINE instream - CLOSE instream + closeFile instream line grepSource key == diff --git a/src/interp/clam.boot b/src/interp/clam.boot index f6254c1d..cf45340d 100644 --- a/src/interp/clam.boot +++ b/src/interp/clam.boot @@ -687,7 +687,7 @@ constructor2ConstructorForm x == rightJustifyString(x,maxWidth) == size:= entryWidth x size > maxWidth => keyedSystemError("S2GE0014",[x]) - [fillerSpaces(maxWidth-size," "),x] + [fillerSpaces(maxWidth-size,char " "),x] domainEqualList(argl1,argl2) == --function used to match argument lists of constructors diff --git a/src/interp/cstream.boot b/src/interp/cstream.boot index c0913788..ead84d1b 100644 --- a/src/interp/cstream.boot +++ b/src/interp/cstream.boot @@ -58,7 +58,7 @@ incRgen1(:z)== [s]:=z a:=shoeread_-line s if null a - then (CLOSE s;StreamNil) + then (closeFile s;StreamNil) else [a,:incRgen s] diff --git a/src/interp/define.boot b/src/interp/define.boot index 9d2e41bf..b670c3c9 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -110,7 +110,6 @@ $subdomain := false --% compDefineAddSignature: (%Form,%Sig,%Env) -> %Env -DomainSubstitutionFunction: (%List %Symbol,%Form) -> %Form --% @@ -1950,14 +1949,14 @@ mkExplicitCategoryFunction(domainOrPackage,sigList,atList) == DomainSubstitutionFunction(parameters,body) == --see definition of DomainSubstitutionMacro in SPAD LISP if parameters then - (body:= Subst(parameters,body)) where + (body := Subst(parameters,body)) where Subst(parameters,body) == atom body => symbolMember?(body,parameters) => MKQ body body listMember?(body,parameters) => - g:=gensym() - $extraParms:=PUSH([g,:body],$extraParms) + g := gensym() + $extraParms := PUSH([g,:body],$extraParms) --Used in SetVector12 to generate a substitution list --bound in buildFunctor --For categories, bound and used in compDefineCategory @@ -1968,13 +1967,13 @@ DomainSubstitutionFunction(parameters,body) == body.op ~= $definition.op => ['QUOTE,simplifyVMForm body] [Subst(parameters,u) for u in body] - not (body is ["Join",:.]) => body + body isnt ["Join",:.] => body atom $definition => body null $definition.args => body --should not bother if it will only be called once - name:= makeSymbol strconc(KAR $definition,";CAT") + name := makeSymbol strconc(KAR $definition,";CAT") SETANDFILE(name,nil) - body:= ['%when,[name],['%otherwise,['%store,name,body]]] + body := ['%when,[name],['%otherwise,['%store,name,body]]] body diff --git a/src/interp/fortcall.boot b/src/interp/fortcall.boot index 85d2eaa7..7a57359a 100644 --- a/src/interp/fortcall.boot +++ b/src/interp/fortcall.boot @@ -567,7 +567,7 @@ prepareResults(results,args,dummies,values,decls) == type := getFortranType(u,decls) data := [defaultValue(type,inFirstNotSecond(args,dummies),values),:data] where defaultValue(type,argNames,actual) == - LISTP(type) and first(type)="character" => MAKE_-STRING(1) + LISTP(type) and first(type)="character" => makeString 1 LISTP(type) and first(type) in ["complex","double complex"] => makeVector( makeList( 2*apply('_*,[getVal(tt,argNames,actual) for tt in rest(type)]),_ @@ -583,7 +583,7 @@ prepareResults(results,args,dummies,values,decls) == type = "double" => longZero type = "double precision" => longZero type = "logical" => 0 - type = "character" => MAKE_-STRING(1) + type = "character" => makeString 1 type = "complex" => makeVector([shortZero,shortZero],"%SingleFloat") type = "double complex" => makeVector([longZero,longZero],"%DoubleFloat") error ['"Unrecognised Fortran type: ",type] diff --git a/src/interp/functor.boot b/src/interp/functor.boot index e4455ff2..e5821bd1 100644 --- a/src/interp/functor.boot +++ b/src/interp/functor.boot @@ -367,7 +367,7 @@ setVector3(name,instantiator) == mkDomainFormer x == if x is ['DomainSubstitutionMacro,parms,body] then - x:=DomainSubstitutionFunction(parms,body) + x := DomainSubstitutionFunction(parms,body) x := applySubst($extraParms,x) --The next line ensures that only one copy of this structure will --appear in the BPI being generated, thus saving (some) space diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index eceeae89..23648b53 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -105,7 +105,7 @@ changeVariableDefinitionToStore(form,vars) == jumpToToplevel? x == atomic? x => false op := x.op - op = 'SEQ => CONTAINED('THROW,x.args) -- FIXME: what about GO? + op is 'SEQ => CONTAINED('THROW,x.args) -- FIXME: what about GO? op in '(EXIT THROW %leave) => true or/[jumpToToplevel? x' for x' in x] @@ -175,15 +175,15 @@ resetTo(x,y) == ++ Simplify the VM form `x' simplifyVMForm x == - x = '%icst0 => 0 - x = '%icst1 => 1 + x is '%icst0 => 0 + x is '%icst1 => 1 atomic? x => x - x.op = 'CLOSEDFN => x + x.op is 'CLOSEDFN => x atom x.op => x is [op,vars,body] and op in $AbstractionOperator => third(x) := simplifyVMForm body x - if x.op = 'IF then + if x.op is 'IF then resetTo(x,optIF2COND x) for args in tails x.args repeat args.first := simplifyVMForm first args @@ -210,7 +210,7 @@ hasNoThrows(a,g) == hasNoThrows(first a,g) and hasNoThrows(rest a,g) changeThrowToGo(s,g) == - atom s or first s='QUOTE => nil + atom s or first s is 'QUOTE => nil s is ["THROW", =g,u] => changeThrowToGo(u,g) s.first := "PROGN" @@ -271,17 +271,17 @@ optCall (x is ['%call,:u]) == x.rest := [:a,name] x fn is [q,R,n] and q in '(ELT CONST) => - q = 'CONST => ['spadConstant,R,n] + q is 'CONST => ['spadConstant,R,n] emitIndirectCall(fn,a,x) systemErrorHere ['optCall,x] optCons (x is ["CONS",a,b]) == - a="NIL" => - b='NIL => (x.first := 'QUOTE; x.rest := ['NIL,:'NIL]; x) + a is "NIL" => + b is 'NIL => (x.first := 'QUOTE; x.rest := ['NIL,:'NIL]; x) b is ['QUOTE,:c] => (x.first := 'QUOTE; x.rest := ['NIL,:c]; x) x a is ['QUOTE,a'] => - b='NIL => (x.first := 'QUOTE; x.rest := [a',:'NIL]; x) + b is 'NIL => (x.first := 'QUOTE; x.rest := [a',:'NIL]; x) b is ['QUOTE,:c] => (x.first := 'QUOTE; x.rest := [a',:c]; x) x x @@ -292,20 +292,20 @@ optMkRecord ["mkRecord",:u] == ['%vector,:u] optCond (x is ['%when,:l]) == - if l is [a,[aa,b]] and aa = '%otherwise and b is ['%when,:c] then + if l is [a,[aa,b]] and aa is '%otherwise and b is ['%when,:c] then x.rest.rest := c if l is [[p1,:c1],[p2,:c2],:.] then if (p1 is ['%not,=p2]) or (p2 is ['%not,=p1]) then l:=[[p1,:c1],['%otherwise,:c2]] x.rest := l - c1 is ['NIL] and p2 = '%otherwise and first c2 = '%otherwise => + c1 is ['NIL] and p2 is '%otherwise and first c2 is '%otherwise => return optNot ['%not,p1] l is [[p1,['%when,[p2,c2]]]] => optCond ['%when,[['%and,p1,p2],c2]] l is [[p1,c1],['%otherwise,'%false]] => optAnd ['%and,p1,c1] l is [[p1,c1],['%otherwise,'%true]] => optOr ['%or,optNot ['%not,p1],c1] l is [[p1,'%false],['%otherwise,c2]] => optAnd ['%and,optNot ['%not,p1],c2] l is [[p1,'%true],['%otherwise,c2]] => optOr ['%or,p1,c2] - l is [[p1,:c1],[p2,:c2],[p3,:c3]] and p3 = '%otherwise => + l is [[p1,:c1],[p2,:c2],[p3,:c3]] and p3 is '%otherwise => EqualBarGensym(c1,c3) => optCond ['%when,[['%or,p1,optNot ['%not,p2]],:c1],['%otherwise,:c2]] EqualBarGensym(c1,c2) => @@ -348,7 +348,7 @@ optIF2COND ["IF",a,b,c] == optXLAMCond x == x is ['%when,u:= [p,c],:l] => - p = '%otherwise => c + p is '%otherwise => c ['%when,u,:optCONDtail l] atom x => x x.first := optXLAMCond first x @@ -358,7 +358,7 @@ optXLAMCond x == optCONDtail l == null l => nil [frst:= [p,c],:l']:= l - p = '%otherwise => [['%otherwise,c]] + p is '%otherwise => [['%otherwise,c]] null rest l => [frst,['%otherwise,["CondError"]]] [frst,:optCONDtail l'] @@ -383,7 +383,7 @@ optSEQ ["SEQ",:l] == null l => nil l is [["%LET",g,x],:r] and replaceableTemporary?(g,r) => getRidOfTemps substitute(x,g,r) - first l="/throwAway" => getRidOfTemps rest l + first l is "/throwAway" => getRidOfTemps rest l --this gets rid of unwanted labels generated by declarations in SEQs [first l,:getRidOfTemps rest l] SEQToCOND l == @@ -483,7 +483,7 @@ isSimpleVMForm form == ++ on the program point where it is evaluated. isFloatableVMForm: %Code -> %Boolean isFloatableVMForm form == - atom form => form ~= "$" + atom form => form isnt "$" form is ["QUOTE",:.] => true symbolMember?(form.op, $simpleVMoperators) and "and"/[isFloatableVMForm arg for arg in form.args] @@ -504,7 +504,7 @@ isVMConstantForm form == findVMFreeVars form == IDENTP form => [form] form isnt [op,:args] => nil - op = "QUOTE" => nil + op is "QUOTE" => nil vars := union/[findVMFreeVars arg for arg in args] atom op => vars union(findVMFreeVars op,vars) @@ -582,7 +582,7 @@ optLET u == body isnt [op,:args] => u -- Well, with case-patterns, it is beneficial to try a bit harder -- with conditional forms. - op = '%when => + op is '%when => continue := true -- shall be continue let-inlining? -- Since we do a single pass, we can't reuse the inits list -- as we may find later that we can't really inline into @@ -681,7 +681,7 @@ optCollectVector form == optRetract ["%retract",e,m,pred] == atom e => cond := simplifyVMForm substitute(e,"#1",pred) - cond = '%true => e + cond is '%true => e ["check-subtype",cond,MKQ m,e] g := gensym() ['%bind,[[g,e]],["check-subtype",substitute(g,"#1",pred),MKQ m,g]] @@ -690,23 +690,23 @@ optRetract ["%retract",e,m,pred] == --% Boolean expression transformers optNot(x is ['%not,a]) == - a = '%true => '%false - a = '%false => '%true + a is '%true => '%false + a is '%false => '%true a is ['%not,b] => b a is ['%when,:.] => optCond [a.op, :[[p,optNot ['%not,c]] for [p,c] in a.args]] x optAnd(x is ['%and,a,b]) == - a = '%true => b - b = '%true => a - a = '%false => '%false + a is '%true => b + b is '%true => a + a is '%false => '%false x optOr(x is ['%or,a,b]) == - a = '%false => b - b = '%false => a - a = '%true => '%true + a is '%false => b + b is '%false => a + a is '%true => '%true x optIeq(x is ['%ieq,a,b]) == diff --git a/src/interp/g-timer.boot b/src/interp/g-timer.boot index 4abb299a..4b849bf8 100644 --- a/src/interp/g-timer.boot +++ b/src/interp/g-timer.boot @@ -51,10 +51,10 @@ printNamedStatsByProperty(listofnames, prop) == strname := STRINGIMAGE name strval := STRINGIMAGE n sayBrightly concat(bright strname, - fillerSpaces(70-#strname-#strval,'"."),bright strval) - sayBrightly bright fillerSpaces(72,'"-") + fillerSpaces(70-#strname-#strval,char "."),bright strval) + sayBrightly bright fillerSpaces(72,char "-") sayBrightly concat(bright '"Total", - fillerSpaces(65-# STRINGIMAGE total,'"."),bright STRINGIMAGE total) + fillerSpaces(65-# STRINGIMAGE total,char "."),bright STRINGIMAGE total) makeLongStatStringByProperty _ (listofnames, listofclasses, prop, classprop, units, flag) == diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 47522a3b..23aa218a 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -40,7 +40,7 @@ namespace BOOT module g_-util where atomic?: %Thing -> %Boolean getTypeOfSyntax: %Form -> %Mode - pairList: (%List %Form,%List %Form) -> %List %Pair(%Form.%Form) + pairList: (%List %Form,%List %Form) -> %List %Pair(%Form,%Form) mkList: %List %Form -> %Form isSubDomain: (%Mode,%Mode) -> %Form usedSymbol?: (%Symbol,%Code) -> %Boolean @@ -458,9 +458,9 @@ insertWOC(x,y) == --% Miscellaneous Functions for Working with Strings -fillerSpaces(n,:charPart) == +fillerSpaces(n,charPart == char " ") == n <= 0 => '"" - MAKE_-FULL_-CVEC(n,IFCAR charPart or '" ") + makeString(n,charPart) centerString(text,width,fillchar) == wid := entryWidth text @@ -487,7 +487,6 @@ stringPrefix?(pref,str) == ok stringChar2Integer(str,pos) == - -- replaces GETSTRINGDIGIT in UT LISP -- returns small integer represented by character in position pos -- in string str. Returns NIL if not a digit or other error. if IDENTP str then str := symbolName str diff --git a/src/interp/i-object.boot b/src/interp/i-object.boot index a8049f29..74359a51 100644 --- a/src/interp/i-object.boot +++ b/src/interp/i-object.boot @@ -438,8 +438,8 @@ srcPosDisplay(sp) == col := srcPosColumn sp dots := col = 0 => '"" - fillerSpaces(col, '".") - sayBrightly [fillerSpaces(#s, '" "), dots, '"^"] + fillerSpaces(col, char ".") + sayBrightly [fillerSpaces(#s, char " "), dots, '"^"] true diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot index 4bd60e63..ddb6f291 100644 --- a/src/interp/i-output.boot +++ b/src/interp/i-output.boot @@ -461,7 +461,7 @@ appChar(string,x,y,d) == RPLACSTR(line,shiftedX,n:=#string,string,0,n) if bumpDeltaIfTrue=true then $highlightDelta:= $highlightDelta+1 d - appChar(string,x,y,append!(d,[[y,:GETFULLSTR(10+$LINELENGTH+$MARGIN," ")]])) + appChar(string,x,y,append!(d,[[y,:makeString(10+$LINELENGTH+$MARGIN,char " ")]])) print(x,domain) == dom:= devaluate domain @@ -1595,7 +1595,7 @@ output(expr,domain) == sayALGEBRA [:bright '"LISP",'"output:",'"%l",expr or '"NIL"] outputNumber(start,linelength,num) == - if start > 1 then blnks := fillerSpaces(start-1,'" ") + if start > 1 then blnks := fillerSpaces(start-1,char " ") else blnks := '"" under := '"__" firsttime:=(linelength>3) @@ -1619,7 +1619,7 @@ outputNumber(start,linelength,num) == sayALGEBRA [blnks, num] outputString(start,linelength,str) == - if start > 1 then blnks := fillerSpaces(start-1,'" ") + if start > 1 then blnks := fillerSpaces(start-1,char " ") else blnks := '"" while # str > linelength repeat if $collectOutput then diff --git a/src/interp/i-parser.boot b/src/interp/i-parser.boot index 10959f93..87132e30 100644 --- a/src/interp/i-parser.boot +++ b/src/interp/i-parser.boot @@ -71,7 +71,10 @@ collectParsedLines(s, p) == ++ parse the whole file `file'. Returns a list of parse tree ++ containing full source location information. parseInputFile file == - WITH_-OPEN_-FILE(st file, parseStream(st, file)) + try + st := inputTextFile file + parseStream(st, file) + finally (if st ~= nil then close st) ++ Same as parseInputFile, but returns a parse form, instead of ++ of a parse tree, i.e. source location information left out. diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index 1c8b3ddd..1ab82514 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -2240,14 +2240,14 @@ loadSpad2Cmd args == reportCount () == centerAndHighlight(" Current Count Settings ",$LINELENGTH,specialChar 'hbar) SAY " " - sayBrightly [:bright " cache",fillerSpaces(30,'".")," ",$cacheCount] + sayBrightly [:bright " cache",fillerSpaces(30,char ".")," ",$cacheCount] if $cacheAlist then for [a,:b] in $cacheAlist repeat aPart:= linearFormatName a n:= sayBrightlyLength aPart - sayBrightly concat(" ",aPart," ",fillerSpaces(32-n,'".")," ",b) + sayBrightly concat(" ",aPart," ",fillerSpaces(32-n,char ".")," ",b) SAY " " - sayBrightly [:bright " stream",fillerSpaces(29,'".")," ",$streamCount] + sayBrightly [:bright " stream",fillerSpaces(29,char ".")," ",$streamCount] --% )library library args == @@ -2886,7 +2886,7 @@ printLabelledList(ls,label1,label2,prefix,patterns) == if syn = '"%i" then syn := '"%i " wid := MAX(30 - (entryWidth syn),1) sayBrightly concat('"%b",prefix,syn,'"%d", - fillerSpaces(wid,'"."),'" ",prefix,comm) + fillerSpaces(wid,char "."),'" ",prefix,comm) sayBrightly '"" whatCommands(patterns) == diff --git a/src/interp/i-toplev.boot b/src/interp/i-toplev.boot index 03d8edf7..9d3642aa 100644 --- a/src/interp/i-toplev.boot +++ b/src/interp/i-toplev.boot @@ -96,14 +96,14 @@ start(:l) == readSpadProfileIfThere() if $displayStartMsgs then spadStartUpMsgs() if $OLDLINE then - SAY fillerSpaces($LINELENGTH,'"=") + SAY fillerSpaces($LINELENGTH,char "=") sayKeyedMsg("S2IZ0050",[namestring ['axiom,'input]]) if $OLDLINE ~= 'END__UNIT then centerAndHighlight($OLDLINE,$LINELENGTH,'" ") sayKeyedMsg("S2IZ0051",NIL) else sayKeyedMsg("S2IZ0052",NIL) - SAY fillerSpaces($LINELENGTH,'"=") + SAY fillerSpaces($LINELENGTH,char "=") TERPRI() $OLDLINE := NIL $superHash := hashTable 'EQUAL diff --git a/src/interp/incl.boot b/src/interp/incl.boot index 578f3ff2..bbe9cb08 100644 --- a/src/interp/incl.boot +++ b/src/interp/incl.boot @@ -66,7 +66,7 @@ incStringStream s== incRenumber incLude(0,incRgen s,0,['"strings"] ,[Top]) incFile fn== - incRenumber incLude(0,incRgen OPEN fn,0,[fn],[Top]) + incRenumber incLude(0,incRgen inputTextFile fn,0,[fn],[Top]) incStream(st, fn) == incRenumber incLude(0,incRgen st,0,[fn],[Top]) diff --git a/src/interp/int-top.boot b/src/interp/int-top.boot index 3fecbbd5..74760f91 100644 --- a/src/interp/int-top.boot +++ b/src/interp/int-top.boot @@ -211,7 +211,10 @@ intloopInclude0(st, name, n) == next(function lineoftoks,$lines)))) intloopInclude(name, n) == - WITH_-OPEN_-FILE(st name, intloopInclude0(st, name, n)) + try + st := inputTextFile name + intloopInclude0(st, name, n) + finally (if st ~= nil then closeFile st) intloopInclude1(name,n) == a:=ncloopIncFileName name @@ -345,7 +348,10 @@ ncloopInclude0(st, name, n) == next(function lineoftoks,$lines)))) ncloopInclude(name, n) == - WITH_-OPEN_-FILE(st name, ncloopInclude0(st, name, n)) + try + st := inputTextFile name + ncloopInclude0(st, name, n) + finally (if st ~= nil then closeFile st) ncloopInclude1(name,n) == a:=ncloopIncFileName name diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot index 9c5a8bcd..413f0ebb 100644 --- a/src/interp/lisplib.boot +++ b/src/interp/lisplib.boot @@ -488,7 +488,7 @@ compConLib1(fun,infileOrNil,outfileOrNil,auxOp,editFlag,traceFlag) == compDefineLisplib(df:=["DEF",[op,:.],:.],m,e,prefix,fal,fn) == --fn= compDefineCategory1 OR compDefineFunctor1 - sayMSG fillerSpaces(72,'"-") + sayMSG fillerSpaces(72,char "-") $LISPLIB: local := 'T $op: local := op $lisplibAttributes: local := NIL @@ -533,7 +533,7 @@ compDefineLisplib(df:=["DEF",[op,:.],:.],m,e,prefix,fal,fn) == filearg := $FILEP(libName,$spadLibFT,$libraryDirectory) RPACKFILE filearg FRESH_-LINE $algebraOutputStream - sayMSG fillerSpaces(72,'"-") + sayMSG fillerSpaces(72,char "-") unloadOneConstructor(op,libName) LOCALDATABASE([symbolName getConstructorAbbreviationFromDB op],NIL) $newConlist := [op, :$newConlist] ----------> bound in function "compiler" @@ -809,7 +809,7 @@ getIndexPathname: %String -> %String getIndexPathname dir == strconc(ensureTrailingSlash dir, $IndexFilename) -getAllIndexPathnames: %String -> %List %Form +getAllIndexPathnames: %String -> %List %Thing getAllIndexPathnames dir == -- GCL's semantics of Common Lisp's `DIRECTORY *' differs from the -- rest of everybody else' semantics. Namely, GCL would return a @@ -822,7 +822,7 @@ getAllIndexPathnames dir == )endif -getAllAldorObjectFiles: %String -> %List %Form +getAllAldorObjectFiles: %String -> %List %Thing getAllAldorObjectFiles dir == asys := DIRECTORY strconc(dir,'"*.asy") asos := DIRECTORY strconc(dir,'"*.ao") @@ -838,19 +838,20 @@ getAllAldorObjectFiles dir == ++ in directory designated by 'dir'. openIndexFileIfPresent: %String -> %Thing openIndexFileIfPresent dir == - OPEN(getIndexPathname dir,KEYWORD::DIRECTION,KEYWORD::INPUT, - KEYWORD::IF_-DOES_-NOT_-EXIST,nil) + inputTextFile getIndexPathname dir ++ getIndexTable: %String -> %Thing getIndexTable dir == indexFile := getIndexPathname dir existingFile? indexFile => - WITH_-OPEN_-FILE(stream indexFile, - GET_-INDEX_-TABLE_-FROM_-STREAM stream) + try + stream := inputTextFile indexFile + GET_-INDEX_-TABLE_-FROM_-STREAM stream + finally (if stream ~= nil then closeFile stream) -- index file doesn't exist but mark this directory as a Lisplib. - WITH_-OPEN_-FILE(stream(indexFile,KEYWORD::DIRECTION,KEYWORD::OUTPUT), - nil) + try stream := outputTextFile indexFile + finally (if stream ~= nil then closeFile stream) --% compDefineExports(form,ops,sig,e) == diff --git a/src/interp/msg.boot b/src/interp/msg.boot index 88873010..2bd735a8 100644 --- a/src/interp/msg.boot +++ b/src/interp/msg.boot @@ -166,7 +166,7 @@ processChPosesForOneLine msgList == posLetter := rest assoc(poCharPosn getMsgPos msg,chPosList) oldPre := getMsgPrefix msg setMsgPrefix (msg,strconc(oldPre,_ - MAKE_-FULL_-CVEC ($preLength - 4 - # oldPre),posLetter) ) + makeString($preLength - 4 - # oldPre),posLetter) ) leaderMsg := makeLeaderMsg chPosList append!(msgList,[leaderMsg]) --a back cons @@ -226,8 +226,7 @@ putFTText (msg,chPosList) == setMsgText(msg,[:markingText,:getMsgText msg]) rep (c,n) == - n > 0 => - MAKE_-FULL_-CVEC(n, c) + n > 0 => makeString(n, c) '"" --called from parameter list of nc message functions @@ -424,10 +423,10 @@ listDecideHowMuch(pos,oldPos) == 'NONE getPreStL optPre == - null optPre => [MAKE_-FULL_-CVEC 2] + null optPre => [makeString 2] spses := (extraPlaces := ($preLength - (# optPre) - 3)) > 0 => - MAKE_-FULL_-CVEC extraPlaces + makeString extraPlaces '"" ['"%b", optPre,spses,'":", '"%d"] @@ -503,7 +502,7 @@ whichCat attr == --% these functions directly interact with the message object makeLeaderMsg chPosList == - st := MAKE_-FULL_-CVEC ($preLength- 3) + st := makeString($preLength- 3) oldPos := -1 for [posNum,:posLetter] in reverse chPosList repeat st := strconc(st, _ diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot index c821ed45..d61a33a7 100644 --- a/src/interp/msgdb.boot +++ b/src/interp/msgdb.boot @@ -231,7 +231,7 @@ substituteSegmentedMsg(msg,args) == c = char "%" and n > 1 and stringChar(x,1) = char "x" and digit? stringChar(x,2) => - l := [fillerSpaces(DIG2FIX stringChar(x,2), '" "),:l] + l := [fillerSpaces(DIG2FIX stringChar(x,2),char " "),:l] --x is a plain word l := [x,:l] addBlanks reverse! l @@ -450,8 +450,8 @@ flowSegmentedMsg(msg, len, offset) == potentialMarg := 0 actualMarg := 0 - off := (offset <= 0 => '""; fillerSpaces(offset,'" ")) - off1:= (offset <= 1 => '""; fillerSpaces(offset-1,'" ")) + off := (offset <= 0 => '""; fillerSpaces(offset,char " ")) + off1:= (offset <= 1 => '""; fillerSpaces(offset-1,char " ")) firstLine := true cons? msg => @@ -554,7 +554,7 @@ sayString(x,out == $OutputStream) == spadStartUpMsgs() == -- messages displayed when the system starts up $LINELENGTH < 60 => NIL - bar := fillerSpaces($LINELENGTH,specialChar 'hbar) + bar := fillerSpaces($LINELENGTH,char specialChar 'hbar) sayKeyedMsg("S2GL0001",[_*BUILD_-VERSION_*, _*YEARWEEK_*]) sayMSG bar sayKeyedMsg("S2GL0018C",NIL) @@ -720,7 +720,7 @@ brightPrintCenter(x,out == $OutputStream) == wid := # x if wid < $LINELENGTH then f := DIVIDE($LINELENGTH - wid,2) - x := [fillerSpaces(f.0,'" "),x] + x := [fillerSpaces(f.0,char " "),x] for y in x repeat brightPrint0(y,out) NIL y := NIL @@ -733,7 +733,7 @@ brightPrintCenter(x,out == $OutputStream) == wid := sayBrightlyLength y if wid < $LINELENGTH then f := DIVIDE($LINELENGTH - wid,2) - y := [fillerSpaces(f.0,'" "),:y] + y := [fillerSpaces(f.0,char " "),:y] for z in y repeat brightPrint0(z,out) if x then sayNewLine(out) @@ -765,7 +765,7 @@ brightPrintRightJustify(x, out == $OutputStream) == x := object2String x wid := # x wid < $LINELENGTH => - x := [fillerSpaces($LINELENGTH-wid,'" "),x] + x := [fillerSpaces($LINELENGTH-wid,char " "),x] for y in x repeat brightPrint0(y,out) NIL brightPrint0(x,out) @@ -779,7 +779,7 @@ brightPrintRightJustify(x, out == $OutputStream) == y := reverse! y wid := sayBrightlyLength y if wid < $LINELENGTH then - y := [fillerSpaces($LINELENGTH-wid,'" "),:y] + y := [fillerSpaces($LINELENGTH-wid,char " "),:y] for z in y repeat brightPrint0(z,out) if x then sayNewLine(out) @@ -823,7 +823,7 @@ sayAsManyPerLineAsPossible l == str := '"" for i in 0..(n-1) repeat [c,:l] := l - str := strconc(str,c,fillerSpaces(w - #c,'" ")) + str := strconc(str,c,fillerSpaces(w - #c,char " ")) (i+1) rem p = 0 => (sayMSG str ; str := '"" ) if str ~= '"" then sayMSG str NIL @@ -861,7 +861,7 @@ say2PerLineThatFit l == while l repeat sayBrightlyNT first l sayBrightlyNT - fillerSpaces(($LINELENGTH quo 2 - sayDisplayWidth first l),'" ") + fillerSpaces(($LINELENGTH quo 2 - sayDisplayWidth first l),char " ") (l:= rest l) => sayBrightlyNT first l l:= rest l @@ -898,7 +898,7 @@ pp2Cols(al) == nil ppPair(abb,name) == - sayBrightlyNT [:bright abb,fillerSpaces(8-entryWidth abb," "),name] + sayBrightlyNT [:bright abb,fillerSpaces(8-entryWidth abb,char " "),name] canFit2ndEntry(name,al) == wid := $LINELENGTH quo 2 - 10 diff --git a/src/interp/newfort.boot b/src/interp/newfort.boot index c0d7277e..d74329b4 100644 --- a/src/interp/newfort.boot +++ b/src/interp/newfort.boot @@ -297,9 +297,8 @@ fortran2Lines f == fortran2Lines1 f == -- f is a list of strings making up 1 FORTRAN statement -- return: a reverse list of FORTRAN lines - normPref := MAKE_-STRING($fortIndent) - --contPref := strconc(MAKE_-STRING($fortIndent-1),"&") - contPref := strconc(" &",MAKE_-STRING($fortIndent-6)) + normPref := makeString $fortIndent + contPref := strconc(" &",makeString($fortIndent-6)) lines := NIL ll := $fortIndent while f repeat @@ -850,10 +849,24 @@ fix2FortranFloat e == isFloat e == FLOATP(e) or string?(e) and FIND(char ".",e) +removeCharFromString(c,s) == + -- find c's position in s. + k := nil + for i in 0..maxIndex s while k = nil repeat + stringChar(s,i) = c => k := i + k = nil => s + -- make a copy without c. + s' := makeString(#s - 1) + for i in 0..(k-1) repeat + stringChar(s',i) := stringChar(s,i) + for i in k..maxIndex s' repeat + stringChar(s',i) := stringChar(s,i+1) + s' + checkPrecision e == -- Do we have a string? string? e and codePoint stringChar(e,0) = 34 => e - e := delete(char " ",STRINGIMAGE e) + e := removeCharFromString(char " ",STRINGIMAGE e) $fortranPrecision = "double" => iPart := subSequence(e,0,(period:=POSITION(char ".",e))+1) expt := if ePos := POSITION(char "E",e) then subSequence(e,ePos+1) else "0" diff --git a/src/interp/preparse.lisp b/src/interp/preparse.lisp index b3279119..059caf40 100644 --- a/src/interp/preparse.lisp +++ b/src/interp/preparse.lisp @@ -156,7 +156,7 @@ (SETQ NCOMBLOCK NIL))) (SETQ NCOMBLOCK (CONS N (CONS A (IFCDR NCOMBLOCK)))) (SETQ A "")) - ('T (PUSH (STRCONC (GETFULLSTR N " ") + ('T (PUSH (STRCONC (|makeString| N #\Space) (SUBSTRING A N ())) $LINELIST) (SETQ $INDEX (1- $INDEX)) (SETQ A (SUBSEQ A 0 N)))) diff --git a/src/interp/scan.boot b/src/interp/scan.boot index 91b7d275..8dcfc387 100644 --- a/src/interp/scan.boot +++ b/src/interp/scan.boot @@ -161,30 +161,29 @@ scanKeyTable:=scanKeyTableCons() scanInsert(s,d) == l := #s h := codePoint stringChar(s,0) - u := d.h + u := vectorRef(d,h) n := #u k:=0 - while l <= #(u.k) repeat + while l <= #vectorRef(u,k) repeat k := k+1 v := newVector(n+1) for i in 0..k-1 repeat - vectorRef(v,i) := u.i + vectorRef(v,i) := vectorRef(u,i) vectorRef(v,k) := s for i in k..n-1 repeat - vectorRef(v,i+1) := u.i + vectorRef(v,i+1) := vectorRef(u,i) vectorRef(d,h) := v s scanDictCons()== - l:= HKEYS scanKeyTable d := a := newVector 256 b := newVector 1 - vectorRef(b,0) := MAKE_-CVEC 0 + vectorRef(b,0) := '"" for i in 0..255 repeat vectorRef(a,i) := b a - for s in l repeat + for s in HKEYS scanKeyTable repeat scanInsert(s,d) d diff --git a/src/interp/setvars.boot b/src/interp/setvars.boot index 659c784f..c2c2f563 100644 --- a/src/interp/setvars.boot +++ b/src/interp/setvars.boot @@ -321,14 +321,14 @@ displaySetVariableSettings(setTree,label) == sayBrightly ["Variable ", "Description ", "Current Value"] - SAY fillerSpaces($LINELENGTH,specialChar 'hbar) + SAY fillerSpaces($LINELENGTH,char specialChar 'hbar) subtree := nil for setData in setTree repeat null satisfiesUserLevel setData.setLevel => nil setOption := object2String setData.setName - setOption := strconc(setOption,fillerSpaces(13-#setOption,'" "), + setOption := strconc(setOption,fillerSpaces(13-#setOption,char " "), setData.setLabel) - setOption := strconc(setOption,fillerSpaces(55-#setOption,'" ")) + setOption := strconc(setOption,fillerSpaces(55-#setOption,char " ")) st := setData.setType st = 'FUNCTION => opt := diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot index 349304f8..c9667864 100644 --- a/src/interp/sys-utility.boot +++ b/src/interp/sys-utility.boot @@ -66,7 +66,7 @@ $COMBLOCKLIST := nil ++ the runtime system. getVMType d == IDENTP d => - d = "*" => d + d is "*" => d "%Thing" string? d => "%Thing" -- literal flag parameter case (d' := devaluate d) of @@ -86,7 +86,7 @@ getVMType d == Vector => ["%Vector",getVMType second d'] PrimitiveArray => ["%SimpleArray", getVMType second d'] Pair => ["%Pair",getVMType second d',getVMType third d'] - Union => ["%Pair",'%Thing,'%Thing] + Union => ["%Pair",'%Short,'%Thing] Record => #rest d' > 2 => "%Shell" ["%Pair",'%Thing,'%Thing] @@ -116,14 +116,6 @@ functionp f == IDENTP f => FBOUNDP f and null MACRO_-FUNCTION f function? f -++ remove `item' from `sequence'. -delete(item,sequence) == - symbol? item => - REMOVE(item,sequence,KEYWORD::TEST,function sameObject?) - atom item and not array? item => - REMOVE(item,sequence) - REMOVE(item,sequence,KEYWORD::TEST,function EQUALP) - ++ returns true if `x' is contained in `y'. CONTAINED: (%Thing,%Thing) -> %Boolean CONTAINED(x,y) == main where @@ -330,10 +322,6 @@ readByteFromFile ifile == writeByteToFile(ofile,b) == writeByte(b,ofile) -closeFile file == - CLOSE file - nil - --% stringImage x == symbol? x => symbolName x diff --git a/src/interp/topics.boot b/src/interp/topics.boot index c107aa90..7cc8356d 100644 --- a/src/interp/topics.boot +++ b/src/interp/topics.boot @@ -90,7 +90,7 @@ mkTopicHashTable() == --given $groupAssoc = ((extended . for item in items repeat HPUT($defaultsHash,item,[kind,:HGET($defaultsHash,item)]) $conTopicHash := hashTable 'EQL --key is constructor name; value is - instream := OPEN '"topics.data" + instream := inputTextFile '"topics.data" while not EOFP instream repeat line := READLINE instream while blankLine? line repeat line := READLINE instream diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp index 590aa4a8..c8f83c3d 100644 --- a/src/interp/vmlisp.lisp +++ b/src/interp/vmlisp.lisp @@ -843,11 +843,6 @@ (define-function 'getstr #'make-cvec) -(defun make-full-cvec (sint &optional (char #\space)) - (make-string sint :initial-element (character char))) - -(define-function 'getfullstr #'make-full-cvec) - ; 17.2 Accessing (defun string2id-n (cvec sint) diff --git a/src/interp/word.boot b/src/interp/word.boot index 0b1a3b92..84a8014d 100644 --- a/src/interp/word.boot +++ b/src/interp/word.boot @@ -174,15 +174,15 @@ pickANumber(word,list) == secondList:= TAKE(-halfLength,short) secondStartIndex:= halfLength + extra shortList:= - "append"/[[[:bright i,fillerSpaces(xx-WIDTH i,'" "),x], - [:bright(i+secondStartIndex),fillerSpaces(xx-WIDTH (i+halfLength),'" "),y]] + "append"/[[[:bright i,fillerSpaces(xx-WIDTH i,char " "),x], + [:bright(i+secondStartIndex),fillerSpaces(xx-WIDTH (i+halfLength),char " "),y]] for i in 1.. for x in firstList for y in secondList] say2PerLineThatFit shortList i:= 1 + halfLength if extra=1 then - sayBrightly [:bright i,fillerSpaces(xx-WIDTH i,'" "),list.(i-1)] + sayBrightly [:bright i,fillerSpaces(xx-WIDTH i,char " "),list.(i-1)] for x in long for i in (1+length).. repeat - sayBrightly [:bright i,fillerSpaces(xx-WIDTH i,'" "),x] + sayBrightly [:bright i,fillerSpaces(xx-WIDTH i,char " "),x] center80 ['"If so: type a number between",:bright 1,'"and",:bright n,"and ENTER"] center80 ['"Anything else means",:bright 'no] y := queryUser nil |