void init_element()

- initializes element module

This module keeps track of all defined SGML elements. Each element has a unique name and number attached to it. To each element belongs a structure, pointed to by `P_Element'. This structure however is not unique. If more elements are defined in one element declaration as in:

then the structure is shared between the elements (here: A and B).

void set_document_name(name)

- sets the name of the current document to name String name;

String document_name()

- returns the name of the current document

These functions keep track of the name of the document currently parser.

void define_element(name_grp, omit_start, omit_end, content, exclus, inclus)

- defines an element P_Group name_grp; Bool omit_start; Bool omit_end; P_Node content; P_Group exclus; P_Group inclus;

P_Element element(name)

- delivers element definition belonging to name String name;

define_element() defines one element definition. The element names are contained in name_grp. omit_start and omit_end are booleans giving the permission to omit start- and end-tags. The content is the tree which contains the content model. The parameters exclus and inclus contain the names of the exclusions and inclusions. The function element_name() returns the structure which corresponds to the element with name name.

P_Group name_group(element)

- returns the names of the elements that belong to elem P_Element element;

Bool omit_start(element)

- returns the value for omit starttag P_Element element;

Bool omit_end(element)

- returns the value for omit endtag P_Element element;

P_Node content(element)

- returns the root of the content model tree P_Element element;

P_Group exclusions(element)

- returns the names of the inclusions P_Element element;

P_Group inclusions(element)

- returns the names of the exclusions P_Element element;

The last 6 functions return a value of the element structure. Given an element name element() returns the corresponding element structure. If the element does not exist zero is returned.

int number_of_elements()

- return the number of elements

int element_number(name)

- returns the number that corresponds to element name String name;

String number_to_name(t)

- returns name of the element corresponding with t int t;

Each element has a unique number. The function element_number() returns the number that corresponds with element with name name. The function number_to_name() returns the name of the element with number t.

Bool element_busy(e)

- returns busy flag P_Element e;

void element_set_busy(e, b)

- sets busy flag to b P_Element e; Bool b;

Bool element_done(e)

- returns done flag P_Element e;

void element_set_done(e, b)

- sets done flag to b P_Element e; Bool b;

P_Set element_firstsym(elem)

- returns the firstsymbols of elem P_Element elem;

The busy and done flags of an element are used by the ambiguity checker. element_firstsym() returns the set of first symbols of the root of the content tree of elem. See the description of the ambiguity checker for an explanation of first sets.

P_Iterator element_iterator()

- returns an iterator that contains all elements

void elem_traverse_post(function)

- traverses the content trees for each element and performs the function function in each node P_Node_func function;

void elem_traverse_pre(function)

- traverses the content trees for each element and performs the function function in each node P_Node_func function;

element_iterator() returns an iterator to visit all elements. The use of type 'P_Iterator' is explained in the module group. The functions elem_traverse_pre() and elem_traverse_post() visit all nodes of the content trees for all elements in the grammar. elem_traverse_pre() visists the node breath-first, elem_traverse_post depth_first().

P_Element reference_elem(ref)

- P_Reference ref;

P_Node reference_node(ref)

- P_Reference ref;

void elem_reference(elem_name, node, elem)

- tells that elem_name is referenced in node to element elem String elem_name; P_Node node; P_Element elem;

P_Group elem_references(elem)

- returns all references to elem P_Element elem;

These functions keep track of references from elements to elements. The function elem_reference creates a reference from node to elem_name. elem is the element to which node belongs.
elem_references() returns the reference group for elem. This group contains all references to elem, as build by elem_reference(). This group can be traversed by the group-iterator, described in the group module. Each member of the group is of type `P_Ref'. The function reference_node() returns the node-field of ref. The function reference_elem() returns the elem-field of ref.

Elemtable new_elem_table(size)

- create new hash table int size;

void insert_elem(h, key, info)

- insert element key with info in hash table h Elemtable h; String key; P_Element info;

P_Element lookup_elem(h, key)

- find element key in hash table h ElemTable h; String key;

These functions define a hash table to keep all elements. See for information ``hash.gen''.

element.c element.h