ScriptSymbol Class Reference

This class manages symbol tables for the scripting engine.Symbol table management for scripting engine. More...

#include <script.h>

Inheritance diagram for ScriptSymbol:

Script ScriptInterp List of all members.

Public Member Functions

virtual SymbolgetEntry (const char *symbol, int size=0)
 Fetch a symbol entry.
void setExclusive (bool enable)
 Can be used to tie together an exclusive function.
virtual void commit (Symbol *sym)
 A virtual method used when "committing" symbol changes.
SymbolgetTrigger (void)
 Fetch a pending trigger value and clear it.
int getSymbolSize (void)
 Fetch default symbol size.
 ScriptSymbol (int size, int pgsize=1024)
 ~ScriptSymbol ()
void * getPointer (const char *symbol)
 Fetch an embedded pointer held in a symbol identifier.
bool setPointer (const char *symbol, void *data)
 Set an embedded pointer object as a symbol.
char * getSymbol (const char *symbol)
 Fetch the address of the value of a given symbol identifier.
char * setSymbol (const char *symbol, const char *value="")
 Set a given symbol to a new value.
char * setConst (const char *symbol, const char *value="")
 Set a constant value.
bool makeSequence (const char *id, unsigned char count, unsigned char recsize)
 Create a sequence object (looping fifo).
bool makeCache (const char *id, unsigned char count, unsigned char recsize)
bool makeStack (const char *id, unsigned char count, unsigned char recsize)
 Create a stack object.
bool makeFifo (const char *id, unsigned char count, unsigned char recsize)
 Create a fifo object.
bool makeCounter (const char *id)
 Create an automatic counter object.
bool postSymbol (Symbol *sym, const char *value)
 Post data into a fifo.
bool removeSymbol (Symbol *sym, const char *value)
 Remove entry from a queue.
char * readSymbol (Symbol *sym)
 Read symbol handles special symbol types.
bool setAlias (const char *symbol, const char *source)
 Set an alias.
bool swapSymbol (const char *oldname, const char *newname)
 Swap an existing symbol, relinks table sets.
SymbolgetAlias (const char *symbol)
 Get an alias.
char * setSymbol (const char *symbol, int size=0)
 Create a new symbol entry of a specified size.
void clrSymbol (const char *id)
 Clear a symbol definition.
void purge (void)
 Purge user defined symbols and memory space.
unsigned gather (Symbol **index, unsigned max, const char *prefrix, const char *suffix="")
 Gather a listing of common script symbols.

Protected Member Functions

bool setArray (const char *sym, const char *source)

Friends

class ScriptInterp

Detailed Description

This class manages symbol tables for the scripting engine.Symbol table management for scripting engine.

A symbol is a variable with a reserved memory space. Some derived systems, like Bayonne IVR, may make use of a channel specific and global symbol tables.

Author:
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

ScriptSymbol::ScriptSymbol ( int  size,
int  pgsize = 1024 
)

ScriptSymbol::~ScriptSymbol (  ) 


Member Function Documentation

void ScriptSymbol::clrSymbol ( const char *  id  ) 

Clear a symbol definition.

This does not remove the entry if it already exists. It mearly clears the initial flag so it still can appear undefined.

Parameters:
symbol name to clear.

virtual void ScriptSymbol::commit ( Symbol sym  )  [virtual]

A virtual method used when "committing" symbol changes.

Normally this is a non-operation, but when system specific dialects are created, special symbols that must be converted from strings into other kinds of internal data types, or that might perform operations can be represented with the commit.

Parameters:
symbol to commit.

unsigned ScriptSymbol::gather ( Symbol **  index,
unsigned  max,
const char *  prefrix,
const char *  suffix = "" 
)

Gather a listing of common script symbols.

Symbol* ScriptSymbol::getAlias ( const char *  symbol  ) 

Get an alias.

Parameters:
symbol name to find.
Returns:
script symbol object or NULL.

virtual Symbol* ScriptSymbol::getEntry ( const char *  symbol,
int  size = 0 
) [virtual]

Fetch a symbol entry.

Normally this is presumed to be from the native symbol table. However, the use of a virtual allows one to derive special "system" symbols as needed for Bayonne dialects, as well as specify special attributes and properties for system symbols. For example, in the Bayonne IVR, symbols might be used to retrieve the current DTMF digit buffer and count, but these are stored as and manipulated in a channel structure rather than in "symbol space".

Returns:
symbol entry or NULL if not found.
Parameters:
symbol name to find or create.
size of symbol space to create if not found.

void* ScriptSymbol::getPointer ( const char *  symbol  ) 

Fetch an embedded pointer held in a symbol identifier.

Parameters:
symbol name.
Returns:
pointer held in symbol or NULL.

char* ScriptSymbol::getSymbol ( const char *  symbol  ) 

Fetch the address of the value of a given symbol identifier.

Parameters:
symbol name.
Returns:
symbol buffer address, or NULL if not found.

int ScriptSymbol::getSymbolSize ( void   )  [inline]

Fetch default symbol size.

Returns:
default symbol size.

Symbol* ScriptSymbol::getTrigger ( void   ) 

Fetch a pending trigger value and clear it.

Returns:
symbol trigger that is active.

bool ScriptSymbol::makeCache ( const char *  id,
unsigned char  count,
unsigned char  recsize 
)

bool ScriptSymbol::makeCounter ( const char *  id  ) 

Create an automatic counter object.

Returns:
false if fail.
Parameters:
name of counter.

bool ScriptSymbol::makeFifo ( const char *  id,
unsigned char  count,
unsigned char  recsize 
)

Create a fifo object.

Returns:
false if fail.
Parameters:
name of fifo.
number of records.
size of record.

bool ScriptSymbol::makeSequence ( const char *  id,
unsigned char  count,
unsigned char  recsize 
)

Create a sequence object (looping fifo).

Returns:
false if fail.
Parameters:
name of sequence.
max. number of sequences.
size of sequence data record.

bool ScriptSymbol::makeStack ( const char *  id,
unsigned char  count,
unsigned char  recsize 
)

Create a stack object.

Returns:
false if fail.
Parameters:
name of stack.
number of entries.
size of record.

bool ScriptSymbol::postSymbol ( Symbol sym,
const char *  value 
)

Post data into a fifo.

Returns:
false if full.
Parameters:
symbol object to post.
data value to post.

void ScriptSymbol::purge ( void   ) 

Purge user defined symbols and memory space.

char* ScriptSymbol::readSymbol ( Symbol sym  ) 

Read symbol handles special symbol types.

Returns:
data of symbol.
Parameters:
symbol. 

bool ScriptSymbol::removeSymbol ( Symbol sym,
const char *  value 
)

Remove entry from a queue.

Returns:
false if invalid.
Parameters:
symbol object to remove from.
data value to find and remove.

bool ScriptSymbol::setAlias ( const char *  symbol,
const char *  source 
)

Set an alias.

Parameters:
symbol name to alias.
value of alias to set.
Returns:
bool if not set, else value.

bool ScriptSymbol::setArray ( const char *  sym,
const char *  source 
) [protected]

char* ScriptSymbol::setConst ( const char *  symbol,
const char *  value = "" 
)

Set a constant value.

Parameters:
symbol name to find.
value string to set.
Returns:
NULL if not found, else value.

void ScriptSymbol::setExclusive ( bool  enable  ) 

Can be used to tie together an exclusive function.

..

Reimplemented in ScriptInterp.

bool ScriptSymbol::setPointer ( const char *  symbol,
void *  data 
)

Set an embedded pointer object as a symbol.

Parameters:
symbol name.
data pointer to save.
Returns:
true if successful.

char* ScriptSymbol::setSymbol ( const char *  symbol,
int  size = 0 
)

Create a new symbol entry of a specified size.

Parameters:
symbol name to create.
size of symbol, otherwise default size used.
buffer or NULL if exists.

char* ScriptSymbol::setSymbol ( const char *  symbol,
const char *  value = "" 
)

Set a given symbol to a new value.

Parameters:
symbol name to find.
value string to set.
Returns:
NULL if not found, else value.

bool ScriptSymbol::swapSymbol ( const char *  oldname,
const char *  newname 
)

Swap an existing symbol, relinks table sets.

Parameters:
symbol name to find.
symbol name to swap with.
Returns:
bool true if successful.


Friends And Related Function Documentation

friend class ScriptInterp [friend]


The documentation for this class was generated from the following file:
Generated on Mon Oct 23 00:53:17 2006 for ccScript by  doxygen 1.4.7