V-Gears 0
Free Final Fantasy VII engine.
WorldCodeGenerator Class Reference

#include <WorldCodeGenerator.h>

Inheritance diagram for WorldCodeGenerator:
Collaboration diagram for WorldCodeGenerator:

Public Member Functions

 WorldCodeGenerator (Engine *engine, std::ostream &output)
 Constructor. More...
 
const InstPtr FindFirstCall ()
 Finds the first function call. More...
 
const InstPtr FindLastCall ()
 Finds the last function call. More...
 
virtual void ProcessSpecialMetadata (const InstPtr inst, char c, int pos)
 Processes special metadata in an instruction. More...
 
- Public Member Functions inherited from CodeGenerator
 CodeGenerator (Engine *engine, std::ostream &output, ARGUMENT_ORDER bin_order, ARGUMENT_ORDER call_order)
 Constructor. More...
 
virtual ~CodeGenerator ()
 Destructor. More...
 
LuaLanguageGetLanguage ()
 Retrieves the target language. More...
 
void WriteFunctionCall (std::string function_name, std::string param_format, const std::vector< ValuePtr > &params)
 Writes a function call. More...
 
virtual void Generate (InstVec &insts, const Graph &graph)
 Generates code from the provided graph and outputs it to stdout. More...
 
virtual void AddOutputLine (std::string line, bool unindent_before=false, bool indent_after=false)
 Adds a line of code to the current group. More...
 
void WriteTodo (std::string class_name, std::string instruction)
 Writes a comment line indicating an unimplemented opcode. More...
 
void WriteAssignment (ValuePtr dst, ValuePtr src)
 Generate an assignment statement. More...
 
void AddArg (ValuePtr arg)
 Add an argument to the argument list. More...
 
virtual void ProcessSpecialMetadata (const InstPtr inst, char c, int pos)
 Process a single character of metadata. More...
 
virtual ValueList GetArgList ()
 Retrieves the argument list. More...
 
virtual ARGUMENT_ORDER GetBinaryOrder ()
 Retrieves the order of operands for binary operations. More...
 

Protected Member Functions

std::string ConstructFuncSignature (const Function &function)
 Constructs the function signature. More...
 
- Protected Member Functions inherited from CodeGenerator
void ProcessInst (Function &function, InstVec &insts, const InstPtr inst)
 Processes an instruction. More...
 
void ProcessUncondJumpInst (Function &function, InstVec &insts, const InstPtr inst)
 Processes an unconditional jump instruction. More...
 
void ProcessCondJumpInst (const InstPtr inst)
 Processes a conditional jump instruction. More...
 
std::string IndentString (std::string s)
 Indents a string according to the current indentation level. More...
 
virtual std::string ConstructFuncSignature (const Function &function)
 Construct the signature for a function. More...
 
virtual void OnBeforeStartFunction (const Function &function)
 Adds lines to the script before a function. More...
 
virtual void OnEndFunction (const Function &function)
 Adds lines to the script at the end a function. More...
 
virtual void OnStartFunction (const Function &function)
 Adds lines to the script before a function instructions. More...
 
virtual bool OutputOnlyRequiredLabels () const
 Checks if only required labels are to be written. More...
 
void GeneratePass (InstVec &insts, const Graph &graph)
 Generates a pass. More...
 

Additional Inherited Members

- Protected Attributes inherited from CodeGenerator
bool is_label_pass_ = true
 Indicates if a label is being processed. More...
 
GroupPtr cur_group_
 The group currently being processed. More...
 
Engineengine_
 The engine used for teh script. More...
 
std::ostream & output_
 The stream to output the code to. More...
 
ValueStack stack_
 The stack currently being processed. More...
 
uint indent_level_
 Current indentation level. More...
 
GraphVertex cur_vertex_
 Graph vertex currently being processed. More...
 
std::unique_ptr< LuaLanguagetarget_lang_
 The target language. More...
 

Constructor & Destructor Documentation

◆ WorldCodeGenerator()

WorldCodeGenerator::WorldCodeGenerator ( Engine engine,
std::ostream &  output 
)

Constructor.

Parameters
[in]engineThe engine.
[out]outputThe generated script.

Member Function Documentation

◆ ConstructFuncSignature()

std::string WorldCodeGenerator::ConstructFuncSignature ( const Function function)
protectedvirtual

Constructs the function signature.

The function signature is the LUA function declaration, and it looks like this:

function_name = function(self)

Parameters
[in]functionThe function to construct the signature for.
Returns
The function signature.

Reimplemented from CodeGenerator.

◆ FindFirstCall()

const InstPtr WorldCodeGenerator::FindFirstCall ( )

Finds the first function call.

Returns
A pointer to the first call instruction.

◆ FindLastCall()

const InstPtr WorldCodeGenerator::FindLastCall ( )

Finds the last function call.

Returns
A pointer to the last call instruction.

◆ ProcessSpecialMetadata()

void WorldCodeGenerator::ProcessSpecialMetadata ( const InstPtr  inst,
char  c,
int  pos 
)
virtual

Processes special metadata in an instruction.

Parameters
[in]instThe instruction to process.
[in]c
[in]pos
Todo:
understand and document.

Reimplemented from CodeGenerator.


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