<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://www.hodique.info/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="http://www.hodique.info/feed.php">
        <title>Yann Hodique</title>
        <description></description>
        <link>http://www.hodique.info/</link>
        <image rdf:resource="http://www.hodique.info/lib/images/favicon.ico" />
       <dc:date>2010-03-10T23:53:14+01:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://www.hodique.info/blog/2010/02/18/python_webservice_part_2_a_twistd_integration"/>
                <rdf:li rdf:resource="http://www.hodique.info/sidebar"/>
                <rdf:li rdf:resource="http://www.hodique.info/projects/emacs"/>
                <rdf:li rdf:resource="http://www.hodique.info/projects/cl_ants"/>
                <rdf:li rdf:resource="http://www.hodique.info/tags/tutorial_lisp_bindings"/>
                <rdf:li rdf:resource="http://www.hodique.info/articles/lisposd"/>
                <rdf:li rdf:resource="http://www.hodique.info/tags/zsi"/>
                <rdf:li rdf:resource="http://www.hodique.info/tags/twisted"/>
                <rdf:li rdf:resource="http://www.hodique.info/tags/test"/>
                <rdf:li rdf:resource="http://www.hodique.info/tags/python"/>
                <rdf:li rdf:resource="http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution"/>
                <rdf:li rdf:resource="http://www.hodique.info/blog/2010/02/14/magit_extensions"/>
                <rdf:li rdf:resource="http://www.hodique.info/blog"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="http://www.hodique.info/lib/images/favicon.ico">
        <title>Yann Hodique</title>
        <link>http://www.hodique.info/</link>
        <url>http://www.hodique.info/lib/images/favicon.ico</url>
    </image>
    <item rdf:about="http://www.hodique.info/blog/2010/02/18/python_webservice_part_2_a_twistd_integration">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-19T00:01:46+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>Python Webservice, part 2 : a twistd integration</title>
        <link>http://www.hodique.info/blog/2010/02/18/python_webservice_part_2_a_twistd_integration</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;


&lt;div class=&quot;styler styler-float-left&quot;&gt;
&lt;p&gt;
&lt;span class=&quot;vcard&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=15d77b&amp;amp;cache=recache&amp;amp;media=http%3A%2F%2Fwww.gravatar.com%2Favatar.php%3Fgravatar_id%3Dd9b955e7af49b0cbfd68c15947b25012%26default%3Dhttp%253A%252F%252Fwww.hodique.info%252Flib%252Fexe%252Ffetch.php%253Fhash%253Dd44619%2526cache%253Drecache%2526media%253Dhttp%25253A%25252F%25252Fwww.hodique.info%25252F%25252Flib%25252Fplugins%25252Favatar%25252Fmonsterid.php%25253Fseed%25253Dd9b955e7af49b0cbfd68c15947b25012%252526size%25253D40%252526.png%26size%3D40%26rating%3DR%26.jpg&quot; class=&quot;media photo fn&quot; title=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; alt=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; width=&quot;40&quot; height=&quot;40&quot; /&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;


&lt;/div&gt;
&lt;!-- SECTION &quot;Python Webservice, part 2 : a twistd integration&quot; [1-126] --&gt;
&lt;h2&gt;&lt;a name=&quot;twistd&quot; id=&quot;twistd&quot;&gt;Twistd&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
In my &lt;a href=&quot;http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:17:python_webservice_part_1_a_twisted_solution&quot;&gt;previous post&lt;/a&gt; I&amp;#039;ve explained how to generate a &lt;acronym title=&quot;Simple Object Access Protocol&quot;&gt;SOAP&lt;/acronym&gt; service from a WSDL file, and how to implement the required methods properly. A solution to run such a service is to use the Twisted Daemon, aka &lt;code&gt;twistd&lt;/code&gt;.
Though not needed, strictly speaking, it provides a nice &lt;a href=&quot;http://twistedmatrix.com/documents/current/core/howto/basics.html&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com/documents/current/core/howto/basics.html&quot;  rel=&quot;nofollow&quot;&gt;set of features&lt;/a&gt; aimed at easing complex applications development.
&lt;/p&gt;

&lt;p&gt;
In particular, it allows to write so-called &lt;a href=&quot;http://twistedmatrix.com/documents/current/core/howto/tap.html&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com/documents/current/core/howto/tap.html&quot;  rel=&quot;nofollow&quot;&gt;plugins&lt;/a&gt; that make it possible to just launch services in the following way:

&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;$ twistd &lt;span class=&quot;kw3&quot;&gt;echo&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
To achieve that, one has to create a file &lt;code&gt;twisted/plugins/echo.py&lt;/code&gt; accessible somewhere from the python path (that is, the &lt;code&gt;twisted&lt;/code&gt; directory should be a subdir of an element of the path).
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Twistd&quot; [127-1036] --&gt;
&lt;h2&gt;&lt;a name=&quot;manhole&quot; id=&quot;manhole&quot;&gt;Manhole&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Twisted offers a nice service, that can be used to provide an inspection/debug interface for your main application. This is called &lt;a href=&quot;http://twistedmatrix.com/documents/9.0.0/api/twisted.manhole.html&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com/documents/9.0.0/api/twisted.manhole.html&quot;  rel=&quot;nofollow&quot;&gt;manhole&lt;/a&gt; and provides a python interpreter interface. This way you can just telnet/ssh the manhole, and execute appropriate commands to introspect the current state of the application, or put it in the desired state.
&lt;/p&gt;

&lt;p&gt;
A nice example of a really useful function to run from the manhole service is the &lt;a href=&quot;http://twistedmatrix.com/documents/9.0.0/api/twisted.python.rebuild.html&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com/documents/9.0.0/api/twisted.python.rebuild.html&quot;  rel=&quot;nofollow&quot;&gt;rebuild&lt;/a&gt; one. It tries very hard to provide in-place reloading of code (and corresponding objects). Don&amp;#039;t expect any wonder here, it will fail in some corner cases. Still, it proves really useful most of the time, and helps a lot not restarting the server every now and then.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Manhole&quot; [1037-1910] --&gt;
&lt;h2&gt;&lt;a name=&quot;example&quot; id=&quot;example&quot;&gt;Example&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Here is a fully working example of a twistd plugin for the Echo service, with a functional manhole service in addition.
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; zope.&lt;span class=&quot;me1&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; implements
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; usage
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;python&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;rebuild&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; rebuild
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;plugin&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; IPlugin
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;application&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; IServiceMaker, MultiService
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;application&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;internet&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; TCPServer
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;web&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; Site
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;web&lt;/span&gt;.&lt;span class=&quot;kw3&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; Resource
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;conch&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;manhole_tap&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; makeService &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; makeConsoleService
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; EchoImpl &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; EchoService
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoOptions&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;usage.&lt;span class=&quot;me1&quot;&gt;Options&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
    optParameters = &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;port&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8080&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;main port&amp;quot;&lt;/span&gt;, &lt;span class=&quot;kw2&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;,
                     &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;service-port&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8081&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;service port&amp;quot;&lt;/span&gt;, &lt;span class=&quot;kw2&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;,
                     &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;service-users&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;/etc/passwd&amp;quot;&lt;/span&gt;,
                      &lt;span class=&quot;st0&quot;&gt;&amp;quot;The path to a passwd-like authentication file&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoServiceMaker&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
    implements&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;IServiceMaker, IPlugin&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    tapname = &lt;span class=&quot;st0&quot;&gt;&amp;quot;echo&amp;quot;&lt;/span&gt;
    description = &lt;span class=&quot;st0&quot;&gt;&amp;quot;Sample Echo service&amp;quot;&lt;/span&gt;
    options = EchoOptions
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; makeService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, options&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span class=&quot;co1&quot;&gt;# Create Service&lt;/span&gt;
        srv = EchoService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        root = Resource&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;co1&quot;&gt;# we'll serve Echo at http://&amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;/echo&lt;/span&gt;
        root.&lt;span class=&quot;me1&quot;&gt;putChild&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'echo'&lt;/span&gt;, srv&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        siteFactory = Site&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;root&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        echo_service = TCPServer&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;options&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'port'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;, siteFactory&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        console_service = makeConsoleService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;telnetPort&amp;quot;&lt;/span&gt;: &lt;span class=&quot;kw2&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;options&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'service-port'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
             &lt;span class=&quot;st0&quot;&gt;&amp;quot;sshPort&amp;quot;&lt;/span&gt;: &lt;span class=&quot;kw2&quot;&gt;None&lt;/span&gt;,
             &lt;span class=&quot;st0&quot;&gt;&amp;quot;namespace&amp;quot;&lt;/span&gt;: &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;service&amp;quot;&lt;/span&gt;: srv,
                           &lt;span class=&quot;st0&quot;&gt;&amp;quot;rebuild&amp;quot;&lt;/span&gt;: rebuild&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;,
             &lt;span class=&quot;st0&quot;&gt;&amp;quot;passwd&amp;quot;&lt;/span&gt;: options&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'service-users'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        svc = MultiService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        echo_service.&lt;span class=&quot;me1&quot;&gt;setServiceParent&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;svc&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        console_service.&lt;span class=&quot;me1&quot;&gt;setServiceParent&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;svc&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; svc
&amp;nbsp;
serviceMaker = EchoServiceMaker&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
The code is hopefully rather straightforward. It should be noted that the manhole service (created by the &lt;code&gt;makeConsoleService()&lt;/code&gt; call) needs to know about a set of objects (the “namespace” key). Those objects are the roots for everything accessible from the service. Here, the main service object (the &lt;code&gt;srv&lt;/code&gt; object) is available to the manhole under the name &lt;code&gt;service&lt;/code&gt;. Here is how it can be used:
&lt;/p&gt;
&lt;pre class=&quot;code shell&quot;&gt;$ telnet localhost 8081
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Username: yann
Password: x
&amp;nbsp;
&amp;gt;&amp;gt;&amp;gt; print service
&amp;lt;EchoImpl.EchoService object at 0x2fc8c10&amp;gt;
&amp;gt;&amp;gt;&amp;gt;&lt;/pre&gt;

&lt;p&gt;
Hint: the password is really &amp;#039;x&amp;#039;, as I&amp;#039;m using /etc/passwd by default, which contains &amp;#039;x&amp;#039; for every “password” field, since the real passwords are in /etc/shadow.
Convenient for a dev deployment ;)
&lt;/p&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Example&quot; [1911-] --&gt;&lt;span class=&quot;plugin_feedmod_comments&quot;&gt;
  &lt;a href=&quot;http://www.hodique.info/blog/2010/02/18/python_webservice_part_2_a_twistd_integration#discussion__section&quot; title=&quot;Read or add comments to this article&quot;&gt;Read or add comments to this article&lt;/a&gt;
&lt;/span&gt;
</description>
    </item>
    <item rdf:about="http://www.hodique.info/sidebar">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T14:37:25+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>Site Map</title>
        <link>http://www.hodique.info/sidebar</link>
        <description>
&lt;p&gt;
&lt;a href=&quot;http://www.linkedin.com/in/hodique&quot; class=&quot;media&quot; title=&quot;http://www.linkedin.com/in/hodique&quot;  rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=979c51&amp;amp;media=http%3A%2F%2Fwww.linkedin.com%2Fimg%2Fwebpromo%2Fbtn_viewmy_160x33.gif&quot; class=&quot;media&quot; title=&quot;View Yann Hodique&amp;#039;s profile on LinkedIn&quot; alt=&quot;View Yann Hodique&amp;#039;s profile on LinkedIn&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;



&lt;div class=&quot;level1&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/home&quot; class=&quot;wikilink1&quot; title=&quot;home&quot;&gt;Home Page&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/wiki/syntax&quot; class=&quot;wikilink1&quot; title=&quot;wiki:syntax&quot;&gt;Wiki help&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/playground/playground&quot; class=&quot;wikilink1&quot; title=&quot;playground:playground&quot;&gt;Sandbox&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Site Map&quot; [144-259] --&gt;
&lt;h1&gt;&lt;a name=&quot;professional&quot; id=&quot;professional&quot;&gt;Professional&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/cv&quot; class=&quot;wikilink1&quot; title=&quot;public:cv&quot;&gt;Curriculum Vitae&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/works&quot; class=&quot;wikilink1&quot; title=&quot;public:works&quot;&gt;University Works&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/abstract&quot; class=&quot;wikilink1&quot; title=&quot;public:abstract&quot;&gt;Thesis Abstract&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/subject&quot; class=&quot;wikilink1&quot; title=&quot;public:subject&quot;&gt;Thesis Subject (french)&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/realtime_scheduler&quot; class=&quot;wikilink1&quot; title=&quot;public:realtime_scheduler&quot;&gt;Realtime scheduler&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/escape_analysis&quot; class=&quot;wikilink1&quot; title=&quot;public:escape_analysis&quot;&gt;Escape analysis&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/bibliography&quot; class=&quot;wikilink1&quot; title=&quot;public:bibliography&quot;&gt;Bibliography&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/teaching&quot; class=&quot;wikilink1&quot; title=&quot;public:teaching&quot;&gt;Teaching&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/initc&quot; class=&quot;wikilink1&quot; title=&quot;public:initc&quot;&gt;InitC&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/cunixfc&quot; class=&quot;wikilink1&quot; title=&quot;public:cunixfc&quot;&gt;PSys&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/public/shellprogrammingfc&quot; class=&quot;wikilink1&quot; title=&quot;public:shellprogrammingfc&quot;&gt;Shell&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Professional&quot; [260-733] --&gt;
&lt;h1&gt;&lt;a name=&quot;personal&quot; id=&quot;personal&quot;&gt;Personal&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/user/yann_hodique&quot; class=&quot;wikilink1&quot; title=&quot;user:yann_hodique&quot;&gt;About Me&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/blog&quot; class=&quot;wikilink1&quot; title=&quot;blog&quot;&gt;Blog&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/docs/index&quot; class=&quot;wikilink1&quot; title=&quot;docs:index&quot;&gt;Documentation&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/projects/index&quot; class=&quot;wikilink1&quot; title=&quot;projects:index&quot;&gt;Projects&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/projects/bibtex_plugin&quot; class=&quot;wikilink1&quot; title=&quot;projects:bibtex_plugin&quot;&gt;BibTeX plugin&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/projects/emacs&quot; class=&quot;wikilink1&quot; title=&quot;projects:emacs&quot;&gt;Emacs contribs&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/articles/index&quot; class=&quot;wikilink1&quot; title=&quot;articles:index&quot;&gt;Articles&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Personal&quot; [734-998] --&gt;
&lt;h1&gt;&lt;a name=&quot;books&quot; id=&quot;books&quot;&gt;Books&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/books/best&quot; class=&quot;wikilink1&quot; title=&quot;books:best&quot;&gt;Best books ever&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/books/read&quot; class=&quot;wikilink1&quot; title=&quot;books:read&quot;&gt;Read list&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/books/toread&quot; class=&quot;wikilink1&quot; title=&quot;books:toread&quot;&gt;To read list&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Books&quot; [999-1117] --&gt;
&lt;h1&gt;&lt;a name=&quot;tags&quot; id=&quot;tags&quot;&gt;Tags&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;
&lt;div id=&quot;cloud&quot;&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/bibtex&quot; class=&quot;cloud1_tag1&quot; title=&quot;tags:bibtex&quot;&gt;bibtex&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/bzr&quot; class=&quot;cloud1_tag1&quot; title=&quot;tags:bzr&quot;&gt;bzr&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;cloud5_tag1&quot; title=&quot;tags:code&quot;&gt;code&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/config&quot; class=&quot;cloud2_tag1&quot; title=&quot;tags:config&quot;&gt;config&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/darcs&quot; class=&quot;cloud3_tag1&quot; title=&quot;tags:darcs&quot;&gt;darcs&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/dokuwiki&quot; class=&quot;cloud4_tag1&quot; title=&quot;tags:dokuwiki&quot;&gt;dokuwiki&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/emacs&quot; class=&quot;cloud5_tag1&quot; title=&quot;tags:emacs&quot;&gt;emacs&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/git&quot; class=&quot;cloud2_tag1&quot; title=&quot;tags:git&quot;&gt;git&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/google&quot; class=&quot;cloud1_tag1&quot; title=&quot;tags:google&quot;&gt;google&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/gtd&quot; class=&quot;cloud1_tag1&quot; title=&quot;tags:gtd&quot;&gt;gtd&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/latex&quot; class=&quot;cloud2_tag1&quot; title=&quot;tags:latex&quot;&gt;latex&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;cloud2_tag1&quot; title=&quot;tags:python&quot;&gt;python&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;cloud2_tag1&quot; title=&quot;tags:twisted&quot;&gt;twisted&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/wiki&quot; class=&quot;cloud3_tag1&quot; title=&quot;tags:wiki&quot;&gt;wiki&lt;/a&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/zsi&quot; class=&quot;cloud1_tag1&quot; title=&quot;tags:zsi&quot;&gt;zsi&lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Tags&quot; [1118-] --&gt;</description>
    </item>
    <item rdf:about="http://www.hodique.info/projects/emacs">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T14:35:46+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title></title>
        <link>http://www.hodique.info/projects/emacs</link>
        <description>
&lt;p&gt;
I&amp;#039;m a daily user of GNU Emacs, and hack a lot on it and with it !
Here are a couple of contributions you might be interested in:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; My &lt;strong&gt;huge&lt;/strong&gt; configuration suite: &lt;a href=&quot;http://github.com/sigma/dotfiles&quot; class=&quot;urlextern&quot; title=&quot;http://github.com/sigma/dotfiles&quot;  rel=&quot;nofollow&quot;&gt;http://github.com/sigma/dotfiles&lt;/a&gt; including a large emacs part&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/blog/2009/11/14/s5_presentation_from_org-mode&quot; class=&quot;wikilink1&quot; title=&quot;blog:2009:11:14:s5_presentation_from_org-mode&quot;&gt;A Org-mode addon to generate S5 slides&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.hodique.info/blog/2010/02/14/magit_extensions&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:14:magit_extensions&quot;&gt;A Magit branch to support extensibility&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/emacs&quot; class=&quot;wikilink1&quot; title=&quot;tags:emacs&quot; rel=&quot;tag&quot;&gt;emacs&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;
</description>
    </item>
    <item rdf:about="http://www.hodique.info/projects/cl_ants">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T11:43:15+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>ICFP 2004</title>
        <link>http://www.hodique.info/projects/cl_ants</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;ICFP 2004&quot; [1-25] --&gt;
&lt;h2&gt;&lt;a name=&quot;background&quot; id=&quot;background&quot;&gt;Background&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
I took part in the &lt;a href=&quot;http://www.cs.luc.edu/icfp/&quot; class=&quot;urlextern&quot; title=&quot;http://www.cs.luc.edu/icfp/&quot;  rel=&quot;nofollow&quot;&gt;ICFP&lt;/a&gt; code contest in 2004, with a few friends of mine from &lt;a href=&quot;http://www.melting-pot.org&quot; class=&quot;urlextern&quot; title=&quot;http://www.melting-pot.org&quot;  rel=&quot;nofollow&quot;&gt;Melting-Pot&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
For those who don&amp;#039;t know of ICFP code contest, let&amp;#039;s have a few words on the rule. A subject is published on the web site at a given time, and from then you have 72 hours to submit your solution. That&amp;#039;s all. The problems are often very funny, and the idea of staying in front of a computer for 72 hours is also (did I mention my geekness?)
&lt;/p&gt;

&lt;p&gt;
For informations about the particular 2004 issue, have a look at the &lt;a href=&quot;http://www.cis.upenn.edu/~plclub/contest/index.php&quot; class=&quot;urlextern&quot; title=&quot;http://www.cis.upenn.edu/~plclub/contest/index.php&quot;  rel=&quot;nofollow&quot;&gt;official website&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Our solution is based on a compiler written in C++ which takes a small C-like dedicated language as input and generates “ant-assembly” language.
The compiler itself is rather nice and involves a very expressive preprocessor. Anyway, it took us about 2/3 of the total time to come up with the compiler, so that the real programs (the ones to be compiled… the ant brains…) were not that efficient.
&lt;/p&gt;

&lt;p&gt;
The result was a 83th place in the general ranking. Not so bad, but not as good as it may have been with more time to think about strategies instead of compilation issues.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Background&quot; [26-1260] --&gt;
&lt;h2&gt;&lt;a name=&quot;idea&quot; id=&quot;idea&quot;&gt;Idea&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

C++ was obviously not the best choice to write a compiler in very limited time. It&amp;#039;s efficient, it&amp;#039;s clean, but it was much too long to develop and debug.
&lt;/p&gt;

&lt;p&gt;
Later, during my holidays (remember my geekness :p), I felt the need to experiment a better solution. As you may find out on the web or even on this site, I&amp;#039;m a big fan of Lisp languages, and I had the strong feeling that I could come up with a functional solution very quickly.
&lt;/p&gt;

&lt;p&gt;
Of course I had already the scheme of the solution in mind (that is, the general design of the language I would need). We were 4 persons the first time, and the general idea of the language to be compiled took us a few hours.
Anyway, in 6 hours, I wrote alone a compiler that is much better than our submission (more expressiveness, opimizations,…) &lt;strong&gt;without&lt;/strong&gt; any prior knowledge of &lt;a href=&quot;http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html&quot; class=&quot;urlextern&quot; title=&quot;http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html&quot;  rel=&quot;nofollow&quot;&gt;Common Lisp&lt;/a&gt; specificities (I like learning a language by programming such things).
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Idea&quot; [1261-2241] --&gt;
&lt;h2&gt;&lt;a name=&quot;target_language&quot; id=&quot;target_language&quot;&gt;Target language&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
(shamelessly extracted from the &lt;a href=&quot;http://www.cis.upenn.edu/~plclub/contest/ants.html&quot; class=&quot;urlextern&quot; title=&quot;http://www.cis.upenn.edu/~plclub/contest/ants.html&quot;  rel=&quot;nofollow&quot;&gt;rules&lt;/a&gt;)
&lt;/p&gt;

&lt;p&gt;
The behavior of ants is defined by a simple, finite state machine. Informally, the instructions of this state machine can be described as follows:

&lt;/p&gt;
&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;th class=&quot;col0&quot;&gt;instruction &lt;/th&gt;&lt;th class=&quot;col1&quot;&gt; effect &lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;code&gt;Sense sensedir st1 st2 cond&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1&quot;&gt;Go to state &lt;code&gt;st1&lt;/code&gt; if &lt;code&gt;cond&lt;/code&gt; holds in &lt;code&gt;sensedir&lt;/code&gt;; and to state &lt;code&gt;st2&lt;/code&gt; otherwise.&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;code&gt;Mark i st&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1&quot;&gt;Set mark &lt;code&gt;i&lt;/code&gt; in current cell and go to &lt;code&gt;st&lt;/code&gt;.&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;code&gt;Unmark i st&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1&quot;&gt;Clear mark &lt;code&gt;i&lt;/code&gt; in current cell and go to &lt;code&gt;st&lt;/code&gt;.&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row4&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;code&gt;PickUp st1 st2&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1&quot;&gt;Pick up food from current cell and go to &lt;code&gt;st1&lt;/code&gt;; go to &lt;code&gt;st2&lt;/code&gt; if there is no food in the current cell.&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row5&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;code&gt;Drop st&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1&quot;&gt;Drop food in current cell and go to &lt;code&gt;st&lt;/code&gt;.&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row6&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;code&gt;Turn lr st&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1&quot;&gt;Turn left or right and go to &lt;code&gt;st&lt;/code&gt;.&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row7&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;code&gt;Move st1 st2&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1&quot;&gt;Move forward and go to &lt;code&gt;st1&lt;/code&gt;; go to &lt;code&gt;st2&lt;/code&gt; if the cell ahead is blocked.&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row8&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;code&gt;Flip p st1 st2&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1&quot;&gt;Choose a random number x from 0 to &lt;code&gt;p&lt;/code&gt;-1; go to &lt;code&gt;st1&lt;/code&gt; if x=0 and &lt;code&gt;st2&lt;/code&gt; otherwise.&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;

That&amp;#039;s all. Now that&amp;#039;s possible to write a brain directly with these instructions, but obviously one could benefit from an abstraction that would make the code easier to write… a compiler.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Target language&quot; [2242-3426] --&gt;
&lt;h2&gt;&lt;a name=&quot;description_of_the_language&quot; id=&quot;description_of_the_language&quot;&gt;Description of the language&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

The compiler is able to compile a small lisp-like language (Lisp is &lt;strong&gt;very&lt;/strong&gt; good at using its own representation).
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Description of the language&quot; [3427-3584] --&gt;
&lt;h3&gt;&lt;a name=&quot;top_level&quot; id=&quot;top_level&quot;&gt;Top level&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

There are two kinds of functional units in this languages
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;func&lt;/code&gt;: they are some kind of lisp functions, but limitations in the target code prevent from having a notion of &lt;code&gt;return&lt;/code&gt;. Thus, they all end with a &lt;code&gt;call&lt;/code&gt; to another &lt;code&gt;func&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;func function-&lt;span class=&quot;kw1&quot;&gt;name&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement n&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;macro&lt;/code&gt;: as usual, &lt;code&gt;macro&lt;/code&gt; allows to inline a block of code. It is essential for the same reason: there is no &lt;code&gt;return&lt;/code&gt;. Thus, code replication is unavoidable&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;macro macro-&lt;span class=&quot;kw1&quot;&gt;name&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement n&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Top level&quot; [3585-4174] --&gt;
&lt;h3&gt;&lt;a name=&quot;statements&quot; id=&quot;statements&quot;&gt;Statements&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

The body of a top-level form is composed of statements.

&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;progn&lt;/code&gt;: a classical sequence in Lisp. It reflects the execution of all its arguments&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement n&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;turn&lt;/code&gt;: the primitive action of making the ant turn its head in the given direction (&lt;code&gt;&amp;#039;left&lt;/code&gt; or &lt;code&gt;&amp;#039;right&lt;/code&gt; or any variable that contains one of these symbols)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'left&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;mark&lt;/code&gt;, &lt;code&gt;unmark&lt;/code&gt;: the primitive action of putting/removing a mark at the current position&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;mark &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;if&lt;/code&gt;: the choice betwwen two statements, based on a condition&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;condition&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;when&lt;/code&gt; and &lt;code&gt;unless&lt;/code&gt;: trivial variants of &lt;code&gt;if&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;cond&lt;/code&gt;: generalized &lt;code&gt;if&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;condition &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;sy0&quot;&gt;...&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;condition n&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement n&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;drop&lt;/code&gt;: drop the food in-place&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;drop&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;call&lt;/code&gt;: branch to the beginning of another function&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;call 'another-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;while&lt;/code&gt;: classical loop structure&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;condition&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;dotimes&lt;/code&gt;: constant loop&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;dotimes&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;statement&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; any other symbol is treated as an invocation to a macro&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Statements&quot; [4175-5482] --&gt;
&lt;h3&gt;&lt;a name=&quot;conditions&quot; id=&quot;conditions&quot;&gt;Conditions&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Several instructions produce boolean results, to be used within the context of conditional statements.

&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;pickup&lt;/code&gt;: try to pick food up there&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pickup&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;flip&lt;/code&gt;: basic &lt;em&gt;random&lt;/em&gt; action. The highest the argument, the most unlikely the event.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flip &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;move&lt;/code&gt;: a movement may fail, due to a rock, another ant, …&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;move&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;sense&lt;/code&gt;: try to detect something somewhere&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sense 'left-ahead 'food&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;not&lt;/code&gt;, &lt;code&gt;or&lt;/code&gt;, &lt;code&gt;and&lt;/code&gt;: classical composition operators&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Conditions&quot; [5483-6098] --&gt;
&lt;h2&gt;&lt;a name=&quot;examples&quot; id=&quot;examples&quot;&gt;Examples&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
The engine makes it possible to express in a lisp-like language strategies like the following
&lt;/p&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;co1&quot;&gt;;; this will be inlined for each &amp;quot;invocation&amp;quot;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;macro uturn &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;dotimes&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn left&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;; entry point of the ant brain&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;func main
  &lt;span class=&quot;co1&quot;&gt;;; let's randomize a bit the initial direction&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flip 3&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'left&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flip &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'right&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;;; from now, search some food. Note that the &amp;quot;function&amp;quot; will never return&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;;; since it can't be expressed easily with the basic instructions&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;;; (plus it's not that useful)&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;call 'search-food&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;func search-food
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pickup&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sense 'left-ahead 'food&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'left&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;move&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pickup&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;uturn&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;move&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'right&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;call 'back-to-home&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sense 'right-ahead 'food&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'right&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;move&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;pickup&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;uturn&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;move&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'left&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;call 'back-to-home&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;move&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'left&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;flip 2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'left&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;uturn&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;call 'back-to-home&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;func back-to-home
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sense 'here 'home&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;unless &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;move&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;turn 'right&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;drop&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;call 'go-out-from-home&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;func go-out-from-home
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;uturn&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sense 'here 'home&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;move&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;call 'search-food&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;; compile everything from &amp;quot;main&amp;quot;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;make-program&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;; dump the result in a suitable format&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;dump-program &lt;span class=&quot;st0&quot;&gt;&amp;quot;primitive-ant&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Examples&quot; [6099-7770] --&gt;
&lt;h2&gt;&lt;a name=&quot;solution&quot; id=&quot;solution&quot;&gt;Solution&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Let&amp;#039;s see the code of the compiler
&lt;/p&gt;
&lt;pre class=&quot;code lisp&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;defpackage icfp
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;use&lt;/span&gt; common-lisp&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;export&lt;/span&gt; func macro make-program dump-program&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;in-package icfp&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;defvar *program* &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;defvar *functions* &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;defvar *macros* &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;defvar *optimize* t&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;body body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; t&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;@body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; indexes-of &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem &lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;counter -1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for e in &lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt;
       &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;incf counter&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;equal&lt;/span&gt; e elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; collect counter&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; uniquify &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for elem in &lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt;
     &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;member&lt;/span&gt; elem acc&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; collect elem into acc
     finally &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; acc&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
       &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; single-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;@instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; 'relative &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; relative-jump-p &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;consp&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 'relative&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; absolute-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; 'absolute &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; absolute-jump-p &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;consp&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 'absolute&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; extern-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; 'extern &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; extern-function-p &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;el elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;consp&lt;/span&gt; el &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; el&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 'extern&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; marker-&lt;span class=&quot;kw1&quot;&gt;symbol&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;; Instructions&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-goto &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;where&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'flip 1 where where&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-turn-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;direction&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;assert &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; direction 'left&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; direction 'right&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'turn direction &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-mark-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;marker&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'mark &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;marker-&lt;span class=&quot;kw1&quot;&gt;symbol&lt;/span&gt; marker&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-unmark-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;marker&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'unmark &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;marker-&lt;span class=&quot;kw1&quot;&gt;symbol&lt;/span&gt; marker&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; mapindex &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;i f seq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;i 0&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;mapcar&lt;/span&gt; #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;s&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;f &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; s&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;incf i&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;seq&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-if-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;optional then &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest else&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-then &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-instr then&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-else &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-block else&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;mapindex i #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; i&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                            'alt1 ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;mapindex i #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; compiled-then&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; else 1 0&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; i&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                            'alt2 ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;
            compiled-then
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; else &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-goto &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; compiled-else&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            compiled-else&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-when-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest then&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-if-instr condition &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; '&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt; then&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-unless-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest else&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; #'compile-if-instr condition &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt; else&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-cond-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest clauses&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt;* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-clauses
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for cl in clauses collect &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; cl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                                &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-block &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; cl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;total &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ 1
                   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; clauses&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; jumps&lt;/span&gt;
                   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; #'+ &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;mapcar&lt;/span&gt; #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;cl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; cl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cadr&lt;/span&gt; cl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; compiled-clauses&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;mapcan&lt;/span&gt; #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;cl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; cl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;bl &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cadr&lt;/span&gt; cl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; total &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- total &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; bl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
                  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;mapindex i #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; i&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                          'alt1 ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                            condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;mapindex i #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                                               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; bl&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; i&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                          'alt2 ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                            condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; condition
                          bl
                          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-goto &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ total 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            compiled-clauses&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-while-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt;* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-body &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-block body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; compiled-body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;mapindex i #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; i&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                            'alt1 ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;mapindex i #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ &lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt; 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; i&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                            'alt2 ins&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;
            compiled-body
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-goto &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-dotimes-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;assert &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;numberp&lt;/span&gt; n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-body &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-block body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;res &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for x below n &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; res &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; res compiled-body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    res&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-drop-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'drop &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-call-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'flip 1 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;extern-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;extern-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; macro-body &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;m&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;caddr&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;assoc&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;m *macros*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; macro-args &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;m&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cadr&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;assoc&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;m *macros*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; args-&lt;span class=&quot;kw1&quot;&gt;subst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sym-args real-args body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;assert &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; sym-args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; real-args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;fbody body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for sym in sym-args for real in real-args
         &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; real sym fbody&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    fbody&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-macro-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;m &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;body &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;macro-body m&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;sym-args &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;macro-args m&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;assert body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-block &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;args-&lt;span class=&quot;kw1&quot;&gt;subst&lt;/span&gt; sym-args args body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;; Conditions&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-pickup-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'pickup 'alt1 'alt2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-flip-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'flip &lt;span class=&quot;kw1&quot;&gt;value&lt;/span&gt; 'alt1 'alt2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-move-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'move 'alt1 'alt2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-sense-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;place kind&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'sense place 'alt1 'alt2 kind&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-not-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; 'alt3 'alt1 compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; 'alt1 'alt2 compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; 'alt2 'alt3 compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    compiled-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-or-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;null&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;t
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;first &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rest &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; #'compile-or-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; first&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 'alt2 first&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; first rest&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-and-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;rest conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;null&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;t
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;first &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rest &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; #'compile-and-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; conditions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nsubst&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; first&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 'alt1 first&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; first rest&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-t-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'flip 1 'alt1 'alt1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-nil-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;single-instr 'flip 1 'alt2 'alt2&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; expand-args &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;mapcar&lt;/span&gt; #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;consp&lt;/span&gt; x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; '&lt;span class=&quot;kw1&quot;&gt;quote&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                     &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cadr&lt;/span&gt; x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;symbolp&lt;/span&gt; x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;symbol-&lt;span class=&quot;kw1&quot;&gt;value&lt;/span&gt; x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;t x&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; build &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; f &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;expand-args args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;consp&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; condition
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-nil-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'t &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-t-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;t &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;No such condition constant&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;args &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; condition&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; instr
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'pickup &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-pickup-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'flip &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-flip-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'move &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-move-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'sense &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-sense-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-not-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-not-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-or-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-and-&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;t &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;No such condition operator&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;instruction&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; instruction&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;args &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; instruction&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;when&lt;/span&gt; instr
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;case&lt;/span&gt; instr
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;mapcan&lt;/span&gt; #'compile-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'turn &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-turn-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'mark &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-mark-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'unmark &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-unmark-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-if-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-when-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'unless &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-unless-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;cond&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-cond-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'drop &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-drop-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'call &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-call-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-while-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;'&lt;span class=&quot;kw1&quot;&gt;dotimes&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;build 'compile-dotimes-instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;t &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; 'compile-macro-instr instr args&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-block &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-instr &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; '&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt; body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; compile-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-body &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-block body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; compiled-body
            &lt;span class=&quot;co1&quot;&gt;;; protect from going out a bad designed func (a func should always&lt;/span&gt;
            &lt;span class=&quot;co1&quot;&gt;;; end by a call). This should NEVER be executed. In case it is&lt;/span&gt;
            &lt;span class=&quot;co1&quot;&gt;;; anyway, let's re-execute the function. The useless code will be&lt;/span&gt;
            &lt;span class=&quot;co1&quot;&gt;;; removed at optimization time anyway.&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-goto &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;relative-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; compiled-body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; func &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;body body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compiled-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;compile-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; '&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
     &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *functions* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; '&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;name&lt;/span&gt; compiled-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;delete-&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; '&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; *functions*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; macro &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;name&lt;/span&gt; args &lt;span class=&quot;sy0&quot;&gt;&amp;amp;&lt;/span&gt;body body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *macros* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; '&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;name&lt;/span&gt; '&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;args '&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;body&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;delete-&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; '&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; *macros*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; function-body &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;assoc&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;f *functions*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; function-dependencies &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;mapcan&lt;/span&gt; #'&lt;span class=&quot;kw1&quot;&gt;identity&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;body &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;function-body f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for instr in body collect
                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for elem in instr
                    &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;consp&lt;/span&gt; elem &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 'extern&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                    collect &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defmacro&lt;/span&gt; run-on-program-with-counter &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;counter f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  `&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;counter 0&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
     &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;mapcar&lt;/span&gt; #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;res &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;f &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;counter &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ 1 &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;counter&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                   res&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             *program*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; transform-matching-instr-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;match op&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for elem in instr
         &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; match &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         collect &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;apply&lt;/span&gt; op &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; else collect elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; resolve-extern &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f offset&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *program*
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;run-on-program-with-counter
         counter
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;transform-matching-instr-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;
          #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;extern-function-p elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;declare &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;ignore elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;absolute-jump offset&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; resolve-relative &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *program*
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;run-on-program-with-counter
         counter
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;transform-matching-instr-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;
          #'relative-jump-p
          #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;absolute-jump &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;+ &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; counter&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; resolve-absolute &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *program*
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;run-on-program-with-counter
         counter
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;transform-matching-instr-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;
          #'absolute-jump-p
          #'&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; goto-alist &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;delete&lt;/span&gt;
            &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;run-on-program-with-counter
             counter
             #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; 'flip&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;equal&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nth&lt;/span&gt; 2 instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nth&lt;/span&gt; 3 instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                     &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; counter
                           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;consp&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nth&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt; instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                               &lt;span class=&quot;co1&quot;&gt;;; called before (resolve-absolute)&lt;/span&gt;
                               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nth&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt; instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                               &lt;span class=&quot;co1&quot;&gt;;; called on final version&lt;/span&gt;
                               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nth&lt;/span&gt; 2 instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for j in &lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt; collect
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;orig &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; j&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
               &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;from &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; j&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;assoc&lt;/span&gt; from &lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; from &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;assoc&lt;/span&gt; from &lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; orig from&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; simplify-jumps &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *program*
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;g &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;goto-alist&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;run-on-program-with-counter
           counter
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;transform-matching-instr-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;
            #'absolute-jump-p
            #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;assoc&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; g&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; following &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for elem in instr
       &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;absolute-jump-p elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; collect &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; non-dead-code &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;to-follow &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;followed &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;current 0&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;while &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; to-follow
                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt;
                  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;delete-&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt;
                   #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;member&lt;/span&gt; n followed&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                     &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;member&lt;/span&gt; n to-follow&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;uniquify &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;following &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;nth&lt;/span&gt; current *program*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                  to-follow&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; followed &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; followed &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; current&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; current &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; to-follow&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; to-follow &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; to-follow&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; followed &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; followed &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; current&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;run-on-program-with-counter
     counter
     #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;member&lt;/span&gt; counter followed&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
             instr&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; kill-dead-code &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *program* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;non-dead-code&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *program*
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;delete&lt;/span&gt;
         &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt;* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;indexes &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;indexes-of &lt;span class=&quot;kw1&quot;&gt;nil&lt;/span&gt; *program*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;run-on-program-with-counter
            counter
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;transform-matching-instr-&lt;span class=&quot;kw1&quot;&gt;function&lt;/span&gt;
             #'absolute-jump-p
             #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;- &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                          &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;delete-&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt;
                                   #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;i&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt; i &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; elem&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                                   &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;copy-&lt;span class=&quot;kw1&quot;&gt;list&lt;/span&gt; indexes&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; optimize-program &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;simplify-jumps&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;kill-dead-code&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; link-program &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;functions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;mapcar&lt;/span&gt; #'&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;resolve-extern &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
          functions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;resolve-relative&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; *optimize*
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;optimize-program&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;resolve-absolute&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; make-program &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *program* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;function-body 'main&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;active-functions '&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;main &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt; 0&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;deps &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;function-dependencies 'main&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; deps&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; t&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;f &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; deps&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;length&lt;/span&gt; *program*&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;assoc&lt;/span&gt; f active-functions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; deps &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; deps &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;function-dependencies f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; *program* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;append&lt;/span&gt; *program* &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;function-body f&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
              &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; active-functions &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cons&lt;/span&gt; f &lt;span class=&quot;kw1&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; active-functions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;setq&lt;/span&gt; deps &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; deps&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;link-program active-functions&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; print-program &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for instr in *program* &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt;
       &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for el in instr
            &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt;
                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;princ&lt;/span&gt; el&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
                 &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;princ&lt;/span&gt; #\Space&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;princ&lt;/span&gt;  #\NewLine&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;defun&lt;/span&gt; dump-program &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;filename&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;assert &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;stringp filename&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;with-open-file &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;s filename &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;direction&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;output&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;if-exists&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;me1&quot;&gt;overwrite&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for instr in *program* &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt;
         &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;progn&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;loop for el in instr
              &lt;span class=&quot;kw1&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;format s &lt;span class=&quot;st0&quot;&gt;&amp;quot;~S &amp;quot;&lt;/span&gt; el&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
           &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;format s &lt;span class=&quot;st0&quot;&gt;&amp;quot;~%&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Solution&quot; [7771-23225] --&gt;
&lt;h2&gt;&lt;a name=&quot;conclusion&quot; id=&quot;conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Would we have written all this in Lisp from the beginning, we would have had at least two entire days to think about strategies to implement, instead of less than one :p&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Lisp rocks !&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/lisp&quot; class=&quot;wikilink1&quot; title=&quot;tags:lisp&quot; rel=&quot;tag&quot;&gt;lisp&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Conclusion&quot; [23226-] --&gt;</description>
    </item>
    <item rdf:about="http://www.hodique.info/tags/tutorial_lisp_bindings">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T11:42:49+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>tutorial lisp bindings</title>
        <link>http://www.hodique.info/tags/tutorial_lisp_bindings</link>
        <description>
&lt;p&gt;
« &lt;a href=&quot;http://www.hodique.info/tags&quot; class=&quot;wikilink1&quot; title=&quot;tags&quot;&gt;Blog Tags&lt;/a&gt;&lt;br/&gt;

&lt;/p&gt;



&lt;div class=&quot;level1&quot;&gt;
&lt;table class=&quot;pagelist&quot;&gt;
	&lt;tr&gt;
		&lt;td class=&quot;page&quot;&gt;&lt;a href=&quot;http://www.hodique.info/projects/cl_ants&quot; class=&quot;wikilink1&quot; title=&quot;projects:cl_ants&quot;&gt;ICFP 2004&lt;/a&gt;&lt;/td&gt;
		&lt;td class=&quot;date&quot;&gt;2010/02/14 08:58&lt;/td&gt;
		&lt;td class=&quot;user&quot;&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td class=&quot;tags&quot;&gt;&lt;a href=&quot;http://www.hodique.info/tags/lisp&quot; class=&quot;wikilink1&quot; title=&quot;tags:lisp&quot; rel=&quot;tag&quot;&gt;lisp&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td class=&quot;page&quot;&gt;&lt;a href=&quot;http://www.hodique.info/articles/lisposd&quot; class=&quot;wikilink1&quot; title=&quot;articles:lisposd&quot;&gt;libxosd sous guile&lt;/a&gt;&lt;/td&gt;
		&lt;td class=&quot;date&quot;&gt;2010/02/14 08:58&lt;/td&gt;
		&lt;td class=&quot;user&quot;&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td class=&quot;tags&quot;&gt;&lt;a href=&quot;http://www.hodique.info/tags/lisp&quot; class=&quot;wikilink1&quot; title=&quot;tags:lisp&quot; rel=&quot;tag&quot;&gt;lisp&lt;/a&gt;&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;tutorial lisp bindings&quot; [17-] --&gt;</description>
    </item>
    <item rdf:about="http://www.hodique.info/articles/lisposd">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T11:32:35+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>libxosd sous guile</title>
        <link>http://www.hodique.info/articles/lisposd</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;libxosd sous guile&quot; [1-34] --&gt;
&lt;h2&gt;&lt;a name=&quot;presentation&quot; id=&quot;presentation&quot;&gt;Présentation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Bien souvent il arrive au programmeur en quête de réutilisation de vouloir
se lier à une bibliothèque partagée existante, mais qui malheureusement se
trouve être écrite dans un autre langage que celui qu&amp;#039;il compte
employer. Dans le cas le plus commun, il s&amp;#039;agira probablement d&amp;#039;une bibliothèque
écrite en C (ce qui correspond aux recommandations du projet
GNU). Le programmeur n&amp;#039;a alors d&amp;#039;autre choix que de recourir à une couche de
&lt;strong&gt;liaison&lt;/strong&gt; (&lt;strong&gt;binding&lt;/strong&gt; en anglais) pour importer les fonctionnalités de ladite
bibliothèque dans son langage favori.
&lt;/p&gt;

&lt;p&gt;
Dans ce tutoriel, nous nous intéresserons à l&amp;#039;exploitation de la
&lt;a href=&quot;http://www.ignavus.net/software.html&quot; class=&quot;urlextern&quot; title=&quot;http://www.ignavus.net/software.html&quot;  rel=&quot;nofollow&quot;&gt;libxosd&lt;/a&gt; dans un programme écrit (ou
extensible) en &lt;a href=&quot;http://www.gnu.org/software/guile/guile.html&quot; class=&quot;urlextern&quot; title=&quot;http://www.gnu.org/software/guile/guile.html&quot;  rel=&quot;nofollow&quot;&gt;guile&lt;/a&gt;, le langage d&amp;#039;extension officiel
du projet GNU, qui est une implémentation de scheme. On pourra notamment
envisager l&amp;#039;utilisation de cette liaison pour l&amp;#039;affichage de noms de bureaux
virtuels dans &lt;a href=&quot;http://scwm.mit.edu&quot; class=&quot;urlextern&quot; title=&quot;http://scwm.mit.edu&quot;  rel=&quot;nofollow&quot;&gt;Scwm&lt;/a&gt;, la génération d&amp;#039;un énorme message
d&amp;#039;avertissement lorsque vos comptes (gérés par gnucash) seront dans le rouge,
ou simplement l&amp;#039;écriture de scripts guile servant à notifier un
événement quelconque.
&lt;/p&gt;

&lt;p&gt;
Pour être complets il convient de noter que les langages considérés ne sont
pas neutres: en effet guile exporte une interface native  C, ce qui
simplifie notablement le portage de la bibliothèque choisie.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Présentation&quot; [35-1487] --&gt;
&lt;h2&gt;&lt;a name=&quot;de_c_a_guile&quot; id=&quot;de_c_a_guile&quot;&gt;De C à guile&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;De C à guile&quot; [1488-1514] --&gt;
&lt;h3&gt;&lt;a name=&quot;encapsulation_de_la_structure_de_donnees&quot; id=&quot;encapsulation_de_la_structure_de_donnees&quot;&gt;Encapsulation de la structure de données&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Pour commencer, il est bon de se rappeler (ou d&amp;#039;apprendre) que guile manipule
un seul type de données: &lt;code&gt;SCM&lt;/code&gt;, aussi les fonctions que nous allons écrire
manipuleront ce type en lieu et place des arguments C des fonctions
“normales”. Nous aurons donc recours à un certain nombre d&amp;#039;assertions et de
conversions pour passer des arguments scheme aux arguments réels dans de bonnes
conditions (et vice versa).
&lt;/p&gt;

&lt;p&gt;
La libxosd adopte un modèle objet centré autour d&amp;#039;une structure &lt;code&gt;xosd&lt;/code&gt;. Ce type
jouant un rôle central, nous devons tout d&amp;#039;abord lui donner un équivalent
guile. Guile permet de définir des &lt;code&gt;smobs&lt;/code&gt; (&lt;strong&gt;small objects&lt;/strong&gt;), qui nous permettront
de faire ce que nous voulons avec les objets &lt;code&gt;xosd&lt;/code&gt;. La définition d&amp;#039;un &lt;code&gt;smob&lt;/code&gt; se
fait simplement en lui donnant un nom et une taille :
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;xosd_tag &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; scm_make_smob_type&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; xosd &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Remarquons que nous n&amp;#039;avons pas fait de lien entre le &lt;code&gt;smob&lt;/code&gt; et la structure de
données que nous voulons encapsuler &lt;code&gt;(xosd *)&lt;/code&gt;. Ce lien ne sera fait qu&amp;#039;à la
création d&amp;#039;un nouvel objet du type de ce &lt;code&gt;smob&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
Ainsi, &lt;code&gt;SCM_RETURN_NEWSMOB(xosd_tag, w);&lt;/code&gt; où &lt;code&gt;w&lt;/code&gt; est de type &lt;code&gt;xosd*&lt;/code&gt; crée un objet
guile auquel l&amp;#039;identifiant &lt;code&gt;xosd_tag&lt;/code&gt; est attaché, et dont on pourra contrôler le
type ultérieurement. Nous reviendrons sur cette étape lorsque nous nous
intéresserons à l&amp;#039;écriture d&amp;#039;un constructeur.
&lt;/p&gt;

&lt;p&gt;
Passons à présent aux fonctions permettant conversion d&amp;#039;un &lt;code&gt;SCM&lt;/code&gt; en son véritable type C.
&lt;/p&gt;

&lt;p&gt;
Nous aurons dans la majeure partie des cas à vérifier que le premier argument
de la fonction considérée est bien un pointeur vers un &lt;code&gt;xosd&lt;/code&gt;. L&amp;#039;interface de
programmation des &lt;code&gt;smobs&lt;/code&gt; nous fournit une macro pour cela:
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;SCM_SMOB_PREDICATE&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd_tag&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;osd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
qui teste l&amp;#039;appartenance de &lt;code&gt;osd&lt;/code&gt; (de type &lt;code&gt;SCM&lt;/code&gt;) au type &lt;code&gt;smob&lt;/code&gt; d&amp;#039;identifiant
&lt;code&gt;xosd_tag&lt;/code&gt;. D&amp;#039;autres macros de test sont disponibles pour les types “primitifs”:
ainsi on pourra écrire &lt;code&gt;SCM_INUMP(n)&lt;/code&gt; pour tester l&amp;#039;appartenance de &lt;code&gt;n&lt;/code&gt; aux
entiers naturels.
&lt;/p&gt;

&lt;p&gt;
Pour effectuer un vrai test de validité d&amp;#039;appel, nous avons encore besoin de la
macro suivante
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;SCM_ASSERT&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;condition&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;argument_effectif&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
           argument_symbolique&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;fonction&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
qui se chargera d&amp;#039;interrompre l&amp;#039;exécution et de lever une erreur si &lt;code&gt;condition&lt;/code&gt;
n&amp;#039;est pas respectée.
&lt;/p&gt;

&lt;p&gt;
Enfin, lorsque toutes le vérifications sont passées, il nous reste encore
à exécuter réellement les conversions de types nécessaire. Nous avons vu
précédemment la macro &lt;code&gt;SCM_RETURN_NEWSMOB&lt;/code&gt; qui nous permettait de convertir
un &lt;code&gt;xosd*&lt;/code&gt; en son smob associé, il est temps de découvrir la macro
&lt;code&gt;SCM_SMOB_DATA(x)&lt;/code&gt; qui, appliquée au résultat précédent, retourne le &lt;code&gt;xosd*&lt;/code&gt; de départ.
Dans la suite, nous utiliserons la macro suivante.
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#define XOSD(x) ((xosd *) SCM_SMOB_DATA(x))&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Encore une fois, il existe également des macros de conversion pour les types
“primitifs”, ainsi &lt;code&gt;SCM_INUM(n)&lt;/code&gt; appelé sur un &lt;code&gt;SCM&lt;/code&gt; renverra un &lt;code&gt;int&lt;/code&gt;,
et la conversion est valide sous réserve que &lt;code&gt;SCM_INUMP(n)&lt;/code&gt; soit vrai.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Encapsulation de la structure de données&quot; [1515-4646] --&gt;
&lt;h3&gt;&lt;a name=&quot;encapsulation_d_une_fonction&quot; id=&quot;encapsulation_d_une_fonction&quot;&gt;Encapsulation d&amp;#039;une fonction&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Une fois les données correctement encapsulées, l&amp;#039;encapsulation d&amp;#039;une fonction
se fait assez facilement suivant un schéma constant :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; vérification des arguments ;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; appel du code utile ;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; construction de la valeur de retour.  &lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

Voyons un exemple complet d&amp;#039;encapsulation de la fonction &lt;code&gt;xosd_set_horizontal_offset(xosd * osd, int n)&lt;/code&gt;
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;static&lt;/span&gt; SCM _wrap_xosd_set_horizontal_offset&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM osd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; SCM n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    SCM_ASSERT&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM_SMOB_PREDICATE&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd_tag&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;osd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; osd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
               SCM_ARG1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;xosd-set-horizontal-offset!&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    SCM_ASSERT&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM_INUMP&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; n&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
               SCM_ARG2&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;xosd-set-horizontal-offset!&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    xosd_set_horizontal_offset&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;XOSD&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;osd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;SCM_INUM&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; SCM_UNSPECIFIED&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
La valeur &lt;code&gt;SCM_UNSPECIFIED&lt;/code&gt; retournée peut être vue comme l&amp;#039;équivalent d&amp;#039;un &lt;code&gt;void&lt;/code&gt;
C: une valeur inutilisable.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Encapsulation d'une fonction&quot; [4647-5519] --&gt;
&lt;h3&gt;&lt;a name=&quot;adaptation_des_interfaces&quot; id=&quot;adaptation_des_interfaces&quot;&gt;Adaptation des interfaces&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

En passant d&amp;#039;un langage à un autre, il apparaît rapidement que certaines
constructions, parfaitement adaptées dans l&amp;#039;un, se trouvent tout à fait
inadaptées dans l&amp;#039;autre. Ainsi, la fonction suivante semble complexe, et peu
transposable en scheme :
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; xosd_display &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;osd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; line&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
                  xosd_command command&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; ...&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;// command appartient à l'ensemble&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;// {XOSD_percentage, XOSD_string, XOSD_printf, XOSD_slider}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Il est bien sûr possible d&amp;#039;écrire une fonction scheme qui adopte le même
comportement, mais la simple présence d&amp;#039;arguments génériques rendrait la
solution inélégante. Si des adaptations mineures de l&amp;#039;interface sont
envisageables, on pourra faire le choix de séparer les différents comportements
(les différentes valeurs de &lt;code&gt;command&lt;/code&gt;) en plusieurs fonctions. D&amp;#039;autre part la
commande &lt;code&gt;XOSD_printf&lt;/code&gt; est clairement écrite comme un substitut à la fonction
&lt;code&gt;printf()&lt;/code&gt; du C, par conséquent, il est logique de ne &lt;strong&gt;pas&lt;/strong&gt; la transcrire telle
quelle, mais d&amp;#039;émuler son comportement à travers la fonction scheme
&lt;code&gt;format&lt;/code&gt; et grâce à la commande &lt;code&gt;XOSD_string&lt;/code&gt;. Ainsi les chaînes de formatage acceptées ne seront pas nécessairement
les mêmes, mais elles seront cohérentes avec les habitudes liées au langage.
&lt;/p&gt;

&lt;p&gt;
Nous écrirons donc trois fonctions: &lt;code&gt;xosd-display-percentage&lt;/code&gt;,
&lt;code&gt;xosd-display-slider&lt;/code&gt;, et &lt;code&gt;xosd-display-string&lt;/code&gt;.  Une fois ceci fait, on
pourra sans problème écrire &lt;code&gt;(xosd-display-string (format ”%d” n))&lt;/code&gt; pour
simuler une fonction &lt;code&gt;(xosd-display-printf)&lt;/code&gt;
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;&lt;span class=&quot;co1&quot;&gt;// affiche str à la ligne line&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; xosd_display_string&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;osd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; line&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;str&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; xosd_display&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;osd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;line&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;XOSD_string&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;str&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;static&lt;/span&gt; SCM _wrap_xosd_display_string&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM osd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; SCM line&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; SCM str&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    SCM_ASSERT&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM_SMOB_PREDICATE&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd_tag&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;osd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; osd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
               SCM_ARG1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;xosd-display-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    SCM_ASSERT&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM_INUMP&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;line&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; line&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
               SCM_ARG2&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;xosd-display-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    SCM_ASSERT&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM_STRINGP&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;str&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; str&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
               SCM_ARG3&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;xosd-display-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    xosd_display_string&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;XOSD&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;osd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;SCM_INUM&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;line&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
                        SCM_STRING_CHARS&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;str&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; SCM_UNSPECIFIED&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Dans un registre différent, il arrive qu&amp;#039;en C on émule le retour de plusieurs
valeurs par le passage de pointeurs vers des variables locales. Ainsi la
fonction &lt;code&gt;xosd_get_colour&lt;/code&gt; a le profil suivant:
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; xosd_get_colour&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;osd&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;red&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
                    &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;green&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;blue&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Cette façon de faire est tout à fait inappropriée en scheme (puisque l&amp;#039;on n&amp;#039;a
pas de pointeurs), où l&amp;#039;usage dans des cas semblables est plutôt de renvoyer
une liste de résultats. Ainsi on voudra plutôt :
&lt;/p&gt;
&lt;pre class=&quot;code scheme&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;get&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;colour osd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Adaptation des interfaces&quot; [5520-8325] --&gt;
&lt;h3&gt;&lt;a name=&quot;constructeursdestructeurs&quot; id=&quot;constructeursdestructeurs&quot;&gt;Constructeurs/destructeurs&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

libxosd est une bibliothèque objet (bien qu&amp;#039;écrite en C) et fournit des
fonctions pour construire et détruire des instances. Le premier réflexe
(malheureux, évidemment) sera d&amp;#039;encapsuler ces méthodes comme les autres, et de
les utiliser en l&amp;#039;état en lisp. Bien que cela fonctionne au premier abord, il
subsiste un problème majeur: supposons que nous ayions écrit une fonction
&lt;code&gt;xosd-destroy&lt;/code&gt; qui sert de destructeur. Que se passera-t-il si nous réutilisons
l&amp;#039;objet détruit? la même chose qu&amp;#039;en C, une &lt;strong&gt;segfault&lt;/strong&gt;. D&amp;#039;autre part, que se
passera-t-il si nous perdons un object &lt;code&gt;xosd&lt;/code&gt; en faisant par exemple 
&lt;code&gt;(set! xosd nil)&lt;/code&gt; (ceci a pour conséquence d&amp;#039;affecter &lt;code&gt;nil&lt;/code&gt;, qui est la valeur &lt;strong&gt;nulle&lt;/strong&gt; de
scheme à la variable &lt;code&gt;xosd&lt;/code&gt;)? absolument rien, mais il nous est désormais
absolument impossible de récupérer la mémoire allouée pour cet objet (&lt;strong&gt;memory
leak&lt;/strong&gt;). Ces deux facettes du même problème mettent en exergue le fait que dans
un programme scheme, la mémoire doit être gérée automatiquement, il faut donc
s&amp;#039;assurer que les objets passent bien par le ramasse-miettes (&lt;strong&gt;garbage
collector&lt;/strong&gt;) pour ne pas avoir de problème.
&lt;/p&gt;

&lt;p&gt;
Guile fournit une interface pour associer à un &lt;code&gt;smob&lt;/code&gt; une fonction de libération
et une fonction de marquage. La première sert à libérer explicitement la
mémoire, la seconde sert à marquer d&amp;#039;éventuels objets à passer au
ramasse-miettes.
&lt;/p&gt;

&lt;p&gt;
Ces fonctions sont installées lors de la phase d&amp;#039;initialisation du module par
les appels suivants :
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;scm_set_smob_mark&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd_tag&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;mark_xosd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
scm_set_smob_free&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd_tag&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;free_xosd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
ils permettent au ramasse-miettes de prendre conscience de l&amp;#039;existence d&amp;#039;objets
supplémentaires, et surtout de la manière dont il doit les gérer.
&lt;/p&gt;

&lt;p&gt;
Puisque notre &lt;code&gt;smob&lt;/code&gt; n&amp;#039;est en fait rien d&amp;#039;autre qu&amp;#039;un &lt;code&gt;xosd*&lt;/code&gt; la fonction
de marquage est triviale. La fonction de libération, quant à elle, est
simplement un enrobage autour de &lt;code&gt;xosd_destroy()&lt;/code&gt;. En ce qui concerne le
constructeur en revanche, rien de particulier, si ce n&amp;#039;est qu&amp;#039;il ne faut pas
oublier que l&amp;#039;on a un &lt;code&gt;smob&lt;/code&gt; à créer (cf encapsulation de la structure).
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;&lt;span class=&quot;co1&quot;&gt;// crée un objet xosd à n lignes&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;static&lt;/span&gt; SCM make_xosd&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    xosd &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt; w&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    SCM_ASSERT&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM_INUMP&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; n&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; SCM_ARG1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;make-xosd&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    w &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; xosd_create&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM_INUM&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;n&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    SCM_RETURN_NEWSMOB&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd_tag&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; w&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;// rien à marquer, le smob est simple&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;static&lt;/span&gt; SCM mark_xosd&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM xosd_smob&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; SCM_BOOL_F&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;// libération du smob&lt;/span&gt;
&lt;span class=&quot;kw4&quot;&gt;static&lt;/span&gt; size_t free_xosd&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;SCM xosd_smob&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    xosd &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt; osd &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; XOSD&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd_smob&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    xosd_destroy&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;osd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;sizeof&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt; xosd &lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Insistons sur le fait que la fonction de libération n&amp;#039;a absolument pas vocation
a être appelée par l&amp;#039;utilisateur (d&amp;#039;ailleurs elle renvoie un &lt;code&gt;size_t&lt;/code&gt; qui ne
signifie rien en &lt;code&gt;scheme&lt;/code&gt;). L&amp;#039;appel sera exclusivement interne.
&lt;/p&gt;

&lt;p&gt;
Une fois ceci fait, la désallocation se fera automatiquement lors d&amp;#039;un passage
du ramasse-miettes. Ainsi, si nous reprenons notre exemple de 
&lt;code&gt;(set! xosd nil)&lt;/code&gt;, au prochain passage du ramasse-miettes, l&amp;#039;ancien contenu de
&lt;code&gt;xosd&lt;/code&gt; sera détecté comme désormais inutilisable (car non atteignable) et
&lt;code&gt;free_xosd()&lt;/code&gt; sera appelé.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Constructeurs/destructeurs&quot; [8326-11548] --&gt;
&lt;h3&gt;&lt;a name=&quot;definitions_et_export_de_module&quot; id=&quot;definitions_et_export_de_module&quot;&gt;Définitions et export de module&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Une fois que toutes les fonctions de la bibliothèque d&amp;#039;origine ont été
encapsulées pour présenter un profil plus &lt;strong&gt;lisp&lt;/strong&gt;, il est encore nécessaire de les
enregistrer auprès de l&amp;#039;interpréteur à l&amp;#039;aide de la fonction
&lt;code&gt;scm_c_define_gsubr()&lt;/code&gt;.
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;scm_c_define_gsubr&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;make-xosd&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; 1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; 0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; 0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; make_xosd&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
les trois paramètres entiers représentent respectivement le nombre de
paramètres obligatoires, le nombre de paramètres optionnels, et une valeur
booléenne signalant l&amp;#039;existence ou non d&amp;#039;un “reste” d&amp;#039;arguments, mais ce n&amp;#039;est
pas le propos ici. Cette instruction associe au symbole d&amp;#039;identifiant
“make-xosd” la fonction C &lt;code&gt;make_xosd()&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
Le langage scheme possède un système de modules (que l&amp;#039;on peut voir comme une
série d&amp;#039;espaces de (re)nommage), chacun exportant une interface à destination
de l&amp;#039;utilisateur. Par défaut, les fonctions déclarées dans un module ne sont
pas exportées (elles sont privées en quelque sorte), aussi nous devons
explicitement exporter chacun des symboles de fonctions définis, et ce grace
à &lt;code&gt;scm_c_export()&lt;/code&gt; qui accepte une série d&amp;#039;arguments terminée par &lt;code&gt;NULL&lt;/code&gt;
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;scm_c_export&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;make-xosd&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; ... &lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;xosd-display-string&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; NULL&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Définitions et export de module&quot; [11549-12810] --&gt;
&lt;h3&gt;&lt;a name=&quot;compilation&quot; id=&quot;compilation&quot;&gt;Compilation&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Une simple compilation en bibliothèque partagée suffit à rendre les fonctions
créées accessibles depuis guile, sous réserve qu&amp;#039;il existe une fonction
particulière &lt;code&gt;scm_init_&amp;lt;name&amp;gt;_module&lt;/code&gt; si la bibliothèque s&amp;#039;appelle &lt;code&gt;lib&amp;lt;name&amp;gt;.so&lt;/code&gt;
et que cette fonction déclare l&amp;#039;ensemble des symboles et fonctions définis.
&lt;/p&gt;
&lt;pre class=&quot;code c&quot;&gt;SCM scm_init_xosdguile_module &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
    SCM module&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    module &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; scm_c_define_module&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;xosdguile&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; init_helper&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; NULL&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; SCM_UNSPECIFIED&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
où &lt;code&gt;init_helper&lt;/code&gt; est une fonction chargée de la création du module proprement
dit, en d&amp;#039;autres termes, il s&amp;#039;agit de la fonction contenant les instructions de
définition et export vues précédemment.
&lt;/p&gt;

&lt;p&gt;
Si notre fichier C s&amp;#039;appelle &lt;code&gt;xosd_wrap.c&lt;/code&gt;, la ligne de compilation idoine est
la suivante:

&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;gcc -Wall -ansi -pedantic -shared -o libxosdguile.so -lxosd xosd_wrap.c&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Compilation&quot; [12811-13705] --&gt;
&lt;h2&gt;&lt;a name=&quot;exemple&quot; id=&quot;exemple&quot;&gt;Exemple&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Donnons maintenant un petit exemple d&amp;#039;utilisation. Pour être original, on veut
afficher un “Hello World!” en bas de l&amp;#039;écran, centré avec un décalage
supplémentaire de 80 pixels vers la droite. En outre, on désire qu&amp;#039;il
disparaisse de lui-même au bout de 5 secondes.
&lt;/p&gt;
&lt;pre class=&quot;code scheme&quot;&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;use&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;modules &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosdguile&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; chargement du module&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;define&lt;/span&gt; osd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;size &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; on veut 5 lignes&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;define&lt;/span&gt; osd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;timeout &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; les messages disparaissent en 5 secondes&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;define&lt;/span&gt; osd &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;make&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;xosd osd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;size&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; création d'un xosd&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;define&lt;/span&gt; osd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;position '&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; . &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; offset horizontal/vertical&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;set&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;timeout&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt; osd osd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;timeout&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; activation du timeout&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;set&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;pos&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt; osd 'bottom&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; placement en bas&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;set&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;align&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt; osd 'center&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; et au centre&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;set&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;horizontal&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;offset&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt; osd &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;car&lt;/span&gt; osd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;position&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; décalage horizontal&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;set&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;vertical&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;offset&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt; osd &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;cdr&lt;/span&gt; osd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;position&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; et vertical&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;xosd&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;display&lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;string&lt;/span&gt; osd &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;Hello World !&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;;; affichage&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Voyons une capture d&amp;#039;écran de la bête en fonctionnement. Franchement vous attendiez quoi d&amp;#039;un “Hello World” ? :)
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.hodique.info/_detail/articles/lisposd.png?id=articles%3Alisposd&quot; class=&quot;media&quot; title=&quot;articles:lisposd.png&quot;&gt;&lt;img src=&quot;http://www.hodique.info/_media/articles/lisposd.png?w=400&quot; class=&quot;media&quot; title=&quot;killer app&quot; alt=&quot;killer app&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Exemple&quot; [13706-14815] --&gt;
&lt;h2&gt;&lt;a name=&quot;references&quot; id=&quot;references&quot;&gt;Références&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

&lt;a href=&quot;http://mtpforge.melting-pot.org/projects/lisposd&quot; class=&quot;urlextern&quot; title=&quot;http://mtpforge.melting-pot.org/projects/lisposd&quot;  rel=&quot;nofollow&quot;&gt;projet (osd)&lt;/a&gt;&lt;br/&gt;

&lt;a href=&quot;http://www.gnu.org/software/guile/guile.html&quot; class=&quot;urlextern&quot; title=&quot;http://www.gnu.org/software/guile/guile.html&quot;  rel=&quot;nofollow&quot;&gt;guile&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
© Yann Hodique
&lt;/p&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/lisp&quot; class=&quot;wikilink1&quot; title=&quot;tags:lisp&quot; rel=&quot;tag&quot;&gt;lisp&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Références&quot; [14816-] --&gt;</description>
    </item>
    <item rdf:about="http://www.hodique.info/tags/zsi">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T11:31:30+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>zsi</title>
        <link>http://www.hodique.info/tags/zsi</link>
        <description>
&lt;p&gt;
« &lt;a href=&quot;http://www.hodique.info/tags&quot; class=&quot;wikilink1&quot; title=&quot;tags&quot;&gt;Blog Tags&lt;/a&gt;&lt;br/&gt;

&lt;/p&gt;



&lt;div class=&quot;level1&quot;&gt;
&lt;table class=&quot;pagelist&quot;&gt;
	&lt;tr&gt;
		&lt;td class=&quot;page&quot;&gt;&lt;a href=&quot;http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:17:python_webservice_part_1_a_twisted_solution&quot;&gt;Python Webservice, part 1 : a Twisted solution&lt;/a&gt;&lt;/td&gt;
		&lt;td class=&quot;date&quot;&gt;2010/02/17 20:02&lt;/td&gt;
		&lt;td class=&quot;user&quot;&gt;Yann Hodique&lt;/td&gt;
		&lt;td class=&quot;tags&quot;&gt;&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/zsi&quot; class=&quot;wikilink1&quot; title=&quot;tags:zsi&quot; rel=&quot;tag&quot;&gt;zsi&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;zsi&quot; [17-] --&gt;</description>
    </item>
    <item rdf:about="http://www.hodique.info/tags/twisted">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T11:31:16+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>twisted</title>
        <link>http://www.hodique.info/tags/twisted</link>
        <description>
&lt;p&gt;
« &lt;a href=&quot;http://www.hodique.info/tags&quot; class=&quot;wikilink1&quot; title=&quot;tags&quot;&gt;Blog Tags&lt;/a&gt;&lt;br/&gt;

&lt;/p&gt;



&lt;div class=&quot;level1&quot;&gt;
&lt;table class=&quot;pagelist&quot;&gt;
	&lt;tr&gt;
		&lt;td class=&quot;page&quot;&gt;&lt;a href=&quot;http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:17:python_webservice_part_1_a_twisted_solution&quot;&gt;Python Webservice, part 1 : a Twisted solution&lt;/a&gt;&lt;/td&gt;
		&lt;td class=&quot;date&quot;&gt;2010/02/17 20:02&lt;/td&gt;
		&lt;td class=&quot;user&quot;&gt;Yann Hodique&lt;/td&gt;
		&lt;td class=&quot;tags&quot;&gt;&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/zsi&quot; class=&quot;wikilink1&quot; title=&quot;tags:zsi&quot; rel=&quot;tag&quot;&gt;zsi&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td class=&quot;page&quot;&gt;&lt;a href=&quot;http://www.hodique.info/blog/2010/02/18/python_webservice_part_2_a_twistd_integration&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:18:python_webservice_part_2_a_twistd_integration&quot;&gt;Python Webservice, part 2 : a twistd integration&lt;/a&gt;&lt;/td&gt;
		&lt;td class=&quot;date&quot;&gt;2010/02/19 00:01&lt;/td&gt;
		&lt;td class=&quot;user&quot;&gt;Yann Hodique&lt;/td&gt;
		&lt;td class=&quot;tags&quot;&gt;&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;twisted&quot; [17-] --&gt;</description>
    </item>
    <item rdf:about="http://www.hodique.info/tags/test">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T11:30:56+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>test</title>
        <link>http://www.hodique.info/tags/test</link>
        <description>
&lt;p&gt;
« &lt;a href=&quot;http://www.hodique.info/tags&quot; class=&quot;wikilink1&quot; title=&quot;tags&quot;&gt;Blog Tags&lt;/a&gt;&lt;br/&gt;

&lt;/p&gt;



&lt;div class=&quot;level1&quot;&gt;
&lt;table class=&quot;pagelist&quot;&gt;
	&lt;tr&gt;
		&lt;td class=&quot;page&quot;&gt;&lt;a href=&quot;http://www.hodique.info/playground/playground&quot; class=&quot;wikilink1&quot; title=&quot;playground:playground&quot;&gt;Playground&lt;/a&gt;&lt;/td&gt;
		&lt;td class=&quot;date&quot;&gt;2010/02/14 08:58&lt;/td&gt;
		&lt;td class=&quot;user&quot;&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td class=&quot;tags&quot;&gt;&lt;a href=&quot;http://www.hodique.info/tags/test&quot; class=&quot;wikilink1&quot; title=&quot;tags:test&quot; rel=&quot;tag&quot;&gt;test&lt;/a&gt;&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;test&quot; [17-] --&gt;</description>
    </item>
    <item rdf:about="http://www.hodique.info/tags/python">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-18T11:30:38+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>python</title>
        <link>http://www.hodique.info/tags/python</link>
        <description>
&lt;p&gt;
« &lt;a href=&quot;http://www.hodique.info/tags&quot; class=&quot;wikilink1&quot; title=&quot;tags&quot;&gt;Blog Tags&lt;/a&gt;&lt;br/&gt;

&lt;/p&gt;



&lt;div class=&quot;level1&quot;&gt;
&lt;table class=&quot;pagelist&quot;&gt;
	&lt;tr&gt;
		&lt;td class=&quot;page&quot;&gt;&lt;a href=&quot;http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:17:python_webservice_part_1_a_twisted_solution&quot;&gt;Python Webservice, part 1 : a Twisted solution&lt;/a&gt;&lt;/td&gt;
		&lt;td class=&quot;date&quot;&gt;2010/02/17 20:02&lt;/td&gt;
		&lt;td class=&quot;user&quot;&gt;Yann Hodique&lt;/td&gt;
		&lt;td class=&quot;tags&quot;&gt;&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/zsi&quot; class=&quot;wikilink1&quot; title=&quot;tags:zsi&quot; rel=&quot;tag&quot;&gt;zsi&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td class=&quot;page&quot;&gt;&lt;a href=&quot;http://www.hodique.info/blog/2010/02/18/python_webservice_part_2_a_twistd_integration&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:18:python_webservice_part_2_a_twistd_integration&quot;&gt;Python Webservice, part 2 : a twistd integration&lt;/a&gt;&lt;/td&gt;
		&lt;td class=&quot;date&quot;&gt;2010/02/19 00:01&lt;/td&gt;
		&lt;td class=&quot;user&quot;&gt;Yann Hodique&lt;/td&gt;
		&lt;td class=&quot;tags&quot;&gt;&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;python&quot; [17-] --&gt;</description>
    </item>
    <item rdf:about="http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-17T20:20:16+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>Python Webservice, part 1 : a Twisted solution</title>
        <link>http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;


&lt;div class=&quot;styler styler-float-left&quot;&gt;
&lt;p&gt;
&lt;span class=&quot;vcard&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=15d77b&amp;amp;cache=recache&amp;amp;media=http%3A%2F%2Fwww.gravatar.com%2Favatar.php%3Fgravatar_id%3Dd9b955e7af49b0cbfd68c15947b25012%26default%3Dhttp%253A%252F%252Fwww.hodique.info%252Flib%252Fexe%252Ffetch.php%253Fhash%253Dd44619%2526cache%253Drecache%2526media%253Dhttp%25253A%25252F%25252Fwww.hodique.info%25252F%25252Flib%25252Fplugins%25252Favatar%25252Fmonsterid.php%25253Fseed%25253Dd9b955e7af49b0cbfd68c15947b25012%252526size%25253D40%252526.png%26size%3D40%26rating%3DR%26.jpg&quot; class=&quot;media photo fn&quot; title=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; alt=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; width=&quot;40&quot; height=&quot;40&quot; /&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;


&lt;p&gt;
As mentioned &lt;a href=&quot;http://www.hodique.info/blog/2009/11/15/https_traffic_logger&quot; class=&quot;wikilink1&quot; title=&quot;blog:2009:11:15:https_traffic_logger&quot;&gt;previously&lt;/a&gt;
I&amp;#039;ve been spending some time recently working on a &lt;acronym title=&quot;Simple Object Access Protocol&quot;&gt;SOAP&lt;/acronym&gt; server mock. For this I&amp;#039;ve used Python &lt;a href=&quot;http://twistedmatrix.com&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com&quot;  rel=&quot;nofollow&quot;&gt;Twisted&lt;/a&gt; and &lt;a href=&quot;http://pywebsvcs.sourceforge.net/zsi.html&quot; class=&quot;urlextern&quot; title=&quot;http://pywebsvcs.sourceforge.net/zsi.html&quot;  rel=&quot;nofollow&quot;&gt;ZSI&lt;/a&gt;. Since the interaction between the 2 seems rather poorly documented (even Google doesn&amp;#039;t know much about it), I thought I&amp;#039;d share what I&amp;#039;ve investigated and done.
&lt;/p&gt;

&lt;p&gt;
Disclaimer: you should be familiar with &lt;acronym title=&quot;Simple Object Access Protocol&quot;&gt;SOAP&lt;/acronym&gt; and Python Twisted. I&amp;#039;ll not cover anything in these areas.
&lt;/p&gt;

&lt;p&gt;
For the sake of simplicity, I&amp;#039;ll take a classical minimal server: an Echo service.
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s start from the definition of such a service, as a WSDL. This one was randomly picked from &lt;a href=&quot;http://www.ioncannon.net/programming/180/soap-on-the-google-app-engine-platform/&quot; class=&quot;urlextern&quot; title=&quot;http://www.ioncannon.net/programming/180/soap-on-the-google-app-engine-platform/&quot;  rel=&quot;nofollow&quot;&gt;there&lt;/a&gt;
Anyway the implementation details are not so important here.
&lt;/p&gt;
&lt;pre class=&quot;code xml&quot;&gt;&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;?xml&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;version&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;encoding&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;definitions&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/wsdl/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:soap&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/wsdl/soap/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:soapenc&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/encoding/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:http&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/wsdl/http/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:xsd&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:tns&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;targetNamespace&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt; &lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;types&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:schema&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;elementFormDefault&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;qualified&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;targetNamespace&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:complexType&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
          &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:sequence&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;xsd:anyType&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
          &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/xsd:sequence&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/xsd:complexType&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/xsd:element&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/xsd:schema&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/types&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;message&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoRequest&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;part&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;parameters&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;element&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:Echo&amp;quot;&lt;/span&gt; &lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/message&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;message&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoResponse&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;part&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;parameters&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;element&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/message&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;portType&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoServer&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;operation&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;message&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:EchoRequest&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;output&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;message&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:EchoResponse&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/operation&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/portType&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;binding&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoServer&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:EchoServer&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:binding&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;style&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;document&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;                  &lt;span class=&quot;re0&quot;&gt;transport&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/http&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;operation&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:operation&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;soapAction&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;input&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:body&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;use&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;literal&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/input&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;output&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:body&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;use&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;literal&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/output&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/operation&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/binding&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;service&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoServer&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;port&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoServer&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;binding&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:EchoServer&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:address&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;location&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://localhost:8080/echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/port&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/service&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/definitions&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
So really nothing fancy here. Just the definitions and shape of the
messages/operations (only trivial ones).
&lt;/p&gt;

&lt;p&gt;
ZSI offers the &lt;code&gt;wsdl2py&lt;/code&gt; tool, that can process such WSDL files, and produce client bindings and server stub. In this article, the server part is what we want. (note the &lt;code&gt;-w&lt;/code&gt; flag will trigger Twisted code generation)
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;$ wsdl2py &lt;span class=&quot;re5&quot;&gt;-w&lt;/span&gt; echo.wsdl&lt;/pre&gt;

&lt;p&gt;
&lt;code&gt;EchoServer_server.py&lt;/code&gt; now contains the code for the service stub. Not much in there, the main part being the following method:
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; soap_Echo&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
    request = ps.&lt;span class=&quot;me1&quot;&gt;Parse&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;EchoRequest.&lt;span class=&quot;me1&quot;&gt;typecode&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; request,EchoResponse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
This is the one we should implement to make the service concrete. Here is a first attempt:
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;EchoServer&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        EchoServer.&lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; soap_Echo&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        request, _ = EchoServer.&lt;span class=&quot;me1&quot;&gt;soap_Echo&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; request, request&lt;/pre&gt;

&lt;p&gt;
That will work. If you register this Service as a Twisted Resource, it will provide a functional &lt;acronym title=&quot;Simple Object Access Protocol&quot;&gt;SOAP&lt;/acronym&gt; Echo service, on which you can execute the following.
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;$ POST http:&lt;span class=&quot;sy0&quot;&gt;//&lt;/span&gt;localhost:8080&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;echo&lt;/span&gt;
Please enter content &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;application&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;x-www-form-urlencoded&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; to be POSTed:
&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;soapenv:Envelope 
    xmlns:&lt;span class=&quot;re2&quot;&gt;soapenv&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&lt;/span&gt; 
    xmlns:&lt;span class=&quot;re2&quot;&gt;xsd&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt; 
    xmlns:&lt;span class=&quot;re2&quot;&gt;xsi&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;soapenv:Body xmlns:&lt;span class=&quot;re2&quot;&gt;ns1&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;ns1:Echo&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;ns1:value xsi:&lt;span class=&quot;kw3&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;xsd:string&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;plop&lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;ns1:value&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;ns1:Echo&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;soapenv:Body&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;soapenv:Envelope&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
^D
&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;soapenv:Envelope xmlns:&lt;span class=&quot;re2&quot;&gt;ZSI&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.zolera.com/schemas/ZSI/&amp;quot;&lt;/span&gt; xmlns:&lt;span class=&quot;re2&quot;&gt;soapenc&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/encoding/&amp;quot;&lt;/span&gt; xmlns:&lt;span class=&quot;re2&quot;&gt;soapenv&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&lt;/span&gt; xmlns:&lt;span class=&quot;re2&quot;&gt;xsd&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt; xmlns:&lt;span class=&quot;re2&quot;&gt;xsi&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;soapenv:Header&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;soapenv:Header&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;soapenv:Body xmlns:&lt;span class=&quot;re2&quot;&gt;ns1&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;ns1:Echo&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;ns1:value xsi:&lt;span class=&quot;kw3&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;xsd:string&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;plop&lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;ns1:value&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;ns1:Echo&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;soapenv:Body&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;soapenv:Envelope&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Still, this is not very Twisted… I mean we don&amp;#039;t take advantage of the asynchronous framework here, as the only method we wrote is definitely synchronous and we treat each call after one another. Would the &lt;code&gt;soap_Echo()&lt;/code&gt; take time for whatever reason, that would introduce unacceptable delays for the user.
Of course, there is no magic in the &lt;code&gt;Deferred&lt;/code&gt; objects, which means than simply returning a &lt;code&gt;Deferred&lt;/code&gt; in &lt;code&gt;soap_Echo()&lt;/code&gt; will absolutely not work.
&lt;/p&gt;

&lt;p&gt;
Digging a bit more in the ZSI Twisted glue, one can find a promising piece of code, appropriately named &lt;code&gt;DeferHandlerChain&lt;/code&gt;. This is an alternative to the &lt;code&gt;DefaultHandlerChain&lt;/code&gt; that&amp;#039;s used (by default) by &lt;code&gt;WSresource&lt;/code&gt; objects (hence &lt;code&gt;EchoServer&lt;/code&gt; ones). The nice property of this handler chain is to put in place a callback chain from &lt;code&gt;processRequest()&lt;/code&gt; to &lt;code&gt;processResponse()&lt;/code&gt;, actually supporting &lt;code&gt;Deferred&lt;/code&gt; objects returned by soap methods. In a word, what we need…
&lt;/p&gt;

&lt;p&gt;
The code can become something like:
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoDeferHandlerChainFactory:
    protocol = DeferHandlerChain
&amp;nbsp;
    @&lt;span class=&quot;kw2&quot;&gt;classmethod&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; newInstance&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;cls&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; cls.&lt;span class=&quot;me1&quot;&gt;protocol&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DefaultCallbackHandler, DataHandler&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;EchoServer&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        EchoServer.&lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        EchoServer.&lt;span class=&quot;me1&quot;&gt;factory&lt;/span&gt; = EchoDeferHandlerChainFactory
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; soap_Echo&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        request, _ = EchoServer.&lt;span class=&quot;me1&quot;&gt;soap_Echo&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; _answer&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
            &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; request
&amp;nbsp;
        &lt;span class=&quot;co1&quot;&gt;# yeah, we have a very busy echo service... 5 seconds delay !&lt;/span&gt;
        d = deferLater&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;reactor, 5, _answer&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; request, d&lt;/pre&gt;

&lt;p&gt;
You can now try triggering several parallel Echo calls, and see that they will not be treated in sequence !
&lt;/p&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/zsi&quot; class=&quot;wikilink1&quot; title=&quot;tags:zsi&quot; rel=&quot;tag&quot;&gt;zsi&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;span class=&quot;plugin_feedmod_comments&quot;&gt;
  &lt;a href=&quot;http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution#discussion__section&quot; title=&quot;Read or add comments to this article&quot;&gt;Read or add comments to this article&lt;/a&gt;
&lt;/span&gt;
</description>
    </item>
    <item rdf:about="http://www.hodique.info/blog/2010/02/14/magit_extensions">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-14T13:05:08+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title>Magit extensions</title>
        <link>http://www.hodique.info/blog/2010/02/14/magit_extensions</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;


&lt;div class=&quot;styler styler-float-left&quot;&gt;
&lt;p&gt;
&lt;span class=&quot;vcard&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=15d77b&amp;amp;cache=recache&amp;amp;media=http%3A%2F%2Fwww.gravatar.com%2Favatar.php%3Fgravatar_id%3Dd9b955e7af49b0cbfd68c15947b25012%26default%3Dhttp%253A%252F%252Fwww.hodique.info%252Flib%252Fexe%252Ffetch.php%253Fhash%253Dd44619%2526cache%253Drecache%2526media%253Dhttp%25253A%25252F%25252Fwww.hodique.info%25252F%25252Flib%25252Fplugins%25252Favatar%25252Fmonsterid.php%25253Fseed%25253Dd9b955e7af49b0cbfd68c15947b25012%252526size%25253D40%252526.png%26size%3D40%26rating%3DR%26.jpg&quot; class=&quot;media photo fn&quot; title=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; alt=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; width=&quot;40&quot; height=&quot;40&quot; /&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;a href=&quot;http://zagadka.vm.bytemark.co.uk/magit/&quot; class=&quot;urlextern&quot; title=&quot;http://zagadka.vm.bytemark.co.uk/magit/&quot;  rel=&quot;nofollow&quot;&gt;Magit&lt;/a&gt; is a great emacs tool to help doing everyday&amp;#039;s operations on &lt;a href=&quot;http://git-scm.com/&quot; class=&quot;urlextern&quot; title=&quot;http://git-scm.com/&quot;  rel=&quot;nofollow&quot;&gt;Git&lt;/a&gt; repositories.
In particular, I really like the contextual approach, that splits the global status in sections, meaning that the same high-level command can have subtle semantics differences when applied to different objects.
As an example, the high-level `magit-discard-item&amp;#039; function obviously takes different steps when applied to an untracked file or to a staged hunk, or even to an entire branch.
&lt;/p&gt;

&lt;p&gt;
The only disadvantage I see in the current implementation is the lack of modularity in it: a heavy use of (really nice, btw) macros makes it mandatory to have the complete set of features available when magit is loaded, so that the generated code is complete.
&lt;/p&gt;

&lt;p&gt;
Still, Git has lots of contributed helpers, which means the only stable way of using them with Magit is to have them integrated upstream, which is not always possible (take the example of custom helpers that cannot be distributed) or does not even make sense (those helpers could be entirely bound to some specificities of a project).
&lt;/p&gt;

&lt;p&gt;
I&amp;#039;ve been working on an attempt to make Magit more modular, by allowing the registration of so-called “extensions”. See code here: &lt;a href=&quot;http://github.com/sigma/magit/tree/extensions&quot; class=&quot;urlextern&quot; title=&quot;http://github.com/sigma/magit/tree/extensions&quot;  rel=&quot;nofollow&quot;&gt;http://github.com/sigma/magit/tree/extensions&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
As a POC, I&amp;#039;ve extracted 2 features from the mainstream Magit, and converted them to extensions: those are magit-svn and magit-topgit.
The way I see things, those 2 features are exactly the kind I&amp;#039;d like to add to magit for my daily work but that would not necessarily make sense as part of the core project. As far as I know, the current behavior when those 2 extensions are loaded is exactly the same as the regular upstream version (including placement of the various sections)
&lt;/p&gt;

&lt;p&gt;
The current code allows you to:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; define new kind of sections (for example a “topic” kind)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; define how and where to display them (for example, right after the core “stashes” section)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; hook new behavior for existing commands for those new sections (for example a way to discard such an item)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; define new top-level commands, and associate menus&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

I tried to stay very close from the Magit way of doing things, and in particular the way you express things in extensions is exactly the same as what you do in the core code. Once again, tricky macros are at play to make the code look the same.
&lt;/p&gt;

&lt;p&gt;
What I&amp;#039;d like to see in the future (though I don&amp;#039;t have much time to do it right now :():
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; new extensions, to ease my daily life.&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; a magit-p4 (perforce integration),&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; maybe a magit-stgit (stgit in place of topgit for topic branches)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; something to integrate with VMware&amp;#039;s &lt;a href=&quot;http://www.reviewboard.org/&quot; class=&quot;urlextern&quot; title=&quot;http://www.reviewboard.org/&quot;  rel=&quot;nofollow&quot;&gt;ReviewBoard&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; code stabilization, and official proposal upstream (if there is an interest in this)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; a way to activate those extensions on a per-project basis (I use both git-svn and git-p4 but never at the same time. same for topgit vs stgit)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

An example being worth a thousand words, here is how to code the magit-topic extension. If you know the Magit code base, you should feel nearly at home.
&lt;script src=&quot;http://gist.github.com/303969.js?file=magit-topic.el&quot;&gt;&lt;/script&gt;
&lt;/p&gt;

&lt;p&gt;
Feel free to tell me what you think, any comment or advice is highly welcome !
&lt;/p&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/emacs&quot; class=&quot;wikilink1&quot; title=&quot;tags:emacs&quot; rel=&quot;tag&quot;&gt;emacs&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/git&quot; class=&quot;wikilink1&quot; title=&quot;tags:git&quot; rel=&quot;tag&quot;&gt;git&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;span class=&quot;plugin_feedmod_comments&quot;&gt;
  &lt;a href=&quot;http://www.hodique.info/blog/2010/02/14/magit_extensions#discussion__section&quot; title=&quot;Read or add comments to this article&quot;&gt;Read or add comments to this article&lt;/a&gt;
&lt;/span&gt;
</description>
    </item>
    <item rdf:about="http://www.hodique.info/blog">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-14T12:16:25+01:00</dc:date>
        <dc:creator>Yann Hodique</dc:creator>
        <title></title>
        <link>http://www.hodique.info/blog</link>
        <description>
&lt;p&gt;

&lt;div class=&quot;hfeed&quot;&gt;
&lt;div class=&quot;plugin_include_content&quot; id=&quot;plugin_include__blog:2010:02:18:python_webservice_part_2_a_twistd_integration&quot;&gt;



&lt;h1&gt;&lt;a name=&quot;python_webservice_part_2_a_twistd_integration&quot; id=&quot;python_webservice_part_2_a_twistd_integration&quot; href=&quot;/blog/2010/02/18/python_webservice_part_2_a_twistd_integration&quot; title=&quot;Python Webservice, part 2 : a twistd integration&quot;&gt;Python Webservice, part 2 : a twistd integration&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;


&lt;div class=&quot;styler styler-float-left&quot;&gt;
&lt;p&gt;
&lt;span class=&quot;vcard&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=15d77b&amp;amp;cache=recache&amp;amp;media=http%3A%2F%2Fwww.gravatar.com%2Favatar.php%3Fgravatar_id%3Dd9b955e7af49b0cbfd68c15947b25012%26default%3Dhttp%253A%252F%252Fwww.hodique.info%252Flib%252Fexe%252Ffetch.php%253Fhash%253Dd44619%2526cache%253Drecache%2526media%253Dhttp%25253A%25252F%25252Fwww.hodique.info%25252F%25252Flib%25252Fplugins%25252Favatar%25252Fmonsterid.php%25253Fseed%25253Dd9b955e7af49b0cbfd68c15947b25012%252526size%25253D40%252526.png%26size%3D40%26rating%3DR%26.jpg&quot; class=&quot;media photo fn&quot; title=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; alt=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; width=&quot;40&quot; height=&quot;40&quot; /&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;


&lt;/div&gt;

&lt;h2&gt;&lt;a name=&quot;twistd&quot; id=&quot;twistd&quot;&gt;Twistd&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
In my &lt;a href=&quot;http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:17:python_webservice_part_1_a_twisted_solution&quot;&gt;previous post&lt;/a&gt; I&amp;#039;ve explained how to generate a &lt;acronym title=&quot;Simple Object Access Protocol&quot;&gt;SOAP&lt;/acronym&gt; service from a WSDL file, and how to implement the required methods properly. A solution to run such a service is to use the Twisted Daemon, aka &lt;code&gt;twistd&lt;/code&gt;.
Though not needed, strictly speaking, it provides a nice &lt;a href=&quot;http://twistedmatrix.com/documents/current/core/howto/basics.html&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com/documents/current/core/howto/basics.html&quot;  rel=&quot;nofollow&quot;&gt;set of features&lt;/a&gt; aimed at easing complex applications development.
&lt;/p&gt;

&lt;p&gt;
In particular, it allows to write so-called &lt;a href=&quot;http://twistedmatrix.com/documents/current/core/howto/tap.html&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com/documents/current/core/howto/tap.html&quot;  rel=&quot;nofollow&quot;&gt;plugins&lt;/a&gt; that make it possible to just launch services in the following way:

&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;$ twistd &lt;span class=&quot;kw3&quot;&gt;echo&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
To achieve that, one has to create a file &lt;code&gt;twisted/plugins/echo.py&lt;/code&gt; accessible somewhere from the python path (that is, the &lt;code&gt;twisted&lt;/code&gt; directory should be a subdir of an element of the path).
&lt;/p&gt;

&lt;/div&gt;

&lt;h2&gt;&lt;a name=&quot;manhole&quot; id=&quot;manhole&quot;&gt;Manhole&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Twisted offers a nice service, that can be used to provide an inspection/debug interface for your main application. This is called &lt;a href=&quot;http://twistedmatrix.com/documents/9.0.0/api/twisted.manhole.html&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com/documents/9.0.0/api/twisted.manhole.html&quot;  rel=&quot;nofollow&quot;&gt;manhole&lt;/a&gt; and provides a python interpreter interface. This way you can just telnet/ssh the manhole, and execute appropriate commands to introspect the current state of the application, or put it in the desired state.
&lt;/p&gt;

&lt;p&gt;
A nice example of a really useful function to run from the manhole service is the &lt;a href=&quot;http://twistedmatrix.com/documents/9.0.0/api/twisted.python.rebuild.html&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com/documents/9.0.0/api/twisted.python.rebuild.html&quot;  rel=&quot;nofollow&quot;&gt;rebuild&lt;/a&gt; one. It tries very hard to provide in-place reloading of code (and corresponding objects). Don&amp;#039;t expect any wonder here, it will fail in some corner cases. Still, it proves really useful most of the time, and helps a lot not restarting the server every now and then.
&lt;/p&gt;

&lt;/div&gt;

&lt;h2&gt;&lt;a name=&quot;example&quot; id=&quot;example&quot;&gt;Example&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Here is a fully working example of a twistd plugin for the Echo service, with a functional manhole service in addition.
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; zope.&lt;span class=&quot;me1&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; implements
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; usage
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;python&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;rebuild&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; rebuild
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;plugin&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; IPlugin
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;application&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; IServiceMaker, MultiService
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;application&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;internet&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; TCPServer
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;web&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; Site
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;web&lt;/span&gt;.&lt;span class=&quot;kw3&quot;&gt;resource&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; Resource
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; twisted.&lt;span class=&quot;me1&quot;&gt;conch&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;manhole_tap&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; makeService &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; makeConsoleService
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;from&lt;/span&gt; EchoImpl &lt;span class=&quot;kw1&quot;&gt;import&lt;/span&gt; EchoService
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoOptions&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;usage.&lt;span class=&quot;me1&quot;&gt;Options&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
    optParameters = &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;port&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8080&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;main port&amp;quot;&lt;/span&gt;, &lt;span class=&quot;kw2&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;,
                     &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;service-port&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt;, &lt;span class=&quot;nu0&quot;&gt;8081&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;service port&amp;quot;&lt;/span&gt;, &lt;span class=&quot;kw2&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;,
                     &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;service-users&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&amp;quot;/etc/passwd&amp;quot;&lt;/span&gt;,
                      &lt;span class=&quot;st0&quot;&gt;&amp;quot;The path to a passwd-like authentication file&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoServiceMaker&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
    implements&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;IServiceMaker, IPlugin&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    tapname = &lt;span class=&quot;st0&quot;&gt;&amp;quot;echo&amp;quot;&lt;/span&gt;
    description = &lt;span class=&quot;st0&quot;&gt;&amp;quot;Sample Echo service&amp;quot;&lt;/span&gt;
    options = EchoOptions
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; makeService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, options&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span class=&quot;co1&quot;&gt;# Create Service&lt;/span&gt;
        srv = EchoService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        root = Resource&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;co1&quot;&gt;# we'll serve Echo at http://&amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;/echo&lt;/span&gt;
        root.&lt;span class=&quot;me1&quot;&gt;putChild&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'echo'&lt;/span&gt;, srv&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        siteFactory = Site&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;root&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        echo_service = TCPServer&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;options&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'port'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;, siteFactory&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        console_service = makeConsoleService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;
            &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;telnetPort&amp;quot;&lt;/span&gt;: &lt;span class=&quot;kw2&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;options&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'service-port'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;,
             &lt;span class=&quot;st0&quot;&gt;&amp;quot;sshPort&amp;quot;&lt;/span&gt;: &lt;span class=&quot;kw2&quot;&gt;None&lt;/span&gt;,
             &lt;span class=&quot;st0&quot;&gt;&amp;quot;namespace&amp;quot;&lt;/span&gt;: &lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;service&amp;quot;&lt;/span&gt;: srv,
                           &lt;span class=&quot;st0&quot;&gt;&amp;quot;rebuild&amp;quot;&lt;/span&gt;: rebuild&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;,
             &lt;span class=&quot;st0&quot;&gt;&amp;quot;passwd&amp;quot;&lt;/span&gt;: options&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;'service-users'&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        svc = MultiService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        echo_service.&lt;span class=&quot;me1&quot;&gt;setServiceParent&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;svc&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        console_service.&lt;span class=&quot;me1&quot;&gt;setServiceParent&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;svc&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; svc
&amp;nbsp;
serviceMaker = EchoServiceMaker&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
The code is hopefully rather straightforward. It should be noted that the manhole service (created by the &lt;code&gt;makeConsoleService()&lt;/code&gt; call) needs to know about a set of objects (the “namespace” key). Those objects are the roots for everything accessible from the service. Here, the main service object (the &lt;code&gt;srv&lt;/code&gt; object) is available to the manhole under the name &lt;code&gt;service&lt;/code&gt;. Here is how it can be used:
&lt;/p&gt;
&lt;pre class=&quot;code shell&quot;&gt;$ telnet localhost 8081
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Username: yann
Password: x
&amp;nbsp;
&amp;gt;&amp;gt;&amp;gt; print service
&amp;lt;EchoImpl.EchoService object at 0x2fc8c10&amp;gt;
&amp;gt;&amp;gt;&amp;gt;&lt;/pre&gt;

&lt;p&gt;
Hint: the password is really &amp;#039;x&amp;#039;, as I&amp;#039;m using /etc/passwd by default, which contains &amp;#039;x&amp;#039; for every “password” field, since the real passwords are in /etc/shadow.
Convenient for a dev deployment ;)
&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;inclmeta level1&quot;&gt;
	&lt;abbr class=&quot;published&quot; title=&quot;2010-02-19T00:01:46Z&quot;&gt;2010/02/19 00:01&lt;/abbr&gt;
	&amp;middot; &lt;span class=&quot;vcard author&quot;&gt;&lt;a href=&quot;http://www.hodique.info/user/yann_hodique&quot; class=&quot;wikilink1 url fn&quot; title=&quot;user:yann_hodique&quot;&gt;Yann Hodique&lt;/a&gt;&lt;/span&gt;
	&amp;middot; &lt;span class=&quot;comment&quot;&gt;&lt;a href=&quot;http://www.hodique.info/blog/2010/02/18/python_webservice_part_2_a_twistd_integration#discussion__section&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:18:python_webservice_part_2_a_twistd_integration#discussion__section&quot;&gt;0&amp;nbsp;Comments&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;
	&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;plugin_include_content&quot; id=&quot;plugin_include__blog:2010:02:17:python_webservice_part_1_a_twisted_solution&quot;&gt;



&lt;h1&gt;&lt;a name=&quot;python_webservice_part_1_a_twisted_solution&quot; id=&quot;python_webservice_part_1_a_twisted_solution&quot; href=&quot;/blog/2010/02/17/python_webservice_part_1_a_twisted_solution&quot; title=&quot;Python Webservice, part 1 : a Twisted solution&quot;&gt;Python Webservice, part 1 : a Twisted solution&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;


&lt;div class=&quot;styler styler-float-left&quot;&gt;
&lt;p&gt;
&lt;span class=&quot;vcard&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=15d77b&amp;amp;cache=recache&amp;amp;media=http%3A%2F%2Fwww.gravatar.com%2Favatar.php%3Fgravatar_id%3Dd9b955e7af49b0cbfd68c15947b25012%26default%3Dhttp%253A%252F%252Fwww.hodique.info%252Flib%252Fexe%252Ffetch.php%253Fhash%253Dd44619%2526cache%253Drecache%2526media%253Dhttp%25253A%25252F%25252Fwww.hodique.info%25252F%25252Flib%25252Fplugins%25252Favatar%25252Fmonsterid.php%25253Fseed%25253Dd9b955e7af49b0cbfd68c15947b25012%252526size%25253D40%252526.png%26size%3D40%26rating%3DR%26.jpg&quot; class=&quot;media photo fn&quot; title=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; alt=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; width=&quot;40&quot; height=&quot;40&quot; /&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;


&lt;p&gt;
As mentioned &lt;a href=&quot;http://www.hodique.info/blog/2009/11/15/https_traffic_logger&quot; class=&quot;wikilink1&quot; title=&quot;blog:2009:11:15:https_traffic_logger&quot;&gt;previously&lt;/a&gt;
I&amp;#039;ve been spending some time recently working on a &lt;acronym title=&quot;Simple Object Access Protocol&quot;&gt;SOAP&lt;/acronym&gt; server mock. For this I&amp;#039;ve used Python &lt;a href=&quot;http://twistedmatrix.com&quot; class=&quot;urlextern&quot; title=&quot;http://twistedmatrix.com&quot;  rel=&quot;nofollow&quot;&gt;Twisted&lt;/a&gt; and &lt;a href=&quot;http://pywebsvcs.sourceforge.net/zsi.html&quot; class=&quot;urlextern&quot; title=&quot;http://pywebsvcs.sourceforge.net/zsi.html&quot;  rel=&quot;nofollow&quot;&gt;ZSI&lt;/a&gt;. Since the interaction between the 2 seems rather poorly documented (even Google doesn&amp;#039;t know much about it), I thought I&amp;#039;d share what I&amp;#039;ve investigated and done.
&lt;/p&gt;

&lt;p&gt;
Disclaimer: you should be familiar with &lt;acronym title=&quot;Simple Object Access Protocol&quot;&gt;SOAP&lt;/acronym&gt; and Python Twisted. I&amp;#039;ll not cover anything in these areas.
&lt;/p&gt;

&lt;p&gt;
For the sake of simplicity, I&amp;#039;ll take a classical minimal server: an Echo service.
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s start from the definition of such a service, as a WSDL. This one was randomly picked from &lt;a href=&quot;http://www.ioncannon.net/programming/180/soap-on-the-google-app-engine-platform/&quot; class=&quot;urlextern&quot; title=&quot;http://www.ioncannon.net/programming/180/soap-on-the-google-app-engine-platform/&quot;  rel=&quot;nofollow&quot;&gt;there&lt;/a&gt;
Anyway the implementation details are not so important here.
&lt;/p&gt;
&lt;pre class=&quot;code xml&quot;&gt;&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;?xml&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;version&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;encoding&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;definitions&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/wsdl/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:soap&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/wsdl/soap/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:soapenc&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/encoding/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:http&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/wsdl/http/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:xsd&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;xmlns:tns&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;    &lt;span class=&quot;re0&quot;&gt;targetNamespace&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt; &lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;types&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:schema&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;elementFormDefault&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;qualified&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;targetNamespace&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:complexType&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
          &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:sequence&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;xsd:element&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;xsd:anyType&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
          &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/xsd:sequence&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/xsd:complexType&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/xsd:element&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/xsd:schema&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/types&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;message&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoRequest&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;part&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;parameters&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;element&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:Echo&amp;quot;&lt;/span&gt; &lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/message&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;message&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoResponse&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;part&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;parameters&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;element&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/message&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;portType&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoServer&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;operation&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;message&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:EchoRequest&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;output&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;message&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:EchoResponse&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/operation&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/portType&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;binding&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoServer&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:EchoServer&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:binding&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;style&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;document&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;sc3&quot;&gt;                  &lt;span class=&quot;re0&quot;&gt;transport&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/http&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;operation&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:operation&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;soapAction&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;Echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;input&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:body&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;use&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;literal&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/input&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;output&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:body&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;use&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;literal&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/output&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/operation&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/binding&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;service&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoServer&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;port&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;EchoServer&amp;quot;&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;binding&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;tns:EchoServer&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
      &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;soap:address&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;location&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://localhost:8080/echo&amp;quot;&lt;/span&gt;&lt;span class=&quot;re2&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/port&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/service&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;sc3&quot;&gt;&lt;span class=&quot;re1&quot;&gt;&amp;lt;/definitions&lt;span class=&quot;re2&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
So really nothing fancy here. Just the definitions and shape of the
messages/operations (only trivial ones).
&lt;/p&gt;

&lt;p&gt;
ZSI offers the &lt;code&gt;wsdl2py&lt;/code&gt; tool, that can process such WSDL files, and produce client bindings and server stub. In this article, the server part is what we want. (note the &lt;code&gt;-w&lt;/code&gt; flag will trigger Twisted code generation)
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;$ wsdl2py &lt;span class=&quot;re5&quot;&gt;-w&lt;/span&gt; echo.wsdl&lt;/pre&gt;

&lt;p&gt;
&lt;code&gt;EchoServer_server.py&lt;/code&gt; now contains the code for the service stub. Not much in there, the main part being the following method:
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; soap_Echo&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
    request = ps.&lt;span class=&quot;me1&quot;&gt;Parse&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;EchoRequest.&lt;span class=&quot;me1&quot;&gt;typecode&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; request,EchoResponse&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
This is the one we should implement to make the service concrete. Here is a first attempt:
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;EchoServer&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        EchoServer.&lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; soap_Echo&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        request, _ = EchoServer.&lt;span class=&quot;me1&quot;&gt;soap_Echo&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; request, request&lt;/pre&gt;

&lt;p&gt;
That will work. If you register this Service as a Twisted Resource, it will provide a functional &lt;acronym title=&quot;Simple Object Access Protocol&quot;&gt;SOAP&lt;/acronym&gt; Echo service, on which you can execute the following.
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;$ POST http:&lt;span class=&quot;sy0&quot;&gt;//&lt;/span&gt;localhost:8080&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;echo&lt;/span&gt;
Please enter content &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;application&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;x-www-form-urlencoded&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; to be POSTed:
&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;soapenv:Envelope 
    xmlns:&lt;span class=&quot;re2&quot;&gt;soapenv&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&lt;/span&gt; 
    xmlns:&lt;span class=&quot;re2&quot;&gt;xsd&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt; 
    xmlns:&lt;span class=&quot;re2&quot;&gt;xsi&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;soapenv:Body xmlns:&lt;span class=&quot;re2&quot;&gt;ns1&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;ns1:Echo&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;ns1:value xsi:&lt;span class=&quot;kw3&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;xsd:string&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;plop&lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;ns1:value&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;ns1:Echo&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;soapenv:Body&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;soapenv:Envelope&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
^D
&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;soapenv:Envelope xmlns:&lt;span class=&quot;re2&quot;&gt;ZSI&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.zolera.com/schemas/ZSI/&amp;quot;&lt;/span&gt; xmlns:&lt;span class=&quot;re2&quot;&gt;soapenc&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/encoding/&amp;quot;&lt;/span&gt; xmlns:&lt;span class=&quot;re2&quot;&gt;soapenv&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&lt;/span&gt; xmlns:&lt;span class=&quot;re2&quot;&gt;xsd&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt; xmlns:&lt;span class=&quot;re2&quot;&gt;xsi&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;sy0&quot;&gt;&amp;lt;&lt;/span&gt;soapenv:Header&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;soapenv:Header&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;soapenv:Body xmlns:&lt;span class=&quot;re2&quot;&gt;ns1&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;urn:ZSI&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;ns1:Echo&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;ns1:value xsi:&lt;span class=&quot;kw3&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;st0&quot;&gt;&amp;quot;xsd:string&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;plop&lt;span class=&quot;sy0&quot;&gt;&amp;lt;/&lt;/span&gt;ns1:value&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;ns1:Echo&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;soapenv:Body&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;soapenv:Envelope&lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Still, this is not very Twisted… I mean we don&amp;#039;t take advantage of the asynchronous framework here, as the only method we wrote is definitely synchronous and we treat each call after one another. Would the &lt;code&gt;soap_Echo()&lt;/code&gt; take time for whatever reason, that would introduce unacceptable delays for the user.
Of course, there is no magic in the &lt;code&gt;Deferred&lt;/code&gt; objects, which means than simply returning a &lt;code&gt;Deferred&lt;/code&gt; in &lt;code&gt;soap_Echo()&lt;/code&gt; will absolutely not work.
&lt;/p&gt;

&lt;p&gt;
Digging a bit more in the ZSI Twisted glue, one can find a promising piece of code, appropriately named &lt;code&gt;DeferHandlerChain&lt;/code&gt;. This is an alternative to the &lt;code&gt;DefaultHandlerChain&lt;/code&gt; that&amp;#039;s used (by default) by &lt;code&gt;WSresource&lt;/code&gt; objects (hence &lt;code&gt;EchoServer&lt;/code&gt; ones). The nice property of this handler chain is to put in place a callback chain from &lt;code&gt;processRequest()&lt;/code&gt; to &lt;code&gt;processResponse()&lt;/code&gt;, actually supporting &lt;code&gt;Deferred&lt;/code&gt; objects returned by soap methods. In a word, what we need…
&lt;/p&gt;

&lt;p&gt;
The code can become something like:
&lt;/p&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoDeferHandlerChainFactory:
    protocol = DeferHandlerChain
&amp;nbsp;
    @&lt;span class=&quot;kw2&quot;&gt;classmethod&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; newInstance&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;cls&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; cls.&lt;span class=&quot;me1&quot;&gt;protocol&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DefaultCallbackHandler, DataHandler&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;class&lt;/span&gt; EchoService&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;EchoServer&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        EchoServer.&lt;span class=&quot;kw4&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        EchoServer.&lt;span class=&quot;me1&quot;&gt;factory&lt;/span&gt; = EchoDeferHandlerChainFactory
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; soap_Echo&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
        request, _ = EchoServer.&lt;span class=&quot;me1&quot;&gt;soap_Echo&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;self&lt;/span&gt;, ps, &lt;span class=&quot;sy0&quot;&gt;**&lt;/span&gt;kw&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
        &lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; _answer&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
            &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; request
&amp;nbsp;
        &lt;span class=&quot;co1&quot;&gt;# yeah, we have a very busy echo service... 5 seconds delay !&lt;/span&gt;
        d = deferLater&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;reactor, 5, _answer&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;return&lt;/span&gt; request, d&lt;/pre&gt;

&lt;p&gt;
You can now try triggering several parallel Echo calls, and see that they will not be treated in sequence !
&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;inclmeta level1&quot;&gt;
	&lt;abbr class=&quot;published&quot; title=&quot;2010-02-17T20:02:04Z&quot;&gt;2010/02/17 20:02&lt;/abbr&gt;
	&amp;middot; &lt;span class=&quot;vcard author&quot;&gt;&lt;a href=&quot;http://www.hodique.info/user/yann_hodique&quot; class=&quot;wikilink1 url fn&quot; title=&quot;user:yann_hodique&quot;&gt;Yann Hodique&lt;/a&gt;&lt;/span&gt;
	&amp;middot; &lt;span class=&quot;comment&quot;&gt;&lt;a href=&quot;http://www.hodique.info/blog/2010/02/17/python_webservice_part_1_a_twisted_solution#discussion__section&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:17:python_webservice_part_1_a_twisted_solution#discussion__section&quot;&gt;0&amp;nbsp;Comments&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/python&quot; class=&quot;wikilink1&quot; title=&quot;tags:python&quot; rel=&quot;tag&quot;&gt;python&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/zsi&quot; class=&quot;wikilink1&quot; title=&quot;tags:zsi&quot; rel=&quot;tag&quot;&gt;zsi&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/twisted&quot; class=&quot;wikilink1&quot; title=&quot;tags:twisted&quot; rel=&quot;tag&quot;&gt;twisted&lt;/a&gt;
	&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;plugin_include_content&quot; id=&quot;plugin_include__blog:2010:02:14:magit_extensions&quot;&gt;



&lt;h1&gt;&lt;a name=&quot;magit_extensions&quot; id=&quot;magit_extensions&quot; href=&quot;/blog/2010/02/14/magit_extensions&quot; title=&quot;Magit extensions&quot;&gt;Magit extensions&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;


&lt;div class=&quot;styler styler-float-left&quot;&gt;
&lt;p&gt;
&lt;span class=&quot;vcard&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=15d77b&amp;amp;cache=recache&amp;amp;media=http%3A%2F%2Fwww.gravatar.com%2Favatar.php%3Fgravatar_id%3Dd9b955e7af49b0cbfd68c15947b25012%26default%3Dhttp%253A%252F%252Fwww.hodique.info%252Flib%252Fexe%252Ffetch.php%253Fhash%253Dd44619%2526cache%253Drecache%2526media%253Dhttp%25253A%25252F%25252Fwww.hodique.info%25252F%25252Flib%25252Fplugins%25252Favatar%25252Fmonsterid.php%25253Fseed%25253Dd9b955e7af49b0cbfd68c15947b25012%252526size%25253D40%252526.png%26size%3D40%26rating%3DR%26.jpg&quot; class=&quot;media photo fn&quot; title=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; alt=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; width=&quot;40&quot; height=&quot;40&quot; /&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;a href=&quot;http://zagadka.vm.bytemark.co.uk/magit/&quot; class=&quot;urlextern&quot; title=&quot;http://zagadka.vm.bytemark.co.uk/magit/&quot;  rel=&quot;nofollow&quot;&gt;Magit&lt;/a&gt; is a great emacs tool to help doing everyday&amp;#039;s operations on &lt;a href=&quot;http://git-scm.com/&quot; class=&quot;urlextern&quot; title=&quot;http://git-scm.com/&quot;  rel=&quot;nofollow&quot;&gt;Git&lt;/a&gt; repositories.
In particular, I really like the contextual approach, that splits the global status in sections, meaning that the same high-level command can have subtle semantics differences when applied to different objects.
As an example, the high-level `magit-discard-item&amp;#039; function obviously takes different steps when applied to an untracked file or to a staged hunk, or even to an entire branch.
&lt;/p&gt;

&lt;p&gt;
The only disadvantage I see in the current implementation is the lack of modularity in it: a heavy use of (really nice, btw) macros makes it mandatory to have the complete set of features available when magit is loaded, so that the generated code is complete.
&lt;/p&gt;

&lt;p&gt;
Still, Git has lots of contributed helpers, which means the only stable way of using them with Magit is to have them integrated upstream, which is not always possible (take the example of custom helpers that cannot be distributed) or does not even make sense (those helpers could be entirely bound to some specificities of a project).
&lt;/p&gt;

&lt;p&gt;
I&amp;#039;ve been working on an attempt to make Magit more modular, by allowing the registration of so-called “extensions”. See code here: &lt;a href=&quot;http://github.com/sigma/magit/tree/extensions&quot; class=&quot;urlextern&quot; title=&quot;http://github.com/sigma/magit/tree/extensions&quot;  rel=&quot;nofollow&quot;&gt;http://github.com/sigma/magit/tree/extensions&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
As a POC, I&amp;#039;ve extracted 2 features from the mainstream Magit, and converted them to extensions: those are magit-svn and magit-topgit.
The way I see things, those 2 features are exactly the kind I&amp;#039;d like to add to magit for my daily work but that would not necessarily make sense as part of the core project. As far as I know, the current behavior when those 2 extensions are loaded is exactly the same as the regular upstream version (including placement of the various sections)
&lt;/p&gt;

&lt;p&gt;
The current code allows you to:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; define new kind of sections (for example a “topic” kind)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; define how and where to display them (for example, right after the core “stashes” section)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; hook new behavior for existing commands for those new sections (for example a way to discard such an item)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; define new top-level commands, and associate menus&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

I tried to stay very close from the Magit way of doing things, and in particular the way you express things in extensions is exactly the same as what you do in the core code. Once again, tricky macros are at play to make the code look the same.
&lt;/p&gt;

&lt;p&gt;
What I&amp;#039;d like to see in the future (though I don&amp;#039;t have much time to do it right now :():
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; new extensions, to ease my daily life.&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; a magit-p4 (perforce integration),&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; maybe a magit-stgit (stgit in place of topgit for topic branches)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; something to integrate with VMware&amp;#039;s &lt;a href=&quot;http://www.reviewboard.org/&quot; class=&quot;urlextern&quot; title=&quot;http://www.reviewboard.org/&quot;  rel=&quot;nofollow&quot;&gt;ReviewBoard&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; code stabilization, and official proposal upstream (if there is an interest in this)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; a way to activate those extensions on a per-project basis (I use both git-svn and git-p4 but never at the same time. same for topgit vs stgit)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

An example being worth a thousand words, here is how to code the magit-topic extension. If you know the Magit code base, you should feel nearly at home.
&lt;script src=&quot;http://gist.github.com/303969.js?file=magit-topic.el&quot;&gt;&lt;/script&gt;
&lt;/p&gt;

&lt;p&gt;
Feel free to tell me what you think, any comment or advice is highly welcome !
&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;inclmeta level1&quot;&gt;
	&lt;abbr class=&quot;published&quot; title=&quot;2010-02-14T13:05:08Z&quot;&gt;2010/02/14 13:05&lt;/abbr&gt;
	&amp;middot; &lt;span class=&quot;vcard author&quot;&gt;&lt;a href=&quot;http://www.hodique.info/user/yann_hodique&quot; class=&quot;wikilink1 url fn&quot; title=&quot;user:yann_hodique&quot;&gt;Yann Hodique&lt;/a&gt;&lt;/span&gt;
	&amp;middot; &lt;span class=&quot;comment&quot;&gt;&lt;a href=&quot;http://www.hodique.info/blog/2010/02/14/magit_extensions#discussion__section&quot; class=&quot;wikilink1&quot; title=&quot;blog:2010:02:14:magit_extensions#discussion__section&quot;&gt;0&amp;nbsp;Comments&lt;/a&gt;&lt;/span&gt;&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/emacs&quot; class=&quot;wikilink1&quot; title=&quot;tags:emacs&quot; rel=&quot;tag&quot;&gt;emacs&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/git&quot; class=&quot;wikilink1&quot; title=&quot;tags:git&quot; rel=&quot;tag&quot;&gt;git&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;
	&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;plugin_include_content&quot; id=&quot;plugin_include__blog:2006:20062511_getting_things_done_with_gwt&quot;&gt;



&lt;h1&gt;&lt;a name=&quot;getting_things_done_with_gwt&quot; id=&quot;getting_things_done_with_gwt&quot; href=&quot;/blog/2006/20062511_getting_things_done_with_gwt&quot; title=&quot;Getting things done with GWT&quot;&gt;Getting things done with GWT&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;


&lt;div class=&quot;styler styler-float-left&quot;&gt;
&lt;p&gt;
&lt;span class=&quot;vcard&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=15d77b&amp;amp;cache=recache&amp;amp;media=http%3A%2F%2Fwww.gravatar.com%2Favatar.php%3Fgravatar_id%3Dd9b955e7af49b0cbfd68c15947b25012%26default%3Dhttp%253A%252F%252Fwww.hodique.info%252Flib%252Fexe%252Ffetch.php%253Fhash%253Dd44619%2526cache%253Drecache%2526media%253Dhttp%25253A%25252F%25252Fwww.hodique.info%25252F%25252Flib%25252Fplugins%25252Favatar%25252Fmonsterid.php%25253Fseed%25253Dd9b955e7af49b0cbfd68c15947b25012%252526size%25253D40%252526.png%26size%3D40%26rating%3DR%26.jpg&quot; class=&quot;media photo fn&quot; title=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; alt=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; width=&quot;40&quot; height=&quot;40&quot; /&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
It&amp;#039;s been a long time I wanted to give a try to &lt;a href=&quot;http://code.google.com/webtoolkit/&quot; class=&quot;urlextern&quot; title=&quot;http://code.google.com/webtoolkit/&quot;  rel=&quot;nofollow&quot;&gt;Google&amp;#039;s GWT&lt;/a&gt;. Also, lately I needed more and more a robust and straightforward implementation of David Allen&amp;#039;s &lt;a href=&quot;http://www.davidco.com/&quot; class=&quot;urlextern&quot; title=&quot;http://www.davidco.com/&quot;  rel=&quot;nofollow&quot;&gt;Getting Things Done&lt;/a&gt; to help me organize my work. There it is, let&amp;#039;s combine those two whishes and produce a working tool.
&lt;/p&gt;

&lt;/div&gt;

&lt;h2&gt;&lt;a name=&quot;gwt_in_brief&quot; id=&quot;gwt_in_brief&quot;&gt;GWT in brief&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

This toolkit gives you the opportunity to code your web application entirely in Java while deploying it under its compiled form (&lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; + JavaScript / Java servlet). The advantages are obvious : during the development, you have access to all the facilities of a Java environment (nice enough language when compared to JavaScript &lt;img src=&quot;http://www.hodique.info/lib/images/smileys/icon_wink.gif&quot; class=&quot;middle&quot; alt=&quot;;-)&quot; /&gt;, debugger), to its robustness, and so on.
&lt;/p&gt;

&lt;p&gt;
I&amp;#039;ve always been attracted by compilers from one high-level language to another lower-level ones. The GWT compiler is clearly a success in this area. It makes it really easy to introduce a layer of &lt;acronym title=&quot;Asynchronous JavaScript and XML&quot;&gt;AJAX&lt;/acronym&gt; in your web application without even thinking about it.
&lt;/p&gt;

&lt;p&gt;
GWT is composed mainly of the following components:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; a graphical toolkit following roughly the way of AWT, QT, … so you feel like home really fast&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; a minimal implementation of the most useful &lt;code&gt;java.lang&lt;/code&gt; and &lt;code&gt;java.util&lt;/code&gt; classes for client use (translated to JavaScript after compilation)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; a services &lt;acronym title=&quot;Application Programming Interface&quot;&gt;API&lt;/acronym&gt; that deals with &lt;acronym title=&quot;Asynchronous JavaScript and XML&quot;&gt;AJAX&lt;/acronym&gt; (client-side) and Java servlets (server-side)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

There are also other interesting aspects (JUnit integration for example), but I&amp;#039;ll leave them for another day. All this is integrated in a very clever and usable way, which makes it easy to develop your application. During development, all you&amp;#039;re going to use is provably “hosted mode”, which is a pack provided by Google, that includes an embedded Tomcat server (for servlets), an embedded browser (based on mozilla), so that you can have a sample of your application running in one click without needing to deploy anything. Plus, this “hosted mode” really runs your Java code, so that you may as well debug it in the meantime. Brilliant !
&lt;/p&gt;

&lt;p&gt;
A small issue that is worth noting : it looks like when you use “hosted mode”, some informations are transmitted to Google. I have to admit I&amp;#039;m a bit disappointed about that.
&lt;/p&gt;

&lt;/div&gt;

&lt;h2&gt;&lt;a name=&quot;gtd_methodology&quot; id=&quot;gtd_methodology&quot;&gt;GTD methodology&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

GTD seems to be very popular these days. The number of articles (in blogs mostly… mine is no exception now ;)) is constantly increasing, and the number of related tools grows in proportion. Still I did not find a single tool that really satisfying.
&lt;/p&gt;

&lt;p&gt;
Here are my expectations for a perfect GTD tools:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; it should be mostly online : I can&amp;#039;t rely on a single device (especially &lt;strong&gt;not&lt;/strong&gt; a laptop, and a &lt;acronym title=&quot;Personal Digital Assistant&quot;&gt;PDA&lt;/acronym&gt; is not reactive enough)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; there should be an offline client/cache/whatever : I&amp;#039;m not always online, even if I am most of the time&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; it should be &lt;strong&gt;fast&lt;/strong&gt;, because most of the time you just add really small tasks to your list&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; it should be nice to look at, because you&amp;#039;ll use it a lot &lt;img src=&quot;http://www.hodique.info/lib/images/smileys/icon_smile.gif&quot; class=&quot;middle&quot; alt=&quot;:-)&quot; /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;

&lt;h2&gt;&lt;a name=&quot;gwtd_started&quot; id=&quot;gwtd_started&quot;&gt;GWTD started&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

With my friend &lt;a href=&quot;http://gnurou.org&quot; class=&quot;urlextern&quot; title=&quot;http://gnurou.org&quot;  rel=&quot;nofollow&quot;&gt;Alexandre&lt;/a&gt;, we started to write the tool of our dreams : GWTD. Well, the name is nearly obvious I guess… still we will have to give it a meaning for completeness purpose. The two goals are :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; to discover the possibilities of GWT&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; to have a working implementation of GTD that fills our needs.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

The project is still in very early stage of development (given the small amount of time we can afford on that, it&amp;#039;s no surprise), bu we hope to come up with a release soon enough.
The code (distributed under Apache licence 2.0) is available at &lt;a href=&quot;http://code.google.com/p/gwtd/&quot; class=&quot;urlextern&quot; title=&quot;http://code.google.com/p/gwtd/&quot;  rel=&quot;nofollow&quot;&gt;code.google.com&lt;/a&gt;, and a &lt;a href=&quot;http://groups.google.com/group/gwtd-devel&quot; class=&quot;urlextern&quot; title=&quot;http://groups.google.com/group/gwtd-devel&quot;  rel=&quot;nofollow&quot;&gt;Google group&lt;/a&gt; has also been created.
Stay tuned !
&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;inclmeta level1&quot;&gt;
	&lt;abbr class=&quot;published&quot; title=&quot;2010-02-14T08:58:57Z&quot;&gt;2010/02/14 08:58&lt;/abbr&gt;&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/code&quot; class=&quot;wikilink1&quot; title=&quot;tags:code&quot; rel=&quot;tag&quot;&gt;code&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/google&quot; class=&quot;wikilink1&quot; title=&quot;tags:google&quot; rel=&quot;tag&quot;&gt;google&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/gwt&quot; class=&quot;wikilink1&quot; title=&quot;tags:gwt&quot; rel=&quot;tag&quot;&gt;gwt&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/gtd&quot; class=&quot;wikilink1&quot; title=&quot;tags:gtd&quot; rel=&quot;tag&quot;&gt;gtd&lt;/a&gt;
	&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;plugin_include_content&quot; id=&quot;plugin_include__blog:2006:20062409_upgrading_dokuwiki&quot;&gt;



&lt;h1&gt;&lt;a name=&quot;upgrading_dokuwiki&quot; id=&quot;upgrading_dokuwiki&quot; href=&quot;/blog/2006/20062409_upgrading_dokuwiki&quot; title=&quot;Upgrading Dokuwiki&quot;&gt;Upgrading Dokuwiki&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;


&lt;div class=&quot;styler styler-float-left&quot;&gt;
&lt;p&gt;
&lt;span class=&quot;vcard&quot;&gt;&lt;img src=&quot;http://www.hodique.info/lib/exe/fetch.php?hash=15d77b&amp;amp;cache=recache&amp;amp;media=http%3A%2F%2Fwww.gravatar.com%2Favatar.php%3Fgravatar_id%3Dd9b955e7af49b0cbfd68c15947b25012%26default%3Dhttp%253A%252F%252Fwww.hodique.info%252Flib%252Fexe%252Ffetch.php%253Fhash%253Dd44619%2526cache%253Drecache%2526media%253Dhttp%25253A%25252F%25252Fwww.hodique.info%25252F%25252Flib%25252Fplugins%25252Favatar%25252Fmonsterid.php%25253Fseed%25253Dd9b955e7af49b0cbfd68c15947b25012%252526size%25253D40%252526.png%26size%3D40%26rating%3DR%26.jpg&quot; class=&quot;media photo fn&quot; title=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; alt=&quot;&amp;#x79;&amp;#x61;&amp;#x6e;&amp;#x6e;&amp;#x2e;&amp;#x68;&amp;#x6f;&amp;#x64;&amp;#x69;&amp;#x71;&amp;#x75;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#x61;&amp;#x69;&amp;#x6c;&amp;#x2e;&amp;#x63;&amp;#x6f;&amp;#x6d;&quot; width=&quot;40&quot; height=&quot;40&quot; /&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;


&lt;p&gt;
I just finished upgrading my Wiki to latest development version of Dokuwiki.
This was not an easy task because I&amp;#039;ve made quite a large number of modifications that needed to be ported or incorporated.
I&amp;#039;ve decided to maintain a Darcs branch of both my &lt;a href=&quot;http://www.dokuwiki.org/wiki%3Adokuwiki&quot; class=&quot;interwiki iw_doku&quot; title=&quot;http://www.dokuwiki.org/wiki%3Adokuwiki&quot;&gt;Dokuwiki&lt;/a&gt; and &lt;a href=&quot;http://www.chimeric.de/dokuwiki%3Atemplates%3Aarctic&quot; class=&quot;interwiki iw_chimeric&quot; title=&quot;http://www.chimeric.de/dokuwiki%3Atemplates%3Aarctic&quot;&gt;Arctic theme&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
For now this is no complete success since I access the filesystem via &lt;a href=&quot;http://fuse.sourceforge.net/sshfs.html&quot; class=&quot;urlextern&quot; title=&quot;http://fuse.sourceforge.net/sshfs.html&quot;  rel=&quot;nofollow&quot;&gt;sshfs&lt;/a&gt;, and it looks like it lacks a proper lock implementation. I&amp;#039;ll try to find a better way &lt;img src=&quot;http://www.hodique.info/lib/images/smileys/icon_smile.gif&quot; class=&quot;middle&quot; alt=&quot;:-)&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;
By the way, I also upgraded several plugins to their latest version, so that you (and I) may experience some weird and uncontrolled border effects. That&amp;#039;s the price for living on the bleeding edge.
&lt;/p&gt;

&lt;/div&gt;
&lt;div class=&quot;inclmeta level1&quot;&gt;
	&lt;abbr class=&quot;published&quot; title=&quot;2010-02-14T08:58:57Z&quot;&gt;2010/02/14 08:58&lt;/abbr&gt;&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;http://www.hodique.info/tags/wiki&quot; class=&quot;wikilink1&quot; title=&quot;tags:wiki&quot; rel=&quot;tag&quot;&gt;wiki&lt;/a&gt;,
	&lt;a href=&quot;http://www.hodique.info/tags/darcs&quot; class=&quot;wikilink1&quot; title=&quot;tags:darcs&quot; rel=&quot;tag&quot;&gt;darcs&lt;/a&gt;
	&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p class=&quot;centeralign&quot;&gt;
&lt;a href=&quot;http://www.hodique.info/blog?first=5&quot; class=&quot;wikilink1&quot;&gt;Older entries &amp;gt;&amp;gt;&lt;/a&gt;
&lt;/p&gt;
&lt;span class=&quot;plugin_feedmod_comments&quot;&gt;
  &lt;a href=&quot;http://www.hodique.info/blog#discussion__section&quot; title=&quot;Read or add comments to this article&quot;&gt;Read or add comments to this article&lt;/a&gt;
&lt;/span&gt;
</description>
    </item>
</rdf:RDF>
