aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/string.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-11-16 16:08:49 +0000
committerdos-reis <gdr@axiomatics.org>2010-11-16 16:08:49 +0000
commit1b31c2ee8c940986d448dfc226b00fc6f6af6639 (patch)
tree74248b28006e29b46b405615cc0bf1a3d5d505de /src/algebra/string.spad.pamphlet
parentad10d0cf79ab09a0175fc95ef5a71033a8de0a1a (diff)
downloadopen-axiom-1b31c2ee8c940986d448dfc226b00fc6f6af6639.tar.gz
* interp/g-opt.boot ($VMsideEffectFreeOperators): Include %s2c
builtin. * interp/g-util.boot (stringToChar): New. (expandCst): Use it. (expandS2c): Likewise. New. * interp/spad.lisp (|$Newline): Move to interp/sys-macros.lisp. * interp/sys-macros.lisp (|$Backspace): New. (|$HorizontalTab|): Likewise. (|$VerticalTab|): Likewise. (|$FormFeed|): Likewise. (|$CarriageReturn|): Likewise. * algebra/string.spad.pamphlet (Character) [newline]: New. [carriageReturn]: Likewise. [linefeed]: Likewise. [formfeed]: Likewise. [backspace]: Likewise. [horizontalTab]: Likewise. [verticalTab]: Likewise. [char]: Tidy.
Diffstat (limited to 'src/algebra/string.spad.pamphlet')
-rw-r--r--src/algebra/string.spad.pamphlet27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/algebra/string.spad.pamphlet b/src/algebra/string.spad.pamphlet
index 9f2e5883..9ea5e74f 100644
--- a/src/algebra/string.spad.pamphlet
+++ b/src/algebra/string.spad.pamphlet
@@ -42,6 +42,20 @@ Character: OrderedFinite() with
++ \spad{escape} provides the escape character, \spad{_}, which
++ is used to allow quotes and other characters {\em within}
++ strings.
+ newline: %
+ ++ \spad{newline} designates the new line character.
+ carriageReturn: %
+ ++ \spad{carriageReturn} designates carriage return.
+ linefeed: %
+ ++ \spad{linefeed} designates the line feed character.
+ formfeed: %
+ ++ \spad{formfeed} designates the form feed character.
+ backspace: %
+ ++ \spad{backspace} designates the backspace character.
+ horizontalTab: %
+ ++ \spad{horizontalTab} designates horizontal tab.
+ verticalTab: %
+ ++ \spad{verticalTab} designates vertical tab.
upperCase: % -> %
++ upperCase(c) converts a lower case letter to the corresponding
++ upper case letter. If c is not a lower case letter, then
@@ -83,6 +97,7 @@ Character: OrderedFinite() with
import %c2i: % -> NNI from Foreign Builtin
import %i2c: NNI -> % from Foreign Builtin
import %ccst: String -> % from Foreign Builtin
+ import %s2c: String -> % from Foreign Builtin
a = b == %ceq(a,b)
a < b == %clt(a,b)
@@ -98,6 +113,13 @@ Character: OrderedFinite() with
space == %ccst " "
quote == %ccst "_""
escape == %ccst "__"
+ newline == %ccst "\n"
+ carriageReturn == %ccst "\r"
+ linefeed == %i2c 10
+ formfeed == %ccst "\f"
+ backspace == %ccst "\b"
+ horizontalTab == %ccst "\t"
+ verticalTab == %ccst "\v"
coerce(c:%):OutputForm == c : OutputForm
digit? c == member?(c, digit())
hexDigit? c == member?(c, hexDigit())
@@ -109,9 +131,8 @@ Character: OrderedFinite() with
latex c ==
concat("\mbox{`", concat(new(1,c)$String, "'}")$String)$String
- char(s:String) ==
- one?(#s) => s(minIndex s)
- userError "String is not a single character"
+ char(s: String) ==
+ %s2c s
upperCase c ==
CHAR_-UPCASE(c)$Lisp : %