(index ("format" 0))
(def (sig (procedure "(format DESTINATION FORMAT-STRING . ARGUMENTS)" (id format))) (p "An almost complete implementation of Common LISP format description according to the CL reference book " (b "Common LISP, the Language") " from Guy L. Steele, Digital Press. This code was originally part of SLIB. The author is Dirk Lutzebaeck.") (p "Returns " (tt "#t") ", " (tt "#f") " or a string; has side effect of printing according to " (tt "FORMAT-STRING") ".  If " (tt "DESTINATION") " is " (tt "#t") ", the output is to the current output port and " (tt "#t") " is returned.  If " (tt "DESTINATION") " is " (tt "#f") ", a formatted string is returned as the result of the call.  If " (tt "DESTINATION") " is a string, " (tt "DESTINATION") " is regarded as the format string; " (tt "FORMAT-STRING") " is then the first argument and the output is returned as a string. If " (tt "DESTINATION") " is a number, the output is to the value of " (tt "(current-error-port)") ". Otherwise " (tt "DESTINATION") " must be an output port and " (tt "#t") " is returned.") (p (tt "FORMAT-STRING") " must be a string.  In case of a formatting error format returns " (tt "#f") " and prints a message on the value of " (tt "(current-error-port)") ".  Characters are output as if the string were output by the " (tt "display") " function with the exception of those prefixed by a tilde (~).  For a detailed description of the " (tt "FORMAT-STRING") " syntax please consult a Common LISP format reference manual.") (p "This code is not reentrant, nor is it thread-safe.") (p (tt "format") " implements " (link "http://srfi.schemers.org/srfi-28/srfi-28.html" "SRFI-28")) (p "A list of all supported, non-supported and extended directives follows:") (p "Format Specification (Format version 3.1) -----------------------------------------") (p "Please consult a Common LISP format reference manual for a detailed description of the format string syntax.") (p "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.") (p "The general form of a directive is:") (p "DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER") (p "DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]") (p "Implemented CL Format Control Directives ........................................") (p "Documentation syntax: Uppercase characters represent the corresponding control directive characters. Lowercase characters represent control directive parameter descriptions.") (p "`~A'") (pre "   Any (print as `display' does).") (pre "  `~@A'") (pre "        left pad.") (pre "  `~MINCOL,COLINC,MINPAD,PADCHARA'") (pre "        full padding.") (p "`~S'") (pre "   S-expression (print as `write' does).") (pre "  `~@S'") (pre "        left pad.") (pre "  `~MINCOL,COLINC,MINPAD,PADCHARS'") (pre "        full padding.") (p "`~D'") (pre "   Decimal.") (pre "  `~@D'") (pre "        print number sign always.") (pre "  `~:D'") (pre "        print comma separated.") (pre "  `~MINCOL,PADCHAR,COMMACHARD'") (pre "        padding.") (p "`~X'") (pre "   Hexadecimal.") (pre "  `~@X'") (pre "        print number sign always.") (pre "  `~:X'") (pre "        print comma separated.") (pre "  `~MINCOL,PADCHAR,COMMACHARX'") (pre "        padding.") (p "`~O'") (pre "   Octal.") (pre "  `~@O'") (pre "        print number sign always.") (pre "  `~:O'") (pre "        print comma separated.") (pre "  `~MINCOL,PADCHAR,COMMACHARO'") (pre "        padding.") (p "`~B'") (pre "   Binary.") (pre "  `~@B'") (pre "        print number sign always.") (pre "  `~:B'") (pre "        print comma separated.") (pre "  `~MINCOL,PADCHAR,COMMACHARB'") (pre "        padding.") (p "`~NR'") (pre "   Radix N.") (pre "  `~N,MINCOL,PADCHAR,COMMACHARR'") (pre "        padding.") (p "`~@R'") (pre "   print a number as a Roman numeral.") (p "`~:@R'") (pre "   print a number as an \"old fashioned\" Roman numeral.") (p "`~:R'") (pre "   print a number as an ordinal English number.") (p "`~R'") (pre "   print a number as a cardinal English number.") (p "`~P'") (pre "   Plural.") (pre "  `~@P'") (pre "        prints `y' and `ies'.") (pre "  `~:P'") (pre "        as `~P but jumps 1 argument backward.'") (pre "  `~:@P'") (pre "        as `~@P but jumps 1 argument backward.'") (p "`~C'") (pre "   Character.") (pre "  `~@C'") (pre "        prints a character as the reader can understand it (i.e. `#\\' prefixing).") (pre "  `~:C'") (pre "        prints a character as emacs does (eg. `^C' for ASCII 03).") (p "`~F'") (pre "   Fixed-format floating-point (prints a flonum like MMM.NNN).") (pre "  `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'") (pre "  `~@F'\n        If the number is positive a plus sign is printed.") (p "`~E'") (pre "   Exponential floating-point (prints a flonum like MMM.NNN`E'EE).") (pre "  `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'") (pre "  `~@E'") (pre "        If the number is positive a plus sign is printed.") (p "`~G'") (pre "   General floating-point (prints a flonum either fixed or exponential).") (pre "  `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'") (pre "  `~@G'") (pre "        If the number is positive a plus sign is printed.") (p "`~$'") (pre "   Dollars floating-point (prints a flonum in fixed with signs separated).") (pre "  `~DIGITS,SCALE,WIDTH,PADCHAR$'") (pre "  `~@$'") (pre "        If the number is positive a plus sign is printed.") (pre "  `~:@$'") (pre "        A sign is always printed and appears before the padding.") (pre "  `~:$'") (pre "        The sign appears before the padding.") (p "`~%'") (pre "   Newline.") (pre "  `~N%'") (pre "        print N newlines.") (p "`~&'") (pre "   print newline if not at the beginning of the output line.") (pre "  `~N&'") (pre "        prints `~&' and then N-1 newlines.") (p "`~|'") (pre "   Page Separator.") (pre "  `~N|'") (pre "        print N page separators.") (p "`~~'") (pre "   Tilde.") (pre "  `~N~'") (pre "        print N tildes.") (p "`~'<newline>") (pre "   Continuation Line.") (pre "  `~:'<newline>") (pre "        newline is ignored, white space left.") (pre "  `~@'<newline>") (pre "        newline is left, white space ignored.") (p "`~T'") (pre "   Tabulation.") (pre "  `~@T'") (pre "        relative tabulation.") (pre "  `~COLNUM,COLINCT'") (pre "        full tabulation.") (p "`~?'") (pre "   Indirection (expects indirect arguments as a list).") (pre "  `~@?'") (pre "        extracts indirect arguments from format arguments.") (p "`~(STR~)'") (pre "   Case conversion (converts by `string-downcase').") (pre "  `~:(STR~)'") (pre "        converts by `string-capitalize'.") (pre "  `~@(STR~)'") (pre "        converts by `string-capitalize-first'.") (pre "  `~:@(STR~)'") (pre "        converts by `string-upcase'.") (p "`~*'") (pre "   Argument Jumping (jumps 1 argument forward).") (pre "  `~N*'") (pre "        jumps N arguments forward.") (pre "  `~:*'") (pre "        jumps 1 argument backward.") (pre "  `~N:*'") (pre "        jumps N arguments backward.") (pre "  `~@*'") (pre "        jumps to the 0th argument.") (pre "  `~N@*'") (pre "        jumps to the Nth argument (beginning from 0)") (p "`~[STR0~;STR1~;...~;STRN~]'") (pre "   Conditional Expression (numerical clause conditional).") (pre "  `~N['") (pre "        take argument from N.") (pre "  `~@['") (pre "        true test conditional.") (pre "  `~:['") (pre "        if-else-then conditional.") (pre "  `~;'") (pre "        clause separator.") (pre "  `~:;'") (pre "        default clause follows.") (p "`~{STR~}'") (pre "   Iteration (args come from the next argument (a list)). Iteration\n   bounding is controlled by configuration variables\n   format:iteration-bounded and format:max-iterations. With both variables\n   default, a maximum of 100 iterations will be performed.") (pre "  `~N{'") (pre "        at most N iterations.") (pre "  `~:{'") (pre "        args from next arg (a list of lists).") (pre "  `~@{'") (pre "        args from the rest of arguments.") (pre "  `~:@{'") (pre "        args from the rest args (lists).") (p "`~^'") (pre "   Up and out.") (pre "  `~N^'") (pre "        aborts if N = 0") (pre "  `~N,M^'") (pre "        aborts if N = M") (pre "  `~N,M,K^'") (pre "        aborts if N <= M <= K") (p "Not Implemented CL Format Control Directives ............................................") (p "`~:A'") (pre "   print `#f' as an empty list (see below).") (p "`~:S'") (pre "   print `#f' as an empty list (see below).") (p "`~<~>'") (pre "   Justification.") (p "`~:^'") (pre "   (sorry I don't understand its semantics completely)") (p "Extended, Replaced and Additional Control Directives ....................................................") (p "`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'") (p "`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'") (p "`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'") (p "`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'") (p "`~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'") (pre "   COMMAWIDTH is the number of characters between two comma\n   characters.") (p "`~I'") (pre "   print a R4RS complex number as `~F~@Fi' with passed parameters for\n   `~F'.") (p "`~Y'") (pre "   Pretty print formatting of an argument for scheme code lists.") (p "`~K'") (pre "   Same as `~?.'") (p "`~!'") (pre "   Flushes the output if format DESTINATION is a port.") (p "`~_'") (pre "   Print a `#\\space' character") (pre "  `~N_'\n        print N `#\\space' characters.") (p "`~/'") (pre "   Print a `#\\tab' character") (pre "  `~N/'\n        print N `#\\tab' characters.") (p "`~NC'") (pre "   Takes N as an integer representation for a character. No arguments\n   are consumed. N is converted to a character by `integer->char'.  N\n   must be a positive decimal number.") (p "`~:S'") (pre "   Print out readproof.  Prints out internal objects represented as\n   `#<...>' as strings `\"#<...>\"' so that the format output can always\n   be processed by `read'.") (p "`~:A'") (pre "   Print out readproof.  Prints out internal objects represented as\n   `#<...>' as strings `\"#<...>\"' so that the format output can always\n   be processed by `read'.") (p "`~Q'") (pre "   Prints information and a copyright notice on the format\n   implementation.") (pre "  `~:Q'\n        prints format version.") (p "`~F, ~E, ~G, ~$'") (pre "   May also print number strings, i.e. passing a number as a string and\n   format it accordingly.") (p "Configuration Variables -----------------------") (p "Format has some configuration variables. There should be no modification necessary for the default configuration. If modification is desired the variable should be set after the format code is loaded.") (p "format:floats") (pre "   System has floating-point numbers. (default #t)") (p "format:complex-numbers") (pre "   System has complex numbers. (default #f)") (p "format:fn-max") (pre "   Maximum number of number digits. (default 200)") (p "format:format:en-max") (pre "   Maximum number of exponent digits. (default 10)") (p "format:expch") (pre "   The character prefixing the exponent value in ~E printing.\n   (default #\\E)") (p "format:radix-pref") (pre "   Does number->string add a radix prefix? (default <detects upon load>)") (p "format:symbol-case-conv") (pre "   Symbols are converted by symbol->string so the case type of the\n   printed symbols is implementation dependent.\n   format:symbol-case-conv is a one arg closure which is either #f (no\n   conversion), string-upcase, string-downcase or string-capitalize.\n   (default #f)") (p "format:iobj-case-conv") (pre "   As format:symbol-case-conv but applies for the representation of\n   implementation internal objects. (default #f)") (p "format:iteration-bounded") (pre "   When #t, a ~{...~} control will iterate no more than the number of\n   times specified by format:max-iterations regardless of the number\n   of iterations implied by modifiers and arguments. When #f, a\n   ~{...~} control will iterate the number of times implied by\n   modifiers and arguments, unless termination is forced by language\n   or system limitations. (default #t)") (p "format:max-iterations") (pre "   The maximum number of iterations performed by a ~{...~} control.\n   Has effect only when format:iteration-bounded is #t. (default 100)") (p "format:unprocessed-arguments-error?") (pre "   Are superfluous arguments treated as an error. (default #f)"))
