Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2011, 2:47:44 AM (13 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:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/LuaState.cc

    r8351 r8729  
    4040#include "util/Exception.h"
    4141#include "Resource.h"
    42 #include "ToluaBindCore.h"
    4342#include "command/IOConsole.h"
    4443
    4544namespace orxonox
    4645{
    47     LuaState::ToluaInterfaceMap LuaState::toluaInterfaces_s;
    48     std::vector<LuaState*> LuaState::instances_s;
    49 
    5046    const std::string LuaState::ERROR_HANDLER_NAME = "errorHandler";
    51 
    52     // Do this after declaring toluaInterfaces_s and instances_s to avoid larger problems
    53     DeclareToluaInterface(Core);
    5447
    5548    LuaState::LuaState()
     
    277270    }
    278271
     272    /*static*/ LuaState::ToluaInterfaceMap& LuaState::getToluaInterfaces()
     273    {
     274        static ToluaInterfaceMap p;
     275        return p;
     276    }
     277
     278    /*static*/ std::vector<LuaState*>& LuaState::getInstances()
     279    {
     280        static std::vector<LuaState*> p;
     281        return p;
     282    }
     283
    279284    /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
    280285    {
    281         for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
     286        for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    282287        {
    283288            if (it->first == name || it->second == function)
     
    287292            }
    288293        }
    289         toluaInterfaces_s[name] = function;
     294        getToluaInterfaces()[name] = function;
    290295
    291296        // Open interface in all LuaStates
    292         for (std::vector<LuaState*>::const_iterator it = instances_s.begin(); it != instances_s.end(); ++it)
     297        for (std::vector<LuaState*>::const_iterator it = getInstances().begin(); it != getInstances().end(); ++it)
    293298            (*function)((*it)->luaState_);
    294299
     
    299304    /*static*/ bool LuaState::removeToluaInterface(const std::string& name)
    300305    {
    301         ToluaInterfaceMap::iterator it = toluaInterfaces_s.find(name);
    302         if (it == toluaInterfaces_s.end())
     306        ToluaInterfaceMap::iterator it = getToluaInterfaces().find(name);
     307        if (it == getToluaInterfaces().end())
    303308        {
    304309            COUT(2) << "Warning: Cannot remove Tolua interface '" << name << "': Not found" << std::endl;
     
    307312
    308313        // Close interface in all LuaStates
    309         for (std::vector<LuaState*>::const_iterator itState = instances_s.begin(); itState != instances_s.end(); ++itState)
     314        for (std::vector<LuaState*>::const_iterator itState = getInstances().begin(); itState != getInstances().end(); ++itState)
    310315        {
    311316            lua_pushnil((*itState)->luaState_);
     
    314319
    315320        // Remove entry
    316         toluaInterfaces_s.erase(it);
     321        getToluaInterfaces().erase(it);
    317322
    318323        // Return dummy bool
     
    322327    /*static*/ void LuaState::openToluaInterfaces(lua_State* state)
    323328    {
    324         for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
     329        for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    325330            (*it->second)(state);
    326331    }
     
    328333    /*static*/ void LuaState::closeToluaInterfaces(lua_State* state)
    329334    {
    330         for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
     335        for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    331336        {
    332337            lua_pushnil(state);
Note: See TracChangeset for help on using the changeset viewer.