Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!portc02.blue.aol.com!howland.erols.net!news.mathworks.com!usenet.eel.ufl.edu!warwick!bris.ac.uk!usenet
From: Nathan Sidwell <nathan@pact.srf.ac.uk>
Subject: defstruct & :print-function
X-Nntp-Posting-Host: talisker.pact.srf.ac.uk
Content-Type: text/plain; charset=us-ascii
Message-ID: <329304C6.2C9B@pact.srf.ac.uk>
Sender: usenet@fsa.bris.ac.uk (Usenet)
Content-Transfer-Encoding: 7bit
Organization: Partnership In Advanced Computing Technologies
Mime-Version: 1.0
Date: Wed, 20 Nov 1996 13:16:54 GMT
X-Mailer: Mozilla 3.0 (X11; I; SunOS 5.5 sun4u)
Lines: 30

Hi,

I'm supplying my own print function for some structures
in the defstruct declaration. This all works well, however
I'm currently ignoring the value of *print-readably*.

The behaviour I desire is that if *print-readably* is true
then the structure is printed in the normal #s() notation, and
if it's false then use my own format. However I can't find an
easy way of getting at the normal structure printing function
or mechanism. The only way I know of would be to explicitly
access each structure member like
	(format stream "~s ~s" :member (struct-type-member object))
which is clearly teduious and error prone. Is there a
way to iterate though the structure members?
Not being able to print the structures readably is making debugging
awkward.

I'm also a little confused about how I should be handling the
depth parameter passed to the print function. Do I ignore this
or do I have to compare it against *print-depth*, if I'm about
to print a list-like object?

thanks,
nathan
-- 
Nathan Sidwell                    The windy road is more interesting
Chameleon Architecture Group at SGS-Thomson, formerly Inmos
http://www.pact.srf.ac.uk/~nathan/                  Tel 0117 9707182
nathan@pact.srf.ac.uk or nathan@inmos.co.uk or nathan@bristol.st.com
