<div dir="ltr">Hi<div><br></div><div>I am currently using tagbody as follows:</div><div><br></div><div><div>(defun parse-tagblock (body tags)</div><div> (labels ((%parse (e)</div><div> (cond</div><div> ((null e) nil)</div>
<div> ((atom e) e)</div><div> (t (cond</div><div> ((eq (car e) 'quote) e)</div><div> ((and (symbolp (car e))</div><div> (string= (symbol-name (car e)) "TAGBLOCK"))</div>
<div> `(block ,(cadr e)</div><div> (tagbody ,@(parse-tagblock</div><div> (cddr e)</div><div> (append (loop for a in (cddr e)</div>
<div> when (symbolp a) collect a)</div><div> tags)))))</div><div> ((and (symbolp (car e))</div><div> (string= (symbol-name (car e)) "GOTO"))</div>
<div> (let ((tag (%parse (cadr e))))</div><div> `(case ,tag</div><div> ,@(loop for x in tags</div><div> collect `(,x (go ,x)))</div>
<div> (t (error (format nil "Can't Go to ~S" ,tag))))))</div><div> (t `(,(%parse (car e)) ,@(%parse (cdr e)))))))))</div><div><br></div><div> (%parse body)))</div>
<div><br></div><div>(defmacro tagblock (name &rest args)</div><div> `(block ,name</div><div> (tagbody ,@(parse-tagblock</div><div> args</div><div> (loop for a in args</div><div> when (symbolp a) collect a)))))</div>
<div><br></div></div><div><br></div><div><br></div><div><br></div><div>tagblock works exactly like tagbody with the additions goto and block; this works even if the tagblocks are nested</div><div><br></div><div>The issue is that the goto is basically transformed to a case instruction and this can be improved by doing an indirect jump as in assembler; for this reason I explored the possibility to implement this using lap-functions</div>
<div>but unfortunately I do not have enough knwowledge to tackle this for now.</div><div><br></div><div>As a first step I implemented the tagblock using funcall and now I am hoping to find a way to rewrite it using lap-functions and replace funcalls by an indirect jump</div>
<div><br></div><div>Where can I find a tutorial about lap-functions, I tried to read compiler/.../nx*.lisp staff but found it difficult to grasp</div><div>without any previous knowledge</div><div><br></div><div>Kind regards</div>
<div>Taoufik</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 24, 2013 at 12:35 PM, Pascal J. Bourguignon <span dir="ltr"><<a href="mailto:pjb@informatimago.com" target="_blank">pjb@informatimago.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Taoufik Dachraoui <<a href="mailto:dachraoui.taoufik@gmail.com">dachraoui.taoufik@gmail.com</a>> writes:<br>
<br>
> Hi<br>
><br>
> I needed to have a computed GO in one of my developments<br>
> I could not use tagbody<br>
<br>
</div>Why can't you use tagbody?<br>
<br>
<a href="https://groups.google.com/forum/?fromgroups=#!msg/comp.lang.lisp/wr3ekiLN8sI/NjVkbNRCVMgJ" target="_blank">https://groups.google.com/forum/?fromgroups=#!msg/comp.lang.lisp/wr3ekiLN8sI/NjVkbNRCVMgJ</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
__Pascal Bourguignon__ <a href="http://www.informatimago.com/" target="_blank">http://www.informatimago.com/</a><br>
A bad day in () is better than a good day in {}.<br>
<br>
_______________________________________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
<a href="http://clozure.com/mailman/listinfo/openmcl-devel" target="_blank">http://clozure.com/mailman/listinfo/openmcl-devel</a><br>
</font></span></blockquote></div><br></div>