Home | nevrax.com |
|
context_debug.hGo to the documentation of this file.00001 00007 /* Copyright, 2000 Nevrax Ltd. 00008 * 00009 * This file is part of NEVRAX D.T.C. SYSTEM. 00010 * NEVRAX D.T.C. SYSTEM is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2, or (at your option) 00013 * any later version. 00014 00015 * NEVRAX D.T.C. SYSTEM is distributed in the hope that it will be useful, but 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * General Public License for more details. 00019 00020 * You should have received a copy of the GNU General Public License 00021 * along with NEVRAX D.T.C. SYSTEM; see the file COPYING. If not, write to the 00022 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00023 * MA 02111-1307, USA. 00024 */ 00025 00026 #ifndef NL_CONTEXT_DEBUG_H 00027 #define NL_CONTEXT_DEBUG_H 00028 00029 #include <set> 00030 #include <string> 00031 #include "nel/ai/agent/agentpack.h" 00032 #include "nel/ai/agent/agent_script.h" 00033 00034 namespace NLAISCRIPT 00035 { 00036 enum TDebugMode 00037 { 00038 runMode, 00039 stepByStepMode, 00040 stepInMode, 00041 stepOutMode, 00042 stopMode 00043 }; 00044 class CCodeBrancheRun; 00045 class CStackPointer; 00046 00053 class CContextDebug : public NLAIAGENT::IObjectIA 00054 { 00055 public: 00056 static const NLAIC::CIdentType IdContextDebug; 00057 00059 bool Active; 00060 00062 CStackPointer &HeapDebug; 00063 00064 // Var name of the current function. 00065 std::list<NLAIAGENT::IObjectIA *> Param; 00066 00067 private : 00068 NLAIAGENT::TProcessStatement _RunState; 00069 std::list<const CCodeBrancheRun*> _CallStack; 00070 TDebugMode _DebugMode; 00071 uint16 _StepIndex; // Index of the current StepByStep branche in the _CallStack 00072 typedef std::set<uint16> uintSet; 00073 typedef std::string mystring; 00074 std::map<mystring, uintSet> _BreakPointSet; 00075 char *_LastCommandLine; 00076 00077 public : 00079 CContextDebug(); 00080 00082 virtual ~CContextDebug(); 00083 00085 const NLAIC::CIdentType &getType() const; 00086 00088 const NLAIC::IBasicType* clone() const; 00089 00091 const NLAIC::IBasicType* newInstance() const; 00092 00094 void getDebugString(std::string &dbgStr) const; 00095 00097 virtual void save(NLMISC::IStream &os); 00098 00100 void load(NLMISC::IStream &is); 00101 00103 bool isEqual(const NLAIAGENT::IBasicObjectIA &a) const; 00104 00106 const NLAIAGENT::IObjectIA::CProcessResult &run(); 00107 00109 00110 void setDebugMode(TDebugMode dm); 00111 TDebugMode getDebugMode () const; 00113 00115 00116 void setStepIndex(uint16 si); 00117 uint16 getStepIndex () const; 00119 00121 void stepIndexUp(); 00122 00124 void stepIndexDown(); 00125 00127 uint16 getCallStackTopIndex() const; 00128 00130 void callStackPop(); 00131 00133 void callStackPush(const CCodeBrancheRun* cbr); 00134 00136 void callStackPrint(NLAIC::IIO *inputOutput) const; 00137 00139 void addBreakPoint(uint16 line, const char* fileName); 00140 00142 void eraseBreakPoint(uint16 line, const char* fileName); 00143 00145 bool getBreakPointValue(uint16 line, const char* fileName) const; 00146 00148 void printActiveBeaks(NLAIC::IIO *inputOutput) const; 00149 00151 const char* getLastCommandLine() const; 00152 00154 void setLastCommandLine(const char* c); 00155 00157 void init() 00158 { 00159 if(Active) _DebugMode = stepByStepMode; 00160 } 00161 }; 00162 } 00163 00164 #endif // NL_CONTEXT_DEBUG_H 00165 00166 /* End of context_debug.h */ |