format destination fmt . arguments | Function |
An almost complete implementation of Common LISP format description
according to the CL reference book Common LISP from Guy L.
Steele, Digital Press. Backward compatible to most of the available
Scheme format implementations.
Returns fmt must be a string or an instance of |
parse-format format-string | Function |
Parses format-string , which is a string of the form of a Common LISP
format description. Returns an instance of gnu.text.ReportFormat ,
which can be passed to the format function.
|
A format string passed to format
or parse-format
consists of format directives (that start with ~
),
and regular characters (that are written directly to the destination).
Most of the Common Lisp (and Slib) format directives are implemented.
Neither justification, nor pretty-printing are supported yet.
Plus of course, we need documentation for format
!
Documentation syntax: Uppercase characters represent the corresponding control directive characters. Lowercase characters represent control directive parameter descriptions.
~A
display
does).
~@A
~
mincol,
colinc,
minpad,
padcharA
~S
write
does).
~@S
~
mincol,
colinc,
minpad,
padcharS
~C
~@C
#\
prefixing).
~:C
^C
for ASCII 03).
~D
~@D
~:D
~
mincol,
padchar,
commachar,
commawidthD
~X
~@X
~:X
~
mincol,
padchar,
commachar,
commawidthX
~O
~@O
~:O
~
mincol,
padchar,
commachar,
commawidthO
~B
~@B
~:B
~
mincol,
padchar,
commachar,
commawidthB
~
nR
~
n,
mincol,
padchar,
commachar,
commawidthR
~@R
~:@R
~:R
~R
~P
~@P
y
and ies
.
~:P
~P but jumps 1 argument backward.
~:@P
~@P but jumps 1 argument backward.
commawidth is the number of characters between two comma characters.
~F
~
width,
digits,
scale,
overflowchar,
padcharF
~@F
~E
E
ee)
~
width,
digits,
exponentdigits,
scale,
overflowchar,
padchar,
exponentcharE
~@E
~G
~
width,
digits,
exponentdigits,
scale,
overflowchar,
padchar,
exponentcharG
~@G
~$
~
digits,
scale,
width,
padchar$
~@$
~:@$
~:$
~%
~
n%
~&
~
n&
~&
and then n-1 newlines.
~|
~
n|
~~
~
n~
~
<newline>
~:
<newline>
~@
<newline>
~T
~@T
~
colnum,
colincT
~?
~@?
~(
str~)
string-downcase
).
~:(
str~)
string-capitalize
.
~@(
str~)
string-capitalize-first
.
~:@(
str~)
string-upcase
.
~*
~
n*
~:*
~
n:*
~@*
~
n@*
~[
str0~;
str1~;...~;
strn~]
~
n[
~@[
~:[
~;
~:;
~{
str~}
~
n{
~:{
~@{
~:@{
~^
~
n^
~
n,
m^
~
n,
m,
k^
~:A
#f
as an empty list (see below).
~:S
#f
as an empty list (see below).
~<~>
~:^
These are not necesasrily implemented in Kawa!
~I
~F~@Fi
with passed parameters for
~F
.
~Y
~K
~?.
~!
~_
#\space
character
~
n_
#\space
characters.
~
nC
integer->char
. n must be a positive decimal number.
~:S
#<...>
as strings "#<...>"
so that the format output can always
be processed by read
.
~:A
#<...>
as strings "#<...>"
so that the format output can always
be processed by read
.
~F, ~E, ~G, ~$