pspp-dev
[Top][All Lists]
Advanced

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

Re: struct variable definition (in var.h)


From: Ben Pfaff
Subject: Re: struct variable definition (in var.h)
Date: Mon, 08 Nov 2004 23:00:23 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

John Darrington <address@hidden> writes:

> 1.  Forget the whole thing.  Just let each command allocate the data
>     it needs on the heap, and keep track of what variable it belongs
>     to.
>
> 2.  Have a generic (void *) pointer instead of the union.  Commands
>     will still be required to allocate and deallocate the memory, but
>     the pointer keeps track of the variable to which they refer.
>
> 3.  As above, but have each command register a function to allocate
>     and de-allocate the memory.  Some lower level of PSPP (which I'll
>     call the `allocator') will call these functions as appropriate. 
>     The allocator will need to provide an interface which commands
>     will use to declare which variables are of interest.

I took another look at this tonight, and now I remember why I
didn't follow through on #1 earlier: it's seriously not a simple
thing to do.  Take the `get' member for example.  This gets
initialized by sfm_read_dictionary() when we read a system file
dictionary from disk, and then it's used later when we actually
read cases from disk.  Between those times, variables in the
dictionary may be added, deleted, renamed, or reordered at will,
so that without some kind of identifier that travels along with
the variables themselves there's no way to connect the data on
disk to where it's supposed to go in the dictionary.

That's kind of a "worst case".  The other cases are not so bad,
but at least the first few that I looked at also demonstrate that
it's not as simple as I'd hoped.

Maybe #2 or #3 is a better option.

Ideas?
-- 
"I didn't say it was your fault.
 I said I was going to blame it on you."




reply via email to

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