diff options
author | dos-reis <gdr@axiomatics.org> | 2012-05-28 18:29:20 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2012-05-28 18:29:20 +0000 |
commit | d310a5d012161a4515d5c9e96e992fc6977d8f6b (patch) | |
tree | 6436a7ac2ed1a978da9d2b2b055a6ea2cb9d916e /src/boot | |
parent | 62a125276f6dc3acedaf11af209b7e4c02306128 (diff) | |
download | open-axiom-d310a5d012161a4515d5c9e96e992fc6977d8f6b.tar.gz |
* interp/lexing.boot: Use makeToken directly.
(tokenInstall): Remove.
(getSpadIntegerToken): Lose parameter. Adjust callers.
(getNumberToken): Likewise.
(getArgumentDesignator): Likewise.
(getToken): Likewise.
(getSpadString): Likewise.
(getSpecial): Likewise.
(getGliph): Likewise.
(getIdentifier): Likewise.
* lisp/core.lisp.in ($stdio): New.
* boot/includer.boot: Use it.
* boot/translator.boot: Likewise.
* boot/utility.boot (stringPrefix?): New.
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. |