Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2011, 2:47:44 AM (14 years ago)
Author:
rgrieder
Message:

Merged unity_build branch back to trunk.

Features:

  • Implemented fully automatic build units to speed up compilation if requested
  • Added DOUT macro for quick debug output
  • Activated text colouring in the POSIX IOConsole
  • DeclareToluaInterface is not necessary anymore

Improvements:

  • Output levels now change appropriately when switch back and forth from dev mode
  • Log level for the file output is now also correct during startup
  • Removed some header file dependencies in core and tools to speed up compilation

no more file for command line options

  • Improved util::tribool by adapting some concepts from boost::tribool

Regressions:

  • It is not possible anymore to specify command line arguments in an extra file because we've got config values for that purpose.
Location:
code/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/command/Functor.h

    r8706 r8729  
    114114#define _Functor_H__
    115115
     116#include "core/CorePrereqs.h"
     117
    116118#include <typeinfo>
    117 
    118 #include "core/CorePrereqs.h"
    119119
    120120#include "util/Debug.h"
  • code/trunk/src/libraries/core/command/IOConsolePOSIX.cc

    r7422 r8729  
    236236    void IOConsole::printOutputLine(const std::string& text, Shell::LineType type)
    237237    {
    238 /*
    239238        // Colour line
    240239        switch (type)
    241240        {
    242         case Shell::None:    this->cout_ << "\033[37m"; break;
    243241        case Shell::Error:   this->cout_ << "\033[91m"; break;
    244         case Shell::Warning: this->cout_ << "\033[31m"; break;
    245         case Shell::Info:    this->cout_ << "\033[34m"; break;
    246         case Shell::Debug:   this->cout_ << "\033[36m"; break;
    247         case Shell::Verbose: this->cout_ << "\033[35m"; break;
    248         case Shell::Ultra:   this->cout_ << "\033[37m"; break;
     242        case Shell::Warning: this->cout_ << "\033[93m"; break;
     243        case Shell::Info:    this->cout_ << "\033[90m"; break;
     244        case Shell::Debug:   this->cout_ << "\033[90m"; break;
     245        case Shell::Verbose: this->cout_ << "\033[90m"; break;
     246        case Shell::Ultra:   this->cout_ << "\033[90m"; break;
     247        case Shell::Command: this->cout_ << "\033[36m"; break;
     248        case Shell::Hint:    this->cout_ << "\033[33m"; break;
     249        case Shell::TDebug:  this->cout_ << "\033[95m"; break;
    249250        default: break;
    250251        }
    251 */
    252252
    253253        // Print output line
    254254        this->cout_ << text;
    255255
    256         // Reset colour to white
    257 //        this->cout_ << "\033[37m";
     256        // Reset colour atributes
     257        this->cout_ << "\033[0m";
    258258    }
    259259
  • code/trunk/src/libraries/core/command/IOConsoleWindows.cc

    r7287 r8729  
    208208        case Shell::Command: colour =                        FOREGROUND_GREEN                  | FOREGROUND_BLUE; break;
    209209        case Shell::Hint:    colour =                        FOREGROUND_GREEN | FOREGROUND_RED                  ; break;
     210        case Shell::TDebug:  colour = FOREGROUND_INTENSITY                    | FOREGROUND_RED | FOREGROUND_BLUE; break;
    210211        default:             colour =                        FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE; break;
    211212        }
  • code/trunk/src/libraries/core/command/IOConsoleWindows.h

    r7401 r8729  
    3939#include <sstream>
    4040#include <string>
    41 #include <vector>
    4241#include "util/Singleton.h"
    4342#include "Shell.h"
  • code/trunk/src/libraries/core/command/Shell.cc

    r8706 r8729  
    3434#include "Shell.h"
    3535
     36#include "util/Math.h"
    3637#include "util/OutputHandler.h"
    3738#include "util/StringUtils.h"
     
    4041#include "core/ConfigFileManager.h"
    4142#include "core/ConfigValueIncludes.h"
     43#include "core/PathConfig.h"
     44#include "core/input/InputBuffer.h"
    4245#include "CommandExecutor.h"
    4346#include "ConsoleCommand.h"
     
    8487
    8588        // Get the previous output and add it to the Shell
    86         for (OutputHandler::OutputVectorIterator it = OutputHandler::getInstance().getOutputVectorBegin();
    87             it != OutputHandler::getInstance().getOutputVectorEnd(); ++it)
    88         {
    89             if (it->first <= this->getSoftDebugLevel())
     89        OutputHandler::OutputVector::const_iterator it = OutputHandler::getInstance().getOutput().begin();
     90        for (;it != OutputHandler::getInstance().getOutput().end(); ++it)
     91        {
     92            if (it->first <= debugLevel_)
    9093            {
    9194                this->outputBuffer_ << it->second;
     
    9699        // Register the shell as output listener
    97100        OutputHandler::getInstance().registerOutputListener(this);
     101        OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
    98102    }
    99103
     
    105109        OutputHandler::getInstance().unregisterOutputListener(this);
    106110        this->inputBuffer_->destroy();
     111    }
     112
     113    namespace DefaultLogLevel
     114    {
     115        const OutputLevel::Value Dev  = OutputLevel::Info;
     116        const OutputLevel::Value User = OutputLevel::Error;
    107117    }
    108118
     
    119129        SetConfigValue(cacheSize_s, 32);
    120130
    121 #ifdef ORXONOX_RELEASE
    122         const unsigned int defaultLevel = 1;
    123 #else
    124         const unsigned int defaultLevel = 3;
    125 #endif
    126         SetConfigValueExternal(softDebugLevel_, "OutputHandler", "softDebugLevel" + this->consoleName_, defaultLevel)
    127             .description("The maximal level of debug output shown in the Shell");
    128         this->setSoftDebugLevel(this->softDebugLevel_);
     131        // Choose the default level according to the path Orxonox was started (build directory or not)
     132        OutputLevel::Value defaultDebugLevel = (PathConfig::buildDirectoryRun() ? DefaultLogLevel::Dev : DefaultLogLevel::User);
     133        SetConfigValueExternal(debugLevel_, "OutputHandler", "debugLevel" + consoleName_, defaultDebugLevel)
     134            .description("The maximum level of debug output shown in the " + consoleName_);
     135        OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
    129136    }
    130137
     
    150157            this->commandHistory_.erase(this->commandHistory_.begin() + index);
    151158            ModifyConfigValue(commandHistory_, remove, index);
     159        }
     160    }
     161
     162    /** Called upon changes in the development mode (by Core)
     163        Behaviour details see Core::devModeChanged.
     164    */
     165    void Shell::devModeChanged(bool value)
     166    {
     167        bool isNormal = (value == PathConfig::buildDirectoryRun());
     168        if (isNormal)
     169        {
     170            ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, update);
     171        }
     172        else
     173        {
     174            OutputLevel::Value level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User);
     175            ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, tset, level);
    152176        }
    153177    }
     
    215239    }
    216240
     241    /// Returns the current position of the cursor in the input buffer.
     242    unsigned int Shell::getCursorPosition() const
     243    {
     244        return this->inputBuffer_->getCursorPosition();
     245    }
     246
     247    /// Returns the current content of the input buffer (the text which was entered by the user)
     248    const std::string& Shell::getInput() const
     249    {
     250        return this->inputBuffer_->get();
     251    }
     252
    217253    /**
    218254        @brief Sends output to the internal output buffer.
  • code/trunk/src/libraries/core/command/Shell.h

    r7401 r8729  
    4949
    5050#include "util/OutputHandler.h"
     51#include "core/Core.h"
    5152#include "core/OrxonoxClass.h"
    52 #include "core/input/InputBuffer.h"
    5353
    5454namespace orxonox
     
    8585        Different graphical consoles build upon a Shell, for example InGameConsole and IOConsole.
    8686    */
    87     class _CoreExport Shell : virtual public OrxonoxClass, public OutputListener
     87    class _CoreExport Shell : public OutputListener, public DevModeListener
    8888    {
    8989        public:
     
    9191            enum LineType
    9292            {
     93                TDebug  = OutputLevel::TDebug,
    9394                None    = OutputLevel::None,
    9495                Warning = OutputLevel::Warning,
     
    118119
    119120            void setCursorPosition(unsigned int cursor);
    120             /// Returns the current position of the cursor in the input buffer.
    121             inline unsigned int getCursorPosition() const
    122                 { return this->inputBuffer_->getCursorPosition(); }
    123 
    124             /// Returns the current content of the input buffer (the text which was entered by the user)
    125             inline const std::string& getInput() const
    126                 { return this->inputBuffer_->get(); }
     121            unsigned int getCursorPosition() const;
     122
     123            const std::string& getInput() const;
    127124
    128125            typedef std::list<std::pair<std::string, LineType> > LineList;
     
    146143        private:
    147144            Shell(const Shell& other);
     145
     146            // DevModeListener
     147            void devModeChanged(bool value);
    148148
    149149            void addToHistory(const std::string& command);
     
    197197            unsigned int              historyOffset_;       ///< The command history is a circular buffer, this variable defines the current write-offset
    198198            std::vector<std::string>  commandHistory_;      ///< The history of commands that were entered by the user
    199             int                       softDebugLevel_;      ///< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output)
     199            int                       debugLevel_;          //!< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output)
    200200            static unsigned int       cacheSize_s;          ///< The maximum cache size of the CommandExecutor - this is stored here for better readability of the config file and because CommandExecutor is no OrxonoxClass
    201201    };
Note: See TracChangeset for help on using the changeset viewer.