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

### 3.1.6 Deconstruction Functions

A fast native implementation of the deconstruction operation is provided by the functions declared in ‘`decons.h`’.

Function: void avm_initialize_decons ()

  This should be called prior to the first call to `avm_deconstruction`, so as to initialize some necessary internal data structures. Results will be undefined if it is not.

Function: void avm_count_decons ()

  For ecologically sound memory management, this function should be called at the end of a run to verify that there have been no leaks due to the deconstruction functions, which there won’t be unless the code in ‘`decons.c`’ has been ineptly modified. An error message to the effect of unreclaimed “points” could be the result otherwise.

Function: list avm_deconstruction (list pointer, list operand, int *fault)

  Deconstructions are performed by this function, as described in Field. In the `silly` program notation (A Simple Lisp Like Language), this function computes the value of ([[`field`]] `pointer`) `operand`.

  For example, using the fixed list `avm_join(NULL,NULL)` as the `pointer` parameter will cause a copy of the operand itself to be returned as the result. A `pointer` equal to `avm_join(NULL,avm_join(NULL,NULL))` will cause a copy of `operand->tail` to be returned, and so on. A `NULL` `pointer` causes an internal error.

  If the deconstruction is invalid, as in the case of the tail of an empty list, the invalid deconstruction error message is returned as the result, and the `*fault` parameter is set to a non-zero value. The `*fault` parameter is also set to a non-zero value in the event of a memory overflow, and the memory overflow message is returned.

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

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