<!-- 95% W3C COMPLIANT, 95% CSS FREE, RAW HTML --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title>BiglooA ``practical Scheme compiler''User manual for version 3.2bJune 2009</title> <style type="text/css"> <!-- pre { font-family: monospace } tt { font-family: monospace } code { font-family: monospace } p.flushright { text-align: right } p.flushleft { text-align: left } span.sc { font-variant: small-caps } span.sf { font-family: sans-serif } span.skribetitle { font-family: sans-serif; font-weight: bolder; font-size: x-large; } span.refscreen { } span.refprint { display: none; } --> </style> </head> <body class="chapter" bgcolor="#ffffff"> <table width="100%" class="skribetitle" cellspacing="0" cellpadding="0"><tbody> <tr><td align="center" bgcolor="#8381de"><div class="skribetitle"><strong><big><big><big>16. Bigloo<br/>A ``practical Scheme compiler''<br/>User manual for version 3.2b<br/>June 2009 -- Errors, Assertions, and Traces</big></big></big></strong></div><center> </center> </td></tr></tbody></table> <table cellpadding="3" cellspacing="0" width="100%" class="skribe-margins"><tr> <td align="left" valign="top" class="skribe-left-margin" width="20%" bgcolor="#dedeff"><div class="skribe-left-margin"> <br/><center id='center28570' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc28560" align="center" colspan="1"><font color="#ffffff"><strong id='bold28558' >main page</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc28567" align="center" colspan="1"><table width="100%" border="0" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc28563" align="left" valign="top" colspan="1"><strong id='bold28562' >top:</strong></td><td id="tc28564" align="right" valign="top" colspan="1"><a href="bigloo.html#Bigloo-A-``practical-Scheme-compiler''-User-manual-for-version-3.2b-June-2009" class="inbound">Bigloo<br/>A ``practical Scheme compiler''<br/>User manual for version 3.2b<br/>June 2009</a></td></tr> </tbody></table> </td></tr> </tbody></table> </center> <br/><br/><center id='center28580' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc28574" align="center" colspan="1"><font color="#ffffff"><strong id='bold28572' >Errors, Assertions, and Traces</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc28577" align="center" colspan="1"><table cellspacing="1" cellpadding="1" width="100%" class="toc"> <tbody> <tr><td valign="top" align="left">16.1</td><td colspan="4" width="100%"><a href="bigloo-17.html#Errors-and-Warnings">Errors and Warnings</a></td></tr> <tr><td valign="top" align="left">16.2</td><td colspan="4" width="100%"><a href="bigloo-17.html#Exceptions">Exceptions</a></td></tr> <tr><td valign="top" align="left">16.3</td><td colspan="4" width="100%"><a href="bigloo-17.html#Deprecated-try-form">Deprecated try form</a></td></tr> <tr><td valign="top" align="left">16.4</td><td colspan="4" width="100%"><a href="bigloo-17.html#Assertions">Assertions</a></td></tr> <tr><td valign="top" align="left">16.5</td><td colspan="4" width="100%"><a href="bigloo-17.html#Tracing">Tracing</a></td></tr> </tbody> </table> </td></tr> </tbody></table> </center> <br/><br/><center id='center28590' ><table width="97%" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" frame="box" rules="none"><tbody> <tr bgcolor="#8381de"><th id="tc28584" align="center" colspan="1"><font color="#ffffff"><strong id='bold28582' >Chapters</strong></font></th></tr> <tr bgcolor="#ffffff"><td id="tc28587" align="center" colspan="1"><table cellspacing="1" cellpadding="1" width="100%" class="toc"> <tbody> <tr><td valign="top" align="left"></td><td colspan="4" width="100%"><a href="bigloo-1.html#Acknowledgements">Acknowledgements</a></td></tr> <tr><td valign="top" align="left">1</td><td colspan="4" width="100%"><a href="bigloo-2.html#Table-of-contents">Table of contents</a></td></tr> <tr><td valign="top" align="left">2</td><td colspan="4" width="100%"><a href="bigloo-3.html#Overview-of-Bigloo">Overview of Bigloo</a></td></tr> <tr><td valign="top" align="left">3</td><td colspan="4" width="100%"><a href="bigloo-4.html#Modules">Modules</a></td></tr> <tr><td valign="top" align="left">4</td><td colspan="4" width="100%"><a href="bigloo-5.html#Core-Language">Core Language</a></td></tr> <tr><td valign="top" align="left">5</td><td colspan="4" width="100%"><a href="bigloo-6.html#DSSSL-support">DSSSL support</a></td></tr> <tr><td valign="top" align="left">6</td><td colspan="4" width="100%"><a href="bigloo-7.html#Standard-Library">Standard Library</a></td></tr> <tr><td valign="top" align="left">7</td><td colspan="4" width="100%"><a href="bigloo-8.html#Pattern-Matching">Pattern Matching</a></td></tr> <tr><td valign="top" align="left">8</td><td colspan="4" width="100%"><a href="bigloo-9.html#Fast-search">Fast search</a></td></tr> <tr><td valign="top" align="left">9</td><td colspan="4" width="100%"><a href="bigloo-10.html#Structures-and-Records">Structures and Records</a></td></tr> <tr><td valign="top" align="left">10</td><td colspan="4" width="100%"><a href="bigloo-11.html#Object-System">Object System</a></td></tr> <tr><td valign="top" align="left">11</td><td colspan="4" width="100%"><a href="bigloo-12.html#Regular-parsing">Regular parsing</a></td></tr> <tr><td valign="top" align="left">12</td><td colspan="4" width="100%"><a href="bigloo-13.html#Lalr(1)-parsing">Lalr(1) parsing</a></td></tr> <tr><td valign="top" align="left">13</td><td colspan="4" width="100%"><a href="bigloo-14.html#Posix-Regular-Expressions">Posix Regular Expressions</a></td></tr> <tr><td valign="top" align="left">14</td><td colspan="4" width="100%"><a href="bigloo-15.html#Command-Line-Parsing">Command Line Parsing</a></td></tr> <tr><td valign="top" align="left">15</td><td colspan="4" width="100%"><a href="bigloo-16.html#Cryptography">Cryptography</a></td></tr> <tr><td valign="top" align="left">16</td><td colspan="4" width="100%"><a href="bigloo-17.html#Errors-Assertions-and-Traces">Errors, Assertions, and Traces</a></td></tr> <tr><td valign="top" align="left">17</td><td colspan="4" width="100%"><a href="bigloo-18.html#Threads">Threads</a></td></tr> <tr><td valign="top" align="left">18</td><td colspan="4" width="100%"><a href="bigloo-19.html#Database-library">Database library</a></td></tr> <tr><td valign="top" align="left">19</td><td colspan="4" width="100%"><a href="bigloo-20.html#Multimedia-library">Multimedia library</a></td></tr> <tr><td valign="top" align="left">20</td><td colspan="4" width="100%"><a href="bigloo-21.html#Mail-library">Mail library</a></td></tr> <tr><td valign="top" align="left">21</td><td colspan="4" width="100%"><a href="bigloo-22.html#Eval-and-code-interpretation">Eval and code interpretation</a></td></tr> <tr><td valign="top" align="left">22</td><td colspan="4" width="100%"><a href="bigloo-23.html#Macro-expansion">Macro expansion</a></td></tr> <tr><td valign="top" align="left">23</td><td colspan="4" width="100%"><a href="bigloo-24.html#Parameters">Parameters</a></td></tr> <tr><td valign="top" align="left">24</td><td colspan="4" width="100%"><a href="bigloo-25.html#Explicit-typing">Explicit typing</a></td></tr> <tr><td valign="top" align="left">25</td><td colspan="4" width="100%"><a href="bigloo-26.html#The-C-interface">The C interface</a></td></tr> <tr><td valign="top" align="left">26</td><td colspan="4" width="100%"><a href="bigloo-27.html#The-Java-interface">The Java interface</a></td></tr> <tr><td valign="top" align="left">27</td><td colspan="4" width="100%"><a href="bigloo-28.html#Bigloo-Libraries">Bigloo Libraries</a></td></tr> <tr><td valign="top" align="left">28</td><td colspan="4" width="100%"><a href="bigloo-29.html#Extending-the-Runtime-System">Extending the Runtime System</a></td></tr> <tr><td valign="top" align="left">29</td><td colspan="4" width="100%"><a href="bigloo-30.html#SRFIs">SRFIs</a></td></tr> <tr><td valign="top" align="left">30</td><td colspan="4" width="100%"><a href="bigloo-31.html#Compiler-description">Compiler description</a></td></tr> <tr><td valign="top" align="left">31</td><td colspan="4" width="100%"><a href="bigloo-32.html#User-Extensions">User Extensions</a></td></tr> <tr><td valign="top" align="left">32</td><td colspan="4" width="100%"><a href="bigloo-33.html#Bigloo-Development-Environment">Bigloo Development Environment</a></td></tr> <tr><td valign="top" align="left">33</td><td colspan="4" width="100%"><a href="bigloo-34.html#Global-Index">Global Index</a></td></tr> <tr><td valign="top" align="left">34</td><td colspan="4" width="100%"><a href="bigloo-35.html#Library-Index">Library Index</a></td></tr> <tr><td valign="top" align="left"></td><td colspan="4" width="100%"><a href="bigloo-36.html#Bibliography">Bibliography</a></td></tr> </tbody> </table> </td></tr> </tbody></table> </center> </div></td> <td align="left" valign="top" class="skribe-body"><div class="skribe-body"> <a name="Errors-Assertions-and-Traces" class="mark"></a><a name="g17679" class="mark"></a><a name="g17681" class="mark"></a><a name="g17683" class="mark"></a><a name="g17685" class="mark"></a> <!-- Errors and Warnings --> <a name="Errors-and-Warnings"></a> <div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">16.1 Errors and Warnings</font> </h3></td></tr></table> </div><div class="section"> <a name="Errors-and-Warnings" class="mark"></a> Bigloo permits to signal an error via the <code id='code17687' >error</code> function. Errors are implemented by the means of exceptions (see <code id='code17688' >with-exception-handler</code>, <code id='code17689' >with-handler</code>, and <code id='code17690' >raise</code> forms). Assertions allow the checking of predicates at certain points in programs. <br/><br/><br/><table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17693" class="mark"></a><a name="error" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17697" align="left" colspan="1"><strong id='bold17695' >error</strong><em id='it17696' > proc msg obj</em></td><td id="tc17698" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> This form signals an error by calling the current error handler with <code id='code17702' ><em id='it17701' >proc</em></code>, <code id='code17704' ><em id='it17703' >msg</em></code> and <code id='code17706' ><em id='it17705' >obj</em></code> as arguments.<br/><br/><center id='center17718' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17716' >(<font color="#6959cf"><strong id='bold28591' >define</strong></font> (<font color="#6959cf"><strong id='bold28593' >foo</strong></font> l) (<strong id='bold28595' >if</strong> (not (pair? l)) (<font color="red"><strong id='bold28596' >error</strong></font> <font color="red">"foo"</font> <font color="red">"argument not a pair"</font> l) (car l)))<br/><br/>(foo 4) error--> *** ERROR<strong id='bold28600' >:bigloo</strong><strong id='bold28602' >:foo</strong>: argument not a pair -- 4 </pre> </td></tr> </tbody></table></center> Switching on the <code id='code17719' >-g</code> compilation switch enables stack dumping when the <code id='code17720' >error</code> function is invoked. That is, when a program is compiled with <code id='code17721' >-g</code> and when, at runtime, the shell variable <code id='code17722' >BIGLOOSTACKDEPTH</code> is set and contains a number, an execution stack of depth <code id='code17723' >BIGLOOSTACKDEPTH</code> is printed when an error is raised. </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17727" class="mark"></a><a name="error/location" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17731" align="left" colspan="1"><strong id='bold17729' >error/location</strong><em id='it17730' > proc msg obj file location</em></td><td id="tc17732" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> This form signals an error by calling the current error handler with <code id='code17736' ><em id='it17735' >proc</em></code>, <code id='code17738' ><em id='it17737' >msg</em></code> and <code id='code17740' ><em id='it17739' >obj</em></code> as arguments. The error is prompted in <code id='code17742' ><em id='it17741' >file</em></code>, at character position <code id='code17744' ><em id='it17743' >location</em></code>.<br/><br/><center id='center17757' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17755' >(<font color="#6959cf"><strong id='bold28604' >define</strong></font> (<font color="#6959cf"><strong id='bold28606' >foo</strong></font> l) (<strong id='bold28608' >if</strong> (not (pair? l)) (error/location <font color="red">"foo"</font> <font color="red">"argument not a pair"</font> l <font color="red">"foo.scm"</font> 115) (car l)))<br/><br/>(foo 4) error--> File <font color="red">"foo.scm"</font>, line 4, character 115: # (car l))) # ^ # *** ERROR<strong id='bold28613' >:bigloo</strong><strong id='bold28615' >:foo</strong> # argument not a pair -- 4 0. FOO 1. DYNAMIC-WIND 2. INTERP 3. ENGINE 4. MAIN </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17761" class="mark"></a><a name="get-trace-stack" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17765" align="left" colspan="1"><strong id='bold17763' >get-trace-stack</strong><em id='it17764' > size</em></td><td id="tc17766" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> <a name="g17770" class="mark"></a><a name="dump-trace-stack" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17774" align="left" colspan="1"><strong id='bold17772' >dump-trace-stack</strong><em id='it17773' > output-port size</em></td><td id="tc17775" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> Switching on the <code id='code17778' >-g</code> compilation switch enables stack dumping <a href="bigloo-31.html#Compiler-Description" class="inbound">Compiler Description</a>. That is, the list of the pending calls can be dumped by the runtime-system. The function <code id='code17779' >get-trace-stack</code> builds such a trace. The list built by <code id='code17780' >get-trace-stack</code> only contains the <code id='code17782' ><em id='it17781' >size</em></code> top most pending calls. The function <code id='code17783' >dump-trace-stack</code> displays a representation of this stack on the <code id='code17785' ><em id='it17784' >output-port</em></code>.<br/><br/></td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17790" class="mark"></a><a name="warning/location" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17794" align="left" colspan="1"><strong id='bold17792' >warning/location</strong><em id='it17793' > file location [arg]...</em></td><td id="tc17795" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> This form signals a warning. That is, is <code id='code17799' ><em id='it17798' >arg</em></code> are displayed on the standard error port. The warning is prompted in <code id='code17801' ><em id='it17800' >file</em></code> at character position <code id='code17803' ><em id='it17802' >location</em></code>.<br/><br/><center id='center17817' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17815' >(<font color="#6959cf"><strong id='bold28617' >define</strong></font> (<font color="#6959cf"><strong id='bold28619' >foo</strong></font> l) (<strong id='bold28621' >if</strong> (not (pair? l)) (<strong id='bold28622' >begin</strong> (warning/location <font color="red">"foo.scm"</font> 154 <font color="red">"foo:"</font> <font color="red">"argument not a pair -- "</font> l) '()) (car l)))<br/><br/>(foo 4) -| File <font color="red">"foo.scm"</font>, line 6, character 154: # (car l))) # ^ # *** WARNING<strong id='bold28627' >:bigloo</strong><strong id='bold28629' >:foo</strong>: argument not a pair -- 4 => '() </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17821" class="mark"></a><a name="exception-notify" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17825" align="left" colspan="1"><strong id='bold17823' >exception-notify</strong><em id='it17824' > exc</em></td><td id="tc17826" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> <a name="g17830" class="mark"></a><a name="error-notify" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17834" align="left" colspan="1"><strong id='bold17832' >error-notify</strong><em id='it17833' > err</em></td><td id="tc17835" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> <a name="g17839" class="mark"></a><a name="warning-notify" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17843" align="left" colspan="1"><strong id='bold17841' >warning-notify</strong><em id='it17842' > err</em></td><td id="tc17844" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> Display a message describing the error or warning on the default error port. </td></tr> </tbody></table><br/> </div><br> <!-- Exceptions --> <a name="Exceptions"></a> <div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">16.2 Exceptions</font> </h3></td></tr></table> </div><div class="section"> <a name="Exceptions" class="mark"></a><a name="g17849" class="mark"></a><a name="g17851" class="mark"></a><a name="g17853" class="mark"></a> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17856" class="mark"></a><a name="current-exception-handler" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17860" align="left" colspan="1"><strong id='bold17858' >current-exception-handler</strong><em id='it17859' ></em></td><td id="tc17861" align="right" colspan="1">SRFI-18 function</td></tr> </tbody></table> Returns the current exception handler with is a 0-ary procedure. </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17867" class="mark"></a><a name="with-exception-handler" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17871" align="left" colspan="1"><strong id='bold17869' >with-exception-handler</strong><em id='it17870' > handler thunk</em></td><td id="tc17872" align="right" colspan="1">SRFI-18 function</td></tr> </tbody></table> Returns the result(s) of calling <code id='code17876' ><em id='it17875' >thunk</em></code> with no arguments. The <code id='code17878' ><em id='it17877' >handler</em></code>, which must be a procedure, is installed as the current exception handler in the dynamic environment in effect during the call to <code id='code17880' ><em id='it17879' >thunk</em></code>. When possible, prefer <code id='code17881' >with-handler</code> to <code id='code17882' >with-exception-handler</code> because the former is more efficient than the latter. </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17886" class="mark"></a><a name="with-handler" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17890" align="left" colspan="1"><strong id='bold17888' >with-handler</strong><em id='it17889' > handler body</em></td><td id="tc17891" align="right" colspan="1">bigloo form</td></tr> </tbody></table> Returns the result(s) of evaluating <code id='code17895' ><em id='it17894' >body</em></code>. The <code id='code17897' ><em id='it17896' >handler</em></code>, which must be a procedure, is installed as the current exception handler in the dynamic environment in effect during the evaluation of <code id='code17899' ><em id='it17898' >body</em></code>. Contrarily to <code id='code17900' >with-exception-handler</code>, if an exception is raised, the <code id='code17902' ><em id='it17901' >handler</em></code> is invoked and the value of the <code id='code17903' >with-handler</code> form is the value produced by invoking the <code id='code17905' ><em id='it17904' >handler</em></code>.<br/><br/>JVM note: When executed within a JVM, the form <code id='code17907' >with-handler</code> also catches Java exceptions.<br/><br/>The form <code id='code17909' >with-handler</code> is intrinsically more efficient than the function <code id='code17910' >with-exception-handler</code>. From a semantics point of view, <code id='code17911' >with-handler</code> could be re-written in terms of <code id='code17912' >with-exception-handler</code> such as:<br/><br/><center id='center17920' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17918' >(<font color="red"><strong id='bold28631' >with-handler</strong></font> handler1 body1) <=> (<font color="red"><strong id='bold28633' >bind-exit</strong></font> (exit) (with-exception-handler (<strong id='bold28635' >lambda</strong> (e) (exit (handler1 e))) (<strong id='bold28636' >lambda</strong> () body))) </pre> </td></tr> </tbody></table></center> It should be noted that the error handler is executed before the execution stack is unwound. Hence, error handlers are executed before protected blocks. For instance in the following code:<br/><br/><center id='center17927' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17925' >(<font color="red"><strong id='bold28637' >with-handler</strong></font> (<strong id='bold28639' >lambda</strong> (e) action) (<font color="red"><strong id='bold28640' >unwind-protect</strong></font> body protect)) </pre> </td></tr> </tbody></table></center> The <code id='code17929' ><em id='it17928' >action</em></code> is executed <em id='emph17930' >before</em> <code id='code17932' ><em id='it17931' >protect</em></code>.<br/><br/></td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g17937" class="mark"></a><a name="raise" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc17941" align="left" colspan="1"><strong id='bold17939' >raise</strong><em id='it17940' > obj</em></td><td id="tc17942" align="right" colspan="1">SRFI-18 function</td></tr> </tbody></table> Calls the current exception handler with obj as the single argument. obj may be any Scheme object. Note that invoking the current handler does not escape from the current computation. It is up the to handler to perform the escape. It an error, signaled by the runtime system, if the current exception handler returns.<br/><br/><center id='center17962' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17960' >(<font color="#6959cf"><strong id='bold28642' >define</strong></font> (<font color="#6959cf"><strong id='bold28644' >f</strong></font> n) (<strong id='bold28646' >if</strong> (< n 0) (<font color="red"><strong id='bold28647' >raise</strong></font> <font color="red">"negative arg"</font>) (sqrt n))))<br/><br/>(<font color="#6959cf"><strong id='bold28650' >define</strong></font> (<font color="#6959cf"><strong id='bold28652' >g</strong></font>) (<font color="red"><strong id='bold28654' >bind-exit</strong></font> (return) (with-exception-handler (<strong id='bold28656' >lambda</strong> (exc) (return (<strong id='bold28657' >if</strong> (string? exc) (string-append <font color="red">"error: "</font> exc) <font color="red">"unknown error"</font>))) (<strong id='bold28660' >lambda</strong> () (write (f 4.)) (write (f -1.)) (write (f 9.))))))<br/><br/>(g) -| 2. and returns <font color="red">"error: negative arg"</font> </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> The standard Bigloo runtime system uses the following classes for signaling errors and warnings:<br/><br/><ul class="itemize" id='itemize18139' ><li><code id='code17966' >&exception</code> which is defined as: <a name="g17967" class="mark"></a><center id='center17972' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17970' >(<strong id='bold28662' >class</strong> &exception (fname read-only (default #f)) (location read-only (default #f))) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code17974' >&error</code> defined as: <a name="g17975" class="mark"></a><center id='center17981' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17979' >(<strong id='bold28663' >class</strong> &error<font color="#00cf00"><strong id='bold28664' >::&exception</strong></font> (proc read-only) (msg read-only) (obj read-only)) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code17983' >&type-error</code> defined as: <a name="g17984" class="mark"></a> <center id='center17991' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17989' >(<strong id='bold28666' >class</strong> &type-error<font color="#00cf00"><strong id='bold28667' >::&error</strong></font> (<strong id='bold28669' >type</strong> read-only)) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code17993' >&io-error</code> defined as: <a name="g17994" class="mark"></a> <center id='center18000' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog17998' >(<strong id='bold28670' >class</strong> &io-error<font color="#00cf00"><strong id='bold28671' >::&error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18002' >&io-port-error</code> defined as: <a name="g18003" class="mark"></a> <center id='center18009' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18007' >(<strong id='bold28673' >class</strong> &io-port-error<font color="#00cf00"><strong id='bold28674' >::&io-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18011' >&io-read-error</code> defined as: <a name="g18012" class="mark"></a> <center id='center18018' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18016' >(<strong id='bold28676' >class</strong> &io-read-error<font color="#00cf00"><strong id='bold28677' >::&io-port-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18020' >&io-write-error</code> defined as: <a name="g18021" class="mark"></a> <center id='center18027' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18025' >(<strong id='bold28679' >class</strong> &io-write-error<font color="#00cf00"><strong id='bold28680' >::&io-port-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18029' >&io-closed-error</code> defined as: <a name="g18030" class="mark"></a> <center id='center18036' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18034' >(<strong id='bold28682' >class</strong> &io-closed-error<font color="#00cf00"><strong id='bold28683' >::&io-port-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18038' >&io-file-not-found-error</code> defined as: <a name="g18039" class="mark"></a> <center id='center18045' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18043' >(<strong id='bold28685' >class</strong> &io-file-not-found-error<font color="#00cf00"><strong id='bold28686' >::&io-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18047' >&io-parse-error</code> defined as: <a name="g18048" class="mark"></a> <center id='center18054' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18052' >(<strong id='bold28688' >class</strong> &io-parse-error<font color="#00cf00"><strong id='bold28689' >::&io-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18056' >&io-unknown-host-error</code> defined as: <a name="g18057" class="mark"></a> <center id='center18063' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18061' >(<strong id='bold28691' >class</strong> &io-unknown-host-error<font color="#00cf00"><strong id='bold28692' >::&io-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18065' >&io-malformed-url-error</code> defined as: <a name="g18066" class="mark"></a> <center id='center18072' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18070' >(<strong id='bold28694' >class</strong> &io-malformed-url-error<font color="#00cf00"><strong id='bold28695' >::&io-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18074' >&http-error</code> defined as: <a name="g18075" class="mark"></a> <center id='center18081' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18079' >(<strong id='bold28697' >class</strong> &http-error<font color="#00cf00"><strong id='bold28698' >::&error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18083' >&http-redirection-error</code> defined as: <a name="g18084" class="mark"></a> <center id='center18090' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18088' >(<strong id='bold28700' >class</strong> &http-redirection-error<font color="#00cf00"><strong id='bold28701' >::&http-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18092' >&http-status-error</code> defined as: <a name="g18093" class="mark"></a> <center id='center18099' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18097' >(<strong id='bold28703' >class</strong> &http-status-error<font color="#00cf00"><strong id='bold28704' >::&http-error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18101' >&http-redirection</code> defined as: <a name="g18102" class="mark"></a> <center id='center18110' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18108' >(<strong id='bold28706' >class</strong> &http-redirection<font color="#00cf00"><strong id='bold28707' >::&exception</strong></font> (port<font color="#00cf00"><strong id='bold28709' >::input-port</strong></font> read-only) (url<font color="#00cf00"><strong id='bold28711' >::bstring</strong></font> read-only)) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18112' >&process-exception</code> defined as: <a name="g18113" class="mark"></a> <center id='center18119' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18117' >(<strong id='bold28713' >class</strong> &process-exception<font color="#00cf00"><strong id='bold28714' >::&error</strong></font>) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18121' >&warning</code> defined as: <a name="g18122" class="mark"></a> <center id='center18128' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18126' >(<strong id='bold28716' >class</strong> &warning<font color="#00cf00"><strong id='bold28717' >::&exception</strong></font> (args read-only)) </pre> </td></tr> </tbody></table></center> </li> <li><code id='code18130' >&eval-warning</code> defined as: <a name="g18131" class="mark"></a> <center id='center18137' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18135' >(<strong id='bold28719' >class</strong> &warning<font color="#00cf00"><strong id='bold28720' >::&warning</strong></font>) </pre> </td></tr> </tbody></table></center> </li> </ul> </div><br> <!-- Deprecated try form --> <a name="Deprecated-try-form"></a> <div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">16.3 Deprecated try form</font> </h3></td></tr></table> </div><div class="section"> <a name="Try" class="mark"></a> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18142" align="left" colspan="1"><strong id='bold18140' >try</strong><em id='it18141' > exp handler</em></td><td id="tc18143" align="right" colspan="1">bigloo syntax</td></tr> </tbody></table> This form is deprecated. As much as possible, it should be replaced with true exceptions (i.e., <code id='code18146' >with-exception-handler</code> and <code id='code18147' >raise</code>). The argument <code id='code18149' ><em id='it18148' >exp</em></code> is evaluated. If an error is raised, the <code id='code18151' ><em id='it18150' >handler</em></code> is called. The argument <code id='code18153' ><em id='it18152' >handler</em></code> is a procedure of four arguments. Its first argument is the continuation of <code id='code18155' ><em id='it18154' >try</em></code>. The other arguments are <code id='code18157' ><em id='it18156' >proc</em></code>, <code id='code18159' ><em id='it18158' >mes</em></code> and <code id='code18161' ><em id='it18160' >obj</em></code>. Invoking the first argument will resume after the error.<br/><br/><center id='center18172' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18170' >(<strong id='bold28722' >let</strong> ((handler (<strong id='bold28723' >lambda</strong> (escape proc mes obj) (print <font color="red">"***ERROR:"</font> proc <font color="red">":"</font> mes <font color="red">" -- "</font> obj) (escape #f)))) (try (car 1) handler)) -| ***ERROR<strong id='bold28727' >:CAR</strong><strong id='bold28729' >:not</strong> a pair -- 1 => #f </pre> </td></tr> </tbody></table></center> The argument <code id='code18174' ><em id='it18173' >handler</em></code> is not evaluated in the dynamic scope of its <code id='code18175' >try</code> form. That is:<br/><br/><center id='center18183' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18181' >(<strong id='bold28731' >let</strong> ((handler (<strong id='bold28732' >lambda</strong> (escape proc mes obj) (escape (car obj))))) (try (car 1) handler)) error--> *** ERROR<strong id='bold28733' >:bigloo</strong><strong id='bold28735' >:CAR</strong> Type `PAIR' expected, `BINT' provided -- 1 </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> Some library functions exist to help in writing handlers:<br/><br/><table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g18188" class="mark"></a><a name="warning" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18192" align="left" colspan="1"><strong id='bold18190' >warning</strong><em id='it18191' > [arg]...</em></td><td id="tc18193" align="right" colspan="1">bigloo procedure</td></tr> </tbody></table> This form signals a warning. That is, is <code id='code18197' ><em id='it18196' >arg</em></code> are displayed on the standard error port.<br/><br/><center id='center18210' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18208' >(<font color="#6959cf"><strong id='bold28737' >define</strong></font> (<font color="#6959cf"><strong id='bold28739' >foo</strong></font> l) (<strong id='bold28741' >if</strong> (not (pair? l)) (<strong id='bold28742' >begin</strong> (<font color="red"><strong id='bold28743' >warning</strong></font> <font color="red">"foo:"</font> <font color="red">"argument not a pair -- "</font> l) '()) (car l)))<br/><br/>(foo 4) -| *** WARNING<strong id='bold28747' >:bigloo</strong><strong id='bold28749' >:foo</strong>: argument not a pair -- 4 => '() </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> </div><br> <!-- Assertions --> <a name="Assertions"></a> <div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">16.4 Assertions</font> </h3></td></tr></table> </div><div class="section"> <a name="Assertions" class="mark"></a> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g18214" class="mark"></a><a name="assert" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18218" align="left" colspan="1"><strong id='bold18216' >assert</strong><em id='it18217' > (var...) s-expression</em></td><td id="tc18219" align="right" colspan="1">bigloo syntax</td></tr> </tbody></table> Assertions can be enabled or disabled using Bigloo's compilation flags <code id='code18222' >-g</code> flag to enable them). If the assertions are disabled they are not evaluated. If an assertion is evaluated, if the expression <code id='code18224' ><em id='it18223' >exp</em></code> does not evaluate to <code id='code18225' >#t</code>, an error is signaled and the interpreter is launched in an environment where <code id='code18227' ><em id='it18226' >var</em></code>... are bound to their current values.<br/><br/>Assertion forms are legal expressions which <em id='emph18229' >always</em> evaluate to the <code id='code18230' >unspecified</code> object.<br/><br/>Here is an example of assertion usage:<br/><br/><center id='center18245' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18243' >(<font color="#1919af"><strong id='bold28751' >module</strong></font> <font color="#1919af"><strong id='bold28753' >foo</strong></font> (eval (<font color="#1919af"><strong id='bold28755' >export</strong></font> <font color="#1919af"><strong id='bold28757' >foo</strong></font>)))<br/><br/>(<font color="#6959cf"><strong id='bold28759' >define</strong></font> (<font color="#6959cf"><strong id='bold28761' >foo</strong></font> x y) [assert (x y) (< x y)] (<strong id='bold28763' >labels</strong> ((gee (t) [assert (t) (>= t 0)] (<strong id='bold28764' >let</strong> ((res (+ x t))) [assert (res t) (> res 10)] res))) (<strong id='bold28765' >set!</strong> x (gee y)) [assert (x) (> x 10)] x))<br/><br/>(repl) </pre> </td></tr> </tbody></table></center> This module is compiled with the <code id='code18246' >-g</code> flag to enable assertions, then the produced executable is run:<br/><br/><center id='center18254' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ccffcc"><pre class="prog" id='prog18252' >$ a.out<br/><br/>1:=> (foo 1 2)<br/><br/>File "foo.scm", line 9, character 158: # [assert (res t) (> res 10)] # ^ # *** ERROR:bigloo:assert # assertion failed -- (BEGIN (> RES 10)) 0. GEE 1. FOO ----------------------- Variables' value are : RES : 3 T : 2 ----------------------- *:=> ^D File "foo.scm", line 12, character 228: # [assert (x) (> x 10)] # ^ # *** ERROR:bigloo:assert # assertion failed -- (BEGIN (> X 10)) 0. FOO ----------------------- Variables' value are : X : 3 -----------------------<br/><br/>*:=> 3 1:=> (foo 1 2) File "foo.scm", line 9, character 158: # [assert (res t) (> res 10)] # ^ # *** ERROR:bigloo:assert # assertion failed -- (BEGIN (> RES 10)) 0. GEE 1. FOO ----------------------- Variables' value are : RES : 3 T : 2 -----------------------<br/><br/>*:=> </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> </div><br> <!-- Tracing --> <a name="Tracing"></a> <div class="section-atitle"><table width="100%"><tr><td bgcolor="#dedeff"><h3><font color="black">16.5 Tracing</font> </h3></td></tr></table> </div><div class="section"> <a name="Tracing" class="mark"></a><a name="g18257" class="mark"></a><a name="g18259" class="mark"></a> Bigloo provides a trace facility whose is intended for simple debugging tasks. It is a replacement for user <code id='code18261' >display</code>s that clutters the source code. Here is a typical example using it:<br/><br/><center id='center18271' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18269' >(<font color="#6959cf"><strong id='bold28766' >define</strong></font> (<font color="#6959cf"><strong id='bold28768' >foo</strong></font> x) (with-trace 1 'foo (<strong id='bold28770' >let</strong> loop ((n x)) (with-trace 2 'loop (trace-item <font color="red">"n="</font> n) (when (> n 0) (<strong id='bold28772' >let</strong> liip ((m n)) (with-trace 2 'liip (trace-item <font color="red">"m="</font> m)) (when (> m 0) (liip (- m 1)))) (loop (- n 1)))))))<br/><br/>(foo 3) </pre> </td></tr> </tbody></table></center> which produces the following output:<br/><br/><center id='center18275' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ccccff"><pre class="prog" id='prog18273' >+ foo |--+ loop | |- n=3 | |--+ liip | | |- m=3 | |--+ liip | | |- m=2 | |--+ liip | | |- m=1 | |--+ liip | | |- m=0 | |--+ loop | | |- n=2 | | |--+ liip | | | |- m=2 | | |--+ liip | | | |- m=1 | | |--+ liip | | | |- m=0 | | |--+ loop | | | |- n=1 | | | |--+ liip | | | | |- m=1 | | | |--+ liip | | | | |- m=0 | | | |--+ loop | | | | |- n=0 </pre> </td></tr> </tbody></table></center> Traces generation is controlled by a set of functions and parameters (see <a href="bigloo-24.html#Parameters" class="inbound">Parameters</a>). The functions are described in this chapter.<br/><br/><table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g18278" class="mark"></a><a name="with-trace" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18282" align="left" colspan="1"><strong id='bold18280' >with-trace</strong><em id='it18281' > level label . body</em></td><td id="tc18283" align="right" colspan="1">bigloo syntax</td></tr> </tbody></table> The variable <code id='code18287' ><em id='it18286' >level</em></code> is the level of a trace. It is a positive integer. It enables simple filtering for traces. A trace is displayed if and only if the debugging level used to compile or to execute the program is greater than the trace level. The variable <code id='code18289' ><em id='it18288' >label</em></code> is a label, .e.i., an identifier denoting the trace. This identifier will be displayed in debug mode. The variable <code id='code18291' ><em id='it18290' >body</em></code> is the body of the form, that is, the expression to be evaluated.<br/><br/>Unless a trace is activated <code id='code18293' >(with-trace lv la body)</code> (when its level <code id='code18295' ><em id='it18294' >lv</em></code> is greater than the current debug level) is equivalent to <code id='code18296' >(begin body)</code>. When traces are activated, before executing <code id='code18298' ><em id='it18297' >body</em></code>.<br/><br/>The debugging level is controlled by two parameters: <code id='code18300' >bigloo-debug</code> and <code id='code18301' >bigloo-compiler-debug</code> (see <a href="bigloo-24.html#Parameters" class="inbound">Parameters</a>).<br/><br/></td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g18306" class="mark"></a><a name="trace-item" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18310" align="left" colspan="1"><strong id='bold18308' >trace-item</strong><em id='it18309' > . args</em></td><td id="tc18311" align="right" colspan="1">bigloo function</td></tr> </tbody></table> This function displays all its arguments. It has to be used nested in a <code id='code18315' ><em id='it18314' >with-trace</em></code> form. </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g18319" class="mark"></a><a name="trace-bold" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18323" align="left" colspan="1"><strong id='bold18321' >trace-bold</strong><em id='it18322' > s</em></td><td id="tc18324" align="right" colspan="1">bigloo function</td></tr> </tbody></table> <a name="g18328" class="mark"></a><a name="trace-string" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18332" align="left" colspan="1"><strong id='bold18330' >trace-string</strong><em id='it18331' > s</em></td><td id="tc18333" align="right" colspan="1">bigloo function</td></tr> </tbody></table> These two functions are provided for convenience. They returns strings made of their parameters. </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g18339" class="mark"></a><a name="trace-color" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18343" align="left" colspan="1"><strong id='bold18341' >trace-color</strong><em id='it18342' > color . args</em></td><td id="tc18344" align="right" colspan="1">bigloo function</td></tr> </tbody></table> The <code id='code18348' ><em id='it18347' >color</em></code> argument is a positive integer. This function returns a string which is the representation of <code id='code18350' ><em id='it18349' >args</em></code> and that appears on the terminal in color <code id='code18352' ><em id='it18351' >color</em></code>.<br/><br/>Colors can be enable or disabled using the <code id='code18354' >bigloo-trace-color</code> parameter (see <a href="bigloo-24.html#Parameters" class="inbound">Parameters</a>). </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g18358" class="mark"></a><a name="trace-margin" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18362" align="left" colspan="1"><strong id='bold18360' >trace-margin</strong><em id='it18361' ></em></td><td id="tc18363" align="right" colspan="1">bigloo function</td></tr> </tbody></table> <a name="g18367" class="mark"></a><a name="trace-margin-set!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18371" align="left" colspan="1"><strong id='bold18369' >trace-margin-set!</strong><em id='it18370' ></em></td><td id="tc18372" align="right" colspan="1">bigloo function</td></tr> </tbody></table> The <code id='code18376' ><em id='it18375' >trace-margin</em></code> parameter is used to control the characters that are displayed in the margin of a trace. Usual applications should not use this. However, it may be convenient to set the margin by hands in some context. For instance, it can be used to distinguished threads in a multi-threaded application such as:<br/><br/><center id='center18386' ><table cellspacing="0" class="color" cellpadding="0" width="95%"><tbody> <tr><td bgcolor="#ffffcc"><pre class="prog" id='prog18384' >(<font color="#ad4386"><strong id='bold28774' >make-thread</strong></font> (<strong id='bold28776' >lambda</strong> () (trace-margin-set! (trace-color 1 <font color="red">"="</font>)) ...)) (<font color="#ad4386"><strong id='bold28778' >make-thread</strong></font> (<strong id='bold28780' >lambda</strong> () (trace-margin-set! (trace-color 2 <font color="red">"="</font>)) ...)) </pre> </td></tr> </tbody></table></center> </td></tr> </tbody></table><br/> <table cellspacing="0" class="frame" cellpadding="10" border="1" width="100%"><tbody> <tr><td><a name="g18390" class="mark"></a><a name="trace-port" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18394" align="left" colspan="1"><strong id='bold18392' >trace-port</strong><em id='it18393' ></em></td><td id="tc18395" align="right" colspan="1">bigloo function</td></tr> </tbody></table> <a name="g18399" class="mark"></a><a name="trace-port-set!" class="mark"></a><table width="100%" style="border-collapse: collapse;" frame="void" rules="none"><tbody> <tr><td id="tc18403" align="left" colspan="1"><strong id='bold18401' >trace-port-set!</strong><em id='it18402' ></em></td><td id="tc18404" align="right" colspan="1">bigloo function</td></tr> </tbody></table> These functions return and set the output port used by traces. </td></tr> </tbody></table><br/><br/><br/> </div><br> </div></td> </tr></table><div class="skribe-ending"> <hr> <p class="ending" id='paragraph28787' ><font size="-1"> This <span class="sc">Html</span> page has been produced by <a href="http://www.inria.fr/mimosa/fp/Skribe" class="http">Skribe</a>. <br/> Last update <em id='it28785' >Tue Jun 2 11:43:27 2009</em>.</font></p></div> </body> </html>