ost::ScriptCommand Class Reference

This class holds the bound keyword set for a given Bayonne style script interpreter.Bayonne script keyword binding tables and compiler constants. More...

#include <script3.h>

Inheritance diagram for ost::ScriptCommand:

ost::Keydata ost::Mutex ost::Script ost::MemPager ost::ScriptChecks ost::ScriptRipple ost::ScriptRuntime List of all members.

Public Member Functions

virtual bool isInput (Line *line)
 Checks if the line statement is an input statement.
Method getHandler (const char *keyword)
 Get the method handler associated with a given keyword.
bool control (char **args)
 Issue a control event against current image for attached modules until claimed.
ScriptImagegetActive (void)
 Get the active script.
const char * getTrapName (unsigned id)
 Get the name of a trap from it's id.
void aliasModule (const char *id, const char *use)
 Alias use modules.
virtual void errlog (const char *level, const char *text)
 Server level logging interface override.
 ScriptCommand ()
 Create an initialized script command box.
 ScriptCommand (ScriptCommand *ini)
 Create a ScriptCommand box initialized from another.
unsigned getActivity (void)
 Get activity counter.

Static Public Member Functions

static const char * findKeyword (Line *line, const char *keyword)
 Test for a specific keyword.
static bool useKeywords (Line *line, const char *list)
 Test current command against a list of valid keywords.
static unsigned getCount (Line *line)
 Count non-keyword arguments.
static const char * getMember (Line *line)
 Get the member id code of a line.

Protected Member Functions

virtual const char * getExternal (const char *opt)
bool isInitial (const char *keyword)
 Fetch whether the given keyword is valid for constructor.
const char * check (char *command, Line *line, ScriptImage *img)
 Check keyword syntax.
virtual unsigned getTrapId (const char *name)
 Get the trap id number associated with a trap name.
virtual unsigned long getTrapDefault (void)
 Get the mask bits for the default script.
virtual unsigned long getTrapHandler (Name *script)
 Get the mask bits for a trap "handler".
virtual unsigned long getTrapMask (unsigned id)
 Get a trap mask for a given identifer.
virtual unsigned long getTrapModifier (const char *name)
 A helper method for the compiler.
virtual unsigned long getTrapMask (const char *name)
 A helper method for the compiler used specifically for "^" trap subsection requests.
void load (Script::Define *keywords)
 Load a set of keywords into the system keyword table.
int trap (const char *name, bool inherited=true)
 Add a trap handler symbolic identity to the keyword table.
unsigned getCount (void)
 Get count of active traps.
bool isInherited (unsigned id)
 Return true if the trap id is inherited.
virtual const char * check (Check chk, Line *line, ScriptImage *img)
 Perform compile time check of a specified symbol.

Static Protected Member Functions

static bool hasKeywords (Line *line)
 Test current command to see if it uses keyword syntax.
static bool useMember (Line *line, const char *list)
 Check the member list.
static const char * getOption (Line *line, unsigned *index)
 Get an option to examine in check routine.

Protected Attributes

bool ripple
unsigned activity

Static Protected Attributes

static ScriptCommandruntime

Friends

class ScriptImage
class ScriptInterp
class ScriptCompiler
class ScriptBinder

Classes

struct  _keyword

Detailed Description

This class holds the bound keyword set for a given Bayonne style script interpreter.Bayonne script keyword binding tables and compiler constants.

Application specific dialects are created by deriving a application specific version of ScriptCommand which then binds application specific keywords and associated methods in an application derived ScriptInterp which are typecast to (scriptmethod_t).

Author:
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

ost::ScriptCommand::ScriptCommand  ) 
 

Create an initialized script command box.

ost::ScriptCommand::ScriptCommand ScriptCommand ini  ) 
 

Create a ScriptCommand box initialized from another.


Member Function Documentation

void ost::ScriptCommand::aliasModule const char *  id,
const char *  use
 

Alias use modules.

..

Parameters:
id to alias.
id to use.

virtual const char* ost::ScriptCommand::check Check  chk,
Line *  line,
ScriptImage img
[protected, virtual]
 

Perform compile time check of a specified symbol.

Returns:
syntax error message string.
Parameters:
chk object pointer to check member function.
line pointer to line being checked.
img pointer to image being compiled.

const char* ost::ScriptCommand::check char *  command,
Line *  line,
ScriptImage img
[protected]
 

Check keyword syntax.

Returns:
syntax error string or NULL.
Parameters:
command name of keyword to check.
line pointer to line being compiled.
img pointer to image being compiled.

bool ost::ScriptCommand::control char **  args  ) 
 

Issue a control event against current image for attached modules until claimed.

Parameters:
args list of control command and arguments.
Returns:
true if processed.

virtual void ost::ScriptCommand::errlog const char *  level,
const char *  text
[virtual]
 

Server level logging interface override.

Parameters:
level of log message.
text of message.

static const char* ost::ScriptCommand::findKeyword Line *  line,
const char *  keyword
[static]
 

Test for a specific keyword.

Returns:
content of keyword that is found.
Parameters:
line pointer to record to examine in check routine.
keyword to search for.

ScriptImage* ost::ScriptCommand::getActive void   )  [inline]
 

Get the active script.

Returns:
pointer to active script image.

unsigned ost::ScriptCommand::getActivity void   )  [inline]
 

Get activity counter.

Returns:
activity counter.

unsigned ost::ScriptCommand::getCount void   )  [inline, protected]
 

Get count of active traps.

Returns:
count of active trap identifiers.

Reimplemented from ost::Keydata.

static unsigned ost::ScriptCommand::getCount Line *  line  )  [static]
 

Count non-keyword arguments.

Returns:
number of non-keyword arguments.
Parameters:
line record to examine.

virtual const char* ost::ScriptCommand::getExternal const char *  opt  )  [protected, virtual]
 

Method ost::ScriptCommand::getHandler const char *  keyword  ) 
 

Get the method handler associated with a given keyword.

This is used by ScriptImage when compiling.

Parameters:
keyword to search for.
Returns:
method handler to execute for this keyword.

static const char* ost::ScriptCommand::getMember Line *  line  )  [static]
 

Get the member id code of a line.

Returns:
member id code.
Parameters:
line record to examine in check routine.

static const char* ost::ScriptCommand::getOption Line *  line,
unsigned *  index
[static, protected]
 

Get an option to examine in check routine.

Returns:
option or NULL if past end of line record.
Parameters:
line record pointer to line to examine.
index pointer to index value. Start at 0.

virtual unsigned long ost::ScriptCommand::getTrapDefault void   )  [protected, virtual]
 

Get the mask bits for the default script.

Returns:
trap mask to use.

virtual unsigned long ost::ScriptCommand::getTrapHandler Name *  script  )  [protected, virtual]
 

Get the mask bits for a trap "handler".

Returns:
script object of trap mask to use.

virtual unsigned ost::ScriptCommand::getTrapId const char *  name  )  [protected, virtual]
 

Get the trap id number associated with a trap name.

Returns:
trap id number, 0 (exit) if invalid.
Parameters:
name of trap identifier.

virtual unsigned long ost::ScriptCommand::getTrapMask const char *  name  )  [protected, virtual]
 

A helper method for the compiler used specifically for "^" trap subsection requests.

These will occasionally carry different attribute settings.

Parameters:
name of trap identifier.
Returns:
bit shifted mask or 0 if invalid.

virtual unsigned long ost::ScriptCommand::getTrapMask unsigned  id  )  [protected, virtual]
 

Get a trap mask for a given identifer.

This is a virtual since some derived handlers may manipulate mask bits.

Returns:
signal bit mask based on id number.
Parameters:
id number of trap mask.

virtual unsigned long ost::ScriptCommand::getTrapModifier const char *  name  )  [protected, virtual]
 

A helper method for the compiler.

Converts a named trap into it's bit shifted mask. By making it a virtual, derived dialects can add "aliases" to default trap names.

Parameters:
name of trap identifier.
Returns:
bit shifted mask or 0 if invalid.

const char* ost::ScriptCommand::getTrapName unsigned  id  ) 
 

Get the name of a trap from it's id.

Parameters:
id of trap.
Returns:
name of trap.

static bool ost::ScriptCommand::hasKeywords Line *  line  )  [static, protected]
 

Test current command to see if it uses keyword syntax.

Returns:
true if keyword syntax used.
Parameters:
line record to examine in check routine.

bool ost::ScriptCommand::isInherited unsigned  id  )  [protected]
 

Return true if the trap id is inherited.

bool ost::ScriptCommand::isInitial const char *  keyword  )  [protected]
 

Fetch whether the given keyword is valid for constructor.

Parameters:
keyword to search for.
Returns:
init flag.

virtual bool ost::ScriptCommand::isInput Line *  line  )  [virtual]
 

Checks if the line statement is an input statement.

Used in some servers...

Returns:
true if line is input.
Parameters:
line to examine.

void ost::ScriptCommand::load Script::Define keywords  )  [protected]
 

Load a set of keywords into the system keyword table.

This provides a convenient method of initializing and adding to the keyword indexes.

Parameters:
keywords defined pair entries to load.

int ost::ScriptCommand::trap const char *  name,
bool  inherited = true
[protected]
 

Add a trap handler symbolic identity to the keyword table.

These are used to handle signal mask coercion and event branch points in the compiler.

Parameters:
name of requested trap to add to the trap table.
inherited status of trap.
Returns:
assigned id number for the trap.

static bool ost::ScriptCommand::useKeywords Line *  line,
const char *  list
[static]
 

Test current command against a list of valid keywords.

Returns:
first keyword found not in list.
Parameters:
line record to examine in check routine.
list of =xxx keyword entries.

static bool ost::ScriptCommand::useMember Line *  line,
const char *  list
[static, protected]
 

Check the member list.

Returns:
true if member found or none.
Parameters:
line record to examine in check routine.
list of .members...


Friends And Related Function Documentation

friend class ScriptBinder [friend]
 

friend class ScriptCompiler [friend]
 

friend class ScriptImage [friend]
 

friend class ScriptInterp [friend]
 


Member Data Documentation

unsigned ost::ScriptCommand::activity [protected]
 

bool ost::ScriptCommand::ripple [protected]
 

ScriptCommand* ost::ScriptCommand::runtime [static, protected]
 


The documentation for this class was generated from the following file:
Generated on Thu Apr 6 09:03:07 2006 for Bayonne Framework by  doxygen 1.4.6