From: Ruth Aylett
Subject: Elementary CLIM question
Date: 
Message-ID: <R.S.Aylett-0505951534410001@146.87.80.20>
Apologies if this is a dumb question.

I just started trying to get to grips with CLIM - I'm using the version
distributed with Lucid Lisp 4.1.1 (this was just before Harlequin took it
all over I think). I've been trying to get a tutorial example to work
which is a little Fifteen puzzle.

I do an in-package clim-user, and then I set up a root window OK with
open-root-window, and the next thing is to call make-application-frame
with this root window as a parent:
  (setq fp1 (make-application-frame 'FIFTEEN-PUZZLE-1 :parent *clim-root* 
              :left 200 :right 400 :top 150 :bottom 350))

When I do this, I get:
>>Error: Destination given to FORMAT is not a stream: #<CLIM::CLX-WINDOW
/x 0:100 y 0:100/ 1A011B6>

which seems to be coming from somewhere inside the call to
make-application-frame, via a call to make-array. As a rank amateur in
this area, I'm completely confused. Could we have a problem with our
installation of Lisp? Or have I done something (or not done something)
really silly? I really can't believe that there is a bug in CLIM.

I know this is a really obscure question, but if there is any really
experienced CLIM person out there, especially someone who has run the
Lucid version under 4.1.1 I'd be really grateful for a push in the right
direction.

-- 
Ruth Aylett    email: ··········@iti.salford.ac.uk  phone: 44-161-745-5716
                                                                                fax: 44-161-745-8169
                       IT Institute, University of Salford, Salford, M5 4WT, UK
                      'Life is beautiful.'

From: Pete Halverson
Subject: Re: Elementary CLIM question
Date: 
Message-ID: <pch-0505951423010001@m142.mystech.com>
Ruth,

In article <···························@146.87.80.20>, you wrote:

> I just started trying to get to grips with CLIM - I'm using the version
> distributed with Lucid Lisp 4.1.1 (this was just before Harlequin took it
> all over I think). I've been trying to get a tutorial example to work
> which is a little Fifteen puzzle.
> 
> I do an in-package clim-user, and then I set up a root window OK with
> open-root-window, and the next thing is to call make-application-frame
> with this root window as a parent:

It would definitely help knowing which version of CLIM you're using; the
major releases have radically different underlying archictures (CLIM2 is
actually more similar to CLIM0.9 than it is to CLIM1!).  Given that refer
to "root windows" as opposed to "ports", I'd guess you're using a CLIM1
implementation.  The *FEATURES* list might help identify the CLIM version
(although I seem to remember that some CLIM1 implementations were
distinguishable by their *not* including an explicit version feature).

>
>   (setq fp1 (make-application-frame 'FIFTEEN-PUZZLE-1 :parent *clim-root* 
>               :left 200 :right 400 :top 150 :bottom 350))
> 
> When I do this, I get:
> >>Error: Destination given to FORMAT is not a stream: #<CLIM::CLX-WINDOW
> /x 0:100 y 0:100/ 1A011B6>
> 
> which seems to be coming from somewhere inside the call to
> make-application-frame, via a call to make-array. As a rank amateur in
> this area, I'm completely confused. Could we have a problem with our
> installation of Lisp? Or have I done something (or not done something)
> really silly? 

My impression is that it's a problem with your CLIM implementation--if
your root window is good it's hard to see anything else wrong with your
MAKE-APPLICATION-FRAME.  From the error message, I'd suspect that
something is calling the wrong FORMAT.  CLIM needs to define new stream
classes, but Lisp doesn't support this--there's no portable way to create
a new kind of stream that can be passed to FORMAT, WRITE, etc.  The usual
workaround done by CLIM implementors is to define shadowed versions of the
CL stream functions which know how to deal with CLIM streams, passing the
arguments on to the real CL functions otherwise.  Possibly there's some
package problem which is causing the real, un-CLIM-ish, FORMAT to be
invoked instead of the "improved" version.
Maybe a full backtrace might help.

>I really can't believe that there is a bug in CLIM.

Believe it. CLIM is so complex that there is probably code in there that
has never been executed.  I have been working with CLIM since version 0.9;
mostly on Symbolics, but I've also used CLIM under Lucid, Allegro, and
these days I'm trying to port our CLIM apps to Harlequin Lispworks, while
trying to bootleg a personal implementation of CLIM2 for MCL after the
rest of my family goes to bed.  There have been times when I've had to
track down and fix several CLIM bugs a week (luckily Symbolics provided
sources; pity Harlequin refuses to :-(  I can say without qualification
that there are definitely still bugs in CLIM.

pch
From: Ken Anderson
Subject: Re: Elementary CLIM question
Date: 
Message-ID: <KANDERSO.95May6151525@bitburg.bbn.com>
In article <···························@146.87.80.20> ··········@iti.salford.ac.uk (Ruth Aylett) writes:

   I just started trying to get to grips with CLIM - I'm using the version
   distributed with Lucid Lisp 4.1.1 (this was just before Harlequin took it
   all over I think). I've been trying to get a tutorial example to work
   which is a little Fifteen puzzle.

   I do an in-package clim-user, and then I set up a root window OK with
   open-root-window, and the next thing is to call make-application-frame
   with this root window as a parent:
     (setq fp1 (make-application-frame 'FIFTEEN-PUZZLE-1 :parent *clim-root* 
		 :left 200 :right 400 :top 150 :bottom 350))

   When I do this, I get:
   >>Error: Destination given to FORMAT is not a stream: #<CLIM::CLX-WINDOW
   /x 0:100 y 0:100/ 1A011B6>

More of a trace back would help here.  I suspect that you are in some kind
of error and something is trying to FORMAT to *STANDARD-OUTPUT*.  CLIM
applications may bind this to a clim window, but if something is calling
LISP::FORMAT rather than CLIM::FORMAT, it will error.

TO get around this, try something like this:

(lcl:defadvice (lcl:invoke-debugger with-initial-io)
    (condition)
  (progn
   (print lcl::*current-process* lcl::*initial-io*))
  (lcl:using-initial-io
   (let ((*inhibit-scheduling*
	  (not (eq lcl::*current-process* lcl::*initial-process*))))
     (lcl:advice-continue condition))))

You can also set the *standard-output* to lcl::*initial-io* by hand and
set it back when you are done debugging.  I tried making all the i/o
routines CLIM aware several times but never completely succeded.
--
Ken Anderson 
Internet: ·········@bbn.com
BBN ST               Work Phone: 617-873-3160
10 Moulton St.       Home Phone: 617-643-0157
Mail Stop 6/4a              FAX: 617-873-2794
Cambridge MA 02138
USA