OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Member Functions | Private Attributes | List of all members
Compiler::Extensions Class Reference

Collection of compiler extensions. More...

#include <extensions.hpp>

Collaboration diagram for Compiler::Extensions:

Classes

struct  Function
 
struct  Instruction
 

Public Member Functions

 Extensions ()
 
int searchKeyword (const std::string &keyword) const
 
bool isFunction (int keyword, ScriptReturn &returnType, ScriptArgs &argumentType, bool &explicitReference) const
 
bool isInstruction (int keyword, ScriptArgs &argumentType, bool &explicitReference) const
 
void registerFunction (const std::string &keyword, ScriptReturn returnType, const ScriptArgs &argumentType, int code, int codeExplicit=-1)
 
void registerInstruction (const std::string &keyword, const ScriptArgs &argumentType, int code, int codeExplicit=-1)
 
void generateFunctionCode (int keyword, std::vector< Interpreter::Type_Code > &code, Literals &literals, const std::string &id, int optionalArguments) const
 Append code for function to code. More...
 
void generateInstructionCode (int keyword, std::vector< Interpreter::Type_Code > &code, Literals &literals, const std::string &id, int optionalArguments) const
 Append code for function to code. More...
 
void listKeywords (std::vector< std::string > &keywords) const
 Append all known keywords to kaywords. More...
 

Private Attributes

int mNextKeywordIndex
 
std::map< std::string, intmKeywords
 
std::map< int, FunctionmFunctions
 
std::map< int, InstructionmInstructions
 

Detailed Description

Collection of compiler extensions.

Constructor & Destructor Documentation

Compiler::Extensions::Extensions ( )

Member Function Documentation

void Compiler::Extensions::generateFunctionCode ( int  keyword,
std::vector< Interpreter::Type_Code > &  code,
Literals literals,
const std::string &  id,
int  optionalArguments 
) const

Append code for function to code.

Here is the call graph for this function:

void Compiler::Extensions::generateInstructionCode ( int  keyword,
std::vector< Interpreter::Type_Code > &  code,
Literals literals,
const std::string &  id,
int  optionalArguments 
) const

Append code for function to code.

Here is the call graph for this function:

bool Compiler::Extensions::isFunction ( int  keyword,
ScriptReturn returnType,
ScriptArgs argumentType,
bool explicitReference 
) const

Is this keyword registered with a function? If yes, return return and argument types.

Parameters
explicitReferenceIn: has explicit reference; Out: set to false, if explicit reference is not available for this instruction.
bool Compiler::Extensions::isInstruction ( int  keyword,
ScriptArgs argumentType,
bool explicitReference 
) const

Is this keyword registered with a function? If yes, return argument types.

Parameters
explicitReferenceIn: has explicit reference; Out: set to false, if explicit reference is not available for this instruction.
void Compiler::Extensions::listKeywords ( std::vector< std::string > &  keywords) const

Append all known keywords to kaywords.

Here is the caller graph for this function:

void Compiler::Extensions::registerFunction ( const std::string &  keyword,
ScriptReturn  returnType,
const ScriptArgs argumentType,
int  code,
int  codeExplicit = -1 
)

Register a custom function

  • keyword must be all lower case.
  • keyword must be unique
  • if explicit references are not supported, segment5codeExplicit must be set to -1
    Note
    Currently only segment 3 and segment 5 opcodes are supported.

Here is the caller graph for this function:

void Compiler::Extensions::registerInstruction ( const std::string &  keyword,
const ScriptArgs argumentType,
int  code,
int  codeExplicit = -1 
)

Register a custom instruction

  • keyword must be all lower case.
  • keyword must be unique
  • if explicit references are not supported, segment5codeExplicit must be set to -1
    Note
    Currently only segment 3 and segment 5 opcodes are supported.

Here is the caller graph for this function:

int Compiler::Extensions::searchKeyword ( const std::string &  keyword) const

Return extension keyword code, that is assigned to the string keyword.

  • if no match is found 0 is returned.
  • keyword must be all lower case.

Here is the caller graph for this function:

Member Data Documentation

std::map<int, Function> Compiler::Extensions::mFunctions
private
std::map<int, Instruction> Compiler::Extensions::mInstructions
private
std::map<std::string, int> Compiler::Extensions::mKeywords
private
int Compiler::Extensions::mNextKeywordIndex
private

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