1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <html lang="en">
- <head>
- <title>Deconstruction Functions - avram - a virtual machine code interpreter</title>
- <meta http-equiv="Content-Type" content="text/html">
- <meta name="description" content="avram - a virtual machine code interpreter">
- <meta name="generator" content="makeinfo 4.13">
- <link title="Top" rel="start" href="index.html#Top">
- <link rel="up" href="Lists.html#Lists" title="Lists">
- <link rel="prev" href="Comparison.html#Comparison" title="Comparison">
- <link rel="next" href="Indirection.html#Indirection" title="Indirection">
- <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
- <meta http-equiv="Content-Style-Type" content="text/css">
- <style type="text/css"><!--
- pre.display { font-family:inherit }
- pre.format { font-family:inherit }
- pre.smalldisplay { font-family:inherit; font-size:smaller }
- pre.smallformat { font-family:inherit; font-size:smaller }
- pre.smallexample { font-size:smaller }
- pre.smalllisp { font-size:smaller }
- span.sc { font-variant:small-caps }
- span.roman { font-family:serif; font-weight:normal; }
- span.sansserif { font-family:sans-serif; font-weight:normal; }
- --></style>
- </head>
- <body>
- <div class="node">
- <a name="Deconstruction-Functions"></a>
- <p>
- Next: <a rel="next" accesskey="n" href="Indirection.html#Indirection">Indirection</a>,
- Previous: <a rel="previous" accesskey="p" href="Comparison.html#Comparison">Comparison</a>,
- Up: <a rel="up" accesskey="u" href="Lists.html#Lists">Lists</a>
- <hr>
- </div>
- <h4 class="subsection">3.1.6 Deconstruction Functions</h4>
- <p>A fast native implementation of the deconstruction operation is provided
- <a name="index-deconstruction-485"></a>by the functions declared in <samp><span class="file">decons.h</span></samp>.
- <div class="defun">
- — Function: void <b>avm_initialize_decons</b> ()<var><a name="index-avm_005finitialize_005fdecons-486"></a></var><br>
- <blockquote><p>This should be called prior to the first call to
- <code>avm_deconstruction</code>, so as to initialize some necessary internal
- data structures. Results will be undefined if it is not.
- </p></blockquote></div>
- <div class="defun">
- — Function: void <b>avm_count_decons</b> ()<var><a name="index-avm_005fcount_005fdecons-487"></a></var><br>
- <blockquote><p>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
- <samp><span class="file">decons.c</span></samp> has been ineptly modified. An error message to the
- effect of unreclaimed “points” could be the result otherwise.
- </p></blockquote></div>
- <div class="defun">
- — Function: list <b>avm_deconstruction</b> (<var>list pointer, list operand, int *fault</var>)<var><a name="index-avm_005fdeconstruction-488"></a></var><br>
- <blockquote><p>Deconstructions are performed by this function, as described in
- <a href="Field.html#Field">Field</a>. In the <code>silly</code> program notation (<a href="A-Simple-Lisp-Like-Language.html#A-Simple-Lisp-Like-Language">A Simple Lisp Like Language</a>), this function computes the value
- of ([[<code>field</code>]] <var>pointer</var>) <var>operand</var>.
- <p>For example, using the fixed list <code>avm_join(NULL,NULL)</code> as the
- <var>pointer</var> parameter will cause a copy of the operand itself
- to be returned as the result. A <var>pointer</var> equal to
- <code>avm_join(NULL,avm_join(NULL,NULL))</code> will cause a copy of
- <code>operand->tail</code> to be returned, and so on. A <code>NULL</code>
- <var>pointer</var> causes an internal error.
- <p>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 <code>*</code><var>fault</var> parameter is set to a non-zero value.
- The <code>*</code><var>fault</var> parameter is also set to a non-zero value in the event
- of a memory overflow, and the memory overflow message is returned.
- </p></blockquote></div>
- </body></html>
|