Search Top Index
HELP VECTORCLASS John Williams, March 1986 -------------------------------------------------------- | Note: The more powerful construct -defclass- can now | | be used instead of -vectorclass-. See REF *DEFSTRUCT | -------------------------------------------------------- vectorclass <classname> <fieldspec> ; vectorclass [identspec] <classname> [[:] <fieldspec>] ; VECTORCLASS is a macro that defines new vector classes using *CONSKEY. It automatically defines constructor, destructor, subscriptor, fast subscriptor, and recogniser procedures for the new class; and a variable containing its key. The <classname> specifies the dataword of the class. The optional <fieldspec> specifies the type of elements of this class of vectors. It should be either the word "full" or an integer for integer- only fields. If no <fieldspec> is specified, the default is "full". See REF *KEYS for more details. The optional <identspec> specifies the status of the identifiers created by VECTORCLASS. One of "constant" and "vars" may be used, to indicate that the identifers should or should not be made constant, and one of "procedure" or 0 may be used, to indicate their *IDENTTYPE. If neither "constant" nor "vars" is specified, the identifier status is defaulted from the variable *POPDEFINECONSTANT; if neither "procedure" nor 0 is specified, the identifier type is defaulted from the variable *POPDEFINEPROCEDURE. -- Example ------------------------------------------------------------- The statement vectorclass short 16; creates procedures initshort, consshort, destshort, isshort subscrshort, fast_subscrshort, and declares the variable short_key with the new key as its value. Vectors of type "short" can only contain integers in the range 0 to (2 ** 16) - 1. -- Recompiling a VECTORCLASS declaration ------------------------------ VECTORCLASS has been defined so that if you re-compile a file containing a call of VECTORCLASS it will not construct a new key. More precisely, when a VECTORCLASS declaration is executed the value of the word <name>_key is examined and if the value is a key and its specification is the same as the specification in the declaration then a new key will not be constructed, although the procedures associated with the key (subscriptors, constructers etc.) will be reassigned to the variables that should contain them. This behaviour ensures that, if the declaration has not changed, then the old subscriptor, recogniser, etc. will continue to work on structures already created. If for any reason you wish the declaration to be re-executed, then you should assign soem non-key object (e.g. undef) to the key name. E.g. in the above example: undef -> short_key; This will force the construction of a new key. Any previously constructed vectors will not work with the new subscriptor and will not be recognised as instances of the new key. -- See also ------------------------------------------------------------ HELP *ISVECTORCLASS HELP *VECTORS HELP *RECORDCLASS HELP *CLASSES REF *KEYS REF *INITV REF *SUBSCRV, REF *CONSVECTOR HELP *MOVE_SUBVECTOR REF *FILL --- C.all/help/vectorclass --- Copyright University of Sussex 1988. All rights reserved. ----------