Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5100 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Aug 22, 2005, 12:42:28 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: testing some AutoCompletion in the Shell.

Location:
trunk/src
Files:
22 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/Makefile.am

    r5075 r5100  
    151151                 lib/util/ini_parser.h \
    152152                 lib/util/substring.h \
     153                 lib/util/array.h \
    153154                 lib/util/list.h \
    154155                 lib/util/color.h \
  • trunk/src/Makefile.in

    r5075 r5100  
    409409                 lib/util/ini_parser.h \
    410410                 lib/util/substring.h \
     411                 lib/util/array.h \
    411412                 lib/util/list.h \
    412413                 lib/util/color.h \
     
    440441          esac; \
    441442        done; \
    442         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
     443        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
    443444        cd $(top_srcdir) && \
    444           $(AUTOMAKE) --foreign  src/Makefile
     445          $(AUTOMAKE) --gnu  src/Makefile
    445446.PRECIOUS: Makefile
    446447Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/Makefile.in

    r4826 r5100  
    189189          esac; \
    190190        done; \
    191         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/Makefile'; \
     191        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/Makefile'; \
    192192        cd $(top_srcdir) && \
    193           $(AUTOMAKE) --foreign  src/lib/Makefile
     193          $(AUTOMAKE) --gnu  src/lib/Makefile
    194194.PRECIOUS: Makefile
    195195Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/collision_detection/Makefile.in

    r4826 r5100  
    224224          esac; \
    225225        done; \
    226         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/collision_detection/Makefile'; \
     226        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/collision_detection/Makefile'; \
    227227        cd $(top_srcdir) && \
    228           $(AUTOMAKE) --foreign  src/lib/collision_detection/Makefile
     228          $(AUTOMAKE) --gnu  src/lib/collision_detection/Makefile
    229229.PRECIOUS: Makefile
    230230Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/event/Makefile.in

    r4826 r5100  
    212212          esac; \
    213213        done; \
    214         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/event/Makefile'; \
     214        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/event/Makefile'; \
    215215        cd $(top_srcdir) && \
    216           $(AUTOMAKE) --foreign  src/lib/event/Makefile
     216          $(AUTOMAKE) --gnu  src/lib/event/Makefile
    217217.PRECIOUS: Makefile
    218218Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/graphics/Makefile.in

    r4826 r5100  
    179179          esac; \
    180180        done; \
    181         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/Makefile'; \
     181        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/Makefile'; \
    182182        cd $(top_srcdir) && \
    183           $(AUTOMAKE) --foreign  src/lib/graphics/Makefile
     183          $(AUTOMAKE) --gnu  src/lib/graphics/Makefile
    184184.PRECIOUS: Makefile
    185185Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/graphics/importer/Makefile.am

    r4579 r5100  
    2020                 material.h \
    2121                 texture.h \
    22                  array.h \
    2322                 anorms.h \
    2423                 anormtab.h
  • trunk/src/lib/graphics/importer/Makefile.in

    r4826 r5100  
    201201                 material.h \
    202202                 texture.h \
    203                  array.h \
    204203                 anorms.h \
    205204                 anormtab.h
     
    218217          esac; \
    219218        done; \
    220         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile'; \
     219        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile'; \
    221220        cd $(top_srcdir) && \
    222           $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile
     221          $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile
    223222.PRECIOUS: Makefile
    224223Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/graphics/spatial_separation/Makefile.in

    r4826 r5100  
    205205          esac; \
    206206        done; \
    207         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/spatial_separation/Makefile'; \
     207        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/spatial_separation/Makefile'; \
    208208        cd $(top_srcdir) && \
    209           $(AUTOMAKE) --foreign  src/lib/graphics/spatial_separation/Makefile
     209          $(AUTOMAKE) --gnu  src/lib/graphics/spatial_separation/Makefile
    210210.PRECIOUS: Makefile
    211211Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/gui/Makefile.in

    r4826 r5100  
    241241          esac; \
    242242        done; \
    243         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/Makefile'; \
     243        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/Makefile'; \
    244244        cd $(top_srcdir) && \
    245           $(AUTOMAKE) --foreign  src/lib/gui/Makefile
     245          $(AUTOMAKE) --gnu  src/lib/gui/Makefile
    246246.PRECIOUS: Makefile
    247247Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/particles/Makefile.in

    r4826 r5100  
    209209          esac; \
    210210        done; \
    211         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/particles/Makefile'; \
     211        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/particles/Makefile'; \
    212212        cd $(top_srcdir) && \
    213           $(AUTOMAKE) --foreign  src/lib/particles/Makefile
     213          $(AUTOMAKE) --gnu  src/lib/particles/Makefile
    214214.PRECIOUS: Makefile
    215215Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/physics/Makefile.in

    r4826 r5100  
    218218          esac; \
    219219        done; \
    220         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/physics/Makefile'; \
     220        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/physics/Makefile'; \
    221221        cd $(top_srcdir) && \
    222           $(AUTOMAKE) --foreign  src/lib/physics/Makefile
     222          $(AUTOMAKE) --gnu  src/lib/physics/Makefile
    223223.PRECIOUS: Makefile
    224224Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/sound/Makefile.in

    r4826 r5100  
    201201          esac; \
    202202        done; \
    203         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/sound/Makefile'; \
     203        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/sound/Makefile'; \
    204204        cd $(top_srcdir) && \
    205           $(AUTOMAKE) --foreign  src/lib/sound/Makefile
     205          $(AUTOMAKE) --gnu  src/lib/sound/Makefile
    206206.PRECIOUS: Makefile
    207207Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/tinyxml/Makefile.in

    r4826 r5100  
    204204          esac; \
    205205        done; \
    206         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/tinyxml/Makefile'; \
     206        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/tinyxml/Makefile'; \
    207207        cd $(top_srcdir) && \
    208           $(AUTOMAKE) --foreign  src/lib/tinyxml/Makefile
     208          $(AUTOMAKE) --gnu  src/lib/tinyxml/Makefile
    209209.PRECIOUS: Makefile
    210210Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/lib/util/array.h

    r5097 r5100  
    1616/*!
    1717  \file array.h
    18   \brief Contains the Array Class that handles float arrays.
     18  \brief Contains the Array Class that handles arrays of classes.
    1919  this class creates a Array of a semi-Dynamic length.
    2020  beware, that after finalizing the array may not be resized again.
     
    2525#include "debug.h"
    2626
    27 //! Array Class that handles dynamic-float arrays.
     27//! Array Class that handles dynamic-type arrays.
    2828template<class T> class Array
    2929{
     
    3838    /** @returns The array */
    3939    inline const T* getArray () const { return this->array; };
     40    inline const T getEntry(unsigned int number) const;
    4041    /** * @returns The Count of entries in the Array*/
    4142    inline unsigned int getCount()const { return this->entryCount; };
     
    6667Array<T>::Array ()
    6768{
    68   PRINTF(4)("crating new Array\n");
     69  PRINTF(5)("crating new Array\n");
    6970  this->firstEntry = new Entry;
    7071  this->firstEntry->next =NULL;
     
    7273  this->finalized = false;
    7374  this->entryCount = 0; //0 means one entry
     75}
     76
     77template<class T>
     78    const T Array<T>::getEntry(unsigned int number) const
     79{
     80  if (this->finalized && number < this->entryCount)
     81    return this->array[number];
    7482}
    7583
     
    8189Array<T>::~Array()
    8290{
    83   PRINTF(4)("deleting array\n");
     91  PRINTF(5)("deleting array\n");
    8492  Entry* walker = this->firstEntry;
    8593  Entry* previous;
     
    9199  }
    92100  if (finalized)
    93     delete []this->array;
     101    delete[] this->array;
    94102}
    95103
     
    101109void Array<T>::finalizeArray ()
    102110{
    103   PRINTF(4)("Finalizing array. Length: %i\n", entryCount);
    104   //  if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL)
    105   if (!(this->array = new GLfloat [this->entryCount]))
    106     PRINTF(0)("could not allocate %i data Blocks\n", this->entryCount);
     111  PRINTF(5)("Finalizing array. Length: %i\n", entryCount);
     112  if (!(this->array = new T [this->entryCount]))
     113    PRINTF(1)("could not allocate %i data Blocks\n", this->entryCount);
    107114  Entry* walker = this->firstEntry;
    108115  for (int i=0; i<this->entryCount; i++)
  • trunk/src/subprojects/Makefile.in

    r4909 r5100  
    186186          esac; \
    187187        done; \
    188         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/Makefile'; \
     188        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/Makefile'; \
    189189        cd $(top_srcdir) && \
    190           $(AUTOMAKE) --foreign  src/subprojects/Makefile
     190          $(AUTOMAKE) --gnu  src/subprojects/Makefile
    191191.PRECIOUS: Makefile
    192192Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/subprojects/collision_detection/Makefile.in

    r5030 r5100  
    281281          esac; \
    282282        done; \
    283         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/collision_detection/Makefile'; \
     283        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/collision_detection/Makefile'; \
    284284        cd $(top_srcdir) && \
    285           $(AUTOMAKE) --foreign  src/subprojects/collision_detection/Makefile
     285          $(AUTOMAKE) --gnu  src/subprojects/collision_detection/Makefile
    286286.PRECIOUS: Makefile
    287287Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/subprojects/importer/Makefile.in

    r5031 r5100  
    250250          esac; \
    251251        done; \
    252         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/importer/Makefile'; \
     252        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/importer/Makefile'; \
    253253        cd $(top_srcdir) && \
    254           $(AUTOMAKE) --foreign  src/subprojects/importer/Makefile
     254          $(AUTOMAKE) --gnu  src/subprojects/importer/Makefile
    255255.PRECIOUS: Makefile
    256256Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/subprojects/particles/Makefile.in

    r5031 r5100  
    267267          esac; \
    268268        done; \
    269         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/particles/Makefile'; \
     269        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/particles/Makefile'; \
    270270        cd $(top_srcdir) && \
    271           $(AUTOMAKE) --foreign  src/subprojects/particles/Makefile
     271          $(AUTOMAKE) --gnu  src/subprojects/particles/Makefile
    272272.PRECIOUS: Makefile
    273273Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/subprojects/testmain/Makefile.in

    r4826 r5100  
    196196          esac; \
    197197        done; \
    198         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/testmain/Makefile'; \
     198        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/testmain/Makefile'; \
    199199        cd $(top_srcdir) && \
    200           $(AUTOMAKE) --foreign  src/subprojects/testmain/Makefile
     200          $(AUTOMAKE) --gnu  src/subprojects/testmain/Makefile
    201201.PRECIOUS: Makefile
    202202Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • trunk/src/util/loading/load_param.cc

    r5099 r5100  
    1717
    1818#include "list.h"
     19#include "array.h"
    1920#include "base_object.h"
    2021
     
    354355/**
    355356 *  prints out all loadable Classes, and their parameters
     357 * @param fileName prints the output to a File
     358 * @todo implement it
    356359*/
    357360void LoadClassDescription::printAll(const char* fileName)
     
    380383}
    381384
    382 
     385/**
     386 * searches for classes, which beginn with classNameBegin
     387 * @param classNameBegin the beginning string of a Class
     388 * @return a NEW char-array with ClassNames. The ARRAY should be deleted afterwards,
     389 * !! The strings MUST NOT be deleted !!
     390 */
     391Array<char*>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)
     392{
     393  unsigned int searchLength = strlen(classNameBegin);
     394  Array<char*>* retVal = new Array<char*>;
     395
     396  tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
     397  LoadClassDescription* enumClassDesc = iterator->nextElement();
     398  while (enumClassDesc)
     399  {
     400    if (strlen(enumClassDesc->className)>searchLength+1 &&
     401        !strncasecmp(enumClassDesc->className, classNameBegin, searchLength))
     402    {
     403      retVal->addEntry(enumClassDesc->className);
     404    }
     405    enumClassDesc = iterator->nextElement();
     406  }
     407  delete iterator;
     408
     409  retVal->finalizeArray();
     410  return retVal;
     411}
     412
     413// const LoadParamDescription* LoadParamDescription::getClass(const char* className)
     414// {
     415//   tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
     416//   LoadClassDescription* enumClassDesc = iterator->nextElement();
     417//   while (enumClassDesc)
     418//   {
     419//     if (!strcmp(enumClassDesc->className, classNameBegin, className))
     420//     {
     421//       delete iterator;
     422//       return enumClassDesc;
     423//     }
     424//     enumClassDesc = iterator->nextElement();
     425//   }
     426//   delete iterator;
     427//
     428//   return NULL;
     429// }
    383430
    384431/**
  • trunk/src/util/loading/load_param.h

    r5099 r5100  
    3131// Forward Declaration //
    3232template<class T> class tList;
     33template<class T> class Array;
    3334
    3435//! macro that makes it even more easy to load a Parameter
     
    310311  LoadParamDescription* addParam(const char* paramName);
    311312
    312 
    313313  static void printAll(const char* fileName = NULL);
     314  static Array<char*>* searchClassWithShort(const char* classNameBegin);
     315//  static const LoadParamDescription* getClass(const char* className);
    314316
    315317 private:
  • trunk/src/util/shell.cc

    r5099 r5100  
    2020#include "text_engine.h"
    2121#include "list.h"
     22#include "array.h"
    2223#include "graphics_engine.h"
    2324#include "event_handler.h"
    2425
     26#include "load_param.h"
    2527#include "debug.h"
    2628#include <stdarg.h>
     
    439441 * autocompletes the Shell's inputLine
    440442 * @returns true, if a result was found, false otherwise
     443 *
     444 * @todo implement it!!
    441445 */
    442446bool Shell::autoComplete()
    443447{
    444   PRINTF(3)("AutoCompletion not implemented yet\n");
     448  //PRINTF(3)("AutoCompletion not implemented yet\n");
     449
     450  char* completionLine = new char[strlen(inputLine)+1];
     451  strcpy(completionLine, this->inputLine);
     452
     453   char* commandBegin = strrchr(completionLine, ' ');
     454  if (commandBegin == NULL)
     455    commandBegin = completionLine;
     456  else
     457  {
     458    if(commandBegin >= completionLine + strlen(completionLine))
     459      commandBegin = completionLine + strlen(completionLine);
     460    else
     461      commandBegin++;
     462  }
     463
     464  printf("%s\n",commandBegin);
     465   Array<char*>* classArray = LoadClassDescription::searchClassWithShort(commandBegin);
     466   if (classArray->getCount() == 0)
     467   {
     468     delete[] completionLine;
     469     delete classArray;
     470     //PRINTF(0)("no completion found for %s\n", commandBegin);
     471     return false;
     472   }
     473
     474   for (unsigned int i = 0; i < classArray->getCount(); i++)
     475   {
     476     PRINTF(0)("%s\n", classArray->getEntry(i));
     477   }
     478   if (classArray->getCount() == 1)
     479   {
     480     this->removeCharacters(strlen(commandBegin));
     481     this->addCharacters(classArray->getEntry(0));
     482     this->addCharacter(' ');
     483   }
     484
     485   delete[] completionLine;
     486   delete classArray;
    445487}
    446488
Note: See TracChangeset for help on using the changeset viewer.