Removed or commented out debug printing
[rl3.git] / rl3 / io / print.sls
blobb95ef6ee97ed4c27a4c274c0e825c9a93cf00f31
1 (library
2  (rl3 io print)
3  
4  (export format get-output-string open-output-string)
6  (import (primitives format open-output-string get-output-string))
8  ;; format
9  ;; Copyright 1998 Lars T Hansen.
10  ;; 2002-09-28 / lth
11  ;;
12  ;; (format <port> <format-string> <arg> ...)
13  ;;
14  ;; <port> can be: an output port 
15  ;;                #t, denoting (current-output-port)
16  ;;                #f, denoting an output string (that is returned)
17  ;;
18  ;; The following formatting characters are valid:
19  ;;   ~a   - write as with 'display'
20  ;;   ~b   - write bytevector elements (decimal)
21  ;;   ~B   - write bytevector elements (hexadecimal)
22  ;;   ~c   - write character as with 'write-char'
23  ;;   ~f   - write number as with 'display', though see below
24  ;;   ~x   - write integer in base 16
25  ;;   ~o   - write integer in base 8
26  ;;   ~s   - write as with 'write', compatible with Chez Scheme
27  ;;   ~w   - write as with 'write'
28  ;;   ~?   - next two args are another format string and a list of
29  ;;          arguments, respectively;; recursively invoke format on
30  ;;          those arguments.
31  ;;   ~%   - newline
32  ;;   ~~   - write a ~
33  ;;
34  ;; ~a and ~w admit a field width specifier
35  ;;   - an integer n formats the datum left-justified in a field that 
36  ;;     is at least n characters wide, inserting spaces on the right 
37  ;;     if necessary
38  ;;   - an integer n followed by @ formats the datum right-justified,
39  ;;     ditto.
40  ;;
41  ;; ~f admits a formatting specifier
42  ;;   - integers w and d, comma separated, that format the datum
43  ;;     left justified in a field at least w characters wide rounded
44  ;;     to d decimal places.  w is optional in which case no leading
45  ;;     spaces are printed;; ,d is optional in which case the number 
46  ;;     is formatted as with number->string and an attempt is made to
47  ;;     fit it in the field (FIXME: should probably round it to fit,
48  ;;     if that's possible.)
51  )