symOpen basic EMF

Synopsis

Creates a symbol table for fast indexing.

Prototype

 #include "uemf.h"

 sym_fd_t symOpen(int hash_size); 

Parameters

hash_sizeTable size. Nearest prime number is actually used.

Description

This module implements a highly efficient generic symbol table with update and access routines. Symbols are simple character strings, and the values they take can be flexible types as defined by value_t. This module allows multiple symbol tables to be created.

The function allocates a table structure (sym_tabent_t) which consists of the table size, a flag for whether the table is in use, and the actual table itself. The structure is stored in a global sym array that can be accessed by the returned sym_fd_t handle.

Return Value

Returns an integer (sym_fd_t) to be used as the handle for subsequent calls to the symbol table access functions. Returns -1 on error.

Example

sym_fd_t id;
sym_t* sp;

id = symOpen(64);
...

symEnter(id, "lookup", valueString("value"), 0);
...

sp = symLookup(id, "lookup");

Stability Classification

Evolving.

See Also

symClose, symDelete, symEnter, symFirst, symLookup, symNext