Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

ScriptImage Class Reference

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

#include <bayonnescript.h>

Inheritance diagram for ScriptImage:

Keydata Script MemPager aaImage List of all members.

Public Member Functions

char * getToken (char **pre=NULL)
virtual Name * getScript (const char *name)
 Fetch named script.
virtual Name * dupScript (const char *name, const char *target)
 Duplicate script if needed.
unsigned gather (const char *suffix, Name **array, unsigned size)
 Fetch list of relational scripts.
std::istream * getSource (void)
 Used by embedded interpreters to fetch script from the current source file.

Protected Member Functions

Method getHandler (const char *keyword)
 Get the interpreter method pointer for a given keyword.
 ScriptImage (ScriptCommand *cmdset, const char *symset)
 Construct a new working image.
void purge (void)
 Purge and reload the script image workspace.
Name * include (const char *scrfile)
 A method to invoke the script compiler to include a script only if it has not been included already.
int compile (const char *scrfile)
 The script compiler itself.
int compile (const char *scrfile, char *name)
 Compile a script from disk and give it a different internal "name" as passed.
int compile (std::istream *str, char *name, const char *scrname=NULL)
 Compile an open stream object into a script.
void commit (void)
 Used in the derived constructor to "commit" the current image for new processes.
virtual const char * getDefined (const char *token)
 Used to process '$const' inserts.
void load (Initial *ilist)
 Used by a derived constructor to load an initialization list.
void initial (const char *keyword, const char *value, unsigned size=0)
 Used to load a single initialization list entry.
const char * preproc (const char *token)
 Check for special preprocessor token.

Protected Attributes

std::ifstream scrSource
std::istream * scrStream
ScriptCommandcmds
int refcount
Name * index [37+1]
char * buffer
unsigned bufsize
char * bp
bool quote
unsigned paren
Mutex duplock
unsigned inccount
const char * incfiles [256]
ScriptImage::InitialListilist

Friends

class __EXPORT ScriptInterp
class __EXPORT ScriptModule

Classes

class  InitialList

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:
David Sugar <dyfet@ostel.com>.


Constructor & Destructor Documentation

ScriptImage::ScriptImage ScriptCommand cmdset,
const char *  symset
[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.

virtual Name* 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.

unsigned ScriptImage::gather const char *  suffix,
Name **  array,
unsigned  size
 

Fetch list of relational scripts.

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

virtual const char* ScriptImage::getDefined const char *  token  )  [inline, protected, virtual]
 

Used to process '$const' inserts.

Returns:
string if found.
Parameters:
script token being substituted.

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

Get the interpreter method pointer for a given keyword.

Returns:
method handler.
Parameters:
keyword to search.

virtual Name* 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 char **  pre = NULL  ) 
 

Name* 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::initial const char *  keyword,
const char *  value,
unsigned  size = 0
[protected]
 

Used to load a single initialization list entry.

Parameters:
keyword 
value 
size 

void ScriptImage::load Initial *  ilist  )  [protected]
 

Used by a derived constructor to load an initialization list.

Parameters:
initialization list.

const char* ScriptImage::preproc const char *  token  )  [protected]
 

Check for special preprocessor token.

Returns:
error message or NULL if no error. name of keyword to check.

void ScriptImage::purge void   )  [protected]
 

Purge and reload the script image workspace.

Reimplemented from MemPager.


Friends And Related Function Documentation

friend class __EXPORT ScriptInterp [friend]
 

friend class __EXPORT ScriptModule [friend]
 


Member Data Documentation

char* ScriptImage::bp [protected]
 

char* ScriptImage::buffer [protected]
 

unsigned ScriptImage::bufsize [protected]
 

ScriptCommand* ScriptImage::cmds [protected]
 

Mutex ScriptImage::duplock [protected]
 

ScriptImage::InitialList * ScriptImage::ilist [protected]
 

unsigned ScriptImage::inccount [protected]
 

const char* ScriptImage::incfiles[256] [protected]
 

Name* ScriptImage::index[37+1] [protected]
 

unsigned ScriptImage::paren [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 on Tue Sep 13 02:19:10 2005 for Bayonne by  doxygen 1.4.4