UCMachine Class Reference

#include <UCMachine.h>

List of all members.

Public Member Functions

 UCMachine (Intrinsic *iset, unsigned int icount)
 ~UCMachine ()
void reset ()
bool execProcess (UCProcess *proc)
std::string & getString (uint16 str)
UCListgetList (uint16 l)
void freeString (uint16 s)
void freeStringList (uint16 l)
void freeList (uint16 l)
uint16 duplicateString (uint16 str)
void usecodeStats ()
bool assignPointer (uint32 ptr, const uint8 *data, uint32 size)
bool dereferencePointer (uint32 ptr, uint8 *data, uint32 size)
void saveGlobals (ODataSource *ods)
void saveStrings (ODataSource *ods)
void saveLists (ODataSource *ods)
bool loadGlobals (IDataSource *ids, uint32 version)
bool loadStrings (IDataSource *ids, uint32 version)
bool loadLists (IDataSource *ids, uint32 version)
 INTRINSIC (I_true)
 INTRINSIC (I_dummyProcess)
 INTRINSIC (I_getName)
 INTRINSIC (I_urandom)
 INTRINSIC (I_rndRange)
 INTRINSIC (I_numToStr)
 INTRINSIC (I_getCurrentTimerTick)
bool trace_event ()

Static Public Member Functions

static UCMachineget_instance ()
static uint32 listToPtr (uint16 l)
static uint32 stringToPtr (uint16 s)
static uint32 stackToPtr (uint16 pid, uint16 offset)
static uint32 globalToPtr (uint16 offset)
static uint32 objectToPtr (uint16 objID)
static uint16 ptrToObject (uint32 ptr)

Protected Member Functions

void loadIntrinsics (Intrinsic *i, unsigned int icount)

Private Member Functions

uint16 assignString (const char *str)
uint16 assignList (UCList *l)
bool trace_show (ProcId pid, ObjId objid, uint16 ucclass)

Static Private Member Functions

static void ConCmd_getGlobal (const Console::ArgvType &argv)
static void ConCmd_setGlobal (const Console::ArgvType &argv)
static void ConCmd_tracePID (const Console::ArgvType &argv)
static void ConCmd_traceObjID (const Console::ArgvType &argv)
static void ConCmd_traceClass (const Console::ArgvType &argv)
static void ConCmd_traceAll (const Console::ArgvType &argv)
static void ConCmd_traceEvents (const Console::ArgvType &argv)
static void ConCmd_stopTrace (const Console::ArgvType &argv)

Private Attributes

ConvertUsecodeconvuse
Intrinsicintrinsics
unsigned int intrinsiccount
BitSetglobals
std::map< uint16, UCList * > listHeap
std::map< uint16, std::string > stringHeap
idManlistIDs
idManstringIDs
bool tracing_enabled
bool trace_all
bool trace_events
std::set< ObjIdtrace_ObjIDs
std::set< ProcIdtrace_PIDs
std::set< uint16trace_classes

Static Private Attributes

static UCMachineucmachine = 0


Detailed Description

Definition at line 36 of file UCMachine.h.


Constructor & Destructor Documentation

UCMachine::UCMachine ( Intrinsic iset,
unsigned int  icount 
)

Definition at line 82 of file UCMachine.cpp.

References Console::AddConsoleCommand(), con, ConCmd_getGlobal(), ConCmd_setGlobal(), ConCmd_stopTrace(), ConCmd_traceAll(), ConCmd_traceClass(), ConCmd_traceEvents(), ConCmd_traceObjID(), ConCmd_tracePID(), convuse, globals, listIDs, loadIntrinsics(), MM_INFO, Console::Print(), stringIDs, trace_all, tracing_enabled, and ucmachine.

UCMachine::~UCMachine (  ) 

Definition at line 114 of file UCMachine.cpp.

References con, ConCmd_getGlobal(), ConCmd_setGlobal(), ConCmd_stopTrace(), ConCmd_traceAll(), ConCmd_traceClass(), ConCmd_traceObjID(), ConCmd_tracePID(), convuse, globals, listIDs, MM_INFO, Console::Print(), Console::RemoveConsoleCommand(), stringIDs, and ucmachine.


Member Function Documentation

uint16 UCMachine::assignList ( UCList l  )  [private]

Definition at line 1996 of file UCMachine.cpp.

References idMan::getNewID(), listHeap, and listIDs.

Referenced by execProcess().

bool UCMachine::assignPointer ( uint32  ptr,
const uint8 data,
uint32  size 
)

Definition at line 2087 of file UCMachine.cpp.

References BaseUCStack::assign(), Kernel::get_instance(), Kernel::getProcess(), perr, SEG_GLOBAL, SEG_STACK_FIRST, SEG_STACK_LAST, and UCProcess::stack.

Referenced by execProcess().

uint16 UCMachine::assignString ( const char *  str  )  [private]

Definition at line 1980 of file UCMachine.cpp.

References idMan::getNewID(), stringHeap, and stringIDs.

Referenced by duplicateString(), and execProcess().

void UCMachine::ConCmd_getGlobal ( const Console::ArgvType argv  )  [static, private]

Definition at line 2383 of file UCMachine.cpp.

References get_instance(), BitSet::getBits(), globals, and pout.

Referenced by UCMachine(), and ~UCMachine().

void UCMachine::ConCmd_setGlobal ( const Console::ArgvType argv  )  [static, private]

Definition at line 2398 of file UCMachine.cpp.

References get_instance(), BitSet::getBits(), globals, pout, and BitSet::setBits().

Referenced by UCMachine(), and ~UCMachine().

void UCMachine::ConCmd_stopTrace ( const Console::ArgvType argv  )  [static, private]

Definition at line 2486 of file UCMachine.cpp.

References get_instance(), trace_all, trace_classes, trace_events, trace_ObjIDs, trace_PIDs, and tracing_enabled.

Referenced by UCMachine(), and ~UCMachine().

void UCMachine::ConCmd_traceAll ( const Console::ArgvType argv  )  [static, private]

Definition at line 2466 of file UCMachine.cpp.

References get_instance(), pout, trace_all, and tracing_enabled.

Referenced by UCMachine(), and ~UCMachine().

void UCMachine::ConCmd_traceClass ( const Console::ArgvType argv  )  [static, private]

Definition at line 2450 of file UCMachine.cpp.

References get_instance(), pout, trace_classes, and tracing_enabled.

Referenced by UCMachine(), and ~UCMachine().

void UCMachine::ConCmd_traceEvents ( const Console::ArgvType argv  )  [static, private]

Definition at line 2475 of file UCMachine.cpp.

References get_instance(), pout, trace_events, and tracing_enabled.

Referenced by UCMachine().

void UCMachine::ConCmd_traceObjID ( const Console::ArgvType argv  )  [static, private]

Definition at line 2434 of file UCMachine.cpp.

References get_instance(), pout, trace_ObjIDs, and tracing_enabled.

Referenced by UCMachine(), and ~UCMachine().

void UCMachine::ConCmd_tracePID ( const Console::ArgvType argv  )  [static, private]

Definition at line 2418 of file UCMachine.cpp.

References get_instance(), pout, trace_PIDs, and tracing_enabled.

Referenced by UCMachine(), and ~UCMachine().

bool UCMachine::dereferencePointer ( uint32  ptr,
uint8 data,
uint32  size 
)

Definition at line 2128 of file UCMachine.cpp.

References BaseUCStack::access(), Kernel::get_instance(), Kernel::getProcess(), perr, SEG_GLOBAL, SEG_OBJ, SEG_STACK_FIRST, SEG_STACK_LAST, and UCProcess::stack.

Referenced by execProcess().

uint16 UCMachine::duplicateString ( uint16  str  ) 

Definition at line 1990 of file UCMachine.cpp.

References assignString(), and stringHeap.

Referenced by UCList::copyStringList(), and execProcess().

bool UCMachine::execProcess ( UCProcess proc  ) 

Definition at line 157 of file UCMachine.cpp.

References BaseUCStack::access(), BaseUCStack::access1(), BaseUCStack::access2(), BaseUCStack::access4(), Kernel::addProcessExec(), BaseUCStack::addSP(), UCList::append(), UCList::appendList(), CurrentMap::areaSearch(), UCList::assign(), BaseUCStack::assign(), BaseUCStack::assign1(), BaseUCStack::assign2(), BaseUCStack::assign4(), assignList(), assignPointer(), assignString(), UCProcess::bp, UCProcess::call(), Item::checkLoopScript(), UCProcess::classid, Container::containerSearch(), convuse, UCList::copyList(), UCList::copyStringList(), dereferencePointer(), duplicateString(), Process::flags, freeList(), UCProcess::freeOnTerminate(), freeString(), freeStringList(), Usecode::get_class(), Usecode::get_class_base_offset(), Usecode::get_class_event(), Usecode::get_class_size(), World::get_instance(), Kernel::get_instance(), BitSet::getBits(), getContainer(), World::getCurrentMap(), UCList::getElementSize(), getItem(), getList(), Kernel::getProcess(), UCList::getSize(), BaseUCStack::getSP(), getString(), UCList::getStringIndex(), globals, UCList::inList(), intrinsiccount, intrinsics, ConvertUsecode::intrinsics(), UCProcess::ip, Process::is_terminated(), Process::item_num, perr, Process::pid, BaseUCStack::pop(), BaseUCStack::pop2(), BaseUCStack::pop4(), pout, print_bp(), print_sp(), Process::PROC_SUSPENDED, BaseUCStack::push(), BaseUCStack::push0(), BaseUCStack::push1(), BaseUCStack::push2(), BaseUCStack::push4(), Process::result, UCProcess::ret(), BitSet::setBits(), Process::setItemNum(), Process::setType(), UCProcess::stack, BaseUCStack::stacksize(), stackToPtr(), stringHeap, stringToPtr(), UCList::substractList(), UCList::substractStringList(), CurrentMap::surfaceSearch(), UCProcess::temp32, Process::terminateDeferred(), trace_show(), Process::type, UCList::unionStringList(), UCProcess::usecode, and Process::waitFor().

Referenced by UCProcess::run().

void UCMachine::freeList ( uint16  l  ) 

Definition at line 2020 of file UCMachine.cpp.

References idMan::clearID(), listHeap, and listIDs.

Referenced by execProcess(), and UCProcess::terminate().

void UCMachine::freeString ( uint16  s  ) 

Definition at line 2007 of file UCMachine.cpp.

References idMan::clearID(), stringHeap, and stringIDs.

Referenced by UCList::assignString(), execProcess(), UCList::freeStrings(), UCProcess::terminate(), and UCList::unionStringList().

void UCMachine::freeStringList ( uint16  l  ) 

Definition at line 2031 of file UCMachine.cpp.

References idMan::clearID(), listHeap, and listIDs.

Referenced by execProcess(), and UCProcess::terminate().

static UCMachine* UCMachine::get_instance (  )  [inline, static]

Definition at line 42 of file UCMachine.h.

References ucmachine.

Referenced by UCList::assignString(), Item::callUsecodeEvent(), GUIApp::ConCmd_engineStats(), ConCmd_getGlobal(), ConCmd_setGlobal(), ConCmd_stopTrace(), ConCmd_traceAll(), ConCmd_traceClass(), ConCmd_traceEvents(), ConCmd_traceObjID(), ConCmd_tracePID(), UCList::copyStringList(), UCList::freeStrings(), UCList::getString(), AskGump::InitGump(), UCProcess::load(), UCList::removeString(), UCProcess::run(), UCList::stringInList(), UCProcess::terminate(), and UCList::unionStringList().

UCList * UCMachine::getList ( uint16  l  ) 

Definition at line 1968 of file UCMachine.cpp.

References listHeap.

Referenced by execProcess().

std::string & UCMachine::getString ( uint16  str  ) 

Definition at line 1956 of file UCMachine.cpp.

References stringHeap.

Referenced by execProcess(), UCList::getString(), AskGump::InitGump(), UCList::removeString(), and UCList::stringInList().

uint32 UCMachine::globalToPtr ( uint16  offset  )  [static]

Definition at line 2070 of file UCMachine.cpp.

References SEG_GLOBAL.

UCMachine::INTRINSIC ( I_getCurrentTimerTick   ) 

UCMachine::INTRINSIC ( I_numToStr   ) 

UCMachine::INTRINSIC ( I_rndRange   ) 

UCMachine::INTRINSIC ( I_urandom   ) 

UCMachine::INTRINSIC ( I_getName   ) 

UCMachine::INTRINSIC ( I_dummyProcess   ) 

UCMachine::INTRINSIC ( I_true   ) 

uint32 UCMachine::listToPtr ( uint16  l  )  [static]

Definition at line 2043 of file UCMachine.cpp.

References SEG_LIST.

bool UCMachine::loadGlobals ( IDataSource ids,
uint32  version 
)

Definition at line 2286 of file UCMachine.cpp.

References globals, and BitSet::load().

Referenced by GUIApp::loadGame().

void UCMachine::loadIntrinsics ( Intrinsic i,
unsigned int  icount 
) [protected]

Definition at line 151 of file UCMachine.cpp.

References intrinsiccount, and intrinsics.

Referenced by UCMachine().

bool UCMachine::loadLists ( IDataSource ids,
uint32  version 
)

Definition at line 2314 of file UCMachine.cpp.

References listHeap, listIDs, UCList::load(), idMan::load(), IDataSource::read2(), and IDataSource::read4().

Referenced by GUIApp::loadGame().

bool UCMachine::loadStrings ( IDataSource ids,
uint32  version 
)

Definition at line 2291 of file UCMachine.cpp.

References idMan::load(), IDataSource::read(), IDataSource::read2(), IDataSource::read4(), stringHeap, and stringIDs.

Referenced by GUIApp::loadGame().

uint32 UCMachine::objectToPtr ( uint16  objID  )  [static]

Definition at line 2079 of file UCMachine.cpp.

References SEG_OBJ.

Referenced by Object::callUsecode().

uint16 UCMachine::ptrToObject ( uint32  ptr  )  [static]

Definition at line 2183 of file UCMachine.cpp.

References BaseUCStack::access2(), Kernel::get_instance(), Kernel::getProcess(), perr, SEG_GLOBAL, SEG_OBJ, SEG_STACK_FIRST, SEG_STACK_LAST, SEG_STRING, and UCProcess::stack.

void UCMachine::reset (  ) 

Definition at line 136 of file UCMachine.cpp.

References con, globals, listHeap, MM_INFO, Console::Print(), BitSet::setSize(), and stringHeap.

Referenced by GUIApp::resetEngine().

void UCMachine::saveGlobals ( ODataSource ods  ) 

Definition at line 2254 of file UCMachine.cpp.

References globals, and BitSet::save().

Referenced by GUIApp::saveGame().

void UCMachine::saveLists ( ODataSource ods  ) 

Definition at line 2273 of file UCMachine.cpp.

References listHeap, listIDs, idMan::save(), ODataSource::write2(), and ODataSource::write4().

Referenced by GUIApp::saveGame().

void UCMachine::saveStrings ( ODataSource ods  ) 

Definition at line 2259 of file UCMachine.cpp.

References idMan::save(), stringHeap, stringIDs, ODataSource::write(), ODataSource::write2(), and ODataSource::write4().

Referenced by GUIApp::saveGame().

uint32 UCMachine::stackToPtr ( uint16  pid,
uint16  offset 
) [static]

Definition at line 2061 of file UCMachine.cpp.

References SEG_STACK.

Referenced by execProcess(), and UCProcess::load().

uint32 UCMachine::stringToPtr ( uint16  s  )  [static]

Definition at line 2052 of file UCMachine.cpp.

References SEG_STRING.

Referenced by execProcess().

bool UCMachine::trace_event (  )  [inline]

Definition at line 131 of file UCMachine.h.

References trace_all, trace_events, and tracing_enabled.

bool UCMachine::trace_show ( ProcId  pid,
ObjId  objid,
uint16  ucclass 
) [inline, private]

Definition at line 121 of file UCMachine.h.

References trace_all, trace_classes, trace_ObjIDs, trace_PIDs, and tracing_enabled.

Referenced by execProcess().

void UCMachine::usecodeStats (  ) 

Definition at line 2221 of file UCMachine.cpp.

References listHeap, pout, and stringHeap.

Referenced by GUIApp::ConCmd_engineStats().


Member Data Documentation

ConvertUsecode* UCMachine::convuse [private]

Definition at line 91 of file UCMachine.h.

Referenced by execProcess(), UCMachine(), and ~UCMachine().

BitSet* UCMachine::globals [private]

Definition at line 95 of file UCMachine.h.

Referenced by ConCmd_getGlobal(), ConCmd_setGlobal(), execProcess(), loadGlobals(), reset(), saveGlobals(), UCMachine(), and ~UCMachine().

unsigned int UCMachine::intrinsiccount [private]

Definition at line 93 of file UCMachine.h.

Referenced by execProcess(), and loadIntrinsics().

Intrinsic* UCMachine::intrinsics [private]

Definition at line 92 of file UCMachine.h.

Referenced by execProcess(), and loadIntrinsics().

std::map<uint16, UCList*> UCMachine::listHeap [private]

Definition at line 97 of file UCMachine.h.

Referenced by assignList(), freeList(), freeStringList(), getList(), loadLists(), reset(), saveLists(), and usecodeStats().

idMan* UCMachine::listIDs [private]

Definition at line 103 of file UCMachine.h.

Referenced by assignList(), freeList(), freeStringList(), loadLists(), saveLists(), UCMachine(), and ~UCMachine().

std::map<uint16, std::string> UCMachine::stringHeap [private]

Definition at line 98 of file UCMachine.h.

Referenced by assignString(), duplicateString(), execProcess(), freeString(), getString(), loadStrings(), reset(), saveStrings(), and usecodeStats().

idMan* UCMachine::stringIDs [private]

Definition at line 104 of file UCMachine.h.

Referenced by assignString(), freeString(), loadStrings(), saveStrings(), UCMachine(), and ~UCMachine().

bool UCMachine::trace_all [private]

Definition at line 115 of file UCMachine.h.

Referenced by ConCmd_stopTrace(), ConCmd_traceAll(), trace_event(), trace_show(), and UCMachine().

std::set<uint16> UCMachine::trace_classes [private]

Definition at line 119 of file UCMachine.h.

Referenced by ConCmd_stopTrace(), ConCmd_traceClass(), and trace_show().

bool UCMachine::trace_events [private]

Definition at line 116 of file UCMachine.h.

Referenced by ConCmd_stopTrace(), ConCmd_traceEvents(), and trace_event().

std::set<ObjId> UCMachine::trace_ObjIDs [private]

Definition at line 117 of file UCMachine.h.

Referenced by ConCmd_stopTrace(), ConCmd_traceObjID(), and trace_show().

std::set<ProcId> UCMachine::trace_PIDs [private]

Definition at line 118 of file UCMachine.h.

Referenced by ConCmd_stopTrace(), ConCmd_tracePID(), and trace_show().

bool UCMachine::tracing_enabled [private]

Definition at line 114 of file UCMachine.h.

Referenced by ConCmd_stopTrace(), ConCmd_traceAll(), ConCmd_traceClass(), ConCmd_traceEvents(), ConCmd_traceObjID(), ConCmd_tracePID(), trace_event(), trace_show(), and UCMachine().

UCMachine * UCMachine::ucmachine = 0 [static, private]

Definition at line 106 of file UCMachine.h.

Referenced by get_instance(), UCMachine(), and ~UCMachine().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:30:08 2007 for pentagram by  doxygen 1.4.7