[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The interface used when the --byte-transducer
option is selected
allows an application to serve as a persistent stream processor suitable
for finite or infinite streams. The interface can be summarized by the
following points.
nil
, and is expected to return a pair
(state,output)
. The state format is
unconstrained. The output must be a character string that will
be written to standard output, but it may be the empty string.
avram
applies the function
to the pair (state,character)
, using the state
obtained from previous evaluation, and the character whose code is the
byte. The purpose of the state field is therefore to provide a
way for the application to remember something from one invocation to
the next.
(state,output)
for each input byte, so that the state
can be used on the next iteration, and the output can be written to standard
output as a character string.
nil
, the computation
terminates.
(state,nil)
thereafter, but may continue to return
(state,output)
pairs for arbitrarily many more iterations.
The EOF
character is not explicitly passed to the function, but
the end is detectable insofar as nil
is not a representation for
any character.
Unlike the situation with line maps, the output character strings do not have line breaks automatically appended, and the application must include them explicitly if required. The convention for line breaks is system dependent. On Unix and GNU/Linux systems, character code 10 indicates a line break, but other systems may use character code 13 followed by character code 10. See Character Table for the representations of characters having these codes.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on December 10, 2012 using texi2html 1.82.