pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

src/dictionary.c


From: John Darrington
Subject: src/dictionary.c
Date: Mon, 9 Mar 2009 11:12:00 +0900
User-agent: Mutt/1.5.18 (2008-05-17)

For a while, I've been unhappy about the way the GUI makes use of
dictionary.c

Currently, we have an object called PsppireDict which contains a
pointer to a (struct dictionary) which is created externally.  In
order that PsppireDict is aware of changes made to to (struct
dictionary), the latter has a set of callbacks to which the containing
PsppireDict connects.  Further, the (struct dictionary) can be
destroyed, whilst the PsppireDict survives.  Typically, this happens
on each procedure - the old dictionary is destroyed and a new one
created in its stead.  The gui has to anticipate this, and reload the
new dict, and it emits a "backend-changed" signal.  All of this is
really messy, and is beginning to make the GUI unmaintainable.

One solution would be to simply move PsppireDict into src/data, but
that would mean that the entire pspp source (including the perl
module) would depend on Glib, which I think we don't want.

A better solution would be to abstract the dictionary into a "virtual
class", something along the lines of the way casereaders are currently
implemented. This way, a common API can be used to create, destroy and
operate upon dictionaries, but will call the code for the required
implementation depending upon whether the program being run is a gui,
command line program, or perl module.  It'll also mean that the
callbacks and the "backend-changed" nonsense will no longer be
required. 

The down side is that it'll mean some pervasive code changes, since
dictionaries are used almost everywhere.  So far as I can tell, almost
all instances of dictionaries are owned  by a dataset.  The exceptions
being some of the casereaders.  So these objects could perhaps use
some "factory" parameters to tell them how to create and destroy
dictionaries. 

Comments?

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]