Antiprism 0.23
Public Member Functions

mu::ParserByteCode Class Reference

Bytecode implementation of the Math Parser. More...

#include <muParserBytecode.h>

List of all members.

Public Member Functions

 ParserByteCode ()
 Bytecode default constructor.
 ParserByteCode (const ParserByteCode &a_ByteCode)
 Copy constructor.
ParserByteCodeoperator= (const ParserByteCode &a_ByteCode)
 Assignment operator.
void Assign (const ParserByteCode &a_ByteCode)
 Copy state of another object to this.
void AddVar (value_type *a_pVar)
 Add a Variable pointer to bytecode.
void AddVal (value_type a_fVal)
 Add a Variable pointer to bytecode.
void AddOp (ECmdCode a_Oprt)
 Add an operator identifier to bytecode.
void AddAssignOp (value_type *a_pVar)
 Add an assignement operator.
void AddFun (generic_fun_type a_pFun, int a_iArgc)
 Add function to bytecode.
void AddBulkFun (generic_fun_type a_pFun, int a_iArgc)
 Add a bulk function to bytecode.
void AddStrFun (generic_fun_type a_pFun, int a_iArgc, int a_iIdx)
 Add Strung function entry to the parser bytecode.
void Finalize ()
 Add end marker to bytecode.
void clear ()
 Delete the bytecode.
std::size_t GetSize () const
 Returns the number of entries in the bytecode.
void AsciiDump ()
 Dump bytecode (for debugging only!).

Detailed Description

Bytecode implementation of the Math Parser.

The bytecode contains the formula converted to revers polish notation stored in a continious memory area. Associated with this data are operator codes, variable pointers, constant values and function pointers. Those are necessary in order to calculate the result. All those data items will be casted to the underlying datatype of the bytecode.

Author:
(C) 2004-2012 Ingo Berg

Constructor & Destructor Documentation

mu::ParserByteCode::ParserByteCode ( const ParserByteCode a_ByteCode)

Copy constructor.

Implemented in Terms of Assign(const ParserByteCode &a_ByteCode)


Member Function Documentation

void mu::ParserByteCode::AddAssignOp ( value_type a_pVar)

Add an assignement operator.

Operator entries in byte code consist of:

  • cmASSIGN code
  • the pointer of the destination variable
See also:
ParserToken::ECmdCode
void mu::ParserByteCode::AddBulkFun ( generic_fun_type  a_pFun,
int  a_iArgc 
)

Add a bulk function to bytecode.

Parameters:
a_iArgcNumber of arguments, negative numbers indicate multiarg functions.
a_pFunPointer to function callback.
void mu::ParserByteCode::AddFun ( generic_fun_type  a_pFun,
int  a_iArgc 
)

Add function to bytecode.

Parameters:
a_iArgcNumber of arguments, negative numbers indicate multiarg functions.
a_pFunPointer to function callback.
void mu::ParserByteCode::AddOp ( ECmdCode  a_Oprt)

Add an operator identifier to bytecode.

Operator entries in byte code consist of:

  • value array position of the result
  • the operator code according to ParserToken::ECmdCode
See also:
ParserToken::ECmdCode
void mu::ParserByteCode::AddStrFun ( generic_fun_type  a_pFun,
int  a_iArgc,
int  a_iIdx 
)

Add Strung function entry to the parser bytecode.

Exceptions:
nothrowA string function entry consists of the stack position of the return value, followed by a cmSTRFUNC code, the function pointer and an index into the string buffer maintained by the parser.
void mu::ParserByteCode::AddVal ( value_type  a_fVal)

Add a Variable pointer to bytecode.

Value entries in byte code consist of:

  • value array position of the value
  • the operator code according to ParserToken::cmVAL
  • the value stored in #mc_iSizeVal number of bytecode entries.
Parameters:
a_pValValue to be added.
Exceptions:
nothrow
void mu::ParserByteCode::AddVar ( value_type a_pVar)

Add a Variable pointer to bytecode.

Parameters:
a_pVarPointer to be added.
Exceptions:
nothrow
void mu::ParserByteCode::Assign ( const ParserByteCode a_ByteCode)

Copy state of another object to this.

Exceptions:
nowthrow
void mu::ParserByteCode::clear ( )

Delete the bytecode.

Exceptions:
nothrowThe name of this function is a violation of my own coding guidelines but this way it's more in line with the STL functions thus more intuitive.
void mu::ParserByteCode::Finalize ( )

Add end marker to bytecode.

Exceptions:
nothrow
ParserByteCode & mu::ParserByteCode::operator= ( const ParserByteCode a_ByteCode)

Assignment operator.

Implemented in Terms of Assign(const ParserByteCode &a_ByteCode)


The documentation for this class was generated from the following files: