diff options
Diffstat (limited to 'libguile/vports.c')
-rw-r--r-- | libguile/vports.c | 75 |
1 files changed, 35 insertions, 40 deletions
diff --git a/libguile/vports.c b/libguile/vports.c index df7c6928c..89cc35cd7 100644 --- a/libguile/vports.c +++ b/libguile/vports.c @@ -139,46 +139,41 @@ sf_close (SCM port) SCM_DEFINE (scm_make_soft_port, "make-soft-port", 2, 0, 0, (SCM pv, SCM modes), -"Returns a port capable of receiving or delivering characters as -specified by the @var{modes} string (@pxref{File Ports, -open-file}). @var{vector} must be a vector of length 6. Its components -are as follows: - -@enumerate 0 -@item -procedure accepting one character for output -@item -procedure accepting a string for output -@item -thunk for flushing output -@item -thunk for getting one character -@item -thunk for closing port (not by garbage collection) -@end enumerate - -For an output-only port only elements 0, 1, 2, and 4 need be -procedures. For an input-only port only elements 3 and 4 need be -procedures. Thunks 2 and 4 can instead be @code{#f} if there is no useful -operation for them to perform. - -If thunk 3 returns @code{#f} or an @code{eof-object} (@pxref{Input, -eof-object?, ,r4rs, The Revised^4 Report on Scheme}) it indicates that -the port has reached end-of-file. For example: - -@example -(define stdout (current-output-port)) -(define p (make-soft-port - (vector - (lambda (c) (write c stdout)) - (lambda (s) (display s stdout)) - (lambda () (display "." stdout)) - (lambda () (char-upcase (read-char))) - (lambda () (display "@@" stdout))) - "rw")) - -(write p p) @result{} #<input-output-soft#\space45d10#\> -@end example") + "Returns a port capable of receiving or delivering characters as\n" + "specified by the @var{modes} string (@pxref{File Ports,\n" + "open-file}). @var{vector} must be a vector of length 6. Its components\n" + "are as follows:\n\n" + "@enumerate 0\n" + "@item\n" + "procedure accepting one character for output\n" + "@item\n" + "procedure accepting a string for output\n" + "@item\n" + "thunk for flushing output\n" + "@item\n" + "thunk for getting one character\n" + "@item\n" + "thunk for closing port (not by garbage collection)\n" + "@end enumerate\n\n" + "For an output-only port only elements 0, 1, 2, and 4 need be\n" + "procedures. For an input-only port only elements 3 and 4 need be\n" + "procedures. Thunks 2 and 4 can instead be @code{#f} if there is no useful\n" + "operation for them to perform.\n\n" + "If thunk 3 returns @code{#f} or an @code{eof-object} (@pxref{Input,\n" + "eof-object?, ,r4rs, The Revised^4 Report on Scheme}) it indicates that\n" + "the port has reached end-of-file. For example:\n\n" + "@example\n" + "(define stdout (current-output-port))\n" + "(define p (make-soft-port\n" + " (vector\n" + " (lambda (c) (write c stdout))\n" + " (lambda (s) (display s stdout))\n" + " (lambda () (display \".\" stdout))\n" + " (lambda () (char-upcase (read-char)))\n" + " (lambda () (display \"@@\" stdout)))\n" + " \"rw\"))\n\n" + "(write p p) @result{} #<input-output-soft#\space45d10#\>\n" + "@end example") #define FUNC_NAME s_scm_make_soft_port { scm_port *pt; |