Please consult a Common LISP format reference manual for a detailed description of the format string syntax. For a demonstration of the implemented directives see formatst.scm.
This implementation supports directive parameters and modifiers
(: and @ characters). Multiple parameters must be
separated by a comma (,). Parameters can be numerical parameters
(positive or negative), character parameters (prefixed by a quote
character ('), variable parameters (v), number of rest
arguments parameter (#), empty and default parameters. Directive
characters are case independent. The general form of a directive
is:
directive ::= ~{directive-parameter,}[:][@]directive-character
directive-parameter ::= [ [-|+]{0-9}+ | 'character | v | # ]
Documentation syntax: Uppercase characters represent the corresponding control directive characters. Lowercase characters represent control directive parameter descriptions.
~Adisplay does).
~@A~mincol,colinc,minpad,padcharA~Swrite does).
~@S~mincol,colinc,minpad,padcharS~D~@D~:D~mincol,padchar,commacharD~X~@X~:X~mincol,padchar,commacharX~O~@O~:O~mincol,padchar,commacharO~B~@B~:B~mincol,padchar,commacharB~nR~n,mincol,padchar,commacharR~@R~:@R~:R~R~P~@Py and ies.
~:P~P but jumps 1 argument backward.
~:@P~@P but jumps 1 argument backward.
~C~@C#\ prefixing).
~:C^C for ASCII 03).
~F~width,digits,scale,overflowchar,padcharF~@F~EEee).
~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).
~<~>~:^~mincol,padchar,commachar,commawidthD~mincol,padchar,commachar,commawidthX~mincol,padchar,commachar,commawidthO~mincol,padchar,commachar,commawidthB~n,mincol,padchar,commachar,commawidthR~I~F~@Fi with passed parameters for
~F.
~Y~K~?.
~!~_#\space character
~n_#\space characters.
~/#\tab character
~n/#\tab characters.
~nCinteger->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.
~Q~:Q~F, ~E, ~G, ~$Format has some configuration variables at the beginning of format.scm to suit the systems and users needs. There should be no modification necessary for the configuration that comes with SLIB. If modification is desired the variable should be set after the format code is loaded. Format detects automatically if the running scheme system implements floating point numbers and complex numbers.
symbol->string so the case type of the
printed symbols is implementation dependent.
format:symbol-case-conv is a one arg closure which is either
#f (no conversion), string-upcase, string-downcase
or string-capitalize. (default #f)
#f)
~E printing. (default
#\E)
#t, a ~{...~} control will iterate no more than the
number of times specified by format:max-iterations regardless of
the number of iterations implied by modifiers and arguments.
When #f, a ~{...~} control will iterate the number of
times implied by modifiers and arguments, unless termination is forced
by language or system limitations. (default #t)
~{...~} control.
Has effect only when format:iteration-bounded is #t.
(default 100)
~A, ~S,
~P, ~X uppercase printing. SLIB format 1.4 uses C-style
printf padding support which is completely replaced by the CL
format padding style.
~, which is not documented
(ignores all characters inside the format string up to a newline
character). (7.1 implements ~a, ~s,
~newline, ~~, ~%, numerical and variable
parameters and :/@ modifiers in the CL sense).
~A and ~S which print in
uppercase. (Elk implements ~a, ~s, ~~, and
~% (no directive parameters or modifiers)).
~a, ~s, ~c, ~%, and ~~ (no directive
parameters or modifiers)).
This implementation of format is solely useful in the SLIB context because it requires other components provided by SLIB.