diff options
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/br-search.boot | 2 | ||||
-rw-r--r-- | src/interp/database.boot | 4 | ||||
-rw-r--r-- | src/interp/format.boot | 2 | ||||
-rw-r--r-- | src/interp/i-funsel.boot | 4 | ||||
-rw-r--r-- | src/interp/i-map.boot | 4 | ||||
-rw-r--r-- | src/interp/i-syscmd.boot | 8 | ||||
-rw-r--r-- | src/interp/io.boot | 2 | ||||
-rw-r--r-- | src/interp/match.boot | 6 | ||||
-rw-r--r-- | src/interp/scan.boot | 10 | ||||
-rw-r--r-- | src/interp/trace.boot | 2 |
10 files changed, 23 insertions, 21 deletions
diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot index f4c1a81d..090d7752 100644 --- a/src/interp/br-search.boot +++ b/src/interp/br-search.boot @@ -899,7 +899,7 @@ replaceGrepStar s == standardizeSignature(s) == underscoreDollars stringChar(s,0) = char "(" => s - k := STRPOS('"->",s,0,nil) or return s --will fail except perhaps on constants + k := findString('"->",s) or return s --will fail except perhaps on constants stringChar(s,k - 1) = char ")" => strconc('"(",s) strconc('"(",subString(s,0,k),'")",subString(s,k)) diff --git a/src/interp/database.boot b/src/interp/database.boot index 3dbcdb96..5fbf69d1 100644 --- a/src/interp/database.boot +++ b/src/interp/database.boot @@ -710,7 +710,7 @@ dropPrefix(fn) == --++ throwKeyedMsg("S2IZ0069A",[namestring egFile,x]) --++ x := dropLeadingBlanks x --++ -- should be two tokens on the line ---++ p := STRPOS('" ",x,1,nil) +--++ p := findChar(char " ",x,1) --++ null p => --++ throwKeyedMsg("S2IZ0069B",[namestring egFile,x]) --++ n := object2Identifier subString(x,0,p) @@ -722,7 +722,7 @@ dropPrefix(fn) == --++ if egName then $globalExposureGroupAlist := --++ [[egName,:reverse! egFiles],:$globalExposureGroupAlist] --++ egFiles := nil ---++ STRPOS('" ",x,1,nil) => +--++ findChar(char " ",x,1) => --++ throwKeyedMsg("S2IZ0069C",[namestring egFile,x]) --++ egName := object2Identifier x --++ if egFiles then $globalExposureGroupAlist := diff --git a/src/interp/format.boot b/src/interp/format.boot index e46fbdac..9303a252 100644 --- a/src/interp/format.boot +++ b/src/interp/format.boot @@ -628,7 +628,7 @@ isInternalFunctionName(op) == 1 = #op' or char "*" ~= stringChar(op',0) => nil -- if there is a semicolon in the name then it is the name of -- a compiled spad function - null (e := STRPOS('"_;",op',1,nil)) => nil + null (e := findChar(char ";",op',1)) => nil char " " = stringChar(op',1) or char "*" = stringChar(op',1) => nil table := MAKETRTTABLE('"0123456789",nil) s := STRPOSL(table,op',1,true) diff --git a/src/interp/i-funsel.boot b/src/interp/i-funsel.boot index 65f5d292..def3fb8b 100644 --- a/src/interp/i-funsel.boot +++ b/src/interp/i-funsel.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2011, Gabriel Dos Reis. +-- Copyright (C) 2007-2012, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -990,7 +990,7 @@ filterModemapsFromPackages(mms, names, op) == name := object2String type found := nil for n in names while not found repeat - STRPOS(n,name,0,nil) => found := true + findString(n,name) => found := true -- hack, hack (op is 'factor) and member(n,mpolys) and member(name,mpacks) => found := true diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot index 33d78c0f..233c41ae 100644 --- a/src/interp/i-map.boot +++ b/src/interp/i-map.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2011, Gabriel Dos Reis. +-- Copyright (C) 2007-2012, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -62,7 +62,7 @@ isInternalMapName name == sz := # (name' := symbolName name) (sz < 7) or (char "*" ~= name'.0) => false not digit? name'.1 => false - null STRPOS('"_;",name',1,nil) => false + null findChar(char ";",name',1) => false -- good enough true diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index 63cda3aa..f79f9baa 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -197,7 +197,7 @@ commandAmbiguityError(kind,x,u) == --% Utility for access to original command line getSystemCommandLine() == - p := STRPOS('")",$currentLine,0,nil) + p := findChar(char ")",$currentLine) line := if p then subString($currentLine,p) else $currentLine idxmax:= maxIndex line for i in 0..idxmax while stringChar(line,i) ~= char " " repeat @@ -2719,7 +2719,7 @@ zsystemdevelopment1(l,im) == --% Synonym File Reader processSynonyms() == - p := STRPOS('")",LINE,0,nil) + p := findChar(char ")",LINE) fill := '"" if p then @@ -2728,13 +2728,13 @@ processSynonyms() == else p := 0 line := LINE - to := STRPOS ('" ", line, 1, nil) + to := findChar(char " ", line,1) if to then to := to - 1 synstr := subString(line, 1, to) syn := STRING2ID_-N (synstr, 1) null (fun := LASSOC (syn, $CommandSynonymAlist)) => nil fun := eval fun -- fun may have been a suspension - to := STRPOS('")",fun,1,nil) + to := findChar(char ")",fun,1) if to and to ~= #(fun)-1 then opt := strconc('" ",subString(fun,to)) fun := subString(fun,0,to-1) diff --git a/src/interp/io.boot b/src/interp/io.boot index 87416720..2191c3d8 100644 --- a/src/interp/io.boot +++ b/src/interp/io.boot @@ -96,6 +96,8 @@ expandLeadingTabs line == findChar(c,s,k == 0) == or/[i for i in k..maxIndex s | stringChar(s,i) = c] +++ Find the position at which `s1' matches a substring of `s2', +++ starting from `k'. Return nil on failure. findString(s1,s2,k == 0) == n1 := #s1 or/[i for i in k..(#s2 - n1) | diff --git a/src/interp/match.boot b/src/interp/match.boot index 97e139ab..7e8144f9 100644 --- a/src/interp/match.boot +++ b/src/interp/match.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2010, Gabriel Dos Reis. +-- Copyright (C) 2007-2012, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -73,8 +73,8 @@ rightCharPosition(c,t,startpos) == --startpos often equals maxIndex t (rightmost stringPosition(s,t,startpos) == n := # t if startpos < 0 or startpos > n then error '"index out of range" - if # s = 0 then return startpos -- bug in STRPOS - r := STRPOS(s,t,startpos,nil) + if # s = 0 then return startpos + r := findString(s,t,startpos) if r = nil then n else r superMatch?(opattern,subject) == --subject assumed to be DOWNCASEd diff --git a/src/interp/scan.boot b/src/interp/scan.boot index 3f55284f..c314a439 100644 --- a/src/interp/scan.boot +++ b/src/interp/scan.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2011, Gabriel Dos Reis. +-- Copyright (C) 2007-2012, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -446,8 +446,8 @@ scanS()== ncSoftError([$linepos,:lnExtraBlanks $linepos+$n],"S2CN0001",[]) '"" n := $n - strsym := STRPOS ('"_"",$ln,$n,nil) or $sz - escsym := STRPOS ('"__",$ln,$n,nil) or $sz + strsym := findChar(char "_"",$ln,$n) or $sz + escsym := findChar(char "__",$ln,$n) or $sz mn := MIN(strsym,escsym) mn = $sz => $n:=$sz @@ -606,8 +606,8 @@ scanExponent(a,w)== lffloat(a,w,'"0") rdigit? x== - d := STRPOS(x,$RDigits,0,nil) => d - d := STRPOS(x,$smallLetters,0,nil) => 10 + d + d := findChar(x,$RDigits) => d + d := findChar(x,$smallLetters) => 10 + d nil scanError()== diff --git a/src/interp/trace.boot b/src/interp/trace.boot index 9b4d051b..9053bce1 100644 --- a/src/interp/trace.boot +++ b/src/interp/trace.boot @@ -808,7 +808,7 @@ breaklet(fn,vars) == stupidIsSpadFunction fn == -- returns true if the function pname has a semi-colon in it -- eventually, this will use isSpadFunction from luke boot - STRPOS('"_;",PNAME fn,0,nil) + findChar(char ";",PNAME fn) break msg == condition:= MONITOR_,EVALTRAN(_/BREAKCONDITION,nil) |