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

### 3.1.8 The Universal Function

A function computing the result of the invisible operator used to specify the virtual code semantics in Virtual Code Semantics, is easily available by way of a declaration in ‘`apply.h`’.

Function: void avm_initialize_apply ()

  This function should be called by the client program at least once prior to the first call to `avm_apply` or `avm_recoverable_apply`. It causes certain internal data structures and error message texts to be initialized.

Function: void avm_count_apply ()

  This function should be used at the end of a run for the purpose of detecting and reporting any unreclaimed storage associated with functions in this section. If the function `avm_count_lists()` is also being used, it should be called after this one.

Function: list avm_apply (list operator, list operand)

  This is the function that evaluates the operator used to describe the virtual code semantics. For example, the value of `f x` can be obtained as the result returned by `avm_apply(f,x)`.

  Both parameters to this function are deallocated unconditionally and should not be referenced again by the caller. If the parameters are needed subsequently, then only copies of them should be passed to `avm_apply` using `avm_copied`.

  This function is not guaranteed to terminate, and may cause a memory overflow error. In the event of an exceptional condition, the error message is written to standard error and the program is halted. There is no externally visible distinction between different levels of error conditions.

Function: list avm_recoverable_apply (list operator, list operand, int *fault)

  This function is similar to `avm_apply` but leaves the responsibility of error handling with the caller. If any overflow or exceptional condition occurs, the result returned is a list representing the error message, and the `fault` flag is set to a non-zero value. This behavior contrasts with that of `avm_apply`, which will display the message to standard error and kill the process.

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

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