diff options
40 files changed, 173 insertions, 167 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9c754c8e..2d62f92f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-04-17 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * boot/tokens.boot: Translate maxIndex to MAXINDEX. + 2011-04-16 Gabriel Dos Reis <gdr@cs.tamu.edu> * boot/tokens.boot (shoeIdChar): Accept "!" too. diff --git a/src/boot/strap/tokens.clisp b/src/boot/strap/tokens.clisp index 6d251628..ef543a5b 100644 --- a/src/boot/strap/tokens.clisp +++ b/src/boot/strap/tokens.clisp @@ -219,7 +219,8 @@ (LIST '|integer?| 'INTEGERP) (LIST '|lastNode| 'LAST) (LIST 'LAST '|last|) (LIST '|list| 'LIST) (LIST '|lowerCase?| 'LOWER-CASE-P) - (LIST '|makeSymbol| 'INTERN) (LIST '|mkpf| 'MKPF) + (LIST '|makeSymbol| 'INTERN) + (LIST '|maxIndex| 'MAXINDEX) (LIST '|mkpf| 'MKPF) (LIST '|nconc| 'NCONC) (LIST '|newString| 'MAKE-STRING) (LIST '|newVector| 'MAKE-ARRAY) (LIST '|nil| NIL) diff --git a/src/boot/tokens.boot b/src/boot/tokens.boot index 307da560..e01e8d6d 100644 --- a/src/boot/tokens.boot +++ b/src/boot/tokens.boot @@ -274,6 +274,7 @@ for i in [ _ ["list", "LIST"] , _ ["lowerCase?", "LOWER-CASE-P"], _ ["makeSymbol", "INTERN"] , _ + ["maxIndex", "MAXINDEX"] , _ ["mkpf", "MKPF"] , _ ["nconc", "NCONC"] , _ ["newString", "MAKE-STRING"], _ diff --git a/src/interp/as.boot b/src/interp/as.boot index d2f3eb55..5c15147c 100644 --- a/src/interp/as.boot +++ b/src/interp/as.boot @@ -319,7 +319,7 @@ asyExtractDescription str == trimComments str == str = nil or str = '"" => '"" - m := MAXINDEX str + m := maxIndex str str := subString(str,0,m) trimString str @@ -702,7 +702,7 @@ asyAbbreviation(id,n) == chk(id,main) where --> n = number of arguments a := createAbbreviation id => a name := PNAME id -- #name < 8 => makeSymbol UPCASE name - parts := asySplit(name,MAXINDEX name) + parts := asySplit(name,maxIndex name) newname := strconc/[asyShorten x for x in parts] #newname < 8 => makeSymbol newname tryname := subString(name,0,7) diff --git a/src/interp/ax.boot b/src/interp/ax.boot index 6f3fe6bd..4b38a678 100644 --- a/src/interp/ax.boot +++ b/src/interp/ax.boot @@ -332,12 +332,12 @@ getDefaultingOps catname == $infovec: local := getInfovec name opTable := $infovec.1 $opList:local := nil - for i in 0..MAXINDEX opTable repeat + for i in 0..maxIndex opTable repeat op := opTable.i i := i + 1 startIndex := opTable.i stopIndex := - i + 1 > MAXINDEX opTable => MAXINDEX getCodeVector() + i + 1 > maxIndex opTable => maxIndex getCodeVector() opTable.(i + 2) curIndex := startIndex while curIndex < stopIndex repeat diff --git a/src/interp/bc-util.boot b/src/interp/bc-util.boot index 6c2531dc..6061e577 100644 --- a/src/interp/bc-util.boot +++ b/src/interp/bc-util.boot @@ -93,7 +93,7 @@ bcOptional s == bcvspace() == bcHt '"\vspace{1}\newline " -bcString2WordList s == fn(s,0,MAXINDEX s) where +bcString2WordList s == fn(s,0,maxIndex s) where fn(s,i,n) == i > n => nil k := or/[j for j in i..n | s.j ~= char '_ ] diff --git a/src/interp/br-con.boot b/src/interp/br-con.boot index 3ad5882b..c0cea190 100644 --- a/src/interp/br-con.boot +++ b/src/interp/br-con.boot @@ -393,7 +393,7 @@ dbSearchOrder(conform,domname,$domain) == --domain = nil or set to live domain catpredvec := first u catinfo := second u catvec := third u - catforms := [[pakform,:pred] for i in 0..MAXINDEX catvec | test ] where + catforms := [[pakform,:pred] for i in 0..maxIndex catvec | test ] where test() == pred := simpCatPredicate p:=SUBLISLIS(rest conform,$FormalMapVariableList,kTestPred catpredvec.i) @@ -1309,12 +1309,12 @@ PUT('Enumeration, 'documentation, substitute(MESSAGE, 'MESSAGE, '( mkConArgSublis args == [[arg,:makeSymbol digits2Names PNAME arg] for arg in args - | (s := PNAME arg) and "or"/[digit? s.i for i in 0..MAXINDEX s]] + | (s := PNAME arg) and "or"/[digit? s.i for i in 0..maxIndex s]] digits2Names s == --This is necessary since arguments of conforms CANNOT have digits in TechExplorer str := '"" - for i in 0..MAXINDEX s repeat + for i in 0..maxIndex s repeat c := s.i segment := n := digit? c => diff --git a/src/interp/br-data.boot b/src/interp/br-data.boot index 7484ff44..9a6d4445 100644 --- a/src/interp/br-data.boot +++ b/src/interp/br-data.boot @@ -112,7 +112,7 @@ buildLibdbConEntry conname == and getConstructorModemapFromDB conname is [[.,t,:.],:.] and t is ['CATEGORY,'package,:.] then kind := 'package $kind := - pname.(MAXINDEX pname) = char '_& => 'x + pname.(maxIndex pname) = char '_& => 'x DOWNCASE PNAME(kind).0 argl := rest $conform conComments := @@ -187,7 +187,7 @@ buildLibOp(op,sig,pred) == buildLibdbString [header,# rest sig,$exposed?,sigpart,conform,predString,comments] libdbTrim s == - k := MAXINDEX s + k := maxIndex s k < 0 => s for i in 0..k repeat s.i = $Newline => s.i := char " " @@ -195,7 +195,7 @@ libdbTrim s == checkCommentsForBraces(kind,sop,sigpart,comments) == count := 0 - for i in 0..MAXINDEX comments repeat + for i in 0..maxIndex comments repeat c := comments.i c = char '_{ => count := count + 1 c = char '_} => @@ -265,7 +265,7 @@ dbReadComments(n) == k := dbTickIndex(line,1,1) line := subString(line,k + 1) while not EOFP instream and (x := READLINE instream) and - (k := MAXINDEX x) and (j := dbTickIndex(x,1,1)) and (j < k) and + (k := maxIndex x) and (j := dbTickIndex(x,1,1)) and (j < k) and x.(j := j + 1) = char '_- and x.(j := j + 1) = char '_- repeat xtralines := [subString(x,j + 1),:xtralines] SHUT instream @@ -313,7 +313,7 @@ dbSplit(line,n,k) == dbSpreadComments(line,n) == line = '"" => nil k := charPosition(char '_-,line,n + 2) - k >= MAXINDEX line => [subString(line,n)] + k >= maxIndex line => [subString(line,n)] line.(k + 1) ~= char '_- => u := dbSpreadComments(line,k) [strconc(subString(line,n,k - n),first u),:rest u] @@ -380,7 +380,7 @@ spreadGlossText(line) == --where XXX is the file position of key1 --this is because grepping will only pick up the first 512 characters line = '"" => nil - MAXINDEX line > 500 => [subString(line,0,500),:spreadGlossText(subString(line,500))] + maxIndex line > 500 => [subString(line,0,500),:spreadGlossText(subString(line,500))] [line] getGlossLines instream == @@ -399,12 +399,12 @@ getGlossLines instream == #line = 0 => 'skip n := charPosition($tick,line,0) last := IFCAR text - n > MAXINDEX line => --this line is continuation of previous line; concat it + n > maxIndex line => --this line is continuation of previous line; concat it fill := #last = 0 => lastLineHadTick => '"" '"\blankline " - #last > 0 and last.(MAXINDEX last) ~= $charBlank => $charBlank + #last > 0 and last.(maxIndex last) ~= $charBlank => $charBlank '"" lastLineHadTick := false text := [strconc(last,fill,line),:rest text] @@ -433,7 +433,7 @@ mkUsersHashTable() == --called by buildDatabase (database.boot) $usersTb getDefaultPackageClients con == --called by mkUsersHashTable - catname := makeSymbol subString(s := PNAME con,0,MAXINDEX s) + catname := makeSymbol subString(s := PNAME con,0,maxIndex s) for [catAncestor,:.] in childrenOf([catname]) repeat pakname := makeSymbol strconc(PNAME catAncestor,'"&") if getCDTEntry(pakname,true) then acc := [pakname,:acc] @@ -472,7 +472,7 @@ getImports conname == --called by mkUsersHashTable infovec := dbInfovec conname or return nil template := infovec.0 u := [doImport(i,template) - for i in 5..(MAXINDEX template) | test] where + for i in 5..(maxIndex template) | test] where test() == template.i is [op,:.] and IDENTP op and not (op in '(Mapping Union Record Enumeration CONS QUOTE local)) doImport(x,template) == diff --git a/src/interp/br-op1.boot b/src/interp/br-op1.boot index 6d3cf5b2..36098e3d 100644 --- a/src/interp/br-op1.boot +++ b/src/interp/br-op1.boot @@ -566,7 +566,7 @@ dbShowKind conform == conname := first conform kind := getConstructorKindFromDB conname kind = "domain" => - (s := PNAME conname).(MAXINDEX s) = '_& => '"default package" + (s := PNAME conname).(maxIndex s) = '_& => '"default package" '"domain" PNAME kind @@ -846,7 +846,7 @@ dbExpandOpAlistIfNecessary(htPage,opAlist,which,needOrigins?,condition?) == packageSymbol := false domform := htpProperty(htPage,'domname) or htpProperty(htPage,'conform) if isDefaultPackageName opOf domform then - catname := intern subString(s := PNAME opOf domform,0,MAXINDEX s) + catname := intern subString(s := PNAME opOf domform,0,maxIndex s) packageSymbol := second domform domform := [catname,:rest rest domform] --skip first argument ($) docTable:= dbDocTable domform diff --git a/src/interp/br-op2.boot b/src/interp/br-op2.boot index 22ced871..47f0ab3f 100644 --- a/src/interp/br-op2.boot +++ b/src/interp/br-op2.boot @@ -310,7 +310,7 @@ whoUses(opSigList,conform) == template := $infovec . 0 found := false opacc := nil - for i in 7..MAXINDEX template repeat + for i in 7..maxIndex template repeat item := template . i item isnt [n,:op] or not MEMQ(op,opList) => 'skip index := n diff --git a/src/interp/br-saturn.boot b/src/interp/br-saturn.boot index 72babbea..5080d6e4 100644 --- a/src/interp/br-saturn.boot +++ b/src/interp/br-saturn.boot @@ -241,7 +241,7 @@ writeSaturnLines lines == writeSaturn(line) == k := 0 - n := MAXINDEX line + n := maxIndex line while --advance k if true k > n => false line.k ~= char '_\ => true @@ -345,7 +345,7 @@ writeSaturnTable line == open := charPosition(char "{",line,0) close:= charPosition(char "}",line,0) open < close => - close := findBalancingBrace(line,open + 1,MAXINDEX line,0) or error '"no balancing brace" + close := findBalancingBrace(line,open + 1,maxIndex line,0) or error '"no balancing brace" writeSaturnPrint subString(line,0,close + 1) writeSaturnTable subString(line,close + 1) $marg := $marg - 3 @@ -454,7 +454,7 @@ saturnTranText x == error nil isMenuItemStyle? s == - 15 = ('"\menuitemstyle{" < s) => subString(s,15,(MAXINDEX s) - 15) + 15 = ('"\menuitemstyle{" < s) => subString(s,15,(maxIndex s) - 15) nil getCallBack callTail == diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot index 35a803d6..7529f96e 100644 --- a/src/interp/br-search.boot +++ b/src/interp/br-search.boot @@ -60,7 +60,7 @@ grepConstruct1(s,key) == --returns the name of file (WITHOUT .text.$SPADNUM on the end) $key : local := key if key = 'k and --convert 'k to 'y if name contains an "&" - or/[s . i = char '_& for i in 0..MAXINDEX s] then key := 'y + or/[s . i = char '_& for i in 0..maxIndex s] then key := 'y filter := pmTransFilter STRINGIMAGE s --parses and-or-not form filter is ['error,:.] => filter --exit on parser error pattern := mkGrepPattern(filter,key) --create string to pass to "grep" @@ -91,7 +91,7 @@ grepForAbbrev(s,key) == s := STRINGIMAGE s someLowerCaseChar := false someUpperCaseChar := false - for i in 0..MAXINDEX s repeat + for i in 0..maxIndex s repeat c := s . i lowerCase? c => return (someLowerCaseChar := true) upperCase? c => someUpperCaseChar := true @@ -139,11 +139,11 @@ grepf(pattern,s,not?) == --s=sourceFile or list of strings pmTransFilter s == --result is either a string or (op ..) where op= and,or,not and arg are results if $browseMixedCase = true then s := DOWNCASE s - or/[isFilterDelimiter? s.i or s.i = $charUnderscore for i in 0..MAXINDEX s] + or/[isFilterDelimiter? s.i or s.i = $charUnderscore for i in 0..maxIndex s] => (parse := pmParseFromString s) and checkPmParse parse or ['error,'"Illegal search string",'"\vspace{3}\center{{\em Your search string} ",escapeSpecialChars s,'" {\em has incorrect syntax}}"] or/[s . i = char '_* and s.(i + 1) = char '_* - and (i=0 or s . (i - 1) ~= char $charUnderscore) for i in 0..(MAXINDEX s - 1)] + and (i=0 or s . (i - 1) ~= char $charUnderscore) for i in 0..(maxIndex s - 1)] => ['error,'"Illegal search string",'"\vspace{3}\center{Consecutive {\em *}'s are not allowed in search patterns}"] s @@ -199,8 +199,8 @@ pmPreparse s == hn fn(s,0,#s) where--stupid insertion of chars to get correct pa strconc(subString(s,i,n - i + 1),$charUnderscore,gn(s,n + 1,j)) subString(s,i,j - i + 1) -firstNonDelim(s,n) == or/[k for k in n..MAXINDEX s | not isFilterDelimiter? s.k] -firstDelim(s,n) == or/[k for k in n..MAXINDEX s | isFilterDelimiter? s.k] +firstNonDelim(s,n) == or/[k for k in n..maxIndex s | not isFilterDelimiter? s.k] +firstDelim(s,n) == or/[k for k in n..maxIndex s | isFilterDelimiter? s.k] isFilterDelimiter? c == MEMQ(c,$pmFilterDelimiters) @@ -260,7 +260,7 @@ mkGrepPattern1(x,:options) == --called by mkGrepPattern (and grepConstructName?) g s == --remove "*"s around pattern for text match not ('w in $options) => s if s.0 = char '_* then s := subString(s,1) - if s.(k := MAXINDEX s) = char '_* then s := subString(s,0,k) + if s.(k := maxIndex s) = char '_* then s := subString(s,0,k) s h(sl,res) == --helper for wild cards sl is [s,:r] => h(r,[$wild1,s,:res]) @@ -270,12 +270,12 @@ mkGrepPattern1(x,:options) == --called by mkGrepPattern (and grepConstructName?) else if res is [.,p,:r] and p = $wild1 then res := r strconc/nreverse res remUnderscores s == - (k := charPosition(char $charUnderscore,s,0)) < MAXINDEX s => + (k := charPosition(char $charUnderscore,s,0)) < maxIndex s => strconc(subString(s,0,k),'"[",s.(k + 1),'"]", remUnderscores(subString(s,k + 2))) s split(s,char) == - max := MAXINDEX s + 1 + max := maxIndex s + 1 f := -1 [subString(s,i,f-i) while ((i := f + 1) <= max) and (f := charPosition(char,s,i))] @@ -571,7 +571,7 @@ docSearch1(filter,doc) == removeSurroundingStars filter == key := STRINGIMAGE filter if key.0 = char '_* then key := subString(key,1) - if key.(max := MAXINDEX key) = char '_* then key := subString(key,0,max) + if key.(max := maxIndex key) = char '_* then key := subString(key,0,max) key showNamedDoc([kind,:lines],index) == @@ -581,7 +581,7 @@ sayDocMessage message == htSay('"{\em ") if message is [leftEnd,left,middle,right,rightEnd] then htSay(leftEnd,left,'"}") - if left ~= '"" and left.(MAXINDEX left) = $blank then htBlank() + if left ~= '"" and left.(maxIndex left) = $blank then htBlank() htSay middle if right ~= '"" and right.0 = $blank then htBlank() htSay('"{\em ",right,rightEnd) @@ -602,7 +602,7 @@ stripOffSegments(s,n) == replaceTicksBySpaces s == n := -1 - max := MAXINDEX s + max := maxIndex s while (n := charPosition(char '_`,s,n + 1)) <= max repeat s.n := char " " s @@ -699,7 +699,7 @@ dbString2Words l == $dbDelimiters := [char " " , char "(", char ")"] dbWordFrom(l,i) == - idxmax := MAXINDEX l + idxmax := maxIndex l while idxmax >= i and l.i = char " " repeat i := i + 1 if idxmax >= i and member(l.i, $dbDelimiters) then return [l.i, i + 1] k := or/[j for j in i..idxmax | not member(l.j, $dbDelimiters)] or return nil @@ -880,7 +880,7 @@ mkDetailedGrepPattern(kind,name,nargs,argOrSig) == main where b = '"[^`]*" or b = char '_. => a strconc(a,$tick,b) simp a == - m := MAXINDEX a + m := maxIndex a m > 6 and a.(m-5) = char '_[ and a.(m-4) = char "^" and a.(m-3) = $tick and a.(m-2) = char '_] and a.(m-1) = char '_* and a.m = $tick @@ -889,7 +889,7 @@ mkDetailedGrepPattern(kind,name,nargs,argOrSig) == main where replaceGrepStar s == s = "" => s - final := MAXINDEX s + final := maxIndex s i := charPosition(char '_*,s,0) i > final => s strconc(subString(s,0,i),'"[^`]*",replaceGrepStar subString(s,i + 1)) @@ -900,7 +900,7 @@ standardizeSignature(s) == underscoreDollars s.(k - 1) = char '_) => strconc('"(",s) strconc('"(",subString(s,0,k),'")",subString(s,k)) -underscoreDollars(s) == fn(s,0,MAXINDEX s) where +underscoreDollars(s) == fn(s,0,maxIndex s) where fn(s,i,n) == i > n => '"" (m := charPosition(char '_$,s,i)) > n => subString(s,i) diff --git a/src/interp/br-util.boot b/src/interp/br-util.boot index 5ad260ae..5c8a5a15 100644 --- a/src/interp/br-util.boot +++ b/src/interp/br-util.boot @@ -536,7 +536,7 @@ isLoaded? conform == property(getConstructorAbbreviationFromDB opOf conform,'LOADED) string2Integer s == - and/[digit? (s.i) for i in 0..MAXINDEX s] => readInteger s + and/[digit? (s.i) for i in 0..maxIndex s] => readInteger s nil dbGetInputString htPage == diff --git a/src/interp/c-doc.boot b/src/interp/c-doc.boot index 2e57a549..6588afb1 100644 --- a/src/interp/c-doc.boot +++ b/src/interp/c-doc.boot @@ -256,7 +256,7 @@ transDoc(conname,doclist) == checkExtractItemList l == --items are separated by commas or end of line acc := nil --l is list of remaining lines while l repeat --stop when you get to a line with a colon - m := MAXINDEX first l + m := maxIndex first l k := charPosition(char '_:,first l,0) k <= m => return nil acc := [first l,:acc] @@ -620,7 +620,7 @@ checkIndentedLines(u, margin) == newString2Words l == not string? l => [l] - m := MAXINDEX l + m := maxIndex l m = -1 => NIL i := 0 [w while newWordFrom(l,i,m) is [w,i]] @@ -640,7 +640,7 @@ newWordFrom(l,i,m) == [buf,i] checkAddPeriod s == --No, just leave blank at the end (rdj: 10/18/91) - m := MAXINDEX s + m := maxIndex s lastChar := s . m lastChar = char "!" or lastChar = char '_? or lastChar = char '_. => s lastChar = char '_, or lastChar = char '_; => @@ -650,7 +650,7 @@ checkAddPeriod s == --No, just leave blank at the end (rdj: 10/18/91) checkGetArgs u == NOT string? u => nil - m := MAXINDEX u + m := maxIndex u k := firstNonBlankPosition(u) k > 0 => checkGetArgs subString(u,k) stringPrefix?('"\spad{",u) => @@ -676,7 +676,7 @@ checkGetMargin lines == firstNonBlankPosition(x,:options) == start := IFCAR options or 0 k := -1 - for i in start..MAXINDEX x repeat + for i in start..maxIndex x repeat if x.i ~= $charBlank then return (k := i) k @@ -687,7 +687,7 @@ checkAddIndented(x,margin) == strconc('"\indented{",STRINGIMAGE(k-margin),'"}{",checkAddSpaceSegments(subString(x,k),0),'"}") checkAddSpaceSegments(u,k) == - m := MAXINDEX u + m := maxIndex u i := charPosition($charBlank,u,k) m < i => u j := i @@ -714,7 +714,7 @@ checkTrim($x,lines) == main where trim(s) == k := wherePP(s) return subString(s,k + 2) - m := MAXINDEX s + m := maxIndex s n := k + 2 for j in (k + 2)..m while s.j = $charBlank repeat (n := n + 1) subString(s,n) @@ -818,7 +818,7 @@ checkDecorate u == not spadflag and (CHARP x and alphabetic? x and not MEMQ(x,$charExclusions) or member(x,$argl)) => [$charRbrace,x,$charLbrace,'"\spad",:acc] - not spadflag and string? x and ((x.0 ~= $charBack and digit?(x.(MAXINDEX x))) or x in '("true" "false")) => + not spadflag and string? x and ((x.0 ~= $charBack and digit?(x.(maxIndex x))) or x in '("true" "false")) => [$charRbrace,x,$charLbrace,'"\spad",:acc] --wrap x1, alpha3, etc xcount := (string? x => # x; 0) xcount = 3 and x.1 = char 't and x.2 = char 'h => @@ -834,7 +834,7 @@ checkDecorate u == nreverse acc hasNoVowels x == - max := MAXINDEX x + max := maxIndex x x.max = char 'y => false and/[not isVowel(x.i) for i in 0..max] @@ -848,7 +848,7 @@ checkAddBackSlashes s == MEMQ(s,$charEscapeList) => strconc($charBack,c) s k := 0 - m := MAXINDEX s + m := maxIndex s insertIndex := nil while k <= m repeat do @@ -902,7 +902,7 @@ checkIeEg u == checkIeEgfun x == CHARP x => nil x is '"" => nil - m := MAXINDEX x + m := maxIndex x for k in 0..(m - 3) repeat x.(k + 1) = $charPeriod and x.(k + 3) = $charPeriod and (x.k = char 'i and x.(k + 2) = char 'e and (key := '"that is") @@ -934,7 +934,7 @@ checkSplitBrace x == #x = 1 => [x.0] (u := checkSplitBackslash x) and rest u => "append"/[checkSplitBrace y for y in u] - m := MAXINDEX x + m := maxIndex x (u := checkSplitOn x) and rest u => "append"/[checkSplitBrace y for y in u] (u := checkSplitPunctuation x) @@ -943,7 +943,7 @@ checkSplitBrace x == checkSplitBackslash x == not string? x => [x] - m := MAXINDEX x + m := maxIndex x (k := charPosition($charBack,x,0)) < m => m = 1 or alphabetic?(x . (k + 1)) => --starts with a backslash so.. (k := charPosition($charBack,x,1)) < m => --..see if there is another @@ -959,7 +959,7 @@ checkSplitBackslash x == checkSplitPunctuation x == not string? x => [x] - m := MAXINDEX x + m := maxIndex x m < 1 => [x] lastchar := x.m lastchar = $charPeriod and x.(m - 1) = $charPeriod => @@ -986,7 +986,7 @@ checkSplitPunctuation x == checkSplitOn(x) == not string? x => [x] l := $charSplitList - m := MAXINDEX x + m := maxIndex x while l repeat char := first l do @@ -998,7 +998,7 @@ checkSplitOn(x) == null l => [x] k = -1 => [char] k = 0 => [char,subString(x,1)] - k = MAXINDEX x => [subString(x,0,k),char] + k = maxIndex x => [subString(x,0,k),char] [subString(x,0,k),char,:checkSplitOn subString(x,k + 1)] @@ -1111,7 +1111,7 @@ checkLookForRightBrace(u) == --return line beginning with right brace checkInteger s == CHARP s => false s = '"" => false - and/[digit? s.i for i in 0..MAXINDEX s] + and/[digit? s.i for i in 0..maxIndex s] checkTransformFirsts(opname,u,margin) == --case 1: \spad{... @@ -1125,7 +1125,7 @@ checkTransformFirsts(opname,u,margin) == margin > 0 => s := leftTrim u strconc(fillerSpaces margin,checkTransformFirsts(opname,s,0)) - m := MAXINDEX u + m := maxIndex u m < 2 => u u.0 = $charBack => u alphabetic? u.0 => @@ -1153,7 +1153,7 @@ checkTransformFirsts(opname,u,margin) == #(p := symbolName infixOp) = 1 and (open := p.0) and (close := LASSOC(open,$checkPrenAlist)) => --have an open bracket l := getMatchingRightPren(u,k + 1,open,close) - if l > MAXINDEX u then l := k - 1 + if l > maxIndex u then l := k - 1 strconc('"\spad{",subString(u,0,l + 1),'"}",subString(u,l + 1)) strconc('"\spad{",subString(u,0,k),'"}",subString(u,k)) l := checkSkipBlanks(u,k,m) or return u @@ -1183,7 +1183,7 @@ checkTransformFirsts(opname,u,margin) == getMatchingRightPren(u,j,open,close) == count := 0 - m := MAXINDEX u + m := maxIndex u for i in j..m repeat c := u . i do @@ -1309,7 +1309,7 @@ checkDecorateForHt u == -- not spadflag and string? x and (member(x,$argl) or #x = 1 -- and alphabetic? x.0) and not (x in '("a" "A")) => -- checkDocError1 ['"Naked ",x] --- not spadflag and string? x and (not x.0 = $charBack and not digit?(x.0) and digit?(x.(MAXINDEX x))or x in '("true" "false")) +-- not spadflag and string? x and (not x.0 = $charBack and not digit?(x.0) and digit?(x.(maxIndex x))or x in '("true" "false")) -- => checkDocError1 ["Naked ",x] u := rest u u diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 08e48948..7cdab710 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -949,7 +949,7 @@ sublisV(p,e) == suba(p,e) == string? e => e -- no need to descend vectors unless they are categories - categoryObject? e => LIST2VEC [suba(p,e.i) for i in 0..MAXINDEX e] + categoryObject? e => LIST2VEC [suba(p,e.i) for i in 0..maxIndex e] atom e => (y:= ASSQ(e,p) => rest y; e) u:= suba(p,first e) v:= suba(p,rest e) diff --git a/src/interp/category.boot b/src/interp/category.boot index 26a55326..46f0b7ea 100644 --- a/src/interp/category.boot +++ b/src/interp/category.boot @@ -76,7 +76,7 @@ CategoryPrint(D,$e) == SAY("This has an alternate view: slot ",rest u," corresponds to ",first u) for u in third D.4 repeat SAY("This has a local domain: slot ",rest u," corresponds to ",first u) - for j in 6..MAXINDEX D repeat + for j in 6..maxIndex D repeat u:= D.j null u => SAY "another domain" atom first u => SAY("Alternate View corresponding to: ",u) diff --git a/src/interp/define.boot b/src/interp/define.boot index 6875e76e..47c9f581 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -134,7 +134,7 @@ makeDomainTemplate vec == --NOTES: This function is called at compile time to create the template -- (slot 0 of the infovec); called by getInfovecCode from compDefineFunctor1 newVec := newShell # vec - for index in 0..MAXINDEX vec repeat + for index in 0..maxIndex vec repeat item := vec.index null item => nil newVec.index := @@ -333,7 +333,7 @@ extendsCategoryBasic(dom,u,v) == uVec := (compMakeCategoryObject(u,$EmptyEnvironment)).expr isCategoryForm(v,nil) => catExtendsCat?(u,v,uVec) v is ['SIGNATURE,op,sig] => - or/[uVec.i is [[=op,=sig],:.] for i in 6..MAXINDEX uVec] + or/[uVec.i is [[=op,=sig],:.] for i in 6..maxIndex uVec] u is ['CATEGORY,.,:l] => v is ['IF,:.] => member(v,l) nil diff --git a/src/interp/format.boot b/src/interp/format.boot index e1caca8a..ff7a9781 100644 --- a/src/interp/format.boot +++ b/src/interp/format.boot @@ -587,7 +587,7 @@ linearFormatForm(op,argl) == s:= PNAME op indexList:= [readInteger PNAME d for i in 1.. while (digit? (d:= s.(idxmax:= i)))] - cleanOp:= makeSymbol (strconc/[PNAME s.i for i in idxmax..MAXINDEX s]) + cleanOp:= makeSymbol (strconc/[PNAME s.i for i in idxmax..maxIndex s]) fnArgs:= indexList.0 > 0 => concat('"(",formatArgList take(-indexList.0,argl),'")") diff --git a/src/interp/functor.boot b/src/interp/functor.boot index 91db6581..a8311049 100644 --- a/src/interp/functor.boot +++ b/src/interp/functor.boot @@ -86,7 +86,7 @@ DomainPrint1(D,brief,$e) == if i=1 and vector? uu.5 then vv:= COPY_-SEQ uu.5 uu.5:= vv - for j in 0..MAXINDEX vv repeat + for j in 0..maxIndex vv repeat if vector? vv.j then l:= ASSQ(keyItem vv.j,Sublis) if l @@ -99,7 +99,7 @@ DomainPrint1(D,brief,$e) == vv.j:= name if i>1 then uu.1:= uu.2:= uu.5:= '"As in first view" - for i in 6..MAXINDEX uu repeat + for i in 6..maxIndex uu repeat uu.i:= DomainPrintSubst(uu.i,Sublis) if vector? uu.i then name:=DPname() @@ -122,7 +122,7 @@ DPname() == PacPrint v == vv:= COPY_-SEQ v - for j in 0..MAXINDEX vv repeat + for j in 0..maxIndex vv repeat if vector? vv.j then l:= ASSQ(keyItem vv.j,Sublis) if l @@ -231,7 +231,7 @@ compCategories1(u,v) == NewbFVectorCopy(u,domName) == v:= newShell # u for i in 0..5 repeat v.i:= u.i - for i in 6..MAXINDEX v | cons? u.i repeat + for i in 6..maxIndex v | cons? u.i repeat v.i:= [function Undef,[domName,i],:first u.i] v @@ -442,7 +442,7 @@ DescendCodeAdd1(base,flag,target,formalArgs,formalArgModes) == --we match signatures cat:= (compMakeCategoryObject(target,e)).expr instantiatedBase:= genvar() - n:=MAXINDEX cat + n:=maxIndex cat code:= [u for i in 6..n | cons? cat.i and cons? (sig:= first cat.i) @@ -822,7 +822,7 @@ getViewsConditions u == DescendCodeVarAdd(base,flag) == princview := first $catvecList [SetFunctionSlots(sig,substitute('ELT,'CONST,implem),flag,'adding) repeat - for i in 6..MAXINDEX princview | + for i in 6..maxIndex princview | princview.i is [sig:=[op,types],:.] and LASSOC([base,:substitute(base,'$,types)],get(op,'modemap,$e)) is [[pred,implem]]] @@ -898,7 +898,7 @@ encodeItem x == getCaps x == s:= STRINGIMAGE x - clist:= [c for i in 0..MAXINDEX s | upperCase? (c:= s.i)] + clist:= [c for i in 0..maxIndex s | upperCase? (c:= s.i)] null clist => '"__" strconc/[first clist,:[L_-CASE u for u in rest clist]] @@ -929,7 +929,7 @@ alistSize c == count(CDAR x,level+1)+count(rest x,level) addSuffix(n,u) == - alphabetic?((s:= STRINGIMAGE u).(MAXINDEX s)) => + alphabetic?((s:= STRINGIMAGE u).(maxIndex s)) => makeSymbol strconc(s,STRINGIMAGE n) INTERNL strconc(s,STRINGIMAGE ";",STRINGIMAGE n) diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 6e5da354..90e10318 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -766,7 +766,7 @@ trimString s == leftTrim rightTrim s leftTrim s == - k := MAXINDEX s + k := maxIndex s k < 0 => s s.0 = $blank => for i in 0..k while s.i = $blank repeat (j := i) @@ -774,7 +774,7 @@ leftTrim s == s rightTrim s == -- assumed a non-empty string - k := MAXINDEX s + k := maxIndex s k < 0 => s s.k = $blank => for i in k..0 by -1 while s.i = $blank repeat (j := i) @@ -873,7 +873,7 @@ $beginEndList := '( isDefaultPackageName x == s := symbolName x - stringChar(s,MAXINDEX s) = char '_& + stringChar(s,maxIndex s) = char '_& isDefaultPackageForm? x == x is [op,:.] and IDENTP op and isDefaultPackageName op diff --git a/src/interp/guess.boot b/src/interp/guess.boot index f2b81b18..380a751d 100644 --- a/src/interp/guess.boot +++ b/src/interp/guess.boot @@ -69,13 +69,13 @@ wordsOfString(s) == [UPCASE x for x in wordsOfStringKeepCase s] wordsOfStringKeepCase s == wordsOfString1(s,0) or [COPY s] wordsOfString1(s,j) == - k := or/[i for i in j..(MAXINDEX(s)-1) | upperCase? s.i] => + k := or/[i for i in j..(maxIndex(s)-1) | upperCase? s.i] => tailWords:= upperCase? s.(k+1) => - n:= or/[i for i in (k+2)..(MAXINDEX(s)-1)|not upperCase? s.i] + n:= or/[i for i in (k+2)..(maxIndex(s)-1)|not upperCase? s.i] null n => [subString(s,k)] n > k+1 => [subString(s,k,n-k-1),:wordsOfString1(s,n-1)] - m := or/[i for i in (k+2)..(MAXINDEX(s)-1) | upperCase? s.i] => + m := or/[i for i in (k+2)..(maxIndex(s)-1) | upperCase? s.i] => [subString(s,k,m-k),:wordsOfString1(s,m)] [subString(s,k)] k > j+1 => [subString(s,j,k-j),:tailWords] @@ -83,7 +83,7 @@ wordsOfString1(s,j) == nil wordKeys s == - removeDuplicates [UPCASE s.0,:fn(s,1,-1,MAXINDEX s,nil)] where fn(s,i,lastKeyIndex,n,acc) == + removeDuplicates [UPCASE s.0,:fn(s,1,-1,maxIndex s,nil)] where fn(s,i,lastKeyIndex,n,acc) == i > n => acc upperCase? s.i => -- i = lastKeyIndex + 1 => fn(s,i + 1,i,n,[s.i,:rest acc]) @@ -283,7 +283,7 @@ deltaWordEntry(word,entry) == --+ Note these are optimized definitions below-- see commented out versions --+ to understand the algorithm canForgeWord(word,entry) == - forge(word,0,MAXINDEX word,entry,0,MAXINDEX entry,0) + forge(word,0,maxIndex word,entry,0,maxIndex entry,0) forge(word,w,W,entry,e,E,n) == w > W => @@ -314,7 +314,7 @@ forge(word,w,W,entry,e,E,n) == --+ DO NOT REMOVE DEFINITIONS BELOW which explain the algorithm --+ canForgeWord(word,entry) ==-- ---+ [d,i,s,t] := forge(word,0,MAXINDEX word,entry,0,MAXINDEX entry,0,0,0,0) +--+ [d,i,s,t] := forge(word,0,maxIndex word,entry,0,maxIndex entry,0,0,0,0) --+ --d=deletions, i=insertions, s=substitutions, t=transpositions --+ --list is formed only for tuning purposes-- remove later on --+ d + i + s + t diff --git a/src/interp/ht-root.boot b/src/interp/ht-root.boot index 8fb7e57b..5604cf01 100644 --- a/src/interp/ht-root.boot +++ b/src/interp/ht-root.boot @@ -145,7 +145,7 @@ htGlossPage(htPage,pattern,tryAgain?) == ['"Glossary items matching {\em ",pattern,'"}"] null lines => tryAgain? and #pattern > 0 => - (pattern.(k := MAXINDEX(pattern))) = char 's => + (pattern.(k := maxIndex(pattern))) = char 's => htGlossPage(htPage,subString(pattern,0,k),true) upperCase? pattern.0 => htGlossPage(htPage,DOWNCASE pattern,false) @@ -269,12 +269,12 @@ htTutorialSearch pattern == mkUnixPattern s == u := mkUpDownPattern s - starPositions := reverse [i for i in 1..(-1 + MAXINDEX u) | u.i = $wild] + starPositions := reverse [i for i in 1..(-1 + maxIndex u) | u.i = $wild] for i in starPositions repeat u := strconc(subString(u,0,i),'".*",subString(u,i + 1)) if u.0 ~= $wild then u := strconc('"[^a-zA-Z]",u) else u := subString(u,1) - if u.(k := MAXINDEX u) ~= $wild then u := strconc(u,'"[^a-zA-Z]") + if u.(k := maxIndex u) ~= $wild then u := strconc(u,'"[^a-zA-Z]") else u := subString(u,0,k) u diff --git a/src/interp/ht-util.boot b/src/interp/ht-util.boot index 61781d39..3e443a60 100644 --- a/src/interp/ht-util.boot +++ b/src/interp/ht-util.boot @@ -134,7 +134,7 @@ htpLabelFilteredInputString(htPage, label) == replacePercentByDollar props.0 nil -replacePercentByDollar s == fn(s,0,MAXINDEX s) where +replacePercentByDollar s == fn(s,0,maxIndex s) where fn(s,i,n) == i > n => '"" (m := charPosition(char "%",s,i)) > n => subString(s,i) diff --git a/src/interp/htcheck.boot b/src/interp/htcheck.boot index 088fc2b2..843ab674 100644 --- a/src/interp/htcheck.boot +++ b/src/interp/htcheck.boot @@ -107,7 +107,7 @@ getHtMacroItem line == i = m => 0 j := charPosition(char '_],line,i + 1) digitString := subString(line,i + 1,j - i - 1) - and/[digit? digitString.i for i in 0..MAXINDEX digitString] + and/[digit? digitString.i for i in 0..maxIndex digitString] => readInteger digitString return nil [command,:numOfArgs] diff --git a/src/interp/htsetvar.boot b/src/interp/htsetvar.boot index 6acb52c4..796760e5 100644 --- a/src/interp/htsetvar.boot +++ b/src/interp/htsetvar.boot @@ -271,7 +271,7 @@ htCheck(checker,value) == parseWord x == string? x => - and/[digit? x.i for i in 0..MAXINDEX x] => readInteger x + and/[digit? x.i for i in 0..maxIndex x] => readInteger x makeSymbol x x diff --git a/src/interp/i-coerfn.boot b/src/interp/i-coerfn.boot index 4ef7dc9f..cfda1e30 100644 --- a/src/interp/i-coerfn.boot +++ b/src/interp/i-coerfn.boot @@ -1651,21 +1651,21 @@ V2M(u,[.,D],[.,R]) == canCoerce(D,R) -- first see if we are coercing a vector of vectors D is ['Vector,E] and - isRectangularVector(u,MAXINDEX u,MAXINDEX u.0) => + isRectangularVector(u,maxIndex u,maxIndex u.0) => LIST2VEC [LIST2VEC [objValUnwrap(coerceInt(objNewWrap(x.j,E),R)) - for j in 0..MAXINDEX(x:=u.i)] for i in 0..MAXINDEX u] + for j in 0..maxIndex(x:=u.i)] for i in 0..maxIndex u] -- if not, try making it into a 1 by n matrix coercionFailure() --LIST2VEC [LIST2VEC [objValUnwrap(coerceInt(objNewWrap(u.i,D),R)) --- for i in 0..MAXINDEX(u)]] +-- for i in 0..maxIndex(u)]] V2Rm(u,[.,D],[.,n,m,R]) == u = '_$fromCoerceable_$ => nil D is [.,E,:.] and isRectangularVector(u,n-1,m-1) => LIST2VEC [LIST2VEC [objValUnwrap(coerceInt(objNewWrap(x.j,E),R)) - for j in 0..MAXINDEX(x:=u.i)] for i in 0..MAXINDEX u] + for j in 0..maxIndex(x:=u.i)] for i in 0..maxIndex u] coercionFailure() V2Sm(u,[.,D],[.,n,R]) == @@ -1673,12 +1673,12 @@ V2Sm(u,[.,D],[.,n,R]) == D is [.,E,:.] and isRectangularVector(u,n-1,n-1) => LIST2VEC [LIST2VEC [objValUnwrap(coerceInt(objNewWrap(x.j,E),R)) - for j in 0..MAXINDEX(x:=u.i)] for i in 0..MAXINDEX u] + for j in 0..maxIndex(x:=u.i)] for i in 0..maxIndex u] coercionFailure() isRectangularVector(x,p,q) == - MAXINDEX x = p => - and/[q=MAXINDEX x.i for i in 0..p] + maxIndex x = p => + and/[q=maxIndex x.i for i in 0..p] -- Polynomial and Expression to Univariate series types diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot index 20c46997..0d84f83d 100644 --- a/src/interp/i-output.boot +++ b/src/interp/i-output.boot @@ -447,7 +447,7 @@ atom2String x == appChar(string,x,y,d) == if CHARP string then string := PNAME string line:= LASSOC(y,d) => - if MAXINDEX string = 1 and string.0 = char "%" then + if maxIndex string = 1 and string.0 = char "%" then string.1 = char "b" => bumpDeltaIfTrue:= true string.0:= EBCDIC 29 @@ -497,7 +497,7 @@ outputTran x == strconc('"_"",x,'"_"") string? x => x vector? x => - outputTran ['BRACKET,['AGGLST,:[x.i for i in 0..MAXINDEX x]]] + outputTran ['BRACKET,['AGGLST,:[x.i for i in 0..maxIndex x]]] integer? x => MINUSP x => ["-",MINUS x] x @@ -733,12 +733,12 @@ outputTranMatrix x == ["MATRIX",:x] --keyedSystemError("S2GE0016",['"outputTranMatrix", -- '"improper internal form for matrix found in output routines"]) - ["MATRIX",nil,:[outtranRow x.i for i in 0..MAXINDEX x]] where + ["MATRIX",nil,:[outtranRow x.i for i in 0..maxIndex x]] where outtranRow x == not vector? x => keyedSystemError("S2GE0016",['"outputTranMatrix", '"improper internal form for matrix found in output routines"]) - ["ROW",:[outputTran x.i for i in 0..MAXINDEX x]] + ["ROW",:[outputTran x.i for i in 0..maxIndex x]] mkSuperSub(op,argl) == $linearFormatScripts => linearFormatForm(op,argl) @@ -748,7 +748,7 @@ mkSuperSub(op,argl) == s:= PNAME op indexList:= [readInteger PNAME d for i in 1.. while (digit? (d:= s.(idxmax:= i)))] - cleanOp:= makeSymbol (strconc/[PNAME s.i for i in idxmax..MAXINDEX s]) + cleanOp:= makeSymbol (strconc/[PNAME s.i for i in idxmax..maxIndex s]) -- if there is just a subscript use the SUB special form #indexList=2 => subPart:= ['SUB,cleanOp,:take(indexList.1,argl)] diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index 8812989c..2c540536 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -205,7 +205,7 @@ commandAmbiguityError(kind,x,u) == getSystemCommandLine() == p := STRPOS('")",$currentLine,0,NIL) line := if p then subString($currentLine,p) else $currentLine - idxmax:= MAXINDEX line + idxmax:= maxIndex line for i in 0..idxmax while stringChar(line,i) ~= char " " repeat index:= i if index=idxmax then line := '"" @@ -2039,7 +2039,7 @@ writify ob == HPUT($seen, ob, nob) HPUT($seen, nob, nob) nob - n := QVMAXINDEX ob + n := maxIndex ob nob := newVector(n+1) HPUT($seen, ob, nob) HPUT($seen, nob, nob) @@ -2182,7 +2182,7 @@ dewritify ob == nob.rest := dewritifyInner qcdr nob vector? ob => - n := QVMAXINDEX ob + n := maxIndex ob nob := newVector(n+1) HPUT($seen, ob, nob) HPUT($seen, nob, nob) @@ -2578,7 +2578,7 @@ processSynonymLine line == value := removeKeyFromLine line where removeKeyFromLine line == line := dropLeadingBlanks line - mx := MAXINDEX line + mx := maxIndex line for i in 0..mx repeat stringChar(line,i) = char " " => return (for j in (i+1)..mx repeat @@ -2769,7 +2769,7 @@ removeUndoLines u == --called by writeInputLines if s1 ~= '")redo" then m := charPosition(char '_),s1,0) code := - m < MAXINDEX s1 => s1.(m + 1) + m < maxIndex s1 => s1.(m + 1) char 'a s2 := trimString subString(s1,0,m) n := diff --git a/src/interp/i-util.boot b/src/interp/i-util.boot index 3204a731..c15dea3b 100644 --- a/src/interp/i-util.boot +++ b/src/interp/i-util.boot @@ -143,7 +143,7 @@ makeInitialModemapFrame() == COPY $InitialModemapFrame isCapitalWord x == - (y := PNAME x) and and/[upperCase? y.i for i in 0..MAXINDEX y] + (y := PNAME x) and and/[upperCase? y.i for i in 0..maxIndex y] mkPredList listOfEntries == [['%ieq,['%head,"#1"],i] for arg in listOfEntries for i in 0..] diff --git a/src/interp/int-top.boot b/src/interp/int-top.boot index e7db6a29..a4d1bf5c 100644 --- a/src/interp/int-top.boot +++ b/src/interp/int-top.boot @@ -279,7 +279,7 @@ mkLineList lines == nonBlank str == value := false - for i in 0..MAXINDEX str repeat + for i in 0..maxIndex str repeat str.i ~= char " " => value := true return value diff --git a/src/interp/interop.boot b/src/interp/interop.boot index 62cb156f..0fd5a1db 100644 --- a/src/interp/interop.boot +++ b/src/interp/interop.boot @@ -459,11 +459,11 @@ hashNewLookupInTable(op,sig,dollar,[domain,opvec],flag) == someMatch := false numvec := getDomainByteVector domain predvec := domain.3 - max := MAXINDEX opvec + max := maxIndex opvec k := getOpCode(op,opvec,max) or return flag => newLookupInAddChain(op,sig,domain,dollar) nil - idxmax := MAXINDEX numvec + idxmax := maxIndex numvec start := opvec.k finish := QSGREATERP(max,k) => opvec.(QSPLUS(k,2)) @@ -536,7 +536,7 @@ hashNewLookupInCategories(op,sig,dom,dollar) == valueList := [dom,:[dom.(5+i) for i in 1..(# rest dom.0)]] valueList := [MKQ val for val in valueList] nsig := MSUBST(dom.0,dollar.0,sig) - for i in 0..MAXINDEX packageVec | + for i in 0..maxIndex packageVec | (entry := packageVec.i) and entry ~= true repeat package := vector? entry => @@ -552,7 +552,7 @@ hashNewLookupInCategories(op,sig,dom,dollar) == --vector? infovec => ----new world true => ----new world opvec := infovec.1 - max := MAXINDEX opvec + max := maxIndex opvec code := getOpCode(op,opvec,max) null code => nil byteVector := CDDDR infovec.3 diff --git a/src/interp/match.boot b/src/interp/match.boot index e146cd74..9897ff71 100644 --- a/src/interp/match.boot +++ b/src/interp/match.boot @@ -65,7 +65,7 @@ charPosition(c,t,startpos) == k := k+1 k -rightCharPosition(c,t,startpos) == --startpos often equals MAXINDEX t (rightmost) +rightCharPosition(c,t,startpos) == --startpos often equals maxIndex t (rightmost) k := startpos for i in startpos..0 by -1 while c ~= ELT(t,i) repeat (k := k - 1) k @@ -119,7 +119,7 @@ patternCheck pattern == main where subString(s,i) pos(c,s) == i := 0 - n := MAXINDEX s + n := maxIndex s acc := nil repeat k := charPosition(c,s,i) @@ -127,12 +127,12 @@ patternCheck pattern == main where acc := [k,:acc] i := k + 1 equal(p,n,c) == - n > MAXINDEX p => false + n > maxIndex p => false p.n = c wild(p,u) == for id in u repeat c := char id - not(or/[p.i = c for i in 0..MAXINDEX(p)]) => return c + not(or/[p.i = c for i in 0..maxIndex(p)]) => return c match?(pattern,subject) == --returns index of first character that matches basicMatch?(pattern,DOWNCASE subject) diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot index 4103a927..9700f7d5 100644 --- a/src/interp/msgdb.boot +++ b/src/interp/msgdb.boot @@ -99,7 +99,7 @@ string2Words l == [w while wordFrom(l,i) is [w,i]] wordFrom(l,i) == - idxmax := MAXINDEX l + idxmax := maxIndex l k := or/[j for j in i..idxmax | stringChar(l,j) ~= char " "] or return nil buf := '"" while k < idxmax and (c := stringChar(l,k)) ~= char " " repeat @@ -644,9 +644,9 @@ brightPrint0AsTeX(x, out == $OutputStream) == blankIndicator x == if IDENTP x then x := symbolName x - not string? x or MAXINDEX x < 1 => nil + not string? x or maxIndex x < 1 => nil stringChar(x,0) = char "%" and stringChar(x,1) = char "x" => - MAXINDEX x > 1 => readInteger subString(x,2) + maxIndex x > 1 => readInteger subString(x,2) 1 nil diff --git a/src/interp/nruncomp.boot b/src/interp/nruncomp.boot index e9709f63..147f7875 100644 --- a/src/interp/nruncomp.boot +++ b/src/interp/nruncomp.boot @@ -426,7 +426,7 @@ stuffDomainSlots dollar == function lookupComplete template := infovec.0 if template.5 then stuffSlot(dollar,5,template.5) - for i in (6 + # rest domname)..MAXINDEX template | item := template.i repeat + for i in (6 + # rest domname)..maxIndex template | item := template.i repeat stuffSlot(dollar,i,item) dollar.1 := LIST(lookupFunction,dollar,infovec.1) dollar.2 := infovec.2 @@ -436,13 +436,13 @@ stuffDomainSlots dollar == bitVector := dollar.3 predvec := first proto4 packagevec := second proto4 - auxvec := LIST2VEC [fn for i in 0..MAXINDEX predvec] where fn() == + auxvec := LIST2VEC [fn for i in 0..maxIndex predvec] where fn() == not testBitVector(bitVector,predvec.i) => nil packagevec.i or true [auxvec,:CDDR proto4] getLookupFun infovec == - MAXINDEX infovec = 4 => infovec.4 + maxIndex infovec = 4 => infovec.4 'lookupIncomplete makeSpadConstant [fn,dollar,slot] == @@ -565,7 +565,7 @@ buildFunctor($definition is [name,:args],sig,code,$locals,$e) == NRTcheckVector domainShell == --RETURNS: an alist (((op,sig),:pred) ...) of missing functions alist := nil - for i in $NRTbase..MAXINDEX domainShell repeat + for i in $NRTbase..maxIndex domainShell repeat --Vector elements can be one of -- (a) T -- item was marked -- (b) NIL -- ??? diff --git a/src/interp/nrunfast.boot b/src/interp/nrunfast.boot index 5c91fc85..216521a9 100644 --- a/src/interp/nrunfast.boot +++ b/src/interp/nrunfast.boot @@ -76,7 +76,7 @@ getDomainCategoriesVector dom == getDomainCompleteCategories dom == vec := getDomainCategoriesVector dom cats := nil - for i in 0..MAXINDEX vec repeat + for i in 0..maxIndex vec repeat cats := [newExpandLocalType(vec.i,dom,dom), :cats] nreverse cats @@ -184,11 +184,11 @@ newLookupInTable(op,sig,dollar,[domain,opvec],flag) == someMatch := false numvec := getDomainByteVector domain predvec := domain.3 - max := MAXINDEX opvec + max := maxIndex opvec k := getOpCode(op,opvec,max) or return flag => newLookupInAddChain(op,sig,domain,dollar) nil - idxmax := MAXINDEX numvec + idxmax := maxIndex numvec start := opvec.k finish := QSGREATERP(max,k) => opvec.(QSPLUS(k,2)) @@ -313,7 +313,7 @@ newLookupInCategories(op,sig,dom,dollar) == valueList := [dom,:[dom.(5+i) for i in 1..(# rest dom.0)]] valueList := [MKQ val for val in valueList] nsig := MSUBST(dom.0,dollar.0,sig) - for i in 0..MAXINDEX packageVec | + for i in 0..maxIndex packageVec | (entry := packageVec.i) and entry ~= 'T repeat package := vector? entry => @@ -329,7 +329,7 @@ newLookupInCategories(op,sig,dom,dollar) == --vector? infovec => ----new world true => ----new world opvec := infovec.1 - max := MAXINDEX opvec + max := maxIndex opvec code := getOpCode(op,opvec,max) null code => nil byteVector := CDDDR infovec.3 @@ -391,7 +391,7 @@ newLookupInCategories1(op,sig,dom,dollar) == valueList := [dom,:[dom.(5+i) for i in 1..(# rest dom.0)]] valueList := [MKQ val for val in valueList] nsig := MSUBST(dom.0,dollar.0,sig) - for i in 0..MAXINDEX packageVec | (entry := packageVec.i) + for i in 0..maxIndex packageVec | (entry := packageVec.i) and (vector? entry or (predIndex := rest (node := catVec.i)) and (predIndex = 0 or testBitVector(predvec,predIndex))) repeat package := @@ -407,7 +407,7 @@ newLookupInCategories1(op,sig,dom,dollar) == success := vector? infovec => opvec := infovec.1 - max := MAXINDEX opvec + max := maxIndex opvec code := getOpCode(op,opvec,max) null code => nil byteVector := CDDR infovec.3 @@ -545,9 +545,9 @@ lookupInDomainByName(op,domain,arg) == opvec := domain . 1 . 2 numvec := getDomainByteVector domain predvec := domain.3 - max := MAXINDEX opvec + max := maxIndex opvec k := getOpCode(op,opvec,max) or return nil - idxmax := MAXINDEX numvec + idxmax := maxIndex numvec start := opvec.k finish := QSGREATERP(max,k) => opvec.(QSPLUS(k,2)) @@ -709,13 +709,13 @@ newHasTest(domform,catOrAtt) == newHasAttribute(eval mkEvalable domform,catOrAtt) lazyMatchAssocV(x,auxvec,catvec,domain) == --new style slot4 - n := MAXINDEX catvec + n := maxIndex catvec xop := first x or/[auxvec.i for i in 0..n | xop = first (lazyt := vectorRef(catvec,i)) and lazyMatch(x,lazyt,domain,domain)] lazyMatchAssocV1(x,vec,domain) == --old style slot4 - n := MAXINDEX vec + n := maxIndex vec xop := first x or/[rest vectorRef(vec,i) for i in 0..n | xop = first (lazyt := first vectorRef(vec,i)) and lazyMatch(x,lazyt,domain,domain)] diff --git a/src/interp/record.boot b/src/interp/record.boot index 625ef097..f1561208 100644 --- a/src/interp/record.boot +++ b/src/interp/record.boot @@ -237,14 +237,14 @@ htFile2InputFile(pathname,:option) == htCommandToInputLine s == fn(s,0) where fn(s,init) == --similar to htTrimAtBackSlash except removes all \ - k := or/[i for i in init..MAXINDEX s | s.i = char '_\] => + k := or/[i for i in init..maxIndex s | s.i = char '_\] => member(s.(k + 1),[char 'f,char 'b]) => subString(s,init,k - init) strconc(subString(s,init,k - init),fn(s,k + 1)) subString(s,init) htTrimAtBackSlash s == backslash := char '_\ - k := or/[i for i in 0..MAXINDEX s | s.i = backslash + k := or/[i for i in 0..maxIndex s | s.i = backslash and member(s.(i + 1),[char 'f,char 'b])] => subString(s,0,k - 1) s @@ -267,7 +267,7 @@ recordAndPrintTest md == --called by recordAndPrint string? $currentLine => [$currentLine] fn $currentLine where fn x == x is [y,:r] => - y.(k := MAXINDEX y) = char '__ => + y.(k := maxIndex y) = char '__ => u := fn r [strconc(subString(y,0,k),'" ",first u),:rest u] [y,:fn r] diff --git a/src/interp/showimp.boot b/src/interp/showimp.boot index 47260bb3..dca66b20 100644 --- a/src/interp/showimp.boot +++ b/src/interp/showimp.boot @@ -81,7 +81,7 @@ showImp(dom,:options) == u := SORTBY('CDDR,defexports) while u repeat [.,.,:key] := first u - defop := makeSymbol(subString((s := PNAME first key),0,MAXINDEX s)) + defop := makeSymbol(subString((s := PNAME first key),0,maxIndex s)) domainForm := [defop,:CDDR key] sayBrightly ["Default functions from",:bright form2String domainForm,'":"] u := showDomainsOp1(u,key) @@ -164,7 +164,7 @@ devaluateSlotDomain(u,dollar) == getCategoriesOfDomain domain == predkeyVec := domain.4.0 catforms := second domain.4 - [fn for i in 0..MAXINDEX predkeyVec | test] where + [fn for i in 0..maxIndex predkeyVec | test] where test() == predkeyVec.i and (x := catforms . i) isnt ['DomainSubstitutionMacro,:.] fn() == @@ -230,7 +230,7 @@ showAttributes dom == showGoGet dom == numvec := CDDR dom.4 - for i in 6..MAXINDEX dom | (slot := dom.i) is ['newGoGet,dol,index,:op] repeat + for i in 6..maxIndex dom | (slot := dom.i) is ['newGoGet,dol,index,:op] repeat numOfArgs := numvec.index whereNumber := numvec.(index := index + 1) signumList := @@ -279,7 +279,7 @@ dcSlots con == name := abbreviation? con or con $infovec: local := getInfovec name template := $infovec.0 - for i in 5..MAXINDEX template repeat + for i in 5..maxIndex template repeat sayBrightlyNT bright i item := template.i item is [n,:op] and integer? n => dcOpLatchPrint(op,n) @@ -336,12 +336,12 @@ dcOpTable con == template := $infovec.0 $predvec: local := getConstructorPredicatesFromDB con opTable := $infovec.1 - for i in 0..MAXINDEX opTable repeat + for i in 0..maxIndex opTable repeat op := opTable.i i := i + 1 startIndex := opTable.i stopIndex := - i + 1 > MAXINDEX opTable => MAXINDEX getCodeVector() + i + 1 > maxIndex opTable => maxIndex getCodeVector() opTable.(i + 2) curIndex := startIndex while curIndex < stopIndex repeat @@ -378,7 +378,7 @@ dcPreds con == name := abbreviation? con or con $infovec: local := getInfovec name $predvec:= getConstructorPredicatesFromDB con - for i in 0..MAXINDEX $predvec repeat + for i in 0..maxIndex $predvec repeat sayBrightlyNT bright (i + 1) sayBrightly pred2English $predvec.i @@ -403,7 +403,7 @@ dcCats con == catpredvec := first u catinfo := second u catvec := third u - for i in 0..MAXINDEX catvec repeat + for i in 0..maxIndex catvec repeat sayBrightlyNT bright i form := catvec.i predNumber := catpredvec.i @@ -421,7 +421,7 @@ dcCats1 con == u := $infovec.3 catvec := second u catinfo := first u - for i in 0..MAXINDEX catvec repeat + for i in 0..maxIndex catvec repeat sayBrightlyNT bright i [form,:predNumber] := catvec.i suffix := @@ -444,7 +444,7 @@ dcData con == dcData1 vec dcData1 vec == - n := MAXINDEX vec + n := maxIndex vec tens := n quo 10 for i in 0..tens repeat start := 10*i @@ -464,7 +464,7 @@ dcSize(:options) == name := abbreviation? con or con infovec := getInfovec name template := infovec.0 - maxindex := MAXINDEX template + maxindex := maxIndex template latch := 0 --# of go get slots lazy := 0 --# of lazy domain slots fun := 0 --# of function slots @@ -483,7 +483,7 @@ dcSize(:options) == catvec := vector? CDDR slot4 => second slot4 third slot4 - n := MAXINDEX catvec + n := maxIndex catvec cSize := sum(nodeSize(2),vectorSize(# first slot4),vectorSize(n + 1), nodeSize(+/[numberOfNodes catvec.i for i in 0..n])) codeVector := @@ -544,7 +544,7 @@ template con == ppTemplate getInfovec(con).0 ppTemplate vec == - for i in 0..MAXINDEX vec repeat + for i in 0..maxIndex vec repeat sayBrightlyNT bright i pp vec.i diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot index 9bff9b41..f5e1e7aa 100644 --- a/src/interp/sys-utility.boot +++ b/src/interp/sys-utility.boot @@ -294,7 +294,7 @@ minimalise x == if not sameObject?(z,rest x) then x.rest := z hashCheck(x,ht) vector? x => - for i in 0..MAXINDEX x repeat + for i in 0..maxIndex x repeat x.i := min(x.i,ht) hashCheck(x,ht) string? x => hashCheck(x,ht) diff --git a/src/interp/topics.boot b/src/interp/topics.boot index 0f2091f0..40aa687c 100644 --- a/src/interp/topics.boot +++ b/src/interp/topics.boot @@ -94,11 +94,11 @@ mkTopicHashTable() == --given $groupAssoc = ((extended . while not EOFP instream repeat line := READLINE instream while blankLine? line repeat line := READLINE instream - m := MAXINDEX line --file "topics.data" has form: + m := maxIndex line --file "topics.data" has form: m = -1 => 'skip --1 ConstructorName: line.0 = char '_- => 'skip --2 constructorName or operation name line := trimString line --3-n ... - m := MAXINDEX line -- (blank line) ... + m := maxIndex line -- (blank line) ... line.m ~= (char '_:) => systemError('"wrong heading") con := makeSymbol subString(line,0,m) alist := [lst while not EOFP instream and @@ -129,7 +129,7 @@ mkTopicHashTable() == --given $groupAssoc = ((extended . $conTopicHash --keys are ops or 'constructor', values are codes blankLine? line == - MAXINDEX line = -1 or and/[line . j = (char '_ ) for j in 0..MAXINDEX line] + maxIndex line = -1 or and/[line . j = (char '_ ) for j in 0..maxIndex line] string2OpAlist s == m := #s @@ -145,7 +145,7 @@ string2OpAlist s == getDefaultProps name == u := HGET($defaultsHash,name) - if (s := PNAME name).(m := MAXINDEX s) = char '? then u := ['p,:u] + if (s := PNAME name).(m := maxIndex s) = char '? then u := ['p,:u] if s.m = char "!" then u := ['destructive,:u] u diff --git a/src/interp/word.boot b/src/interp/word.boot index b39c79c9..ab749561 100644 --- a/src/interp/word.boot +++ b/src/interp/word.boot @@ -108,13 +108,13 @@ wordsOfString(s) == [UPCASE x for x in wordsOfStringKeepCase s] wordsOfStringKeepCase s == wordsOfString1(s,0) or [COPY s] wordsOfString1(s,j) == - k := or/[i for i in j..(MAXINDEX(s)-1) | isBreakCharacter s.i] => + k := or/[i for i in j..(maxIndex(s)-1) | isBreakCharacter s.i] => tailWords:= isBreakCharacter s.(k+1) => - n:= or/[i for i in (k+2)..(MAXINDEX(s)-1)|not isBreakCharacter s.i] + n:= or/[i for i in (k+2)..(maxIndex(s)-1)|not isBreakCharacter s.i] null n => [subString(s,k)] n > k+1 => [subString(s,k,n-k-1),:wordsOfString1(s,n-1)] - m := or/[i for i in (k+2)..(MAXINDEX(s)-1) | isBreakCharacter s.i] => + m := or/[i for i in (k+2)..(maxIndex(s)-1) | isBreakCharacter s.i] => [subString(s,k,m-k),:wordsOfString1(s,m)] [subString(s,k)] k > j+1 => [subString(s,j,k-j),:tailWords] @@ -274,7 +274,7 @@ findApproximateWords(word,table) == for [x,:.] in alist repeat k := deltaWordEntry(upperWord,UPCASE COPY x) k < lastThreshold => vec.k := [x,:vec.k] - or/[vec.k for k in 0..MAXINDEX vec] + or/[vec.k for k in 0..maxIndex vec] guessFromList(key,stringList) == threshold := MAX(3,(# key)/2) @@ -282,7 +282,7 @@ guessFromList(key,stringList) == for x in stringList repeat k := deltaWordEntry(key,x) k < threshold => vec.k := [x,:vec.k] - or/[vec.k for k in 0..MAXINDEX vec] + or/[vec.k for k in 0..maxIndex vec] deltaWordEntry(word,entry) == word = entry => 0 @@ -292,7 +292,7 @@ deltaWordEntry(word,entry) == --+ Note these are optimized definitions below-- see commented out versions --+ to understand the algorithm canForgeWord(word,entry) == - forge(word,0,MAXINDEX word,entry,0,MAXINDEX entry,0) + forge(word,0,maxIndex word,entry,0,maxIndex entry,0) forge(word,w,W,entry,e,E,n) == w > W => @@ -323,7 +323,7 @@ forge(word,w,W,entry,e,E,n) == --+ DO NOT REMOVE DEFINITIONS BELOW which explain the algorithm --+ canForgeWord(word,entry) ==-- ---+ [d,i,s,t] := forge(word,0,MAXINDEX word,entry,0,MAXINDEX entry,0,0,0,0) +--+ [d,i,s,t] := forge(word,0,maxIndex word,entry,0,maxIndex entry,0,0,0,0) --+ --d=deletions, i=insertions, s=substitutions, t=transpositions --+ --list is formed only for tuning purposes-- remove later on --+ d + i + s + t @@ -368,13 +368,13 @@ patternTran pattern == maskConvert DOWNCASE pattern hasWildCard? str == - or/[str.i = '_? and (i=0 or not(str.(i-1) = '__ )) for i in 0..MAXINDEX str] + or/[str.i = '_? and (i=0 or not(str.(i-1) = '__ )) for i in 0..maxIndex str] maskConvert str == --replace all ? not preceded by an underscore by & buf:= GETSTR(#str) j:= 0 --index into res - final := MAXINDEX str + final := maxIndex str for i in 0..final repeat c := str.i if c = char "__" and i < final then @@ -397,6 +397,6 @@ suffix?(s,t) == obSearch x == vec:= OBARRAY() pattern:= PNAME x - [y for i in 0..MAXINDEX OBARRAY() | + [y for i in 0..maxIndex OBARRAY() | (IDENTP (y := vec.i) or CVEC y) and match?(pattern,COPY y)] |