diff options
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/includer.boot | 2 | ||||
-rw-r--r-- | src/boot/translator.boot | 8 | ||||
-rw-r--r-- | src/boot/utility.boot | 13 |
3 files changed, 17 insertions, 6 deletions
diff --git a/src/boot/includer.boot b/src/boot/includer.boot index 9b09f02b..d6b98584 100644 --- a/src/boot/includer.boot +++ b/src/boot/includer.boot @@ -79,7 +79,7 @@ shoeReadLispString(s,n) == -- write LINE to standard terminal I/O. shoeConsole line == - writeLine(line, _*TERMINAL_-IO_*) + writeLine(line,$stdio) shoeSpaces n == makeString(n,char ".") diff --git a/src/boot/translator.boot b/src/boot/translator.boot index 79228477..2302582d 100644 --- a/src/boot/translator.boot +++ b/src/boot/translator.boot @@ -691,12 +691,12 @@ PSTTOMC string== shoePCompileTrees shoeTransformString string BOOTLOOP() == - a := readLine _*STANDARD_-INPUT_* + a := readLine $stdin #a=0=> writeLine '"Boot Loop; to exit type ] " BOOTLOOP() shoePrefix? ('")console",a) => - stream:= _*TERMINAL_-IO_* + stream := $stdio PSTTOMC bRgen stream BOOTLOOP() stringChar(a,0) = char "]" => nil @@ -704,12 +704,12 @@ BOOTLOOP() == BOOTLOOP() BOOTPO() == - a := readLine _*STANDARD_-INPUT_* + a := readLine $stdin #a=0=> writeLine '"Boot Loop; to exit type ] " BOOTPO() shoePrefix? ('")console",a) => - stream:= _*TERMINAL_-IO_* + stream := $stdio PSTOUT bRgen stream BOOTPO() stringChar(a,0) = char "]" => nil diff --git a/src/boot/utility.boot b/src/boot/utility.boot index 6dfdb668..ec51df12 100644 --- a/src/boot/utility.boot +++ b/src/boot/utility.boot @@ -49,7 +49,8 @@ module utility (objectMember?, symbolMember?, stringMember?, setDifference, setUnion, setIntersection, symbolAssoc, applySubst, applySubst!, applySubstNQ, objectAssoc, remove, removeSymbol, atomic?, every?, any?, take, takeWhile, drop, - copyTree, finishLine, stringSuffix?, findChar, charPosition) where + copyTree, finishLine, stringPrefix?, stringSuffix?, + findChar, charPosition) where substitute: (%Thing,%Thing,%Thing) -> %Thing substitute!: (%Thing,%Thing,%Thing) -> %Thing append: (%List %Thing,%List %Thing) -> %List %Thing @@ -75,6 +76,7 @@ module utility (objectMember?, symbolMember?, stringMember?, -- firstNonblankPosition: (%String,%Short) -> %Maybe %Short firstBlankPosition: (%String,%Short) -> %Maybe %Short stringSuffix?: (%String,%String) -> %Maybe %Short + stringPrefix?: (%String,%String) -> %Maybe %Short %defaultReadAndLoadSettings() @@ -371,6 +373,15 @@ stringSuffix?(suf,str) == and/[stringChar(suf,i) = stringChar(str,j) for i in 0..n1-1 for j in n..] => n nil +++ If the string `s1' is a prefix of `s2', return its length which is +++ also the one-past-the-last index into of the last character in `s2'; +++ otherise return nil. +stringPrefix?(s1,s2) == + n1 := #s1 + n1 > #s2 => nil + and/[s1.i = s2.i for i in 0..(n1-1)] => n1 + nil + --% I/O ++ Add a newline character and flush the output stream. |