From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/opcode_8cpp-source.html | 836 +++++++++++++++++++++++++++++++ 1 file changed, 836 insertions(+) create mode 100644 docs/doxygen/nel/opcode_8cpp-source.html (limited to 'docs/doxygen/nel/opcode_8cpp-source.html') diff --git a/docs/doxygen/nel/opcode_8cpp-source.html b/docs/doxygen/nel/opcode_8cpp-source.html new file mode 100644 index 00000000..693317f0 --- /dev/null +++ b/docs/doxygen/nel/opcode_8cpp-source.html @@ -0,0 +1,836 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

opcode.cpp

Go to the documentation of this file.
00001 
+00006 /* Copyright, 2000 Nevrax Ltd.
+00007  *
+00008  * This file is part of NEVRAX NEL.
+00009  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00010  * it under the terms of the GNU General Public License as published by
+00011  * the Free Software Foundation; either version 2, or (at your option)
+00012  * any later version.
+00013 
+00014  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00017  * General Public License for more details.
+00018 
+00019  * You should have received a copy of the GNU General Public License
+00020  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00022  * MA 02111-1307, USA.
+00023  */
+00024 #include <string>
+00025 #include "nel/ai/script/compilateur.h"
+00026 #include "nel/ai/agent/agent_script.h"
+00027 #include "nel/ai/script/type_def.h"
+00028 #include "nel/ai/script/object_load.h"
+00029 
+00030 
+00031 namespace NLAISCRIPT
+00032 {       
+00033 
+00034         NLAIAGENT::TProcessStatement CNegOpCode::runOpCode(CCodeContext &context)
+00035         {       
+00036                 sint k = (int)context.Stack;
+00037                 NLAIAGENT::IObjetOp *o = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00038                 context.Stack[k] = o->getNeg();
+00039                 o->release();
+00040                 return NLAIAGENT::IObjectIA::ProcessIdle;
+00041         }
+00042 
+00043         void CNegOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00044         {
+00045                 std::string X;
+00046 
+00047                 ((NLAIAGENT::IObjectIA *)context.Stack)->getDebugString(X);
+00048                 str +="-";
+00049                 str += X;               
+00050         }
+00051 
+00052 
+00053         NLAIAGENT::TProcessStatement CAddOpCode::runOpCode(CCodeContext &context)
+00054         {               
+00055                 sint k = (int)context.Stack;
+00056                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00057                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00058 
+00059                 context.Stack[k - 1] = (*a) + (b);
+00060                 
+00061                 context.Stack--;
+00062                 a->release();
+00063                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00064         }
+00065 
+00066         void CAddOpCode::getDebugResult(std::string &str,CCodeContext &context) const 
+00067         {
+00068                 std::string X,Y;
+00069                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00070                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00071 
+00072                 str = X;
+00073                 str += " + ";
+00074                 str += Y;       
+00075         }
+00076 
+00077         NLAIAGENT::TProcessStatement CSubOpCode::runOpCode(CCodeContext &context)
+00078         {                               
+00079                 sint k = (int)context.Stack;
+00080                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00081                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00082 
+00083                 context.Stack[k - 1] = (*a) - (b);
+00084                 
+00085                 context.Stack--;
+00086                 a->release();
+00087                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00088         }
+00089         
+00090         void CSubOpCode::getDebugResult(std::string &str,CCodeContext &context) const 
+00091         {
+00092                 std::string X,Y;
+00093                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00094                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00095                 
+00096                 str = X;
+00097                 str += " - ";
+00098                 str += Y;
+00099         }
+00100 
+00101         NLAIAGENT::TProcessStatement CDivOpCode::runOpCode(CCodeContext &context)
+00102         {                               
+00103                 sint k = (int)context.Stack;
+00104                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00105                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00106 
+00107                 context.Stack[k - 1] = (*a) / (b);
+00108                 
+00109                 context.Stack--;
+00110                 a->release();
+00111                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00112         }
+00113 
+00114         void CDivOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00115         {
+00116                 std::string X,Y;
+00117                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00118                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00119                 
+00120                 str = X;
+00121                 str += " / ";
+00122                 str += Y;
+00123         }
+00124 
+00125 
+00126         NLAIAGENT::TProcessStatement CMulOpCode::runOpCode(CCodeContext &context)
+00127         {                               
+00128                 sint k = (int)context.Stack;
+00129                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00130                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00131 
+00132                 context.Stack[k - 1] = (*a) * (b);
+00133                 
+00134                 context.Stack--;
+00135                 a->release();
+00136                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00137         }
+00138 
+00139         void CMulOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00140         {
+00141                 std::string X,Y;
+00142                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00143                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00144                 
+00145                 str = X;
+00146                 str += " * ";
+00147                 str += Y;
+00148         }
+00149 
+00150         NLAIAGENT::TProcessStatement CSupOpCode::runOpCode(CCodeContext &context)
+00151         {               
+00152                 sint k = (int)context.Stack;
+00153                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00154                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00155 
+00156                 context.Stack[k - 1] = (*a) > (*b);
+00157                 
+00158                 context.Stack--;
+00159                 a->release();
+00160 
+00161                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00162         }
+00163 
+00164         void CSupOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00165         {
+00166                 std::string X,Y;
+00167                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00168                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00169                 
+00170                 str = X;
+00171                 str += " > ";
+00172                 str += Y;
+00173         }
+00174 
+00175         
+00176 
+00177         NLAIAGENT::TProcessStatement CInfOpCode::runOpCode(CCodeContext &context)
+00178         {                               
+00179                 sint k = (int)context.Stack;
+00180                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00181                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00182 
+00183                 context.Stack[k - 1] = (*a) < (*b);
+00184                 
+00185                 context.Stack--;
+00186                 a->release();
+00187 
+00188                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00189         }
+00190 
+00191         void CInfOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00192         {
+00193                 std::string X,Y;
+00194                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00195                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00196                 
+00197                 str = X;
+00198                 str += " < ";
+00199                 str += Y;
+00200         }
+00201 
+00202         NLAIAGENT::TProcessStatement CEqOpCode::runOpCode(CCodeContext &context)
+00203         {                               
+00204                 sint k = (int)context.Stack;
+00205                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00206                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00207 
+00208                 context.Stack[k - 1] = (*a) == (*b);
+00209                 
+00210                 context.Stack--;
+00211                 a->release();
+00212                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00213         }
+00214 
+00215         void CEqOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00216         {
+00217                 std::string X,Y;
+00218                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00219                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00220                 
+00221                 str = X;
+00222                 str += " = ";
+00223                 str += Y;
+00224         }
+00225 
+00226         NLAIAGENT::TProcessStatement CSupEqOpCode::runOpCode(CCodeContext &context)
+00227         {                               
+00228                 sint k = (int)context.Stack;
+00229                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00230                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00231 
+00232                 context.Stack[k - 1] = (*a) >= (*b);
+00233                 
+00234                 context.Stack--;
+00235                 a->release();
+00236                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00237         }
+00238 
+00239         void CSupEqOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00240         {
+00241                 std::string X,Y;
+00242                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00243                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00244                 
+00245                 str = X;
+00246                 str += " >= ";
+00247                 str += Y;
+00248         }
+00249 
+00250         NLAIAGENT::TProcessStatement CInfEqOpCode::runOpCode(CCodeContext &context)
+00251         {                               
+00252                 sint k = (int)context.Stack;
+00253                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00254                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00255 
+00256                 context.Stack[k - 1] = (*a) <= (*b);
+00257                 
+00258                 context.Stack--;
+00259                 a->release();
+00260                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00261         }
+00262 
+00263         void CInfEqOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00264         {
+00265                 std::string X,Y;
+00266                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00267                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00268                 
+00269                 str = X;
+00270                 str += " <= ";
+00271                 str += Y;
+00272         }
+00273 
+00274         NLAIAGENT::TProcessStatement CDiffOpCode::runOpCode(CCodeContext &context)
+00275         {                               
+00276                 sint k = (int)context.Stack;
+00277                 NLAIAGENT::IObjetOp *a = (NLAIAGENT::IObjetOp *)context.Stack[k - 1];
+00278                 NLAIAGENT::IObjetOp *b = (NLAIAGENT::IObjetOp *)context.Stack[k];
+00279 
+00280                 context.Stack[k - 1] = (*a) != (*b);
+00281                 
+00282                 context.Stack--;
+00283                 a->release();
+00284 
+00285                 return NLAIAGENT::IObjectIA::ProcessIdle;;
+00286         }
+00287 
+00288         void CDiffOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00289         {
+00290                 std::string X,Y;
+00291                 context.Stack[(int)context.Stack - 1]->getDebugString(X);
+00292                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00293                 
+00294                 str = X;
+00295                 str += " != ";
+00296                 str += Y;
+00297         }
+00298 
+00299         NLAIAGENT::TProcessStatement CNotOpCode::runOpCode(CCodeContext &context)
+00300         {               
+00301                 
+00302                 NLAIAGENT::IObjetOp *op = !*((NLAIAGENT::IObjetOp *)((NLAIAGENT::IObjectIA *)context.Stack));           
+00303                 context.Stack[(int)context.Stack]->release();
+00304                 context.Stack[(int)context.Stack] = op;
+00305                 
+00306                 return NLAIAGENT::IObjectIA::ProcessIdle;
+00307         }
+00308         void CNotOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00309         {
+00310                 std::string Y;
+00311                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00312                 
+00313                 str = "!";
+00314                 str += Y;
+00315         }
+00316 
+00317         NLAIAGENT::TProcessStatement CAffMemberiOpCode::runOpCode(CCodeContext &context)
+00318         {                               
+00319                 NLAIAGENT::IObjectIA *a = ((NLAIAGENT::IObjectIA *)context.Self);
+00320                 std::list<sint32>::iterator i = _I.begin();
+00321                 sint32 n = _I.size() - 1;
+00322                 while(n --)
+00323                 {                       
+00324                         a = (NLAIAGENT::IObjectIA *)a->getStaticMember(*i++);
+00325                 }
+00326                 NLAIAGENT::IObjectIA *obj = ((NLAIAGENT::IObjectIA *)context.Stack);
+00327                 
+00328                 if(!a->setStaticMember(*i,obj))
+00329                                                                 obj->incRef();
+00330                 context.Stack --;
+00331                 return NLAIAGENT::processIdle;
+00332         }
+00333 
+00334         NLAIAGENT::TProcessStatement CAffMemberOpCode::runOpCode(CCodeContext &context)
+00335         {       
+00336                 NLAIAGENT::IObjectIA *a = ((NLAIAGENT::IObjectIA *)context.Stack);
+00337                 
+00338                 if(!((NLAIAGENT::IObjectIA *)context.Self)->setStaticMember(_I,a))
+00339                                                                                                                                         a->incRef();
+00340                 context.Stack --;
+00341                 return NLAIAGENT::processIdle;
+00342         }       
+00343 
+00344         //*************************************
+00345         // CLocAllocDebug
+00346         //*************************************
+00347 
+00348         CLocAllocDebug::CLocAllocDebug()
+00349         {
+00350         }               
+00351 
+00352         CLocAllocDebug::~CLocAllocDebug()
+00353         {
+00354         }
+00355 
+00356         NLAIAGENT::TProcessStatement CLocAllocDebug::runOpCode(CCodeContext &context)
+00357         {                               
+00358                 /*NLAIAGENT::iObjectIA *i = (NLAIAGENT::iObjectIA *)NLAIC::getRegistry()->createInstance(_b);
+00359                 context.Heap[(sint32)context.Heap] = NULL;*/
+00360                 context.Heap ++;
+00361                 context.ContextDebug.HeapDebug ++;
+00362                 //context.ContextDebug->HeapDebug[context.ContextDebug->HeapDebug]
+00363                 return NLAIAGENT::processIdle;
+00364         }
+00365 
+00366         void CLocAllocDebug::getDebugResult(std::string &str,CCodeContext &context) const
+00367         {                                       
+00368                 str += NLAIC::stringGetBuild("Reservation d'un espace memoir locale pour une variable à l'emplacement %d",(sint32)context.Heap);                                
+00369         }
+00370 
+00371         const NLAIC::IBasicType *CLocAllocDebug::clone() const
+00372         {
+00373                 NLAIC::IBasicType *x = new CLocAllocDebug();
+00374                 return x;            
+00375         }
+00376         const NLAIC::IBasicType *CLocAllocDebug::newInstance() const 
+00377         {
+00378                 return clone();
+00379         }
+00380 
+00381         const NLAIC::CIdentType &CLocAllocDebug::getType() const
+00382         {
+00383                 return IdLocAllocDebug;
+00384         }               
+00385 
+00386         void CLocAllocDebug::save(NLMISC::IStream &os)
+00387         {       
+00388 
+00389         }
+00390 
+00391         void CLocAllocDebug::load(NLMISC::IStream &is) 
+00392         {                               
+00393         }
+00394 
+00395         //*************************************
+00396         // CAffOpCodeDebug
+00397         //*************************************
+00398 
+00399         CAffOpCodeDebug::CAffOpCodeDebug(int i, const char* varName):
+00400           _I(i),
+00401           _VarName(NULL)
+00402         {
+00403                 _VarName = new char[strlen(varName)+1];
+00404                 strcpy(_VarName, varName);
+00405         }
+00406         
+00407         CAffOpCodeDebug::~CAffOpCodeDebug()
+00408         {
+00409                 delete[] _VarName;
+00410         }
+00411         
+00412 
+00413         NLAIAGENT::TProcessStatement CAffHeapMemberiOpCode::runOpCode(CCodeContext &context)
+00414         {       
+00415                 
+00416                 NLAIAGENT::IObjectIA *a = ((NLAIAGENT::IObjectIA *)context.Heap[(int)_N]);                      
+00417                 std::list<sint32>::iterator i = _I.begin();
+00418                 sint32 n = _I.size() - 1;
+00419                 while(n --)
+00420                 {
+00421                         a = (NLAIAGENT::IObjectIA *)a->getStaticMember(*i++);
+00422                 }               
+00423                 NLAIAGENT::IObjectIA *obj = ((NLAIAGENT::IObjectIA *)context.Stack);
+00424                 
+00425                 if(!a->setStaticMember(*i,obj))
+00426                                                                         obj->incRef();
+00427                 context.Stack --;                       
+00428                 return NLAIAGENT::processIdle;
+00429         }
+00430 
+00431         void CAffHeapMemberiOpCode::getDebugResult(std::string &str,CCodeContext &context) const
+00432         {       
+00433                 std::string txt;
+00434                 std::string txtClass;
+00435                 ((NLAIAGENT::IObjectIA *)context.Stack)->getDebugString(txt);
+00436                 ((NLAIAGENT::IObjectIA *)context.Heap[(int)_N])->getDebugString(txtClass);
+00437                 std::list<sint32>::const_iterator i = _I.begin();
+00438                 sint32 n = _I.size();
+00439                 str += NLAIC::stringGetBuild("Affecte le membre sur le heap : %s ",txtClass.c_str());
+00440                 while(n --)
+00441                 {
+00442                         str += NLAIC::stringGetBuild("%d",*i++);
+00443                         if(n) str += "->";
+00444                 }               
+00445                 str += " a la valeur: ";
+00446                 str += txt;
+00447         }
+00448 
+00449         NLAIAGENT::TProcessStatement CAffOpCodeDebug::runOpCode(CCodeContext &context)
+00450         {       
+00451                 /*NLAIAGENT::iObjectIA *i = (NLAIAGENT::iObjectIA *)NLAIC::getRegistry()->createInstance(_b);
+00452                 context.Heap[(sint32)context.Heap] = i;
+00453                 context.Heap ++;*/
+00454 
+00455                 NLAIAGENT::IObjectIA *i = (NLAIAGENT::IObjectIA *)context.Stack;
+00456                 NLAIAGENT::CStringVarName vn(_VarName);
+00457                 NLAIAGENT::IObjectIA *iD = (NLAIAGENT::IObjectIA *) new NLAIAGENT::CStringType(vn);
+00458                 i->incRef();            
+00459                 NLAIAGENT::IObjectIA *tmp = context.Heap[(int)_I];
+00460                 NLAIAGENT::IObjectIA *tmpD = context.ContextDebug.HeapDebug[(int)_I];
+00461                 context.Heap[_I] = i;
+00462                 context.ContextDebug.HeapDebug[_I] = iD;
+00463                 if(tmp) tmp->release();
+00464                 if(tmpD) tmpD->release();
+00465                 //context.Heap ++;
+00466                 context.Stack --;
+00467                 return NLAIAGENT::processIdle;
+00468         }
+00469 
+00470         void CAffOpCodeDebug::getDebugResult(std::string &str,CCodeContext &context) const
+00471         {
+00472                 std::string Y;
+00473                 context.Stack[(int)context.Stack]->getDebugString(Y);
+00474                 str += NLAIC::stringGetBuild("Affectation<%d> a %s",_I,Y.c_str());
+00475         }
+00476 
+00477         const NLAIC::IBasicType *CAffOpCodeDebug::clone() const
+00478         {
+00479                 NLAIC::IBasicType *x = new CAffOpCodeDebug(_I, _VarName);
+00480                 return x;            
+00481         }
+00482         const NLAIC::IBasicType *CAffOpCodeDebug::newInstance() const 
+00483         {
+00484                 return clone();
+00485         }
+00486 
+00487         const NLAIC::CIdentType &CAffOpCodeDebug::getType() const
+00488         {
+00489                 return IdAffOpCodeDebug;
+00490         }
+00491 
+00492         void CAffOpCodeDebug::getDebugString(char *) const{ }
+00493 
+00494         void CAffOpCodeDebug::save(NLMISC::IStream &os)
+00495         {
+00496                 sint32 i = (sint32) _I;
+00497                 os.serial( i );
+00498                 std::string s(_VarName);
+00499                 os.serial(s);           
+00500         }
+00501 
+00502         void CAffOpCodeDebug::load(NLMISC::IStream &is) 
+00503         {               
+00504                 sint32 i;
+00505                 is.serial(i);
+00506                 _I = i;
+00507                 std::string varname;
+00508                 is.serial( varname );
+00509                 delete _VarName;
+00510                 _VarName = new char[varname.length()+1];
+00511                 strcpy(_VarName, varname.c_str());
+00512         }
+00513 
+00514         //*************************************
+00515         // CFreeAllocDebug
+00516         //*************************************
+00517 
+00518         CFreeAllocDebug::CFreeAllocDebug()
+00519         {
+00520         }
+00521         
+00522         CFreeAllocDebug::~CFreeAllocDebug()
+00523         {
+00524         }
+00525         
+00526         NLAIAGENT::TProcessStatement CFreeAllocDebug::runOpCode(CCodeContext &context)
+00527         {                               
+00528                 sint32 i = (sint32)context.Heap;        
+00529                 i -= context.Heap.popMark();
+00530                 context.Heap -= i;
+00531 
+00532                 sint32 j = (sint32)context.ContextDebug.HeapDebug;      
+00533 //              j -= context.ContextDebug.HeapDebug.popMark();
+00534                 context.ContextDebug.HeapDebug -= j;
+00535 
+00536                 return NLAIAGENT::processIdle;
+00537         }
+00538         void CFreeAllocDebug::getDebugResult(std::string &str,CCodeContext &context) const
+00539         {               
+00540                 str += NLAIC::stringGetBuild("libere le bloc de memoire de %d à %d",(sint32)context.Heap.mark(),(sint32)context.Heap);  
+00541         }
+00542 
+00543         const NLAIC::IBasicType *CFreeAllocDebug::clone() const
+00544         {
+00545                 NLAIC::IBasicType *x = new CFreeAllocDebug();
+00546                 return x;            
+00547         }
+00548         const NLAIC::IBasicType *CFreeAllocDebug::newInstance() const 
+00549         {
+00550                 return clone();
+00551         }
+00552 
+00553         const NLAIC::CIdentType &CFreeAllocDebug::getType() const
+00554         {
+00555                 return IdFreeAllocDebug;
+00556         }
+00557 
+00558         
+00559         
+00560         void CFreeAllocDebug::save(NLMISC::IStream &os)
+00561         {               
+00562         }
+00563 
+00564         void CFreeAllocDebug::load(NLMISC::IStream &is) 
+00565         {                               
+00566         }
+00567 
+00568         //*************************************
+00569         // CMarkMsg
+00570         //*************************************
+00571         NLAIAGENT::TProcessStatement CMarkMsg::runOpCode(CCodeContext &context)
+00572         {
+00573                 NLAIAGENT::IBaseGroupType *param = (NLAIAGENT::IBaseGroupType *)context.Stack[(int)context.Stack];
+00574                 NLAIAGENT::IMessageBase *msg = (NLAIAGENT::IMessageBase *)param->get();
+00575                 msg->setMethodIndex(_Heritance,_I);
+00576                 return NLAIAGENT::processIdle;
+00577         }
+00578 
+00579         //*************************************
+00580         // CFindRunMsg
+00581         //*************************************
+00582 
+00583         CFindRunMsg::CFindRunMsg(NLAIAGENT::IBaseGroupType *methodName,CParam *param,IOpType *baseClass,ILoadObject *objectLoad)
+00584         {
+00585                 _Param = param;
+00586                 _MethodName = methodName;
+00587                 _BaseClass = baseClass;         
+00588                 _ObjectLoad = objectLoad;
+00589         }
+00590 
+00591         CFindRunMsg::CFindRunMsg(const NLAIAGENT::IBaseGroupType &methodName,const CParam &param,const IOpType &baseClass,const ILoadObject &objectLoad)
+00592         {
+00593                 _Param = (CParam *)param.clone();
+00594                 _MethodName = (NLAIAGENT::IBaseGroupType *)methodName.clone();
+00595                 _BaseClass = (IOpType *)baseClass.clone();
+00596                 _ObjectLoad = (ILoadObject *)objectLoad.clone();
+00597         }
+00598 
+00599         CFindRunMsg::~CFindRunMsg()
+00600         {
+00601                 _Param->release();
+00602                 _MethodName->release();
+00603                 _BaseClass->release();
+00604                 _ObjectLoad->release();
+00605         }
+00606 
+00607         NLAIAGENT::TProcessStatement CFindRunMsg::runOpCode(CCodeContext &context)
+00608         {
+00609                 const NLAIAGENT::IObjectIA *o = _ObjectLoad->getObject(context);
+00610                 NLAIAGENT::IBaseGroupType *param = (NLAIAGENT::IBaseGroupType *)_ObjectLoad->getParam(context);
+00611                 NLAIAGENT::CIteratorContener it = param->getIterator();
+00612                 it ++;
+00613                 NLAIAGENT::IMessageBase *msg = (NLAIAGENT::IMessageBase *)it++;
+00614 
+00615                 const NLAIAGENT::CStringType *name = (const NLAIAGENT::CStringType *)_MethodName->get();
+00616 
+00617                 NLAIAGENT::tQueue a = o->isMember(NULL,&name->getStr(),*_Param);
+00618                 
+00619                 if(a.size())
+00620                 {                       
+00621                         NLAIAGENT::CIdMethod m = a.top();                               
+00622                         msg->setMethodIndex(0,m.Index);                 
+00623                 }
+00624 
+00625                 return NLAIAGENT::processIdle;
+00626         }
+00627 
+00628         void CFindRunMsg::getDebugResult(std::string &str,CCodeContext &context) const
+00629         {
+00630                 std::string m;
+00631                 std::string p;
+00632                 _MethodName->getDebugString(m);
+00633                 _Param->getDebugString(p);
+00634                 str += NLAIC::stringGetBuild("find '%s%s' for %s",m.c_str() ,p.c_str(), (const char *)context.Self->getType());
+00635         }
+00636 
+00637         const NLAIC::IBasicType *CFindRunMsg::clone() const
+00638         {
+00639                 _Param->incRef();
+00640                 _MethodName->incRef();
+00641                 _BaseClass->incRef();
+00642                 _ObjectLoad->incRef();
+00643                 NLAIC::IBasicType *clone = new CFindRunMsg(_MethodName,_Param,_BaseClass,_ObjectLoad);
+00644                 return clone;
+00645         }
+00646 
+00647         void CFindRunMsg::save(NLMISC::IStream &os)
+00648         {       
+00649                 os.serial( (NLAIC::CIdentType &) _ObjectLoad->getType() );
+00650                 _ObjectLoad->save(os);
+00651                 _BaseClass->serial(os);
+00652                 os.serial( (NLAIC::CIdentType &) _Param->getType() );
+00653                 _Param->save(os);
+00654                 os.serial( (NLAIC::CIdentType &) _MethodName->getType() );
+00655                 _MethodName->save(os);
+00656         }
+00657 
+00658         void CFindRunMsg::load(NLMISC::IStream &is) 
+00659         {
+00660                 NLAIC::CIdentTypeAlloc id;
+00661                 is.serial( id );
+00662                 _ObjectLoad->release();
+00663                 _ObjectLoad = (ILoadObject *)id.allocClass();
+00664                 _ObjectLoad->load(is);
+00665 
+00666                 _BaseClass->release();
+00667                 _BaseClass = (IOpType *)IOpType::loadIOpType(is);
+00668                 _Param->release();
+00669                 _MethodName->release();         
+00670                 is.serial( id );
+00671                 _Param = (CParam *)id.allocClass();
+00672                 _Param->load(is);
+00673                 is.serial( id );
+00674                 _MethodName = (NLAIAGENT::IBaseGroupType *)id.allocClass();
+00675                 _MethodName->load(is);
+00676         }               
+00677 
+00678         //*************************************
+00679         // CMsgSetSender
+00680         //*************************************
+00681 
+00682         NLAIAGENT::TProcessStatement CMsgSetSender::runOpCode(CCodeContext &context)
+00683         {               
+00684                 NLAIAGENT::IBaseGroupType *a = (NLAIAGENT::IBaseGroupType *)context.Stack[(int)context.Stack];
+00685                 NLAIAGENT::CIteratorContener i = a->getIterator();
+00686                 i++;
+00687                 if(a->size() == 3) i++;
+00688                 NLAIAGENT::IMessageBase *msg = (NLAIAGENT::IMessageBase *)i ++;
+00689                 //((NLAIAGENT::IObjectIA *)context.Self)->incRef();
+00690                 if(!msg->getProtcetSender()) msg->setSender((NLAIAGENT::IObjectIA *)context.Self);
+00691                 else msg->UnsetProtcetSender();
+00692 
+00693                 
+00694                 return NLAIAGENT::processIdle;
+00695         }
+00696 
+00697         void CMsgSetSender::save(NLMISC::IStream &os)
+00698         {
+00699         }
+00700 
+00701         void CMsgSetSender::load(NLMISC::IStream &is)
+00702         {
+00703         }
+00704 
+00705         void CMsgSetSender::getDebugResult(std::string &str,CCodeContext &context) const
+00706         {               
+00707                 str += "MsgSetSender";
+00708         }
+00709 
+00710         //*************************************
+00711         // CAddParamNameDebug
+00712         //*************************************
+00713 
+00714         CAddParamNameDebug::CAddParamNameDebug(const NLAIAGENT::IBaseGroupType &debugAttrib)
+00715         {
+00716                 _DebugAttrib = (NLAIAGENT::IBaseGroupType *)debugAttrib.clone();
+00717         }
+00718         
+00719         CAddParamNameDebug::~CAddParamNameDebug()
+00720         {
+00721                 _DebugAttrib->release();
+00722         }
+00723         
+00724         NLAIAGENT::TProcessStatement CAddParamNameDebug::runOpCode(CCodeContext &context)
+00725         {
+00726                 context.ContextDebug.Param.push_back(_DebugAttrib);
+00727                 _DebugAttrib->incRef();
+00728                 return NLAIAGENT::processIdle;
+00729         }
+00730         
+00731         void CAddParamNameDebug::getDebugResult(std::string &str,CCodeContext &context) const
+00732         {               
+00733                 str = "Build a name liste that match the actual function parameters values.";
+00734         }
+00735 
+00736         const NLAIC::IBasicType *CAddParamNameDebug::clone() const
+00737         {
+00738                 NLAIC::IBasicType *x = new CAddParamNameDebug(*_DebugAttrib);
+00739                 return x;            
+00740         }
+00741         
+00742         const NLAIC::IBasicType *CAddParamNameDebug::newInstance() const 
+00743         {
+00744                 return clone();
+00745         }
+00746 
+00747         const NLAIC::CIdentType &CAddParamNameDebug::getType() const
+00748         {
+00749                 return IdAddParamNameDebug;
+00750         }
+00751         
+00752         void CAddParamNameDebug::save(NLMISC::IStream &os)
+00753         {               
+00754                 os.serial( (NLAIC::CIdentType &) _DebugAttrib->getType() );
+00755                 _DebugAttrib->save(os);
+00756         }
+00757 
+00758         void CAddParamNameDebug::load(NLMISC::IStream &is) 
+00759         {                               
+00760                 _DebugAttrib->release();
+00761                 NLAIC::CIdentTypeAlloc id;
+00762                 is.serial( id );
+00763                 _DebugAttrib =  (NLAIAGENT::IBaseGroupType *)id.allocClass();
+00764                 _DebugAttrib->load(is);
+00765         }       
+00766 }
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1