[CM] A question about def-clm-struct

cristopher pierson ewing cewing@u.washington.edu
Mon, 2 Dec 2002 18:58:12 -0800 (PST)


Folks,

Does def-clm-struct also allow the types of defstruct options that are
allowed by defstruct?

Specifically, I am wondering if the :print-funtion option may be used.  I
have a clm-struct that creates a moveable x,y point and uses envs to move
the x or y position of the point in time.  This structure is used in the
run loop, so it seems it must be a clm-struct, but I'm getting tired of
having to see the entire printed representation of the envelopes that
control x and y, when all I really need to see are the current values of x
and y right now.  I'd like to define it similarly to the following, which
works fine as a lisp struct:

(defstruct (foo
             (:print-function
               (lambda (f s k)
                 (format s "<hello: ~A>" (foo-bar f)))))
  (bar 'baz))

When I run this in lisp, it works well, and if I evaluate
CM(27): (setf f (make-foo))
I get
 <hello: BAZ>
Which is exactly what I'd expect.

But if I try to create the foo as a clm-struct i get:

CM(29): Error: Received signal number 11 (Segmentation violation)
  [condition type: SYNCHRONOUS-OPERATING-SYSTEM-SIGNAL]

Restart actions (select using :continue):
 0: Return to Top Level (an "abort" restart).
 1: Abort entirely from this process.

Now, when I have gotten results like this before, it always means that I
am doing something that isn't working on the C-code side of things.  I'm
sure that must be that case here as well, but I don't get why
def-clm-struct can't work exactly like defstruct with the added benefit of
setting up the structure names in C.

I know this is not a vital issue, I can certainly continue to look at the
well-formatted info that comes out of the def-clm-struct print function,
but I'd love to be able to control what I have to see. Any suggestions?

Thanks a million,

C


********************************
Cris Ewing
CARTAH Assistant
University of Washington
Home Phone: (206) 365-3413
E-mail: cewing@u.washington.edu
*******************************