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.

XG.3D-GET/SET/REM/LENGTH/NTH

source files: [xc]thl.[ch]

SYNTAX

(XG.3D-GET    <property-list> <property-name> [ <default> ] )
(XG.3D-SET    <property-list> <property-name> <property-value> )
(XG.3D-REM    <property-list> <property-name> )
(XG.3D-LENGTH <property-list> )
(XG.3D-NTH    <property-list> <fix:index> [<default-value>])

DESCRIPTION

These functions work on disembodied property lists, which Skandha4 uses extensively. CommonLisp does not approve of disembodied property lists, for presumably good reasons which escape me as yet, thus my choice of function names which are ugly and virtually guaranteed not to conflict with more CommonLisp compatible functions.

We take <property-list> to be in general a list

(:symbol value  :symbol2 value2 ...)

of paired symbols and values.

XG.3D-GET searches a propertylist for the given symbol, and returns the corresponding value. If the symbol is not found, <default> is returned if provided, otherwise an error is signalled.

XG.3D-SET changes the value of the given symbol in the propertylist by destructively modifying it, if the given symbol already has a value, otherwise inserts the given symbol-value pair into the propertylist. The return value is always the new propertylist. If the propertylist was initially non-empty, the new symbol-value pair is inserted noninitially and destructively, so that old pointers to the list remain valid. This somewhat unLispish implementation is primarily for the benefit of hook functions which wish to insert information into a thing without knowing what thinglist(s) refer to the thing.

XG.3D-REM removes the given symbol (and its value) from the propertylist by destructively modifying it, if the given symbol is present in the propertylist, in which case the return value is the new propertylist. If the symbol is not found, the original propertylist is returned intact. You should normally save the new value of the propertylist, since pointers to the old list are likely to include the removed symbol-value pair.

XG.3D-LENGTH returns the number of property-value PAIRS in the propertylist.

XG.3D-NTH returns the symbol naming the Nth property-value pair in the propertylist -- the first pair is indexed by zero. If there is no nth, <default-value> is returned if supplied, else an error is signalled.


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