A fast native implementation of the deconstruction operation is provided by the functions declared in decons.h.
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.
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.
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 toavm_join(NULL,avm_join(NULL,NULL))
will cause a copy ofoperand->tail
to be returned, and so on. ANULL
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.