Previous: Character Oriented Interaction, Up: Output From Interactive Applications


2.6.4.3 Mixed Modes of Interaction

An application is not confined exclusively to line oriented or character oriented interaction, but may switch from one style to the other between iterations, and signal its choice simply by the format of the data structure it returns. If the prompt strings field is non-empty, the interaction is line oriented, and if the field is empty, the interaction is character oriented. A function using both styles has to be prepared for whichever type of data it indicates, either a character or a list of character strings as the case may be.

Another alternative is possible if the function returns a data structure in the form (files,nil). This structure includes neither a list of command lines nor a list of prompt strings, empty or otherwise, but does include a list of quadruples in the files field. The quadruples are of the form ((overwrite,path),(preamble,contents)). The fields have the same interpretations as in the output from a non-interactive parameter mode application, as described in Output From Non-interactive Applications, and will cause a list of files to be written in the same way.

As an interactive application is able cause the execution of arbitrary shell commands, it doesn't need avram to write files for it the way a non-interactive application does, so this feature does not provide any additional capabilities. However, it may be helpful as a matter of convenience.

After the files are written, the function will be applied to the same result it returned, (files,nil). There is no direct means of preserving unconstrained state information from previous iterations in this style of interaction. A likely scenario might therefore be that the function returns a file list after finishing its other business, and then returns nil on the next iteration to terminate.