Pol  Revision:3cfda13
Pol::Bscript::EScriptProgram Class Reference

#include <eprog.h>

+ Inheritance diagram for Pol::Bscript::EScriptProgram:

Public Member Functions

 EScriptProgram ()
 
int _readToken (Token &token, unsigned position) const
 
int add_dbg_filename (const std::string &filename)
 
void add_ins_dbg_info ()
 
void addfunction (std::string name, unsigned firstPC, unsigned lastPC)
 
void addlocalvar (const std::string &localvarname)
 
void addToken (const Token &token)
 
void append (const StoredToken &stoken)
 
void append (const StoredToken &stoken, unsigned *posn)
 
void append (const StoredToken &stoken, const CompilerContext &ctx)
 
void append (const StoredToken &stoken, const CompilerContext &ctx, unsigned *posn)
 
void clear_modules ()
 
int create_instructions ()
 
std::string dbg_get_instruction (size_t atPC) const
 
void dump (std::ostream &os)
 
void dump_casejmp (std::ostream &os, const Token &token)
 
void enterblock ()
 
void enterfunction ()
 
void erase ()
 
void leaveblock ()
 
void leavefunction ()
 
unsigned parentvariables (unsigned parent)
 
int read (const char *fname)
 
int read_dbg_file ()
 
int read_exported_functions (FILE *fp, BSCRIPT_SECTION_HDR *hdr)
 
int read_globalvarnames (FILE *fp)
 
int read_module (FILE *fp)
 
int read_progdef_hdr (FILE *fp)
 
void setcontext (const CompilerContext &ctx)
 
void setstatementbegin ()
 
size_t sizeEstimate () const
 
void update_dbg_pos (const Token &tkn)
 
unsigned varcount (unsigned block)
 
int write (const char *fname)
 
int write_dbg (const char *fname, bool gen_txt)
 
- Public Member Functions inherited from ref_counted
unsigned int add_ref ()
 
unsigned int count () const
 
unsigned int release ()
 

Public Attributes

std::vector< EPDbgBlockblocks
 
unsigned curblock
 
unsigned curfile
 
unsigned curline
 
std::vector< std::string > dbg_filenames
 
std::vector< unsigned > dbg_filenum
 
std::vector< EPDbgFunctiondbg_functions
 
std::vector< unsigned > dbg_ins_blocks
 
std::vector< bool > dbg_ins_statementbegin
 
std::vector< unsigned > dbg_linenum
 
bool debug_loaded
 
unsigned expectedArgs
 
std::vector< EPExportedFunctionexported_functions
 
std::vector< std::string > fileline
 
std::vector< std::string > function_decls
 
std::vector< std::string > globalvarnames
 
bool haveProgram
 
std::vector< Instructioninstr
 
u64 instr_cycles
 
unsigned int invocations
 
std::vector< FunctionalityModule * > modules
 
boost_utils::script_name_flystring name
 
unsigned nglobals
 
Plib::Package const * pkg
 
std::string program_decl
 
unsigned program_PC
 
unsigned savecurblock
 
std::vector< std::string > sourcelines
 
bool statementbegin
 
SymbolContainer symbols
 
StoredTokenContainer tokens
 
unsigned short version
 

Private Member Functions

 ~EScriptProgram ()
 

Friends

class EScriptProgramCheckpoint
 
class ref_ptr< EScriptProgram >
 

Additional Inherited Members

- Protected Member Functions inherited from ref_counted
 ref_counted ()
 
- Protected Attributes inherited from ref_counted
std::atomic< unsigned int > _count
 

Detailed Description

Definition at line 77 of file eprog.h.

Constructor & Destructor Documentation

Pol::Bscript::EScriptProgram::EScriptProgram ( )
Pol::Bscript::EScriptProgram::~EScriptProgram ( )
private

Definition at line 63 of file eprog.cpp.

References Pol::Clib::delete_all(), Pol::Bscript::escript_program_count, modules, and name.

Member Function Documentation

int Pol::Bscript::EScriptProgram::_readToken ( Token token,
unsigned  position 
) const

Definition at line 198 of file eprog_read.cpp.

References Pol::Bscript::SymbolContainer::array(), Pol::Bscript::StoredTokenContainer::atGet1(), Pol::Bscript::CTRL_JSR_USERFUNC, Pol::Bscript::CTRL_LEAVE_BLOCK, Pol::Bscript::CTRL_STATEMENTBEGIN, Pol::Bscript::Token::dataptr, Pol::Clib::decint(), Pol::Bscript::Token::dval, Pol::Bscript::FunctionalityModule::functions, Pol::Bscript::StoredToken::id, Pol::Bscript::Token::id, Pol::Bscript::INS_ASSIGN_GLOBALVAR, Pol::Bscript::INS_ASSIGN_LOCALVAR, Pol::Bscript::INS_CALL_METHOD, Pol::Bscript::INS_CALL_METHOD_ID, Pol::Bscript::INS_CASEJMP, Pol::Bscript::INS_GET_MEMBER_ID, Pol::Bscript::INS_INITFOR, Pol::Bscript::INS_INITFOREACH, Pol::Bscript::INS_NEXTFOR, Pol::Bscript::INS_SET_MEMBER_ID, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_DIVIDEEQUAL, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_MINUSEQUAL, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_MODULUSEQUAL, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_PLUSEQUAL, Pol::Bscript::INS_SET_MEMBER_ID_CONSUME_TIMESEQUAL, Pol::Bscript::INS_STEPFOREACH, Pol::Bscript::SymbolContainer::length(), Pol::Bscript::Token::lval, Pol::Bscript::StoredToken::module, Pol::Bscript::Token::module, modules, Pol::Bscript::ModuleFunction::name, Pol::Bscript::Token::nulStr(), Pol::Bscript::StoredToken::offset, Pol::Bscript::RSV_GLOBAL, Pol::Bscript::RSV_GOTO, Pol::Bscript::RSV_JMPIFFALSE, Pol::Bscript::RSV_JMPIFTRUE, Pol::Bscript::RSV_LOCAL, Pol::Bscript::Token::setStr(), Pol::Bscript::Token::sourceFile, symbols, Pol::Bscript::TOK_ARRAY_SUBSCRIPT, Pol::Bscript::TOK_DOUBLE, Pol::Bscript::TOK_FUNC, Pol::Bscript::TOK_FUNCREF, Pol::Bscript::TOK_GLOBALVAR, Pol::Bscript::TOK_LOCALVAR, Pol::Bscript::TOK_LONG, Pol::Bscript::TOK_USERFUNC, tokens, Pol::Bscript::TYP_FUNC, Pol::Bscript::TYP_USERFUNC, Pol::Bscript::StoredToken::type, and Pol::Bscript::Token::type.

Referenced by create_instructions(), and dump().

int Pol::Bscript::EScriptProgram::add_dbg_filename ( const std::string &  filename)

Definition at line 486 of file eprog2.cpp.

References dbg_filenames.

void Pol::Bscript::EScriptProgram::add_ins_dbg_info ( )
void Pol::Bscript::EScriptProgram::addfunction ( std::string  name,
unsigned  firstPC,
unsigned  lastPC 
)
void Pol::Bscript::EScriptProgram::addlocalvar ( const std::string &  localvarname)

Definition at line 555 of file eprog2.cpp.

References blocks, and curblock.

void Pol::Bscript::EScriptProgram::append ( const StoredToken stoken)
void Pol::Bscript::EScriptProgram::append ( const StoredToken stoken,
unsigned *  posn 
)
void Pol::Bscript::EScriptProgram::append ( const StoredToken stoken,
const CompilerContext ctx 
)
void Pol::Bscript::EScriptProgram::append ( const StoredToken stoken,
const CompilerContext ctx,
unsigned *  posn 
)
void Pol::Bscript::EScriptProgram::clear_modules ( )

Definition at line 73 of file eprog.cpp.

References Pol::Clib::delete_all(), and modules.

int Pol::Bscript::EScriptProgram::create_instructions ( )
std::string Pol::Bscript::EScriptProgram::dbg_get_instruction ( size_t  atPC) const

Definition at line 502 of file eprog2.cpp.

References instr, OSTRINGSTREAM, and OSTRINGSTREAM_STR.

Referenced by Pol::Core::DebugContext::cmd_scriptins().

void Pol::Bscript::EScriptProgram::dump_casejmp ( std::ostream &  os,
const Token token 
)
void Pol::Bscript::EScriptProgram::enterblock ( )
void Pol::Bscript::EScriptProgram::enterfunction ( )

Definition at line 514 of file eprog2.cpp.

References curblock, and savecurblock.

void Pol::Bscript::EScriptProgram::erase ( )
void Pol::Bscript::EScriptProgram::leaveblock ( )

Definition at line 540 of file eprog2.cpp.

References blocks, curblock, dbg_ins_blocks, and passert.

void Pol::Bscript::EScriptProgram::leavefunction ( )

Definition at line 519 of file eprog2.cpp.

References curblock, and savecurblock.

unsigned Pol::Bscript::EScriptProgram::parentvariables ( unsigned  parent)

Definition at line 358 of file eprog2.cpp.

References blocks.

int Pol::Bscript::EScriptProgram::read_globalvarnames ( FILE *  fp)
int Pol::Bscript::EScriptProgram::read_module ( FILE *  fp)
int Pol::Bscript::EScriptProgram::read_progdef_hdr ( FILE *  fp)

Reads the Program Header section from the file pointer

Definition at line 163 of file eprog_read.cpp.

References Pol::Bscript::BSCRIPT_PROGDEF_HDR::expectedArgs, expectedArgs, and haveProgram.

Referenced by read().

void Pol::Bscript::EScriptProgram::setcontext ( const CompilerContext ctx)
void Pol::Bscript::EScriptProgram::setstatementbegin ( )

Definition at line 510 of file eprog2.cpp.

References statementbegin.

void Pol::Bscript::EScriptProgram::update_dbg_pos ( const Token tkn)

Definition at line 46 of file eprog2.cpp.

References curfile, curline, Pol::Bscript::Token::dbg_filenum, and Pol::Bscript::Token::dbg_linenum.

Referenced by addToken().

unsigned Pol::Bscript::EScriptProgram::varcount ( unsigned  block)

Definition at line 349 of file eprog2.cpp.

References blocks.

Referenced by enterblock().

Friends And Related Function Documentation

friend class EScriptProgramCheckpoint
friend

Definition at line 163 of file eprog.h.

friend class ref_ptr< EScriptProgram >
friend

Definition at line 165 of file eprog.h.

Member Data Documentation

unsigned Pol::Bscript::EScriptProgram::curblock
unsigned Pol::Bscript::EScriptProgram::curfile

Definition at line 130 of file eprog.h.

Referenced by add_ins_dbg_info(), setcontext(), and update_dbg_pos().

unsigned Pol::Bscript::EScriptProgram::curline

Definition at line 131 of file eprog.h.

Referenced by add_ins_dbg_info(), setcontext(), and update_dbg_pos().

std::vector<EPDbgFunction> Pol::Bscript::EScriptProgram::dbg_functions

Definition at line 135 of file eprog.h.

Referenced by addfunction(), erase(), read_dbg_file(), sizeEstimate(), and write_dbg().

std::vector<bool> Pol::Bscript::EScriptProgram::dbg_ins_statementbegin
unsigned Pol::Bscript::EScriptProgram::expectedArgs

Definition at line 89 of file eprog.h.

Referenced by read_progdef_hdr(), and write().

std::vector<EPExportedFunction> Pol::Bscript::EScriptProgram::exported_functions
std::vector<std::string> Pol::Bscript::EScriptProgram::fileline
std::vector<std::string> Pol::Bscript::EScriptProgram::function_decls

Definition at line 115 of file eprog.h.

Referenced by dump(), and sizeEstimate().

std::vector<std::string> Pol::Bscript::EScriptProgram::globalvarnames
bool Pol::Bscript::EScriptProgram::haveProgram

Definition at line 90 of file eprog.h.

Referenced by read_progdef_hdr(), Pol::Mobile::Character::start_script(), and write().

u64 Pol::Bscript::EScriptProgram::instr_cycles
unsigned int Pol::Bscript::EScriptProgram::invocations
unsigned Pol::Bscript::EScriptProgram::nglobals

Definition at line 88 of file eprog.h.

Referenced by erase(), and read().

std::string Pol::Bscript::EScriptProgram::program_decl

Definition at line 112 of file eprog.h.

Referenced by dump(), and sizeEstimate().

unsigned Pol::Bscript::EScriptProgram::program_PC

Definition at line 111 of file eprog.h.

Referenced by dump().

unsigned Pol::Bscript::EScriptProgram::savecurblock

Definition at line 128 of file eprog.h.

Referenced by enterfunction(), and leavefunction().

std::vector<std::string> Pol::Bscript::EScriptProgram::sourcelines
bool Pol::Bscript::EScriptProgram::statementbegin

Definition at line 132 of file eprog.h.

Referenced by add_ins_dbg_info(), Pol::Bscript::Compiler::rollback(), and setstatementbegin().

SymbolContainer Pol::Bscript::EScriptProgram::symbols
unsigned short Pol::Bscript::EScriptProgram::version

Definition at line 120 of file eprog.h.

Referenced by read().


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