Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8145 in orxonox.OLD for trunk/src/lib/shell


Ignore:
Timestamp:
Jun 5, 2006, 11:49:26 AM (19 years ago)
Author:
bensch
Message:

trunk: merged the gui back
merged with command:
svn merge -r8114:HEAD https://svn.orxonox.net/orxonox/branches/gui .
→ no conflicts

Location:
trunk/src/lib/shell
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_buffer.cc

    r7764 r8145  
    4141  ShellBuffer* ShellBuffer::singletonRef = NULL;
    4242  std::list<std::string> ShellBuffer::buffer;
     43  char ShellBuffer::bufferArray[SHELL_BUFFER_SIZE];
     44
    4345
    4446  /**
     
    6264   * @param line the Line as in the first argument in printf
    6365   */
    64   bool ShellBuffer::addBufferLineStatic(const char* line, ...)
     66  void ShellBuffer::addBufferLineStatic(const char* line, ...)
    6567  {
    66     va_list arguments;
    67     va_start(arguments, line);
    68 
    6968    static OrxThread::Mutex ShellBuffer__bufferMutex;
    7069
    7170    OrxThread::MutexLock bufferLock(&ShellBuffer__bufferMutex);
     71
     72    va_list arguments;
     73    va_start(arguments, line);
     74    vsnprintf(ShellBuffer::bufferArray, SHELL_BUFFER_SIZE, line, arguments);
     75    va_end(arguments);
     76
    7277#if DEBUG_LEVEL < 3
    7378    if (ShellBuffer::singletonRef == NULL)
    7479#endif
    75       vprintf(line, arguments);
     80      printf(ShellBuffer::bufferArray);
    7681#if DEBUG_LEVEL < 3
    7782    else
     
    7984    if (ShellBuffer::singletonRef != NULL)
    8085#endif
    81       ShellBuffer::singletonRef->addBufferLine(line, arguments);
    82     return true;
     86      ShellBuffer::singletonRef->addBufferLine(ShellBuffer::bufferArray);
    8387  }
    8488
     
    9195   * and displays the line as the First Line of the display-buffer
    9296   */
    93   void ShellBuffer::addBufferLine(const char* line, va_list arguments)
     97  void ShellBuffer::addBufferLine(const char* line)
    9498  {
    95     // copy the output to the bufferArray
    96     vsprintf(this->bufferArray, line, arguments);
    97 
    98     std::string inputBuffer = this->keepBuffer + this->bufferArray;
     99    std::string inputBuffer = this->keepBuffer + line;
    99100
    100101    int lineBegin = 0;
  • trunk/src/lib/shell/shell_buffer.h

    r7762 r8145  
    3232    inline static bool isInstanciated() { return (ShellBuffer::singletonRef == NULL)?false:true; };
    3333
    34     static bool addBufferLineStatic(const char* line, ...);
    35     void addBufferLine(const char* line, va_list arg);
     34    static void addBufferLineStatic(const char* line, ...);
     35    void addBufferLine(const char* line);
    3636
    3737    /// BUFFER
     
    5656    unsigned int                  maxBufferSize;                         //!< The Size of the buffer
    5757
    58     char                          bufferArray[SHELL_BUFFER_SIZE];     //!< a BUFFER for fast writing
    5958    std::string                   keepBuffer;                         //!< a BUFFER to have multi-non-newLine commands be copied into the shell.
    6059
     
    6261
    6362    // The Beginning of buffer (buffer.front()) is the last added line.
     63    static char                   bufferArray[SHELL_BUFFER_SIZE];     //!< a BUFFER for fast writing
    6464    static std::list<std::string> buffer;                             //!< A list of stored char-arrays(strings) to store the history
    6565  };
  • trunk/src/lib/shell/shell_command.h

    r7742 r8145  
    3434   * $ ClassName [ObjectName] commandNameInShell [parameters]
    3535   */
    36   //#define SHELL_COMMAND(command, class, function) \
    37   //        ShellCommand* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function)
    3836#define SHELL_COMMAND(command, class, function) \
    3937           OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, createExecutor<class>(&class::function))
Note: See TracChangeset for help on using the changeset viewer.