From: ······@po-box.mcgill.ca
Subject: Q: defobfun
Date: 
Message-ID: <337742DC.7B62@po-box.mcgill.ca>
I have the following code on Macintosh Allegro Common Lisp 1.3.2
which work fine.

> ;;define the action associated with the button
> (defobfun (dialog-item-action *display-diagram-dialog-item*) ()
>   (declare (object-variable my-dialog))
>   (return-from-modal-dialog     ;;return the following when the button is pressed:
>    (reverse
>     (ask my-dialog
>       (ask-named-item 'seq1     ;;the selected cells in the sequence dialog item.
>         (mapcar 'cell-contents
>                 (selected-cells)))))))

	But on Macintosh Common Lisp 4.0, I got the following error message:

> > Error: While compiling an anonymous function :
> >        DECLARE not expected in (DECLARE (OBJECT-VARIABLE MY-DIALOG)).

	I did not find any precise information in the manual, does any one has
an idea??


									Francois
From: Stefan k. Bamberger
Subject: Re: Q: defobfun
Date: 
Message-ID: <bambi-1305971355050001@wi6a84.informatik.uni-wuerzburg.de>
In article <·············@po-box.mcgill.ca>, ······@po-box.mcgill.ca wrote:



MCL 1.3.2 dated before the CLOS aera. Therefore, it had an own object
system, especially for the graphic. SInce MCL 2.x, CLOS is implemented and
the whole GUI is CLOS based.
Your code is no longer valid!

Fortunately, it's not so difficult to convert the former code to CLOS. I ,
once , wrote a small parser to do the work automatically, but don't know
whether this code exists anymore.

ONe thing is crucial: the implicite object-variable (self) no longer
exists. It's now the instance which is used to specialize the method and
is handled as a parameter.

The code below is now something like this:

(defclass *display-diagram-dialog-item* (dialog-item)
  (
   ;; the sequence (subclass of table-dialog-item)
   (seq1 :initarg :the-sequence :initform nil :accessor ddd<>sequence)
   )
  )

(defmethod dialog-item-action ((my-dialog *display-diagram-dialog-item*))
  (return-from-modal-dialog     ;;return the following when the button is
pressed:
    (reverse
     (mapcar 'cell-contents
        (selected-cells (ddd<>sequence my-dialog)))
    )))

oneof is now make-instance,
ask <foo> <bar> is now a slot with the name <bar> in the class of <foo>
with an abitrary accessor mehtod (the slot-name for easier automatic
conversion) or the general access (slot-value <foo> <bar>) as a direct
aequivalent. I think, that's the one I used in my parser.

Perhaps, the digitool folks can support you with the conversion tools of
the MCL 2.0 version. I remeber there was a file with code for better
conversion.

good luck,

- stefan


> I have the following code on Macintosh Allegro Common Lisp 1.3.2
> which work fine.
> 
> > ;;define the action associated with the button
> > (defobfun (dialog-item-action *display-diagram-dialog-item*) ()
> >   (declare (object-variable my-dialog))
> >   (return-from-modal-dialog     ;;return the following when the button
is pressed:
> >    (reverse
> >     (ask my-dialog
> >       (ask-named-item 'seq1     ;;the selected cells in the sequence
dialog item.
> >         (mapcar 'cell-contents
> >                 (selected-cells)))))))
> 
>         But on Macintosh Common Lisp 4.0, I got the following error message:
> 
> > > Error: While compiling an anonymous function :
> > >        DECLARE not expected in (DECLARE (OBJECT-VARIABLE MY-DIALOG)).
> 
>         I did not find any precise information in the manual, does any one has
> an idea??
> 
> 
>                                                                        
Francois
-- 
University of Wuerzburg, GERMANY
·····@informatik.uni-wuerzburg.de