Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ScriptImage Class Reference

A derivable class to hold compiled script images for active processes. Script compiler image set. More...

#include <script.h>

Inheritance diagram for ScriptImage:

MemPager List of all members.

Public Methods

virtual scriptname_tgetScript (const char *name)
 Fetch named script. More...

virtual scriptname_tdupScript (const char *name, const char *target)
 Duplicate script if needed. More...

unsigned Gather (const char *suffix, scriptname_t **array, unsigned size)
 Fetch list of relational scripts. More...

std::istream* getSource (void)
 Used by embedded interpreters to fetch script from the current source file. More...


Protected Methods

char* getToken (void)
scriptmethod_t getHandler (const char *keyword)
 Get the interpreter method pointer for a given keyword. More...

 ScriptImage (ScriptCommand *cmdset)
 Construct a new working image. More...

void Purge (void)
 Purge and reload the script image workspace.

scriptname_tInclude (const char *scrfile)
 A method to invoke the script compiler to include a script only if it has not been included already. More...

int Compile (const char *scrfile)
 The script compiler itself. More...

int Compile (const char *scrfile, char *name)
 Compile a script from disk and give it a different internal "name" as passed. More...

int Compile (std::istream *str, char *name, const char *scrname=NULL)
 Compile an open stream object into a script. More...

void Commit (void)
 Used in the derived constructor to "commit" the current image for new processes. More...


Protected Attributes

std::ifstream scrSource
std::istream* scrStream
ScriptCommandcmds
int refcount
scriptname_tindex [SCRIPT_INDEX_SIZE]
char buffer [512]
char* bp
bool quote
Mutex duplock

Friends

class  ScriptInterp
class  ScriptModule

Detailed Description

A derivable class to hold compiled script images for active processes. Script compiler image set.

This includes the script image compiler itself. Typically, a script is compiled one file at a time from a directory, and the committed, during the constructor in a derived class.

Author(s):
David Sugar <dyfet@ostel.com>.


Constructor & Destructor Documentation

ScriptImage::ScriptImage ( ScriptCommand * cmdset ) [protected]
 

Construct a new working image.

This must be derived to an application specific compiler that can scan directories and invoke the compiler as needed.

Parameters:
cmdset   of keyword table object used.


Member Function Documentation

void ScriptImage::Commit ( void ) [protected]
 

Used in the derived constructor to "commit" the current image for new processes.

This is usually the last statement in the derived constructor.

int ScriptImage::Compile ( std::istream * str,
char * name,
const char * scrname = NULL ) [protected]
 

Compile an open stream object into a script.

Returns:
lines of script compiled.
Parameters:
stream   object to use.
name   of script save under.

int ScriptImage::Compile ( const char * scrfile,
char * name ) [protected]
 

Compile a script from disk and give it a different internal "name" as passed.

Returns:
lines of script compiled.
Parameters:
name   of script file to compile.
name   of script to save under.
test   if script already loaded.

int ScriptImage::Compile ( const char * scrfile ) [protected]
 

The script compiler itself.

This linearly compiles a Bayonne script file that is specified. Normally used along with a dir scanner in the constructor.

Returns:
lines of script compiled.
Parameters:
name   of script file to compile.

unsigned ScriptImage::Gather ( const char * suffix,
scriptname_t ** array,
unsigned size )
 

Fetch list of relational scripts.

Parameters:
suffix.  
index.  
max   entries.
Returns:
count of entries found.

scriptname_t * ScriptImage::Include ( const char * scrfile ) [protected]
 

A method to invoke the script compiler to include a script only if it has not been included already.

Returns:
named script object.
Parameters:
name   of script file to compile.

void ScriptImage::Purge ( void ) [protected]
 

Purge and reload the script image workspace.

scriptname_t * ScriptImage::dupScript ( const char * name,
const char * target ) [virtual]
 

Duplicate script if needed.

Parameters:
script   name to dup.
target   name to dup as.
Returns:
script or NULL.

scriptmethod_t ScriptImage::getHandler ( const char * keyword ) [inline, protected]
 

Get the interpreter method pointer for a given keyword.

Returns:
method handler.
Parameters:
keyword   to search.

scriptname_t * ScriptImage::getScript ( const char * name ) [virtual]
 

Fetch named script.

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

std::istream * ScriptImage::getSource ( void ) [inline]
 

Used by embedded interpreters to fetch script from the current source file.

Returns:
reference to source file stream.

char* ScriptImage::getToken ( void ) [protected]
 


Friends And Related Function Documentation

class ScriptInterp [friend]
 

class ScriptModule [friend]
 


Member Data Documentation

char * ScriptImage::bp [protected]
 

char ScriptImage::buffer[512] [protected]
 

ScriptCommand * ScriptImage::cmds [protected]
 

Mutex ScriptImage::duplock [protected]
 

scriptname_t * ScriptImage::index[SCRIPT_INDEX_SIZE] [protected]
 

bool ScriptImage::quote [protected]
 

int ScriptImage::refcount [protected]
 

std::ifstream ScriptImage::scrSource [protected]
 

std::istream * ScriptImage::scrStream [protected]
 


The documentation for this class was generated from the following file:
Generated at Tue Oct 9 20:52:05 2001 for ccscript by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001