manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14.8 Default Ports for Input, Output and Errors

Scheme Procedure: current-input-port
C Function: scm_current_input_port ()

Return the current input port. This is the default port used by many input procedures.

Initially this is the standard input in Unix and C terminology. When the standard input is a tty the port is unbuffered, otherwise it’s fully buffered.

Unbuffered input is good if an application runs an interactive subprocess, since any type-ahead input won’t go into Guile’s buffer and be unavailable to the subprocess.

Note that Guile buffering is completely separate from the tty “line discipline”. In the usual cooked mode on a tty Guile only sees a line of input once the user presses <Return>.

Scheme Procedure: current-output-port
C Function: scm_current_output_port ()

Return the current output port. This is the default port used by many output procedures.

Initially this is the standard output in Unix and C terminology. When the standard output is a tty this port is unbuffered, otherwise it’s fully buffered.

Unbuffered output to a tty is good for ensuring progress output or a prompt is seen. But an application which always prints whole lines could change to line buffered, or an application with a lot of output could go fully buffered and perhaps make explicit force-output calls (see section Writing) at selected points.

Scheme Procedure: current-error-port
C Function: scm_current_error_port ()

Return the port to which errors and warnings should be sent.

Initially this is the standard error in Unix and C terminology. When the standard error is a tty this port is unbuffered, otherwise it’s fully buffered.

Scheme Procedure: set-current-input-port port
Scheme Procedure: set-current-output-port port
Scheme Procedure: set-current-error-port port
C Function: scm_set_current_input_port (port)
C Function: scm_set_current_output_port (port)
C Function: scm_set_current_error_port (port)

Change the ports returned by current-input-port, current-output-port and current-error-port, respectively, so that they use the supplied port for input or output.

C Function: void scm_dynwind_current_input_port (SCM port)
C Function: void scm_dynwind_current_output_port (SCM port)
C Function: void scm_dynwind_current_error_port (SCM port)

These functions must be used inside a pair of calls to scm_dynwind_begin and scm_dynwind_end (see section Dynamic Wind). During the dynwind context, the indicated port is set to port.

More precisely, the current port is swapped with a ‘backup’ value whenever the dynwind context is entered or left. The backup value is initialized with the port argument.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2019
Individual documents may contain additional copyright information.