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

#### 2.6.4.2 Character Oriented Interaction

A character oriented style of interaction involves the function always returning a data structure of the form `(state,(command lines,nil))`. The state and command lines fields serve exactly the same purposes respectively as they do in the case of line oriented interaction. The field that would be occupied by the prompt strings list in the case of line oriented interaction is identically `nil` in this style.

When this style is used, `avram` spawns a process and/or sends command lines to it as in the case of line oriented interaction, but attempts to read only a single character from it per iteration. When the character is received, `avram` applies the function to the pair `(state,character)` in order to obtain the next state and the next list of command lines. If the process has terminated, a `nil` value is used in place of the character. If the process is quiescent, deadlock ensues.

The character oriented style is a lower level protocol that shifts more of the burden of analyzing the process’s output to the virtual code application. It can do anything line oriented interaction can do except proceeding immediately without waiting to receive any output from the process. It may also allow more general criteria (in effect) than the matching of a fixed prompt string to delimit the received data, for those pathological processes that may require such things.

Applications using character oriented interaction need to deal with line breaks explicitly among the received characters, unlike the case with line oriented interaction, where the line breaks are implicit in the list of received strings. Contrary to the convention for Unix text files, line breaks in the output of a process are indicated by character code 13 followed by character code 10.

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

This document was generated on November 8, 2012 using texi2html 1.82.