diff options
author | dos-reis <gdr@axiomatics.org> | 2010-12-29 17:51:01 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-12-29 17:51:01 +0000 |
commit | 25671a46921cd1e72d296ed5cbcdc72de78f569d (patch) | |
tree | 64b93ee7e988e1faf37bf34e6322da80d14c31ff /src/interp | |
parent | d6e1db9b19a58fd6298e3d37eb6ec25f34ff191a (diff) | |
download | open-axiom-25671a46921cd1e72d296ed5cbcdc72de78f569d.tar.gz |
* interp/g-opt.boot ($VMsideEffectFreeOperators): Include %strlength.
* interp/g-util.boot: Expand it.
* algebra/string.spad.pamphlet (String): Remove use of QCSIZE.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/g-opt.boot | 1 | ||||
-rw-r--r-- | src/interp/g-util.boot | 11 | ||||
-rw-r--r-- | src/interp/i-funsel.boot | 4 | ||||
-rw-r--r-- | src/interp/msgdb.boot | 30 |
4 files changed, 24 insertions, 22 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 36f369ec..cd078397 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -451,6 +451,7 @@ $VMsideEffectFreeOperators == %nil %pair? %lconcat %llength %lfirst %lsecond %lthird %lreverse %lempty? %hash %ismall? %string? %f2s %ccst %ceq %clt %cle %cgt %cge %c2i %i2c %s2c %sname + %strlength %vref %vlength %before?) ++ List of simple VM operators diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 9737c712..3a2504cf 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -512,6 +512,7 @@ for x in [ -- string unary functions ['%string?, :'STRINGP], + ['%strlength, :'LENGTH], -- general utility ['%hash, :'SXHASH], @@ -600,7 +601,7 @@ isSharpVar x == isSharpVarWithNum x == not isSharpVar x => nil - (n := QCSIZE(p := PNAME x)) < 2 => nil + (n := #(p := PNAME x)) < 2 => nil ok := true c := 0 for i in 1..(n-1) while ok repeat @@ -977,8 +978,8 @@ stringPrefix?(pref,str) == -- sees if the first #pref letters of str are pref -- replaces STRINGPREFIXP not (string?(pref) and string?(str)) => NIL - (lp := QCSIZE pref) = 0 => true - lp > QCSIZE str => NIL + (lp := # pref) = 0 => true + lp > # str => NIL ok := true i := 0 while ok and (i < lp) repeat @@ -992,13 +993,13 @@ stringChar2Integer(str,pos) == -- in string str. Returns NIL if not a digit or other error. if IDENTP str then str := PNAME str not (string?(str) and - integer?(pos) and (pos >= 0) and (pos < QCSIZE(str))) => NIL + integer?(pos) and (pos >= 0) and (pos < #str)) => NIL not digit?(d := SCHAR(str,pos)) => NIL DIG2FIX d dropLeadingBlanks str == str := object2String str - l := QCSIZE str + l := # str nb := NIL i := 0 while (i < l) and not nb repeat diff --git a/src/interp/i-funsel.boot b/src/interp/i-funsel.boot index 37939a6a..e58d4a3a 100644 --- a/src/interp/i-funsel.boot +++ b/src/interp/i-funsel.boot @@ -1016,7 +1016,7 @@ selectMmsGen(op,tar,args1,args2) == $Subst: local := NIL $SymbolType: local := NIL - null (S := getModemapsFromDatabase(op,QLENGTH args1)) => NIL + null (S := getModemapsFromDatabase(op,#args1)) => NIL if (op = 'map) and (2 = #args1) and (first(args1) is ['Mapping,., elem]) and @@ -1702,7 +1702,7 @@ printMms(mmS) == sayMSG '" " for [sig,imp,.] in mmS for i in 1.. repeat istr := strconc('"[",STRINGIMAGE i,'"]") - if QCSIZE(istr) = 3 then istr := strconc(istr,'" ") + if #istr = 3 then istr := strconc(istr,'" ") sayMSG [:bright istr,'"signature: ",:formatSignature rest sig] first sig='local => sayMSG ['" implemented: local function ",imp] diff --git a/src/interp/msgdb.boot b/src/interp/msgdb.boot index 9d650bd6..36281057 100644 --- a/src/interp/msgdb.boot +++ b/src/interp/msgdb.boot @@ -175,7 +175,7 @@ substituteSegmentedMsg(msg,args) == cons? x => l := [substituteSegmentedMsg(x,args),:l] c := x.0 - n := STRINGLENGTH x + n := # x -- x is a special case (n > 2) and c = char "%" and x.1 = char "k" => @@ -573,14 +573,14 @@ brightPrint(x,out == $OutputStream) == brightPrint0(x,out == $OutputStream) == $texFormatting => brightPrint0AsTeX(x,out) - if IDENTP x then x := PNAME x + if IDENTP x then x := symbolName x not string? x => brightPrintHighlight(x,out) -- if the first character is a backslash and the second is a percent sign, -- don't try to give the token any special interpretation. Just print -- it without the backslash. - STRINGLENGTH x > 1 and x.0 = char "\" and x.1 = char "%" => + # x > 1 and x.0 = char "\" and x.1 = char "%" => sayString(subString(x,1),out) x = '"%l" => sayNewLine(out) @@ -639,7 +639,7 @@ brightPrint0AsTeX(x, out == $OutputStream) == brightPrintHighlight(x,out) blankIndicator x == - if IDENTP x then x := PNAME x + if IDENTP x then x := symbolName x not string? x or MAXINDEX x < 1 => nil x.0 = char '% and x.1 = char 'x => MAXINDEX x > 1 => readInteger subString(x,2) @@ -655,7 +655,7 @@ brightPrint1(x, out == $OutputStream) == brightPrintHighlight(x, out == $OutputStream) == $texFormatting => brightPrintHighlightAsTeX(x,out) x is [key,:rst] => - if IDENTP key then key := PNAME key + if IDENTP key then key := symbolName key key is '"%m" => mathprint(rst,out) string? key and key in '("%p" "%s") => PRETTYPRIN0(rst,out) key is '"%ce" => brightPrintCenter(rst,out) @@ -672,7 +672,7 @@ brightPrintHighlight(x, out == $OutputStream) == sayString('" . ",out) brightPrint1(la,out) sayString('")",out) - IDENTP x => sayString(PNAME x,out) + IDENTP x => sayString(symbolName x,out) -- following line helps find certain bugs that slip through -- also see sayBrightlyLength1 vector? x => sayString('"UNPRINTABLE",out) @@ -699,7 +699,7 @@ brightPrintHighlightAsTeX(x, out == $OutputStream) == sayString('" . ",out) brightPrint1(la,out) sayString('")",out) - IDENTP x => sayString(PNAME x,out) + IDENTP x => sayString(symbolName x,out) vector? x => sayString('"UNPRINTABLE",out) sayString(object2String x,out) @@ -713,7 +713,7 @@ brightPrintCenter(x,out == $OutputStream) == -- centers rst within $LINELENGTH, checking for %l's atom x => x := object2String x - wid := STRINGLENGTH x + wid := # x if wid < $LINELENGTH then f := DIVIDE($LINELENGTH - wid,2) x := [fillerSpaces(f.0,'" "),x] @@ -759,7 +759,7 @@ brightPrintRightJustify(x, out == $OutputStream) == -- right justifies rst within $LINELENGTH, checking for %l's atom x => x := object2String x - wid := STRINGLENGTH x + wid := # x wid < $LINELENGTH => x := [fillerSpaces($LINELENGTH-wid,'" "),x] for y in x repeat brightPrint0(y,out) @@ -794,14 +794,14 @@ sayBrightlyLength1 x == null $highlightAllowed => 1 1 member(x,'("%l" %l)) => 0 - string? x and STRINGLENGTH x > 2 and x.0 = '"%" and x.1 = '"x" => - INTERN x.3 - string? x => STRINGLENGTH x - IDENTP x => STRINGLENGTH PNAME x + string? x and # x > 2 and x.0 = char "%" and x.1 = char "x" => + readInteger(x,2) + string? x => # x + IDENTP x => # symbolName x -- following line helps find certain bugs that slip through -- also see brightPrintHighlight - vector? x => STRINGLENGTH '"UNPRINTABLE" - atom x => STRINGLENGTH STRINGIMAGE x + vector? x => # '"UNPRINTABLE" + atom x => # toString x 2 + sayBrightlyLength x sayAsManyPerLineAsPossible l == |