I tried this but it did not work cause the type is prefixed with a column and when interning<div>it returns a symbol prefixed by a backslash</div><div><br></div><div><div>&gt; Error: Unknown foreign type: :\&#39;&lt;XE&gt;XPOSE&lt;E&gt;VENT</div>
<div>&gt; While executing: CCL::%PARSE-FOREIGN-TYPE, in process listener(1).</div><div>&gt; Type :GO to continue, :POP to abort, :R for a list of available restarts.</div><div>&gt; If continued: Skip loading init file.</div>
<div><br></div><div>Taoufik</div><br><div class="gmail_quote">On Mon, Jan 25, 2010 at 10:30 AM, Ron Garret <span dir="ltr">&lt;<a href="mailto:ron@flownet.com">ron@flownet.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Try something like:<br>
<br>
(defmacro xpref (thing type slotname)<br>
  `(pref ,thing ,(intern (format nil &quot;~A.~A&quot; type slotname))))<br>
<br>
rg<br>
<div><div></div><div class="h5"><br>
On Jan 25, 2010, at 12:25 AM, Taoufik Dachraoui wrote:<br>
<br>
&gt; Hi<br>
&gt;<br>
&gt; I have the following code:<br>
&gt;<br>
&gt; (defmacro defonevent (onevent eventtype xstruct)<br>
&gt;   `(defmacro ,onevent (&amp;rest body)<br>
&gt;      `(progn<br>
&gt;       (if (null (gethash (window *context*) %event-handlers%))<br>
&gt;           (setf (gethash (window *context*) %event-handlers%) (make-hash-table)))<br>
&gt;       (setf (gethash ,&#39;,eventtype (gethash (window *context*) %event-handlers%))<br>
&gt;             #&#39;(lambda (event)<br>
&gt;                 (macrolet ((this (var) `(xpref event &#39;,&#39;,&#39;,xstruct ,var)))<br>
&gt;                   (this window) ; to avoid the warning if the event is not used in the body<br>
&gt;                   ,@body))))))<br>
&gt;<br>
&gt; (defonevent on-expose #$Expose :&lt;XE&gt;xpose&lt;E&gt;vent)<br>
&gt; (defonevent on-buttonpress #$ButtonPress :&lt;XB&gt;utton&lt;E&gt;vent)<br>
&gt; (defonevent on-buttonrelease #$ButtonRelease :&lt;XB&gt;utton&lt;E&gt;vent)<br>
&gt; (defonevent on-keypress #$KeyPress :&lt;XK&gt;ey&lt;E&gt;vent)<br>
&gt; (defonevent on-keyrelease #$KeyRelease :&lt;XK&gt;ey&lt;E&gt;vent)<br>
&gt; (defonevent on-clientmessage #$ClientMessage :&lt;XC&gt;lient&lt;M&gt;essage&lt;E&gt;vent)<br>
&gt; (defonevent on-mapnotify #$MappingNotify :&lt;XM&gt;ap&lt;E&gt;vent)<br>
&gt;<br>
&gt;<br>
&gt; ; usage<br>
&gt; (cell ....<br>
&gt;   (on-expose<br>
&gt;      (drawline 0 0 (this width) (this height)))<br>
&gt;   ...<br>
&gt;  )<br>
&gt;<br>
&gt;<br>
&gt; The issue is that I do not know how to implement xpref. The pref macro takes an accessor of the form<br>
&gt; type.field but I need a macro that takes the type of the structure and the field name separately.<br>
&gt;<br>
&gt; Thank you for your help<br>
&gt;<br>
&gt; Taoufik<br>
</div></div>&gt; _______________________________________________<br>
&gt; Openmcl-devel mailing list<br>
&gt; <a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
&gt; <a href="http://clozure.com/mailman/listinfo/openmcl-devel" target="_blank">http://clozure.com/mailman/listinfo/openmcl-devel</a><br>
<br>
</blockquote></div><br></div>