Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

Gobject Module

Gobjects (Generic OBJECTS) are mainly of interest to people writing new modules for xlisp. Gobjects look to all xlisp code exactly like normal objects, but they support in addition a hidden arbitrary-size (and runtime resizable) binary data segment which may be used to store whatever your heart should desire.

The various array classes provided by the Skandha4 3d module are all built on top of the facilities provided by the Gobject module.

Gobjects are useful whenever you want to store data in C format, but still have it accessable in xlisp and garbagecollected like a normal xlisp datum. Reasons for doing this include:

In memory, a gobject has three basic segments, which in order are:

NOTE that this section does not document facilities gobject provides at the C level, only those visible at the lisp level. For now, you must simply read the source to find out what is available in C.

NOTE that the GOBJECT module actually exports two classes, GOBJECT and CLOSED-GOBJECT. These differ only in that CLOSED-GOBJECT provides no messages to read, write, or resize the LVAL and binary segments. GOBJECT can be useful for off-the-cuff hacking entirely in xlisp. CLOSED-GOBJECT is usually used as the parent class for new hybrid classes coded up in C, since it restricts the xlisp programmer to whatever accessor functions you choose to provide.

NOTE that while separate messages are provided for accessing the binary segment of a gobject as bytes, floats etc, all of these messages access the *same* binary segment. If you change the size of a gobject using :BYTE-ADJUST-ARRAY, you change its size as measured by all of:

:BYTE-ARRAY-DIMENSION :INTEGER-ARRAY-DIMENSION :FLOAT-ARRAY-DIMENSION :DOUBLE-ARRAY-DIMENSION

You do not change the :LVAL-ARRAY-DIMENSION, however, since LVALs are not stored in the binary data segment, but in a separate LVAL segment (since they must be kept separate for the garbage collector).


Go to the first, previous, next, last section, table of contents.