[DGD] Data storage on the kernel level
Felix A. Croes
felix at dworkin.nl
Sun Mar 8 16:11:21 CET 1998
Serhat Sakarya <serhat at freud.et.tudelft.nl> wrote:
> I'm considering writing several kfuns that might require storing
> (dynamic) data in certain objects. This would be on the kernel level
> rather than in LPC.
>
> Silly example: suppose I'd like to take inventories to the kernel and
> have lists of object references in some (but not all) objects. No, I'm
> not considering this at this time, but I'd like to know what would be
> a nice way to handle the data storage aspect. :-)
The easiest way would be to store it as LPC data. That way, it will be
swapped in and out automatically, and no modifications to dgd/src/data.c
will be required.
For every object, one value is reserved at the end of the variable
array which can be used for non-LPC purposes. Currently, it is being
used by user objects (unless you have the net package installed) and
by objects using parse_string().
To obtain the value, use
d_get_variable(data, data->nvariables - 1);
To store a value, use
d_assign_var(data, d_get_variable(data, data->nvariables - 1), val);
Regards,
Dworkin
More information about the DGD
mailing list