Index: trunk/src/lib/shell/shell_command.cc
===================================================================
--- trunk/src/lib/shell/shell_command.cc	(revision 5656)
+++ trunk/src/lib/shell/shell_command.cc	(revision 5779)
@@ -47,5 +47,5 @@
   this->shellClass = ShellCommandClass::getCommandClass(className); //ClassList::IDToString(classID);
   if (this->shellClass != NULL)
-    this->shellClass->commandList->add(this);
+    this->shellClass->commandList.push_back(this);
 }
 
@@ -82,5 +82,6 @@
 void ShellCommand::unregisterCommand(const char* commandName, const char* className)
 {
-  if (ShellCommandClass::commandClassList == NULL)
+  /// FIXME
+/*  if (ShellCommandClass::commandClassList == NULL)
     ShellCommandClass::initCommandClassList();
 
@@ -89,24 +90,21 @@
  if (checkClass != NULL)
   {
-    tIterator<ShellCommand>* iterator = checkClass->commandList->getIterator();
-    ShellCommand* elem = iterator->firstElement();
-    while(elem != NULL)
-    {
-      if (!strcmp(commandName, elem->getName()))
-      {
-        checkClass->commandList->remove(elem);
-        delete elem;
+    std::list<ShellCommand*>::iterator elem;
+    for (elem = checkClass->commandList.begin(); elem != checkClass->commandList.end(); elem++)
+    {
+      if (!strcmp(commandName, (*elem)->getName()))
+      {
+        delete (*elem);
+        checkClass->commandList.remove(*elem);
         break;
       }
-      elem = iterator->nextElement();
-    }
-    delete iterator;
-
-    if (checkClass->commandList->getSize() == 0)
+    }
+
+    if (checkClass->commandList->size() == 0)
     {
       ShellCommandClass::commandClassList->remove(checkClass);
       delete checkClass;
     }
-  }
+  }*/
 }
 
@@ -132,17 +130,13 @@
   if (checkClass != NULL)
   {
-    tIterator<ShellCommand>* iterator = checkClass->commandList->getIterator();
-    ShellCommand* elem = iterator->firstElement();
-    while(elem != NULL)
-   {
-     if (!strcmp(commandName, elem->getName()))
-     {
-       PRINTF(2)("Command already registered\n");
-       delete iterator;
-       return true;
-      }
-     elem = iterator->nextElement();
-   }
-   delete iterator;
+    std::list<ShellCommand*>::const_iterator elem;
+    for (elem = checkClass->commandList.begin(); elem != checkClass->commandList.end(); elem++)
+    {
+      if (!strcmp(commandName, (*elem)->getName()))
+      {
+        PRINTF(2)("Command '%s::%s' already registered\n", className, commandName);
+        return true;
+      }
+    }
    return false;
   }
@@ -163,11 +157,11 @@
     return false;
 
-  long classID = CL_NULL;                 //< the classID retrieved from the Class.
-  ShellCommandClass* commandClass = NULL; //< the command class this command applies to.
-  tList<BaseObject>* objectList = NULL;   //< the list of Objects stored in classID
-  BaseObject* objectPointer = NULL;       //< a pointer to th Object to Execute the command on
-  bool emptyComplete = false;             //< if the completion input is empty string. e.g ""
-  unsigned int fktPos = 1;                //< the position of the function (needed for finding it)
-//  long completeType = SHELLC_NONE;      //< the Type we'd like to complete.
+  long classID = CL_NULL;                      //< the classID retrieved from the Class.
+  ShellCommandClass* commandClass = NULL;      //< the command class this command applies to.
+  std::list<BaseObject*>* objectList = NULL;   //< the list of Objects stored in classID
+  BaseObject* objectPointer = NULL;            //< a pointer to th Object to Execute the command on
+  bool emptyComplete = false;                  //< if the completion input is empty string. e.g ""
+  unsigned int fktPos = 1;                     //< the position of the function (needed for finding it)
+//  long completeType = SHELLC_NONE;           //< the Type we'd like to complete.
   SubString inputSplits(executionString, " \t\n,");
 
@@ -179,94 +173,76 @@
     if (ShellCommandClass::aliasList != NULL)
     {
-      tIterator<ShellCommandAlias>* itAL = ShellCommandClass::aliasList->getIterator();
-      ShellCommandAlias* elemAL = itAL->firstElement();
-      while(elemAL != NULL)
-      {
-        if (elemAL->getName() != NULL && !strcmp(elemAL->getName(), inputSplits.getString(0)) && elemAL->getCommand() != NULL &&
-            elemAL->getCommand()->shellClass != NULL )
+      list<ShellCommandAlias*>::iterator alias;
+      for (alias = ShellCommandClass::aliasList->begin(); alias != ShellCommandClass::aliasList->end(); alias++ )
+      {
+        if ((*alias)->getName() != NULL && !strcmp((*alias)->getName(), inputSplits.getString(0)) && (*alias)->getCommand() != NULL &&
+            (*alias)->getCommand()->shellClass != NULL )
         {
-          objectList = ClassList::getList(elemAL->getCommand()->shellClass->getName());
+          objectList = ClassList::getList((*alias)->getCommand()->shellClass->getName());
           if (objectList != NULL)
           {
             if (inputSplits.getCount() > 1)
-              elemAL->getCommand()->executor->execute(objectList->firstElement(), executionString+inputSplits.getOffset(1));
+              (*alias)->getCommand()->executor->execute(objectList->front(), executionString+inputSplits.getOffset(1));
             else
-              elemAL->getCommand()->executor->execute(objectList->firstElement(), "");
-            delete itAL;
+              (*alias)->getCommand()->executor->execute(objectList->front(), "");
+           return true;
+          }
+        }
+      }
+    }
+    // looking for a Matching Class
+    if (likely(ShellCommandClass::commandClassList != NULL))
+    {
+      list<ShellCommandClass*>::iterator commandClassIT;
+      for (commandClassIT = ShellCommandClass::commandClassList->begin(); commandClassIT != ShellCommandClass::commandClassList->end(); commandClassIT++)
+      {
+        if ((*commandClassIT)->getName() && !strcasecmp(inputSplits.getString(0), (*commandClassIT)->getName()))
+        {
+          //elemCL->getName();
+          classID = ClassList::StringToID((*commandClassIT)->getName());
+          commandClass = (*commandClassIT);
+          objectList = ClassList::getList(classID);
+          break;
+        }
+      }
+    }
+
+    if (commandClass != NULL && inputSplits.getCount() >= 2)
+    {
+      if (objectList != NULL)
+      {
+        // Checking for a Match in the Objects of classID (else take the first)
+        list<BaseObject*>::const_iterator object;
+        for (object = objectList->begin(); object != objectList->end(); object++)
+        {
+          if ((*object)->getName() != NULL && !strcasecmp((*object)->getName(), inputSplits.getString(1)))
+          {
+            objectPointer = (*object);
+            fktPos = 2;
+            break;
+          }
+         }
+
+      //
+        if (objectPointer == NULL)
+          objectPointer = objectList->front();
+      }
+      // match a function.
+      if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.getCount() >= 3)))
+      {
+        list<ShellCommand*>::iterator cmdIT;
+        for (cmdIT = commandClass->commandList.begin(); cmdIT != commandClass->commandList.end(); cmdIT++)
+        {
+          if (!strcmp((*cmdIT)->getName(), inputSplits.getString(fktPos)))
+          {
+            if (objectPointer == NULL && (*cmdIT)->executor->getType() & Executor_Objective)
+              return false;
+            if (inputSplits.getCount() > fktPos+1)
+              (*cmdIT)->executor->execute(objectPointer, executionString+inputSplits.getOffset(fktPos +1));
+            else
+              (*cmdIT)->executor->execute(objectPointer, "");
             return true;
           }
         }
-        elemAL = itAL->nextElement();
-      }
-      delete itAL;
-    }
-    // looking for a Matching Class
-    if (likely(ShellCommandClass::commandClassList != NULL))
-    {
-      tIterator<ShellCommandClass>* itCL = ShellCommandClass::commandClassList->getIterator();
-      ShellCommandClass* elemCL = itCL->firstElement();
-      while(elemCL != NULL)
-      {
-        if (elemCL->getName() && !strcasecmp(inputSplits.getString(0), elemCL->getName()))
-        {
-          //elemCL->getName();
-          classID = ClassList::StringToID(elemCL->getName());
-          commandClass = elemCL;
-          objectList = ClassList::getList(classID);
-          break;
-        }
-        elemCL = itCL->nextElement();
-      }
-      delete itCL;
-    }
-
-    if (commandClass != NULL && inputSplits.getCount() >= 2)
-    {
-      if (objectList != NULL)
-      {
-        // Checking for a Match in the Objects of classID (else take the first)
-        tIterator<BaseObject>* itBO = objectList->getIterator();
-        BaseObject* enumBO = itBO->firstElement();
-        while(enumBO)
-        {
-          if (enumBO->getName() != NULL && !strcasecmp(enumBO->getName(), inputSplits.getString(1)))
-          {
-            objectPointer = enumBO;
-            fktPos = 2;
-            break;
-          }
-          enumBO = itBO->nextElement();
-         }
-         delete itBO;
-
-      //
-        if (objectPointer == NULL)
-          objectPointer = objectList->firstElement();
-      }
-      // match a function.
-      if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.getCount() >= 3)))
-      {
-        tIterator<ShellCommand>* itCMD = commandClass->commandList->getIterator();
-        ShellCommand* enumCMD = itCMD->firstElement();
-        while (enumCMD != NULL)
-        {
-          if (!strcmp(enumCMD->getName(), inputSplits.getString(fktPos)))
-          {
-            if (objectPointer == NULL && enumCMD->executor->getType() & Executor_Objective)
-            {
-              delete itCMD;
-              return false;
-            }
-            if (inputSplits.getCount() > fktPos+1)
-              enumCMD->executor->execute(objectPointer, executionString+inputSplits.getOffset(fktPos +1));
-            else
-              enumCMD->executor->execute(objectPointer, "");
-            delete itCMD;
-            return true;
-          }
-
-          enumCMD = itCMD->nextElement();
-        }
-        delete itCMD;
       }
     }
@@ -306,8 +282,8 @@
   {
     if (ShellCommandClass::aliasList == NULL)
-      ShellCommandClass::aliasList = new tList<ShellCommandAlias>;
+      ShellCommandClass::aliasList = new std::list<ShellCommandAlias*>;
 
     ShellCommandAlias* aliasCMD = new ShellCommandAlias(alias, this);
-    ShellCommandClass::aliasList->add(aliasCMD);
+    ShellCommandClass::aliasList->push_back(aliasCMD);
     this->alias = aliasCMD;
   }
@@ -348,27 +324,22 @@
   }
 
-  tIterator<ShellCommandClass>* iteratorCL = ShellCommandClass::commandClassList->getIterator();
-  ShellCommandClass* elemCL = iteratorCL->firstElement();
-  while(elemCL != NULL)
-  {
-    PRINT(0)("Class:'%s' registered %d commands: \n", elemCL->className, elemCL->commandList->getSize());
-    tIterator<ShellCommand>* iterator = elemCL->commandList->getIterator();
-    const ShellCommand* elem = iterator->firstElement();
-    while(elem != NULL)
-    {
-      PRINT(0)("  command:'%s' : params:%d: ", elem->getName(), elem->executor->getParamCount());
+  list<ShellCommandClass*>::iterator classIT;
+  for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
+  {
+    PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className, (*classIT)->commandList.size());
+
+    list<ShellCommand*>::iterator cmdIT;
+    for (cmdIT = (*classIT)->commandList.begin(); cmdIT != (*classIT)->commandList.end(); cmdIT++)
+    {
+      PRINT(0)("  command:'%s' : params:%d: ", (*cmdIT)->getName(), (*cmdIT)->executor->getParamCount());
       /// FIXME
       /*      for (unsigned int i = 0; i< elem->paramCount; i++)
        printf("%s ", ShellCommand::paramToString(elem->parameters[i]));*/
-      if (elem->description != NULL)
-       printf("- %s", elem->description);
+      if ((*cmdIT)->description != NULL)
+       printf("- %s", (*cmdIT)->description);
       printf("\n");
 
-      elem = iterator->nextElement();
-    }
-    delete iterator;
-    elemCL = iteratorCL->nextElement();
-  }
-  delete iteratorCL;
+    }
+  }
 }
 
