+class GroupTable (with_metaclass(GroupTableClass)):
+ """
+ Base class for group tables objects.
+
+ A `group table' is a table of constants, typically defining a cyclic group
+ or something similar. We read the values from an input file, and write
+ them out as C definitions. These have a somewhat stereotyped format, so we
+ can mostly handle them uniformly.
+
+ Specifically, input files consist of lines which are split into
+ whitespace-separated words. Blank lines, and lines beginning with `#', are
+ ignored. The remaining lines are gathered together into stanzas of the
+ form
+
+ KEYWORD NAME [HEAD-VALUE ...]
+ SLOT VALUE
+ ...
+
+ (Indentation is shown for clarity only.) Such a stanza describes a group
+ NAME; some slots are assigned values from the headline, and others from
+ their own individual lines.
+
+ Subclasses must define the following attributes.
+
+ data_t The name of the type for describing a particular
+ group.
+
+ entry_t The name of the type which associates a name with
+ some group data; this will be defined as
+
+ typedef struct ENTRY_T {
+ const char *name;
+ DATA_T *data;
+ } ENTRY_T;
+
+ or similar.
+
+ filename The filename, typically `SOMETHING.c', to put in the
+ output header.
+
+ header The header file to include, so as to establish the
+ necessary types and other definitions.
+
+ keyword The keyword beginning a new definition in the input
+ file. The default is `group'.
+
+ mode The mode name, used to invoke this kind of table
+ operation (used by GroupTableClass).
+
+ slots A vector of slot objects (see BaseSlot for the
+ protocol) describing the structure of this particular
+ kind of group, in the order they should be written in
+ an initializer.
+
+ Instances carry an `st' attribute, which contains a `struct' object in
+ which slots can maintain some state. This object carries the following
+ attributes maintained by this class.
+
+ d A dictionary mapping slots (not their names!) to
+ values assigned in the current stanza. This is reset
+ at the start of each stanza. Slot implementations
+ a free to use this or not, and the representation is
+ internal to the specific slot class.
+
+ mpmap A dictionary mapping values (integers, or `None') to
+ C initializers (typically, actually, macro
+ invocations).
+
+ name The name of the group currently being parsed.
+
+ nextmp Index for the next `mp' object to be written.
+ """
+
+ ## Additional attributes, for internal use:
+ ##
+ ## _defs A set of known names for groups.
+ ##
+ ## _headslots A list of slots filled in from the headline.
+ ##
+ ## _names A list of pairs (ALIAS, DATA) mapping alias names to
+ ## the actual group data.
+ ##
+ ## _slotmap A dictionary mapping slot names to their
+ ## descriptions.
+
+ ## Default values.