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

3.4.2 Execution Modes

Some functions declared in ‘exmodes.h’ are useful for executing interactive applications or filter mode transducers in a manner consistent with the specifications described in the previous chapter.

Function: void avm_interact (list avm_interactor, int step_mode, int ask_to_overwrite_mode, int quiet_mode)

This function executes an interactive virtual code application. The parameters have these interpretations.

avm_interactor

is the virtual code for a function that performs as specified in Output From Interactive Applications.

step_mode

will cause all shell commands to be echoed if set to a non-zero value, and will cause the program to pause after each shell command until a key is pressed.

ask_to_overwrite_mode

can be set to a non-zero value by the caller to cause the program to ask permission of the user to overwrite any existing files in cases where the virtual code returns a file list as described in Mixed Modes of Interaction.

quiet_mode

can be set to a non-zero value to suppress console messages in the case of file output per Mixed Modes of Interaction.

The meaning of this function is accessible to any reader willing to slog through Output From Interactive Applications. The only subtle point is that avm_interactor parameter in this function does not correspond to the virtual code application that avram reads from a virtual code file, but to the result computed when the application read from the file is applied to the data structure representing the command line and environment.

Any of the memory overflows or i/o errors possible with other functions in the library are possible from this one as well, and will also cause it to print an error message and halt the program. A badly designed virtual code application could cause a deadlock, which will not be detected or reported

Function: void avm_trace_interaction ()

This function enables diagnostic output for the avm_recoverable_interact function.

Function: void avm_disable_interaction ()

This function causes avm_interact and avm_recoverable_interact to terminate with an error instead of executing, as required by the --jail command line option.

Function: list avm_recoverable_interact (list interactor, int *fault)

This function is similar to avm_interact but always closes the pipe and performs no file i/o, and will return an error message rather than exiting. Otherwise it returns a transcript of the intereaction as a list of lists of strings represented as lists of character encodings. It implements the interact combinator with the virtual code for the transducer function given as the parameter. A prior call to avm_trace_interaction will cause diagnostic information to be written to standard output when this function is executed.

Function: void avm_byte_transduce (list operator)

This function executes a filter mode byte transducer application, which behaves as described in Byte Transducers. The argument is the virtual code for the application, which would be found in a virtual code file. There are limited opportunities for i/o errors, as only standard input and standard output are involved with this function, but fatal errors due to memory overflow are possible.

Function: void avm_line_map (list operator)

This function executes line mapped filter mode applications, which are explained in Line Maps. The argument is the virtual code for the application. Similar comments to those above apply.

Function: void avm_initialize_exmodes ()

This function should be called before any of the other functions in this section in order to initialize some local variables. Results are undefined if this function isn’t called first.

Function: void avm_count_exmodes ()

This function doesn’t do anything in the present version of the library, but should be called after the last call to any of the other functions in this section in order to maintain compatibility with future versions, which may use it for cleaning up local variables.


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

This document was generated on December 10, 2012 using texi2html 1.82.