| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!DOCTYPE book [ |
| 3 | <!ENTITY % eclent SYSTEM "ecl.ent"> |
| 4 | %eclent; |
| 5 | ]> |
| 6 | <book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en"> |
| 7 | <chapter xml:id="ansi.environment"> |
| 8 | <title>Environment</title> |
| 9 | |
| 10 | <section xml:id="ansi.environment.dict"> |
| 11 | <title>Dictionary</title> |
| 12 | |
| 13 | <refentry xml:id="ansi.environment.disassemble"> |
| 14 | <refnamediv> |
| 15 | <refname><function>disassemble</function></refname> |
| 16 | <refpurpose>Display the assembly code of a function</refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsynopsisdiv> |
| 20 | <funcsynopsis> |
| 21 | <funcprototype> |
| 22 | <funcdef>disassemble</funcdef> |
| 23 | <paramdef><parameter>function-designator</parameter>*</paramdef> |
| 24 | </funcprototype> |
| 25 | </funcsynopsis> |
| 26 | <variablelist> |
| 27 | <varlistentry> |
| 28 | <term><replaceable>function-designator</replaceable></term> |
| 29 | <listitem><para>A symbol which is bound to a function in the global environment, or a lambda form |
| 30 | </para></listitem> |
| 31 | </varlistentry> |
| 32 | </variablelist> |
| 33 | </refsynopsisdiv> |
| 34 | |
| 35 | <refsect1> |
| 36 | <title>Function</title> |
| 37 | |
| 38 | <para>As specified in &ANSI; this function outputs the internal represention of a compiled function, or of a lambda form, as it would look after being compiled.</para> |
| 39 | |
| 40 | <para>&ECL; only has a particular difference: it has two different compilers, one based on bytecodes and one based on the C language. The output will thus depend on the arguments and on which compiler is active at the moment in which this function is run.</para> |
| 41 | <itemizedlist> |
| 42 | <listitem><para>If the argument is a bytecompiled function, the output will be bytecodes.</para></listitem> |
| 43 | <listitem><para>If the argument is a lambda form, it will be processed by the active compiler and the appropriate output (bytecodes or C) will be shown.</para></listitem> |
| 44 | <listitem><para>If the argument is a C-compiled form, &ECL; will retrieve its original lambda form and process it with the currently active compiler.</para></listitem> |
| 45 | </itemizedlist> |
| 46 | </refsect1> |
| 47 | </refentry> |
| 48 | |
| 49 | <refentry xml:id="ansi.environment.trace"> |
| 50 | <refnamediv> |
| 51 | <refname><function>trace</function></refname> |
| 52 | <refpurpose>Follow execution of functions</refpurpose> |
| 53 | </refnamediv> |
| 54 | |
| 55 | <refsynopsisdiv> |
| 56 | <funcsynopsis> |
| 57 | <funcprototype> |
| 58 | <funcdef>trace</funcdef> |
| 59 | <paramdef><parameter>function-name</parameter>*</paramdef> |
| 60 | </funcprototype> |
| 61 | </funcsynopsis> |
| 62 | <variablelist> |
| 63 | <varlistentry> |
| 64 | <term><replaceable>function-name</replaceable></term> |
| 65 | <listitem><para> |
| 66 | <synopsis>{<replaceable>symbol</replaceable> | (<replaceable>symbol</replaceable> [<replaceable>option</replaceable> <replaceable>form</replaceable>]*)}</synopsis> |
| 67 | </para></listitem> |
| 68 | </varlistentry> |
| 69 | <varlistentry> |
| 70 | <term><replaceable>symbol</replaceable></term> |
| 71 | <listitem><para>A symbol which is bound to a function in the global |
| 72 | environment. Not evaluated.</para></listitem> |
| 73 | </varlistentry> |
| 74 | <varlistentry> |
| 75 | <term><replaceable>option</replaceable></term> |
| 76 | <listitem><para>One of <symbol>:BREAK</symbol>, |
| 77 | <symbol>:BREAK-AFTER</symbol>, <symbol>:COND-BEFORE</symbol>, |
| 78 | <symbol>:COND-AFTER</symbol>, <symbol>:COND</symbol>, |
| 79 | <symbol>:PRINT</symbol>, <symbol>:PRINT-AFTER</symbol>, |
| 80 | <symbol>:STEP</symbol></para></listitem> |
| 81 | </varlistentry> |
| 82 | <varlistentry> |
| 83 | <term><replaceable>form</replaceable></term> |
| 84 | <listitem><para>A lisp form evaluated in an special |
| 85 | environment.</para></listitem> |
| 86 | </varlistentry> |
| 87 | <varlistentry> |
| 88 | <term>returns</term> |
| 89 | <listitem><para>List of symbols with traced functions.</para></listitem> |
| 90 | </varlistentry> |
| 91 | </variablelist> |
| 92 | </refsynopsisdiv> |
| 93 | |
| 94 | <refsect1> |
| 95 | <title>Macro</title> |
| 96 | |
| 97 | <para>Causes one or more functions to be traced. Each |
| 98 | <replaceable>function-name</replaceable> can be a symbol which is bound to |
| 99 | a function, or a list containing that symbol plus additional options. If |
| 100 | the function bound to that symbol is called, information about the |
| 101 | argumetns and output of this function will be printed. Trace options will |
| 102 | modify the amount of information and when it is printed.</para> |
| 103 | |
| 104 | <para>Not that if the function is called from another function compiled in |
| 105 | the same file, tracing might not be enabled. If this is the case, to |
| 106 | enable tracing, recompile the caller with a <literal>notinline</literal> |
| 107 | declaration for the called function.</para> |
| 108 | |
| 109 | <para><function>trace</function> returns a name list of those functions |
| 110 | that were traced by the call to trace. If no |
| 111 | <replaceable>function-name</replaceable> is given, <literal>trace</literal> |
| 112 | simply returns a name list of all the currently traced functions.</para> |
| 113 | |
| 114 | <para>Trace options cause the normal printout to be suppressed, or cause |
| 115 | extra information to be printed. Each option is a pair of an option keyword |
| 116 | and a value form. If an already traced function is traced again, any new |
| 117 | options replace the old options and a warning might be printed. The lisp |
| 118 | <replaceable>form</replaceable> accompanying the option is evaluated in an |
| 119 | environment where <replaceable>sys::arglist</replaceable> is contains the |
| 120 | list of arguments to the function.</para> |
| 121 | |
| 122 | <para>The following options are defined:</para> |
| 123 | <variablelist> |
| 124 | <varlistentry> |
| 125 | <term><symbol>:cond</symbol></term> |
| 126 | <term><symbol>:cond-before</symbol></term> |
| 127 | <term><symbol>:cond-after</symbol></term> |
| 128 | <listitem> |
| 129 | <para>If <symbol>:cond-before</symbol> is specified, then |
| 130 | <function>trace</function> does nothing unless |
| 131 | <replaceable>form</replaceable> evaluates to true at the time of the |
| 132 | call. <symbol>:cond-after</symbol> is similar, but suppresses the |
| 133 | initial printout, and is tested when the function returns. |
| 134 | <symbol>:cond</symbol> tries both before and after.</para> |
| 135 | </listitem> |
| 136 | </varlistentry> |
| 137 | <varlistentry> |
| 138 | <term><symbol>:step</symbol></term> |
| 139 | <listitem> |
| 140 | <para>If <replaceable>form</replaceable> evaluates to true, the stepper |
| 141 | is entered.</para> |
| 142 | </listitem> |
| 143 | </varlistentry> |
| 144 | <varlistentry> |
| 145 | <term><symbol>:break</symbol></term> |
| 146 | <term><symbol>:break-after</symbol></term> |
| 147 | <listitem> |
| 148 | <para>If specified, and <replaceable>form</replaceable> evaluates to |
| 149 | true, then the debugger is invoked at the start of the function or at |
| 150 | the end of the function according to the respective option.</para> |
| 151 | </listitem> |
| 152 | </varlistentry> |
| 153 | <varlistentry> |
| 154 | <term><symbol>:print</symbol></term> |
| 155 | <term><symbol>:print-after</symbol></term> |
| 156 | <listitem> |
| 157 | <para>In addition to the usual printout, the result of evaluating |
| 158 | <replaceable>form</replaceable> is printed at the start of the function |
| 159 | or at the end of the function, depending on the option. Multiple print |
| 160 | options cause multiple values to be output, in the order in which they |
| 161 | were introduced.</para> |
| 162 | </listitem> |
| 163 | </varlistentry> |
| 164 | </variablelist> |
| 165 | </refsect1> |
| 166 | </refentry> |
| 167 | </section> |
| 168 | |
| 169 | <xi:include href="ref_c_environment.xml" xpointer="ansi.environment.c-dict" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 170 | |
| 171 | </chapter> |
| 172 | </book> |