From 28d4d7ea3f3ad01bcd2ab35382cb7b3728a84d78 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sun, 7 Oct 2012 20:00:55 +0200 Subject: [PATCH 01/43] Manually convert last changes in branch to upstream/master. Regular merge attempt resulted in everything being overwritten by fast-forward merging. - Remove check for 255 master/plugin files. --- apps/openmw/engine.cpp | 29 +++++++++++----- apps/openmw/engine.hpp | 8 +++-- apps/openmw/main.cpp | 21 ++++++------ apps/openmw/mwrender/terrain.cpp | 31 +++++++++++++---- apps/openmw/mwrender/terrain.hpp | 2 +- apps/openmw/mwworld/worldimp.cpp | 33 ++++++++++++++---- apps/openmw/mwworld/worldimp.hpp | 3 +- components/esm/esm_reader.hpp | 8 +++++ components/esm/loadland.cpp | 1 + components/esm/loadland.hpp | 1 + components/esm_store/reclists.hpp | 56 +++++++++++++++++++++++++------ components/esm_store/store.cpp | 9 +++++ 12 files changed, 155 insertions(+), 47 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index b86923a1d..a02dbf1d6 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -212,18 +212,31 @@ void OMW::Engine::setCell (const std::string& cellName) // Set master file (esm) // - If the given name does not have an extension, ".esm" is added automatically -// - Currently OpenMW only supports one master at the same time. void OMW::Engine::addMaster (const std::string& master) { - assert (mMaster.empty()); - mMaster = master; - + mMaster.push_back(master); + std::string &str = mMaster.back(); + // Append .esm if not already there - std::string::size_type sep = mMaster.find_last_of ("."); + std::string::size_type sep = str.find_last_of ("."); if (sep == std::string::npos) { - mMaster += ".esm"; + str += ".esm"; + } +} + +// Add plugin file (esp) +void OMW::Engine::addPlugin (const std::string& plugin) +{ + mPlugins.push_back(plugin); + std::string &str = mPlugins.back(); + + // Append .esp if not already there + std::string::size_type sep = str.find_last_of ("."); + if (sep == std::string::npos) + { + str += ".esp"; } } @@ -331,8 +344,8 @@ void OMW::Engine::go() MWGui::CursorReplace replacer; // Create the world - mEnvironment.setWorld (new MWWorld::World (*mOgre, mFileCollections, mMaster, - mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoding, mFallbackMap)); + mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mMaster, mPlugins, + mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoding, mFallbackMap) ); // Create window manager - this manages all the MW-specific GUI windows MWScript::registerExtensions (mExtensions); diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index 57402c91e..7fd27b36b 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -64,7 +64,8 @@ namespace OMW boost::filesystem::path mResDir; OEngine::Render::OgreRenderer *mOgre; std::string mCellName; - std::string mMaster; + std::vector mMaster; + std::vector mPlugins; int mFpsLevel; bool mDebug; bool mVerboseScripts; @@ -122,9 +123,12 @@ namespace OMW /// Set master file (esm) /// - If the given name does not have an extension, ".esm" is added automatically - /// - Currently OpenMW only supports one master at the same time. void addMaster(const std::string& master); + /// Same as "addMaster", but for plugin files (esp) + /// - If the given name does not have an extension, ".esp" is added automatically + void addPlugin(const std::string& plugin); + /// Enable fps counter void showFPS(int level); diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 5c2ba2f80..c2b8d7559 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -224,18 +224,19 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat master.push_back("Morrowind"); } - if (master.size() > 1) - { - std::cout - << "Ignoring all but the first master file (multiple master files not yet supported)." - << std::endl; - } - engine.addMaster(master[0]); - StringsVector plugin = variables["plugin"].as(); - if (!plugin.empty()) + // Removed check for 255 files, which would be the hard-coded limit in Morrowind. + // I'll keep the following variable in, maybe we can use it for somethng different. + int cnt = master.size() + plugin.size(); + + // Prepare loading master/plugin files (i.e. send filenames to engine) + for (std::vector::size_type i = 0; i < master.size(); i++) { - std::cout << "Ignoring plugin files (plugins not yet supported)." << std::endl; + engine.addMaster(master[i]); + } + for (std::vector::size_type i = 0; i < plugin.size(); i++) + { + engine.addPlugin(plugin[i]); } // startup-settings diff --git a/apps/openmw/mwrender/terrain.cpp b/apps/openmw/mwrender/terrain.cpp index 691e7c4af..e39cdd150 100644 --- a/apps/openmw/mwrender/terrain.cpp +++ b/apps/openmw/mwrender/terrain.cpp @@ -141,7 +141,7 @@ namespace MWRender std::map indexes; initTerrainTextures(&terrainData, cellX, cellY, x * numTextures, y * numTextures, - numTextures, indexes); + numTextures, indexes, land->plugin); if (mTerrainGroup.getTerrain(terrainX, terrainY) == NULL) { @@ -200,8 +200,13 @@ namespace MWRender void TerrainManager::initTerrainTextures(Terrain::ImportData* terrainData, int cellX, int cellY, int fromX, int fromY, int size, - std::map& indexes) + std::map& indexes, size_t plugin) { + // FIXME: In a multiple esm configuration, we have multiple palettes. Since this code + // crosses cell boundaries, we no longer have a unique terrain palette. Instead, we need + // to adopt the following code for a dynamic palette. And this is evil - the current design + // does not work well for this task... + assert(terrainData != NULL && "Must have valid terrain data"); assert(fromX >= 0 && fromY >= 0 && "Can't get a terrain texture on terrain outside the current cell"); @@ -214,12 +219,20 @@ namespace MWRender // //If we don't sort the ltex indexes, the splatting order may differ between //cells which may lead to inconsistent results when shading between cells + int num = MWBase::Environment::get().getWorld()->getStore().landTexts.getSizePlugin(plugin); std::set ltexIndexes; for ( int y = fromY - 1; y < fromY + size + 1; y++ ) { for ( int x = fromX - 1; x < fromX + size + 1; x++ ) { - ltexIndexes.insert(getLtexIndexAt(cellX, cellY, x, y)); + int idx = getLtexIndexAt(cellX, cellY, x, y); + // This is a quick hack to prevent the program from trying to fetch textures + // from a neighboring cell, which might originate from a different plugin, + // and use a separate texture palette. Right now, we simply cast it to the + // default texture (i.e. 0). + if (idx > num) + idx = 0; + ltexIndexes.insert(idx); } } @@ -231,7 +244,7 @@ namespace MWRender iter != ltexIndexes.end(); ++iter ) { - const uint16_t ltexIndex = *iter; + uint16_t ltexIndex = *iter; //this is the base texture, so we can ignore this at present if ( ltexIndex == baseTexture ) { @@ -244,8 +257,12 @@ namespace MWRender { //NB: All vtex ids are +1 compared to the ltex ids - assert( (int)MWBase::Environment::get().getWorld()->getStore().landTexts.getSize() >= (int)ltexIndex - 1 && - "LAND.VTEX must be within the bounds of the LTEX array"); + // NOTE: using the quick hack above, we should no longer end up with textures indices + // that are out of bounds. However, I haven't updated the test to a multi-palette + // system yet. We probably need more work here, so we skip it for now. + + //assert( (int)MWBase::Environment::get().getWorld()->getStore().landTexts.getSize() >= (int)ltexIndex - 1 && + //"LAND.VTEX must be within the bounds of the LTEX array"); std::string texture; if ( ltexIndex == 0 ) @@ -254,7 +271,7 @@ namespace MWRender } else { - texture = MWBase::Environment::get().getWorld()->getStore().landTexts.search(ltexIndex-1)->texture; + texture = MWBase::Environment::get().getWorld()->getStore().landTexts.search(ltexIndex-1, plugin)->texture; //TODO this is needed due to MWs messed up texture handling texture = texture.substr(0, texture.rfind(".")) + ".dds"; } diff --git a/apps/openmw/mwrender/terrain.hpp b/apps/openmw/mwrender/terrain.hpp index c83d96cf4..484a0dbe3 100644 --- a/apps/openmw/mwrender/terrain.hpp +++ b/apps/openmw/mwrender/terrain.hpp @@ -75,7 +75,7 @@ namespace MWRender{ void initTerrainTextures(Ogre::Terrain::ImportData* terrainData, int cellX, int cellY, int fromX, int fromY, int size, - std::map& indexes); + std::map& indexes, size_t plugin); /** * Creates the blend (splatting maps) for the given terrain from the ltex data. diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 38063b051..dd3717f97 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -164,7 +164,8 @@ namespace MWWorld World::World (OEngine::Render::OgreRenderer& renderer, const Files::Collections& fileCollections, - const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame, + const std::vector& master, const std::vector& plugins, + const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame, const std::string& encoding, std::map fallbackMap) : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm), @@ -177,14 +178,32 @@ namespace MWWorld mWeatherManager = new MWWorld::WeatherManager(mRendering); - boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master)); + int idx = 0; + for (std::vector::size_type i = 0; i < master.size(); i++, idx++) + { + boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master[i])); + + std::cout << "Loading ESM " << masterPath.string() << "\n"; - std::cout << "Loading ESM " << masterPath.string() << "\n"; + // This parses the ESM file + mEsm.setEncoding(encoding); + mEsm.open (masterPath.string()); + mEsm.setIndex(idx); + mStore.load (mEsm); + } + + for (std::vector::size_type i = 0; i < plugins.size(); i++, idx++) + { + boost::filesystem::path pluginPath (fileCollections.getCollection (".esp").getPath (plugins[i])); + + std::cout << "Loading ESP " << pluginPath.string() << "\n"; - // This parses the ESM file and loads a sample cell - mEsm.setEncoding(encoding); - mEsm.open (masterPath.string()); - mStore.load (mEsm); + // This parses the ESP file + mEsm.setEncoding(encoding); + mEsm.open (pluginPath.string()); + mEsm.setIndex(idx); + mStore.load (mEsm); + } mPlayer = new MWWorld::Player (mStore.npcs.find ("player"), *this); mRendering->attachCameraTo(mPlayer->getPlayer()); diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 90cd2151b..52bda6749 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -96,7 +96,8 @@ namespace MWWorld World (OEngine::Render::OgreRenderer& renderer, const Files::Collections& fileCollections, - const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame, + const std::vector& master, const std::vector& plugins, + const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame, const std::string& encoding, std::map fallbackMap); virtual ~World(); diff --git a/components/esm/esm_reader.hpp b/components/esm/esm_reader.hpp index 66c0710a6..afa6da213 100644 --- a/components/esm/esm_reader.hpp +++ b/components/esm/esm_reader.hpp @@ -189,6 +189,14 @@ public: void openRaw(const std::string &file); + // This is a quick hack for multiple esm/esp files. Each plugin introduces its own + // terrain palette, but ESMReader does not pass a reference to the correct plugin + // to the individual load() methods. This hack allows to pass this reference + // indirectly to the load() method. + int idx; + void setIndex(const int index) {idx = index;} + const int getIndex() {return idx;} + /************************************************************************* * * Medium-level reading shortcuts diff --git a/components/esm/loadland.cpp b/components/esm/loadland.cpp index 05cadae7f..101617071 100644 --- a/components/esm/loadland.cpp +++ b/components/esm/loadland.cpp @@ -23,6 +23,7 @@ Land::~Land() void Land::load(ESMReader &esm) { mEsm = &esm; + plugin = mEsm->getIndex(); // Get the grid location esm.getSubNameIs("INTV"); diff --git a/components/esm/loadland.hpp b/components/esm/loadland.hpp index ebc314a28..898134d72 100644 --- a/components/esm/loadland.hpp +++ b/components/esm/loadland.hpp @@ -17,6 +17,7 @@ struct Land int flags; // Only first four bits seem to be used, don't know what // they mean. int X, Y; // Map coordinates. + int plugin; // Plugin index, used to reference the correct material palette. // File context. This allows the ESM reader to be 'reset' to this // location later when we are ready to load the full data set. diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp index ffecfc8de..42597bea4 100644 --- a/components/esm_store/reclists.hpp +++ b/components/esm_store/reclists.hpp @@ -26,6 +26,7 @@ namespace ESMS virtual void load(ESMReader &esm, const std::string &id) = 0; virtual int getSize() = 0; + virtual void remove(const std::string &id) {}; virtual void listIdentifier (std::vector& identifier) const = 0; static std::string toLower (const std::string& name) @@ -57,6 +58,14 @@ namespace ESMS list[id2].load(esm); } + // Delete the given object ID. Plugin files support this, so we need to do this, too. + void remove(const std::string &id) + { + std::string id2 = toLower (id); + + list.erase(id2); + } + // Find the given object ID, or return NULL if not found. const X* search(const std::string &id) const { @@ -268,38 +277,63 @@ namespace ESMS { virtual ~LTexList() {} - // TODO: For multiple ESM/ESP files we need one list per file. - std::vector ltex; + // For multiple ESM/ESP files we need one list per file. + typedef std::vector LandTextureList; + std::vector ltex; LTexList() { - // More than enough to hold Morrowind.esm. - ltex.reserve(128); + ltex.push_back(LandTextureList()); + LandTextureList <exl = ltex[0]; + // More than enough to hold Morrowind.esm. Extra lists for plugins will we + // added on-the-fly in a different method. + ltexl.reserve(128); } - const LandTexture* search(size_t index) const + const LandTexture* search(size_t index, size_t plugin) const { - assert(index < ltex.size()); - return <ex.at(index); + assert(plugin < ltex.size()); + const LandTextureList <exl = ltex[plugin]; + + assert(index < ltexl.size()); + return <exl.at(index); } + // "getSize" returns the number of individual terrain palettes. + // "getSizePlugin" returns the number of land textures in a specific palette. int getSize() { return ltex.size(); } int getSize() const { return ltex.size(); } + int getSizePlugin(size_t plugin) { assert(plugin < ltex.size()); return ltex[plugin].size(); } + int getSizePlugin(size_t plugin) const { assert(plugin < ltex.size()); return ltex[plugin].size(); } + virtual void listIdentifier (std::vector& identifier) const {} - void load(ESMReader &esm, const std::string &id) + void load(ESMReader &esm, const std::string &id, size_t plugin) { LandTexture lt; lt.load(esm); lt.id = id; // Make sure we have room for the structure - if(lt.index + 1 > (int)ltex.size()) - ltex.resize(lt.index+1); + if (plugin >= ltex.size()) { + ltex.resize(plugin+1); + } + LandTextureList <exl = ltex[plugin]; + if(lt.index + 1 > (int)ltexl.size()) + ltexl.resize(lt.index+1); // Store it - ltex[lt.index] = lt; + ltexl[lt.index] = lt; + } + + // Load all terrain palettes at the same size. Inherited virtual function + // from "RecList". Mostly useless, because we need the implementation + // above this one. + void load(ESMReader &esm, const std::string &id) + { + size_t plugin = esm.getIndex(); + load(esm, id, plugin); } }; diff --git a/components/esm_store/store.cpp b/components/esm_store/store.cpp index c676601e5..d13cd373d 100644 --- a/components/esm_store/store.cpp +++ b/components/esm_store/store.cpp @@ -67,6 +67,15 @@ void ESMStore::load(ESMReader &esm) { // Load it std::string id = esm.getHNOString("NAME"); + // ... unless it got deleted! This means that the following record + // has been deleted, and trying to load it using standard assumptions + // on the structure will (probably) fail. + if (esm.isNextSub("DELE")) { + esm.skipRecord(); + all.erase(id); + it->second->remove(id); + continue; + } it->second->load(esm, id); if (n.val==ESM::REC_DIAL) From 7f77bf76c7bc3e12fce4879b21612a6d49101fb7 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Tue, 6 Nov 2012 22:13:19 +0100 Subject: [PATCH 02/43] - Add support for multiple esm contexts in cell store. This will allow to generate references from multiple esX files. Currently, only the first context is used. - Add many TODOs to mark points where more work is required to fully implement this feature. --- apps/openmw/mwworld/cellstore.cpp | 128 +++++++++++++++++------------- apps/openmw/mwworld/cellstore.hpp | 4 + components/esm/loadcell.cpp | 12 ++- components/esm/loadcell.hpp | 3 +- extern/shiny | 2 +- 5 files changed, 89 insertions(+), 60 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index fcdec1e7f..322b43a00 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -45,23 +45,32 @@ namespace MWWorld { assert (cell); - if (cell->mContext.filename.empty()) + if (cell->mContextList.size() == 0) return; // this is a dynamically generated cell -> skipping. - // Reopen the ESM reader and seek to the right position. - cell->restore (esm); - - ESM::CellRef ref; - - // Get each reference in turn - while (cell->getNextRef (esm, ref)) + // Load references from all plugins that do something with this cell. + // HACK: only use first entry for now, full support requires some more work + //for (int i = 0; i < cell->mContextList.size(); i++) + for (int i = 0; i < 1; i++) { - std::string lowerCase; + // Reopen the ESM reader and seek to the right position. + // TODO: we will need to intoduce separate "esm"s, one per plugin! + cell->restore (esm); - std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), - (int(*)(int)) std::tolower); + ESM::CellRef ref; - mIds.push_back (lowerCase); + // Get each reference in turn + while (cell->getNextRef (esm, ref)) + { + std::string lowerCase; + + std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), + (int(*)(int)) std::tolower); + + // TODO: support deletion / moving references out of the cell. no simple "push_back", + // but see what the plugin wants to do. + mIds.push_back (lowerCase); + } } std::sort (mIds.begin(), mIds.end()); @@ -71,57 +80,64 @@ namespace MWWorld { assert (cell); - if (cell->mContext.filename.empty()) + if (cell->mContextList.size() == 0) return; // this is a dynamically generated cell -> skipping. - // Reopen the ESM reader and seek to the right position. - cell->restore(esm); - - ESM::CellRef ref; - - // Get each reference in turn - while(cell->getNextRef(esm, ref)) + // Load references from all plugins that do something with this cell. + // HACK: only use first entry for now, full support requires some more work + //for (int i = 0; i < cell->mContextList.size(); i++) + for (int i = 0; i < 1; i++) { - std::string lowerCase; + // Reopen the ESM reader and seek to the right position. + // TODO: we will need to intoduce separate "esm"s, one per plugin! + cell->restore(esm); - std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), - (int(*)(int)) std::tolower); + ESM::CellRef ref; - int rec = store.find(ref.mRefID); - - ref.mRefID = lowerCase; - - /* We can optimize this further by storing the pointer to the - record itself in store.all, so that we don't need to look it - up again here. However, never optimize. There are infinite - opportunities to do that later. - */ - switch(rec) + // Get each reference in turn + while(cell->getNextRef(esm, ref)) { - case ESM::REC_ACTI: activators.find(ref, store.activators); break; - case ESM::REC_ALCH: potions.find(ref, store.potions); break; - case ESM::REC_APPA: appas.find(ref, store.appas); break; - case ESM::REC_ARMO: armors.find(ref, store.armors); break; - case ESM::REC_BOOK: books.find(ref, store.books); break; - case ESM::REC_CLOT: clothes.find(ref, store.clothes); break; - case ESM::REC_CONT: containers.find(ref, store.containers); break; - case ESM::REC_CREA: creatures.find(ref, store.creatures); break; - case ESM::REC_DOOR: doors.find(ref, store.doors); break; - case ESM::REC_INGR: ingreds.find(ref, store.ingreds); break; - case ESM::REC_LEVC: creatureLists.find(ref, store.creatureLists); break; - case ESM::REC_LEVI: itemLists.find(ref, store.itemLists); break; - case ESM::REC_LIGH: lights.find(ref, store.lights); break; - case ESM::REC_LOCK: lockpicks.find(ref, store.lockpicks); break; - case ESM::REC_MISC: miscItems.find(ref, store.miscItems); break; - case ESM::REC_NPC_: npcs.find(ref, store.npcs); break; - case ESM::REC_PROB: probes.find(ref, store.probes); break; - case ESM::REC_REPA: repairs.find(ref, store.repairs); break; - case ESM::REC_STAT: statics.find(ref, store.statics); break; - case ESM::REC_WEAP: weapons.find(ref, store.weapons); break; + std::string lowerCase; - case 0: std::cout << "Cell reference " + ref.mRefID + " not found!\n"; break; - default: - std::cout << "WARNING: Ignoring reference '" << ref.mRefID << "' of unhandled type\n"; + std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), + (int(*)(int)) std::tolower); + + int rec = store.find(ref.mRefID); + + ref.mRefID = lowerCase; + + /* We can optimize this further by storing the pointer to the + record itself in store.all, so that we don't need to look it + up again here. However, never optimize. There are infinite + opportunities to do that later. + */ + switch(rec) + { + case ESM::REC_ACTI: activators.find(ref, store.activators); break; + case ESM::REC_ALCH: potions.find(ref, store.potions); break; + case ESM::REC_APPA: appas.find(ref, store.appas); break; + case ESM::REC_ARMO: armors.find(ref, store.armors); break; + case ESM::REC_BOOK: books.find(ref, store.books); break; + case ESM::REC_CLOT: clothes.find(ref, store.clothes); break; + case ESM::REC_CONT: containers.find(ref, store.containers); break; + case ESM::REC_CREA: creatures.find(ref, store.creatures); break; + case ESM::REC_DOOR: doors.find(ref, store.doors); break; + case ESM::REC_INGR: ingreds.find(ref, store.ingreds); break; + case ESM::REC_LEVC: creatureLists.find(ref, store.creatureLists); break; + case ESM::REC_LEVI: itemLists.find(ref, store.itemLists); break; + case ESM::REC_LIGH: lights.find(ref, store.lights); break; + case ESM::REC_LOCK: lockpicks.find(ref, store.lockpicks); break; + case ESM::REC_MISC: miscItems.find(ref, store.miscItems); break; + case ESM::REC_NPC_: npcs.find(ref, store.npcs); break; + case ESM::REC_PROB: probes.find(ref, store.probes); break; + case ESM::REC_REPA: repairs.find(ref, store.repairs); break; + case ESM::REC_STAT: statics.find(ref, store.statics); break; + case ESM::REC_WEAP: weapons.find(ref, store.weapons); break; + + case 0: std::cout << "Cell reference " + ref.mRefID + " not found!\n"; break; + default: + std::cout << "WARNING: Ignoring reference '" << ref.mRefID << "' of unhandled type\n"; + } } } } diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 32ab6e07b..fd739b565 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -62,6 +62,10 @@ namespace MWWorld if(obj == NULL) throw std::runtime_error("Error resolving cell reference " + ref.mRefID); + // TODO: this line must be modified for multiple plugins and moved references. + // This means: no simple "push back", but search for an existing reference with + // this ID first! If it exists, merge data into this list instead of just adding it. + // I'll probably generate a separate method jist for this. list.push_back(LiveRef(ref, obj)); } diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index 97ce17775..65c9c23e7 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "esmreader.hpp" #include "esmwriter.hpp" @@ -111,7 +112,7 @@ void Cell::load(ESMReader &esm) } // Save position of the cell references and move on - mContext = esm.getContext(); + mContextList.push_back(esm.getContext()); esm.skipRecord(); } @@ -148,7 +149,8 @@ void Cell::save(ESMWriter &esm) void Cell::restore(ESMReader &esm) const { - esm.restoreContext(mContext); + // TODO: support all contexts in the list! + esm.restoreContext(mContextList[0]); } std::string Cell::getDescription() const @@ -167,6 +169,12 @@ std::string Cell::getDescription() const bool Cell::getNextRef(ESMReader &esm, CellRef &ref) { + // TODO: Add support for moved references. References moved without crossing a cell boundary simply + // overwrite old data. References moved across cell boundaries are using a different set of keywords, + // and I'll have to think more about how this can be done. + // TODO: Add support for multiple plugins. This requires a tricky renaming scheme for "ref.mRefnum". + // I'll probably add something to "ESMReader", we will need one per plugin anyway. + // TODO: Try and document reference numbering, I don't think this has been done anywhere else. if (!esm.hasMoreSubs()) return false; diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index fbd7c0456..9511ae0e7 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -2,6 +2,7 @@ #define OPENMW_ESM_CELL_H #include +#include #include "esmcommon.hpp" #include "defs.hpp" @@ -120,7 +121,7 @@ struct Cell // Optional region name for exterior and quasi-exterior cells. std::string mRegion; - ESM_Context mContext; // File position + std::vector mContextList; // File position; multiple positions for multiple plugin support DATAstruct mData; AMBIstruct mAmbi; float mWater; // Water level diff --git a/extern/shiny b/extern/shiny index f17c4ebab..4750676ac 160000 --- a/extern/shiny +++ b/extern/shiny @@ -1 +1 @@ -Subproject commit f17c4ebab0e7a1f3bbb25fd9b3dbef2bd742536a +Subproject commit 4750676ac46a7aaa86bca53dc68c5a1ba11f3bc1 From 42eefaf36ff371d8bdecdca54e5aa26269d7ba6b Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sat, 10 Nov 2012 21:43:41 +0100 Subject: [PATCH 03/43] - Add support for loading references from multiple esm/esp files. Full reference ID mangling coming soon (currently, moved references are simply cloned). - Reference loader now (partially) supports MVRF tag. --- apps/esmtool/esmtool.cpp | 5 ++++- apps/openmw/mwbase/world.hpp | 2 +- apps/openmw/mwworld/cells.cpp | 3 ++- apps/openmw/mwworld/cells.hpp | 5 +++-- apps/openmw/mwworld/cellstore.cpp | 34 +++++++++++++++---------------- apps/openmw/mwworld/cellstore.hpp | 10 ++++----- apps/openmw/mwworld/worldimp.cpp | 24 ++++++++++++++-------- apps/openmw/mwworld/worldimp.hpp | 4 ++-- components/esm/esmcommon.hpp | 4 ++++ components/esm/esmreader.hpp | 2 +- components/esm/loadcell.cpp | 31 +++++++++++++++++++++------- components/esm/loadcell.hpp | 2 +- components/esm_store/reclists.hpp | 19 +++++++++++++++-- 13 files changed, 95 insertions(+), 50 deletions(-) diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index 4f6d9dbfc..25c4f3a7a 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -220,7 +220,10 @@ void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info) bool save = (info.mode == "clone"); // Skip back to the beginning of the reference list - cell.restore(esm); + // FIXME: Changes to the references backend required to support multiple plugins have + // almost certainly broken this following line. I'll leave it as is for now, so that + // the compiler does not complain. + cell.restore(esm, 0); // Loop through all the references ESM::CellRef ref; diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 6710fc68b..06c3002c7 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -106,7 +106,7 @@ namespace MWBase virtual const ESMS::ESMStore& getStore() const = 0; - virtual ESM::ESMReader& getEsmReader() = 0; + virtual std::vector& getEsmReader() = 0; virtual MWWorld::LocalScripts& getLocalScripts() = 0; diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index e5a38d4be..e49835f41 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -85,7 +85,7 @@ MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, Ptr::CellS return ptr; } -MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader) +MWWorld::Cells::Cells (const ESMS::ESMStore& store, std::vector& reader) : mStore (store), mReader (reader), mIdCache (20, std::pair ("", (Ptr::CellStore*)0)), /// \todo make cache size configurable mIdCacheIndex (0) @@ -120,6 +120,7 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y) if (result->second.mState!=Ptr::CellStore::State_Loaded) { + // Multiple plugin support for landscape data is much easier than for references. The last plugin wins. result->second.load (mStore, mReader); fillContainers (result->second); } diff --git a/apps/openmw/mwworld/cells.hpp b/apps/openmw/mwworld/cells.hpp index 3e1383166..3941399f8 100644 --- a/apps/openmw/mwworld/cells.hpp +++ b/apps/openmw/mwworld/cells.hpp @@ -2,6 +2,7 @@ #define GAME_MWWORLD_CELLS_H #include +#include #include #include "ptr.hpp" @@ -22,7 +23,7 @@ namespace MWWorld class Cells { const ESMS::ESMStore& mStore; - ESM::ESMReader& mReader; + std::vector& mReader; std::map mInteriors; std::map, CellStore> mExteriors; std::vector > mIdCache; @@ -39,7 +40,7 @@ namespace MWWorld public: - Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader); + Cells (const ESMS::ESMStore& store, std::vector& reader); ///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole /// world diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 322b43a00..91c0afe26 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -16,7 +16,7 @@ namespace MWWorld mWaterLevel = cell->mWater; } - void CellStore::load (const ESMS::ESMStore &store, ESM::ESMReader &esm) + void CellStore::load (const ESMS::ESMStore &store, std::vector &esm) { if (mState!=State_Loaded) { @@ -31,7 +31,7 @@ namespace MWWorld } } - void CellStore::preload (const ESMS::ESMStore &store, ESM::ESMReader &esm) + void CellStore::preload (const ESMS::ESMStore &store, std::vector &esm) { if (mState==State_Unloaded) { @@ -41,7 +41,7 @@ namespace MWWorld } } - void CellStore::listRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm) + void CellStore::listRefs(const ESMS::ESMStore &store, std::vector &esm) { assert (cell); @@ -49,26 +49,24 @@ namespace MWWorld return; // this is a dynamically generated cell -> skipping. // Load references from all plugins that do something with this cell. - // HACK: only use first entry for now, full support requires some more work - //for (int i = 0; i < cell->mContextList.size(); i++) - for (int i = 0; i < 1; i++) + for (size_t i = 0; i < cell->mContextList.size(); i++) { // Reopen the ESM reader and seek to the right position. - // TODO: we will need to intoduce separate "esm"s, one per plugin! - cell->restore (esm); + int index = cell->mContextList.at(i).index; + cell->restore (esm[index], i); ESM::CellRef ref; // Get each reference in turn - while (cell->getNextRef (esm, ref)) + while (cell->getNextRef (esm[index], ref)) { std::string lowerCase; std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), (int(*)(int)) std::tolower); - // TODO: support deletion / moving references out of the cell. no simple "push_back", - // but see what the plugin wants to do. + // TODO: Fully support deletion / moving references out of the cell. no simple "push_back", + // but make sure that the reference exists only once. mIds.push_back (lowerCase); } } @@ -76,7 +74,7 @@ namespace MWWorld std::sort (mIds.begin(), mIds.end()); } - void CellStore::loadRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm) + void CellStore::loadRefs(const ESMS::ESMStore &store, std::vector &esm) { assert (cell); @@ -84,24 +82,24 @@ namespace MWWorld return; // this is a dynamically generated cell -> skipping. // Load references from all plugins that do something with this cell. - // HACK: only use first entry for now, full support requires some more work - //for (int i = 0; i < cell->mContextList.size(); i++) - for (int i = 0; i < 1; i++) + for (size_t i = 0; i < cell->mContextList.size(); i++) { // Reopen the ESM reader and seek to the right position. - // TODO: we will need to intoduce separate "esm"s, one per plugin! - cell->restore(esm); + int index = cell->mContextList.at(i).index; + cell->restore (esm[index], i); ESM::CellRef ref; // Get each reference in turn - while(cell->getNextRef(esm, ref)) + while(cell->getNextRef(esm[index], ref)) { std::string lowerCase; std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), (int(*)(int)) std::tolower); + // TODO: Fully support deletion / moving references out of the cell. No simple loading, + // but make sure that the reference exists only once. Current code clones references. int rec = store.find(ref.mRefID); ref.mRefID = lowerCase; diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index fd739b565..69c4cf9b4 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -3,7 +3,7 @@ #include -#include +#include #include #include "refdata.hpp" @@ -126,9 +126,9 @@ namespace MWWorld CellRefList statics; CellRefList weapons; - void load (const ESMS::ESMStore &store, ESM::ESMReader &esm); + void load (const ESMS::ESMStore &store, std::vector &esm); - void preload (const ESMS::ESMStore &store, ESM::ESMReader &esm); + void preload (const ESMS::ESMStore &store, std::vector &esm); /// Call functor (ref) for each reference. functor must return a bool. Returning /// false will abort the iteration. @@ -187,9 +187,9 @@ namespace MWWorld } /// Run through references and store IDs - void listRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm); + void listRefs(const ESMS::ESMStore &store, std::vector &esm); - void loadRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm); + void loadRefs(const ESMS::ESMStore &store, std::vector &esm); }; } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 6cf831b53..bbc44f5e1 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -179,6 +179,8 @@ namespace MWWorld mWeatherManager = new MWWorld::WeatherManager(mRendering); int idx = 0; + // NOTE: We might need to reserve one more for the running game / save. + mEsm.resize(master.size() + plugins.size()); for (std::vector::size_type i = 0; i < master.size(); i++, idx++) { boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master[i])); @@ -186,10 +188,12 @@ namespace MWWorld std::cout << "Loading ESM " << masterPath.string() << "\n"; // This parses the ESM file - mEsm.setEncoding(encoding); - mEsm.open (masterPath.string()); - mEsm.setIndex(idx); - mStore.load (mEsm); + ESM::ESMReader lEsm; + lEsm.setEncoding(encoding); + lEsm.open (masterPath.string()); + lEsm.setIndex(idx); + mEsm[idx] = lEsm; + mStore.load (mEsm[idx]); } for (std::vector::size_type i = 0; i < plugins.size(); i++, idx++) @@ -199,10 +203,12 @@ namespace MWWorld std::cout << "Loading ESP " << pluginPath.string() << "\n"; // This parses the ESP file - mEsm.setEncoding(encoding); - mEsm.open (pluginPath.string()); - mEsm.setIndex(idx); - mStore.load (mEsm); + ESM::ESMReader lEsm; + lEsm.setEncoding(encoding); + lEsm.open (pluginPath.string()); + lEsm.setIndex(idx); + mEsm[idx] = lEsm; + mStore.load (mEsm[idx]); } mPlayer = new MWWorld::Player (mStore.npcs.find ("player"), *this); @@ -282,7 +288,7 @@ namespace MWWorld return mStore; } - ESM::ESMReader& World::getEsmReader() + std::vector& World::getEsmReader() { return mEsm; } diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index c8c56f130..ffb2137c7 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -55,7 +55,7 @@ namespace MWWorld MWWorld::Scene *mWorldScene; MWWorld::Player *mPlayer; - ESM::ESMReader mEsm; + std::vector mEsm; ESMS::ESMStore mStore; LocalScripts mLocalScripts; MWWorld::Globals *mGlobalVariables; @@ -127,7 +127,7 @@ namespace MWWorld virtual const ESMS::ESMStore& getStore() const; - virtual ESM::ESMReader& getEsmReader(); + virtual std::vector& getEsmReader(); virtual LocalScripts& getLocalScripts(); diff --git a/components/esm/esmcommon.hpp b/components/esm/esmcommon.hpp index e0c5c08af..d61564c67 100644 --- a/components/esm/esmcommon.hpp +++ b/components/esm/esmcommon.hpp @@ -113,6 +113,10 @@ struct ESM_Context size_t leftFile; NAME recName, subName; HEDRstruct header; + // When working with multiple esX files, we will generate lists of all files that + // actually contribute to a specific cell. Therefore, we need to store the index + // of the file belonging to this contest. See CellStore::(list/load)refs for details. + int index; // True if subName has been read but not used. bool subCached; diff --git a/components/esm/esmreader.hpp b/components/esm/esmreader.hpp index 96b164d5e..f09442a57 100644 --- a/components/esm/esmreader.hpp +++ b/components/esm/esmreader.hpp @@ -81,7 +81,7 @@ public: // to the individual load() methods. This hack allows to pass this reference // indirectly to the load() method. int idx; - void setIndex(const int index) {idx = index;} + void setIndex(const int index) {idx = index; mCtx.index = index;} const int getIndex() {return idx;} /************************************************************************* diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index 65c9c23e7..beedd3cac 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -113,6 +113,8 @@ void Cell::load(ESMReader &esm) // Save position of the cell references and move on mContextList.push_back(esm.getContext()); + if (mContextList.size() > 1) + std::cout << "found two plugins" << std::endl; esm.skipRecord(); } @@ -147,10 +149,9 @@ void Cell::save(ESMWriter &esm) esm.writeHNT("NAM0", mNAM0); } -void Cell::restore(ESMReader &esm) const +void Cell::restore(ESMReader &esm, int iCtx) const { - // TODO: support all contexts in the list! - esm.restoreContext(mContextList[0]); + esm.restoreContext(mContextList[iCtx]); } std::string Cell::getDescription() const @@ -169,15 +170,28 @@ std::string Cell::getDescription() const bool Cell::getNextRef(ESMReader &esm, CellRef &ref) { - // TODO: Add support for moved references. References moved without crossing a cell boundary simply - // overwrite old data. References moved across cell boundaries are using a different set of keywords, - // and I'll have to think more about how this can be done. // TODO: Add support for multiple plugins. This requires a tricky renaming scheme for "ref.mRefnum". // I'll probably add something to "ESMReader", we will need one per plugin anyway. // TODO: Try and document reference numbering, I don't think this has been done anywhere else. if (!esm.hasMoreSubs()) return false; - + + if (esm.isNextSub("MVRF")) { + // Moved existing reference across cell boundaries, so interpret the blocks correctly. + // FIXME: Right now, we don't do anything with this data. This might result in weird behaviour, + // where a moved reference does not appear because the owning cell (i.e. this cell) is not + // loaded in memory. + int movedRefnum = 0; + int destCell[2]; + esm.getHT(movedRefnum); + esm.getHNT(destCell, "CNDT"); + // TODO: Figure out what happens when a reference has moved into an interior cell. This might + // be required for NPCs following the player. + } + // If we have just parsed a MVRF entry, there should be a regular FRMR entry following right there. + // With the exception that this bock technically belongs to a different cell than this one. + // TODO: Figure out a way to handle these weird references that do not belong to this cell. + // This may require some not-so-small behing-the-scenes updates. esm.getHNT(ref.mRefnum, "FRMR"); ref.mRefID = esm.getHNString("NAME"); @@ -228,6 +242,9 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) // Number of references in the cell? Maximum once in each cell, // but not always at the beginning, and not always right. In other // words, completely useless. + // Update: Well, maybe not completely useless. This might actually be + // number_of_references + number_of_references_moved_here_Across_boundaries, + // and could be helpful for collecting these weird moved references. ref.mNam0 = 0; if (esm.isNextSub("NAM0")) { diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index 9511ae0e7..ccfdcadd8 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -152,7 +152,7 @@ struct Cell // somewhere other than the file system, you need to pre-open the // ESMReader, and the filename must match the stored filename // exactly. - void restore(ESMReader &esm) const; + void restore(ESMReader &esm, int iCtx) const; std::string getDescription() const; ///< Return a short string describing the cell (mostly used for debugging/logging purpose) diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp index eac1b5b72..44b7e6569 100644 --- a/components/esm_store/reclists.hpp +++ b/components/esm_store/reclists.hpp @@ -496,6 +496,11 @@ namespace ESMS { count++; + // Don't automatically assume that a new cell must be spawned. Multiple plugins write to the same cell, + // and we merge all this data into one Cell object. However, we can't simply search for the cell id, + // as many exterior cells do not have a name. Instead, we need to search by (x,y) coordinates - and they + // are not available until both cells have been loaded! So first, proceed as usual. + // All cells have a name record, even nameless exterior cells. ESM::Cell *cell = new ESM::Cell; cell->mName = id; @@ -505,12 +510,22 @@ namespace ESMS if(cell->mData.mFlags & ESM::Cell::Interior) { - // Store interior cell by name + // Store interior cell by name, try to merge with existing parent data. + ESM::Cell *oldcell = const_cast(searchInt(id)); + if (oldcell) { + cell->mContextList.push_back(oldcell->mContextList.at(0)); + delete oldcell; + } intCells[id] = cell; } else { - // Store exterior cells by grid position + // Store exterior cells by grid position, try to merge with existing parent data. + ESM::Cell *oldcell = const_cast(searchExt(cell->getGridX(), cell->getGridY())); + if (oldcell) { + cell->mContextList.push_back(oldcell->mContextList.at(0)); + delete oldcell; + } extCells[std::make_pair (cell->mData.mX, cell->mData.mY)] = cell; } } From 2175f13b67e9075455bc944b0e32cdd0cb9b5ceb Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sat, 17 Nov 2012 00:21:51 +0100 Subject: [PATCH 04/43] - Add tracking for dependencies between plugins. - Add reference number mangling required for moving references around. --- apps/openmw/mwworld/worldimp.cpp | 6 ++++-- components/esm/esmcommon.hpp | 1 + components/esm/esmreader.cpp | 25 +++++++++++++++++++++++++ components/esm/esmreader.hpp | 3 +++ components/esm/loadcell.cpp | 22 ++++++++++++++++++++-- 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index bbc44f5e1..3e23679b1 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -190,8 +190,9 @@ namespace MWWorld // This parses the ESM file ESM::ESMReader lEsm; lEsm.setEncoding(encoding); - lEsm.open (masterPath.string()); lEsm.setIndex(idx); + lEsm.setGlobalReaderList(&mEsm); + lEsm.open (masterPath.string()); mEsm[idx] = lEsm; mStore.load (mEsm[idx]); } @@ -205,8 +206,9 @@ namespace MWWorld // This parses the ESP file ESM::ESMReader lEsm; lEsm.setEncoding(encoding); - lEsm.open (pluginPath.string()); lEsm.setIndex(idx); + lEsm.setGlobalReaderList(&mEsm); + lEsm.open (pluginPath.string()); mEsm[idx] = lEsm; mStore.load (mEsm[idx]); } diff --git a/components/esm/esmcommon.hpp b/components/esm/esmcommon.hpp index d61564c67..335d12337 100644 --- a/components/esm/esmcommon.hpp +++ b/components/esm/esmcommon.hpp @@ -89,6 +89,7 @@ struct MasterData { std::string name; uint64_t size; + int index; // Position of the parent file in the global list of loaded files }; // Data that is only present in save game files diff --git a/components/esm/esmreader.cpp b/components/esm/esmreader.cpp index 2915a1ce7..d1703a2ac 100644 --- a/components/esm/esmreader.cpp +++ b/components/esm/esmreader.cpp @@ -1,5 +1,6 @@ #include "esmreader.hpp" #include +#include namespace ESM { @@ -61,6 +62,7 @@ void ESMReader::openRaw(Ogre::DataStreamPtr _esm, const std::string &name) void ESMReader::open(Ogre::DataStreamPtr _esm, const std::string &name) { openRaw(_esm, name); + std::string fname = boost::filesystem::path(name).filename().string(); if (getRecName() != "TES3") fail("Not a valid Morrowind file"); @@ -78,6 +80,29 @@ void ESMReader::open(Ogre::DataStreamPtr _esm, const std::string &name) MasterData m; m.name = getHString(); m.size = getHNLong("DATA"); + // Cache parent esX files by tracking their indices in the global list of + // all files/readers used by the engine. This will greaty help to accelerate + // parsing of reference IDs. + size_t index = ~0; + // TODO: check for case mismatch, it might be required on Windows. + size_t i = 0; + // FIXME: This is ugly! Make it nicer! + for (; i < idx; i++) { + const std::string &candidate = mGlobalReaderList->at(i).getContext().filename; + std::string fnamecandidate = boost::filesystem::path(candidate).filename().string(); + if (m.name == fnamecandidate) { + index = i; + break; + } + } + if (index == (size_t)~0) { + // Tried to load a parent file that has not been loaded yet. This is bad, + // the launcher should have taken care of this. + std::string fstring = "File " + fname + " asks for parent file " + m.name + + ", but it has not been loaded yet. Please check your load order."; + fail(fstring); + } + m.index = index; mMasters.push_back(m); } diff --git a/components/esm/esmreader.hpp b/components/esm/esmreader.hpp index f09442a57..b415009d3 100644 --- a/components/esm/esmreader.hpp +++ b/components/esm/esmreader.hpp @@ -83,6 +83,8 @@ public: int idx; void setIndex(const int index) {idx = index; mCtx.index = index;} const int getIndex() {return idx;} + + void setGlobalReaderList(std::vector *list) {mGlobalReaderList = list;} /************************************************************************* * @@ -254,6 +256,7 @@ private: SaveData mSaveData; MasterList mMasters; + std::vector *mGlobalReaderList; ToUTF8::FromType mEncoding; }; } diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index beedd3cac..1a1811a90 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -170,8 +170,6 @@ std::string Cell::getDescription() const bool Cell::getNextRef(ESMReader &esm, CellRef &ref) { - // TODO: Add support for multiple plugins. This requires a tricky renaming scheme for "ref.mRefnum". - // I'll probably add something to "ESMReader", we will need one per plugin anyway. // TODO: Try and document reference numbering, I don't think this has been done anywhere else. if (!esm.hasMoreSubs()) return false; @@ -194,6 +192,26 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) // This may require some not-so-small behing-the-scenes updates. esm.getHNT(ref.mRefnum, "FRMR"); ref.mRefID = esm.getHNString("NAME"); + + // Identify references belonging to a parent file and adapt the ID accordingly. + int local = (ref.mRefnum & 0xff000000) >> 24; + size_t global = esm.getIndex() + 1; + if (local) + { + // If the most significant 8 bits are used, then this reference already exists. + // In this case, do not spawn a new reference, but overwrite the old one. + ref.mRefnum &= 0x00ffffff; // delete old plugin ID + const ESM::ESMReader::MasterList &masters = esm.getMasters(); + // TODO: Test how Morrowind does it! Maybe the first entry in the list should be "1"... + global = masters[local-1].index + 1; + ref.mRefnum |= global << 24; // insert global plugin ID + std::cout << "Refnum_old = " << ref.mRefnum << " " << local << " " << global << std::endl; + } + else + { + // This is an addition by the present plugin. Set the corresponding plugin index. + ref.mRefnum |= global << 24; // insert global plugin ID + } // getHNOT will not change the existing value if the subrecord is // missing From 31fb715bd7be529689e66fb9a33fb5c51b105d3d Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sat, 17 Nov 2012 21:50:25 +0100 Subject: [PATCH 05/43] - Add support for moving existing references by plugin files. No cell changing yet. - Change CellRefList::list from list<> to map so we can identify live references by their Refnumber. - Introduce ContainerRefList, a clone of the original CellRefList. It is now used for containers, which do not track Refnumbers. - Many small tweaks so that the new CellRefList does not conflict with existing code. --- apps/openmw/mwworld/cells.cpp | 12 ++--- apps/openmw/mwworld/cellstore.cpp | 6 +-- apps/openmw/mwworld/cellstore.hpp | 47 +++++++++++++++-- apps/openmw/mwworld/containerstore.cpp | 28 +++++----- apps/openmw/mwworld/containerstore.hpp | 72 +++++++++++++------------- apps/openmw/mwworld/localscripts.cpp | 4 +- apps/openmw/mwworld/scene.cpp | 6 +-- apps/openmw/mwworld/worldimp.cpp | 18 +++---- components/esm/loadcell.cpp | 6 +-- components/esm_store/reclists.hpp | 5 +- 10 files changed, 119 insertions(+), 85 deletions(-) diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index e49835f41..667f2d4ca 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -43,30 +43,30 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore) cellStore.containers.list.begin()); iter!=cellStore.containers.list.end(); ++iter) { - Ptr container (&*iter, &cellStore); + Ptr container (&iter->second, &cellStore); Class::get (container).getContainerStore (container).fill ( - iter->base->mInventory, mStore); + iter->second.base->mInventory, mStore); } for (CellRefList::List::iterator iter ( cellStore.creatures.list.begin()); iter!=cellStore.creatures.list.end(); ++iter) { - Ptr container (&*iter, &cellStore); + Ptr container (&iter->second, &cellStore); Class::get (container).getContainerStore (container).fill ( - iter->base->mInventory, mStore); + iter->second.base->mInventory, mStore); } for (CellRefList::List::iterator iter ( cellStore.npcs.list.begin()); iter!=cellStore.npcs.list.end(); ++iter) { - Ptr container (&*iter, &cellStore); + Ptr container (&iter->second, &cellStore); Class::get (container).getContainerStore (container).fill ( - iter->base->mInventory, mStore); + iter->second.base->mInventory, mStore); } } diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 91c0afe26..0af886124 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -65,8 +65,7 @@ namespace MWWorld std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), (int(*)(int)) std::tolower); - // TODO: Fully support deletion / moving references out of the cell. no simple "push_back", - // but make sure that the reference exists only once. + // TODO: Fully support deletion of references. mIds.push_back (lowerCase); } } @@ -98,8 +97,7 @@ namespace MWWorld std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), (int(*)(int)) std::tolower); - // TODO: Fully support deletion / moving references out of the cell. No simple loading, - // but make sure that the reference exists only once. Current code clones references. + // TODO: Fully support deletion of references. int rec = store.find(ref.mRefID); ref.mRefID = lowerCase; diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 69c4cf9b4..236f67231 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -47,6 +47,47 @@ namespace MWWorld /// A list of cell references template struct CellRefList + { + typedef LiveCellRef LiveRef; + typedef std::map List; + List list; + + // Search for the given reference in the given reclist from + // ESMStore. Insert the reference into the list if a match is + // found. If not, throw an exception. + template + void find(ESM::CellRef &ref, const Y& recList) + { + const X* obj = recList.find(ref.mRefID); + if(obj == NULL) + throw std::runtime_error("Error resolving cell reference " + ref.mRefID); + + list[ref.mRefnum] = LiveRef(ref, obj); + } + + LiveRef *find (const std::string& name) + { + for (typename std::map::iterator iter (list.begin()); iter!=list.end(); ++iter) + { + if (iter->second.mData.getCount() > 0 && iter->second.ref.mRefID == name) + return &iter->second; + } + + return 0; + } + + LiveRef &insert(const LiveRef &item) { + list[item.ref.mRefnum] = item; + return list[item.ref.mRefnum]; + } + }; + + /// A list of container references. These references do not track their mRefnumber. + /// Otherwise, taking 1 of 20 instances of an object would produce multiple objects + /// with the same reference. + // TODO: Check how Morrowind does this! Maybe auto-generate references on drop. + template + struct ContainerRefList { typedef LiveCellRef LiveRef; typedef std::list List; @@ -62,10 +103,6 @@ namespace MWWorld if(obj == NULL) throw std::runtime_error("Error resolving cell reference " + ref.mRefID); - // TODO: this line must be modified for multiple plugins and moved references. - // This means: no simple "push back", but search for an existing reference with - // this ID first! If it exists, merge data into this list instead of just adding it. - // I'll probably generate a separate method jist for this. list.push_back(LiveRef(ref, obj)); } @@ -180,7 +217,7 @@ namespace MWWorld { for (typename List::List::iterator iter (list.list.begin()); iter!=list.list.end(); ++iter) - if (!functor (iter->ref, iter->mData)) + if (!functor (iter->second.ref, iter->second.mData)) return false; return true; diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 5c4dd03a4..035f79310 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -19,11 +19,11 @@ namespace { template - float getTotalWeight (const MWWorld::CellRefList& cellRefList) + float getTotalWeight (const MWWorld::ContainerRefList& cellRefList) { float sum = 0; - for (typename MWWorld::CellRefList::List::const_iterator iter ( + for (typename MWWorld::ContainerRefList::List::const_iterator iter ( cellRefList.list.begin()); iter!=cellRefList.list.end(); ++iter) @@ -270,29 +270,29 @@ MWWorld::ContainerStoreIterator::ContainerStoreIterator (int mask, ContainerStor ++*this; } -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Potion), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mPotion(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Apparatus), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mApparatus(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Armor), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mArmor(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Book), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mBook(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Clothing), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mClothing(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Ingredient), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mIngredient(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Light), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLight(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Lockpick), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLockpick(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Miscellaneous), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mMiscellaneous(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Probe), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mProbe(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Repair), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mRepair(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Weapon), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mWeapon(iterator){} void MWWorld::ContainerStoreIterator::incType() diff --git a/apps/openmw/mwworld/containerstore.hpp b/apps/openmw/mwworld/containerstore.hpp index ae27fad3d..9611b9c21 100644 --- a/apps/openmw/mwworld/containerstore.hpp +++ b/apps/openmw/mwworld/containerstore.hpp @@ -37,18 +37,18 @@ namespace MWWorld private: - MWWorld::CellRefList potions; - MWWorld::CellRefList appas; - MWWorld::CellRefList armors; - MWWorld::CellRefList books; - MWWorld::CellRefList clothes; - MWWorld::CellRefList ingreds; - MWWorld::CellRefList lights; - MWWorld::CellRefList lockpicks; - MWWorld::CellRefList miscItems; - MWWorld::CellRefList probes; - MWWorld::CellRefList repairs; - MWWorld::CellRefList weapons; + MWWorld::ContainerRefList potions; + MWWorld::ContainerRefList appas; + MWWorld::ContainerRefList armors; + MWWorld::ContainerRefList books; + MWWorld::ContainerRefList clothes; + MWWorld::ContainerRefList ingreds; + MWWorld::ContainerRefList lights; + MWWorld::ContainerRefList lockpicks; + MWWorld::ContainerRefList miscItems; + MWWorld::ContainerRefList probes; + MWWorld::ContainerRefList repairs; + MWWorld::ContainerRefList weapons; int mStateId; mutable float mCachedWeight; mutable bool mWeightUpToDate; @@ -119,18 +119,18 @@ namespace MWWorld ContainerStore *mContainer; mutable Ptr mPtr; - MWWorld::CellRefList::List::iterator mPotion; - MWWorld::CellRefList::List::iterator mApparatus; - MWWorld::CellRefList::List::iterator mArmor; - MWWorld::CellRefList::List::iterator mBook; - MWWorld::CellRefList::List::iterator mClothing; - MWWorld::CellRefList::List::iterator mIngredient; - MWWorld::CellRefList::List::iterator mLight; - MWWorld::CellRefList::List::iterator mLockpick; - MWWorld::CellRefList::List::iterator mMiscellaneous; - MWWorld::CellRefList::List::iterator mProbe; - MWWorld::CellRefList::List::iterator mRepair; - MWWorld::CellRefList::List::iterator mWeapon; + MWWorld::ContainerRefList::List::iterator mPotion; + MWWorld::ContainerRefList::List::iterator mApparatus; + MWWorld::ContainerRefList::List::iterator mArmor; + MWWorld::ContainerRefList::List::iterator mBook; + MWWorld::ContainerRefList::List::iterator mClothing; + MWWorld::ContainerRefList::List::iterator mIngredient; + MWWorld::ContainerRefList::List::iterator mLight; + MWWorld::ContainerRefList::List::iterator mLockpick; + MWWorld::ContainerRefList::List::iterator mMiscellaneous; + MWWorld::ContainerRefList::List::iterator mProbe; + MWWorld::ContainerRefList::List::iterator mRepair; + MWWorld::ContainerRefList::List::iterator mWeapon; private: @@ -141,18 +141,18 @@ namespace MWWorld ///< Begin-iterator // construct iterator using a CellRefList iterator - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); void incType(); diff --git a/apps/openmw/mwworld/localscripts.cpp b/apps/openmw/mwworld/localscripts.cpp index d0d698feb..1ef1cdeaf 100644 --- a/apps/openmw/mwworld/localscripts.cpp +++ b/apps/openmw/mwworld/localscripts.cpp @@ -15,9 +15,9 @@ namespace cellRefList.list.begin()); iter!=cellRefList.list.end(); ++iter) { - if (!iter->base->mScript.empty() && iter->mData.getCount()) + if (!iter->second.base->mScript.empty() && iter->second.mData.getCount()) { - localScripts.add (iter->base->mScript, MWWorld::Ptr (&*iter, cell)); + localScripts.add (iter->second.base->mScript, MWWorld::Ptr (&iter->second, cell)); } } } diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 881b090fa..b6add7fbf 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -23,7 +23,7 @@ namespace if (!cellRefList.list.empty()) { const MWWorld::Class& class_ = - MWWorld::Class::get (MWWorld::Ptr (&*cellRefList.list.begin(), &cell)); + MWWorld::Class::get (MWWorld::Ptr (&cellRefList.list.begin()->second, &cell)); int numRefs = cellRefList.list.size(); int current = 0; @@ -33,9 +33,9 @@ namespace MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 1, current, numRefs); ++current; - if (it->mData.getCount() || it->mData.isEnabled()) + if (it->second.mData.getCount() || it->second.mData.isEnabled()) { - MWWorld::Ptr ptr (&*it, &cell); + MWWorld::Ptr ptr (&it->second, &cell); try { diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 3e23679b1..e999100f0 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -28,13 +28,13 @@ namespace cellRefList.list.begin()); iter!=cellRefList.list.end(); ++iter) { - if (!iter->base->script.empty() && iter->mData.getCount()) + if (!iter->second->base->script.empty() && iter->second->mData.getCount()) { - if (const ESM::Script *script = store.scripts.find (iter->base->script)) + if (const ESM::Script *script = store.scripts.find (iter->second->base->script)) { iter->mData.setLocals (*script); - localScripts.add (iter->base->script, MWWorld::Ptr (&*iter, cell)); + localScripts.add (iter->base->script, MWWorld::Ptr (&iter->second, cell)); } } } @@ -48,10 +48,10 @@ namespace for (iterator iter (refList.list.begin()); iter!=refList.list.end(); ++iter) { - if(iter->mData.getCount() > 0 && iter->mData.getBaseNode()){ - if (iter->mData.getHandle()==handle) + if (iter->second.mData.getCount() > 0 && iter->second.mData.getBaseNode()){ + if (iter->second.mData.getHandle()==handle) { - return &*iter; + return &iter->second; } } } @@ -1115,10 +1115,10 @@ namespace MWWorld std::vector result; MWWorld::CellRefList& doors = cell->doors; - std::list< MWWorld::LiveCellRef >& refList = doors.list; - for (std::list< MWWorld::LiveCellRef >::iterator it = refList.begin(); it != refList.end(); ++it) + std::map >& refList = doors.list; + for (std::map >::iterator it = refList.begin(); it != refList.end(); ++it) { - MWWorld::LiveCellRef& ref = *it; + MWWorld::LiveCellRef& ref = it->second; if (ref.ref.mTeleport) { diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index 1a1811a90..b7f27b08d 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -113,8 +113,6 @@ void Cell::load(ESMReader &esm) // Save position of the cell references and move on mContextList.push_back(esm.getContext()); - if (mContextList.size() > 1) - std::cout << "found two plugins" << std::endl; esm.skipRecord(); } @@ -202,10 +200,8 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) // In this case, do not spawn a new reference, but overwrite the old one. ref.mRefnum &= 0x00ffffff; // delete old plugin ID const ESM::ESMReader::MasterList &masters = esm.getMasters(); - // TODO: Test how Morrowind does it! Maybe the first entry in the list should be "1"... global = masters[local-1].index + 1; ref.mRefnum |= global << 24; // insert global plugin ID - std::cout << "Refnum_old = " << ref.mRefnum << " " << local << " " << global << std::endl; } else { @@ -256,7 +252,7 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) esm.getHNOT(ref.mFltv, "FLTV"); esm.getHNT(ref.mPos, "DATA", 24); - + // Number of references in the cell? Maximum once in each cell, // but not always at the beginning, and not always right. In other // words, completely useless. diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp index 44b7e6569..14452fca9 100644 --- a/components/esm_store/reclists.hpp +++ b/components/esm_store/reclists.hpp @@ -523,7 +523,10 @@ namespace ESMS // Store exterior cells by grid position, try to merge with existing parent data. ESM::Cell *oldcell = const_cast(searchExt(cell->getGridX(), cell->getGridY())); if (oldcell) { - cell->mContextList.push_back(oldcell->mContextList.at(0)); + // The load order is important. Push the new source context on the *back* of the existing list, + // and then move the list to the new cell. + oldcell->mContextList.push_back(cell->mContextList.at(0)); + cell->mContextList = oldcell->mContextList; delete oldcell; } extCells[std::make_pair (cell->mData.mX, cell->mData.mY)] = cell; From 896ab44d1e919852aae03be9ecb71378f031b6f5 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sun, 25 Nov 2012 17:19:29 +0100 Subject: [PATCH 06/43] - Add some updated files missing from last commit. - Move plugin dependency test from esmreader.cpp to esmstpre.cpp; fixes crash in omwlauncher. --- apps/openmw/CMakeLists.txt | 7 ++-- apps/openmw/mwrender/terrain.cpp | 2 +- apps/openmw/mwworld/cellstore.cpp | 8 ++-- apps/openmw/mwworld/cellstore.hpp | 28 ++++++++------ apps/openmw/mwworld/esmstore.cpp | 29 ++++++++++++++ apps/openmw/mwworld/store.hpp | 64 +++++++++++++++++++++---------- apps/openmw/mwworld/worldimp.cpp | 4 +- components/esm/esmreader.cpp | 25 ------------ components/esm/esmreader.hpp | 1 + 9 files changed, 102 insertions(+), 66 deletions(-) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 538f63dc9..e2a2e7f14 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -34,7 +34,7 @@ add_openmw_dir (mwgui ) add_openmw_dir (mwdialogue - dialoguemanagerimp journalimp journalentry quest topic + dialoguemanagerimp journalimp journalentry quest topic filter selectwrapper ) add_openmw_dir (mwscript @@ -50,9 +50,10 @@ add_openmw_dir (mwsound add_openmw_dir (mwworld refdata worldimp physicssystem scene globals class action nullaction actionteleport - containerstore actiontalk actiontake manualref player cellfunctors + containerstore actiontalk actiontake manualref player cellfunctors failedaction cells localscripts customdata weather inventorystore ptr actionopen actionread actionequip timestamp actionalchemy cellstore actionapply actioneat + esmstore store recordcmp ) add_openmw_dir (mwclass @@ -62,7 +63,7 @@ add_openmw_dir (mwclass add_openmw_dir (mwmechanics mechanicsmanagerimp stat creaturestats magiceffects movement actors drawstate spells - activespells npcstats aipackage aisequence alchemy + activespells npcstats aipackage aisequence alchemy aiwander aitravel aifollow aiescort aiactivate ) add_openmw_dir (mwbase diff --git a/apps/openmw/mwrender/terrain.cpp b/apps/openmw/mwrender/terrain.cpp index d46c2521f..eb5b07af4 100644 --- a/apps/openmw/mwrender/terrain.cpp +++ b/apps/openmw/mwrender/terrain.cpp @@ -221,7 +221,7 @@ namespace MWRender // //If we don't sort the ltex indexes, the splatting order may differ between //cells which may lead to inconsistent results when shading between cells - int num = MWBase::Environment::get().getWorld()->getStore().landTexts.getSizePlugin(plugin); + int num = MWBase::Environment::get().getWorld()->getStore().get().getSize(plugin); std::set ltexIndexes; for ( int y = fromY - 1; y < fromY + size + 1; y++ ) { diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 74856c9ed..ba8f5aa61 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -49,10 +49,10 @@ namespace MWWorld return; // this is a dynamically generated cell -> skipping. // Load references from all plugins that do something with this cell. - for (size_t i = 0; i < cell->mContextList.size(); i++) + for (size_t i = 0; i < mCell->mContextList.size(); i++) { // Reopen the ESM reader and seek to the right position. - int index = cell->mContextList.at(i).index; + int index = mCell->mContextList.at(i).index; mCell->restore (esm[index], i); ESM::CellRef ref; @@ -81,10 +81,10 @@ namespace MWWorld return; // this is a dynamically generated cell -> skipping. // Load references from all plugins that do something with this cell. - for (size_t i = 0; i < cell->mContextList.size(); i++) + for (size_t i = 0; i < mCell->mContextList.size(); i++) { // Reopen the ESM reader and seek to the right position. - int index = cell->mContextList.at(i).index; + int index = mCell->mContextList.at(i).index; mCell->restore (esm[index], i); ESM::CellRef ref; diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index b66137cc6..bf7581f6e 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -49,26 +49,32 @@ namespace MWWorld { typedef LiveCellRef LiveRef; typedef std::map List; - List list; + List mList; // Search for the given reference in the given reclist from // ESMStore. Insert the reference into the list if a match is // found. If not, throw an exception. - template - void find(ESM::CellRef &ref, const Y& recList) + /// Searches for reference of appropriate type in given ESMStore. + /// If reference exists, loads it into container, throws an exception + /// on miss + void load(ESM::CellRef &ref, const MWWorld::ESMStore &esmStore) { - const X* obj = recList.find(ref.mRefID); - if(obj == NULL) - throw std::runtime_error("Error resolving cell reference " + ref.mRefID); + // for throwing exception on unhandled record type + const MWWorld::Store &store = esmStore.get(); + const X *ptr = store.find(ref.mRefID); - list[ref.mRefnum] = LiveRef(ref, obj); + /// \note redundant because Store::find() throws exception on miss + if (ptr == NULL) { + throw std::runtime_error("Error resolving cell reference " + ref.mRefID); + } + mList[ref.mRefnum] = LiveRef(ref, ptr); } LiveRef *find (const std::string& name) { - for (typename std::map::iterator iter (list.begin()); iter!=list.end(); ++iter) + for (typename std::map::iterator iter (mList.begin()); iter!=mList.end(); ++iter) { - if (iter->second.mData.getCount() > 0 && iter->second.ref.mRefID == name) + if (iter->second.mData.getCount() > 0 && iter->second.mRef.mRefID == name) return &iter->second; } @@ -76,8 +82,8 @@ namespace MWWorld } LiveRef &insert(const LiveRef &item) { - list[item.ref.mRefnum] = item; - return list[item.ref.mRefnum]; + mList[item.mRef.mRefnum] = item; + return mList[item.mRef.mRefnum]; } }; diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 73f5185c9..db444153f 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -3,6 +3,8 @@ #include #include +#include + namespace MWWorld { @@ -25,6 +27,33 @@ void ESMStore::load(ESM::ESMReader &esm) ESM::Dialogue *dialogue = 0; + // Cache parent esX files by tracking their indices in the global list of + // all files/readers used by the engine. This will greaty help to accelerate + // parsing of reference IDs. + size_t index = ~0; + const ESM::ESMReader::MasterList &masters = esm.getMasters(); + std::vector *allPlugins = esm.getGlobalReaderList(); + for (size_t j = 0; j < masters.size(); j++) { + ESM::MasterData &mast = const_cast(masters[j]); + std::string fname = mast.name; + for (size_t i = 0; i < esm.getIndex(); i++) { + const std::string &candidate = allPlugins->at(i).getContext().filename; + std::string fnamecandidate = boost::filesystem::path(candidate).filename().string(); + if (fname == fnamecandidate) { + index = i; + break; + } + } + if (index == (size_t)~0) { + // Tried to load a parent file that has not been loaded yet. This is bad, + // the launcher should have taken care of this. + std::string fstring = "File " + fname + " asks for parent file " + masters[j].name + + ", but it has not been loaded yet. Please check your load order."; + esm.fail(fstring); + } + mast.index = index; + } + // Loop through all records while(esm.hasMoreRecs()) { diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index fd93f39f1..53f4482bb 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -219,24 +219,31 @@ namespace MWWorld template <> class Store : public StoreBase { - std::vector mStatic; + // For multiple ESM/ESP files we need one list per file. + typedef std::vector LandTextureList; + std::vector mStatic; public: Store() { - mStatic.reserve(128); + mStatic.push_back(LandTextureList()); + LandTextureList <exl = mStatic[0]; + // More than enough to hold Morrowind.esm. Extra lists for plugins will we + // added on-the-fly in a different method. + ltexl.reserve(128); } typedef std::vector::const_iterator iterator; - const ESM::LandTexture *search(size_t index) const { - if (index < mStatic.size()) { - return &mStatic.at(index); - } - return 0; + const ESM::LandTexture *search(size_t index, size_t plugin) const { + assert(plugin < mStatic.size()); + const LandTextureList <exl = mStatic[plugin]; + + assert(index < ltexl.size()); + return <exl.at(index); } - const ESM::LandTexture *find(size_t index) const { - const ESM::LandTexture *ptr = search(index); + const ESM::LandTexture *find(size_t index, size_t plugin) const { + const ESM::LandTexture *ptr = search(index, plugin); if (ptr == 0) { std::ostringstream msg; msg << "Land texture with index " << index << " not found"; @@ -249,23 +256,40 @@ namespace MWWorld return mStatic.size(); } - void load(ESM::ESMReader &esm, const std::string &id) { - ESM::LandTexture ltex; - ltex.load(esm); + int getSize(size_t plugin) const { + assert(plugin < mStatic.size()); + return mStatic[plugin].size(); + } - if (ltex.mIndex >= (int) mStatic.size()) { - mStatic.resize(ltex.mIndex + 1); + void load(ESM::ESMReader &esm, const std::string &id, size_t plugin) { + ESM::LandTexture lt; + lt.load(esm); + lt.mId = id; + + // Make sure we have room for the structure + if (plugin >= mStatic.size()) { + mStatic.resize(plugin+1); } - mStatic[ltex.mIndex] = ltex; - mStatic[ltex.mIndex].mId = id; + LandTextureList <exl = mStatic[plugin]; + if(lt.mIndex + 1 > (int)ltexl.size()) + ltexl.resize(lt.mIndex+1); + + // Store it + ltexl[lt.mIndex] = lt; } - iterator begin() const { - return mStatic.begin(); + void load(ESM::ESMReader &esm, const std::string &id) { + load(esm, id, esm.getIndex()); } - iterator end() const { - return mStatic.end(); + iterator begin(size_t plugin) const { + assert(plugin < mStatic.size()); + return mStatic[plugin].begin(); + } + + iterator end(size_t plugin) const { + assert(plugin < mStatic.size()); + return mStatic[plugin].end(); } }; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 9f2d419f1..1fa23700d 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1081,8 +1081,8 @@ namespace MWWorld std::vector result; MWWorld::CellRefList& doors = cell->mDoors; - std::map< MWWorld::LiveCellRef >& refList = doors.mList; - for (std::map >::iterator it = refList.begin(); it != refList.end(); ++it) + CellRefList::List& refList = doors.mList; + for (CellRefList::List::iterator it = refList.begin(); it != refList.end(); ++it) { MWWorld::LiveCellRef& ref = it->second; diff --git a/components/esm/esmreader.cpp b/components/esm/esmreader.cpp index d1703a2ac..2915a1ce7 100644 --- a/components/esm/esmreader.cpp +++ b/components/esm/esmreader.cpp @@ -1,6 +1,5 @@ #include "esmreader.hpp" #include -#include namespace ESM { @@ -62,7 +61,6 @@ void ESMReader::openRaw(Ogre::DataStreamPtr _esm, const std::string &name) void ESMReader::open(Ogre::DataStreamPtr _esm, const std::string &name) { openRaw(_esm, name); - std::string fname = boost::filesystem::path(name).filename().string(); if (getRecName() != "TES3") fail("Not a valid Morrowind file"); @@ -80,29 +78,6 @@ void ESMReader::open(Ogre::DataStreamPtr _esm, const std::string &name) MasterData m; m.name = getHString(); m.size = getHNLong("DATA"); - // Cache parent esX files by tracking their indices in the global list of - // all files/readers used by the engine. This will greaty help to accelerate - // parsing of reference IDs. - size_t index = ~0; - // TODO: check for case mismatch, it might be required on Windows. - size_t i = 0; - // FIXME: This is ugly! Make it nicer! - for (; i < idx; i++) { - const std::string &candidate = mGlobalReaderList->at(i).getContext().filename; - std::string fnamecandidate = boost::filesystem::path(candidate).filename().string(); - if (m.name == fnamecandidate) { - index = i; - break; - } - } - if (index == (size_t)~0) { - // Tried to load a parent file that has not been loaded yet. This is bad, - // the launcher should have taken care of this. - std::string fstring = "File " + fname + " asks for parent file " + m.name - + ", but it has not been loaded yet. Please check your load order."; - fail(fstring); - } - m.index = index; mMasters.push_back(m); } diff --git a/components/esm/esmreader.hpp b/components/esm/esmreader.hpp index b415009d3..732dbe9bc 100644 --- a/components/esm/esmreader.hpp +++ b/components/esm/esmreader.hpp @@ -85,6 +85,7 @@ public: const int getIndex() {return idx;} void setGlobalReaderList(std::vector *list) {mGlobalReaderList = list;} + std::vector *getGlobalReaderList() {return mGlobalReaderList;} /************************************************************************* * From b103426cf0f1a45efa97ca4d3cf215ee8640dc4f Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sun, 25 Nov 2012 19:07:16 +0100 Subject: [PATCH 07/43] - Partially reimplement deleting objects defined in a parent esX file. - Try to reimplement multiple esX files dropping references in the same file. NOTE: None of these features works. Maybe the code itself does not build. Anyway, after 12 hours of hacking, I am just tired and want to get a snapshot of the code out. --- apps/openmw/mwworld/cellstore.cpp | 2 ++ apps/openmw/mwworld/esmstore.cpp | 11 ++++++- apps/openmw/mwworld/esmstore.hpp | 3 +- apps/openmw/mwworld/store.hpp | 48 ++++++++++++++++++++++++++----- apps/openmw/mwworld/worldimp.cpp | 2 ++ components/esm/loadcell.cpp | 1 + 6 files changed, 58 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index ba8f5aa61..ff8368dd1 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -83,6 +83,8 @@ namespace MWWorld // Load references from all plugins that do something with this cell. for (size_t i = 0; i < mCell->mContextList.size(); i++) { + if (mCell->mContextList.size() > 1) + std::cout << "number of lists " << mCell->mContextList.size() << std::endl; // Reopen the ESM reader and seek to the right position. int index = mCell->mContextList.at(i).index; mCell->restore (esm[index], i); diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index db444153f..564126797 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -84,6 +84,15 @@ void ESMStore::load(ESM::ESMReader &esm) } else { // Load it std::string id = esm.getHNOString("NAME"); + // ... unless it got deleted! This means that the following record + // has been deleted, and trying to load it using standard assumptions + // on the structure will (probably) fail. + if (esm.isNextSub("DELE")) { + esm.skipRecord(); + all.erase(id); + it->second->remove(id); + continue; + } it->second->load(esm, id); if (n.val==ESM::REC_DIAL) { @@ -113,7 +122,7 @@ void ESMStore::load(ESM::ESMReader &esm) cout << *it << " "; cout << endl; */ - setUp(); + //setUp(); } void ESMStore::setUp() diff --git a/apps/openmw/mwworld/esmstore.hpp b/apps/openmw/mwworld/esmstore.hpp index 9917254ee..bd8e003f4 100644 --- a/apps/openmw/mwworld/esmstore.hpp +++ b/apps/openmw/mwworld/esmstore.hpp @@ -168,7 +168,8 @@ namespace MWWorld return ptr; } - private: + // This method must be called once, after loading all master/plugin files. This can only be done + // from the outside, so it must be public. void setUp(); }; diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 53f4482bb..d4d632eff 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -473,14 +473,48 @@ namespace MWWorld } void load(ESM::ESMReader &esm, const std::string &id) { - ESM::Cell cell; - cell.mName = id; - cell.load(esm); + // Don't automatically assume that a new cell must be spawned. Multiple plugins write to the same cell, + // and we merge all this data into one Cell object. However, we can't simply search for the cell id, + // as many exterior cells do not have a name. Instead, we need to search by (x,y) coordinates - and they + // are not available until both cells have been loaded! So first, proceed as usual. + + // All cells have a name record, even nameless exterior cells. + ESM::Cell *cell = new ESM::Cell; + cell->mName = id; - if (cell.isExterior()) { - mExt.push_back(cell); - } else { - mInt.push_back(cell); + // The cell itself takes care of all the hairy details + cell->load(esm); + + if(cell->mData.mFlags & ESM::Cell::Interior) + { + // Store interior cell by name, try to merge with existing parent data. + ESM::Cell *oldcell = const_cast(search(id)); + if (oldcell) { + // push the new references on the list of references to manage + oldcell->mContextList.push_back(cell->mContextList.at(0)); + // copy list into new cell + cell->mContextList = oldcell->mContextList; + // have new cell replace old cell + *oldcell = *cell; + } else + mInt.push_back(*cell); + delete cell; + } + else + { + // Store exterior cells by grid position, try to merge with existing parent data. + ESM::Cell *oldcell = const_cast(search(cell->getGridX(), cell->getGridY())); + std::cout << "setup - " << oldcell << " " << cell->getGridX() << " " << cell->getGridY() << std::endl; + if (oldcell) { + // push the new references on the list of references to manage + oldcell->mContextList.push_back(cell->mContextList.at(0)); + // copy list into new cell + cell->mContextList = oldcell->mContextList; + // have new cell replace old cell + *oldcell = *cell; + } else + mExt.push_back(*cell); + delete cell; } } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 1fa23700d..6dbba2a45 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -215,6 +215,8 @@ namespace MWWorld mEsm[idx] = lEsm; mStore.load (mEsm[idx]); } + + mStore.setUp(); mPlayer = new MWWorld::Player (mStore.get().find ("player"), *this); mRendering->attachCameraTo(mPlayer->getPlayer()); diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index b7f27b08d..0158af70a 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -201,6 +201,7 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) ref.mRefnum &= 0x00ffffff; // delete old plugin ID const ESM::ESMReader::MasterList &masters = esm.getMasters(); global = masters[local-1].index + 1; + std::cout << "moved ref: " << local << " " << global << std::endl; ref.mRefnum |= global << 24; // insert global plugin ID } else From 049b0e66e0e63e5ac9c9ebdb837c371964ae856b Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Tue, 25 Dec 2012 20:27:30 +0100 Subject: [PATCH 08/43] - Restore ability to generate references in the same cell from multiple plugins - Disable some code related to deleting entries in the store so that it builds again --- apps/openmw/mwworld/cellstore.cpp | 2 -- apps/openmw/mwworld/esmstore.cpp | 2 ++ apps/openmw/mwworld/store.hpp | 48 +++++++++++++++---------------- components/esm/loadcell.cpp | 1 - 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index ff8368dd1..ba8f5aa61 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -83,8 +83,6 @@ namespace MWWorld // Load references from all plugins that do something with this cell. for (size_t i = 0; i < mCell->mContextList.size(); i++) { - if (mCell->mContextList.size() > 1) - std::cout << "number of lists " << mCell->mContextList.size() << std::endl; // Reopen the ESM reader and seek to the right position. int index = mCell->mContextList.at(i).index; mCell->restore (esm[index], i); diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 564126797..b1b9b1534 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -87,12 +87,14 @@ void ESMStore::load(ESM::ESMReader &esm) // ... unless it got deleted! This means that the following record // has been deleted, and trying to load it using standard assumptions // on the structure will (probably) fail. + /* if (esm.isNextSub("DELE")) { esm.skipRecord(); all.erase(id); it->second->remove(id); continue; } + */ it->second->load(esm, id); if (n.val==ESM::REC_DIAL) { diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index d4d632eff..fd3e9c59c 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -371,15 +371,15 @@ namespace MWWorld } }; - std::vector mInt; - std::vector mExt; + typedef std::map DynamicInt; + typedef std::map, ESM::Cell> DynamicExt; + + DynamicInt mInt; + DynamicExt mExt; std::vector mSharedInt; std::vector mSharedExt; - typedef std::map DynamicInt; - typedef std::map, ESM::Cell> DynamicExt; - DynamicInt mDynamicInt; DynamicExt mDynamicExt; @@ -401,11 +401,10 @@ namespace MWWorld ESM::Cell cell; cell.mName = StringUtils::lowerCase(id); - std::vector::const_iterator it = - std::lower_bound(mInt.begin(), mInt.end(), cell, RecordCmp()); + std::map::const_iterator it = mInt.find(cell.mName); - if (it != mInt.end() && StringUtils::ciEqual(it->mName, id)) { - return &(*it); + if (it != mInt.end() && StringUtils::ciEqual(it->second.mName, id)) { + return &(it->second); } DynamicInt::const_iterator dit = mDynamicInt.find(cell.mName); @@ -420,14 +419,12 @@ namespace MWWorld ESM::Cell cell; cell.mData.mX = x, cell.mData.mY = y; - std::vector::const_iterator it = - std::lower_bound(mExt.begin(), mExt.end(), cell, ExtCmp()); - - if (it != mExt.end() && it->mData.mX == x && it->mData.mY == y) { - return &(*it); + std::pair key(x, y); + std::map, ESM::Cell>::const_iterator it = mExt.find(key); + if (it != mExt.end()) { + return &(it->second); } - std::pair key(x, y); DynamicExt::const_iterator dit = mDynamicExt.find(key); if (dit != mDynamicExt.end()) { return &dit->second; @@ -457,18 +454,20 @@ namespace MWWorld } void setUp() { - typedef std::vector::iterator Iterator; + //typedef std::vector::iterator Iterator; + typedef std::map, ESM::Cell>::iterator ExtIterator; + typedef std::map::iterator IntIterator; - std::sort(mInt.begin(), mInt.end(), RecordCmp()); + //std::sort(mInt.begin(), mInt.end(), RecordCmp()); mSharedInt.reserve(mInt.size()); - for (Iterator it = mInt.begin(); it != mInt.end(); ++it) { - mSharedInt.push_back(&(*it)); + for (IntIterator it = mInt.begin(); it != mInt.end(); ++it) { + mSharedInt.push_back(&(it->second)); } - std::sort(mExt.begin(), mExt.end(), ExtCmp()); + //std::sort(mExt.begin(), mExt.end(), ExtCmp()); mSharedExt.reserve(mExt.size()); - for (Iterator it = mExt.begin(); it != mExt.end(); ++it) { - mSharedExt.push_back(&(*it)); + for (ExtIterator it = mExt.begin(); it != mExt.end(); ++it) { + mSharedExt.push_back(&(it->second)); } } @@ -497,14 +496,13 @@ namespace MWWorld // have new cell replace old cell *oldcell = *cell; } else - mInt.push_back(*cell); + mInt[cell->mName] = *cell; delete cell; } else { // Store exterior cells by grid position, try to merge with existing parent data. ESM::Cell *oldcell = const_cast(search(cell->getGridX(), cell->getGridY())); - std::cout << "setup - " << oldcell << " " << cell->getGridX() << " " << cell->getGridY() << std::endl; if (oldcell) { // push the new references on the list of references to manage oldcell->mContextList.push_back(cell->mContextList.at(0)); @@ -513,7 +511,7 @@ namespace MWWorld // have new cell replace old cell *oldcell = *cell; } else - mExt.push_back(*cell); + mExt[std::make_pair(cell->mData.mX, cell->mData.mY)] = *cell; delete cell; } } diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index 0158af70a..b7f27b08d 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -201,7 +201,6 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) ref.mRefnum &= 0x00ffffff; // delete old plugin ID const ESM::ESMReader::MasterList &masters = esm.getMasters(); global = masters[local-1].index + 1; - std::cout << "moved ref: " << local << " " << global << std::endl; ref.mRefnum |= global << 24; // insert global plugin ID } else From 8ccec174811ccb3a58d1289531a0e29783f99602 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Wed, 26 Dec 2012 10:34:59 +0100 Subject: [PATCH 09/43] - Restore ability for plugins deleting records defined in parent files - Don't throw a runtime_error when trying to load a reference based on a deleted record (just a warning for now, should be closer to MW) --- apps/openmw/mwworld/cellstore.hpp | 11 +++--- apps/openmw/mwworld/esmstore.cpp | 15 ++++---- apps/openmw/mwworld/store.hpp | 58 ++++++++++++++++++++----------- 3 files changed, 50 insertions(+), 34 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index bf7581f6e..cf09496e8 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -61,13 +61,14 @@ namespace MWWorld { // for throwing exception on unhandled record type const MWWorld::Store &store = esmStore.get(); - const X *ptr = store.find(ref.mRefID); + const X *ptr = store.search(ref.mRefID); - /// \note redundant because Store::find() throws exception on miss + /// \note no longer redundant - changed to Store::search(), don't throw + /// an exception on miss, try to continue (that's how MW does it, anyway) if (ptr == NULL) { - throw std::runtime_error("Error resolving cell reference " + ref.mRefID); - } - mList[ref.mRefnum] = LiveRef(ref, ptr); + std::cout << "Warning: could not resolve cell reference " << ref.mRefID << ", trying to continue anyway" << std::endl; + } else + mList[ref.mRefnum] = LiveRef(ref, ptr); } LiveRef *find (const std::string& name) diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index b1b9b1534..54050b38c 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -87,20 +87,18 @@ void ESMStore::load(ESM::ESMReader &esm) // ... unless it got deleted! This means that the following record // has been deleted, and trying to load it using standard assumptions // on the structure will (probably) fail. - /* if (esm.isNextSub("DELE")) { esm.skipRecord(); - all.erase(id); - it->second->remove(id); + it->second->eraseStatic(id); continue; } - */ it->second->load(esm, id); if (n.val==ESM::REC_DIAL) { // dirty hack, but it is better than non-const search() // or friends - dialogue = &mDialogs.mStatic.back(); + //dialogue = &mDialogs.mStatic.back(); + dialogue = const_cast(mDialogs.find(id)); assert (dialogue->mId == id); } else { dialogue = 0; @@ -140,12 +138,11 @@ void ESMStore::setUp() ESM::NPC item; item.mId = "player"; - std::vector::iterator pIt = - std::lower_bound(mNpcs.mStatic.begin(), mNpcs.mStatic.end(), item, RecordCmp()); - assert(pIt != mNpcs.mStatic.end() && pIt->mId == "player"); + const ESM::NPC *pIt = mNpcs.find("player"); + assert(pIt != NULL); mNpcs.insert(*pIt); - mNpcs.mStatic.erase(pIt); + mNpcs.eraseStatic(pIt->mId); } } // end namespace diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index fd3e9c59c..77c9c7357 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -19,6 +19,8 @@ namespace MWWorld virtual int getSize() const = 0; virtual void load(ESM::ESMReader &esm, const std::string &id) = 0; + + virtual bool eraseStatic(const std::string &id) {return false;} }; template @@ -85,7 +87,7 @@ namespace MWWorld template class Store : public StoreBase { - std::vector mStatic; + std::map mStatic; std::vector mShared; std::map mDynamic; @@ -107,11 +109,10 @@ namespace MWWorld T item; item.mId = StringUtils::lowerCase(id); - typename std::vector::const_iterator it = - std::lower_bound(mStatic.begin(), mStatic.end(), item, RecordCmp()); - - if (it != mStatic.end() && StringUtils::ciEqual(it->mId, id)) { - return &(*it); + typename std::map::const_iterator it = mStatic.find(item.mId); + + if (it != mStatic.end() && StringUtils::ciEqual(it->second.mId, id)) { + return &(it->second); } typename Dynamic::const_iterator dit = mDynamic.find(item.mId); @@ -133,18 +134,19 @@ namespace MWWorld } void load(ESM::ESMReader &esm, const std::string &id) { - mStatic.push_back(T()); - mStatic.back().mId = StringUtils::lowerCase(id); - mStatic.back().load(esm); + std::string idLower = StringUtils::lowerCase(id); + mStatic[idLower] = T(); + mStatic[idLower].mId = idLower; + mStatic[idLower].load(esm); } void setUp() { - std::sort(mStatic.begin(), mStatic.end(), RecordCmp()); + //std::sort(mStatic.begin(), mStatic.end(), RecordCmp()); mShared.reserve(mStatic.size()); - typename std::vector::iterator it = mStatic.begin(); + typename std::map::iterator it = mStatic.begin(); for (; it != mStatic.end(); ++it) { - mShared.push_back(&(*it)); + mShared.push_back(&(it->second)); } } @@ -181,6 +183,19 @@ namespace MWWorld return ptr; } + bool eraseStatic(const std::string &id) { + T item; + item.mId = StringUtils::lowerCase(id); + + typename std::map::const_iterator it = mStatic.find(item.mId); + + if (it != mStatic.end() && StringUtils::ciEqual(it->second.mId, id)) { + mStatic.erase(it); + } + + return true; + } + bool erase(const std::string &id) { std::string key = StringUtils::lowerCase(id); typename Dynamic::iterator it = mDynamic.find(key); @@ -204,16 +219,18 @@ namespace MWWorld template <> inline void Store::load(ESM::ESMReader &esm, const std::string &id) { - mStatic.push_back(ESM::Dialogue()); - mStatic.back().mId = id; - mStatic.back().load(esm); + std::string idLower = StringUtils::lowerCase(id); + mStatic[idLower] = ESM::Dialogue(); + mStatic[idLower].mId = id; // don't smash case here, as this line is printed... I think + mStatic[idLower].load(esm); } template <> inline void Store::load(ESM::ESMReader &esm, const std::string &id) { - mStatic.push_back(ESM::Script()); - mStatic.back().load(esm); - StringUtils::toLower(mStatic.back().mId); + ESM::Script scpt; + scpt.load(esm); + StringUtils::toLower(scpt.mId); + mStatic[scpt.mId] = scpt; } template <> @@ -478,6 +495,7 @@ namespace MWWorld // are not available until both cells have been loaded! So first, proceed as usual. // All cells have a name record, even nameless exterior cells. + std::string idLower = StringUtils::lowerCase(id); ESM::Cell *cell = new ESM::Cell; cell->mName = id; @@ -487,7 +505,7 @@ namespace MWWorld if(cell->mData.mFlags & ESM::Cell::Interior) { // Store interior cell by name, try to merge with existing parent data. - ESM::Cell *oldcell = const_cast(search(id)); + ESM::Cell *oldcell = const_cast(search(idLower)); if (oldcell) { // push the new references on the list of references to manage oldcell->mContextList.push_back(cell->mContextList.at(0)); @@ -496,7 +514,7 @@ namespace MWWorld // have new cell replace old cell *oldcell = *cell; } else - mInt[cell->mName] = *cell; + mInt[idLower] = *cell; delete cell; } else From 2cef65a056d7d67ba5f6607efefeeb18bef43e24 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Thu, 27 Dec 2012 20:11:58 +0100 Subject: [PATCH 10/43] - Remove some files that are no longer in upstream/master --- components/esm_store/reclists.hpp | 735 ------------------------------ components/esm_store/store.cpp | 124 ----- 2 files changed, 859 deletions(-) delete mode 100644 components/esm_store/reclists.hpp delete mode 100644 components/esm_store/store.cpp diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp deleted file mode 100644 index 14452fca9..000000000 --- a/components/esm_store/reclists.hpp +++ /dev/null @@ -1,735 +0,0 @@ -#ifndef _GAME_ESM_RECLISTS_H -#define _GAME_ESM_RECLISTS_H - -#include "components/esm/records.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -using namespace boost::algorithm; - -namespace ESMS -{ - using namespace ESM; - - struct RecList - { - virtual ~RecList() {} - - virtual void load(ESMReader &esm, const std::string &id) = 0; - virtual int getSize() = 0; - virtual void remove(const std::string &id) {}; - virtual void listIdentifier (std::vector& identifier) const = 0; - - static std::string toLower (const std::string& name) - { - std::string lowerCase; - - std::transform (name.begin(), name.end(), std::back_inserter (lowerCase), - (int(*)(int)) std::tolower); - - return lowerCase; - } - }; - - typedef std::map RecListList; - - template - struct RecListT : RecList - { - virtual ~RecListT() {} - - typedef std::map MapType; - - MapType list; - - // Load one object of this type - void load(ESMReader &esm, const std::string &id) - { - std::string id2 = toLower (id); - list[id2].load(esm); - } - - // Delete the given object ID. Plugin files support this, so we need to do this, too. - void remove(const std::string &id) - { - std::string id2 = toLower (id); - - list.erase(id2); - } - - // Find the given object ID, or return NULL if not found. - const X* search(const std::string &id) const - { - std::string id2 = toLower (id); - - typename MapType::const_iterator iter = list.find (id2); - - if (iter == list.end()) - return NULL; - - return &iter->second; - } - - // Find the given object ID (throws an exception if not found) - const X* find(const std::string &id) const - { - const X *object = search (id); - - if (!object) - throw std::runtime_error ("object " + id + " not found"); - - return object; - } - - int getSize() { return list.size(); } - - virtual void listIdentifier (std::vector& identifier) const - { - for (typename MapType::const_iterator iter (list.begin()); iter!=list.end(); ++iter) - identifier.push_back (iter->first); - } - }; - - // Same as RecListT, but does not case-smash the IDs - // Note that lookups (search or find) are still case insensitive - template - struct RecListCaseT : RecList - { - virtual ~RecListCaseT() {} - - typedef std::map MapType; - - MapType list; - - // Load one object of this type - void load(ESMReader &esm, const std::string &id) - { - //std::string id2 = toLower (id); - - list[id].load(esm); - } - - // Find the given object ID, or return NULL if not found. - const X* search(const std::string &id) const - { - std::string id2 = toLower (id); - - for (typename MapType::const_iterator iter = list.begin(); - iter != list.end(); ++iter) - { - if (toLower(iter->first) == id2) - return &iter->second; - } - - return NULL; - } - - // non-const version - X* search(const std::string &id) - { - std::string id2 = toLower (id); - - for (typename MapType::iterator iter = list.begin(); - iter != list.end(); ++iter) - { - if (toLower(iter->first) == id2) - return &iter->second; - } - - return NULL; - } - - // Find the given object ID (throws an exception if not found) - const X* find(const std::string &id) const - { - const X *object = search (id); - - if (!object) - throw std::runtime_error ("object " + id + " not found"); - - return object; - } - - int getSize() { return list.size(); } - - virtual void listIdentifier (std::vector& identifier) const - { - for (typename MapType::const_iterator iter (list.begin()); iter!=list.end(); ++iter) - identifier.push_back (iter->first); - } - }; - - /// Modified version of RecListT for records, that need to store their own ID - template - struct RecListWithIDT : RecList - { - virtual ~RecListWithIDT() {} - - typedef std::map MapType; - - MapType list; - - // Load one object of this type - void load(ESMReader &esm, const std::string &id) - { - std::string id2 = toLower (id); - list[id2].mId = id2; - list[id2].load(esm); - } - - // Find the given object ID, or return NULL if not found. - const X* search(const std::string &id) const - { - std::string id2 = toLower (id); - - typename MapType::const_iterator iter = list.find (id2); - - if (iter == list.end()) - return NULL; - return &iter->second; - } - - // Find the given object ID (throws an exception if not found) - const X* find(const std::string &id) const - { - const X *object = search (id); - - if (!object) - throw std::runtime_error ("object " + id + " not found"); - - return object; - } - - int getSize() { return list.size(); } - - virtual void listIdentifier (std::vector& identifier) const - { - for (typename MapType::const_iterator iter (list.begin()); iter!=list.end(); ++iter) - identifier.push_back (iter->first); - } - }; - - // The only difference to the above is a slight change to the load() - // function. We might merge these together later, and store the id - // in all the structs. - template - struct RecIDListT : RecList - { - virtual ~RecIDListT() {} - - typedef std::map MapType; - - MapType list; - - void load(ESMReader &esm, const std::string &id) - { - std::string id2 = toLower (id); - X& ref = list[id2]; - - ref.mId = id; - ref.load(esm); - } - - // Find the given object ID, or return NULL if not found. - const X* search(const std::string &id) const - { - std::string id2 = toLower (id); - - typename MapType::const_iterator iter = list.find (id2); - - if (iter == list.end()) - return NULL; - - return &iter->second; - } - - // Find the given object ID (throws an exception if not found) - const X* find(const std::string &id) const - { - const X *object = search (id); - - if (!object) - throw std::runtime_error ("object " + id + " not found"); - - return object; - } - - int getSize() { return list.size(); } - - virtual void listIdentifier (std::vector& identifier) const - { - for (typename MapType::const_iterator iter (list.begin()); iter!=list.end(); ++iter) - identifier.push_back (iter->first); - } - }; - - /* Land textures are indexed by an integer number - */ - struct LTexList : RecList - { - virtual ~LTexList() {} - - // For multiple ESM/ESP files we need one list per file. - typedef std::vector LandTextureList; - std::vector ltex; - - LTexList() - { - ltex.push_back(LandTextureList()); - LandTextureList <exl = ltex[0]; - // More than enough to hold Morrowind.esm. Extra lists for plugins will we - // added on-the-fly in a different method. - ltexl.reserve(128); - } - - const LandTexture* search(size_t index, size_t plugin) const - { - assert(plugin < ltex.size()); - const LandTextureList <exl = ltex[plugin]; - - assert(index < ltexl.size()); - return <exl.at(index); - } - - // "getSize" returns the number of individual terrain palettes. - // "getSizePlugin" returns the number of land textures in a specific palette. - int getSize() { return ltex.size(); } - int getSize() const { return ltex.size(); } - - int getSizePlugin(size_t plugin) { assert(plugin < ltex.size()); return ltex[plugin].size(); } - int getSizePlugin(size_t plugin) const { assert(plugin < ltex.size()); return ltex[plugin].size(); } - - virtual void listIdentifier (std::vector& identifier) const {} - - void load(ESMReader &esm, const std::string &id, size_t plugin) - { - LandTexture lt; - lt.load(esm); - lt.mId = id; - - // Make sure we have room for the structure - if (plugin >= ltex.size()) { - ltex.resize(plugin+1); - } - LandTextureList <exl = ltex[plugin]; - if(lt.mIndex + 1 > (int)ltexl.size()) - ltexl.resize(lt.mIndex+1); - - // Store it - ltexl[lt.mIndex] = lt; - } - - // Load all terrain palettes at the same size. Inherited virtual function - // from "RecList". Mostly useless, because we need the implementation - // above this one. - void load(ESMReader &esm, const std::string &id) - { - size_t plugin = esm.getIndex(); - load(esm, id, plugin); - } - }; - - /* Landscapes are indexed by the X,Y coordinates of the exterior - cell they belong to. - */ - struct LandList : RecList - { - virtual ~LandList() - { - for ( LandMap::iterator itr = lands.begin(); itr != lands.end(); ++itr ) - { - delete itr->second; - } - } - - // Map containing all landscapes - typedef std::pair LandCoord; - typedef std::map LandMap; - LandMap lands; - - int count; - LandList() : count(0) {} - int getSize() { return count; } - - virtual void listIdentifier (std::vector& identifier) const {} - - // Find land for the given coordinates. Return null if no mData. - Land *search(int x, int y) const - { - LandMap::const_iterator itr = lands.find(std::make_pair (x, y)); - if ( itr == lands.end() ) - { - return NULL; - } - - return itr->second; - } - - void load(ESMReader &esm, const std::string &id) - { - count++; - - // Create the structure and load it. This actually skips the - // landscape data and remembers the file position for later. - Land *land = new Land(); - land->load(esm); - - // Store the structure - lands[std::make_pair (land->mX, land->mY)] = land; - } - }; - - struct ciLessBoost : std::binary_function -{ - bool operator() (const std::string & s1, const std::string & s2) const { - //case insensitive version of is_less - return lexicographical_compare(s1, s2, is_iless()); - } -}; - - - // Cells aren't simply indexed by name. Exterior cells are treated - // separately. - // TODO: case handling (cell names are case-insensitive, but they are also showen to the - // player, so we can't simply smash case. - struct CellList : RecList - { - // Total cell count. Used for statistics. - int count; - CellList() : count(0) {} - int getSize() { return count; } - - // List of interior cells. Indexed by cell name. - typedef std::map IntCells; - IntCells intCells; - - // List of exterior cells. Indexed as extCells[mX][mY]. - typedef std::map, ESM::Cell*> ExtCells; - ExtCells extCells; - - virtual void listIdentifier (std::vector& identifier) const - { - for (IntCells::const_iterator iter (intCells.begin()); iter!=intCells.end(); ++iter) - identifier.push_back (iter->first); - } - - virtual ~CellList() - { - for (IntCells::iterator it = intCells.begin(); it!=intCells.end(); ++it) - delete it->second; - - for (ExtCells::iterator it = extCells.begin(); it!=extCells.end(); ++it) - delete it->second; - } - - const ESM::Cell* searchInt(const std::string &id) const - { - IntCells::const_iterator iter = intCells.find(id); - - if (iter!=intCells.end()) - return iter->second; - - return 0; - } - - const ESM::Cell* findInt(const std::string &id) const - { - const ESM::Cell *cell = searchInt (id); - - if (!cell) - throw std::runtime_error ("Interior cell not found - " + id); - - return cell; - } - - const ESM::Cell *searchExt (int x, int y) const - { - ExtCells::const_iterator it = extCells.find (std::make_pair (x, y)); - - if (it==extCells.end()) - return 0; - - return it->second; - } - - const ESM::Cell *findExt (int x, int y) const - { - const ESM::Cell *cell = searchExt (x, y); - - if (!cell) - throw std::runtime_error ("Exterior cell not found"); - - return cell; - } - const ESM::Cell *searchExtByName (const std::string& id) const - { - for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter) - { - if (toLower (iter->second->mName) == toLower (id)) - return iter->second; - } - - return 0; - } - - const ESM::Cell *searchExtByRegion (const std::string& id) const - { - std::string id2 = toLower (id); - - for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter) - if (toLower (iter->second->mRegion)==id) - return iter->second; - - return 0; - } - - void load(ESMReader &esm, const std::string &id) - { - count++; - - // Don't automatically assume that a new cell must be spawned. Multiple plugins write to the same cell, - // and we merge all this data into one Cell object. However, we can't simply search for the cell id, - // as many exterior cells do not have a name. Instead, we need to search by (x,y) coordinates - and they - // are not available until both cells have been loaded! So first, proceed as usual. - - // All cells have a name record, even nameless exterior cells. - ESM::Cell *cell = new ESM::Cell; - cell->mName = id; - - // The cell itself takes care of all the hairy details - cell->load(esm); - - if(cell->mData.mFlags & ESM::Cell::Interior) - { - // Store interior cell by name, try to merge with existing parent data. - ESM::Cell *oldcell = const_cast(searchInt(id)); - if (oldcell) { - cell->mContextList.push_back(oldcell->mContextList.at(0)); - delete oldcell; - } - intCells[id] = cell; - } - else - { - // Store exterior cells by grid position, try to merge with existing parent data. - ESM::Cell *oldcell = const_cast(searchExt(cell->getGridX(), cell->getGridY())); - if (oldcell) { - // The load order is important. Push the new source context on the *back* of the existing list, - // and then move the list to the new cell. - oldcell->mContextList.push_back(cell->mContextList.at(0)); - cell->mContextList = oldcell->mContextList; - delete oldcell; - } - extCells[std::make_pair (cell->mData.mX, cell->mData.mY)] = cell; - } - } - }; - - struct PathgridList : RecList - { - int count; - - // List of grids for interior cells. Indexed by cell name. - typedef std::map IntGrids; - IntGrids intGrids; - - // List of grids for exterior cells. Indexed as extCells[mX][mY]. - typedef std::map, ESM::Pathgrid*> ExtGrids; - ExtGrids extGrids; - - PathgridList() : count(0) {} - - virtual ~PathgridList() - { - for (IntGrids::iterator it = intGrids.begin(); it!=intGrids.end(); ++it) - delete it->second; - - for (ExtGrids::iterator it = extGrids.begin(); it!=extGrids.end(); ++it) - delete it->second; - } - - int getSize() { return count; } - - virtual void listIdentifier (std::vector& identifier) const - { - // do nothing - } - - void load(ESMReader &esm, const std::string &id) - { - count++; - ESM::Pathgrid *grid = new ESM::Pathgrid; - grid->load(esm); - if (grid->mData.mX == 0 && grid->mData.mY == 0) - { - intGrids[grid->mCell] = grid; - } - else - { - extGrids[std::make_pair(grid->mData.mX, grid->mData.mY)] = grid; - } - } - - Pathgrid *find(int cellX, int cellY, const std::string &cellName) const - { - Pathgrid *result = search(cellX, cellY, cellName); - if (!result) - { - throw std::runtime_error("no pathgrid found for cell " + cellName); - } - return result; - } - - Pathgrid *search(int cellX, int cellY, const std::string &cellName) const - { - Pathgrid *result = NULL; - if (cellX == 0 && cellY == 0) // possibly interior - { - IntGrids::const_iterator it = intGrids.find(cellName); - if (it != intGrids.end()) - result = it->second; - } - else - { - ExtGrids::const_iterator it = extGrids.find(std::make_pair(cellX, cellY)); - if (it != extGrids.end()) - result = it->second; - } - return result; - } - - Pathgrid *search(const ESM::Cell &cell) const - { - int cellX, cellY; - if (cell.mData.mFlags & ESM::Cell::Interior) - { - cellX = cellY = 0; - } - else - { - cellX = cell.mData.mX; - cellY = cell.mData.mY; - } - return search(cellX, cellY, cell.mName); - } - }; - - template - struct ScriptListT : RecList - { - virtual ~ScriptListT() {} - - typedef std::map MapType; - - MapType list; - - // Load one object of this type - void load(ESMReader &esm, const std::string &id) - { - X ref; - ref.load (esm); - - std::string realId = toLower (ref.mData.mName.toString()); - - std::swap (list[realId], ref); - } - - // Find the given object ID, or return NULL if not found. - const X* search(const std::string &id) const - { - std::string id2 = toLower (id); - - typename MapType::const_iterator iter = list.find (id2); - - if (iter == list.end()) - return NULL; - - return &iter->second; - } - - // Find the given object ID (throws an exception if not found) - const X* find(const std::string &id) const - { - const X *object = search (id); - - if (!object) - throw std::runtime_error ("object " + id + " not found"); - - return object; - } - - int getSize() { return list.size(); } - - virtual void listIdentifier (std::vector& identifier) const - { - for (typename MapType::const_iterator iter (list.begin()); iter!=list.end(); ++iter) - identifier.push_back (iter->first); - } - }; - - template - struct IndexListT - { - virtual ~IndexListT() {} - - typedef std::map MapType; - - MapType list; - - void load(ESMReader &esm) - { - X ref; - ref.load (esm); - int index = ref.mIndex; - list[index] = ref; - } - - int getSize() - { - return list.size(); - } - - virtual void listIdentifier (std::vector& identifier) const {} - - // Find the given object ID, or return NULL if not found. - const X* search (int id) const - { - typename MapType::const_iterator iter = list.find (id); - - if (iter == list.end()) - return NULL; - - return &iter->second; - } - - // Find the given object ID (throws an exception if not found) - const X* find (int id) const - { - const X *object = search (id); - - if (!object) - { - std::ostringstream error; - error << "object " << id << " not found"; - throw std::runtime_error (error.str()); - } - - return object; - } - }; - - /* We need special lists for: - - Path grids - */ -} -#endif diff --git a/components/esm_store/store.cpp b/components/esm_store/store.cpp deleted file mode 100644 index aeacfbacd..000000000 --- a/components/esm_store/store.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include -#include "store.hpp" - -using namespace std; -using namespace ESM; -using namespace ESMS; - -/* -static string toStr(int i) -{ - char name[5]; - *((int*)name) = i; - name[4] = 0; - return std::string(name); -} -*/ - -void ESMStore::load(ESMReader &esm) -{ - set missing; - - ESM::Dialogue *dialogue = 0; - - // Loop through all records - while(esm.hasMoreRecs()) - { - NAME n = esm.getRecName(); - esm.getRecHeader(); - - // Look up the record type. - RecListList::iterator it = recLists.find(n.val); - - if(it == recLists.end()) - { - if (n.val==ESM::REC_INFO) - { - if (dialogue) - { - ESM::DialInfo info; - info.load (esm); - - dialogue->mInfo.push_back (info); - } - else - { - std::cerr << "error: info record without dialog" << std::endl; - esm.skipRecord(); - } - } - else if (n.val==ESM::REC_MGEF) - { - magicEffects.load (esm); - } - else if (n.val==ESM::REC_SKIL) - { - skills.load (esm); - } - else - { - // Not found (this would be an error later) - esm.skipRecord(); - missing.insert(n.toString()); - } - } - else - { - // Load it - std::string id = esm.getHNOString("NAME"); - // ... unless it got deleted! This means that the following record - // has been deleted, and trying to load it using standard assumptions - // on the structure will (probably) fail. - if (esm.isNextSub("DELE")) { - esm.skipRecord(); - all.erase(id); - it->second->remove(id); - continue; - } - it->second->load(esm, id); - - if (n.val==ESM::REC_DIAL) - { - RecListCaseT& recList = static_cast& > (*it->second); - - ESM::Dialogue* d = recList.search (id); - - assert (d != NULL); - - dialogue = d; - } - else - dialogue = 0; - - // Insert the reference into the global lookup - if(!id.empty() && - (n.val==REC_ACTI || n.val==REC_ALCH || n.val==REC_APPA || n.val==REC_ARMO || - n.val==REC_BOOK || n.val==REC_CLOT || n.val==REC_CONT || n.val==REC_CREA || - n.val==REC_DOOR || n.val==REC_INGR || n.val==REC_LEVC || n.val==REC_LEVI || - n.val==REC_LIGH || n.val==REC_LOCK || n.val==REC_MISC || n.val==REC_NPC_ || - n.val==REC_PROB || n.val==REC_REPA || n.val==REC_STAT || n.val==REC_WEAP) - ) - all[id] = n.val; - } - } - - for (int i = 0; i < Attribute::Length; ++i) - { - Attribute::AttributeID id = Attribute::sAttributeIds[i]; - attributes.list.insert(std::make_pair(id, Attribute(id, Attribute::sGmstAttributeIds[i], Attribute::sGmstAttributeDescIds[i]))); - } - - /* This information isn't needed on screen. But keep the code around - for debugging purposes later. - - cout << "\n" << recLists.size() << " record types:\n"; - for(RecListList::iterator it = recLists.begin(); it != recLists.end(); it++) - cout << " " << toStr(it->first) << ": " << it->second->getSize() << endl; - cout << "\nNot implemented yet: "; - for(set::iterator it = missing.begin(); - it != missing.end(); it++ ) - cout << *it << " "; - cout << endl; - */ -} From d6377fb2e39ef8d25fd887511d7f0bc501f00b59 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Thu, 3 Jan 2013 18:51:04 +0100 Subject: [PATCH 11/43] - Support deleting references from a plugin - Add preliminary support for loading some unique fields appearing only in savegames - Add a few lines required for supporting respawning references. Incomplete. --- apps/openmw/mwworld/cellstore.cpp | 7 +++++-- apps/openmw/mwworld/cellstore.hpp | 7 +++++++ components/esm/esmreader.hpp | 8 ++++++++ components/esm/loadcell.cpp | 28 ++++++++++++++++++++++++++-- components/esm/loadcell.hpp | 3 +++ 5 files changed, 49 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index ba8f5aa61..d007ff981 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -61,11 +61,15 @@ namespace MWWorld while (mCell->getNextRef (esm[index], ref)) { std::string lowerCase; + if (ref.mDeleted) { + // Right now, don't do anything. Wehere is "listRefs" actually used, anyway? + // Skipping for now... + continue; + } std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), (int(*)(int)) std::tolower); - // TODO: Fully support deletion of references. mIds.push_back (lowerCase); } } @@ -97,7 +101,6 @@ namespace MWWorld std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), (int(*)(int)) std::tolower); - // TODO: Fully support deletion of references. int rec = store.find(ref.mRefID); ref.mRefID = lowerCase; diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index cf09496e8..2b25faa70 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -59,6 +59,13 @@ namespace MWWorld /// on miss void load(ESM::CellRef &ref, const MWWorld::ESMStore &esmStore) { + // Skip this when reference was deleted. + // TODO: Support respawning references, in this case, we need to track it somehow. + if (ref.mDeleted) { + mList.erase(ref.mRefnum); + return; + } + // for throwing exception on unhandled record type const MWWorld::Store &store = esmStore.get(); const X *ptr = store.search(ref.mRefID); diff --git a/components/esm/esmreader.hpp b/components/esm/esmreader.hpp index 732dbe9bc..df4c1919e 100644 --- a/components/esm/esmreader.hpp +++ b/components/esm/esmreader.hpp @@ -119,6 +119,14 @@ public: getHT(x); } + template + void getHNOT(X &x, const char* name, int size) + { + assert(sizeof(X) == size); + if(isNextSub(name)) + getHT(x); + } + int64_t getHNLong(const char *name); // Get data of a given type/size, including subrecord header diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index b7f27b08d..aafe629e6 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -213,7 +213,24 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) // missing ref.mScale = 1.0; esm.getHNOT(ref.mScale, "XSCL"); - + + // TODO: support loading references from saves, there are tons of keys not recognized yet. + // The following is just an incomplete list. + if (esm.isNextSub("ACTN")) + esm.skipHSub(); + if (esm.isNextSub("STPR")) + esm.skipHSub(); + if (esm.isNextSub("ACDT")) + esm.skipHSub(); + if (esm.isNextSub("ACSC")) + esm.skipHSub(); + if (esm.isNextSub("ACSL")) + esm.skipHSub(); + if (esm.isNextSub("CHRD")) + esm.skipHSub(); + else if (esm.isNextSub("CRED")) // ??? + esm.skipHSub(); + ref.mOwner = esm.getHNOString("ANAM"); ref.mGlob = esm.getHNOString("BNAM"); ref.mSoul = esm.getHNOString("XSOL"); @@ -251,7 +268,7 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) esm.getHNOT(ref.mUnam, "UNAM"); esm.getHNOT(ref.mFltv, "FLTV"); - esm.getHNT(ref.mPos, "DATA", 24); + esm.getHNOT(ref.mPos, "DATA", 24); // Number of references in the cell? Maximum once in each cell, // but not always at the beginning, and not always right. In other @@ -265,6 +282,13 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) esm.getHT(ref.mNam0); //esm.getHNOT(NAM0, "NAM0"); } + + if (esm.isNextSub("DELE")) { + esm.skipHSub(); + ref.mDeleted = 2; // Deleted, will not respawn. + // TODO: find out when references do respawn. + } else + ref.mDeleted = 0; return true; } diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index ccfdcadd8..dff5a3338 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -70,6 +70,9 @@ public: // No idea - occurs ONCE in Morrowind.esm, for an activator char mUnam; + + // Track deleted references. 0 - not deleted, 1 - deleted, but respawns, 2 - deleted and does not respawn. + int mDeleted; // Occurs in Tribunal.esm, eg. in the cell "Mournhold, Plaza // Brindisi Dorom", where it has the value 100. Also only for From a8e02779b26e0e7b21761b3489ae58917b28181d Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sat, 19 Jan 2013 23:33:18 +0100 Subject: [PATCH 12/43] - Add support for multiple plugins trying to modify the same reference - Fix a small signed/unsigned warning --- apps/openmw/mwworld/cellstore.cpp | 56 +++++++++++++++++++++++ apps/openmw/mwworld/esmstore.cpp | 6 +-- apps/openmw/mwworld/esmstore.hpp | 3 ++ apps/openmw/mwworld/store.hpp | 45 ++++++++++++++++--- components/esm/loadcell.cpp | 74 ++++++++++++++++++++++++------- components/esm/loadcell.hpp | 46 ++++++++++++++++++- 6 files changed, 203 insertions(+), 27 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index d007ff981..ecc1bc306 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -96,6 +96,11 @@ namespace MWWorld // Get each reference in turn while(mCell->getNextRef(esm[index], ref)) { + // Don't load reference if it was moved to a different cell. + if (mCell->mMovedRefs.find(ref.mRefnum) != mCell->mMovedRefs.end()) { + continue; + } + std::string lowerCase; std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), @@ -139,5 +144,56 @@ namespace MWWorld } } } + + // Load moved references, from separately tracked list. + for (ESM::CellRefTracker::const_iterator it = mCell->mLeasedRefs.begin(); it != mCell->mLeasedRefs.end(); it++) + { + // Doesn't seem to work in one line... huh? Too sleepy to check... + //const ESM::CellRef &ref0 = it->second; + ESM::CellRef &ref = const_cast(it->second); + + std::string lowerCase; + + std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), + (int(*)(int)) std::tolower); + + int rec = store.find(ref.mRefID); + + ref.mRefID = lowerCase; + + /* We can optimize this further by storing the pointer to the + record itself in store.all, so that we don't need to look it + up again here. However, never optimize. There are infinite + opportunities to do that later. + */ + switch(rec) + { + case ESM::REC_ACTI: mActivators.load(ref, store); break; + case ESM::REC_ALCH: mPotions.load(ref, store); break; + case ESM::REC_APPA: mAppas.load(ref, store); break; + case ESM::REC_ARMO: mArmors.load(ref, store); break; + case ESM::REC_BOOK: mBooks.load(ref, store); break; + case ESM::REC_CLOT: mClothes.load(ref, store); break; + case ESM::REC_CONT: mContainers.load(ref, store); break; + case ESM::REC_CREA: mCreatures.load(ref, store); break; + case ESM::REC_DOOR: mDoors.load(ref, store); break; + case ESM::REC_INGR: mIngreds.load(ref, store); break; + case ESM::REC_LEVC: mCreatureLists.load(ref, store); break; + case ESM::REC_LEVI: mItemLists.load(ref, store); break; + case ESM::REC_LIGH: mLights.load(ref, store); break; + case ESM::REC_LOCK: mLockpicks.load(ref, store); break; + case ESM::REC_MISC: mMiscItems.load(ref, store); break; + case ESM::REC_NPC_: mNpcs.load(ref, store); break; + case ESM::REC_PROB: mProbes.load(ref, store); break; + case ESM::REC_REPA: mRepairs.load(ref, store); break; + case ESM::REC_STAT: mStatics.load(ref, store); break; + case ESM::REC_WEAP: mWeapons.load(ref, store); break; + + case 0: std::cout << "Cell reference " + ref.mRefID + " not found!\n"; break; + default: + std::cout << "WARNING: Ignoring reference '" << ref.mRefID << "' of unhandled type\n"; + } + + } } } diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 54050b38c..38fadca9e 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -30,13 +30,13 @@ void ESMStore::load(ESM::ESMReader &esm) // Cache parent esX files by tracking their indices in the global list of // all files/readers used by the engine. This will greaty help to accelerate // parsing of reference IDs. - size_t index = ~0; + int index = ~0; const ESM::ESMReader::MasterList &masters = esm.getMasters(); std::vector *allPlugins = esm.getGlobalReaderList(); for (size_t j = 0; j < masters.size(); j++) { ESM::MasterData &mast = const_cast(masters[j]); std::string fname = mast.name; - for (size_t i = 0; i < esm.getIndex(); i++) { + for (int i = 0; i < esm.getIndex(); i++) { const std::string &candidate = allPlugins->at(i).getContext().filename; std::string fnamecandidate = boost::filesystem::path(candidate).filename().string(); if (fname == fnamecandidate) { @@ -44,7 +44,7 @@ void ESMStore::load(ESM::ESMReader &esm) break; } } - if (index == (size_t)~0) { + if (index == (int)~0) { // Tried to load a parent file that has not been loaded yet. This is bad, // the launcher should have taken care of this. std::string fstring = "File " + fname + " asks for parent file " + masters[j].name diff --git a/apps/openmw/mwworld/esmstore.hpp b/apps/openmw/mwworld/esmstore.hpp index bd8e003f4..2039a00db 100644 --- a/apps/openmw/mwworld/esmstore.hpp +++ b/apps/openmw/mwworld/esmstore.hpp @@ -94,6 +94,9 @@ namespace MWWorld ESMStore() : mDynamicCount(0) { + // Cell store needs access to this for tracking moved references + mCells.mEsmStore = this; + mStores[ESM::REC_ACTI] = &mActivators; mStores[ESM::REC_ALCH] = &mPotions; mStores[ESM::REC_APPA] = &mAppas; diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 77c9c7357..c36e84813 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -399,8 +399,7 @@ namespace MWWorld DynamicInt mDynamicInt; DynamicExt mDynamicExt; - - + const ESM::Cell *search(const ESM::Cell &cell) const { if (cell.isExterior()) { return search(cell.getGridX(), cell.getGridY()); @@ -409,6 +408,8 @@ namespace MWWorld } public: + ESMStore *mEsmStore; + typedef SharedIterator iterator; Store() @@ -450,6 +451,30 @@ namespace MWWorld return 0; } + const ESM::Cell *searchOrCreate(int x, int y) { + ESM::Cell cell; + cell.mData.mX = x, cell.mData.mY = y; + + std::pair key(x, y); + std::map, ESM::Cell>::const_iterator it = mExt.find(key); + if (it != mExt.end()) { + return &(it->second); + } + + DynamicExt::const_iterator dit = mDynamicExt.find(key); + if (dit != mDynamicExt.end()) { + return &dit->second; + } + + ESM::Cell *newCell = new ESM::Cell; + newCell->mData.mX = x; + newCell->mData.mY = y; + mExt[std::make_pair(x, y)] = *newCell; + delete newCell; + + return &mExt[std::make_pair(x, y)]; + } + const ESM::Cell *find(const std::string &id) const { const ESM::Cell *ptr = search(id); if (ptr == 0) { @@ -500,7 +525,7 @@ namespace MWWorld cell->mName = id; // The cell itself takes care of all the hairy details - cell->load(esm); + cell->load(esm, *mEsmStore); if(cell->mData.mFlags & ESM::Cell::Interior) { @@ -515,7 +540,6 @@ namespace MWWorld *oldcell = *cell; } else mInt[idLower] = *cell; - delete cell; } else { @@ -526,12 +550,23 @@ namespace MWWorld oldcell->mContextList.push_back(cell->mContextList.at(0)); // copy list into new cell cell->mContextList = oldcell->mContextList; + // merge lists of leased references, use newer data in case of conflict + for (ESM::MovedCellRefTracker::const_iterator it = cell->mMovedRefs.begin(); it != cell->mMovedRefs.end(); it++) { + // remove reference from current leased ref tracker and add it to new cell + if (oldcell->mMovedRefs.find(it->second.mRefnum) != oldcell->mMovedRefs.end()) { + ESM::MovedCellRef target0 = oldcell->mMovedRefs[it->second.mRefnum]; + ESM::Cell *wipecell = const_cast(search(target0.mTarget[0], target0.mTarget[1])); + wipecell->mLeasedRefs.erase(it->second.mRefnum); + } + oldcell->mMovedRefs[it->second.mRefnum] = it->second; + } + cell->mMovedRefs = oldcell->mMovedRefs; // have new cell replace old cell *oldcell = *cell; } else mExt[std::make_pair(cell->mData.mX, cell->mData.mY)] = *cell; - delete cell; } + delete cell; } iterator intBegin() const { diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index aafe629e6..76a1e4f95 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -2,11 +2,15 @@ #include #include -#include +#include +#include #include "esmreader.hpp" #include "esmwriter.hpp" +#include +#include + namespace ESM { @@ -64,10 +68,11 @@ void CellRef::save(ESMWriter &esm) } } -void Cell::load(ESMReader &esm) +void Cell::load(ESMReader &esm, MWWorld::ESMStore &store) { // Ignore this for now, it might mean we should delete the entire // cell? + // TODO: treat the special case "another plugin moved this ref, but we want to delete it"! if (esm.isNextSub("DELE")) { esm.skipHSub(); } @@ -110,6 +115,33 @@ void Cell::load(ESMReader &esm) if (esm.isNextSub("NAM0")) { esm.getHT(mNAM0); } + + // preload moved references + while (esm.isNextSub("MVRF")) { + CellRef ref; + MovedCellRef cMRef; + getNextMVRF(esm, cMRef); + + MWWorld::Store &cStore = const_cast&>(store.get()); + ESM::Cell *cellAlt = const_cast(cStore.searchOrCreate(cMRef.mTarget[0], cMRef.mTarget[1])); + + // Get regular moved reference data. Adapted from CellStore::loadRefs. Maybe we can optimize the following + // implementation when the oher implementation works as well. + getNextRef(esm, ref); + std::string lowerCase; + + std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), + (int(*)(int)) std::tolower); + + // Add data required to make reference appear in the correct cell. + /* + std::cout << "Moving refnumber! First cell: " << mData.mX << " " << mData.mY << std::endl; + std::cout << " New cell: " << cMRef.mTarget[0] << " " << cMRef.mTarget[0] << std::endl; + std::cout << "Refnumber (MVRF): " << cMRef.mRefnum << " (FRMR) " << ref.mRefnum << std::endl; + */ + mMovedRefs[cMRef.mRefnum] = cMRef; + cellAlt->mLeasedRefs[ref.mRefnum] = ref; + } // Save position of the cell references and move on mContextList.push_back(esm.getContext()); @@ -171,23 +203,15 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) // TODO: Try and document reference numbering, I don't think this has been done anywhere else. if (!esm.hasMoreSubs()) return false; - + + // NOTE: We should not need this check. It is a safety check until we have checked + // more plugins, and how they treat these moved references. if (esm.isNextSub("MVRF")) { - // Moved existing reference across cell boundaries, so interpret the blocks correctly. - // FIXME: Right now, we don't do anything with this data. This might result in weird behaviour, - // where a moved reference does not appear because the owning cell (i.e. this cell) is not - // loaded in memory. - int movedRefnum = 0; - int destCell[2]; - esm.getHT(movedRefnum); - esm.getHNT(destCell, "CNDT"); - // TODO: Figure out what happens when a reference has moved into an interior cell. This might - // be required for NPCs following the player. + esm.skipRecord(); // skip MVRF + esm.skipRecord(); // skip CNDT + // That should be it, I haven't seen any other fields yet. } - // If we have just parsed a MVRF entry, there should be a regular FRMR entry following right there. - // With the exception that this bock technically belongs to a different cell than this one. - // TODO: Figure out a way to handle these weird references that do not belong to this cell. - // This may require some not-so-small behing-the-scenes updates. + esm.getHNT(ref.mRefnum, "FRMR"); ref.mRefID = esm.getHNString("NAME"); @@ -293,4 +317,20 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) return true; } +bool Cell::getNextMVRF(ESMReader &esm, MovedCellRef &mref) +{ + esm.getHT(mref.mRefnum); + esm.getHNOT(mref.mTarget, "CNDT"); + + // Identify references belonging to a parent file and adapt the ID accordingly. + int local = (mref.mRefnum & 0xff000000) >> 24; + size_t global = esm.getIndex() + 1; + mref.mRefnum &= 0x00ffffff; // delete old plugin ID + const ESM::ESMReader::MasterList &masters = esm.getMasters(); + global = masters[local-1].index + 1; + mref.mRefnum |= global << 24; // insert global plugin ID + + return true; +} + } diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index dff5a3338..6862dbc5c 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -6,6 +6,14 @@ #include "esmcommon.hpp" #include "defs.hpp" +#include + +/* +namespace MWWorld { + class ESMStore; + class CellStore; +} +*/ namespace ESM { @@ -86,6 +94,26 @@ public: void save(ESMWriter &esm); }; +/* Moved cell reference tracking object. This mainly stores the target cell + of the reference, so we can easily know where it has been moved when another + plugin tries to move it independently. + */ +class MovedCellRef +{ +public: + int mRefnum; + + // Target cell (if exterior) + int mTarget[2]; + + // TODO: Support moving references between exterior and interior cells! + // This may happen in saves, when an NPC follows the player. Tribunal + // introduces a henchman (which no one uses), so we may need this as well. +}; + +typedef std::map MovedCellRefTracker; +typedef std::map CellRefTracker; + /* Cells hold data about objects, creatures, statics (rocks, walls, buildings) and landscape (for exterior cells). Cells frequently also has other associated LAND and PGRD records. Combined, all this @@ -131,8 +159,17 @@ struct Cell bool mWaterInt; int mMapColor; int mNAM0; - - void load(ESMReader &esm); + + // References "leased" from another cell (i.e. a different cell + // introduced this ref, and it has been moved here by a plugin) + CellRefTracker mLeasedRefs; + MovedCellRefTracker mMovedRefs; + + void load(ESMReader &esm, MWWorld::ESMStore &store); + + // This method is left in for compatibility with esmtool. Parsing moved references currently requires + // passing ESMStore, bit it does not know about this parameter, so we do it this way. + void load(ESMReader &esm) {}; void save(ESMWriter &esm); bool isExterior() const @@ -167,6 +204,11 @@ struct Cell reuse one memory location without blanking it between calls. */ static bool getNextRef(ESMReader &esm, CellRef &ref); + + /* This fetches an MVRF record, which is used to track moved references. + * Since they are comparably rare, we use a separate method for this. + */ + static bool getNextMVRF(ESMReader &esm, MovedCellRef &mref); }; } #endif From 713d324eeb6713d62436454619ca2c6614d48dc7 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sun, 20 Jan 2013 19:07:33 +0100 Subject: [PATCH 13/43] - Minor code cleanup --- apps/openmw/mwrender/terrain.cpp | 2 +- apps/openmw/mwworld/cellstore.hpp | 5 ++++- apps/openmw/mwworld/esmstore.cpp | 5 ++--- components/esm/esmreader.hpp | 6 +++--- components/esm/loadland.cpp | 2 +- components/esm/loadland.hpp | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwrender/terrain.cpp b/apps/openmw/mwrender/terrain.cpp index eb5b07af4..676139cf5 100644 --- a/apps/openmw/mwrender/terrain.cpp +++ b/apps/openmw/mwrender/terrain.cpp @@ -143,7 +143,7 @@ namespace MWRender std::map indexes; initTerrainTextures(&terrainData, cellX, cellY, x * numTextures, y * numTextures, - numTextures, indexes, land->plugin); + numTextures, indexes, land->mPlugin); if (mTerrainGroup.getTerrain(terrainX, terrainY) == NULL) { diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 2b25faa70..cbaf56458 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -98,7 +98,10 @@ namespace MWWorld /// A list of container references. These references do not track their mRefnumber. /// Otherwise, taking 1 of 20 instances of an object would produce multiple objects /// with the same reference. - // TODO: Check how Morrowind does this! Maybe auto-generate references on drop. + /// Unfortunately, this also means that we need a different STL container. + /// (cells use CellRefList, where refs can be located according to their refnumner, + /// which uses a map; container items do not make use of the refnumber, so we + /// can't use a map with refnumber keys.) template struct ContainerRefList { diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 38fadca9e..1666ad823 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -28,8 +28,8 @@ void ESMStore::load(ESM::ESMReader &esm) ESM::Dialogue *dialogue = 0; // Cache parent esX files by tracking their indices in the global list of - // all files/readers used by the engine. This will greaty help to accelerate - // parsing of reference IDs. + // all files/readers used by the engine. This will greaty accelerate + // refnumber mangling, as required for handling moved references. int index = ~0; const ESM::ESMReader::MasterList &masters = esm.getMasters(); std::vector *allPlugins = esm.getGlobalReaderList(); @@ -122,7 +122,6 @@ void ESMStore::load(ESM::ESMReader &esm) cout << *it << " "; cout << endl; */ - //setUp(); } void ESMStore::setUp() diff --git a/components/esm/esmreader.hpp b/components/esm/esmreader.hpp index df4c1919e..ba7d6c3e0 100644 --- a/components/esm/esmreader.hpp +++ b/components/esm/esmreader.hpp @@ -80,9 +80,9 @@ public: // terrain palette, but ESMReader does not pass a reference to the correct plugin // to the individual load() methods. This hack allows to pass this reference // indirectly to the load() method. - int idx; - void setIndex(const int index) {idx = index; mCtx.index = index;} - const int getIndex() {return idx;} + int mIdx; + void setIndex(const int index) {mIdx = index; mCtx.index = index;} + const int getIndex() {return mIdx;} void setGlobalReaderList(std::vector *list) {mGlobalReaderList = list;} std::vector *getGlobalReaderList() {return mGlobalReaderList;} diff --git a/components/esm/loadland.cpp b/components/esm/loadland.cpp index ecc25501f..89b48c27d 100644 --- a/components/esm/loadland.cpp +++ b/components/esm/loadland.cpp @@ -81,7 +81,7 @@ Land::~Land() void Land::load(ESMReader &esm) { mEsm = &esm; - plugin = mEsm->getIndex(); + mPlugin = mEsm->getIndex(); // Get the grid location esm.getSubNameIs("INTV"); diff --git a/components/esm/loadland.hpp b/components/esm/loadland.hpp index f72d020ac..c1cce5e7e 100644 --- a/components/esm/loadland.hpp +++ b/components/esm/loadland.hpp @@ -23,7 +23,7 @@ struct Land int mFlags; // Only first four bits seem to be used, don't know what // they mean. int mX, mY; // Map coordinates. - int plugin; // Plugin index, used to reference the correct material palette. + int mPlugin; // Plugin index, used to reference the correct material palette. // File context. This allows the ESM reader to be 'reset' to this // location later when we are ready to load the full data set. From 854eff321f3992d8da6e324577d130df0d3e1f7d Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Fri, 25 Jan 2013 17:54:05 +0100 Subject: [PATCH 14/43] - Some time ago, upstream/master did merge the submodule 'shiny' into upstream/master. This branch now does this as well. --- extern/shiny | 1 - extern/shiny/CMakeLists.txt | 75 + extern/shiny/Docs/Configurations.dox | 32 + extern/shiny/Docs/Doxyfile | 1826 ++++ extern/shiny/Docs/GettingStarted.dox | 65 + extern/shiny/Docs/Lod.dox | 49 + extern/shiny/Docs/Macros.dox | 270 + extern/shiny/Docs/Mainpage.dox | 13 + extern/shiny/Docs/Materials.dox | 128 + extern/shiny/Extra/core.h | 168 + extern/shiny/License.txt | 9 + extern/shiny/Main/Factory.cpp | 583 ++ extern/shiny/Main/Factory.hpp | 207 + extern/shiny/Main/Language.hpp | 16 + extern/shiny/Main/MaterialInstance.cpp | 220 + extern/shiny/Main/MaterialInstance.hpp | 104 + extern/shiny/Main/MaterialInstancePass.cpp | 16 + extern/shiny/Main/MaterialInstancePass.hpp | 29 + .../Main/MaterialInstanceTextureUnit.cpp | 14 + .../Main/MaterialInstanceTextureUnit.hpp | 26 + extern/shiny/Main/Platform.cpp | 94 + extern/shiny/Main/Platform.hpp | 145 + extern/shiny/Main/Preprocessor.cpp | 99 + extern/shiny/Main/Preprocessor.hpp | 69 + extern/shiny/Main/PropertyBase.cpp | 268 + extern/shiny/Main/PropertyBase.hpp | 235 + extern/shiny/Main/ScriptLoader.cpp | 401 + extern/shiny/Main/ScriptLoader.hpp | 134 + extern/shiny/Main/ShaderInstance.cpp | 707 ++ extern/shiny/Main/ShaderInstance.hpp | 71 + extern/shiny/Main/ShaderSet.cpp | 172 + extern/shiny/Main/ShaderSet.hpp | 71 + .../shiny/Platforms/Ogre/OgreGpuProgram.cpp | 70 + .../shiny/Platforms/Ogre/OgreGpuProgram.hpp | 31 + extern/shiny/Platforms/Ogre/OgreMaterial.cpp | 99 + extern/shiny/Platforms/Ogre/OgreMaterial.hpp | 38 + .../Platforms/Ogre/OgreMaterialSerializer.cpp | 67 + .../Platforms/Ogre/OgreMaterialSerializer.hpp | 29 + extern/shiny/Platforms/Ogre/OgrePass.cpp | 128 + extern/shiny/Platforms/Ogre/OgrePass.hpp | 35 + extern/shiny/Platforms/Ogre/OgrePlatform.cpp | 174 + extern/shiny/Platforms/Ogre/OgrePlatform.hpp | 72 + .../Platforms/Ogre/OgreTextureUnitState.cpp | 40 + .../Platforms/Ogre/OgreTextureUnitState.hpp | 27 + extern/shiny/Preprocessor/aq.cpp | 236 + extern/shiny/Preprocessor/cpp_re.cpp | 442 + extern/shiny/Preprocessor/cpp_re.inc | 9044 +++++++++++++++++ .../instantiate_cpp_exprgrammar.cpp | 52 + .../Preprocessor/instantiate_cpp_grammar.cpp | 56 + .../instantiate_cpp_literalgrs.cpp | 56 + .../instantiate_defined_grammar.cpp | 52 + .../instantiate_predef_macros.cpp | 52 + .../Preprocessor/instantiate_re2c_lexer.cpp | 65 + .../instantiate_re2c_lexer_str.cpp | 64 + extern/shiny/Preprocessor/token_ids.cpp | 447 + extern/shiny/Readme.txt | 33 + 56 files changed, 17725 insertions(+), 1 deletion(-) delete mode 160000 extern/shiny create mode 100644 extern/shiny/CMakeLists.txt create mode 100644 extern/shiny/Docs/Configurations.dox create mode 100644 extern/shiny/Docs/Doxyfile create mode 100644 extern/shiny/Docs/GettingStarted.dox create mode 100644 extern/shiny/Docs/Lod.dox create mode 100644 extern/shiny/Docs/Macros.dox create mode 100644 extern/shiny/Docs/Mainpage.dox create mode 100644 extern/shiny/Docs/Materials.dox create mode 100644 extern/shiny/Extra/core.h create mode 100644 extern/shiny/License.txt create mode 100644 extern/shiny/Main/Factory.cpp create mode 100644 extern/shiny/Main/Factory.hpp create mode 100644 extern/shiny/Main/Language.hpp create mode 100644 extern/shiny/Main/MaterialInstance.cpp create mode 100644 extern/shiny/Main/MaterialInstance.hpp create mode 100644 extern/shiny/Main/MaterialInstancePass.cpp create mode 100644 extern/shiny/Main/MaterialInstancePass.hpp create mode 100644 extern/shiny/Main/MaterialInstanceTextureUnit.cpp create mode 100644 extern/shiny/Main/MaterialInstanceTextureUnit.hpp create mode 100644 extern/shiny/Main/Platform.cpp create mode 100644 extern/shiny/Main/Platform.hpp create mode 100644 extern/shiny/Main/Preprocessor.cpp create mode 100644 extern/shiny/Main/Preprocessor.hpp create mode 100644 extern/shiny/Main/PropertyBase.cpp create mode 100644 extern/shiny/Main/PropertyBase.hpp create mode 100644 extern/shiny/Main/ScriptLoader.cpp create mode 100644 extern/shiny/Main/ScriptLoader.hpp create mode 100644 extern/shiny/Main/ShaderInstance.cpp create mode 100644 extern/shiny/Main/ShaderInstance.hpp create mode 100644 extern/shiny/Main/ShaderSet.cpp create mode 100644 extern/shiny/Main/ShaderSet.hpp create mode 100644 extern/shiny/Platforms/Ogre/OgreGpuProgram.cpp create mode 100644 extern/shiny/Platforms/Ogre/OgreGpuProgram.hpp create mode 100644 extern/shiny/Platforms/Ogre/OgreMaterial.cpp create mode 100644 extern/shiny/Platforms/Ogre/OgreMaterial.hpp create mode 100644 extern/shiny/Platforms/Ogre/OgreMaterialSerializer.cpp create mode 100644 extern/shiny/Platforms/Ogre/OgreMaterialSerializer.hpp create mode 100644 extern/shiny/Platforms/Ogre/OgrePass.cpp create mode 100644 extern/shiny/Platforms/Ogre/OgrePass.hpp create mode 100644 extern/shiny/Platforms/Ogre/OgrePlatform.cpp create mode 100644 extern/shiny/Platforms/Ogre/OgrePlatform.hpp create mode 100644 extern/shiny/Platforms/Ogre/OgreTextureUnitState.cpp create mode 100644 extern/shiny/Platforms/Ogre/OgreTextureUnitState.hpp create mode 100644 extern/shiny/Preprocessor/aq.cpp create mode 100644 extern/shiny/Preprocessor/cpp_re.cpp create mode 100644 extern/shiny/Preprocessor/cpp_re.inc create mode 100644 extern/shiny/Preprocessor/instantiate_cpp_exprgrammar.cpp create mode 100644 extern/shiny/Preprocessor/instantiate_cpp_grammar.cpp create mode 100644 extern/shiny/Preprocessor/instantiate_cpp_literalgrs.cpp create mode 100644 extern/shiny/Preprocessor/instantiate_defined_grammar.cpp create mode 100644 extern/shiny/Preprocessor/instantiate_predef_macros.cpp create mode 100644 extern/shiny/Preprocessor/instantiate_re2c_lexer.cpp create mode 100644 extern/shiny/Preprocessor/instantiate_re2c_lexer_str.cpp create mode 100644 extern/shiny/Preprocessor/token_ids.cpp create mode 100644 extern/shiny/Readme.txt diff --git a/extern/shiny b/extern/shiny deleted file mode 160000 index 4750676ac..000000000 --- a/extern/shiny +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4750676ac46a7aaa86bca53dc68c5a1ba11f3bc1 diff --git a/extern/shiny/CMakeLists.txt b/extern/shiny/CMakeLists.txt new file mode 100644 index 000000000..603336413 --- /dev/null +++ b/extern/shiny/CMakeLists.txt @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 2.8) + +# This is NOT intended as a stand-alone build system! Instead, you should include this from the main CMakeLists of your project. +# Make sure to link against Ogre and boost::filesystem. + +option(SHINY_BUILD_OGRE_PLATFORM "build the Ogre platform" ON) + +set(SHINY_LIBRARY "shiny") +set(SHINY_OGREPLATFORM_LIBRARY "shiny.OgrePlatform") + +# Sources +file(GLOB SOURCE_FILES Main/*.cpp ) + +set(SOURCE_FILES + Main/Factory.cpp + Main/MaterialInstance.cpp + Main/MaterialInstancePass.cpp + Main/MaterialInstanceTextureUnit.cpp + Main/Platform.cpp + Main/Preprocessor.cpp + Main/PropertyBase.cpp + Main/ScriptLoader.cpp + Main/ShaderInstance.cpp + Main/ShaderSet.cpp +) + +# In Debug mode, write the shader sources to the current directory +if (DEFINED CMAKE_BUILD_TYPE) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DSHINY_WRITE_SHADER_DEBUG) + endif() +endif() + +if (DEFINED SHINY_USE_WAVE_SYSTEM_INSTALL) + # use system install +else() + list(APPEND SOURCE_FILES + Preprocessor/aq.cpp + Preprocessor/cpp_re.cpp + Preprocessor/instantiate_cpp_literalgrs.cpp + Preprocessor/instantiate_cpp_exprgrammar.cpp + Preprocessor/instantiate_cpp_grammar.cpp + Preprocessor/instantiate_defined_grammar.cpp + Preprocessor/instantiate_predef_macros.cpp + Preprocessor/instantiate_re2c_lexer.cpp + Preprocessor/instantiate_re2c_lexer_str.cpp + Preprocessor/token_ids.cpp + ) + + # Don't use thread-safe boost::wave. Results in a huge speed-up for the preprocessor. + add_definitions(-DBOOST_WAVE_SUPPORT_THREADING=0) +endif() + +set(OGRE_PLATFORM_SOURCE_FILES + Platforms/Ogre/OgreGpuProgram.cpp + Platforms/Ogre/OgreMaterial.cpp + Platforms/Ogre/OgreMaterialSerializer.cpp + Platforms/Ogre/OgrePass.cpp + Platforms/Ogre/OgrePlatform.cpp + Platforms/Ogre/OgreTextureUnitState.cpp +) + +file(GLOB OGRE_PLATFORM_SOURCE_FILES Platforms/Ogre/*.cpp) + +add_library(${SHINY_LIBRARY} STATIC ${SOURCE_FILES}) + +if (SHINY_BUILD_OGRE_PLATFORM) + add_library(${SHINY_OGREPLATFORM_LIBRARY} STATIC ${OGRE_PLATFORM_SOURCE_FILES}) +endif() + + +link_directories(${CMAKE_CURRENT_BINARY_DIR}) + +set(SHINY_LIBRARY ${SHINY_LIBRARY} PARENT_SCOPE) +set(SHINY_OGREPLATFORM_LIBRARY ${SHINY_OGREPLATFORM_LIBRARY} PARENT_SCOPE) diff --git a/extern/shiny/Docs/Configurations.dox b/extern/shiny/Docs/Configurations.dox new file mode 100644 index 000000000..affd91423 --- /dev/null +++ b/extern/shiny/Docs/Configurations.dox @@ -0,0 +1,32 @@ +/*! + + \page configurations Configurations + + A common task in shader development is to provide a different set of simpler shaders for all your materials. Some examples: + - When rendering cubic or planar reflection maps in real-time, you will want to disable shadows. + - For an in-game minimap render target, you don't want to have fog. + + For this task, the library provides a \a Configuration concept. + + A Configuration is a set of properties that can override global settings, as long as this Configuration is active. + + Here's an example. Say you have a global setting with the name 'shadows' that controls if your materials receive shadows. + + Now, lets create a configuration for our reflection render targets that disables shadows for all materials. Paste the following in a new file with the extension '.configuration': + + \code + configuration reflection_targets + { + shadows false + } + \endcode + + \note You may also create configurations using sh::Factory::registerConfiguration. + + The active Configuration is controlled by the active material scheme in Ogre. So, in order to use the configuration "reflection_targets" for your reflection renders, simply call + \code + viewport->setMaterialScheme ("reflection_targets"); + \endcode + on the Ogre viewport of your reflection render! + +*/ diff --git a/extern/shiny/Docs/Doxyfile b/extern/shiny/Docs/Doxyfile new file mode 100644 index 000000000..3564c45f6 --- /dev/null +++ b/extern/shiny/Docs/Doxyfile @@ -0,0 +1,1826 @@ +# Doxyfile 1.8.1.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = shiny + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = /home/scrawl/sh_doxy/generated + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# style sheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50% before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/extern/shiny/Docs/GettingStarted.dox b/extern/shiny/Docs/GettingStarted.dox new file mode 100644 index 000000000..b9cf58e23 --- /dev/null +++ b/extern/shiny/Docs/GettingStarted.dox @@ -0,0 +1,65 @@ +/*! + \page getting-started Getting started + + \section download Download the source + + \code + git clone git@github.com:scrawl/shiny.git + \endcode + + \section building Build the source + + The source files you want to build are: + - Main/*.cpp + - Preprocessor/*.cpp (unless you are using the system install of boost::wave, more below) + - Platforms/Ogre/*.cpp + + You can either build the sources as a static library, or simply add the sources to the source tree of your project. + + If you use CMake, you might find the included CMakeLists.txt useful. It builds static libraries with the names "shiny" and "shiny.OgrePlatform". + + \note The CMakeLists.txt is not intended as a stand-alone build system! Instead, you should include this from the main CMakeLists of your project. + + Make sure to link against OGRE and the boost filesystem library. + + If your boost version is older than 1.49, you must set the SHINY_USE_WAVE_SYSTEM_INSTALL variable and additionally link against the boost wave library. + + \code + set(SHINY_USE_WAVE_SYSTEM_INSTALL "TRUE") + \endcode + + \section code Basic initialisation code + + Add the following code to your application: + + \code{cpp} + + #include + #include + + .... + + sh::OgrePlatform* platform = new sh::OgrePlatform( + "General", // OGRE Resource group to use for creating materials. + myApplication.getDataPath() + "/" + "materials" // Path to look for materials and shaders. NOTE: This does NOT use the Ogre resource system, so you have to specify an absolute path. + ); + + sh::Factory* factory = new sh::Factory(platform); + + // Set a language. Valid options: CG, HLSL, GLSL + factory->setCurrentLanguage(sh::Language_GLSL); + + factory->loadAllFiles(); + + .... + your application runs here + .... + + // don't forget to delete on exit + delete factory; + + \endcode + + That's it! Now you can start defining materials. Refer to the page \ref defining-materials-shaders . + +*/ diff --git a/extern/shiny/Docs/Lod.dox b/extern/shiny/Docs/Lod.dox new file mode 100644 index 000000000..37d004638 --- /dev/null +++ b/extern/shiny/Docs/Lod.dox @@ -0,0 +1,49 @@ +/*! + + \page lod Material LOD + + \section howitworks How it works + + When Ogre requests a technique for a specific LOD index, the Factory selects the appropriate LOD configuration which then temporarily overrides the global settings in the shaders. We can use this to disable shader features one by one at a lower LOD, resulting in simpler and faster techniques for distant objects. + + \section howtouseit How to use it + + - Create a file with the extension '.lod'. There you can specify shader features to disable at a specific LOD level. Higher LOD index refers to a lower LOD. Example contents: + + \code + lod_configuration 1 + { + specular_mapping false + } + + lod_configuration 2 + { + specular_mapping false + normal_mapping false + } + + lod_configuration 3 + { + terrain_composite_map true + specular_mapping false + normal_mapping false + } + \endcode + + \note You can also add LOD configurations by calling \a sh::Factory::registerLodConfiguration. + + \note Do not use an index of 0. LOD 0 refers to the highest LOD, and you will never want to disable features at the highest LOD level. + + + - In your materials, specify the distances at which a lower LOD kicks in. Note that the actual distance might also be affected by the viewport and current entity LOD bias. In this example, the first LOD level (lod index 1) would normally be applied at a distance of 100 units, the next after 300, and the last after 1000 units. + + \code + material sample_material + { + lod_values 100 300 1000 + + ... your passes, texture units etc ... + } + \endcode + +*/ diff --git a/extern/shiny/Docs/Macros.dox b/extern/shiny/Docs/Macros.dox new file mode 100644 index 000000000..0578c447f --- /dev/null +++ b/extern/shiny/Docs/Macros.dox @@ -0,0 +1,270 @@ +/*! + \page macros Shader Macros + + \tableofcontents + + \section Shader Language + + These macros are automatically defined, depending on the shader language that has been set by the application using sh::Factory::setCurrentLanguage. + + - SH_GLSL + - SH_HLSL + - SH_CG + + Example: + + \code + #if SH_GLSL == 1 + // glsl porting code + #endif + + #if SH_CG == 1 || SH_HLSL == 1 + // cg / hlsl porting code (similiar syntax) + #endif + \endcode + + \note It is encouraged to use the shipped porting header (extra/core.h) by #include-ing it in your shaders. If you do that, you should not have to use the above macros directly. + + \section vertex-fragment Vertex / fragment shader + + These macros are automatically defined, depending on the type of shader that is currently being compiled. + + - SH_VERTEX_SHADER + - SH_FRAGMENT_SHADER + + If you use the same source file for both vertex and fragment shader, then it is advised to use these macros for blending out the unused source. This will reduce your compile time. + + \section passthrough Vertex -> Fragment passthrough + + In shader development, a common task is to pass variables from the vertex to the fragment shader. This is no problem if you have a deterministic shader source (i.e. no #ifdefs). + + However, as soon as you begin to have lots of permutations of the same shader source, a problem arises. All current GPUs have a limit of 8 vertex to fragment passthroughs (with 4 components each, for example a float4). + + A common optimization is to put several individual float values together in a float4 (so-called "Packing"). But if your shader has lots of permutations and the passthrough elements you actually need are not known beforehand, it can be very tedious to pack manually. With the following macros, packing can become easier. + + \subsection shAllocatePassthrough shAllocatePassthrough + + Usage: \@shAllocatePassthrough(num_components, name) + + Example: + \code + #if FRAGMENT_NEED_DEPTH + @shAllocatePassthrough(1, depth) + #endif + \endcode + + This is the first thing you should do before using any of the macros below. + + \subsection shPassthroughVertexOutputs shPassthroughVertexOutputs + + Usage: \@shPassthroughVertexOutputs + + Use this in the inputs/outputs section of your vertex shader, in order to declare all the outputs that are needed for packing the variables that you want passed to the fragment. + + \subsection shPassthroughFragmentInputs shPassthroughFragmentInputs + + Usage: \@shPassthroughFragmentInputs + + Use this in the inputs/outputs section of your fragment shader, in order to declare all the inputs that are needed for receiving the variables that you want passed to the fragment. + + \subsection shPassthroughAssign shPassthroughAssign + + Usage: \@shPassthroughAssign(name, value) + + Use this in the vertex shader for assigning a value to the variable you want passed to the fragment. + + Example: + \code + #if FRAGMENT_NEED_DEPTH + @shPassthroughAssign(depth, shOutputPosition.z); + #endif + + \endcode + + \subsection shPassthroughReceive shPassthroughReceive + + Usage: \@shPassthroughReceive(name) + + Use this in the fragment shader to receive the passed value. + + Example: + + \code + #if FRAGMENT_NEED_DEPTH + float depth = @shPassthroughReceive(depth); + #endif + \endcode + + \section texUnits Texture units + + \subsection shUseSampler shUseSampler + + Usage: \@shUseSampler(samplerName) + + Requests the texture unit with name \a samplerName to be available for use in this pass. + + Why is this necessary? If you have a derived material that does not use all of the texture units that its parent defines (for example, if an optional asset such as a normal map is not available), there would be no way to know which texture units are actually needed and which can be skipped in the creation process (those that are never referenced in the shader). + + \section properties Property retrieval / binding + + \subsection shUniformProperty shUniformProperty + + Usage: \@shUniformProperty<4f|3f|2f|1f|int> (uniformName, property) + + Binds the value of \a property (from the shader_properties of the pass this shader belongs to) to the uniform with name \a uniformName. + + The following variants are available, depending on the type of your uniform variable: + - \@shUniformProperty4f + - \@shUniformProperty3f + - \@shUniformProperty2f + - \@shUniformProperty1f + - \@shUniformPropertyInt + + Example: \@shUniformProperty1f (uFresnelScale, fresnelScale) + + \subsection shPropertyBool shPropertyBool + + Retrieve a boolean property of the pass that this shader belongs to, gets replaced with either 0 or 1. + + Usage: \@shPropertyBool(propertyName) + + Example: + \code + #if @shPropertyBool(has_normal_map) + ... + #endif + \endcode + + \subsection shPropertyNotBool shPropertyNotBool + + Same as shPropertyBool, but inverts the result (i.e. when shPropertyBool would return 0, this returns 1 and vice versa) + + \subsection shPropertyString shPropertyString + + Retrieve a string property of the pass that this shader belongs to + + Usage: \@shPropertyString(propertyName) + + \subsection shPropertyEqual shPropertyEqual + + Check if the value of a property equals a specific value, gets replaced with either 0 or 1. This is useful because the preprocessor cannot compare strings, only numbers. + + Usage: \@shPropertyEqual(propertyName, value) + + Example: + \code + #if @shPropertyEqual(lighting_mode, phong) + ... + #endif + \endcode + + \section globalSettings Global settings + + \subsection shGlobalSettingBool shGlobalSettingBool + + Retrieves the boolean value of a specific global setting, gets replaced with either 0 or 1. The value can be set using sh::Factory::setGlobalSetting. + + Usage: \@shGlobalSettingBool(settingName) + + \subsection shGlobalSettingEqual shGlobalSettingEqual + + Check if the value of a global setting equals a specific value, gets replaced with either 0 or 1. This is useful because the preprocessor cannot compare strings, only numbers. + + Usage: \@shGlobalSettingEqual(settingName, value) + + \subsection shGlobalSettingString shGlobalSettingString + + Gets replaced with the current value of a given global setting. The value can be set using sh::Factory::setGlobalSetting. + + Usage: \@shGlobalSettingString(settingName) + + \section sharedParams Shared parameters + + \subsection shSharedParameter shSharedParameter + + Allows you to bind a custom value to a uniform parameter. + + Usage: \@shSharedParameter(sharedParameterName) + + Example: \@shSharedParameter(pssmSplitPoints) - now the uniform parameter 'pssmSplitPoints' can be altered in all shaders that use it by executing sh::Factory::setSharedParameter("pssmSplitPoints", value) + + \note You may use the same shared parameter in as many shaders as you want. But don't forget to add the \@shSharedParameter macro to every shader that uses this shared parameter. + + \section autoconstants Auto constants + + \subsection shAutoConstant shAutoConstant + + Usage: \@shAutoConstant(uniformName, autoConstantName, [extraData]) + + Example: \@shAutoConstant(uModelViewMatrix, worldviewproj_matrix) + + Example: \@shAutoConstant(uLightPosition4, light_position, 4) + + Binds auto constant with name \a autoConstantName to the uniform \a uniformName. Optionally, you may specify extra data (for example the light index), as required by some auto constants. + + The auto constant names are the same as Ogre's. Read the section "3.1.9 Using Vertex/Geometry/Fragment Programs in a Pass" of the Ogre manual for a list of all auto constant names. + + \section misc Misc + + \subsection shForeach shForeach + + Usage: \@shForeach(n) + + Repeats the content of this foreach block \a n times. The end of the block is marked via \@shEndForeach, and the current iteration number can be retrieved via \@shIterator. + + \note Nested foreach blocks are currently \a not supported. + + \note For technical reasons, you can only use constant numbers, properties (\@shPropertyString) or global settings (\@shGlobalSettingString) as \a n parameter. + + Example: + + \code + @shForeach(3) + this is iteration number @shIterator + @shEndForeach + + Gets replaced with: + + this is iteration number 0 + this is iteration number 1 + this is iteration number 2 + \endcode + + Optionally, you can pass a constant offset to \@shIterator. Example: + + \code + @shForeach(3) + this is iteration number @shIterator(7) + @shEndForeach + + Gets replaced with: + + this is iteration number 7 + this is iteration number 8 + this is iteration number 9 + \endcode + + \subsection shCounter shCounter + + Gets replaced after the preprocessing step with the number that equals the n-th occurence of counters of the same ID. + + Usage: \@shCounter(ID) + + Example: + \code + @shCounter(0) + @shCounter(0) + @shCounter(1) + @shCounter(0) + \endcode + + Gets replaced with: + + \code + 0 + 1 + 0 + 2 + \endcode + +*/ diff --git a/extern/shiny/Docs/Mainpage.dox b/extern/shiny/Docs/Mainpage.dox new file mode 100644 index 000000000..fb8f596dc --- /dev/null +++ b/extern/shiny/Docs/Mainpage.dox @@ -0,0 +1,13 @@ +/*! + + \mainpage + + - \ref getting-started + - \ref defining-materials-shaders + - \ref macros + - \ref configurations + - \ref lod + + - sh::Factory - the main interface class + +*/ diff --git a/extern/shiny/Docs/Materials.dox b/extern/shiny/Docs/Materials.dox new file mode 100644 index 000000000..2dae60560 --- /dev/null +++ b/extern/shiny/Docs/Materials.dox @@ -0,0 +1,128 @@ +/*! + + \page defining-materials-shaders Defining materials and shaders + + \section first-material Your first material + + Create a file called "myFirstMaterial.mat" and place it in the path you have used in your initialisation code (see \ref getting-started). Paste the following: + + \code + + material my_first_material + { + diffuse 1.0 1.0 1.0 1.0 + specular 0.4 0.4 0.4 32 + ambient 1.0 1.0 1.0 + emissive 0.0 0.0 0.0 + diffuseMap black.png + + pass + { + diffuse $diffuse + specular $specular + ambient $ambient + emissive $emissive + + texture_unit diffuseMap + { + texture $diffuseMap + create_in_ffp true // use this texture unit for fixed function pipeline + } + } + } + + material material1 + { + parent my_first_material + diffuseMap texture1.png + } + + material material2 + { + parent my_first_material + diffuseMap texture2.png + } + + \endcode + + \section first-shader The first shader + + Change the 'pass' section to include some shaders: + + \code + pass + { + vertex_program my_first_shader_vertex + fragment_program my_first_shader_fragment + ... + } + \endcode + + \note This does \a not refer to a single shader with a fixed source code, but in fact will automatically create a new \a instance of this shader (if necessary), which can have its own uniform variables, compile-time macros and much more! + + Next, we're going to define our shaders. Paste this in a new file called 'myfirstshader.shaderset' + + \code + shader_set my_first_shader_vertex + { + source example.shader + type vertex + profiles_cg vs_2_0 arbvp1 + profiles_hlsl vs_2_0 + } + + shader_set my_first_shader_fragment + { + source example.shader + type fragment + profiles_cg ps_2_x ps_2_0 ps arbfp1 + profiles_hlsl ps_2_0 + } + \endcode + + Some notes: + - There is no entry_point property because the entry point is always \a main. + - Both profiles_cg and profiles_hlsl are a list of shader profiles. The first profile that is supported is automatically picked. GLSL does not have shader profiles. + + Now, let's get into writing our shader! As you can guess from above, the filename should be 'example.shader' + + \code + #include "core.h" + + #ifdef SH_VERTEX_SHADER + + SH_BEGIN_PROGRAM + shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix) + shInput(float2, uv0) + shOutput(float2, UV) + SH_START_PROGRAM + { + shOutputPosition = shMatrixMult(wvp, shInputPosition); + UV = uv0; + } + + #else + + SH_BEGIN_PROGRAM + // NOTE: It is important that the sampler name here (diffuseMap) matches + // the name of the texture unit in the material. This is necessary because the system + // skips texture units that are never "referenced" in the shader. This can be the case + // when your base material has optional assets (for example a normal map) that are not + // used by some derived materials. + shSampler2D(diffuseMap) + shInput(float2, UV) + SH_START_PROGRAM + { + shOutputColour(0) = shSample(diffuseMap, UV); + } + + #endif + + \endcode + + There you have it! This shader will compile in several languages thanks to the porting defines in "core.h". If you need more defines, feel free to add them and don't forget to send them to me! + + For a full list of macros available when writing your shaders, refer to the page \ref macros + + In the future, some more in-depth shader examples might follow. +*/ diff --git a/extern/shiny/Extra/core.h b/extern/shiny/Extra/core.h new file mode 100644 index 000000000..cba716777 --- /dev/null +++ b/extern/shiny/Extra/core.h @@ -0,0 +1,168 @@ +#if SH_HLSL == 1 || SH_CG == 1 + + #define shTexture2D sampler2D + #define shSample(tex, coord) tex2D(tex, coord) + #define shCubicSample(tex, coord) texCUBE(tex, coord) + #define shLerp(a, b, t) lerp(a, b, t) + #define shSaturate(a) saturate(a) + + #define shSampler2D(name) , uniform sampler2D name : register(s@shCounter(0)) @shUseSampler(name) + + #define shSamplerCube(name) , uniform samplerCUBE name : register(s@shCounter(0)) @shUseSampler(name) + + #define shMatrixMult(m, v) mul(m, v) + + #define shUniform(type, name) , uniform type name + + #define shTangentInput(type) , in type tangent : TANGENT + #define shVertexInput(type, name) , in type name : TEXCOORD@shCounter(1) + #define shInput(type, name) , in type name : TEXCOORD@shCounter(1) + #define shOutput(type, name) , out type name : TEXCOORD@shCounter(2) + + #define shNormalInput(type) , in type normal : NORMAL + + #define shColourInput(type) , in type colour : COLOR + + #ifdef SH_VERTEX_SHADER + + #define shOutputPosition oPosition + #define shInputPosition iPosition + + + #define SH_BEGIN_PROGRAM \ + void main( \ + float4 iPosition : POSITION \ + , out float4 oPosition : POSITION + + #define SH_START_PROGRAM \ + ) \ + + #endif + + #ifdef SH_FRAGMENT_SHADER + + #define shOutputColour(num) oColor##num + + #define shDeclareMrtOutput(num) , out float4 oColor##num : COLOR##num + + #define SH_BEGIN_PROGRAM \ + void main( \ + out float4 oColor0 : COLOR + + #define SH_START_PROGRAM \ + ) \ + + #endif + +#endif + +#if SH_GLSL == 1 + + @version 120 + + #define float2 vec2 + #define float3 vec3 + #define float4 vec4 + #define int2 ivec2 + #define int3 ivec3 + #define int4 ivec4 + #define shTexture2D sampler2D + #define shSample(tex, coord) texture2D(tex, coord) + #define shCubicSample(tex, coord) textureCube(tex, coord) + #define shLerp(a, b, t) mix(a, b, t) + #define shSaturate(a) clamp(a, 0.0, 1.0) + + #define shUniform(type, name) uniform type name; + + #define shSampler2D(name) uniform sampler2D name; @shUseSampler(name) + + #define shSamplerCube(name) uniform samplerCube name; @shUseSampler(name) + + #define shMatrixMult(m, v) (m * v) + + #define shOutputPosition gl_Position + + #define float4x4 mat4 + #define float3x3 mat3 + + // GLSL 1.3 + #if 0 + + // automatically recognized by ogre when the input name equals this + #define shInputPosition vertex + + #define shOutputColour(num) oColor##num + + #define shTangentInput(type) in type tangent; + #define shVertexInput(type, name) in type name; + #define shInput(type, name) in type name; + #define shOutput(type, name) out type name; + + // automatically recognized by ogre when the input name equals this + #define shNormalInput(type) in type normal; + #define shColourInput(type) in type colour; + + #ifdef SH_VERTEX_SHADER + + #define SH_BEGIN_PROGRAM \ + in float4 vertex; + #define SH_START_PROGRAM \ + void main(void) + + #endif + + #ifdef SH_FRAGMENT_SHADER + + #define shDeclareMrtOutput(num) out vec4 oColor##num; + + #define SH_BEGIN_PROGRAM \ + out float4 oColor0; + #define SH_START_PROGRAM \ + void main(void) + + + #endif + + #endif + + // GLSL 1.2 + + #if 1 + + // automatically recognized by ogre when the input name equals this + #define shInputPosition vertex + + #define shOutputColour(num) gl_FragData[num] + + #define shTangentInput(type) attribute type tangent; + #define shVertexInput(type, name) attribute type name; + #define shInput(type, name) varying type name; + #define shOutput(type, name) varying type name; + + // automatically recognized by ogre when the input name equals this + #define shNormalInput(type) attribute type normal; + #define shColourInput(type) attribute type colour; + + #ifdef SH_VERTEX_SHADER + + #define SH_BEGIN_PROGRAM \ + attribute vec4 vertex; + #define SH_START_PROGRAM \ + void main(void) + + #endif + + #ifdef SH_FRAGMENT_SHADER + + #define shDeclareMrtOutput(num) + + #define SH_BEGIN_PROGRAM + + #define SH_START_PROGRAM \ + void main(void) + + + #endif + + #endif +#endif diff --git a/extern/shiny/License.txt b/extern/shiny/License.txt new file mode 100644 index 000000000..d89bcf3ad --- /dev/null +++ b/extern/shiny/License.txt @@ -0,0 +1,9 @@ +Copyright (c) 2012 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + diff --git a/extern/shiny/Main/Factory.cpp b/extern/shiny/Main/Factory.cpp new file mode 100644 index 000000000..678ee25c9 --- /dev/null +++ b/extern/shiny/Main/Factory.cpp @@ -0,0 +1,583 @@ +#include "Factory.hpp" + +#include +#include + +#include +#include +#include + +#include "Platform.hpp" +#include "ScriptLoader.hpp" +#include "ShaderSet.hpp" +#include "MaterialInstanceTextureUnit.hpp" + +namespace sh +{ + Factory* Factory::sThis = 0; + + Factory& Factory::getInstance() + { + assert (sThis); + return *sThis; + } + + Factory* Factory::getInstancePtr() + { + return sThis; + } + + Factory::Factory (Platform* platform) + : mPlatform(platform) + , mShadersEnabled(true) + , mShaderDebugOutputEnabled(false) + , mCurrentLanguage(Language_None) + , mListener(NULL) + , mCurrentConfiguration(NULL) + , mCurrentLodConfiguration(NULL) + , mReadMicrocodeCache(false) + , mWriteMicrocodeCache(false) + , mReadSourceCache(false) + , mWriteSourceCache(false) + { + assert (!sThis); + sThis = this; + + mPlatform->setFactory(this); + } + + void Factory::loadAllFiles() + { + assert(mCurrentLanguage != Language_None); + + bool anyShaderDirty = false; + + if (boost::filesystem::exists (mPlatform->getCacheFolder () + "/lastModified.txt")) + { + std::ifstream file; + file.open(std::string(mPlatform->getCacheFolder () + "/lastModified.txt").c_str()); + + std::string line; + while (getline(file, line)) + { + std::string sourceFile = line; + + if (!getline(file, line)) + assert(0); + + int modified = boost::lexical_cast(line); + + mShadersLastModified[sourceFile] = modified; + } + } + + // load configurations + { + ScriptLoader shaderSetLoader(".configuration"); + ScriptLoader::loadAllFiles (&shaderSetLoader, mPlatform->getBasePath()); + std::map nodes = shaderSetLoader.getAllConfigScripts(); + for (std::map ::const_iterator it = nodes.begin(); + it != nodes.end(); ++it) + { + if (!(it->second->getName() == "configuration")) + { + std::cerr << "sh::Factory: Warning: Unsupported root node type \"" << it->second->getName() << "\" for file type .configuration" << std::endl; + break; + } + + PropertySetGet newConfiguration; + newConfiguration.setParent(&mGlobalSettings); + + std::vector props = it->second->getChildren(); + for (std::vector::const_iterator propIt = props.begin(); propIt != props.end(); ++propIt) + { + std::string name = (*propIt)->getName(); + std::string val = (*propIt)->getValue(); + + newConfiguration.setProperty (name, makeProperty(val)); + } + + mConfigurations[it->first] = newConfiguration; + } + } + + // load lod configurations + { + ScriptLoader lodLoader(".lod"); + ScriptLoader::loadAllFiles (&lodLoader, mPlatform->getBasePath()); + std::map nodes = lodLoader.getAllConfigScripts(); + for (std::map ::const_iterator it = nodes.begin(); + it != nodes.end(); ++it) + { + if (!(it->second->getName() == "lod_configuration")) + { + std::cerr << "sh::Factory: Warning: Unsupported root node type \"" << it->second->getName() << "\" for file type .lod" << std::endl; + break; + } + + if (it->first == "0") + { + throw std::runtime_error("lod level 0 (max lod) can't have a configuration"); + } + + PropertySetGet newLod; + + std::vector props = it->second->getChildren(); + for (std::vector::const_iterator propIt = props.begin(); propIt != props.end(); ++propIt) + { + std::string name = (*propIt)->getName(); + std::string val = (*propIt)->getValue(); + + newLod.setProperty (name, makeProperty(val)); + } + + mLodConfigurations[boost::lexical_cast(it->first)] = newLod; + } + } + + // load shader sets + { + ScriptLoader shaderSetLoader(".shaderset"); + ScriptLoader::loadAllFiles (&shaderSetLoader, mPlatform->getBasePath()); + std::map nodes = shaderSetLoader.getAllConfigScripts(); + for (std::map ::const_iterator it = nodes.begin(); + it != nodes.end(); ++it) + { + if (!(it->second->getName() == "shader_set")) + { + std::cerr << "sh::Factory: Warning: Unsupported root node type \"" << it->second->getName() << "\" for file type .shaderset" << std::endl; + break; + } + + if (!it->second->findChild("profiles_cg")) + throw std::runtime_error ("missing \"profiles_cg\" field for \"" + it->first + "\""); + if (!it->second->findChild("profiles_hlsl")) + throw std::runtime_error ("missing \"profiles_hlsl\" field for \"" + it->first + "\""); + if (!it->second->findChild("source")) + throw std::runtime_error ("missing \"source\" field for \"" + it->first + "\""); + if (!it->second->findChild("type")) + throw std::runtime_error ("missing \"type\" field for \"" + it->first + "\""); + + std::vector profiles_cg; + boost::split (profiles_cg, it->second->findChild("profiles_cg")->getValue(), boost::is_any_of(" ")); + std::string cg_profile; + for (std::vector::iterator it2 = profiles_cg.begin(); it2 != profiles_cg.end(); ++it2) + { + if (mPlatform->isProfileSupported(*it2)) + { + cg_profile = *it2; + break; + } + } + + std::vector profiles_hlsl; + boost::split (profiles_hlsl, it->second->findChild("profiles_hlsl")->getValue(), boost::is_any_of(" ")); + std::string hlsl_profile; + for (std::vector::iterator it2 = profiles_hlsl.begin(); it2 != profiles_hlsl.end(); ++it2) + { + if (mPlatform->isProfileSupported(*it2)) + { + hlsl_profile = *it2; + break; + } + } + + std::string sourceFile = mPlatform->getBasePath() + "/" + it->second->findChild("source")->getValue(); + + ShaderSet newSet (it->second->findChild("type")->getValue(), cg_profile, hlsl_profile, + sourceFile, + mPlatform->getBasePath(), + it->first, + &mGlobalSettings); + + int lastModified = boost::filesystem::last_write_time (boost::filesystem::path(sourceFile)); + if (mShadersLastModified.find(sourceFile) != mShadersLastModified.end() + && mShadersLastModified[sourceFile] != lastModified) + { + newSet.markDirty (); + anyShaderDirty = true; + } + + mShadersLastModified[sourceFile] = lastModified; + + mShaderSets.insert(std::make_pair(it->first, newSet)); + } + } + + // load materials + { + ScriptLoader materialLoader(".mat"); + ScriptLoader::loadAllFiles (&materialLoader, mPlatform->getBasePath()); + + std::map nodes = materialLoader.getAllConfigScripts(); + for (std::map ::const_iterator it = nodes.begin(); + it != nodes.end(); ++it) + { + if (!(it->second->getName() == "material")) + { + std::cerr << "sh::Factory: Warning: Unsupported root node type \"" << it->second->getName() << "\" for file type .mat" << std::endl; + break; + } + + MaterialInstance newInstance(it->first, this); + newInstance.create(mPlatform); + if (!mShadersEnabled) + newInstance.setShadersEnabled (false); + + newInstance.setSourceFile (it->second->m_fileName); + + std::vector props = it->second->getChildren(); + for (std::vector::const_iterator propIt = props.begin(); propIt != props.end(); ++propIt) + { + std::string name = (*propIt)->getName(); + + std::string val = (*propIt)->getValue(); + + if (name == "pass") + { + MaterialInstancePass* newPass = newInstance.createPass(); + std::vector props2 = (*propIt)->getChildren(); + for (std::vector::const_iterator propIt2 = props2.begin(); propIt2 != props2.end(); ++propIt2) + { + std::string name2 = (*propIt2)->getName(); + std::string val2 = (*propIt2)->getValue(); + + if (name2 == "shader_properties") + { + std::vector shaderProps = (*propIt2)->getChildren(); + for (std::vector::const_iterator shaderPropIt = shaderProps.begin(); shaderPropIt != shaderProps.end(); ++shaderPropIt) + { + std::string val = (*shaderPropIt)->getValue(); + newPass->mShaderProperties.setProperty((*shaderPropIt)->getName(), makeProperty(val)); + } + } + else if (name2 == "texture_unit") + { + MaterialInstanceTextureUnit* newTex = newPass->createTextureUnit(val2); + std::vector texProps = (*propIt2)->getChildren(); + for (std::vector::const_iterator texPropIt = texProps.begin(); texPropIt != texProps.end(); ++texPropIt) + { + std::string val = (*texPropIt)->getValue(); + newTex->setProperty((*texPropIt)->getName(), makeProperty(val)); + } + } + else + newPass->setProperty((*propIt2)->getName(), makeProperty(val2)); + } + } + else if (name == "parent") + newInstance.setParentInstance(val); + else + newInstance.setProperty((*propIt)->getName(), makeProperty(val)); + } + + if (newInstance.hasProperty("create_configuration")) + { + std::string config = retrieveValue(newInstance.getProperty("create_configuration"), NULL).get(); + newInstance.createForConfiguration (config, 0); + } + + mMaterials.insert (std::make_pair(it->first, newInstance)); + } + + // now that all materials are loaded, replace the parent names with the actual pointers to parent + for (MaterialMap::iterator it = mMaterials.begin(); it != mMaterials.end(); ++it) + { + std::string parent = it->second.getParentInstance(); + if (parent != "") + { + if (mMaterials.find (it->second.getParentInstance()) == mMaterials.end()) + throw std::runtime_error ("Unable to find parent for material instance \"" + it->first + "\""); + it->second.setParent(&mMaterials.find(parent)->second); + } + } + } + + if (mPlatform->supportsShaderSerialization () && mReadMicrocodeCache && !anyShaderDirty) + { + std::string file = mPlatform->getCacheFolder () + "/shShaderCache.txt"; + if (boost::filesystem::exists(file)) + { + mPlatform->deserializeShaders (file); + } + } + } + + Factory::~Factory () + { + if (mPlatform->supportsShaderSerialization () && mWriteMicrocodeCache) + { + std::string file = mPlatform->getCacheFolder () + "/shShaderCache.txt"; + mPlatform->serializeShaders (file); + } + + if (mReadSourceCache) + { + // save the last modified time of shader sources + std::ofstream file; + file.open(std::string(mPlatform->getCacheFolder () + "/lastModified.txt").c_str()); + + for (LastModifiedMap::const_iterator it = mShadersLastModified.begin(); it != mShadersLastModified.end(); ++it) + { + file << it->first << "\n" << it->second << std::endl; + } + + file.close(); + } + + delete mPlatform; + sThis = 0; + } + + MaterialInstance* Factory::searchInstance (const std::string& name) + { + if (mMaterials.find(name) != mMaterials.end()) + return &mMaterials.find(name)->second; + + return NULL; + } + + MaterialInstance* Factory::findInstance (const std::string& name) + { + assert (mMaterials.find(name) != mMaterials.end()); + return &mMaterials.find(name)->second; + } + + MaterialInstance* Factory::requestMaterial (const std::string& name, const std::string& configuration, unsigned short lodIndex) + { + MaterialInstance* m = searchInstance (name); + + if (configuration != "Default" && mConfigurations.find(configuration) == mConfigurations.end()) + return NULL; + + if (m) + { + // make sure all lod techniques below (higher lod) exist + int i = lodIndex; + while (i>0) + { + --i; + m->createForConfiguration (configuration, i); + + if (mListener) + mListener->materialCreated (m, configuration, i); + } + + m->createForConfiguration (configuration, lodIndex); + if (mListener) + mListener->materialCreated (m, configuration, lodIndex); + } + return m; + } + + MaterialInstance* Factory::createMaterialInstance (const std::string& name, const std::string& parentInstance) + { + if (parentInstance != "" && mMaterials.find(parentInstance) == mMaterials.end()) + throw std::runtime_error ("trying to clone material that does not exist"); + + MaterialInstance newInstance(name, this); + + if (!mShadersEnabled) + newInstance.setShadersEnabled(false); + + if (parentInstance != "") + newInstance.setParent (&mMaterials.find(parentInstance)->second); + + newInstance.create(mPlatform); + + mMaterials.insert (std::make_pair(name, newInstance)); + + return &mMaterials.find(name)->second; + } + + void Factory::destroyMaterialInstance (const std::string& name) + { + if (mMaterials.find(name) != mMaterials.end()) + mMaterials.erase(name); + } + + void Factory::setShadersEnabled (bool enabled) + { + mShadersEnabled = enabled; + for (MaterialMap::iterator it = mMaterials.begin(); it != mMaterials.end(); ++it) + { + it->second.setShadersEnabled(enabled); + } + } + + void Factory::setGlobalSetting (const std::string& name, const std::string& value) + { + bool changed = true; + if (mGlobalSettings.hasProperty(name)) + changed = (retrieveValue(mGlobalSettings.getProperty(name), NULL).get() != value); + + mGlobalSettings.setProperty (name, makeProperty(new StringValue(value))); + + if (changed) + { + for (MaterialMap::iterator it = mMaterials.begin(); it != mMaterials.end(); ++it) + { + it->second.destroyAll(); + } + } + } + + void Factory::setSharedParameter (const std::string& name, PropertyValuePtr value) + { + mPlatform->setSharedParameter(name, value); + } + + ShaderSet* Factory::getShaderSet (const std::string& name) + { + return &mShaderSets.find(name)->second; + } + + Platform* Factory::getPlatform () + { + return mPlatform; + } + + Language Factory::getCurrentLanguage () + { + return mCurrentLanguage; + } + + void Factory::setCurrentLanguage (Language lang) + { + bool changed = (mCurrentLanguage != lang); + mCurrentLanguage = lang; + + if (changed) + { + for (MaterialMap::iterator it = mMaterials.begin(); it != mMaterials.end(); ++it) + { + it->second.destroyAll(); + } + } + } + + MaterialInstance* Factory::getMaterialInstance (const std::string& name) + { + return findInstance(name); + } + + void Factory::setTextureAlias (const std::string& alias, const std::string& realName) + { + mTextureAliases[alias] = realName; + + // update the already existing texture units + for (std::map::iterator it = mTextureAliasInstances.begin(); it != mTextureAliasInstances.end(); ++it) + { + if (it->second == alias) + { + it->first->setTextureName(realName); + } + } + } + + std::string Factory::retrieveTextureAlias (const std::string& name) + { + if (mTextureAliases.find(name) != mTextureAliases.end()) + return mTextureAliases[name]; + else + return ""; + } + + PropertySetGet* Factory::getConfiguration (const std::string& name) + { + return &mConfigurations[name]; + } + + void Factory::registerConfiguration (const std::string& name, PropertySetGet configuration) + { + mConfigurations[name] = configuration; + mConfigurations[name].setParent (&mGlobalSettings); + } + + void Factory::registerLodConfiguration (int index, PropertySetGet configuration) + { + mLodConfigurations[index] = configuration; + } + + void Factory::setMaterialListener (MaterialListener* listener) + { + mListener = listener; + } + + void Factory::addTextureAliasInstance (const std::string& name, TextureUnitState* t) + { + mTextureAliasInstances[t] = name; + } + + void Factory::removeTextureAliasInstances (TextureUnitState* t) + { + mTextureAliasInstances.erase(t); + } + + void Factory::setActiveConfiguration (const std::string& configuration) + { + if (configuration == "Default") + mCurrentConfiguration = 0; + else + { + assert (mConfigurations.find(configuration) != mConfigurations.end()); + mCurrentConfiguration = &mConfigurations[configuration]; + } + } + + void Factory::setActiveLodLevel (int level) + { + if (level == 0) + mCurrentLodConfiguration = 0; + else + { + assert (mLodConfigurations.find(level) != mLodConfigurations.end()); + mCurrentLodConfiguration = &mLodConfigurations[level]; + } + } + + void Factory::setShaderDebugOutputEnabled (bool enabled) + { + mShaderDebugOutputEnabled = enabled; + } + + PropertySetGet* Factory::getCurrentGlobalSettings() + { + PropertySetGet* p = &mGlobalSettings; + + // current global settings are affected by active configuration & active lod configuration + + if (mCurrentConfiguration) + { + p = mCurrentConfiguration; + } + + if (mCurrentLodConfiguration) + { + mCurrentLodConfiguration->setParent(p); + p = mCurrentLodConfiguration; + } + + return p; + } + + void Factory::saveMaterials (const std::string& filename) + { + std::ofstream file; + file.open (filename.c_str ()); + + for (MaterialMap::iterator it = mMaterials.begin(); it != mMaterials.end(); ++it) + { + it->second.save(file); + } + + file.close(); + } + + void Factory::_ensureMaterial(const std::string& name, const std::string& configuration) + { + MaterialInstance* m = searchInstance (name); + assert(m); + m->createForConfiguration (configuration, 0); + } +} diff --git a/extern/shiny/Main/Factory.hpp b/extern/shiny/Main/Factory.hpp new file mode 100644 index 000000000..799dd71eb --- /dev/null +++ b/extern/shiny/Main/Factory.hpp @@ -0,0 +1,207 @@ +#ifndef SH_FACTORY_H +#define SH_FACTORY_H + +#include +#include + +#include "MaterialInstance.hpp" +#include "ShaderSet.hpp" +#include "Language.hpp" + +namespace sh +{ + class Platform; + + typedef std::map MaterialMap; + typedef std::map ShaderSetMap; + typedef std::map ConfigurationMap; + typedef std::map LodConfigurationMap; + typedef std::map LastModifiedMap; + + typedef std::map TextureAliasMap; + + /** + * @brief + * Allows you to be notified when a certain material was just created. Useful for changing material properties that you can't + * do in a .mat script (for example a series of animated textures) \n + * When receiving the event, you can get the platform material by calling m->getMaterial() + * and casting that to the platform specific material (e.g. for Ogre, sh::OgreMaterial) + */ + class MaterialListener + { + public: + virtual void materialCreated (MaterialInstance* m, const std::string& configuration, unsigned short lodIndex) = 0; + }; + + /** + * @brief + * The main interface class + */ + class Factory + { + public: + Factory(Platform* platform); + ///< @note Ownership of \a platform is transferred to this class, so you don't have to delete it. + + ~Factory(); + + /** + * Create a MaterialInstance, optionally copying all properties from \a parentInstance + * @param name name of the new instance + * @param name of the parent (optional) + * @return newly created instance + */ + MaterialInstance* createMaterialInstance (const std::string& name, const std::string& parentInstance = ""); + + /// @note It is safe to call this if the instance does not exist + void destroyMaterialInstance (const std::string& name); + + /// Use this to enable or disable shaders on-the-fly + void setShadersEnabled (bool enabled); + + /// write generated shaders to current directory, useful for debugging + void setShaderDebugOutputEnabled (bool enabled); + + /// Use this to manage user settings. \n + /// Global settings can be retrieved in shaders through a macro. \n + /// When a global setting is changed, the shaders that depend on them are recompiled automatically. + void setGlobalSetting (const std::string& name, const std::string& value); + + /// Adjusts the given shared parameter. \n + /// Internally, this will change all uniform parameters of this name marked with the macro \@shSharedParameter \n + /// @param name of the shared parameter + /// @param value of the parameter, use sh::makeProperty to construct this value + void setSharedParameter (const std::string& name, PropertyValuePtr value); + + Language getCurrentLanguage (); + + /// Switch between different shader languages (cg, glsl, hlsl) + void setCurrentLanguage (Language lang); + + /// Get a MaterialInstance by name + MaterialInstance* getMaterialInstance (const std::string& name); + + /// Register a configuration, which can then be used by switching the active material scheme + void registerConfiguration (const std::string& name, PropertySetGet configuration); + + /// Register a lod configuration, which can then be used by setting up lod distance values for the material \n + /// 0 refers to highest lod, so use 1 or higher as index parameter + void registerLodConfiguration (int index, PropertySetGet configuration); + + /// Set an alias name for a texture, the real name can then be retrieved with the "texture_alias" + /// property in a texture unit - this is useful if you don't know the name of your texture beforehand. \n + /// Example: \n + /// - In the material definition: texture_alias ReflectionMap \n + /// - At runtime: factory->setTextureAlias("ReflectionMap", "rtt_654654"); \n + /// You can call factory->setTextureAlias as many times as you want, and if the material was already created, its texture will be updated! + void setTextureAlias (const std::string& alias, const std::string& realName); + + /// Retrieve the real texture name for a texture alias (the real name is set by the user) + std::string retrieveTextureAlias (const std::string& name); + + /// Attach a listener for material created events + void setMaterialListener (MaterialListener* listener); + + /// Call this after you have set up basic stuff, like the shader language. + void loadAllFiles (); + + /// Controls writing of generated shader source code to the cache folder, so that the + /// (rather expensive) preprocessing step can be skipped on the next run. See Factory::setReadSourceCache \n + /// \note The default is off (no cache writing) + void setWriteSourceCache(bool write) { mWriteSourceCache = write; } + + /// Controls reading of generated shader sources from the cache folder + /// \note The default is off (no cache reading) + /// \note Even if microcode caching is enabled, generating (or caching) the source is still required due to the macros. + void setReadSourceCache(bool read) { mReadSourceCache = read; } + + /// Controls writing the microcode of the generated shaders to the cache folder. Microcode is machine independent + /// and loads very fast compared to regular compilation. Note that the availability of this feature depends on the \a Platform. + /// \note The default is off (no cache writing) + void setWriteMicrocodeCache(bool write) { mWriteMicrocodeCache = write; } + + /// Controls reading of shader microcode from the cache folder. Microcode is machine independent + /// and loads very fast compared to regular compilation. Note that the availability of this feature depends on the \a Platform. + /// \note The default is off (no cache reading) + void setReadMicrocodeCache(bool read) { mReadMicrocodeCache = read; } + + /// Saves all the materials that were initially loaded from the file with this name + void saveMaterials (const std::string& filename); + + static Factory& getInstance(); + ///< Return instance of this class. + + static Factory* getInstancePtr(); + + /// Make sure a material technique is loaded.\n + /// You will probably never have to use this. + void _ensureMaterial(const std::string& name, const std::string& configuration); + + private: + + MaterialInstance* requestMaterial (const std::string& name, const std::string& configuration, unsigned short lodIndex); + ShaderSet* getShaderSet (const std::string& name); + PropertySetGet* getConfiguration (const std::string& name); + Platform* getPlatform (); + + PropertySetGet* getCurrentGlobalSettings(); + + void addTextureAliasInstance (const std::string& name, TextureUnitState* t); + void removeTextureAliasInstances (TextureUnitState* t); + + std::string getCacheFolder () { return mPlatform->getCacheFolder (); } + bool getReadSourceCache() { return mReadSourceCache; } + bool getWriteSourceCache() { return mReadSourceCache; } + public: + bool getWriteMicrocodeCache() { return mWriteMicrocodeCache; } // Fixme + + private: + void setActiveConfiguration (const std::string& configuration); + void setActiveLodLevel (int level); + + bool getShaderDebugOutputEnabled() { return mShaderDebugOutputEnabled; } + + std::map mTextureAliasInstances; + + friend class Platform; + friend class MaterialInstance; + friend class ShaderInstance; + friend class ShaderSet; + friend class TextureUnitState; + + private: + static Factory* sThis; + + bool mShadersEnabled; + bool mShaderDebugOutputEnabled; + + bool mReadMicrocodeCache; + bool mWriteMicrocodeCache; + bool mReadSourceCache; + bool mWriteSourceCache; + + MaterialMap mMaterials; + ShaderSetMap mShaderSets; + ConfigurationMap mConfigurations; + LodConfigurationMap mLodConfigurations; + LastModifiedMap mShadersLastModified; + + PropertySetGet mGlobalSettings; + + PropertySetGet* mCurrentConfiguration; + PropertySetGet* mCurrentLodConfiguration; + + TextureAliasMap mTextureAliases; + + Language mCurrentLanguage; + + MaterialListener* mListener; + + Platform* mPlatform; + + MaterialInstance* findInstance (const std::string& name); + MaterialInstance* searchInstance (const std::string& name); + }; +} + +#endif diff --git a/extern/shiny/Main/Language.hpp b/extern/shiny/Main/Language.hpp new file mode 100644 index 000000000..20bf8ed61 --- /dev/null +++ b/extern/shiny/Main/Language.hpp @@ -0,0 +1,16 @@ +#ifndef SH_LANGUAGE_H +#define SH_LANGUAGE_H + +namespace sh +{ + enum Language + { + Language_CG, + Language_HLSL, + Language_GLSL, + Language_Count, + Language_None + }; +} + +#endif diff --git a/extern/shiny/Main/MaterialInstance.cpp b/extern/shiny/Main/MaterialInstance.cpp new file mode 100644 index 000000000..0f8bcdda7 --- /dev/null +++ b/extern/shiny/Main/MaterialInstance.cpp @@ -0,0 +1,220 @@ +#include "MaterialInstance.hpp" + +#include + +#include "Factory.hpp" +#include "ShaderSet.hpp" + +namespace sh +{ + MaterialInstance::MaterialInstance (const std::string& name, Factory* f) + : mName(name) + , mShadersEnabled(true) + , mFactory(f) + , mListener(NULL) + { + } + + MaterialInstance::~MaterialInstance () + { + } + + void MaterialInstance::setParentInstance (const std::string& name) + { + mParentInstance = name; + } + + std::string MaterialInstance::getParentInstance () + { + return mParentInstance; + } + + void MaterialInstance::create (Platform* platform) + { + mMaterial = platform->createMaterial(mName); + + if (hasProperty ("shadow_caster_material")) + mMaterial->setShadowCasterMaterial (retrieveValue(getProperty("shadow_caster_material"), NULL).get()); + + if (hasProperty ("lod_values")) + mMaterial->setLodLevels (retrieveValue(getProperty("lod_values"), NULL).get()); + } + + void MaterialInstance::destroyAll () + { + if (hasProperty("create_configuration")) + return; + mMaterial->removeAll(); + mTexUnits.clear(); + } + + void MaterialInstance::setProperty (const std::string& name, PropertyValuePtr value) + { + PropertySetGet::setProperty (name, value); + destroyAll(); // trigger updates + } + + void MaterialInstance::createForConfiguration (const std::string& configuration, unsigned short lodIndex) + { + bool res = mMaterial->createConfiguration(configuration, lodIndex); + if (!res) + return; // listener was false positive + + if (mListener) + mListener->requestedConfiguration (this, configuration); + + mFactory->setActiveConfiguration (configuration); + mFactory->setActiveLodLevel (lodIndex); + + bool allowFixedFunction = true; + if (!mShadersEnabled && hasProperty("allow_fixed_function")) + { + allowFixedFunction = retrieveValue(getProperty("allow_fixed_function"), NULL).get(); + } + + bool useShaders = mShadersEnabled || !allowFixedFunction; + + // get passes of the top-most parent + PassVector passes = getPasses(); + if (passes.size() == 0) + throw std::runtime_error ("material \"" + mName + "\" does not have any passes"); + + for (PassVector::iterator it = passes.begin(); it != passes.end(); ++it) + { + boost::shared_ptr pass = mMaterial->createPass (configuration, lodIndex); + it->copyAll (pass.get(), this); + + // texture samplers used in the shaders + std::vector usedTextureSamplersVertex; + std::vector usedTextureSamplersFragment; + + PropertySetGet* context = this; + + // create or retrieve shaders + bool hasVertex = it->hasProperty("vertex_program"); + bool hasFragment = it->hasProperty("fragment_program"); + if (useShaders) + { + it->setContext(context); + it->mShaderProperties.setContext(context); + if (hasVertex) + { + ShaderSet* vertex = mFactory->getShaderSet(retrieveValue(it->getProperty("vertex_program"), context).get()); + ShaderInstance* v = vertex->getInstance(&it->mShaderProperties); + if (v) + { + pass->assignProgram (GPT_Vertex, v->getName()); + v->setUniformParameters (pass, &it->mShaderProperties); + + std::vector sharedParams = v->getSharedParameters (); + for (std::vector::iterator it = sharedParams.begin(); it != sharedParams.end(); ++it) + { + pass->addSharedParameter (GPT_Vertex, *it); + } + + std::vector vector = v->getUsedSamplers (); + usedTextureSamplersVertex.insert(usedTextureSamplersVertex.end(), vector.begin(), vector.end()); + } + } + if (hasFragment) + { + ShaderSet* fragment = mFactory->getShaderSet(retrieveValue(it->getProperty("fragment_program"), context).get()); + ShaderInstance* f = fragment->getInstance(&it->mShaderProperties); + if (f) + { + pass->assignProgram (GPT_Fragment, f->getName()); + f->setUniformParameters (pass, &it->mShaderProperties); + + std::vector sharedParams = f->getSharedParameters (); + for (std::vector::iterator it = sharedParams.begin(); it != sharedParams.end(); ++it) + { + pass->addSharedParameter (GPT_Fragment, *it); + } + + std::vector vector = f->getUsedSamplers (); + usedTextureSamplersFragment.insert(usedTextureSamplersFragment.end(), vector.begin(), vector.end()); + } + } + } + + // create texture units + std::vector texUnits = it->getTexUnits(); + int i=0; + for (std::vector::iterator texIt = texUnits.begin(); texIt != texUnits.end(); ++texIt ) + { + // only create those that are needed by the shader, OR those marked to be created in fixed function pipeline if shaders are disabled + bool foundVertex = std::find(usedTextureSamplersVertex.begin(), usedTextureSamplersVertex.end(), texIt->getName()) != usedTextureSamplersVertex.end(); + bool foundFragment = std::find(usedTextureSamplersFragment.begin(), usedTextureSamplersFragment.end(), texIt->getName()) != usedTextureSamplersFragment.end(); + if ( (foundVertex || foundFragment) + || (((!useShaders || (!hasVertex || !hasFragment)) && allowFixedFunction) && texIt->hasProperty("create_in_ffp") && retrieveValue(texIt->getProperty("create_in_ffp"), this).get())) + { + boost::shared_ptr texUnit = pass->createTextureUnitState (); + texIt->copyAll (texUnit.get(), context); + + mTexUnits.push_back(texUnit); + + // set texture unit indices (required by GLSL) + if (useShaders && ((hasVertex && foundVertex) || (hasFragment && foundFragment)) && mFactory->getCurrentLanguage () == Language_GLSL) + { + pass->setTextureUnitIndex (foundVertex ? GPT_Vertex : GPT_Fragment, texIt->getName(), i); + + ++i; + } + } + } + } + + if (mListener) + mListener->createdConfiguration (this, configuration); + } + + Material* MaterialInstance::getMaterial () + { + return mMaterial.get(); + } + + MaterialInstancePass* MaterialInstance::createPass () + { + mPasses.push_back (MaterialInstancePass()); + mPasses.back().setContext(this); + return &mPasses.back(); + } + + PassVector MaterialInstance::getPasses() + { + if (mParent) + return static_cast(mParent)->getPasses(); + else + return mPasses; + } + + void MaterialInstance::setShadersEnabled (bool enabled) + { + if (enabled == mShadersEnabled) + return; + mShadersEnabled = enabled; + + // trigger updates + if (mMaterial.get()) + destroyAll(); + } + + void MaterialInstance::save (std::ofstream& stream) + { + stream << "material " << mName << "\n" + << "{\n"; + + if (mParent) + { + stream << "\t" << static_cast(mParent)->getName() << "\n"; + } + + const PropertyMap& properties = listProperties (); + for (PropertyMap::const_iterator it = properties.begin(); it != properties.end(); ++it) + { + stream << "\t" << it->first << " " << retrieveValue(getProperty(it->first), NULL).get() << "\n"; + } + + stream << "}\n"; + } +} diff --git a/extern/shiny/Main/MaterialInstance.hpp b/extern/shiny/Main/MaterialInstance.hpp new file mode 100644 index 000000000..000f9d60c --- /dev/null +++ b/extern/shiny/Main/MaterialInstance.hpp @@ -0,0 +1,104 @@ +#ifndef SH_MATERIALINSTANCE_H +#define SH_MATERIALINSTANCE_H + +#include +#include + +#include "PropertyBase.hpp" +#include "Platform.hpp" +#include "MaterialInstancePass.hpp" + +namespace sh +{ + class Factory; + + typedef std::vector PassVector; + + /** + * @brief + * Allows you to be notified when a certain configuration for a material was just about to be created. \n + * Useful for adjusting some properties prior to the material being created (Or you could also re-create + * the whole material from scratch, i.e. use this as a method to create this material entirely in code) + */ + class MaterialInstanceListener + { + public: + virtual void requestedConfiguration (MaterialInstance* m, const std::string& configuration) = 0; ///< called before creating + virtual void createdConfiguration (MaterialInstance* m, const std::string& configuration) = 0; ///< called after creating + }; + + /** + * @brief + * A specific material instance, which has all required properties set + * (for example the diffuse & normal map, ambient/diffuse/specular values). \n + * Depending on these properties, the system will automatically select a shader permutation + * that suits these and create the backend materials / passes (provided by the \a Platform class). + */ + class MaterialInstance : public PropertySetGet + { + public: + MaterialInstance (const std::string& name, Factory* f); + virtual ~MaterialInstance (); + + MaterialInstancePass* createPass (); + PassVector getPasses(); ///< gets the passes of the top-most parent + + /// @attention Because the backend material passes are created on demand, the returned material here might not contain anything yet! + /// The only place where you should use this method, is for the MaterialInstance given by the MaterialListener::materialCreated event! + Material* getMaterial(); + + /// attach a \a MaterialInstanceListener to this specific material (as opposed to \a MaterialListener, which listens to all materials) + void setListener (MaterialInstanceListener* l) { mListener = l; } + + std::string getName() { return mName; } + + virtual void setProperty (const std::string& name, PropertyValuePtr value); + + private: + void setParentInstance (const std::string& name); + std::string getParentInstance (); + + void create (Platform* platform); + void createForConfiguration (const std::string& configuration, unsigned short lodIndex); + + void destroyAll (); + + void setShadersEnabled (bool enabled); + + void setSourceFile(const std::string& sourceFile) { mSourceFile = sourceFile; } + + std::string getSourceFile() { return mSourceFile; } + ///< get the name of the file this material was read from, or empty if it was created dynamically by code + + void save (std::ofstream& stream); + ///< this will only save the properties, not the passes and texture units, and as such + /// is only intended to be used for derived materials + + friend class Factory; + + + private: + std::string mParentInstance; + ///< this is only used during the file-loading phase. an instance could be loaded before its parent is loaded, + /// so initially only the parent's name is written to this member. + /// once all instances are loaded, the actual mParent pointer (from PropertySetGet class) can be set + + std::vector< boost::shared_ptr > mTexUnits; + + MaterialInstanceListener* mListener; + + PassVector mPasses; + + std::string mName; + + std::string mSourceFile; + + boost::shared_ptr mMaterial; + + bool mShadersEnabled; + + Factory* mFactory; + }; +} + +#endif diff --git a/extern/shiny/Main/MaterialInstancePass.cpp b/extern/shiny/Main/MaterialInstancePass.cpp new file mode 100644 index 000000000..b14476f4e --- /dev/null +++ b/extern/shiny/Main/MaterialInstancePass.cpp @@ -0,0 +1,16 @@ +#include "MaterialInstancePass.hpp" + +namespace sh +{ + + MaterialInstanceTextureUnit* MaterialInstancePass::createTextureUnit (const std::string& name) + { + mTexUnits.push_back(MaterialInstanceTextureUnit(name)); + return &mTexUnits.back(); + } + + std::vector MaterialInstancePass::getTexUnits () + { + return mTexUnits; + } +} diff --git a/extern/shiny/Main/MaterialInstancePass.hpp b/extern/shiny/Main/MaterialInstancePass.hpp new file mode 100644 index 000000000..7d7330f70 --- /dev/null +++ b/extern/shiny/Main/MaterialInstancePass.hpp @@ -0,0 +1,29 @@ +#ifndef SH_MATERIALINSTANCEPASS_H +#define SH_MATERIALINSTANCEPASS_H + +#include + +#include "PropertyBase.hpp" +#include "MaterialInstanceTextureUnit.hpp" + +namespace sh +{ + /** + * @brief + * Holds properties of a single texture unit in a \a MaterialInstancePass. \n + * No inheritance here for now. + */ + class MaterialInstancePass : public PropertySetGet + { + public: + MaterialInstanceTextureUnit* createTextureUnit (const std::string& name); + + PropertySetGet mShaderProperties; + + std::vector getTexUnits (); + private: + std::vector mTexUnits; + }; +} + +#endif diff --git a/extern/shiny/Main/MaterialInstanceTextureUnit.cpp b/extern/shiny/Main/MaterialInstanceTextureUnit.cpp new file mode 100644 index 000000000..0e3078af3 --- /dev/null +++ b/extern/shiny/Main/MaterialInstanceTextureUnit.cpp @@ -0,0 +1,14 @@ +#include "MaterialInstanceTextureUnit.hpp" + +namespace sh +{ + MaterialInstanceTextureUnit::MaterialInstanceTextureUnit (const std::string& name) + : mName(name) + { + } + + std::string MaterialInstanceTextureUnit::getName() const + { + return mName; + } +} diff --git a/extern/shiny/Main/MaterialInstanceTextureUnit.hpp b/extern/shiny/Main/MaterialInstanceTextureUnit.hpp new file mode 100644 index 000000000..ae9f54fd2 --- /dev/null +++ b/extern/shiny/Main/MaterialInstanceTextureUnit.hpp @@ -0,0 +1,26 @@ +#ifndef SH_MATERIALINSTANCETEXTUREUNIT_H +#define SH_MATERIALINSTANCETEXTUREUNIT_H + +#include "PropertyBase.hpp" + +namespace sh +{ + /** + * @brief + * A single texture unit state that belongs to a \a MaterialInstancePass \n + * this is not the real "backend" \a TextureUnitState (provided by \a Platform), + * it is merely a placeholder for properties. \n + * @note The backend \a TextureUnitState will only be created if this texture unit is + * actually used (i.e. referenced in the shader, or marked with property create_in_ffp = true). + */ + class MaterialInstanceTextureUnit : public PropertySetGet + { + public: + MaterialInstanceTextureUnit (const std::string& name); + std::string getName() const; + private: + std::string mName; + }; +} + +#endif diff --git a/extern/shiny/Main/Platform.cpp b/extern/shiny/Main/Platform.cpp new file mode 100644 index 000000000..94b4f872a --- /dev/null +++ b/extern/shiny/Main/Platform.cpp @@ -0,0 +1,94 @@ +#include "Platform.hpp" + +#include + +#include "Factory.hpp" + +namespace sh +{ + Platform::Platform (const std::string& basePath) + : mBasePath(basePath) + , mCacheFolder("./") + , mShaderCachingEnabled(false) + { + } + + Platform::~Platform () + { + } + + void Platform::setFactory (Factory* factory) + { + mFactory = factory; + } + + std::string Platform::getBasePath () + { + return mBasePath; + } + + bool Platform::supportsMaterialQueuedListener () + { + return false; + } + + bool Platform::supportsShaderSerialization () + { + return false; + } + + MaterialInstance* Platform::fireMaterialRequested (const std::string& name, const std::string& configuration, unsigned short lodIndex) + { + return mFactory->requestMaterial (name, configuration, lodIndex); + } + + void Platform::serializeShaders (const std::string& file) + { + throw std::runtime_error ("Shader serialization not supported by this platform"); + } + + void Platform::deserializeShaders (const std::string& file) + { + throw std::runtime_error ("Shader serialization not supported by this platform"); + } + + void Platform::setCacheFolder (const std::string& folder) + { + mCacheFolder = folder; + } + + void Platform::setShaderCachingEnabled (bool enabled) + { + mShaderCachingEnabled = enabled; + } + + std::string Platform::getCacheFolder() const + { + return mCacheFolder; + } + + // ------------------------------------------------------------------------------ + + bool TextureUnitState::setPropertyOverride (const std::string& name, PropertyValuePtr& value, PropertySetGet *context) + { + if (name == "texture_alias") + { + std::string aliasName = retrieveValue(value, context).get(); + + Factory::getInstance().addTextureAliasInstance (aliasName, this); + + setTextureName (Factory::getInstance().retrieveTextureAlias (aliasName)); + + return true; + } + else + return false; + } + + TextureUnitState::~TextureUnitState() + { + Factory* f = Factory::getInstancePtr (); + if (f) + f->removeTextureAliasInstances (this); + } +} diff --git a/extern/shiny/Main/Platform.hpp b/extern/shiny/Main/Platform.hpp new file mode 100644 index 000000000..1b095e957 --- /dev/null +++ b/extern/shiny/Main/Platform.hpp @@ -0,0 +1,145 @@ +#ifndef SH_PLATFORM_H +#define SH_PLATFORM_H + +#include + +#include + +#include "Language.hpp" +#include "PropertyBase.hpp" + +namespace sh +{ + class Factory; + class MaterialInstance; + + enum GpuProgramType + { + GPT_Vertex, + GPT_Fragment + // GPT_Geometry + }; + + // These classes are supposed to be filled by the platform implementation + class GpuProgram + { + public: + virtual bool getSupported () = 0; ///< @return true if the compilation was successful + + /// @param name name of the uniform in the shader + /// @param autoConstantName name of the auto constant (for example world_viewproj_matrix) + /// @param extraInfo if any extra info is needed (e.g. light index), put it here + virtual void setAutoConstant (const std::string& name, const std::string& autoConstantName, const std::string& extraInfo = "") = 0; + }; + + class TextureUnitState : public PropertySet + { + public: + virtual ~TextureUnitState(); + + virtual void setTextureName (const std::string& textureName) = 0; + + protected: + virtual bool setPropertyOverride (const std::string& name, PropertyValuePtr& value, PropertySetGet *context); + }; + + class Pass : public PropertySet + { + public: + virtual boost::shared_ptr createTextureUnitState () = 0; + virtual void assignProgram (GpuProgramType type, const std::string& name) = 0; + + /// @param type gpu program type + /// @param name name of the uniform in the shader + /// @param vt type of value, e.g. vector4 + /// @param value value to set + /// @param context used for retrieving linked values + virtual void setGpuConstant (int type, const std::string& name, ValueType vt, PropertyValuePtr value, PropertySetGet* context) = 0; + + virtual void setTextureUnitIndex (int programType, const std::string& name, int index) = 0; + + virtual void addSharedParameter (int type, const std::string& name) = 0; + }; + + class Material : public PropertySet + { + public: + virtual boost::shared_ptr createPass (const std::string& configuration, unsigned short lodIndex) = 0; + virtual bool createConfiguration (const std::string& name, unsigned short lodIndex) = 0; ///< @return false if already exists + virtual void removeAll () = 0; ///< remove all configurations + + virtual void setLodLevels (const std::string& lodLevels) = 0; + + virtual void setShadowCasterMaterial (const std::string& name) = 0; + }; + + class Platform + { + public: + Platform (const std::string& basePath); + virtual ~Platform (); + + void setShaderCachingEnabled (bool enabled); + + /// set the folder to use for shader caching + void setCacheFolder (const std::string& folder); + + private: + virtual boost::shared_ptr createMaterial (const std::string& name) = 0; + + virtual boost::shared_ptr createGpuProgram ( + GpuProgramType type, + const std::string& compileArguments, + const std::string& name, const std::string& profile, + const std::string& source, Language lang) = 0; + + virtual void setSharedParameter (const std::string& name, PropertyValuePtr value) = 0; + + virtual bool isProfileSupported (const std::string& profile) = 0; + + virtual void serializeShaders (const std::string& file); + virtual void deserializeShaders (const std::string& file); + + std::string getCacheFolder () const; + + friend class Factory; + friend class MaterialInstance; + friend class ShaderInstance; + + protected: + /** + * this will be \a true if the platform supports serialization (writing shader microcode + * to disk) and deserialization (create gpu program from saved microcode) + */ + virtual bool supportsShaderSerialization (); + + /** + * this will be \a true if the platform supports a listener that notifies the system + * whenever a material is requested for rendering. if this is supported, shaders can be + * compiled on-demand when needed (and not earlier) + * @todo the Factory is not designed yet to handle the case where this method returns false + */ + virtual bool supportsMaterialQueuedListener (); + + /** + * fire event: material requested for rendering + * @param name material name + * @param configuration requested configuration + */ + MaterialInstance* fireMaterialRequested (const std::string& name, const std::string& configuration, unsigned short lodIndex); + + std::string mCacheFolder; + Factory* mFactory; + + protected: + bool mShaderCachingEnabled; + + private: + void setFactory (Factory* factory); + + std::string mBasePath; + std::string getBasePath(); + }; +} + +#endif diff --git a/extern/shiny/Main/Preprocessor.cpp b/extern/shiny/Main/Preprocessor.cpp new file mode 100644 index 000000000..1a97668bc --- /dev/null +++ b/extern/shiny/Main/Preprocessor.cpp @@ -0,0 +1,99 @@ +#include "Preprocessor.hpp" + +#include +#include +#include + +namespace sh +{ + std::string Preprocessor::preprocess (std::string source, const std::string& includePath, std::vector definitions, const std::string& name) + { + std::stringstream returnString; + + // current file position is saved for exception handling + boost::wave::util::file_position_type current_position; + + try + { + // This token type is one of the central types used throughout the library. + // It is a template parameter to some of the public classes and instances + // of this type are returned from the iterators. + typedef boost::wave::cpplexer::lex_token<> token_type; + + // The template boost::wave::cpplexer::lex_iterator<> is the lexer type to + // to use as the token source for the preprocessing engine. It is + // parametrized with the token type. + typedef boost::wave::cpplexer::lex_iterator lex_iterator_type; + + // This is the resulting context type. The first template parameter should + // match the iterator type used during construction of the context + // instance (see below). It is the type of the underlying input stream. + typedef boost::wave::context + context_type; + + // The preprocessor iterator shouldn't be constructed directly. It is + // generated through a wave::context<> object. This wave:context<> object + // is additionally used to initialize and define different parameters of + // the actual preprocessing. + // + // The preprocessing of the input stream is done on the fly behind the + // scenes during iteration over the range of context_type::iterator_type + // instances. + context_type ctx (source.begin(), source.end(), name.c_str()); + ctx.add_include_path(includePath.c_str()); + for (std::vector::iterator it = definitions.begin(); it != definitions.end(); ++it) + { + ctx.add_macro_definition(*it); + } + + // Get the preprocessor iterators and use them to generate the token + // sequence. + context_type::iterator_type first = ctx.begin(); + context_type::iterator_type last = ctx.end(); + + // The input stream is preprocessed for you while iterating over the range + // [first, last). The dereferenced iterator returns tokens holding + // information about the preprocessed input stream, such as token type, + // token value, and position. + while (first != last) + { + current_position = (*first).get_position(); + returnString << (*first).get_value(); + ++first; + } + } + catch (boost::wave::cpp_exception const& e) + { + // some preprocessing error + std::stringstream error; + error + << e.file_name() << "(" << e.line_no() << "): " + << e.description(); + throw std::runtime_error(error.str()); + } + catch (std::exception const& e) + { + // use last recognized token to retrieve the error position + std::stringstream error; + error + << current_position.get_file() + << "(" << current_position.get_line() << "): " + << "exception caught: " << e.what(); + throw std::runtime_error(error.str()); + } + catch (...) + { + // use last recognized token to retrieve the error position + std::stringstream error; + error + << current_position.get_file() + << "(" << current_position.get_line() << "): " + << "unexpected exception caught."; + throw std::runtime_error(error.str()); + } + + return returnString.str(); + } +} diff --git a/extern/shiny/Main/Preprocessor.hpp b/extern/shiny/Main/Preprocessor.hpp new file mode 100644 index 000000000..7ee30ae7f --- /dev/null +++ b/extern/shiny/Main/Preprocessor.hpp @@ -0,0 +1,69 @@ +#ifndef SH_PREPROCESSOR_H +#define SH_PREPROCESSOR_H + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +namespace sh +{ + /** + * @brief A simple interface for the boost::wave preprocessor + */ + class Preprocessor + { + public: + /** + * @brief Run a shader source string through the preprocessor + * @param source source string + * @param includePath path to search for includes (that are included with #include) + * @param definitions macros to predefine (vector of strings of the format MACRO=value, or just MACRO to define it as 1) + * @param name name to use for error messages + * @return processed string + */ + static std::string preprocess (std::string source, const std::string& includePath, std::vector definitions, const std::string& name); + }; + + + + class emit_custom_line_directives_hooks + : public boost::wave::context_policies::default_preprocessing_hooks + { + public: + + template + bool + emit_line_directive(ContextT const& ctx, ContainerT &pending, + typename ContextT::token_type const& act_token) + { + // emit a #line directive showing the relative filename instead + typename ContextT::position_type pos = act_token.get_position(); + unsigned int column = 1; + + typedef typename ContextT::token_type result_type; + + // no line directives for now + pos.set_column(column); + pending.push_back(result_type(boost::wave::T_GENERATEDNEWLINE, "\n", pos)); + + return true; + } + }; + + +} + +#endif diff --git a/extern/shiny/Main/PropertyBase.cpp b/extern/shiny/Main/PropertyBase.cpp new file mode 100644 index 000000000..0c39e5c1e --- /dev/null +++ b/extern/shiny/Main/PropertyBase.cpp @@ -0,0 +1,268 @@ +#include "PropertyBase.hpp" + +#include +#include + +#include +#include + +namespace sh +{ + + IntValue::IntValue(int in) + : mValue(in) + { + } + + IntValue::IntValue(const std::string& in) + { + mValue = boost::lexical_cast(in); + } + + std::string IntValue::serialize() + { + return boost::lexical_cast(mValue); + } + + // ------------------------------------------------------------------------------ + + BooleanValue::BooleanValue (bool in) + : mValue(in) + { + } + + BooleanValue::BooleanValue (const std::string& in) + { + if (in == "true") + mValue = true; + else if (in == "false") + mValue = false; + else + { + std::cerr << "sh::BooleanValue: Warning: Unrecognized value \"" << in << "\" for property value of type BooleanValue" << std::endl; + mValue = false; + } + } + + std::string BooleanValue::serialize () + { + if (mValue) + return "true"; + else + return "false"; + } + + // ------------------------------------------------------------------------------ + + StringValue::StringValue (const std::string& in) + { + mStringValue = in; + } + + std::string StringValue::serialize() + { + return mStringValue; + } + + // ------------------------------------------------------------------------------ + + LinkedValue::LinkedValue (const std::string& in) + { + mStringValue = in; + mStringValue.erase(0, 1); + } + + std::string LinkedValue::serialize() + { + throw std::runtime_error ("can't directly get a linked value"); + } + + std::string LinkedValue::get(PropertySetGet* context) const + { + PropertyValuePtr p = context->getProperty(mStringValue); + return retrieveValue(p, NULL).get(); + } + + // ------------------------------------------------------------------------------ + + FloatValue::FloatValue (float in) + { + mValue = in; + } + + FloatValue::FloatValue (const std::string& in) + { + mValue = boost::lexical_cast(in); + } + + std::string FloatValue::serialize () + { + return boost::lexical_cast(mValue); + } + + // ------------------------------------------------------------------------------ + + Vector2::Vector2 (float x, float y) + : mX(x) + , mY(y) + { + } + + Vector2::Vector2 (const std::string& in) + { + std::vector tokens; + boost::split(tokens, in, boost::is_any_of(" ")); + assert ((tokens.size() == 2) && "Invalid Vector2 conversion"); + mX = boost::lexical_cast (tokens[0]); + mY = boost::lexical_cast (tokens[1]); + } + + std::string Vector2::serialize () + { + return boost::lexical_cast(mX) + " " + + boost::lexical_cast(mY); + } + + // ------------------------------------------------------------------------------ + + Vector3::Vector3 (float x, float y, float z) + : mX(x) + , mY(y) + , mZ(z) + { + } + + Vector3::Vector3 (const std::string& in) + { + std::vector tokens; + boost::split(tokens, in, boost::is_any_of(" ")); + assert ((tokens.size() == 3) && "Invalid Vector3 conversion"); + mX = boost::lexical_cast (tokens[0]); + mY = boost::lexical_cast (tokens[1]); + mZ = boost::lexical_cast (tokens[2]); + } + + std::string Vector3::serialize () + { + return boost::lexical_cast(mX) + " " + + boost::lexical_cast(mY) + " " + + boost::lexical_cast(mZ); + } + + // ------------------------------------------------------------------------------ + + Vector4::Vector4 (float x, float y, float z, float w) + : mX(x) + , mY(y) + , mZ(z) + , mW(w) + { + } + + Vector4::Vector4 (const std::string& in) + { + std::vector tokens; + boost::split(tokens, in, boost::is_any_of(" ")); + assert ((tokens.size() == 4) && "Invalid Vector4 conversion"); + mX = boost::lexical_cast (tokens[0]); + mY = boost::lexical_cast (tokens[1]); + mZ = boost::lexical_cast (tokens[2]); + mW = boost::lexical_cast (tokens[3]); + } + + std::string Vector4::serialize () + { + return boost::lexical_cast(mX) + " " + + boost::lexical_cast(mY) + " " + + boost::lexical_cast(mZ) + " " + + boost::lexical_cast(mW); + } + + // ------------------------------------------------------------------------------ + + void PropertySet::setProperty (const std::string& name, PropertyValuePtr &value, PropertySetGet* context) + { + if (!setPropertyOverride (name, value, context)) + std::cerr << "sh::PropertySet: Warning: No match for property with name '" << name << "'" << std::endl; + } + + bool PropertySet::setPropertyOverride (const std::string& name, PropertyValuePtr &value, PropertySetGet* context) + { + // if we got here, none of the sub-classes was able to make use of the property + return false; + } + + // ------------------------------------------------------------------------------ + + PropertySetGet::PropertySetGet (PropertySetGet* parent) + : mParent(parent) + , mContext(NULL) + { + } + + PropertySetGet::PropertySetGet () + : mParent(NULL) + , mContext(NULL) + { + } + + void PropertySetGet::setParent (PropertySetGet* parent) + { + mParent = parent; + } + + void PropertySetGet::setContext (PropertySetGet* context) + { + mContext = context; + } + + PropertySetGet* PropertySetGet::getContext() + { + return mContext; + } + + void PropertySetGet::setProperty (const std::string& name, PropertyValuePtr value) + { + mProperties [name] = value; + } + + PropertyValuePtr& PropertySetGet::getProperty (const std::string& name) + { + bool found = (mProperties.find(name) != mProperties.end()); + + if (!found) + { + if (!mParent) + throw std::runtime_error ("Trying to retrieve property \"" + name + "\" that does not exist"); + else + return mParent->getProperty (name); + } + else + return mProperties[name]; + } + + bool PropertySetGet::hasProperty (const std::string& name) + { + bool found = (mProperties.find(name) != mProperties.end()); + + if (!found) + { + if (!mParent) + return false; + else + return mParent->hasProperty (name); + } + else + return true; + } + + void PropertySetGet::copyAll (PropertySet* target, PropertySetGet* context) + { + if (mParent) + mParent->copyAll (target, context); + for (PropertyMap::iterator it = mProperties.begin(); it != mProperties.end(); ++it) + { + target->setProperty(it->first, it->second, context); + } + } +} diff --git a/extern/shiny/Main/PropertyBase.hpp b/extern/shiny/Main/PropertyBase.hpp new file mode 100644 index 000000000..240acce81 --- /dev/null +++ b/extern/shiny/Main/PropertyBase.hpp @@ -0,0 +1,235 @@ +#ifndef SH_PROPERTYBASE_H +#define SH_PROPERTYBASE_H + +#include +#include + +#include + +namespace sh +{ + class StringValue; + class PropertySetGet; + class LinkedValue; + + enum ValueType + { + VT_String, + VT_Int, + VT_Float, + VT_Vector2, + VT_Vector3, + VT_Vector4 + }; + + class PropertyValue + { + public: + PropertyValue() {} + + virtual ~PropertyValue() {} + + std::string _getStringValue() { return mStringValue; } + + virtual std::string serialize() = 0; + + protected: + std::string mStringValue; ///< this will possibly not contain anything in the specialised classes + }; + typedef boost::shared_ptr PropertyValuePtr; + + class StringValue : public PropertyValue + { + public: + StringValue (const std::string& in); + std::string get() const { return mStringValue; } + + virtual std::string serialize(); + }; + + /** + * @brief Used for retrieving a named property from a context + */ + class LinkedValue : public PropertyValue + { + public: + LinkedValue (const std::string& in); + + std::string get(PropertySetGet* context) const; + + virtual std::string serialize(); + }; + + class FloatValue : public PropertyValue + { + public: + FloatValue (float in); + FloatValue (const std::string& in); + float get() const { return mValue; } + + virtual std::string serialize(); + private: + float mValue; + }; + + class IntValue : public PropertyValue + { + public: + IntValue (int in); + IntValue (const std::string& in); + int get() const { return mValue; } + + virtual std::string serialize(); + private: + int mValue; + }; + + class BooleanValue : public PropertyValue + { + public: + BooleanValue (bool in); + BooleanValue (const std::string& in); + bool get() const { return mValue; } + + virtual std::string serialize(); + private: + bool mValue; + }; + + class Vector2 : public PropertyValue + { + public: + Vector2 (float x, float y); + Vector2 (const std::string& in); + + float mX, mY; + + virtual std::string serialize(); + }; + + class Vector3 : public PropertyValue + { + public: + Vector3 (float x, float y, float z); + Vector3 (const std::string& in); + + float mX, mY, mZ; + + virtual std::string serialize(); + }; + + class Vector4 : public PropertyValue + { + public: + Vector4 (float x, float y, float z, float w); + Vector4 (const std::string& in); + + float mX, mY, mZ, mW; + + virtual std::string serialize(); + }; + + /// \brief base class that allows setting properties with any kind of value-type + class PropertySet + { + public: + void setProperty (const std::string& name, PropertyValuePtr& value, PropertySetGet* context); + + protected: + virtual bool setPropertyOverride (const std::string& name, PropertyValuePtr& value, PropertySetGet* context); + ///< @return \a true if the specified property was found, or false otherwise + }; + + typedef std::map PropertyMap; + + /// \brief base class that allows setting properties with any kind of value-type and retrieving them + class PropertySetGet + { + public: + PropertySetGet (PropertySetGet* parent); + PropertySetGet (); + + virtual ~PropertySetGet() {} + + void copyAll (PropertySet* target, PropertySetGet* context); ///< call setProperty for each property/value pair stored in \a this + + void setParent (PropertySetGet* parent); + void setContext (PropertySetGet* context); + PropertySetGet* getContext(); + + virtual void setProperty (const std::string& name, PropertyValuePtr value); + PropertyValuePtr& getProperty (const std::string& name); + + const PropertyMap& listProperties() { return mProperties; } + + bool hasProperty (const std::string& name); + + private: + PropertyMap mProperties; + + protected: + PropertySetGet* mParent; + ///< the parent can provide properties as well (when they are retrieved via getProperty) \n + /// multiple levels of inheritance are also supported \n + /// children can override properties of their parents + + PropertySetGet* mContext; + ///< used to retrieve linked property values + }; + + template + static T retrieveValue (boost::shared_ptr& value, PropertySetGet* context) + { + if (typeid(*value).name() == typeid(LinkedValue).name()) + { + std::string v = static_cast(value.get())->get(context); + PropertyValuePtr newVal = PropertyValuePtr (new StringValue(v)); + return retrieveValue(newVal, NULL); + } + if (typeid(T).name() == typeid(*value).name()) + { + // requested type is the same as source type, only have to cast it + return *static_cast(value.get()); + } + + if ((typeid(T).name() == typeid(StringValue).name()) + && typeid(*value).name() != typeid(StringValue).name()) + { + // if string type is requested and value is not string, use serialize method to convert to string + T* ptr = new T (value->serialize()); // note that T is always StringValue here, but we can't use it here + value = boost::shared_ptr (static_cast(ptr)); + return *ptr; + } + + { + // remaining case: deserialization from string by passing the string to constructor of class T + T* ptr = new T(value->_getStringValue()); + PropertyValuePtr newVal (static_cast(ptr)); + value = newVal; + return *ptr; + } + } + ///< + /// @brief alternate version that supports linked values (use of $variables in parent material) + /// @note \a value is changed in-place to the converted object + /// @return converted object \n + + /// Create a property from a string + inline PropertyValuePtr makeProperty (const std::string& prop) + { + if (prop.size() > 1 && prop[0] == '$') + return PropertyValuePtr (static_cast(new LinkedValue(prop))); + else + return PropertyValuePtr (static_cast (new StringValue(prop))); + } + + template + /// Create a property of any type + /// Example: sh::makeProperty\ (new sh::Vector4(1, 1, 1, 1)) + inline PropertyValuePtr makeProperty (T* p) + { + return PropertyValuePtr ( static_cast(p) ); + } +} + +#endif diff --git a/extern/shiny/Main/ScriptLoader.cpp b/extern/shiny/Main/ScriptLoader.cpp new file mode 100644 index 000000000..a8971dc87 --- /dev/null +++ b/extern/shiny/Main/ScriptLoader.cpp @@ -0,0 +1,401 @@ +#include "ScriptLoader.hpp" + +#include +#include +#include +#include + +#include + +namespace sh +{ + void ScriptLoader::loadAllFiles(ScriptLoader* c, const std::string& path) + { + for ( boost::filesystem::recursive_directory_iterator end, dir(path); dir != end; ++dir ) + { + boost::filesystem::path p(*dir); + if(p.extension() == c->m_fileEnding) + { + c->m_currentFileName = (*dir).path().string(); + std::ifstream in((*dir).path().string().c_str(), std::ios::binary); + c->parseScript(in); + } + } + } + + ScriptLoader::ScriptLoader(const std::string& fileEnding) + { + m_fileEnding = fileEnding; + } + + ScriptLoader::~ScriptLoader() + { + clearScriptList(); + } + + void ScriptLoader::clearScriptList() + { + std::map ::iterator i; + for (i = m_scriptList.begin(); i != m_scriptList.end(); i++) + { + delete i->second; + } + m_scriptList.clear(); + } + + ScriptNode *ScriptLoader::getConfigScript(const std::string &name) + { + std::map ::iterator i; + + std::string key = name; + i = m_scriptList.find(key); + + //If found.. + if (i != m_scriptList.end()) + { + return i->second; + } + else + { + return NULL; + } + } + + std::map ScriptLoader::getAllConfigScripts () + { + return m_scriptList; + } + + void ScriptLoader::parseScript(std::ifstream &stream) + { + //Get first token + _nextToken(stream); + if (tok == TOKEN_EOF) + { + stream.close(); + return; + } + + //Parse the script + _parseNodes(stream, 0); + + stream.close(); + } + + void ScriptLoader::_nextToken(std::ifstream &stream) + { + //EOF token + if (!stream.good()) + { + tok = TOKEN_EOF; + return; + } + + //(Get next character) + int ch = stream.get(); + + while ((ch == ' ' || ch == 9) && !stream.eof()) + { //Skip leading spaces / tabs + ch = stream.get(); + } + + if (!stream.good()) + { + tok = TOKEN_EOF; + return; + } + + //Newline token + if (ch == '\r' || ch == '\n') + { + do + { + ch = stream.get(); + } while ((ch == '\r' || ch == '\n') && !stream.eof()); + + stream.unget(); + + tok = TOKEN_NewLine; + return; + } + + //Open brace token + else if (ch == '{') + { + tok = TOKEN_OpenBrace; + return; + } + + //Close brace token + else if (ch == '}') + { + tok = TOKEN_CloseBrace; + return; + } + + //Text token + if (ch < 32 || ch > 122) //Verify valid char + { + throw std::runtime_error("Parse Error: Invalid character, ConfigLoader::load()"); + } + + tokVal = ""; + tok = TOKEN_Text; + do + { + //Skip comments + if (ch == '/') + { + int ch2 = stream.peek(); + + //C++ style comment (//) + if (ch2 == '/') + { + stream.get(); + do + { + ch = stream.get(); + } while (ch != '\r' && ch != '\n' && !stream.eof()); + + tok = TOKEN_NewLine; + return; + } + } + + //Add valid char to tokVal + tokVal += (char)ch; + + //Next char + ch = stream.get(); + + } while (ch > 32 && ch <= 122 && !stream.eof()); + + stream.unget(); + + return; + } + + void ScriptLoader::_skipNewLines(std::ifstream &stream) + { + while (tok == TOKEN_NewLine) + { + _nextToken(stream); + } + } + + void ScriptLoader::_parseNodes(std::ifstream &stream, ScriptNode *parent) + { + typedef std::pair ScriptItem; + + while (true) + { + switch (tok) + { + //Node + case TOKEN_Text: + { + //Add the new node + ScriptNode *newNode; + if (parent) + { + newNode = parent->addChild(tokVal); + } + else + { + newNode = new ScriptNode(0, tokVal); + } + + //Get values + _nextToken(stream); + std::string valueStr; + int i=0; + while (tok == TOKEN_Text) + { + if (i == 0) + valueStr += tokVal; + else + valueStr += " " + tokVal; + _nextToken(stream); + ++i; + } + newNode->setValue(valueStr); + + //Add root nodes to scriptList + if (!parent) + { + std::string key; + + if (newNode->getValue() == "") + throw std::runtime_error("Root node must have a name (\"" + newNode->getName() + "\")"); + key = newNode->getValue(); + + m_scriptList.insert(ScriptItem(key, newNode)); + } + + _skipNewLines(stream); + + //Add any sub-nodes + if (tok == TOKEN_OpenBrace) + { + //Parse nodes + _nextToken(stream); + _parseNodes(stream, newNode); + //Check for matching closing brace + if (tok != TOKEN_CloseBrace) + { + throw std::runtime_error("Parse Error: Expecting closing brace"); + } + _nextToken(stream); + _skipNewLines(stream); + } + + newNode->m_fileName = m_currentFileName; + + break; + } + + //Out of place brace + case TOKEN_OpenBrace: + throw std::runtime_error("Parse Error: Opening brace out of plane"); + break; + + //Return if end of nodes have been reached + case TOKEN_CloseBrace: + return; + + //Return if reached end of file + case TOKEN_EOF: + return; + + case TOKEN_NewLine: + _nextToken(stream); + break; + } + }; + } + + ScriptNode::ScriptNode(ScriptNode *parent, const std::string &name) + { + m_name = name; + m_parent = parent; + _removeSelf = true; //For proper destruction + m_lastChildFound = -1; + + //Add self to parent's child list (unless this is the root node being created) + if (parent != NULL) + { + m_parent->m_children.push_back(this); + _iter = --(m_parent->m_children.end()); + } + } + + ScriptNode::~ScriptNode() + { + //Delete all children + std::vector::iterator i; + for (i = m_children.begin(); i != m_children.end(); i++) + { + ScriptNode *node = *i; + node->_removeSelf = false; + delete node; + } + m_children.clear(); + + //Remove self from parent's child list + if (_removeSelf && m_parent != NULL) + { + m_parent->m_children.erase(_iter); + } + } + + ScriptNode *ScriptNode::addChild(const std::string &name, bool replaceExisting) + { + if (replaceExisting) + { + ScriptNode *node = findChild(name, false); + if (node) + { + return node; + } + } + return new ScriptNode(this, name); + } + + ScriptNode *ScriptNode::findChild(const std::string &name, bool recursive) + { + int indx, prevC, nextC; + int childCount = (int)m_children.size(); + + if (m_lastChildFound != -1) + { + //If possible, try checking the nodes neighboring the last successful search + //(often nodes searched for in sequence, so this will boost search speeds). + prevC = m_lastChildFound-1; if (prevC < 0) prevC = 0; else if (prevC >= childCount) prevC = childCount-1; + nextC = m_lastChildFound+1; if (nextC < 0) nextC = 0; else if (nextC >= childCount) nextC = childCount-1; + for (indx = prevC; indx <= nextC; ++indx) + { + ScriptNode *node = m_children[indx]; + if (node->m_name == name) + { + m_lastChildFound = indx; + return node; + } + } + + //If not found that way, search for the node from start to finish, avoiding the + //already searched area above. + for (indx = nextC + 1; indx < childCount; ++indx) + { + ScriptNode *node = m_children[indx]; + if (node->m_name == name) { + m_lastChildFound = indx; + return node; + } + } + for (indx = 0; indx < prevC; ++indx) + { + ScriptNode *node = m_children[indx]; + if (node->m_name == name) { + m_lastChildFound = indx; + return node; + } + } + } + else + { + //Search for the node from start to finish + for (indx = 0; indx < childCount; ++indx){ + ScriptNode *node = m_children[indx]; + if (node->m_name == name) { + m_lastChildFound = indx; + return node; + } + } + } + + //If not found, search child nodes (if recursive == true) + if (recursive) + { + for (indx = 0; indx < childCount; ++indx) + { + m_children[indx]->findChild(name, recursive); + } + } + + //Not found anywhere + return NULL; + } + + void ScriptNode::setParent(ScriptNode *newParent) + { + //Remove self from current parent + m_parent->m_children.erase(_iter); + + //Set new parent + m_parent = newParent; + + //Add self to new parent + m_parent->m_children.push_back(this); + _iter = --(m_parent->m_children.end()); + } +} diff --git a/extern/shiny/Main/ScriptLoader.hpp b/extern/shiny/Main/ScriptLoader.hpp new file mode 100644 index 000000000..caf743bd2 --- /dev/null +++ b/extern/shiny/Main/ScriptLoader.hpp @@ -0,0 +1,134 @@ +#ifndef SH_CONFIG_LOADER_H__ +#define SH_CONFIG_LOADER_H__ + +#include +#include +#include +#include + +namespace sh +{ + class ScriptNode; + + /** + * @brief The base class of loaders that read Ogre style script files to get configuration and settings. + * Heavily inspired by: http://www.ogre3d.org/tikiwiki/All-purpose+script+parser + * ( "Non-ogre version") + */ + class ScriptLoader + { + public: + static void loadAllFiles(ScriptLoader* c, const std::string& path); + + ScriptLoader(const std::string& fileEnding); + virtual ~ScriptLoader(); + + std::string m_fileEnding; + + // For a line like + // entity animals/dog + // { + // ... + // } + // The type is "entity" and the name is "animals/dog" + // Or if animal/dog was not there then name is "" + ScriptNode *getConfigScript (const std::string &name); + + std::map getAllConfigScripts (); + + void parseScript(std::ifstream &stream); + + std::string m_currentFileName; + + protected: + + float m_LoadOrder; + // like "*.object" + + std::map m_scriptList; + + enum Token + { + TOKEN_Text, + TOKEN_NewLine, + TOKEN_OpenBrace, + TOKEN_CloseBrace, + TOKEN_EOF + }; + + Token tok, lastTok; + std::string tokVal; + + void _parseNodes(std::ifstream &stream, ScriptNode *parent); + void _nextToken(std::ifstream &stream); + void _skipNewLines(std::ifstream &stream); + + void clearScriptList(); + }; + + class ScriptNode + { + public: + ScriptNode(ScriptNode *parent, const std::string &name = "untitled"); + ~ScriptNode(); + + inline void setName(const std::string &name) + { + this->m_name = name; + } + + inline std::string &getName() + { + return m_name; + } + + inline void setValue(const std::string &value) + { + m_value = value; + } + + inline std::string &getValue() + { + return m_value; + } + + ScriptNode *addChild(const std::string &name = "untitled", bool replaceExisting = false); + ScriptNode *findChild(const std::string &name, bool recursive = false); + + inline std::vector &getChildren() + { + return m_children; + } + + inline ScriptNode *getChild(unsigned int index = 0) + { + assert(index < m_children.size()); + return m_children[index]; + } + + void setParent(ScriptNode *newParent); + + inline ScriptNode *getParent() + { + return m_parent; + } + + std::string m_fileName; + + + private: + std::string m_name; + std::string m_value; + std::vector m_children; + ScriptNode *m_parent; + + + int m_lastChildFound; //The last child node's index found with a call to findChild() + + std::vector::iterator _iter; + bool _removeSelf; + }; + +} + +#endif diff --git a/extern/shiny/Main/ShaderInstance.cpp b/extern/shiny/Main/ShaderInstance.cpp new file mode 100644 index 000000000..07ef8dfe2 --- /dev/null +++ b/extern/shiny/Main/ShaderInstance.cpp @@ -0,0 +1,707 @@ +#include "ShaderInstance.hpp" + +#include +#include +#include + +#include +#include +#include + +#include + +#include "Preprocessor.hpp" +#include "Factory.hpp" +#include "ShaderSet.hpp" + +namespace +{ + std::string convertLang (sh::Language lang) + { + if (lang == sh::Language_CG) + return "SH_CG"; + else if (lang == sh::Language_HLSL) + return "SH_HLSL"; + else //if (lang == sh::Language_GLSL) + return "SH_GLSL"; + } + + char getComponent(int num) + { + if (num == 0) + return 'x'; + else if (num == 1) + return 'y'; + else if (num == 2) + return 'z'; + else if (num == 3) + return 'w'; + else + throw std::runtime_error("invalid component"); + } + + std::string getFloat(sh::Language lang, int num_components) + { + if (lang == sh::Language_CG || lang == sh::Language_HLSL) + return (num_components == 1) ? "float" : "float" + boost::lexical_cast(num_components); + else + return (num_components == 1) ? "float" : "vec" + boost::lexical_cast(num_components); + } + + bool isCmd (const std::string& source, size_t pos, const std::string& cmd) + { + return (source.size() >= pos + cmd.size() && source.substr(pos, cmd.size()) == cmd); + } + + void writeDebugFile (const std::string& content, const std::string& filename) + { + boost::filesystem::path full_path(boost::filesystem::current_path()); + std::ofstream of ((full_path / filename ).string().c_str() , std::ios_base::out); + of.write(content.c_str(), content.size()); + of.close(); + } +} + +namespace sh +{ + std::string Passthrough::expand_assign(std::string toAssign) + { + std::string res; + + int i = 0; + int current_passthrough = passthrough_number; + int current_component_left = component_start; + int current_component_right = 0; + int components_left = num_components; + int components_at_once; + while (i < num_components) + { + if (components_left + current_component_left <= 4) + components_at_once = components_left; + else + components_at_once = 4 - current_component_left; + + std::string componentStr = "."; + for (int j = 0; j < components_at_once; ++j) + componentStr += getComponent(j + current_component_left); + std::string componentStr2 = "."; + for (int j = 0; j < components_at_once; ++j) + componentStr2 += getComponent(j + current_component_right); + if (num_components == 1) + { + componentStr2 = ""; + } + res += "passthrough" + boost::lexical_cast(current_passthrough) + componentStr + " = " + toAssign + componentStr2; + + current_component_left += components_at_once; + current_component_right += components_at_once; + components_left -= components_at_once; + + i += components_at_once; + + if (components_left == 0) + { + // finished + return res; + } + else + { + // add semicolon to every instruction but the last + res += "; "; + } + + if (current_component_left == 4) + { + current_passthrough++; + current_component_left = 0; + } + } + throw std::runtime_error("expand_assign error"); // this should never happen, but gets us rid of the "control reaches end of non-void function" warning + } + + std::string Passthrough::expand_receive() + { + std::string res; + + res += getFloat(lang, num_components) + "("; + + int i = 0; + int current_passthrough = passthrough_number; + int current_component = component_start; + int components_left = num_components; + while (i < num_components) + { + int components_at_once = std::min(components_left, 4 - current_component); + + std::string componentStr; + for (int j = 0; j < components_at_once; ++j) + componentStr += getComponent(j + current_component); + + res += "passthrough" + boost::lexical_cast(current_passthrough) + "." + componentStr; + + current_component += components_at_once; + + components_left -= components_at_once; + + i += components_at_once; + + if (components_left == 0) + { + // finished + return res + ")"; +; + } + else + { + // add comma to every variable but the last + res += ", "; + } + + if (current_component == 4) + { + current_passthrough++; + current_component = 0; + } + } + + throw std::runtime_error("expand_receive error"); // this should never happen, but gets us rid of the "control reaches end of non-void function" warning + } + + // ------------------------------------------------------------------------------ + + void ShaderInstance::parse (std::string& source, PropertySetGet* properties) + { + size_t pos = 0; + while (true) + { + pos = source.find("@", pos); + if (pos == std::string::npos) + break; + + if (isCmd(source, pos, "@shProperty")) + { + std::vector args = extractMacroArguments (pos, source); + + size_t start = source.find("(", pos); + size_t end = source.find(")", pos); + std::string cmd = source.substr(pos+1, start-(pos+1)); + + std::string replaceValue; + if (cmd == "shPropertyBool") + { + std::string propertyName = args[0]; + PropertyValuePtr value = properties->getProperty(propertyName); + bool val = retrieveValue(value, properties->getContext()).get(); + replaceValue = val ? "1" : "0"; + } + else if (cmd == "shPropertyNotBool") // same as above, but inverts the result + { + std::string propertyName = args[0]; + PropertyValuePtr value = properties->getProperty(propertyName); + bool val = retrieveValue(value, properties->getContext()).get(); + replaceValue = val ? "0" : "1"; + } + else if (cmd == "shPropertyString") + { + std::string propertyName = args[0]; + PropertyValuePtr value = properties->getProperty(propertyName); + replaceValue = retrieveValue(value, properties->getContext()).get(); + } + else if (cmd == "shPropertyEqual") + { + std::string propertyName = args[0]; + std::string comparedAgainst = args[1]; + std::string value = retrieveValue(properties->getProperty(propertyName), properties->getContext()).get(); + replaceValue = (value == comparedAgainst) ? "1" : "0"; + } + else + throw std::runtime_error ("unknown command \"" + cmd + "\""); + source.replace(pos, (end+1)-pos, replaceValue); + } + else if (isCmd(source, pos, "@shGlobalSetting")) + { + std::vector args = extractMacroArguments (pos, source); + + std::string cmd = source.substr(pos+1, source.find("(", pos)-(pos+1)); + std::string replaceValue; + if (cmd == "shGlobalSettingBool") + { + std::string settingName = args[0]; + std::string value = retrieveValue(mParent->getCurrentGlobalSettings()->getProperty(settingName), NULL).get(); + replaceValue = (value == "true" || value == "1") ? "1" : "0"; + } + else if (cmd == "shGlobalSettingEqual") + { + std::string settingName = args[0]; + std::string comparedAgainst = args[1]; + std::string value = retrieveValue(mParent->getCurrentGlobalSettings()->getProperty(settingName), NULL).get(); + replaceValue = (value == comparedAgainst) ? "1" : "0"; + } + else if (cmd == "shGlobalSettingString") + { + std::string settingName = args[0]; + replaceValue = retrieveValue(mParent->getCurrentGlobalSettings()->getProperty(settingName), NULL).get(); + } + else + throw std::runtime_error ("unknown command \"" + cmd + "\""); + + source.replace(pos, (source.find(")", pos)+1)-pos, replaceValue); + } + else if (isCmd(source, pos, "@shForeach")) + { + + assert(source.find("@shEndForeach", pos) != std::string::npos); + size_t block_end = source.find("@shEndForeach", pos); + + // get the argument for parsing + size_t start = source.find("(", pos); + size_t end = start; + int brace_depth = 1; + while (brace_depth > 0) + { + ++end; + if (source[end] == '(') + ++brace_depth; + else if (source[end] == ')') + --brace_depth; + } + std::string arg = source.substr(start+1, end-(start+1)); + parse(arg, properties); + + int num = boost::lexical_cast(arg); + + // get the content of the inner block + std::string content = source.substr(end+1, block_end - (end+1)); + + // replace both outer and inner block with content of inner block num times + std::string replaceStr; + for (int i=0; i 0) + { + ++_end; + if (addStr[_end] == '(') + ++_brace_depth; + else if (addStr[_end] == ')') + --_brace_depth; + } + std::string arg = addStr.substr(_start+1, _end-(_start+1)); + parse(arg, properties); + + int offset = boost::lexical_cast (arg); + addStr.replace(pos2, (_end+1)-pos2, boost::lexical_cast(i+offset)); + } + else + { + addStr.replace(pos2, std::string("@shIterator").length(), boost::lexical_cast(i)); + } + } + + replaceStr += addStr; + } + source.replace(pos, (block_end+std::string("@shEndForeach").length())-pos, replaceStr); + } + else if (source.size() > pos+1) + ++pos; // skip + } + + } + + ShaderInstance::ShaderInstance (ShaderSet* parent, const std::string& name, PropertySetGet* properties) + : mName(name) + , mParent(parent) + , mSupported(true) + , mCurrentPassthrough(0) + , mCurrentComponent(0) + { + std::string source = mParent->getSource(); + int type = mParent->getType(); + std::string basePath = mParent->getBasePath(); + size_t pos; + + bool readCache = Factory::getInstance ().getReadSourceCache () && boost::filesystem::exists( + Factory::getInstance ().getCacheFolder () + "/" + mName) + && !mParent->isDirty (); + bool writeCache = Factory::getInstance ().getWriteSourceCache (); + + + if (readCache) + { + std::ifstream ifs( std::string(Factory::getInstance ().getCacheFolder () + "/" + mName).c_str() ); + std::stringstream ss; + ss << ifs.rdbuf(); + source = ss.str(); + } + else + { + std::vector definitions; + + if (mParent->getType() == GPT_Vertex) + definitions.push_back("SH_VERTEX_SHADER"); + else + definitions.push_back("SH_FRAGMENT_SHADER"); + definitions.push_back(convertLang(Factory::getInstance().getCurrentLanguage())); + + parse(source, properties); + + if (Factory::getInstance ().getShaderDebugOutputEnabled ()) + writeDebugFile(source, name + ".pre"); + else + { + #ifdef SHINY_WRITE_SHADER_DEBUG + writeDebugFile(source, name + ".pre"); + #endif + } + + // why do we need our own preprocessor? there are several custom commands available in the shader files + // (for example for binding uniforms to properties or auto constants) - more below. it is important that these + // commands are _only executed if the specific code path actually "survives" the compilation. + // thus, we run the code through a preprocessor first to remove the parts that are unused because of + // unmet #if conditions (or other preprocessor directives). + source = Preprocessor::preprocess(source, basePath, definitions, name); + + // parse counter + std::map counters; + while (true) + { + pos = source.find("@shCounter"); + if (pos == std::string::npos) + break; + + size_t end = source.find(")", pos); + + std::vector args = extractMacroArguments (pos, source); + assert(args.size()); + + int index = boost::lexical_cast(args[0]); + + if (counters.find(index) == counters.end()) + counters[index] = 0; + + source.replace(pos, (end+1)-pos, boost::lexical_cast(counters[index]++)); + } + + // parse passthrough declarations + while (true) + { + pos = source.find("@shAllocatePassthrough"); + if (pos == std::string::npos) + break; + + if (mCurrentPassthrough > 7) + throw std::runtime_error ("too many passthrough's requested (max 8)"); + + std::vector args = extractMacroArguments (pos, source); + assert(args.size() == 2); + + size_t end = source.find(")", pos); + + Passthrough passthrough; + + passthrough.num_components = boost::lexical_cast(args[0]); + assert (passthrough.num_components != 0); + + std::string passthroughName = args[1]; + passthrough.lang = Factory::getInstance().getCurrentLanguage (); + passthrough.component_start = mCurrentComponent; + passthrough.passthrough_number = mCurrentPassthrough; + + mPassthroughMap[passthroughName] = passthrough; + + mCurrentComponent += passthrough.num_components; + if (mCurrentComponent > 3) + { + mCurrentComponent -= 4; + ++mCurrentPassthrough; + } + + source.erase(pos, (end+1)-pos); + } + + // passthrough assign + while (true) + { + pos = source.find("@shPassthroughAssign"); + if (pos == std::string::npos) + break; + + std::vector args = extractMacroArguments (pos, source); + assert(args.size() == 2); + + size_t end = source.find(")", pos); + + std::string passthroughName = args[0]; + std::string assignTo = args[1]; + + assert(mPassthroughMap.find(passthroughName) != mPassthroughMap.end()); + Passthrough& p = mPassthroughMap[passthroughName]; + + source.replace(pos, (end+1)-pos, p.expand_assign(assignTo)); + } + + // passthrough receive + while (true) + { + pos = source.find("@shPassthroughReceive"); + if (pos == std::string::npos) + break; + + std::vector args = extractMacroArguments (pos, source); + assert(args.size() == 1); + + size_t end = source.find(")", pos); + std::string passthroughName = args[0]; + + assert(mPassthroughMap.find(passthroughName) != mPassthroughMap.end()); + Passthrough& p = mPassthroughMap[passthroughName]; + + source.replace(pos, (end+1)-pos, p.expand_receive()); + } + + // passthrough vertex outputs + while (true) + { + pos = source.find("@shPassthroughVertexOutputs"); + if (pos == std::string::npos) + break; + + std::string result; + for (int i = 0; i < mCurrentPassthrough+1; ++i) + { + // not using newlines here, otherwise the line numbers reported by compiler would be messed up.. + if (Factory::getInstance().getCurrentLanguage () == Language_CG || Factory::getInstance().getCurrentLanguage () == Language_HLSL) + result += ", out float4 passthrough" + boost::lexical_cast(i) + " : TEXCOORD" + boost::lexical_cast(i); + + /* + else + result += "out vec4 passthrough" + boost::lexical_cast(i) + "; "; + */ + else + result += "varying vec4 passthrough" + boost::lexical_cast(i) + "; "; + } + + source.replace(pos, std::string("@shPassthroughVertexOutputs").length(), result); + } + + // passthrough fragment inputs + while (true) + { + pos = source.find("@shPassthroughFragmentInputs"); + if (pos == std::string::npos) + break; + + std::string result; + for (int i = 0; i < mCurrentPassthrough+1; ++i) + { + // not using newlines here, otherwise the line numbers reported by compiler would be messed up.. + if (Factory::getInstance().getCurrentLanguage () == Language_CG || Factory::getInstance().getCurrentLanguage () == Language_HLSL) + result += ", in float4 passthrough" + boost::lexical_cast(i) + " : TEXCOORD" + boost::lexical_cast(i); + /* + else + result += "in vec4 passthrough" + boost::lexical_cast(i) + "; "; + */ + else + result += "varying vec4 passthrough" + boost::lexical_cast(i) + "; "; + } + + source.replace(pos, std::string("@shPassthroughFragmentInputs").length(), result); + } + } + + // save to cache _here_ - we want to preserve some macros + if (writeCache && !readCache) + { + std::ofstream of (std::string(Factory::getInstance ().getCacheFolder () + "/" + mName).c_str(), std::ios_base::out); + of.write(source.c_str(), source.size()); + of.close(); + } + + + // parse shared parameters + while (true) + { + pos = source.find("@shSharedParameter"); + if (pos == std::string::npos) + break; + + std::vector args = extractMacroArguments (pos, source); + assert(args.size()); + + size_t end = source.find(")", pos); + + mSharedParameters.push_back(args[0]); + + source.erase(pos, (end+1)-pos); + } + + // parse auto constants + typedef std::map< std::string, std::pair > AutoConstantMap; + AutoConstantMap autoConstants; + while (true) + { + pos = source.find("@shAutoConstant"); + if (pos == std::string::npos) + break; + + std::vector args = extractMacroArguments (pos, source); + assert(args.size() >= 2); + + size_t end = source.find(")", pos); + + std::string autoConstantName, uniformName; + std::string extraData; + + uniformName = args[0]; + autoConstantName = args[1]; + if (args.size() > 2) + extraData = args[2]; + + autoConstants[uniformName] = std::make_pair(autoConstantName, extraData); + + source.erase(pos, (end+1)-pos); + } + + // parse uniform properties + while (true) + { + pos = source.find("@shUniformProperty"); + if (pos == std::string::npos) + break; + + std::vector args = extractMacroArguments (pos, source); + assert(args.size() == 2); + + size_t start = source.find("(", pos); + size_t end = source.find(")", pos); + std::string cmd = source.substr(pos, start-pos); + + ValueType vt; + if (cmd == "@shUniformProperty4f") + vt = VT_Vector4; + else if (cmd == "@shUniformProperty3f") + vt = VT_Vector3; + else if (cmd == "@shUniformProperty2f") + vt = VT_Vector2; + else if (cmd == "@shUniformProperty1f") + vt = VT_Float; + else if (cmd == "@shUniformPropertyInt") + vt = VT_Int; + else + throw std::runtime_error ("unsupported command \"" + cmd + "\""); + + + std::string propertyName, uniformName; + uniformName = args[0]; + propertyName = args[1]; + mUniformProperties[uniformName] = std::make_pair(propertyName, vt); + + source.erase(pos, (end+1)-pos); + } + + // parse texture samplers used + while (true) + { + pos = source.find("@shUseSampler"); + if (pos == std::string::npos) + break; + + size_t end = source.find(")", pos); + + mUsedSamplers.push_back(extractMacroArguments (pos, source)[0]); + source.erase(pos, (end+1)-pos); + } + + // convert any left-over @'s to # + boost::algorithm::replace_all(source, "@", "#"); + + Platform* platform = Factory::getInstance().getPlatform(); + + std::string profile; + if (Factory::getInstance ().getCurrentLanguage () == Language_CG) + profile = mParent->getCgProfile (); + else if (Factory::getInstance ().getCurrentLanguage () == Language_HLSL) + profile = mParent->getHlslProfile (); + + + if (type == GPT_Vertex) + mProgram = boost::shared_ptr(platform->createGpuProgram(GPT_Vertex, "", mName, profile, source, Factory::getInstance().getCurrentLanguage())); + else if (type == GPT_Fragment) + mProgram = boost::shared_ptr(platform->createGpuProgram(GPT_Fragment, "", mName, profile, source, Factory::getInstance().getCurrentLanguage())); + + + if (Factory::getInstance ().getShaderDebugOutputEnabled ()) + writeDebugFile(source, name); + else + { +#ifdef SHINY_WRITE_SHADER_DEBUG + writeDebugFile(source, name); +#endif + } + + if (!mProgram->getSupported()) + { + std::cerr << " Full source code below: \n" << source << std::endl; + mSupported = false; + return; + } + + // set auto constants + for (AutoConstantMap::iterator it = autoConstants.begin(); it != autoConstants.end(); ++it) + { + mProgram->setAutoConstant(it->first, it->second.first, it->second.second); + } + } + + std::string ShaderInstance::getName () + { + return mName; + } + + bool ShaderInstance::getSupported () const + { + return mSupported; + } + + std::vector ShaderInstance::getUsedSamplers() + { + return mUsedSamplers; + } + + void ShaderInstance::setUniformParameters (boost::shared_ptr pass, PropertySetGet* properties) + { + for (UniformMap::iterator it = mUniformProperties.begin(); it != mUniformProperties.end(); ++it) + { + pass->setGpuConstant(mParent->getType(), it->first, it->second.second, properties->getProperty(it->second.first), properties->getContext()); + } + } + + std::vector ShaderInstance::extractMacroArguments (size_t pos, const std::string& source) + { + size_t start = source.find("(", pos); + size_t end = source.find(")", pos); + std::string args = source.substr(start+1, end-(start+1)); + std::vector results; + boost::algorithm::split(results, args, boost::is_any_of(",")); + std::for_each(results.begin(), results.end(), + boost::bind(&boost::trim, + _1, std::locale() )); + return results; + } +} diff --git a/extern/shiny/Main/ShaderInstance.hpp b/extern/shiny/Main/ShaderInstance.hpp new file mode 100644 index 000000000..76326ce0c --- /dev/null +++ b/extern/shiny/Main/ShaderInstance.hpp @@ -0,0 +1,71 @@ +#ifndef SH_SHADERINSTANCE_H +#define SH_SHADERINSTANCE_H + +#include + +#include "Platform.hpp" + +namespace sh +{ + class ShaderSet; + + typedef std::map< std::string, std::pair > UniformMap; + + struct Passthrough + { + Language lang; ///< language to generate for + + int num_components; ///< e.g. 4 for a float4 + + int passthrough_number; + int component_start; ///< 0 = x + + std::string expand_assign(std::string assignTo); + std::string expand_receive(); + }; + typedef std::map PassthroughMap; + + /** + * @brief A specific instance of a \a ShaderSet with a deterministic shader source + */ + class ShaderInstance + { + public: + ShaderInstance (ShaderSet* parent, const std::string& name, PropertySetGet* properties); + + std::string getName(); + + bool getSupported () const; + + std::vector getUsedSamplers(); + std::vector getSharedParameters() { return mSharedParameters; } + + void setUniformParameters (boost::shared_ptr pass, PropertySetGet* properties); + + private: + boost::shared_ptr mProgram; + std::string mName; + ShaderSet* mParent; + bool mSupported; ///< shader compilation was sucessful? + + std::vector mUsedSamplers; + ///< names of the texture samplers that are used by this shader + + std::vector mSharedParameters; + + UniformMap mUniformProperties; + ///< uniforms that this depends on, and their property names / value-types + /// @note this lists shared uniform parameters as well + + int mCurrentPassthrough; ///< 0 - x + int mCurrentComponent; ///< 0:x, 1:y, 2:z, 3:w + + PassthroughMap mPassthroughMap; + + std::vector extractMacroArguments (size_t pos, const std::string& source); ///< take a macro invocation and return vector of arguments + + void parse (std::string& source, PropertySetGet* properties); + }; +} + +#endif diff --git a/extern/shiny/Main/ShaderSet.cpp b/extern/shiny/Main/ShaderSet.cpp new file mode 100644 index 000000000..2702ece19 --- /dev/null +++ b/extern/shiny/Main/ShaderSet.cpp @@ -0,0 +1,172 @@ +#include "ShaderSet.hpp" + +#include +#include + +#include +#include +#include + +#include "Factory.hpp" + +namespace sh +{ + ShaderSet::ShaderSet (const std::string& type, const std::string& cgProfile, const std::string& hlslProfile, const std::string& sourceFile, const std::string& basePath, + const std::string& name, PropertySetGet* globalSettingsPtr) + : mBasePath(basePath) + , mName(name) + , mCgProfile(cgProfile) + , mHlslProfile(hlslProfile) + , mIsDirty(false) + { + if (type == "vertex") + mType = GPT_Vertex; + else // if (type == "fragment") + mType = GPT_Fragment; + + std::ifstream stream(sourceFile.c_str(), std::ifstream::in); + std::stringstream buffer; + + buffer << stream.rdbuf(); + stream.close(); + mSource = buffer.str(); + parse(); + } + + void ShaderSet::parse() + { + std::string currentToken; + bool tokenIsRecognized = false; + bool isInBraces = false; + for (std::string::const_iterator it = mSource.begin(); it != mSource.end(); ++it) + { + char c = *it; + if (((c == ' ') && !isInBraces) || (c == '\n') || + ( ((c == '(') || (c == ')')) + && !tokenIsRecognized)) + { + if (tokenIsRecognized) + { + if (boost::starts_with(currentToken, "@shGlobalSetting")) + { + assert ((currentToken.find('(') != std::string::npos) && (currentToken.find(')') != std::string::npos)); + size_t start = currentToken.find('(')+1; + mGlobalSettings.push_back(currentToken.substr(start, currentToken.find(')')-start)); + } + else if (boost::starts_with(currentToken, "@shPropertyEqual")) + { + assert ((currentToken.find('(') != std::string::npos) && (currentToken.find(')') != std::string::npos) + && (currentToken.find(',') != std::string::npos)); + size_t start = currentToken.find('(')+1; + size_t end = currentToken.find(','); + mProperties.push_back(currentToken.substr(start, end-start)); + } + else if (boost::starts_with(currentToken, "@shProperty")) + { + assert ((currentToken.find('(') != std::string::npos) && (currentToken.find(')') != std::string::npos)); + size_t start = currentToken.find('(')+1; + std::string propertyName = currentToken.substr(start, currentToken.find(')')-start); + // if the property name is constructed dynamically (e.g. through an iterator) then there is nothing we can do + if (propertyName.find("@") == std::string::npos) + mProperties.push_back(propertyName); + } + } + + currentToken = ""; + } + else + { + if (currentToken == "") + { + if (c == '@') + tokenIsRecognized = true; + else + tokenIsRecognized = false; + } + else + { + if (c == '@') + { + // ouch, there are nested macros + // ( for example @shForeach(@shPropertyString(foobar)) ) + currentToken = ""; + } + } + + if (c == '(' && tokenIsRecognized) + isInBraces = true; + else if (c == ')' && tokenIsRecognized) + isInBraces = false; + + currentToken += c; + + } + } + } + + ShaderInstance* ShaderSet::getInstance (PropertySetGet* properties) + { + size_t h = buildHash (properties); + if (std::find(mFailedToCompile.begin(), mFailedToCompile.end(), h) != mFailedToCompile.end()) + return NULL; + if (mInstances.find(h) == mInstances.end()) + { + ShaderInstance newInstance(this, mName + "_" + boost::lexical_cast(h), properties); + if (!newInstance.getSupported()) + { + mFailedToCompile.push_back(h); + return NULL; + } + mInstances.insert(std::make_pair(h, newInstance)); + } + return &mInstances.find(h)->second; + } + + size_t ShaderSet::buildHash (PropertySetGet* properties) + { + size_t seed = 0; + PropertySetGet* currentGlobalSettings = getCurrentGlobalSettings (); + + for (std::vector::iterator it = mProperties.begin(); it != mProperties.end(); ++it) + { + std::string v = retrieveValue(properties->getProperty(*it), properties->getContext()).get(); + boost::hash_combine(seed, v); + } + for (std::vector ::iterator it = mGlobalSettings.begin(); it != mGlobalSettings.end(); ++it) + { + boost::hash_combine(seed, retrieveValue(currentGlobalSettings->getProperty(*it), NULL).get()); + } + boost::hash_combine(seed, static_cast(Factory::getInstance().getCurrentLanguage())); + return seed; + } + + PropertySetGet* ShaderSet::getCurrentGlobalSettings() const + { + return Factory::getInstance ().getCurrentGlobalSettings (); + } + + std::string ShaderSet::getBasePath() const + { + return mBasePath; + } + + std::string ShaderSet::getSource() const + { + return mSource; + } + + std::string ShaderSet::getCgProfile() const + { + return mCgProfile; + } + + std::string ShaderSet::getHlslProfile() const + { + return mHlslProfile; + } + + int ShaderSet::getType() const + { + return mType; + } +} diff --git a/extern/shiny/Main/ShaderSet.hpp b/extern/shiny/Main/ShaderSet.hpp new file mode 100644 index 000000000..776750598 --- /dev/null +++ b/extern/shiny/Main/ShaderSet.hpp @@ -0,0 +1,71 @@ +#ifndef SH_SHADERSET_H +#define SH_SHADERSET_H + +#include +#include +#include + +#include "ShaderInstance.hpp" + +namespace sh +{ + class PropertySetGet; + + typedef std::map ShaderInstanceMap; + + /** + * @brief Contains possible shader permutations of a single uber-shader (represented by one source file) + */ + class ShaderSet + { + public: + ShaderSet (const std::string& type, const std::string& cgProfile, const std::string& hlslProfile, const std::string& sourceFile, const std::string& basePath, + const std::string& name, PropertySetGet* globalSettingsPtr); + + /// Retrieve a shader instance for the given properties. \n + /// If a \a ShaderInstance with the same properties exists already, simply returns this instance. \n + /// Otherwise, creates a new \a ShaderInstance (i.e. compiles a new shader). \n + /// Might also return NULL if the shader failed to compile. \n + /// @note Only the properties that actually affect the shader source are taken into consideration here, + /// so it does not matter if you pass any extra properties that the shader does not care about. + ShaderInstance* getInstance (PropertySetGet* properties); + + void markDirty() { mIsDirty = true; } + ///< Signals that the cache is out of date, and thus should not be used this time + + private: + PropertySetGet* getCurrentGlobalSettings() const; + std::string getBasePath() const; + std::string getSource() const; + std::string getCgProfile() const; + std::string getHlslProfile() const; + int getType() const; + + bool isDirty() { return mIsDirty; } + + friend class ShaderInstance; + + bool mIsDirty; + + private: + GpuProgramType mType; + std::string mSource; + std::string mBasePath; + std::string mCgProfile; + std::string mHlslProfile; + std::string mName; + + std::vector mFailedToCompile; + + std::vector mGlobalSettings; ///< names of the global settings that affect the shader source + std::vector mProperties; ///< names of the per-material properties that affect the shader source + + ShaderInstanceMap mInstances; ///< maps permutation ID (generated from the properties) to \a ShaderInstance + + void parse(); ///< find out which properties and global settings affect the shader source + + size_t buildHash (PropertySetGet* properties); + }; +} + +#endif diff --git a/extern/shiny/Platforms/Ogre/OgreGpuProgram.cpp b/extern/shiny/Platforms/Ogre/OgreGpuProgram.cpp new file mode 100644 index 000000000..fe5aa2fe7 --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgreGpuProgram.cpp @@ -0,0 +1,70 @@ +#include + +#include "OgreGpuProgram.hpp" + +#include + +#include +#include +#include + +namespace sh +{ + OgreGpuProgram::OgreGpuProgram( + GpuProgramType type, + const std::string& compileArguments, + const std::string& name, const std::string& profile, + const std::string& source, const std::string& lang, + const std::string& resourceGroup) + : GpuProgram() + { + Ogre::HighLevelGpuProgramManager& mgr = Ogre::HighLevelGpuProgramManager::getSingleton(); + assert (mgr.getByName(name).isNull() && "Vertex program already exists"); + + Ogre::GpuProgramType t; + if (type == GPT_Vertex) + t = Ogre::GPT_VERTEX_PROGRAM; + else + t = Ogre::GPT_FRAGMENT_PROGRAM; + + mProgram = mgr.createProgram(name, resourceGroup, lang, t); + if (lang != "glsl") + mProgram->setParameter("entry_point", "main"); + + if (lang == "hlsl") + mProgram->setParameter("target", profile); + else if (lang == "cg") + mProgram->setParameter("profiles", profile); + + mProgram->setSource(source); + mProgram->load(); + + if (mProgram.isNull() || !mProgram->isSupported()) + std::cerr << "Failed to compile shader \"" << name << "\". Consider the OGRE log for more information." << std::endl; + } + + bool OgreGpuProgram::getSupported() + { + return (!mProgram.isNull() && mProgram->isSupported()); + } + + void OgreGpuProgram::setAutoConstant (const std::string& name, const std::string& autoConstantName, const std::string& extraInfo) + { + assert (!mProgram.isNull() && mProgram->isSupported()); + const Ogre::GpuProgramParameters::AutoConstantDefinition* d = Ogre::GpuProgramParameters::getAutoConstantDefinition(autoConstantName); + + if (!d) + throw std::runtime_error ("can't find auto constant with name \"" + autoConstantName + "\""); + Ogre::GpuProgramParameters::AutoConstantType t = d->acType; + + // this simplifies debugging for CG a lot. + mProgram->getDefaultParameters()->setIgnoreMissingParams(true); + + if (d->dataType == Ogre::GpuProgramParameters::ACDT_NONE) + mProgram->getDefaultParameters()->setNamedAutoConstant (name, t, 0); + else if (d->dataType == Ogre::GpuProgramParameters::ACDT_INT) + mProgram->getDefaultParameters()->setNamedAutoConstant (name, t, extraInfo == "" ? 0 : boost::lexical_cast(extraInfo)); + else if (d->dataType == Ogre::GpuProgramParameters::ACDT_REAL) + mProgram->getDefaultParameters()->setNamedAutoConstantReal (name, t, extraInfo == "" ? 0.f : boost::lexical_cast(extraInfo)); + } +} diff --git a/extern/shiny/Platforms/Ogre/OgreGpuProgram.hpp b/extern/shiny/Platforms/Ogre/OgreGpuProgram.hpp new file mode 100644 index 000000000..42673ed9b --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgreGpuProgram.hpp @@ -0,0 +1,31 @@ +#ifndef SH_OGREGPUPROGRAM_H +#define SH_OGREGPUPROGRAM_H + +#include + +#include + +#include "../../Main/Platform.hpp" + +namespace sh +{ + class OgreGpuProgram : public GpuProgram + { + public: + OgreGpuProgram ( + GpuProgramType type, + const std::string& compileArguments, + const std::string& name, const std::string& profile, + const std::string& source, const std::string& lang, + const std::string& resourceGroup); + + virtual bool getSupported(); + + virtual void setAutoConstant (const std::string& name, const std::string& autoConstantName, const std::string& extraInfo = ""); + + private: + Ogre::HighLevelGpuProgramPtr mProgram; + }; +} + +#endif diff --git a/extern/shiny/Platforms/Ogre/OgreMaterial.cpp b/extern/shiny/Platforms/Ogre/OgreMaterial.cpp new file mode 100644 index 000000000..4a550b8bf --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgreMaterial.cpp @@ -0,0 +1,99 @@ +#include "OgreMaterial.hpp" + +#include +#include +#include + +#include "OgrePass.hpp" +#include "OgreMaterialSerializer.hpp" +#include "OgrePlatform.hpp" + +namespace sh +{ + static const std::string sDefaultTechniqueName = "SH_DefaultTechnique"; + + OgreMaterial::OgreMaterial (const std::string& name, const std::string& resourceGroup) + : Material() + { + assert (Ogre::MaterialManager::getSingleton().getByName(name).isNull() && "Material already exists"); + mMaterial = Ogre::MaterialManager::getSingleton().create (name, resourceGroup); + mMaterial->removeAllTechniques(); + mMaterial->createTechnique()->setSchemeName (sDefaultTechniqueName); + mMaterial->compile(); + } + + OgreMaterial::~OgreMaterial() + { + Ogre::MaterialManager::getSingleton().remove(mMaterial->getName()); + } + + boost::shared_ptr OgreMaterial::createPass (const std::string& configuration, unsigned short lodIndex) + { + return boost::shared_ptr (new OgrePass (this, configuration, lodIndex)); + } + + void OgreMaterial::removeAll () + { + mMaterial->removeAllTechniques(); + mMaterial->createTechnique()->setSchemeName (sDefaultTechniqueName); + mMaterial->compile(); + } + + void OgreMaterial::setLodLevels (const std::string& lodLevels) + { + OgreMaterialSerializer& s = OgrePlatform::getSerializer(); + + s.setMaterialProperty ("lod_values", lodLevels, mMaterial); + } + + bool OgreMaterial::createConfiguration (const std::string& name, unsigned short lodIndex) + { + for (int i=0; igetNumTechniques(); ++i) + { + if (mMaterial->getTechnique(i)->getSchemeName() == name && mMaterial->getTechnique(i)->getLodIndex() == lodIndex) + return false; + } + + Ogre::Technique* t = mMaterial->createTechnique(); + t->setSchemeName (name); + t->setLodIndex (lodIndex); + if (mShadowCasterMaterial != "") + t->setShadowCasterMaterial(mShadowCasterMaterial); + + mMaterial->compile(); + + return true; + } + + Ogre::MaterialPtr OgreMaterial::getOgreMaterial () + { + return mMaterial; + } + + Ogre::Technique* OgreMaterial::getOgreTechniqueForConfiguration (const std::string& configurationName, unsigned short lodIndex) + { + for (int i=0; igetNumTechniques(); ++i) + { + if (mMaterial->getTechnique(i)->getSchemeName() == configurationName && mMaterial->getTechnique(i)->getLodIndex() == lodIndex) + { + return mMaterial->getTechnique(i); + } + } + + // Prepare and throw error message + std::stringstream message; + message << "Could not find configurationName '" << configurationName + << "' and lodIndex " << lodIndex; + + throw std::runtime_error(message.str()); + } + + void OgreMaterial::setShadowCasterMaterial (const std::string& name) + { + mShadowCasterMaterial = name; + for (int i=0; igetNumTechniques(); ++i) + { + mMaterial->getTechnique(i)->setShadowCasterMaterial(mShadowCasterMaterial); + } + } +} diff --git a/extern/shiny/Platforms/Ogre/OgreMaterial.hpp b/extern/shiny/Platforms/Ogre/OgreMaterial.hpp new file mode 100644 index 000000000..bec23f0b6 --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgreMaterial.hpp @@ -0,0 +1,38 @@ +#ifndef SH_OGREMATERIAL_H +#define SH_OGREMATERIAL_H + +#include + +#include + +#include "../../Main/Platform.hpp" + +namespace sh +{ + class OgreMaterial : public Material + { + public: + OgreMaterial (const std::string& name, const std::string& resourceGroup); + virtual ~OgreMaterial(); + + virtual boost::shared_ptr createPass (const std::string& configuration, unsigned short lodIndex); + virtual bool createConfiguration (const std::string& name, unsigned short lodIndex); + + virtual void removeAll (); + + Ogre::MaterialPtr getOgreMaterial(); + + virtual void setLodLevels (const std::string& lodLevels); + + Ogre::Technique* getOgreTechniqueForConfiguration (const std::string& configurationName, unsigned short lodIndex = 0); + + virtual void setShadowCasterMaterial (const std::string& name); + + private: + Ogre::MaterialPtr mMaterial; + + std::string mShadowCasterMaterial; + }; +} + +#endif diff --git a/extern/shiny/Platforms/Ogre/OgreMaterialSerializer.cpp b/extern/shiny/Platforms/Ogre/OgreMaterialSerializer.cpp new file mode 100644 index 000000000..9f57c7b44 --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgreMaterialSerializer.cpp @@ -0,0 +1,67 @@ +#include "OgreMaterialSerializer.hpp" + +namespace sh +{ + void OgreMaterialSerializer::reset() + { + mScriptContext.section = Ogre::MSS_NONE; + mScriptContext.material.setNull(); + mScriptContext.technique = 0; + mScriptContext.pass = 0; + mScriptContext.textureUnit = 0; + mScriptContext.program.setNull(); + mScriptContext.lineNo = 0; + mScriptContext.filename.clear(); + mScriptContext.techLev = -1; + mScriptContext.passLev = -1; + mScriptContext.stateLev = -1; + } + + bool OgreMaterialSerializer::setPassProperty (const std::string& param, std::string value, Ogre::Pass* pass) + { + reset(); + + mScriptContext.section = Ogre::MSS_PASS; + mScriptContext.pass = pass; + + if (mPassAttribParsers.find (param) == mPassAttribParsers.end()) + return false; + else + { + mPassAttribParsers.find(param)->second(value, mScriptContext); + return true; + } + } + + bool OgreMaterialSerializer::setTextureUnitProperty (const std::string& param, std::string value, Ogre::TextureUnitState* t) + { + reset(); + + mScriptContext.section = Ogre::MSS_TEXTUREUNIT; + mScriptContext.textureUnit = t; + + if (mTextureUnitAttribParsers.find (param) == mTextureUnitAttribParsers.end()) + return false; + else + { + mTextureUnitAttribParsers.find(param)->second(value, mScriptContext); + return true; + } + } + + bool OgreMaterialSerializer::setMaterialProperty (const std::string& param, std::string value, Ogre::MaterialPtr m) + { + reset(); + + mScriptContext.section = Ogre::MSS_MATERIAL; + mScriptContext.material = m; + + if (mMaterialAttribParsers.find (param) == mMaterialAttribParsers.end()) + return false; + else + { + mMaterialAttribParsers.find(param)->second(value, mScriptContext); + return true; + } + } +} diff --git a/extern/shiny/Platforms/Ogre/OgreMaterialSerializer.hpp b/extern/shiny/Platforms/Ogre/OgreMaterialSerializer.hpp new file mode 100644 index 000000000..acfc5a362 --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgreMaterialSerializer.hpp @@ -0,0 +1,29 @@ +#ifndef SH_OGREMATERIALSERIALIZER_H +#define SH_OGREMATERIALSERIALIZER_H + +#include + +namespace Ogre +{ + class Pass; +} + +namespace sh +{ + /** + * @brief This class allows me to let Ogre handle the pass & texture unit properties + */ + class OgreMaterialSerializer : public Ogre::MaterialSerializer + { + public: + bool setPassProperty (const std::string& param, std::string value, Ogre::Pass* pass); + bool setTextureUnitProperty (const std::string& param, std::string value, Ogre::TextureUnitState* t); + bool setMaterialProperty (const std::string& param, std::string value, Ogre::MaterialPtr m); + + private: + void reset(); + }; + +} + +#endif diff --git a/extern/shiny/Platforms/Ogre/OgrePass.cpp b/extern/shiny/Platforms/Ogre/OgrePass.cpp new file mode 100644 index 000000000..8cfaae078 --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgrePass.cpp @@ -0,0 +1,128 @@ +#include + +#include "OgrePass.hpp" + +#include +#include + +#include "OgreTextureUnitState.hpp" +#include "OgreGpuProgram.hpp" +#include "OgreMaterial.hpp" +#include "OgreMaterialSerializer.hpp" +#include "OgrePlatform.hpp" + +namespace sh +{ + OgrePass::OgrePass (OgreMaterial* parent, const std::string& configuration, unsigned short lodIndex) + : Pass() + { + Ogre::Technique* t = parent->getOgreTechniqueForConfiguration(configuration, lodIndex); + mPass = t->createPass(); + } + + boost::shared_ptr OgrePass::createTextureUnitState () + { + return boost::shared_ptr (new OgreTextureUnitState (this)); + } + + void OgrePass::assignProgram (GpuProgramType type, const std::string& name) + { + if (type == GPT_Vertex) + mPass->setVertexProgram (name); + else if (type == GPT_Fragment) + mPass->setFragmentProgram (name); + else + throw std::runtime_error("unsupported GpuProgramType"); + } + + Ogre::Pass* OgrePass::getOgrePass () + { + return mPass; + } + + bool OgrePass::setPropertyOverride (const std::string &name, PropertyValuePtr& value, PropertySetGet* context) + { + if (((typeid(*value) == typeid(StringValue)) || typeid(*value) == typeid(LinkedValue)) + && retrieveValue(value, context).get() == "default") + return true; + + if (name == "vertex_program") + return true; // handled already + else if (name == "fragment_program") + return true; // handled already + else if (name == "ffp_vertex_colour_ambient") + { + bool enabled = retrieveValue(value, context).get(); + // fixed-function vertex colour tracking + mPass->setVertexColourTracking(enabled ? Ogre::TVC_AMBIENT : Ogre::TVC_NONE); + return true; + } + else + { + OgreMaterialSerializer& s = OgrePlatform::getSerializer(); + + return s.setPassProperty (name, retrieveValue(value, context).get(), mPass); + } + } + + void OgrePass::setGpuConstant (int type, const std::string& name, ValueType vt, PropertyValuePtr value, PropertySetGet* context) + { + Ogre::GpuProgramParametersSharedPtr params; + if (type == GPT_Vertex) + { + if (!mPass->hasVertexProgram ()) + return; + params = mPass->getVertexProgramParameters(); + } + else if (type == GPT_Fragment) + { + if (!mPass->hasFragmentProgram ()) + return; + params = mPass->getFragmentProgramParameters(); + } + + if (vt == VT_Float) + params->setNamedConstant (name, retrieveValue(value, context).get()); + else if (vt == VT_Int) + params->setNamedConstant (name, retrieveValue(value, context).get()); + else if (vt == VT_Vector4) + { + Vector4 v = retrieveValue(value, context); + params->setNamedConstant (name, Ogre::Vector4(v.mX, v.mY, v.mZ, v.mW)); + } + else if (vt == VT_Vector3) + { + Vector3 v = retrieveValue(value, context); + params->setNamedConstant (name, Ogre::Vector4(v.mX, v.mY, v.mZ, 1.0)); + } + else if (vt == VT_Vector2) + { + Vector2 v = retrieveValue(value, context); + params->setNamedConstant (name, Ogre::Vector4(v.mX, v.mY, 1.0, 1.0)); + } + else + throw std::runtime_error ("unsupported constant type"); + } + + void OgrePass::addSharedParameter (int type, const std::string& name) + { + Ogre::GpuProgramParametersSharedPtr params; + if (type == GPT_Vertex) + params = mPass->getVertexProgramParameters(); + else if (type == GPT_Fragment) + params = mPass->getFragmentProgramParameters(); + + params->addSharedParameters (name); + } + + void OgrePass::setTextureUnitIndex (int programType, const std::string& name, int index) + { + Ogre::GpuProgramParametersSharedPtr params; + if (programType == GPT_Vertex) + params = mPass->getVertexProgramParameters(); + else if (programType == GPT_Fragment) + params = mPass->getFragmentProgramParameters(); + + params->setNamedConstant(name, index); + } +} diff --git a/extern/shiny/Platforms/Ogre/OgrePass.hpp b/extern/shiny/Platforms/Ogre/OgrePass.hpp new file mode 100644 index 000000000..da67a1a2a --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgrePass.hpp @@ -0,0 +1,35 @@ +#ifndef SH_OGREPASS_H +#define SH_OGREPASS_H + +#include + +#include "../../Main/Platform.hpp" + +namespace sh +{ + class OgreMaterial; + + class OgrePass : public Pass + { + public: + OgrePass (OgreMaterial* parent, const std::string& configuration, unsigned short lodIndex); + + virtual boost::shared_ptr createTextureUnitState (); + virtual void assignProgram (GpuProgramType type, const std::string& name); + + Ogre::Pass* getOgrePass(); + + virtual void setGpuConstant (int type, const std::string& name, ValueType vt, PropertyValuePtr value, PropertySetGet* context); + + virtual void addSharedParameter (int type, const std::string& name); + virtual void setTextureUnitIndex (int programType, const std::string& name, int index); + + private: + Ogre::Pass* mPass; + + protected: + virtual bool setPropertyOverride (const std::string &name, PropertyValuePtr& value, PropertySetGet* context); + }; +} + +#endif diff --git a/extern/shiny/Platforms/Ogre/OgrePlatform.cpp b/extern/shiny/Platforms/Ogre/OgrePlatform.cpp new file mode 100644 index 000000000..357949402 --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgrePlatform.cpp @@ -0,0 +1,174 @@ +#include + +#include "OgrePlatform.hpp" + +#include +#include +#include + +#include "OgreMaterial.hpp" +#include "OgreGpuProgram.hpp" +#include "OgreMaterialSerializer.hpp" + +#include "../../Main/MaterialInstance.hpp" +#include "../../Main/Factory.hpp" + +namespace +{ + std::string convertLang (sh::Language lang) + { + if (lang == sh::Language_CG) + return "cg"; + else if (lang == sh::Language_HLSL) + return "hlsl"; + else if (lang == sh::Language_GLSL) + return "glsl"; + throw std::runtime_error ("invalid language, valid are: cg, hlsl, glsl"); + } +} + +namespace sh +{ + OgreMaterialSerializer* OgrePlatform::sSerializer = 0; + + OgrePlatform::OgrePlatform(const std::string& resourceGroupName, const std::string& basePath) + : Platform(basePath) + , mResourceGroup(resourceGroupName) + { + Ogre::MaterialManager::getSingleton().addListener(this); + + if (supportsShaderSerialization()) + Ogre::GpuProgramManager::getSingletonPtr()->setSaveMicrocodesToCache(true); + + sSerializer = new OgreMaterialSerializer(); + } + + OgreMaterialSerializer& OgrePlatform::getSerializer() + { + assert(sSerializer); + return *sSerializer; + } + + OgrePlatform::~OgrePlatform () + { + delete sSerializer; + } + + bool OgrePlatform::isProfileSupported (const std::string& profile) + { + return Ogre::GpuProgramManager::getSingleton().isSyntaxSupported(profile); + } + + bool OgrePlatform::supportsShaderSerialization () + { + // Not very reliable in OpenGL mode (requires extension), and somehow doesn't work on linux even if the extension is present + return Ogre::Root::getSingleton ().getRenderSystem ()->getName ().find("OpenGL") == std::string::npos; + } + + bool OgrePlatform::supportsMaterialQueuedListener () + { + return true; + } + + boost::shared_ptr OgrePlatform::createMaterial (const std::string& name) + { + OgreMaterial* material = new OgreMaterial(name, mResourceGroup); + return boost::shared_ptr (material); + } + + boost::shared_ptr OgrePlatform::createGpuProgram ( + GpuProgramType type, + const std::string& compileArguments, + const std::string& name, const std::string& profile, + const std::string& source, Language lang) + { + OgreGpuProgram* prog = new OgreGpuProgram (type, compileArguments, name, profile, source, convertLang(lang), mResourceGroup); + return boost::shared_ptr (static_cast(prog)); + } + + Ogre::Technique* OgrePlatform::handleSchemeNotFound ( + unsigned short schemeIndex, const Ogre::String &schemeName, Ogre::Material *originalMaterial, + unsigned short lodIndex, const Ogre::Renderable *rend) + { + MaterialInstance* m = fireMaterialRequested(originalMaterial->getName(), schemeName, lodIndex); + if (m) + { + OgreMaterial* _m = static_cast(m->getMaterial()); + return _m->getOgreTechniqueForConfiguration (schemeName, lodIndex); + } + else + return 0; // material does not belong to us + } + + void OgrePlatform::serializeShaders (const std::string& file) + { + std::fstream output; + output.open(file.c_str(), std::ios::out | std::ios::binary); + Ogre::DataStreamPtr shaderCache (OGRE_NEW Ogre::FileStreamDataStream(file, &output, false)); + Ogre::GpuProgramManager::getSingleton().saveMicrocodeCache(shaderCache); + } + + void OgrePlatform::deserializeShaders (const std::string& file) + { + std::ifstream inp; + inp.open(file.c_str(), std::ios::in | std::ios::binary); + Ogre::DataStreamPtr shaderCache(OGRE_NEW Ogre::FileStreamDataStream(file, &inp, false)); + Ogre::GpuProgramManager::getSingleton().loadMicrocodeCache(shaderCache); + } + + void OgrePlatform::setSharedParameter (const std::string& name, PropertyValuePtr value) + { + Ogre::GpuSharedParametersPtr params; + if (mSharedParameters.find(name) == mSharedParameters.end()) + { + params = Ogre::GpuProgramManager::getSingleton().createSharedParameters(name); + Ogre::GpuConstantType type; + if (typeid(*value) == typeid(Vector4)) + type = Ogre::GCT_FLOAT4; + else if (typeid(*value) == typeid(Vector3)) + type = Ogre::GCT_FLOAT3; + else if (typeid(*value) == typeid(Vector2)) + type = Ogre::GCT_FLOAT2; + else if (typeid(*value) == typeid(FloatValue)) + type = Ogre::GCT_FLOAT1; + else if (typeid(*value) == typeid(IntValue)) + type = Ogre::GCT_INT1; + else + assert(0); + params->addConstantDefinition(name, type); + mSharedParameters[name] = params; + } + else + params = mSharedParameters.find(name)->second; + + Ogre::Vector4 v (1.0, 1.0, 1.0, 1.0); + if (typeid(*value) == typeid(Vector4)) + { + Vector4 vec = retrieveValue(value, NULL); + v.x = vec.mX; + v.y = vec.mY; + v.z = vec.mZ; + v.w = vec.mW; + } + else if (typeid(*value) == typeid(Vector3)) + { + Vector3 vec = retrieveValue(value, NULL); + v.x = vec.mX; + v.y = vec.mY; + v.z = vec.mZ; + } + else if (typeid(*value) == typeid(Vector2)) + { + Vector2 vec = retrieveValue(value, NULL); + v.x = vec.mX; + v.y = vec.mY; + } + else if (typeid(*value) == typeid(FloatValue)) + v.x = retrieveValue(value, NULL).get(); + else if (typeid(*value) == typeid(IntValue)) + v.x = static_cast(retrieveValue(value, NULL).get()); + else + throw std::runtime_error ("unsupported property type for shared parameter \"" + name + "\""); + params->setNamedConstant(name, v); + } +} diff --git a/extern/shiny/Platforms/Ogre/OgrePlatform.hpp b/extern/shiny/Platforms/Ogre/OgrePlatform.hpp new file mode 100644 index 000000000..d115c46bb --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgrePlatform.hpp @@ -0,0 +1,72 @@ +#ifndef SH_OGREPLATFORM_H +#define SH_OGREPLATFORM_H + +/** + * @addtogroup Platforms + * @{ + */ + +/** + * @addtogroup Ogre + * A set of classes to interact with Ogre's material system + * @{ + */ + +#include "../../Main/Platform.hpp" + +#include +#include + +namespace sh +{ + class OgreMaterialSerializer; + + class OgrePlatform : public Platform, public Ogre::MaterialManager::Listener + { + public: + OgrePlatform (const std::string& resourceGroupName, const std::string& basePath); + virtual ~OgrePlatform (); + + virtual Ogre::Technique* handleSchemeNotFound ( + unsigned short schemeIndex, const Ogre::String &schemeName, Ogre::Material *originalMaterial, + unsigned short lodIndex, const Ogre::Renderable *rend); + + static OgreMaterialSerializer& getSerializer(); + + private: + virtual bool isProfileSupported (const std::string& profile); + + virtual void serializeShaders (const std::string& file); + virtual void deserializeShaders (const std::string& file); + + virtual boost::shared_ptr createMaterial (const std::string& name); + + virtual boost::shared_ptr createGpuProgram ( + GpuProgramType type, + const std::string& compileArguments, + const std::string& name, const std::string& profile, + const std::string& source, Language lang); + + virtual void setSharedParameter (const std::string& name, PropertyValuePtr value); + + friend class ShaderInstance; + friend class Factory; + + protected: + virtual bool supportsShaderSerialization (); + virtual bool supportsMaterialQueuedListener (); + + std::string mResourceGroup; + + static OgreMaterialSerializer* sSerializer; + + std::map mSharedParameters; + }; +} + +/** + * @} + * @} + */ + +#endif diff --git a/extern/shiny/Platforms/Ogre/OgreTextureUnitState.cpp b/extern/shiny/Platforms/Ogre/OgreTextureUnitState.cpp new file mode 100644 index 000000000..0938cf667 --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgreTextureUnitState.cpp @@ -0,0 +1,40 @@ +#include "OgreTextureUnitState.hpp" + +#include "OgrePass.hpp" +#include "OgrePlatform.hpp" +#include "OgreMaterialSerializer.hpp" + +namespace sh +{ + OgreTextureUnitState::OgreTextureUnitState (OgrePass* parent) + : TextureUnitState() + { + mTextureUnitState = parent->getOgrePass()->createTextureUnitState(""); + } + + bool OgreTextureUnitState::setPropertyOverride (const std::string &name, PropertyValuePtr& value, PropertySetGet* context) + { + OgreMaterialSerializer& s = OgrePlatform::getSerializer(); + + if (name == "texture_alias") + { + // texture alias in this library refers to something else than in ogre + // delegate up + return TextureUnitState::setPropertyOverride (name, value, context); + } + else if (name == "direct_texture") + { + setTextureName (retrieveValue(value, context).get()); + return true; + } + else if (name == "create_in_ffp") + return true; // handled elsewhere + + return s.setTextureUnitProperty (name, retrieveValue(value, context).get(), mTextureUnitState); + } + + void OgreTextureUnitState::setTextureName (const std::string& textureName) + { + mTextureUnitState->setTextureName(textureName); + } +} diff --git a/extern/shiny/Platforms/Ogre/OgreTextureUnitState.hpp b/extern/shiny/Platforms/Ogre/OgreTextureUnitState.hpp new file mode 100644 index 000000000..d36f4b945 --- /dev/null +++ b/extern/shiny/Platforms/Ogre/OgreTextureUnitState.hpp @@ -0,0 +1,27 @@ +#ifndef SH_OGRETEXTUREUNITSTATE_H +#define SH_OGRETEXTUREUNITSTATE_H + +#include + +#include "../../Main/Platform.hpp" + +namespace sh +{ + class OgrePass; + + class OgreTextureUnitState : public TextureUnitState + { + public: + OgreTextureUnitState (OgrePass* parent); + + virtual void setTextureName (const std::string& textureName); + + private: + Ogre::TextureUnitState* mTextureUnitState; + + protected: + virtual bool setPropertyOverride (const std::string &name, PropertyValuePtr& value, PropertySetGet* context); + }; +} + +#endif diff --git a/extern/shiny/Preprocessor/aq.cpp b/extern/shiny/Preprocessor/aq.cpp new file mode 100644 index 000000000..b81d5b332 --- /dev/null +++ b/extern/shiny/Preprocessor/aq.cpp @@ -0,0 +1,236 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001 Daniel C. Nuffer. + Copyright (c) 2001-2011 Hartmut Kaiser. + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include + +#include +#include + +#include // configuration data +#include + +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { +namespace wave { +namespace cpplexer { +namespace re2clex { + +int aq_grow(aq_queue q) +{ + using namespace std; // some systems have memcpy/realloc in std + std::size_t new_size = q->max_size << 1; + aq_stdelement* new_queue = (aq_stdelement*)realloc(q->queue, + new_size * sizeof(aq_stdelement)); + + BOOST_ASSERT(NULL != q); + BOOST_ASSERT(q->max_size < 100000); + BOOST_ASSERT(q->size <= q->max_size); + +#define ASSERT_SIZE BOOST_ASSERT( \ + ((q->tail + q->max_size + 1) - q->head) % q->max_size == \ + q->size % q->max_size) + + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + if (!new_queue) + { + BOOST_ASSERT(0); + return 0; + } + + q->queue = new_queue; + if (q->tail <= q->head) /* tail has wrapped around */ + { + /* move the tail from the beginning to the end */ + memcpy(q->queue + q->max_size, q->queue, + (q->tail + 1) * sizeof(aq_stdelement)); + q->tail += q->max_size; + } + q->max_size = new_size; + + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + return 1; +} + +int aq_enqueue(aq_queue q, aq_stdelement e) +{ + BOOST_ASSERT(NULL != q); + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + + if (AQ_FULL(q)) + if (!aq_grow(q)) + return 0; + + ++q->tail; + if (q->tail == q->max_size) + q->tail = 0; + + q->queue[q->tail] = e; + ++q->size; + + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + return 1; +} + +int aq_enqueue_front(aq_queue q, aq_stdelement e) +{ + BOOST_ASSERT(NULL != q); + + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + + if (AQ_FULL(q)) + if (!aq_grow(q)) + return 0; + + if (q->head == 0) + q->head = q->max_size - 1; + else + --q->head; + + q->queue[q->head] = e; + ++q->size; + + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + return 1; +} + +int aq_serve(aq_queue q, aq_stdelement *e) +{ + + BOOST_ASSERT(NULL != q); + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + + if (AQ_EMPTY(q)) + return 0; + + *e = q->queue[q->head]; + return aq_pop(q); +} + +int aq_pop(aq_queue q) +{ + + BOOST_ASSERT(NULL != q); + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + + if (AQ_EMPTY(q)) + return 0; + + ++q->head; + if (q->head == q->max_size) + q->head = 0; + --q->size; + + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + return 1; +} + +aq_queue aq_create(void) +{ + aq_queue q; + + using namespace std; // some systems have malloc in std + q = (aq_queue)malloc(sizeof(aq_queuetype)); + if (!q) + { + return 0; + } + + q->max_size = 8; /* initial size */ + q->queue = (aq_stdelement*)malloc( + sizeof(aq_stdelement) * q->max_size); + if (!q->queue) + { + free(q); + return 0; + } + + q->head = 0; + q->tail = q->max_size - 1; + q->size = 0; + + + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + return q; +} + +void aq_terminate(aq_queue q) +{ + using namespace std; // some systems have free in std + + BOOST_ASSERT(NULL != q); + BOOST_ASSERT(q->size <= q->max_size); + ASSERT_SIZE; + BOOST_ASSERT(q->head <= q->max_size); + BOOST_ASSERT(q->tail <= q->max_size); + + free(q->queue); + free(q); +} + +/////////////////////////////////////////////////////////////////////////////// +} // namespace re2clex +} // namespace cpplexer +} // namespace wave +} // namespace boost + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + diff --git a/extern/shiny/Preprocessor/cpp_re.cpp b/extern/shiny/Preprocessor/cpp_re.cpp new file mode 100644 index 000000000..69d77c372 --- /dev/null +++ b/extern/shiny/Preprocessor/cpp_re.cpp @@ -0,0 +1,442 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + + Copyright (c) 2001 Daniel C. Nuffer + Copyright (c) 2001-2011 Hartmut Kaiser. + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + TODO: + It also may be necessary to add $ to identifiers, for asm. + handle errors better. + have some easier way to parse strings instead of files (done) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include + +#include +#include +#include +#include +#include +#include +#include + +#include // configuration data + +#if defined(BOOST_HAS_UNISTD_H) +#include +#else +#include +#endif + +#include +#include + +#include +#include +#include +#include +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +#if defined(BOOST_MSVC) +#pragma warning (disable: 4101) // 'foo' : unreferenced local variable +#pragma warning (disable: 4102) // 'foo' : unreferenced label +#endif + +/////////////////////////////////////////////////////////////////////////////// +#define BOOST_WAVE_BSIZE 196608 + +#define YYCTYPE uchar +#define YYCURSOR cursor +#define YYLIMIT limit +#define YYMARKER marker +#define YYFILL(n) \ + { \ + cursor = uchar_wrapper(fill(s, cursor), cursor.column); \ + limit = uchar_wrapper (s->lim); \ + } \ + /**/ + +#include + +/////////////////////////////////////////////////////////////////////////////// +#define BOOST_WAVE_UPDATE_CURSOR() \ + { \ + s->line += count_backslash_newlines(s, cursor); \ + s->curr_column = cursor.column; \ + s->cur = cursor; \ + s->lim = limit; \ + s->ptr = marker; \ + } \ + /**/ + +/////////////////////////////////////////////////////////////////////////////// +#define BOOST_WAVE_RET(i) \ + { \ + BOOST_WAVE_UPDATE_CURSOR() \ + if (s->cur > s->lim) \ + return T_EOF; /* may happen for empty files */ \ + return (i); \ + } \ + /**/ + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { +namespace wave { +namespace cpplexer { +namespace re2clex { + +#define RE2C_ASSERT BOOST_ASSERT + +int get_one_char(Scanner *s) +{ + if (0 != s->act) { + RE2C_ASSERT(s->first != 0 && s->last != 0); + RE2C_ASSERT(s->first <= s->act && s->act <= s->last); + if (s->act < s->last) + return *(s->act)++; + } + return -1; +} + +std::ptrdiff_t rewind_stream (Scanner *s, int cnt) +{ + if (0 != s->act) { + RE2C_ASSERT(s->first != 0 && s->last != 0); + s->act += cnt; + RE2C_ASSERT(s->first <= s->act && s->act <= s->last); + return s->act - s->first; + } + return 0; +} + +std::size_t get_first_eol_offset(Scanner* s) +{ + if (!AQ_EMPTY(s->eol_offsets)) + { + return s->eol_offsets->queue[s->eol_offsets->head]; + } + else + { + return (unsigned int)-1; + } +} + +void adjust_eol_offsets(Scanner* s, std::size_t adjustment) +{ + aq_queue q; + std::size_t i; + + if (!s->eol_offsets) + s->eol_offsets = aq_create(); + + q = s->eol_offsets; + + if (AQ_EMPTY(q)) + return; + + i = q->head; + while (i != q->tail) + { + if (adjustment > q->queue[i]) + q->queue[i] = 0; + else + q->queue[i] -= adjustment; + ++i; + if (i == q->max_size) + i = 0; + } + if (adjustment > q->queue[i]) + q->queue[i] = 0; + else + q->queue[i] -= adjustment; +} + +int count_backslash_newlines(Scanner *s, uchar *cursor) +{ + std::size_t diff, offset; + int skipped = 0; + + /* figure out how many backslash-newlines skipped over unknowingly. */ + diff = cursor - s->bot; + offset = get_first_eol_offset(s); + while (offset <= diff && offset != (unsigned int)-1) + { + skipped++; + aq_pop(s->eol_offsets); + offset = get_first_eol_offset(s); + } + return skipped; +} + +bool is_backslash(uchar *p, uchar *end, int &len) +{ + if (*p == '\\') { + len = 1; + return true; + } + else if (*p == '?' && *(p+1) == '?' && (p+2 < end && *(p+2) == '/')) { + len = 3; + return true; + } + return false; +} + +uchar *fill(Scanner *s, uchar *cursor) +{ + using namespace std; // some systems have memcpy etc. in namespace std + if(!s->eof) + { + uchar* p; + std::ptrdiff_t cnt = s->tok - s->bot; + if(cnt) + { + if (NULL == s->lim) + s->lim = s->top; + memmove(s->bot, s->tok, s->lim - s->tok); + s->tok = s->cur = s->bot; + s->ptr -= cnt; + cursor -= cnt; + s->lim -= cnt; + adjust_eol_offsets(s, cnt); + } + + if((s->top - s->lim) < BOOST_WAVE_BSIZE) + { + uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BOOST_WAVE_BSIZE)*sizeof(uchar)); + if (buf == 0) + { + using namespace std; // some systems have printf in std + if (0 != s->error_proc) { + (*s->error_proc)(s, lexing_exception::unexpected_error, + "Out of memory!"); + } + else + printf("Out of memory!\n"); + + /* get the scanner to stop */ + *cursor = 0; + return cursor; + } + + memmove(buf, s->tok, s->lim - s->tok); + s->tok = s->cur = buf; + s->ptr = &buf[s->ptr - s->bot]; + cursor = &buf[cursor - s->bot]; + s->lim = &buf[s->lim - s->bot]; + s->top = &s->lim[BOOST_WAVE_BSIZE]; + free(s->bot); + s->bot = buf; + } + + if (s->act != 0) { + cnt = s->last - s->act; + if (cnt > BOOST_WAVE_BSIZE) + cnt = BOOST_WAVE_BSIZE; + memmove(s->lim, s->act, cnt); + s->act += cnt; + if (cnt != BOOST_WAVE_BSIZE) + { + s->eof = &s->lim[cnt]; *(s->eof)++ = '\0'; + } + } + + /* backslash-newline erasing time */ + + /* first scan for backslash-newline and erase them */ + for (p = s->lim; p < s->lim + cnt - 2; ++p) + { + int len = 0; + if (is_backslash(p, s->lim + cnt, len)) + { + if (*(p+len) == '\n') + { + int offset = len + 1; + memmove(p, p + offset, s->lim + cnt - p - offset); + cnt -= offset; + --p; + aq_enqueue(s->eol_offsets, p - s->bot + 1); + } + else if (*(p+len) == '\r') + { + if (*(p+len+1) == '\n') + { + int offset = len + 2; + memmove(p, p + offset, s->lim + cnt - p - offset); + cnt -= offset; + --p; + } + else + { + int offset = len + 1; + memmove(p, p + offset, s->lim + cnt - p - offset); + cnt -= offset; + --p; + } + aq_enqueue(s->eol_offsets, p - s->bot + 1); + } + } + } + + /* FIXME: the following code should be fixed to recognize correctly the + trigraph backslash token */ + + /* check to see if what we just read ends in a backslash */ + if (cnt >= 2) + { + uchar last = s->lim[cnt-1]; + uchar last2 = s->lim[cnt-2]; + /* check \ EOB */ + if (last == '\\') + { + int next = get_one_char(s); + /* check for \ \n or \ \r or \ \r \n straddling the border */ + if (next == '\n') + { + --cnt; /* chop the final \, we've already read the \n. */ + aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot)); + } + else if (next == '\r') + { + int next2 = get_one_char(s); + if (next2 == '\n') + { + --cnt; /* skip the backslash */ + } + else + { + /* rewind one, and skip one char */ + rewind_stream(s, -1); + --cnt; + } + aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot)); + } + else if (next != -1) /* -1 means end of file */ + { + /* next was something else, so rewind the stream */ + rewind_stream(s, -1); + } + } + /* check \ \r EOB */ + else if (last == '\r' && last2 == '\\') + { + int next = get_one_char(s); + if (next == '\n') + { + cnt -= 2; /* skip the \ \r */ + } + else + { + /* rewind one, and skip two chars */ + rewind_stream(s, -1); + cnt -= 2; + } + aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot)); + } + /* check \ \n EOB */ + else if (last == '\n' && last2 == '\\') + { + cnt -= 2; + aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot)); + } + } + + s->lim += cnt; + if (s->eof) /* eof needs adjusting if we erased backslash-newlines */ + { + s->eof = s->lim; + *(s->eof)++ = '\0'; + } + } + return cursor; +} + +/////////////////////////////////////////////////////////////////////////////// +// Special wrapper class holding the current cursor position +struct uchar_wrapper +{ + uchar_wrapper (uchar *base_cursor, unsigned int column = 1) + : base_cursor(base_cursor), column(column) + {} + + uchar_wrapper& operator++() + { + ++base_cursor; + ++column; + return *this; + } + + uchar_wrapper& operator--() + { + --base_cursor; + --column; + return *this; + } + + uchar operator* () const + { + return *base_cursor; + } + + operator uchar *() const + { + return base_cursor; + } + + friend std::ptrdiff_t + operator- (uchar_wrapper const& lhs, uchar_wrapper const& rhs) + { + return lhs.base_cursor - rhs.base_cursor; + } + + uchar *base_cursor; + unsigned int column; +}; + +/////////////////////////////////////////////////////////////////////////////// +boost::wave::token_id scan(Scanner *s) +{ + BOOST_ASSERT(0 != s->error_proc); // error handler must be given + + uchar_wrapper cursor (s->tok = s->cur, s->column = s->curr_column); + uchar_wrapper marker (s->ptr); + uchar_wrapper limit (s->lim); + +// include the correct Re2C token definition rules +#if BOOST_WAVE_USE_STRICT_LEXER != 0 +#include "strict_cpp_re.inc" +#else +#include "cpp_re.inc" +#endif + +} /* end of scan */ + +/////////////////////////////////////////////////////////////////////////////// +} // namespace re2clex +} // namespace cpplexer +} // namespace wave +} // namespace boost + +#undef BOOST_WAVE_RET +#undef BOOST_WAVE_BSIZE +#undef YYCTYPE +#undef YYCURSOR +#undef YYLIMIT +#undef YYMARKER +#undef YYFILL + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + diff --git a/extern/shiny/Preprocessor/cpp_re.inc b/extern/shiny/Preprocessor/cpp_re.inc new file mode 100644 index 000000000..afb7fc189 --- /dev/null +++ b/extern/shiny/Preprocessor/cpp_re.inc @@ -0,0 +1,9044 @@ +/* Generated by re2c 0.13.5 on Sun Jan 09 15:38:23 2011 */ +#line 1 "cpp.re" +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + + Copyright (c) 2001 Daniel C. Nuffer + Copyright (c) 2001-2011 Hartmut Kaiser. + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + This is a lexer conforming to the Standard with a few exceptions. + So it does allow the '$' to be part of identifiers. If you need strict + Standards conforming behaviour, please include the lexer definition + provided in the file strict_cpp.re. + + TODO: + handle errors better. +=============================================================================*/ + +#line 40 "cpp.re" + + + +#line 25 "cpp_re.inc" +{ + YYCTYPE yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + /* table 1 .. 8: 0 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 60, 32, 60, 60, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 60, 60, 52, 60, 60, 60, 60, 56, + 60, 60, 156, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 44, 57, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 58, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + /* table 9 .. 12: 256 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 80, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 80, 64, 0, 64, 96, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 64, 64, 64, 64, 64, 0, + 64, 224, 224, 224, 224, 224, 224, 96, + 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 64, 0, 64, 64, 96, + 64, 224, 224, 224, 224, 224, 224, 96, + 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + }; + + if ((YYLIMIT - YYCURSOR) < 17) YYFILL(17); + yych = *YYCURSOR; + switch (yych) { + case 0x00: goto yy90; + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case 0x0E: + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1C: + case 0x1D: + case 0x1E: + case 0x1F: goto yy93; + case '\t': + case '\v': + case '\f': goto yy84; + case '\n': goto yy87; + case '\r': goto yy89; + case ' ': goto yy86; + case '!': goto yy68; + case '"': goto yy79; + case '#': goto yy45; + case '$': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'S': + case 'T': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case 'h': + case 'j': + case 'k': + case 'q': + case 'y': + case 'z': goto yy82; + case '%': goto yy37; + case '&': goto yy62; + case '\'': goto yy77; + case '(': goto yy47; + case ')': goto yy49; + case '*': goto yy57; + case '+': goto yy53; + case ',': goto yy74; + case '-': goto yy55; + case '.': goto yy4; + case '/': goto yy2; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy6; + case ':': goto yy43; + case ';': goto yy51; + case '<': goto yy33; + case '=': goto yy70; + case '>': goto yy72; + case '?': goto yy31; + case 'L': goto yy76; + case 'R': goto yy80; + case 'U': goto yy81; + case '[': goto yy39; + case '\\': goto yy83; + case ']': goto yy41; + case '^': goto yy59; + case '_': goto yy28; + case 'a': goto yy8; + case 'b': goto yy10; + case 'c': goto yy11; + case 'd': goto yy12; + case 'e': goto yy13; + case 'f': goto yy14; + case 'g': goto yy15; + case 'i': goto yy16; + case 'l': goto yy17; + case 'm': goto yy18; + case 'n': goto yy19; + case 'o': goto yy20; + case 'p': goto yy21; + case 'r': goto yy22; + case 's': goto yy23; + case 't': goto yy24; + case 'u': goto yy25; + case 'v': goto yy26; + case 'w': goto yy27; + case 'x': goto yy61; + case '{': goto yy29; + case '|': goto yy64; + case '}': goto yy35; + case '~': goto yy66; + default: goto yy92; + } +yy2: + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '.') { + if (yych == '*') goto yy998; + } else { + if (yych <= '/') goto yy996; + if (yych == '=') goto yy994; + } +#line 188 "cpp.re" + { BOOST_WAVE_RET(T_DIVIDE); } +#line 238 "cpp_re.inc" +yy4: + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '-') { + if (yych == '*') goto yy988; + } else { + if (yych <= '.') goto yy990; + if (yych <= '/') goto yy5; + if (yych <= '9') goto yy991; + } +yy5: +#line 174 "cpp.re" + { BOOST_WAVE_RET(T_DOT); } +#line 252 "cpp_re.inc" +yy6: + ++YYCURSOR; +yy7: +#line 45 "cpp.re" + { goto pp_number; } +#line 258 "cpp_re.inc" +yy8: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case 'l': goto yy964; + case 'n': goto yy965; + case 's': goto yy966; + case 'u': goto yy967; + default: goto yy109; + } +yy9: +#line 290 "cpp.re" + { BOOST_WAVE_RET(T_IDENTIFIER); } +#line 272 "cpp_re.inc" +yy10: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'n') { + if (yych == 'i') goto yy946; + goto yy109; + } else { + if (yych <= 'o') goto yy947; + if (yych == 'r') goto yy948; + goto yy109; + } +yy11: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case 'a': goto yy893; + case 'h': goto yy894; + case 'l': goto yy895; + case 'o': goto yy896; + default: goto yy109; + } +yy12: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'n') { + if (yych == 'e') goto yy855; + goto yy109; + } else { + if (yych <= 'o') goto yy856; + if (yych == 'y') goto yy858; + goto yy109; + } +yy13: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'm') { + if (yych == 'l') goto yy830; + goto yy109; + } else { + if (yych <= 'n') goto yy831; + if (yych == 'x') goto yy832; + goto yy109; + } +yy14: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case 'a': goto yy811; + case 'l': goto yy812; + case 'o': goto yy813; + case 'r': goto yy814; + default: goto yy109; + } +yy15: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'o') goto yy807; + goto yy109; +yy16: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'l') { + if (yych == 'f') goto yy791; + goto yy109; + } else { + if (yych <= 'm') goto yy793; + if (yych <= 'n') goto yy794; + goto yy109; + } +yy17: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'o') goto yy787; + goto yy109; +yy18: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'u') goto yy780; + goto yy109; +yy19: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'e') { + if (yych == 'a') goto yy747; + if (yych <= 'd') goto yy109; + goto yy748; + } else { + if (yych <= 'o') { + if (yych <= 'n') goto yy109; + goto yy749; + } else { + if (yych == 'u') goto yy750; + goto yy109; + } + } +yy20: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'p') goto yy733; + if (yych == 'r') goto yy734; + goto yy109; +yy21: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'r') goto yy712; + if (yych == 'u') goto yy713; + goto yy109; +yy22: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy684; + goto yy109; +yy23: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 's') { + if (yych <= 'g') goto yy109; + if (yych <= 'h') goto yy638; + if (yych <= 'i') goto yy639; + goto yy109; + } else { + if (yych <= 't') goto yy640; + if (yych == 'w') goto yy641; + goto yy109; + } +yy24: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'h') { + if (yych == 'e') goto yy591; + if (yych <= 'g') goto yy109; + goto yy592; + } else { + if (yych <= 'r') { + if (yych <= 'q') goto yy109; + goto yy593; + } else { + if (yych == 'y') goto yy594; + goto yy109; + } + } +yy25: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '8') { + if (yych <= '&') { + if (yych == '"') goto yy129; + goto yy109; + } else { + if (yych <= '\'') goto yy131; + if (yych <= '7') goto yy109; + goto yy573; + } + } else { + if (yych <= 'm') { + if (yych == 'R') goto yy128; + goto yy109; + } else { + if (yych <= 'n') goto yy574; + if (yych == 's') goto yy575; + goto yy109; + } + } +yy26: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy555; + if (yych == 'o') goto yy556; + goto yy109; +yy27: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'c') goto yy543; + if (yych == 'h') goto yy544; + goto yy109; +yy28: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '_': goto yy454; + case 'a': goto yy455; + case 'b': goto yy456; + case 'c': goto yy457; + case 'd': goto yy458; + case 'f': goto yy459; + case 'i': goto yy460; + case 's': goto yy461; + default: goto yy109; + } +yy29: + ++YYCURSOR; +#line 138 "cpp.re" + { BOOST_WAVE_RET(T_LEFTBRACE); } +#line 466 "cpp_re.inc" +yy31: + yyaccept = 2; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '?') goto yy419; +yy32: +#line 163 "cpp.re" + { BOOST_WAVE_RET(T_QUESTION_MARK); } +#line 474 "cpp_re.inc" +yy33: + ++YYCURSOR; + if ((yych = *YYCURSOR) <= ':') { + if (yych == '%') goto yy415; + if (yych >= ':') goto yy413; + } else { + if (yych <= ';') goto yy34; + if (yych <= '<') goto yy411; + if (yych <= '=') goto yy409; + } +yy34: +#line 204 "cpp.re" + { BOOST_WAVE_RET(T_LESS); } +#line 488 "cpp_re.inc" +yy35: + ++YYCURSOR; +#line 141 "cpp.re" + { BOOST_WAVE_RET(T_RIGHTBRACE); } +#line 493 "cpp_re.inc" +yy37: + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '<') { + if (yych == ':') goto yy400; + } else { + if (yych <= '=') goto yy402; + if (yych <= '>') goto yy404; + } +#line 189 "cpp.re" + { BOOST_WAVE_RET(T_PERCENT); } +#line 504 "cpp_re.inc" +yy39: + ++YYCURSOR; +#line 144 "cpp.re" + { BOOST_WAVE_RET(T_LEFTBRACKET); } +#line 509 "cpp_re.inc" +yy41: + ++YYCURSOR; +#line 147 "cpp.re" + { BOOST_WAVE_RET(T_RIGHTBRACKET); } +#line 514 "cpp_re.inc" +yy43: + ++YYCURSOR; + if ((yych = *YYCURSOR) == ':') goto yy396; + if (yych == '>') goto yy398; +#line 161 "cpp.re" + { BOOST_WAVE_RET(T_COLON); } +#line 521 "cpp_re.inc" +yy45: + yyaccept = 3; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'c') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych == '\t') goto yy273; + } else { + if (yych <= '\f') goto yy273; + if (yych >= ' ') goto yy273; + } + } else { + if (yych <= '.') { + if (yych == '#') goto yy284; + } else { + if (yych <= '/') goto yy273; + if (yych == '?') goto yy283; + } + } + } else { + if (yych <= 'p') { + if (yych <= 'i') { + if (yych <= 'e') goto yy273; + if (yych >= 'i') goto yy273; + } else { + if (yych == 'l') goto yy273; + if (yych >= 'p') goto yy273; + } + } else { + if (yych <= 't') { + if (yych == 'r') goto yy273; + } else { + if (yych == 'v') goto yy46; + if (yych <= 'w') goto yy273; + } + } + } +yy46: +#line 150 "cpp.re" + { BOOST_WAVE_RET(T_POUND); } +#line 562 "cpp_re.inc" +yy47: + ++YYCURSOR; +#line 158 "cpp.re" + { BOOST_WAVE_RET(T_LEFTPAREN); } +#line 567 "cpp_re.inc" +yy49: + ++YYCURSOR; +#line 159 "cpp.re" + { BOOST_WAVE_RET(T_RIGHTPAREN); } +#line 572 "cpp_re.inc" +yy51: + ++YYCURSOR; +#line 160 "cpp.re" + { BOOST_WAVE_RET(T_SEMICOLON); } +#line 577 "cpp_re.inc" +yy53: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '+') goto yy268; + if (yych == '=') goto yy270; +#line 185 "cpp.re" + { BOOST_WAVE_RET(T_PLUS); } +#line 584 "cpp_re.inc" +yy55: + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '<') { + if (yych == '-') goto yy262; + } else { + if (yych <= '=') goto yy264; + if (yych <= '>') goto yy260; + } +#line 186 "cpp.re" + { BOOST_WAVE_RET(T_MINUS); } +#line 595 "cpp_re.inc" +yy57: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy258; +#line 187 "cpp.re" + { BOOST_WAVE_RET(T_STAR); } +#line 601 "cpp_re.inc" +yy59: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy256; +#line 190 "cpp.re" + { BOOST_WAVE_RET(T_XOR); } +#line 607 "cpp_re.inc" +yy61: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'o') goto yy249; + goto yy109; +yy62: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '&') goto yy245; + if (yych == '=') goto yy247; +#line 193 "cpp.re" + { BOOST_WAVE_RET(T_AND); } +#line 619 "cpp_re.inc" +yy64: + yyaccept = 4; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '>') { + if (yych == '=') goto yy240; + } else { + if (yych <= '?') goto yy237; + if (yych == '|') goto yy238; + } +yy65: +#line 195 "cpp.re" + { BOOST_WAVE_RET(T_OR); } +#line 632 "cpp_re.inc" +yy66: + ++YYCURSOR; +#line 198 "cpp.re" + { BOOST_WAVE_RET(T_COMPL); } +#line 637 "cpp_re.inc" +yy68: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy235; +#line 201 "cpp.re" + { BOOST_WAVE_RET(T_NOT); } +#line 643 "cpp_re.inc" +yy70: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy233; +#line 203 "cpp.re" + { BOOST_WAVE_RET(T_ASSIGN); } +#line 649 "cpp_re.inc" +yy72: + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '<') goto yy73; + if (yych <= '=') goto yy227; + if (yych <= '>') goto yy229; +yy73: +#line 205 "cpp.re" + { BOOST_WAVE_RET(T_GREATER); } +#line 658 "cpp_re.inc" +yy74: + ++YYCURSOR; +#line 237 "cpp.re" + { BOOST_WAVE_RET(T_COMMA); } +#line 663 "cpp_re.inc" +yy76: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '?') { + if (yych <= '&') { + if (yych <= '"') { + if (yych <= '!') goto yy9; + goto yy137; + } else { + if (yych == '$') goto yy108; + goto yy9; + } + } else { + if (yych <= '/') { + if (yych <= '\'') goto yy226; + goto yy9; + } else { + if (yych <= '9') goto yy108; + if (yych <= '>') goto yy9; + goto yy111; + } + } + } else { + if (yych <= '[') { + if (yych <= 'Q') { + if (yych <= '@') goto yy9; + goto yy108; + } else { + if (yych <= 'R') goto yy225; + if (yych <= 'Z') goto yy108; + goto yy9; + } + } else { + if (yych <= '_') { + if (yych <= '\\') goto yy110; + if (yych <= '^') goto yy9; + goto yy108; + } else { + if (yych <= '`') goto yy9; + if (yych <= 'z') goto yy108; + goto yy9; + } + } + } +yy77: + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\f') { + if (yych == '\t') goto yy182; + if (yych >= '\v') goto yy182; + } else { + if (yych <= 0x1F) goto yy78; + if (yych != '\'') goto yy182; + } +yy78: +#line 339 "cpp.re" + { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); } +#line 721 "cpp_re.inc" +yy79: + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\n') { + if (yych == '\t') goto yy138; + goto yy78; + } else { + if (yych <= '\f') goto yy138; + if (yych <= 0x1F) goto yy78; + goto yy138; + } +yy80: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '"') goto yy135; + goto yy109; +yy81: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '&') { + if (yych == '"') goto yy129; + goto yy109; + } else { + if (yych <= '\'') goto yy131; + if (yych == 'R') goto yy128; + goto yy109; + } +yy82: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + goto yy109; +yy83: + yyaccept = 5; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'U') goto yy100; + if (yych == 'u') goto yy98; + goto yy78; +yy84: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy97; +yy85: +#line 319 "cpp.re" + { BOOST_WAVE_RET(T_SPACE); } +#line 766 "cpp_re.inc" +yy86: + yych = *++YYCURSOR; + goto yy97; +yy87: + ++YYCURSOR; +yy88: +#line 322 "cpp.re" + { + s->line++; + cursor.column = 1; + BOOST_WAVE_RET(T_NEWLINE); + } +#line 779 "cpp_re.inc" +yy89: + yych = *++YYCURSOR; + if (yych == '\n') goto yy95; + goto yy88; +yy90: + ++YYCURSOR; +#line 329 "cpp.re" + { + if (s->eof && cursor != s->eof) + { + BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor + (*s->error_proc)(s, lexing_exception::generic_lexing_error, + "invalid character '\\000' in input stream"); + } + BOOST_WAVE_RET(T_EOF); + } +#line 796 "cpp_re.inc" +yy92: + yych = *++YYCURSOR; + goto yy78; +yy93: + ++YYCURSOR; +#line 342 "cpp.re" + { + // flag the error + BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor + (*s->error_proc)(s, lexing_exception::generic_lexing_error, + "invalid character '\\%03o' in input stream", *--YYCURSOR); + } +#line 809 "cpp_re.inc" +yy95: + yych = *++YYCURSOR; + goto yy88; +yy96: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy97: + if (yybm[256+yych] & 16) { + goto yy96; + } + goto yy85; +yy98: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy125; + } else { + if (yych <= 'F') goto yy125; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy125; + } +yy99: + YYCURSOR = YYMARKER; + if (yyaccept <= 56) { + if (yyaccept <= 28) { + if (yyaccept <= 14) { + if (yyaccept <= 7) { + if (yyaccept <= 3) { + if (yyaccept <= 1) { + if (yyaccept <= 0) { + goto yy5; + } else { + goto yy9; + } + } else { + if (yyaccept <= 2) { + goto yy32; + } else { + goto yy46; + } + } + } else { + if (yyaccept <= 5) { + if (yyaccept <= 4) { + goto yy65; + } else { + goto yy78; + } + } else { + if (yyaccept <= 6) { + goto yy142; + } else { + goto yy192; + } + } + } + } else { + if (yyaccept <= 11) { + if (yyaccept <= 9) { + if (yyaccept <= 8) { + goto yy251; + } else { + goto yy255; + } + } else { + if (yyaccept <= 10) { + goto yy291; + } else { + goto yy306; + } + } + } else { + if (yyaccept <= 13) { + if (yyaccept <= 12) { + goto yy401; + } else { + goto yy429; + } + } else { + goto yy433; + } + } + } + } else { + if (yyaccept <= 21) { + if (yyaccept <= 18) { + if (yyaccept <= 16) { + if (yyaccept <= 15) { + goto yy437; + } else { + goto yy468; + } + } else { + if (yyaccept <= 17) { + goto yy474; + } else { + goto yy482; + } + } + } else { + if (yyaccept <= 20) { + if (yyaccept <= 19) { + goto yy490; + } else { + goto yy495; + } + } else { + goto yy500; + } + } + } else { + if (yyaccept <= 25) { + if (yyaccept <= 23) { + if (yyaccept <= 22) { + goto yy503; + } else { + goto yy513; + } + } else { + if (yyaccept <= 24) { + goto yy519; + } else { + goto yy522; + } + } + } else { + if (yyaccept <= 27) { + if (yyaccept <= 26) { + goto yy529; + } else { + goto yy536; + } + } else { + goto yy538; + } + } + } + } + } else { + if (yyaccept <= 42) { + if (yyaccept <= 35) { + if (yyaccept <= 32) { + if (yyaccept <= 30) { + if (yyaccept <= 29) { + goto yy540; + } else { + goto yy542; + } + } else { + if (yyaccept <= 31) { + goto yy548; + } else { + goto yy554; + } + } + } else { + if (yyaccept <= 34) { + if (yyaccept <= 33) { + goto yy564; + } else { + goto yy566; + } + } else { + goto yy572; + } + } + } else { + if (yyaccept <= 39) { + if (yyaccept <= 37) { + if (yyaccept <= 36) { + goto yy579; + } else { + goto yy587; + } + } else { + if (yyaccept <= 38) { + goto yy590; + } else { + goto yy603; + } + } + } else { + if (yyaccept <= 41) { + if (yyaccept <= 40) { + goto yy605; + } else { + goto yy608; + } + } else { + goto yy611; + } + } + } + } else { + if (yyaccept <= 49) { + if (yyaccept <= 46) { + if (yyaccept <= 44) { + if (yyaccept <= 43) { + goto yy613; + } else { + goto yy619; + } + } else { + if (yyaccept <= 45) { + goto yy628; + } else { + goto yy630; + } + } + } else { + if (yyaccept <= 48) { + if (yyaccept <= 47) { + goto yy637; + } else { + goto yy646; + } + } else { + goto yy652; + } + } + } else { + if (yyaccept <= 53) { + if (yyaccept <= 51) { + if (yyaccept <= 50) { + goto yy656; + } else { + goto yy663; + } + } else { + if (yyaccept <= 52) { + goto yy669; + } else { + goto yy675; + } + } + } else { + if (yyaccept <= 55) { + if (yyaccept <= 54) { + goto yy679; + } else { + goto yy683; + } + } else { + goto yy691; + } + } + } + } + } + } else { + if (yyaccept <= 85) { + if (yyaccept <= 71) { + if (yyaccept <= 64) { + if (yyaccept <= 60) { + if (yyaccept <= 58) { + if (yyaccept <= 57) { + goto yy705; + } else { + goto yy711; + } + } else { + if (yyaccept <= 59) { + goto yy718; + } else { + goto yy727; + } + } + } else { + if (yyaccept <= 62) { + if (yyaccept <= 61) { + goto yy732; + } else { + goto yy735; + } + } else { + if (yyaccept <= 63) { + goto yy739; + } else { + goto yy746; + } + } + } + } else { + if (yyaccept <= 68) { + if (yyaccept <= 66) { + if (yyaccept <= 65) { + goto yy756; + } else { + goto yy759; + } + } else { + if (yyaccept <= 67) { + goto yy763; + } else { + goto yy769; + } + } + } else { + if (yyaccept <= 70) { + if (yyaccept <= 69) { + goto yy771; + } else { + goto yy779; + } + } else { + goto yy786; + } + } + } + } else { + if (yyaccept <= 78) { + if (yyaccept <= 75) { + if (yyaccept <= 73) { + if (yyaccept <= 72) { + goto yy790; + } else { + goto yy792; + } + } else { + if (yyaccept <= 74) { + goto yy797; + } else { + goto yy801; + } + } + } else { + if (yyaccept <= 77) { + if (yyaccept <= 76) { + goto yy806; + } else { + goto yy810; + } + } else { + goto yy819; + } + } + } else { + if (yyaccept <= 82) { + if (yyaccept <= 80) { + if (yyaccept <= 79) { + goto yy821; + } else { + goto yy825; + } + } else { + if (yyaccept <= 81) { + goto yy829; + } else { + goto yy838; + } + } + } else { + if (yyaccept <= 84) { + if (yyaccept <= 83) { + goto yy843; + } else { + goto yy848; + } + } else { + goto yy851; + } + } + } + } + } else { + if (yyaccept <= 99) { + if (yyaccept <= 92) { + if (yyaccept <= 89) { + if (yyaccept <= 87) { + if (yyaccept <= 86) { + goto yy854; + } else { + goto yy857; + } + } else { + if (yyaccept <= 88) { + goto yy869; + } else { + goto yy874; + } + } + } else { + if (yyaccept <= 91) { + if (yyaccept <= 90) { + goto yy881; + } else { + goto yy886; + } + } else { + goto yy892; + } + } + } else { + if (yyaccept <= 96) { + if (yyaccept <= 94) { + if (yyaccept <= 93) { + goto yy901; + } else { + goto yy908; + } + } else { + if (yyaccept <= 95) { + goto yy910; + } else { + goto yy916; + } + } + } else { + if (yyaccept <= 98) { + if (yyaccept <= 97) { + goto yy921; + } else { + goto yy925; + } + } else { + goto yy928; + } + } + } + } else { + if (yyaccept <= 106) { + if (yyaccept <= 103) { + if (yyaccept <= 101) { + if (yyaccept <= 100) { + goto yy934; + } else { + goto yy938; + } + } else { + if (yyaccept <= 102) { + goto yy943; + } else { + goto yy945; + } + } + } else { + if (yyaccept <= 105) { + if (yyaccept <= 104) { + goto yy952; + } else { + goto yy955; + } + } else { + goto yy960; + } + } + } else { + if (yyaccept <= 110) { + if (yyaccept <= 108) { + if (yyaccept <= 107) { + goto yy963; + } else { + goto yy970; + } + } else { + if (yyaccept <= 109) { + goto yy972; + } else { + goto yy974; + } + } + } else { + if (yyaccept <= 112) { + if (yyaccept <= 111) { + goto yy978; + } else { + goto yy985; + } + } else { + goto yy987; + } + } + } + } + } + } +yy100: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy101; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy101: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy102; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy102: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy103; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy103: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy104; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy104: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy105; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy105: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy106; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy106: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy107; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy107: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy108; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy108: + yyaccept = 1; + YYMARKER = ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy109: + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych != '\\') goto yy9; +yy110: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == 'U') goto yy114; + if (yych == 'u') goto yy113; + goto yy99; +yy111: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych != '?') goto yy99; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '/') goto yy110; + goto yy99; +yy113: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy122; + goto yy99; + } else { + if (yych <= 'F') goto yy122; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy122; + goto yy99; + } +yy114: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy115; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy115: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy116; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy116: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy117; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy117: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy118; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy118: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy119; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy119: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy120; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy120: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy121; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy121: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy108; + goto yy99; + } else { + if (yych <= 'F') goto yy108; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy108; + goto yy99; + } +yy122: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy123; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy123: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy124; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy124: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy108; + goto yy99; + } else { + if (yych <= 'F') goto yy108; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy108; + goto yy99; + } +yy125: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy126; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy126: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy127; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy127: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy108; + goto yy99; + } else { + if (yych <= 'F') goto yy108; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy108; + goto yy99; + } +yy128: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '"') goto yy133; + goto yy109; +yy129: + ++YYCURSOR; +#line 274 "cpp.re" + { + if (s->act_in_cpp0x_mode) + goto extstringlit; + --YYCURSOR; + BOOST_WAVE_RET(T_IDENTIFIER); + } +#line 1591 "cpp_re.inc" +yy131: + ++YYCURSOR; +#line 266 "cpp.re" + { + if (s->act_in_cpp0x_mode) + goto extcharlit; + --YYCURSOR; + BOOST_WAVE_RET(T_IDENTIFIER); + } +#line 1601 "cpp_re.inc" +yy133: + ++YYCURSOR; +#line 282 "cpp.re" + { + if (s->act_in_cpp0x_mode) + goto extrawstringlit; + --YYCURSOR; + BOOST_WAVE_RET(T_IDENTIFIER); + } +#line 1611 "cpp_re.inc" +yy135: + ++YYCURSOR; +#line 258 "cpp.re" + { + if (s->act_in_cpp0x_mode) + goto extrawstringlit; + --YYCURSOR; + BOOST_WAVE_RET(T_IDENTIFIER); + } +#line 1621 "cpp_re.inc" +yy137: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy138: + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy99; + if (yych <= '"') goto yy141; + if (yych >= '\\') goto yy140; +yy139: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy99; + if (yych <= '"') goto yy141; + if (yych <= '[') goto yy152; +yy140: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '`') { + if (yych <= '7') { + if (yych <= '&') { + if (yych == '"') goto yy137; + goto yy99; + } else { + if (yych <= '\'') goto yy137; + if (yych <= '/') goto yy99; + goto yy147; + } + } else { + if (yych <= 'T') { + if (yych == '?') goto yy145; + goto yy99; + } else { + if (yych <= 'U') goto yy144; + if (yych == '\\') goto yy137; + goto yy99; + } + } + } else { + if (yych <= 'r') { + if (yych <= 'f') { + if (yych <= 'b') goto yy137; + if (yych <= 'e') goto yy99; + goto yy137; + } else { + if (yych == 'n') goto yy137; + if (yych <= 'q') goto yy99; + goto yy137; + } + } else { + if (yych <= 'u') { + if (yych <= 's') goto yy99; + if (yych <= 't') goto yy137; + goto yy143; + } else { + if (yych <= 'v') goto yy137; + if (yych == 'x') goto yy146; + goto yy99; + } + } + } +yy141: + ++YYCURSOR; +yy142: +#line 255 "cpp.re" + { BOOST_WAVE_RET(T_STRINGLIT); } +#line 1695 "cpp_re.inc" +yy143: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy178; + goto yy99; + } else { + if (yych <= 'F') goto yy178; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy178; + goto yy99; + } +yy144: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy171; + goto yy99; + } else { + if (yych <= 'F') goto yy171; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy171; + goto yy99; + } +yy145: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy99; + if (yych <= '"') goto yy141; + if (yych <= '[') goto yy151; + goto yy140; +yy146: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 128) { + goto yy149; + } + goto yy99; +yy147: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '"') { + if (yych <= '\n') { + if (yych == '\t') goto yy137; + goto yy99; + } else { + if (yych <= '\f') goto yy137; + if (yych <= 0x1F) goto yy99; + if (yych <= '!') goto yy137; + goto yy141; + } + } else { + if (yych <= '>') { + if (yych <= '/') goto yy137; + if (yych >= '8') goto yy137; + } else { + if (yych <= '?') goto yy139; + if (yych == '\\') goto yy140; + goto yy137; + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy99; + if (yych <= '"') goto yy141; + if (yych <= '[') goto yy139; + goto yy140; +yy149: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 128) { + goto yy149; + } + if (yych <= '!') { + if (yych <= '\n') { + if (yych == '\t') goto yy137; + goto yy99; + } else { + if (yych <= '\f') goto yy137; + if (yych <= 0x1F) goto yy99; + goto yy137; + } + } else { + if (yych <= '?') { + if (yych <= '"') goto yy141; + if (yych <= '>') goto yy137; + goto yy139; + } else { + if (yych == '\\') goto yy140; + goto yy137; + } + } +yy151: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy99; + if (yych <= '"') goto yy141; + if (yych >= '\\') goto yy140; +yy152: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 1) { + goto yy152; + } + if (yych <= '!') { + if (yych <= '\n') { + if (yych == '\t') goto yy137; + goto yy99; + } else { + if (yych <= '\f') goto yy137; + if (yych <= 0x1F) goto yy99; + goto yy137; + } + } else { + if (yych <= '/') { + if (yych <= '"') goto yy141; + if (yych <= '.') goto yy137; + } else { + if (yych == '\\') goto yy140; + goto yy137; + } + } +yy154: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 2) { + goto yy154; + } + if (yych <= '7') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy158; + if (yych <= '/') goto yy137; + goto yy147; + } + } + } else { + if (yych <= 'U') { + if (yych == '?') goto yy159; + if (yych <= 'T') goto yy137; + goto yy157; + } else { + if (yych <= 'u') { + if (yych <= 't') goto yy137; + } else { + if (yych == 'x') goto yy149; + goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + goto yy168; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + goto yy168; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych <= 'f') goto yy168; + goto yy137; + } + } + } +yy157: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + goto yy161; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + goto yy161; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych <= 'f') goto yy161; + goto yy137; + } + } + } +yy158: + yyaccept = 6; + YYMARKER = ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy142; + if (yych <= '"') goto yy141; + if (yych <= '[') goto yy139; + goto yy140; +yy159: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy99; + if (yych <= '"') goto yy141; + if (yych >= '\\') goto yy140; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 1) { + goto yy152; + } + if (yych <= '!') { + if (yych <= '\n') { + if (yych == '\t') goto yy137; + goto yy99; + } else { + if (yych <= '\f') goto yy137; + if (yych <= 0x1F) goto yy99; + goto yy137; + } + } else { + if (yych <= '/') { + if (yych <= '"') goto yy141; + if (yych <= '.') goto yy137; + goto yy154; + } else { + if (yych == '\\') goto yy140; + goto yy137; + } + } +yy161: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych >= 'g') goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych >= 'g') goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych >= 'g') goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych >= 'g') goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych >= 'g') goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych >= 'g') goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy99; + if (yych <= '"') goto yy141; + if (yych <= '[') goto yy139; + goto yy140; +yy168: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych >= 'g') goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy137; + if (yych <= '\n') goto yy99; + goto yy137; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy99; + goto yy137; + } else { + if (yych <= '"') goto yy141; + if (yych <= '/') goto yy137; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy139; + if (yych <= '@') goto yy137; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy137; + goto yy140; + } else { + if (yych <= '`') goto yy137; + if (yych >= 'g') goto yy137; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[256+yych] & 64) { + goto yy137; + } + if (yych <= '!') goto yy99; + if (yych <= '"') goto yy141; + if (yych <= '[') goto yy139; + goto yy140; +yy171: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy172; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy172: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy173; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy173: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy174; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy174: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy175; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy175: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy176; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy176: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy177; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy177: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy137; + goto yy99; + } else { + if (yych <= 'F') goto yy137; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy137; + goto yy99; + } +yy178: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy179; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy179: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy180; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy180: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy137; + goto yy99; + } else { + if (yych <= 'F') goto yy137; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy137; + goto yy99; + } +yy181: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy182: + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy99; + if (yych <= '\'') goto yy191; + if (yych >= '\\') goto yy184; +yy183: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy99; + if (yych <= '\'') goto yy191; + if (yych <= '[') goto yy196; +yy184: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '`') { + if (yych <= '7') { + if (yych <= '&') { + if (yych == '"') goto yy181; + goto yy99; + } else { + if (yych <= '\'') goto yy181; + if (yych <= '/') goto yy99; + goto yy189; + } + } else { + if (yych <= 'T') { + if (yych == '?') goto yy187; + goto yy99; + } else { + if (yych <= 'U') goto yy186; + if (yych == '\\') goto yy181; + goto yy99; + } + } + } else { + if (yych <= 'r') { + if (yych <= 'f') { + if (yych <= 'b') goto yy181; + if (yych <= 'e') goto yy99; + goto yy181; + } else { + if (yych == 'n') goto yy181; + if (yych <= 'q') goto yy99; + goto yy181; + } + } else { + if (yych <= 'u') { + if (yych <= 's') goto yy99; + if (yych <= 't') goto yy181; + } else { + if (yych <= 'v') goto yy181; + if (yych == 'x') goto yy188; + goto yy99; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy222; + goto yy99; + } else { + if (yych <= 'F') goto yy222; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy222; + goto yy99; + } +yy186: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy215; + goto yy99; + } else { + if (yych <= 'F') goto yy215; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy215; + goto yy99; + } +yy187: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy99; + if (yych <= '\'') goto yy191; + if (yych <= '[') goto yy195; + goto yy184; +yy188: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy193; + goto yy99; + } else { + if (yych <= 'F') goto yy193; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy193; + goto yy99; + } +yy189: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\'') { + if (yych <= '\n') { + if (yych == '\t') goto yy181; + goto yy99; + } else { + if (yych <= '\f') goto yy181; + if (yych <= 0x1F) goto yy99; + if (yych <= '&') goto yy181; + goto yy191; + } + } else { + if (yych <= '>') { + if (yych <= '/') goto yy181; + if (yych >= '8') goto yy181; + } else { + if (yych <= '?') goto yy183; + if (yych == '\\') goto yy184; + goto yy181; + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy99; + if (yych <= '\'') goto yy191; + if (yych <= '[') goto yy183; + goto yy184; +yy191: + ++YYCURSOR; +yy192: +#line 252 "cpp.re" + { BOOST_WAVE_RET(T_CHARLIT); } +#line 2542 "cpp_re.inc" +yy193: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + goto yy193; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + goto yy193; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych <= 'f') goto yy193; + goto yy181; + } + } + } +yy195: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy99; + if (yych <= '\'') goto yy191; + if (yych >= '\\') goto yy184; +yy196: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\'') { + if (yych <= '\n') { + if (yych == '\t') goto yy181; + goto yy99; + } else { + if (yych <= '\f') goto yy181; + if (yych <= 0x1F) goto yy99; + if (yych <= '&') goto yy181; + goto yy191; + } + } else { + if (yych <= '>') { + if (yych != '/') goto yy181; + } else { + if (yych <= '?') goto yy196; + if (yych == '\\') goto yy184; + goto yy181; + } + } +yy198: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '>') { + if (yych <= 0x1F) { + if (yych <= '\t') { + if (yych <= 0x08) goto yy99; + goto yy181; + } else { + if (yych <= '\n') goto yy99; + if (yych <= '\f') goto yy181; + goto yy99; + } + } else { + if (yych <= '\'') { + if (yych <= '&') goto yy181; + goto yy202; + } else { + if (yych <= '/') goto yy181; + if (yych <= '7') goto yy189; + goto yy181; + } + } + } else { + if (yych <= '\\') { + if (yych <= 'T') { + if (yych <= '?') goto yy203; + goto yy181; + } else { + if (yych <= 'U') goto yy201; + if (yych <= '[') goto yy181; + goto yy198; + } + } else { + if (yych <= 'u') { + if (yych <= 't') goto yy181; + } else { + if (yych == 'x') goto yy193; + goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + goto yy212; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + goto yy212; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych <= 'f') goto yy212; + goto yy181; + } + } + } +yy201: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + goto yy205; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + goto yy205; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych <= 'f') goto yy205; + goto yy181; + } + } + } +yy202: + yyaccept = 7; + YYMARKER = ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy192; + if (yych <= '\'') goto yy191; + if (yych <= '[') goto yy183; + goto yy184; +yy203: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy99; + if (yych <= '\'') goto yy191; + if (yych >= '\\') goto yy184; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\'') { + if (yych <= '\n') { + if (yych == '\t') goto yy181; + goto yy99; + } else { + if (yych <= '\f') goto yy181; + if (yych <= 0x1F) goto yy99; + if (yych <= '&') goto yy181; + goto yy191; + } + } else { + if (yych <= '>') { + if (yych == '/') goto yy198; + goto yy181; + } else { + if (yych <= '?') goto yy196; + if (yych == '\\') goto yy184; + goto yy181; + } + } +yy205: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych >= 'g') goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych >= 'g') goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych >= 'g') goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych >= 'g') goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych >= 'g') goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych >= 'g') goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy99; + if (yych <= '\'') goto yy191; + if (yych <= '[') goto yy183; + goto yy184; +yy212: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych >= 'g') goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy181; + if (yych <= '\n') goto yy99; + goto yy181; + } else { + if (yych <= '&') { + if (yych <= 0x1F) goto yy99; + goto yy181; + } else { + if (yych <= '\'') goto yy191; + if (yych <= '/') goto yy181; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy183; + if (yych <= '@') goto yy181; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy181; + goto yy184; + } else { + if (yych <= '`') goto yy181; + if (yych >= 'g') goto yy181; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 4) { + goto yy181; + } + if (yych <= '&') goto yy99; + if (yych <= '\'') goto yy191; + if (yych <= '[') goto yy183; + goto yy184; +yy215: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy216; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy216: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy217; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy217: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy218; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy218: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy219; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy219: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy220; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy220: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy221; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy221: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy181; + goto yy99; + } else { + if (yych <= 'F') goto yy181; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy181; + goto yy99; + } +yy222: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy223; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy223: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych >= ':') goto yy99; + } else { + if (yych <= 'F') goto yy224; + if (yych <= '`') goto yy99; + if (yych >= 'g') goto yy99; + } +yy224: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy99; + if (yych <= '9') goto yy181; + goto yy99; + } else { + if (yych <= 'F') goto yy181; + if (yych <= '`') goto yy99; + if (yych <= 'f') goto yy181; + goto yy99; + } +yy225: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '"') goto yy135; + goto yy109; +yy226: + yych = *++YYCURSOR; + if (yych == '\'') goto yy99; + goto yy182; +yy227: + ++YYCURSOR; +#line 227 "cpp.re" + { BOOST_WAVE_RET(T_GREATEREQUAL); } +#line 3175 "cpp_re.inc" +yy229: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy231; +#line 220 "cpp.re" + { BOOST_WAVE_RET(T_SHIFTRIGHT); } +#line 3181 "cpp_re.inc" +yy231: + ++YYCURSOR; +#line 221 "cpp.re" + { BOOST_WAVE_RET(T_SHIFTRIGHTASSIGN); } +#line 3186 "cpp_re.inc" +yy233: + ++YYCURSOR; +#line 223 "cpp.re" + { BOOST_WAVE_RET(T_EQUAL); } +#line 3191 "cpp_re.inc" +yy235: + ++YYCURSOR; +#line 224 "cpp.re" + { BOOST_WAVE_RET(T_NOTEQUAL); } +#line 3196 "cpp_re.inc" +yy237: + yych = *++YYCURSOR; + if (yych == '?') goto yy242; + goto yy99; +yy238: + ++YYCURSOR; +#line 230 "cpp.re" + { BOOST_WAVE_RET(T_OROR); } +#line 3205 "cpp_re.inc" +yy240: + ++YYCURSOR; +#line 216 "cpp.re" + { BOOST_WAVE_RET(T_ORASSIGN); } +#line 3210 "cpp_re.inc" +yy242: + yych = *++YYCURSOR; + if (yych != '!') goto yy99; + ++YYCURSOR; +#line 232 "cpp.re" + { BOOST_WAVE_RET(T_OROR_TRIGRAPH); } +#line 3217 "cpp_re.inc" +yy245: + ++YYCURSOR; +#line 228 "cpp.re" + { BOOST_WAVE_RET(T_ANDAND); } +#line 3222 "cpp_re.inc" +yy247: + ++YYCURSOR; +#line 214 "cpp.re" + { BOOST_WAVE_RET(T_ANDASSIGN); } +#line 3227 "cpp_re.inc" +yy249: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 8; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '@') { + if (yych <= '/') { + if (yych == '$') goto yy108; + } else { + if (yych <= '9') goto yy108; + if (yych == '?') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= 'Z') goto yy108; + if (yych == '\\') goto yy110; + } else { + if (yych <= '_') goto yy252; + if (yych <= '`') goto yy251; + if (yych <= 'z') goto yy108; + } + } +yy251: +#line 192 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XOR_ALT); } +#line 3254 "cpp_re.inc" +yy252: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'q') goto yy109; + yyaccept = 9; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy255: +#line 212 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XORASSIGN_ALT); } +#line 3272 "cpp_re.inc" +yy256: + ++YYCURSOR; +#line 211 "cpp.re" + { BOOST_WAVE_RET(T_XORASSIGN); } +#line 3277 "cpp_re.inc" +yy258: + ++YYCURSOR; +#line 208 "cpp.re" + { BOOST_WAVE_RET(T_STARASSIGN); } +#line 3282 "cpp_re.inc" +yy260: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '*') goto yy266; +#line 248 "cpp.re" + { BOOST_WAVE_RET(T_ARROW); } +#line 3288 "cpp_re.inc" +yy262: + ++YYCURSOR; +#line 236 "cpp.re" + { BOOST_WAVE_RET(T_MINUSMINUS); } +#line 3293 "cpp_re.inc" +yy264: + ++YYCURSOR; +#line 207 "cpp.re" + { BOOST_WAVE_RET(T_MINUSASSIGN); } +#line 3298 "cpp_re.inc" +yy266: + ++YYCURSOR; +#line 239 "cpp.re" + { + if (s->act_in_c99_mode) { + --YYCURSOR; + BOOST_WAVE_RET(T_ARROW); + } + else { + BOOST_WAVE_RET(T_ARROWSTAR); + } + } +#line 3311 "cpp_re.inc" +yy268: + ++YYCURSOR; +#line 235 "cpp.re" + { BOOST_WAVE_RET(T_PLUSPLUS); } +#line 3316 "cpp_re.inc" +yy270: + ++YYCURSOR; +#line 206 "cpp.re" + { BOOST_WAVE_RET(T_PLUSASSIGN); } +#line 3321 "cpp_re.inc" +yy272: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 12) YYFILL(12); + yych = *YYCURSOR; +yy273: + if (yych <= 'h') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych == '\t') goto yy272; + goto yy99; + } else { + if (yych <= '\f') goto yy272; + if (yych <= 0x1F) goto yy99; + goto yy272; + } + } else { + if (yych <= 'c') { + if (yych != '/') goto yy99; + } else { + if (yych <= 'd') goto yy281; + if (yych <= 'e') goto yy275; + goto yy99; + } + } + } else { + if (yych <= 'q') { + if (yych <= 'l') { + if (yych <= 'i') goto yy282; + if (yych <= 'k') goto yy99; + goto yy279; + } else { + if (yych == 'p') goto yy278; + goto yy99; + } + } else { + if (yych <= 'u') { + if (yych <= 'r') goto yy276; + if (yych <= 't') goto yy99; + goto yy280; + } else { + if (yych == 'w') goto yy277; + goto yy99; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '*') goto yy389; + goto yy99; +yy275: + yych = *++YYCURSOR; + if (yych <= 'm') { + if (yych == 'l') goto yy365; + goto yy99; + } else { + if (yych <= 'n') goto yy366; + if (yych == 'r') goto yy367; + goto yy99; + } +yy276: + yych = *++YYCURSOR; + if (yych == 'e') goto yy359; + goto yy99; +yy277: + yych = *++YYCURSOR; + if (yych == 'a') goto yy352; + goto yy99; +yy278: + yych = *++YYCURSOR; + if (yych == 'r') goto yy346; + goto yy99; +yy279: + yych = *++YYCURSOR; + if (yych == 'i') goto yy342; + goto yy99; +yy280: + yych = *++YYCURSOR; + if (yych == 'n') goto yy337; + goto yy99; +yy281: + yych = *++YYCURSOR; + if (yych == 'e') goto yy331; + goto yy99; +yy282: + yych = *++YYCURSOR; + if (yych == 'f') goto yy290; + if (yych == 'n') goto yy289; + goto yy99; +yy283: + yych = *++YYCURSOR; + if (yych == '?') goto yy286; + goto yy99; +yy284: + ++YYCURSOR; +#line 153 "cpp.re" + { BOOST_WAVE_RET(T_POUND_POUND); } +#line 3419 "cpp_re.inc" +yy286: + yych = *++YYCURSOR; + if (yych != '=') goto yy99; + ++YYCURSOR; +#line 154 "cpp.re" + { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); } +#line 3426 "cpp_re.inc" +yy289: + yych = *++YYCURSOR; + if (yych == 'c') goto yy301; + goto yy99; +yy290: + yyaccept = 10; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'd') goto yy293; + if (yych == 'n') goto yy292; +yy291: +#line 301 "cpp.re" + { BOOST_WAVE_RET(T_PP_IF); } +#line 3439 "cpp_re.inc" +yy292: + yych = *++YYCURSOR; + if (yych == 'd') goto yy297; + goto yy99; +yy293: + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + yych = *++YYCURSOR; + if (yych != 'f') goto yy99; + ++YYCURSOR; +#line 302 "cpp.re" + { BOOST_WAVE_RET(T_PP_IFDEF); } +#line 3452 "cpp_re.inc" +yy297: + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + yych = *++YYCURSOR; + if (yych != 'f') goto yy99; + ++YYCURSOR; +#line 303 "cpp.re" + { BOOST_WAVE_RET(T_PP_IFNDEF); } +#line 3461 "cpp_re.inc" +yy301: + yych = *++YYCURSOR; + if (yych != 'l') goto yy99; + yych = *++YYCURSOR; + if (yych != 'u') goto yy99; + yych = *++YYCURSOR; + if (yych != 'd') goto yy99; + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + yyaccept = 11; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '_') goto yy307; + goto yy309; +yy306: +#line 299 "cpp.re" + { BOOST_WAVE_RET(T_PP_INCLUDE); } +#line 3478 "cpp_re.inc" +yy307: + yych = *++YYCURSOR; + if (yych == 'n') goto yy328; + goto yy99; +yy308: + yyaccept = 11; + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy309: + if (yych <= ' ') { + if (yych <= '\n') { + if (yych == '\t') goto yy308; + goto yy306; + } else { + if (yych <= '\f') goto yy308; + if (yych <= 0x1F) goto yy306; + goto yy308; + } + } else { + if (yych <= '.') { + if (yych == '"') goto yy312; + goto yy306; + } else { + if (yych <= '/') goto yy310; + if (yych == '<') goto yy311; + goto yy306; + } + } +yy310: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '*') goto yy321; + goto yy99; +yy311: + yych = *++YYCURSOR; + if (yych == '>') goto yy99; + goto yy318; +yy312: + yych = *++YYCURSOR; + if (yych == '"') goto yy99; + goto yy314; +yy313: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy314: + if (yybm[0+yych] & 8) { + goto yy313; + } + if (yych <= '!') goto yy99; + ++YYCURSOR; +#line 296 "cpp.re" + { BOOST_WAVE_RET(T_PP_QHEADER); } +#line 3534 "cpp_re.inc" +yy317: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy318: + if (yybm[0+yych] & 16) { + goto yy317; + } + if (yych <= '=') goto yy99; + ++YYCURSOR; +#line 293 "cpp.re" + { BOOST_WAVE_RET(T_PP_HHEADER); } +#line 3547 "cpp_re.inc" +yy321: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy321; + } + if (yych == '\r') goto yy323; + if (yych <= ')') goto yy99; + goto yy325; +yy323: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy321; + } + if (yych == '\r') goto yy323; + if (yych <= ')') goto yy99; +yy325: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy325; + } + if (yych <= '\r') { + if (yych <= 0x08) goto yy99; + if (yych <= '\f') goto yy321; + } else { + if (yych <= 0x1F) goto yy99; + if (yych == '/') goto yy308; + goto yy321; + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy321; + } + if (yych == '\r') goto yy323; + if (yych <= ')') goto yy99; + goto yy325; +yy328: + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + yych = *++YYCURSOR; + if (yych != 'x') goto yy99; + yych = *++YYCURSOR; + if (yych == 't') goto yy308; + goto yy99; +yy331: + yych = *++YYCURSOR; + if (yych != 'f') goto yy99; + yych = *++YYCURSOR; + if (yych != 'i') goto yy99; + yych = *++YYCURSOR; + if (yych != 'n') goto yy99; + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + ++YYCURSOR; +#line 307 "cpp.re" + { BOOST_WAVE_RET(T_PP_DEFINE); } +#line 3611 "cpp_re.inc" +yy337: + yych = *++YYCURSOR; + if (yych != 'd') goto yy99; + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + yych = *++YYCURSOR; + if (yych != 'f') goto yy99; + ++YYCURSOR; +#line 308 "cpp.re" + { BOOST_WAVE_RET(T_PP_UNDEF); } +#line 3622 "cpp_re.inc" +yy342: + yych = *++YYCURSOR; + if (yych != 'n') goto yy99; + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + ++YYCURSOR; +#line 309 "cpp.re" + { BOOST_WAVE_RET(T_PP_LINE); } +#line 3631 "cpp_re.inc" +yy346: + yych = *++YYCURSOR; + if (yych != 'a') goto yy99; + yych = *++YYCURSOR; + if (yych != 'g') goto yy99; + yych = *++YYCURSOR; + if (yych != 'm') goto yy99; + yych = *++YYCURSOR; + if (yych != 'a') goto yy99; + ++YYCURSOR; +#line 311 "cpp.re" + { BOOST_WAVE_RET(T_PP_PRAGMA); } +#line 3644 "cpp_re.inc" +yy352: + yych = *++YYCURSOR; + if (yych != 'r') goto yy99; + yych = *++YYCURSOR; + if (yych != 'n') goto yy99; + yych = *++YYCURSOR; + if (yych != 'i') goto yy99; + yych = *++YYCURSOR; + if (yych != 'n') goto yy99; + yych = *++YYCURSOR; + if (yych != 'g') goto yy99; + ++YYCURSOR; +#line 313 "cpp.re" + { BOOST_WAVE_RET(T_PP_WARNING); } +#line 3659 "cpp_re.inc" +yy359: + yych = *++YYCURSOR; + if (yych != 'g') goto yy99; + yych = *++YYCURSOR; + if (yych != 'i') goto yy99; + yych = *++YYCURSOR; + if (yych != 'o') goto yy99; + yych = *++YYCURSOR; + if (yych != 'n') goto yy99; + ++YYCURSOR; +#line 315 "cpp.re" + { BOOST_WAVE_RET(T_MSEXT_PP_REGION); } +#line 3672 "cpp_re.inc" +yy365: + yych = *++YYCURSOR; + if (yych == 'i') goto yy383; + if (yych == 's') goto yy384; + goto yy99; +yy366: + yych = *++YYCURSOR; + if (yych == 'd') goto yy372; + goto yy99; +yy367: + yych = *++YYCURSOR; + if (yych != 'r') goto yy99; + yych = *++YYCURSOR; + if (yych != 'o') goto yy99; + yych = *++YYCURSOR; + if (yych != 'r') goto yy99; + ++YYCURSOR; +#line 310 "cpp.re" + { BOOST_WAVE_RET(T_PP_ERROR); } +#line 3692 "cpp_re.inc" +yy372: + yych = *++YYCURSOR; + if (yych == 'i') goto yy373; + if (yych == 'r') goto yy374; + goto yy99; +yy373: + yych = *++YYCURSOR; + if (yych == 'f') goto yy381; + goto yy99; +yy374: + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + yych = *++YYCURSOR; + if (yych != 'g') goto yy99; + yych = *++YYCURSOR; + if (yych != 'i') goto yy99; + yych = *++YYCURSOR; + if (yych != 'o') goto yy99; + yych = *++YYCURSOR; + if (yych != 'n') goto yy99; + ++YYCURSOR; +#line 316 "cpp.re" + { BOOST_WAVE_RET(T_MSEXT_PP_ENDREGION); } +#line 3716 "cpp_re.inc" +yy381: + ++YYCURSOR; +#line 306 "cpp.re" + { BOOST_WAVE_RET(T_PP_ENDIF); } +#line 3721 "cpp_re.inc" +yy383: + yych = *++YYCURSOR; + if (yych == 'f') goto yy387; + goto yy99; +yy384: + yych = *++YYCURSOR; + if (yych != 'e') goto yy99; + ++YYCURSOR; +#line 304 "cpp.re" + { BOOST_WAVE_RET(T_PP_ELSE); } +#line 3732 "cpp_re.inc" +yy387: + ++YYCURSOR; +#line 305 "cpp.re" + { BOOST_WAVE_RET(T_PP_ELIF); } +#line 3737 "cpp_re.inc" +yy389: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\r') { + if (yych <= 0x08) goto yy99; + if (yych <= '\f') goto yy389; + } else { + if (yych <= 0x1F) goto yy99; + if (yych == '*') goto yy393; + goto yy389; + } +yy391: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\r') { + if (yych <= 0x08) goto yy99; + if (yych <= '\f') goto yy389; + goto yy391; + } else { + if (yych <= 0x1F) goto yy99; + if (yych != '*') goto yy389; + } +yy393: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych <= 0x08) goto yy99; + if (yych <= '\f') goto yy389; + if (yych >= 0x0E) goto yy99; + } else { + if (yych <= '*') { + if (yych <= ')') goto yy389; + goto yy393; + } else { + if (yych == '/') goto yy272; + goto yy389; + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '\r') { + if (yych <= 0x08) goto yy99; + if (yych <= '\f') goto yy389; + goto yy391; + } else { + if (yych <= 0x1F) goto yy99; + if (yych == '*') goto yy393; + goto yy389; + } +yy396: + ++YYCURSOR; +#line 165 "cpp.re" + { + if (s->act_in_c99_mode) { + --YYCURSOR; + BOOST_WAVE_RET(T_COLON); + } + else { + BOOST_WAVE_RET(T_COLON_COLON); + } + } +#line 3803 "cpp_re.inc" +yy398: + ++YYCURSOR; +#line 149 "cpp.re" + { BOOST_WAVE_RET(T_RIGHTBRACKET_ALT); } +#line 3808 "cpp_re.inc" +yy400: + yyaccept = 12; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'e') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych == '\t') goto yy273; + } else { + if (yych <= '\f') goto yy273; + if (yych >= ' ') goto yy273; + } + } else { + if (yych <= '.') { + if (yych == '%') goto yy406; + } else { + if (yych <= '/') goto yy273; + if (yych >= 'd') goto yy273; + } + } + } else { + if (yych <= 'p') { + if (yych <= 'k') { + if (yych == 'i') goto yy273; + } else { + if (yych <= 'l') goto yy273; + if (yych >= 'p') goto yy273; + } + } else { + if (yych <= 't') { + if (yych == 'r') goto yy273; + } else { + if (yych == 'v') goto yy401; + if (yych <= 'w') goto yy273; + } + } + } +yy401: +#line 151 "cpp.re" + { BOOST_WAVE_RET(T_POUND_ALT); } +#line 3848 "cpp_re.inc" +yy402: + ++YYCURSOR; +#line 210 "cpp.re" + { BOOST_WAVE_RET(T_PERCENTASSIGN); } +#line 3853 "cpp_re.inc" +yy404: + ++YYCURSOR; +#line 143 "cpp.re" + { BOOST_WAVE_RET(T_RIGHTBRACE_ALT); } +#line 3858 "cpp_re.inc" +yy406: + yych = *++YYCURSOR; + if (yych != ':') goto yy99; + ++YYCURSOR; +#line 157 "cpp.re" + { BOOST_WAVE_RET(T_POUND_POUND_ALT); } +#line 3865 "cpp_re.inc" +yy409: + ++YYCURSOR; +#line 226 "cpp.re" + { BOOST_WAVE_RET(T_LESSEQUAL); } +#line 3870 "cpp_re.inc" +yy411: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy417; +#line 219 "cpp.re" + { BOOST_WAVE_RET(T_SHIFTLEFT); } +#line 3876 "cpp_re.inc" +yy413: + ++YYCURSOR; +#line 146 "cpp.re" + { BOOST_WAVE_RET(T_LEFTBRACKET_ALT); } +#line 3881 "cpp_re.inc" +yy415: + ++YYCURSOR; +#line 140 "cpp.re" + { BOOST_WAVE_RET(T_LEFTBRACE_ALT); } +#line 3886 "cpp_re.inc" +yy417: + ++YYCURSOR; +#line 222 "cpp.re" + { BOOST_WAVE_RET(T_SHIFTLEFTASSIGN); } +#line 3891 "cpp_re.inc" +yy419: + yych = *++YYCURSOR; + switch (yych) { + case '!': goto yy432; + case '\'': goto yy430; + case '(': goto yy424; + case ')': goto yy426; + case '-': goto yy434; + case '/': goto yy436; + case '<': goto yy420; + case '=': goto yy428; + case '>': goto yy422; + default: goto yy99; + } +yy420: + ++YYCURSOR; +#line 139 "cpp.re" + { BOOST_WAVE_RET(T_LEFTBRACE_TRIGRAPH); } +#line 3910 "cpp_re.inc" +yy422: + ++YYCURSOR; +#line 142 "cpp.re" + { BOOST_WAVE_RET(T_RIGHTBRACE_TRIGRAPH); } +#line 3915 "cpp_re.inc" +yy424: + ++YYCURSOR; +#line 145 "cpp.re" + { BOOST_WAVE_RET(T_LEFTBRACKET_TRIGRAPH); } +#line 3920 "cpp_re.inc" +yy426: + ++YYCURSOR; +#line 148 "cpp.re" + { BOOST_WAVE_RET(T_RIGHTBRACKET_TRIGRAPH); } +#line 3925 "cpp_re.inc" +yy428: + yyaccept = 13; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'c') { + if (yych <= ' ') { + if (yych <= '\n') { + if (yych == '\t') goto yy273; + } else { + if (yych <= '\f') goto yy273; + if (yych >= ' ') goto yy273; + } + } else { + if (yych <= '.') { + if (yych == '#') goto yy449; + } else { + if (yych <= '/') goto yy273; + if (yych == '?') goto yy448; + } + } + } else { + if (yych <= 'p') { + if (yych <= 'i') { + if (yych <= 'e') goto yy273; + if (yych >= 'i') goto yy273; + } else { + if (yych == 'l') goto yy273; + if (yych >= 'p') goto yy273; + } + } else { + if (yych <= 't') { + if (yych == 'r') goto yy273; + } else { + if (yych == 'v') goto yy429; + if (yych <= 'w') goto yy273; + } + } + } +yy429: +#line 152 "cpp.re" + { BOOST_WAVE_RET(T_POUND_TRIGRAPH); } +#line 3966 "cpp_re.inc" +yy430: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '=') goto yy446; +#line 191 "cpp.re" + { BOOST_WAVE_RET(T_XOR_TRIGRAPH); } +#line 3972 "cpp_re.inc" +yy432: + yyaccept = 14; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '>') { + if (yych == '=') goto yy441; + } else { + if (yych <= '?') goto yy438; + if (yych == '|') goto yy439; + } +yy433: +#line 197 "cpp.re" + { BOOST_WAVE_RET(T_OR_TRIGRAPH); } +#line 3985 "cpp_re.inc" +yy434: + ++YYCURSOR; +#line 199 "cpp.re" + { BOOST_WAVE_RET(T_COMPL_TRIGRAPH); } +#line 3990 "cpp_re.inc" +yy436: + yyaccept = 15; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'U') goto yy100; + if (yych == 'u') goto yy98; +yy437: +#line 249 "cpp.re" + { BOOST_WAVE_RET(T_ANY_TRIGRAPH); } +#line 3999 "cpp_re.inc" +yy438: + yych = *++YYCURSOR; + if (yych == '?') goto yy443; + goto yy99; +yy439: + ++YYCURSOR; +#line 231 "cpp.re" + { BOOST_WAVE_RET(T_OROR_TRIGRAPH); } +#line 4008 "cpp_re.inc" +yy441: + ++YYCURSOR; +#line 218 "cpp.re" + { BOOST_WAVE_RET(T_ORASSIGN_TRIGRAPH); } +#line 4013 "cpp_re.inc" +yy443: + yych = *++YYCURSOR; + if (yych != '!') goto yy99; + ++YYCURSOR; +#line 234 "cpp.re" + { BOOST_WAVE_RET(T_OROR_TRIGRAPH); } +#line 4020 "cpp_re.inc" +yy446: + ++YYCURSOR; +#line 213 "cpp.re" + { BOOST_WAVE_RET(T_XORASSIGN_TRIGRAPH); } +#line 4025 "cpp_re.inc" +yy448: + yych = *++YYCURSOR; + if (yych == '?') goto yy451; + goto yy99; +yy449: + ++YYCURSOR; +#line 155 "cpp.re" + { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); } +#line 4034 "cpp_re.inc" +yy451: + yych = *++YYCURSOR; + if (yych != '=') goto yy99; + ++YYCURSOR; +#line 156 "cpp.re" + { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); } +#line 4041 "cpp_re.inc" +yy454: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case 'a': goto yy455; + case 'b': goto yy456; + case 'c': goto yy457; + case 'd': goto yy458; + case 'e': goto yy507; + case 'f': goto yy505; + case 'i': goto yy504; + case 'l': goto yy508; + case 's': goto yy461; + case 't': goto yy506; + default: goto yy109; + } +yy455: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 's') goto yy501; + goto yy109; +yy456: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy496; + goto yy109; +yy457: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'd') goto yy491; + goto yy109; +yy458: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy483; + goto yy109; +yy459: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy475; + goto yy109; +yy460: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'n') goto yy469; + goto yy109; +yy461: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'd') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 16; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy468: +#line 130 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_STDCALL : T_IDENTIFIER); } +#line 4117 "cpp_re.inc" +yy469: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; +yy470: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 17; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy474: +#line 135 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INLINE : T_IDENTIFIER); } +#line 4142 "cpp_re.inc" +yy475: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 18; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy482: +#line 129 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FASTCALL : T_IDENTIFIER); } +#line 4172 "cpp_re.inc" +yy483: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 19; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy490: +#line 127 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_DECLSPEC : T_IDENTIFIER); } +#line 4202 "cpp_re.inc" +yy491: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 20; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy495: +#line 128 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_CDECL : T_IDENTIFIER); } +#line 4223 "cpp_re.inc" +yy496: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'd') goto yy109; + yyaccept = 21; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy500: +#line 126 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_BASED : T_IDENTIFIER); } +#line 4244 "cpp_re.inc" +yy501: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'm') goto yy109; + yyaccept = 22; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy503: +#line 136 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_ASM : T_IDENTIFIER); } +#line 4259 "cpp_re.inc" +yy504: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'n') goto yy530; + goto yy109; +yy505: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy475; + if (yych == 'i') goto yy523; + goto yy109; +yy506: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'r') goto yy520; + goto yy109; +yy507: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'x') goto yy514; + goto yy109; +yy508: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'v') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 23; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy513: +#line 134 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_LEAVE : T_IDENTIFIER); } +#line 4304 "cpp_re.inc" +yy514: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 24; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy519: +#line 132 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_EXCEPT : T_IDENTIFIER); } +#line 4328 "cpp_re.inc" +yy520: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'y') goto yy109; + yyaccept = 25; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy522: +#line 131 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_TRY : T_IDENTIFIER); } +#line 4343 "cpp_re.inc" +yy523: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'y') goto yy109; + yyaccept = 26; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy529: +#line 133 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FINALLY : T_IDENTIFIER); } +#line 4370 "cpp_re.inc" +yy530: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'l') goto yy470; + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case '1': goto yy532; + case '3': goto yy533; + case '6': goto yy534; + case '8': goto yy535; + default: goto yy109; + } +yy532: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '6') goto yy541; + goto yy109; +yy533: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '2') goto yy539; + goto yy109; +yy534: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '4') goto yy537; + goto yy109; +yy535: + yyaccept = 27; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy536: +#line 122 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT8 : T_IDENTIFIER); } +#line 4411 "cpp_re.inc" +yy537: + yyaccept = 28; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy538: +#line 125 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT64 : T_IDENTIFIER); } +#line 4423 "cpp_re.inc" +yy539: + yyaccept = 29; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy540: +#line 124 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT32 : T_IDENTIFIER); } +#line 4435 "cpp_re.inc" +yy541: + yyaccept = 30; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy542: +#line 123 "cpp.re" + { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT16 : T_IDENTIFIER); } +#line 4447 "cpp_re.inc" +yy543: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'h') goto yy549; + goto yy109; +yy544: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 31; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy548: +#line 120 "cpp.re" + { BOOST_WAVE_RET(T_WHILE); } +#line 4473 "cpp_re.inc" +yy549: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '_') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 32; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy554: +#line 119 "cpp.re" + { BOOST_WAVE_RET(T_WCHART); } +#line 4497 "cpp_re.inc" +yy555: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'r') goto yy567; + goto yy109; +yy556: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy557; + if (yych == 'l') goto yy558; + goto yy109; +yy557: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'd') goto yy565; + goto yy109; +yy558: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 33; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy564: +#line 118 "cpp.re" + { BOOST_WAVE_RET(T_VOLATILE); } +#line 4540 "cpp_re.inc" +yy565: + yyaccept = 34; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy566: +#line 117 "cpp.re" + { BOOST_WAVE_RET(T_VOID); } +#line 4552 "cpp_re.inc" +yy567: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'u') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 35; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy572: +#line 116 "cpp.re" + { BOOST_WAVE_RET(T_VIRTUAL); } +#line 4576 "cpp_re.inc" +yy573: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '"') goto yy129; + if (yych == 'R') goto yy128; + goto yy109; +yy574: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy580; + if (yych == 's') goto yy581; + goto yy109; +yy575: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'g') goto yy109; + yyaccept = 36; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy579: +#line 115 "cpp.re" + { BOOST_WAVE_RET(T_USING); } +#line 4609 "cpp_re.inc" +yy580: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'o') goto yy588; + goto yy109; +yy581: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'g') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'd') goto yy109; + yyaccept = 37; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy587: +#line 114 "cpp.re" + { BOOST_WAVE_RET(T_UNSIGNED); } +#line 4641 "cpp_re.inc" +yy588: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 38; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy590: +#line 113 "cpp.re" + { BOOST_WAVE_RET(T_UNION); } +#line 4656 "cpp_re.inc" +yy591: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'm') goto yy631; + goto yy109; +yy592: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy614; + if (yych == 'r') goto yy615; + goto yy109; +yy593: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'u') goto yy609; + if (yych == 'y') goto yy610; + goto yy109; +yy594: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'h') { + if (yych != 'd') goto yy109; + } else { + if (yych <= 'i') goto yy598; + if (yych == 'n') goto yy599; + goto yy109; + } + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy606; + goto yy109; +yy598: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'd') goto yy604; + goto yy109; +yy599: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'm') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 39; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy603: +#line 112 "cpp.re" + { BOOST_WAVE_RET(T_TYPENAME); } +#line 4719 "cpp_re.inc" +yy604: + yyaccept = 40; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy605: +#line 111 "cpp.re" + { BOOST_WAVE_RET(T_TYPEID); } +#line 4731 "cpp_re.inc" +yy606: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'f') goto yy109; + yyaccept = 41; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy608: +#line 110 "cpp.re" + { BOOST_WAVE_RET(T_TYPEDEF); } +#line 4746 "cpp_re.inc" +yy609: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy612; + goto yy109; +yy610: + yyaccept = 42; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy611: +#line 109 "cpp.re" + { BOOST_WAVE_RET(T_TRY); } +#line 4763 "cpp_re.inc" +yy612: + yyaccept = 43; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy613: +#line 108 "cpp.re" + { BOOST_WAVE_RET(T_TRUE); } +#line 4775 "cpp_re.inc" +yy614: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 's') goto yy629; + goto yy109; +yy615: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy616; + if (yych == 'o') goto yy617; + goto yy109; +yy616: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy620; + goto yy109; +yy617: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'w') goto yy109; + yyaccept = 44; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy619: +#line 107 "cpp.re" + { BOOST_WAVE_RET(T_THROW); } +#line 4806 "cpp_re.inc" +yy620: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'd') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '_') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'o') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 45; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy628: +#line 106 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_THREADLOCAL : T_IDENTIFIER); } +#line 4839 "cpp_re.inc" +yy629: + yyaccept = 46; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy630: +#line 105 "cpp.re" + { BOOST_WAVE_RET(T_THIS); } +#line 4851 "cpp_re.inc" +yy631: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 47; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy637: +#line 104 "cpp.re" + { BOOST_WAVE_RET(T_TEMPLATE); } +#line 4878 "cpp_re.inc" +yy638: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'o') goto yy680; + goto yy109; +yy639: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'g') goto yy670; + if (yych == 'z') goto yy671; + goto yy109; +yy640: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy647; + if (yych == 'r') goto yy648; + goto yy109; +yy641: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'h') goto yy109; + yyaccept = 48; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy646: +#line 103 "cpp.re" + { BOOST_WAVE_RET(T_SWITCH); } +#line 4919 "cpp_re.inc" +yy647: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 't') goto yy653; + goto yy109; +yy648: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'u') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 49; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy652: +#line 102 "cpp.re" + { BOOST_WAVE_RET(T_STRUCT); } +#line 4945 "cpp_re.inc" +yy653: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 50; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '@') { + if (yych <= '/') { + if (yych == '$') goto yy108; + } else { + if (yych <= '9') goto yy108; + if (yych == '?') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= 'Z') goto yy108; + if (yych == '\\') goto yy110; + } else { + if (yych <= '_') goto yy657; + if (yych <= '`') goto yy656; + if (yych <= 'z') goto yy108; + } + } +yy656: +#line 99 "cpp.re" + { BOOST_WAVE_RET(T_STATIC); } +#line 4975 "cpp_re.inc" +yy657: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy658; + if (yych == 'c') goto yy659; + goto yy109; +yy658: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 's') goto yy664; + goto yy109; +yy659: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 51; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy663: +#line 100 "cpp.re" + { BOOST_WAVE_RET(T_STATICCAST); } +#line 5007 "cpp_re.inc" +yy664: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 52; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy669: +#line 101 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_STATICASSERT : T_IDENTIFIER); } +#line 5031 "cpp_re.inc" +yy670: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'n') goto yy676; + goto yy109; +yy671: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'o') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'f') goto yy109; + yyaccept = 53; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy675: +#line 98 "cpp.re" + { BOOST_WAVE_RET(T_SIZEOF); } +#line 5057 "cpp_re.inc" +yy676: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'd') goto yy109; + yyaccept = 54; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy679: +#line 97 "cpp.re" + { BOOST_WAVE_RET(T_SIGNED); } +#line 5075 "cpp_re.inc" +yy680: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 55; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy683: +#line 96 "cpp.re" + { BOOST_WAVE_RET(T_SHORT); } +#line 5093 "cpp_re.inc" +yy684: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'h') { + if (yych != 'g') goto yy109; + } else { + if (yych <= 'i') goto yy686; + if (yych == 't') goto yy687; + goto yy109; + } + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy706; + goto yy109; +yy686: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'n') goto yy692; + goto yy109; +yy687: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'u') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 56; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy691: +#line 95 "cpp.re" + { BOOST_WAVE_RET(T_RETURN); } +#line 5133 "cpp_re.inc" +yy692: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '_') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 57; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy705: +#line 94 "cpp.re" + { BOOST_WAVE_RET(T_REINTERPRETCAST); } +#line 5181 "cpp_re.inc" +yy706: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 58; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy711: +#line 93 "cpp.re" + { BOOST_WAVE_RET(T_REGISTER); } +#line 5205 "cpp_re.inc" +yy712: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy719; + if (yych == 'o') goto yy720; + goto yy109; +yy713: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'b') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 59; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy718: +#line 92 "cpp.re" + { BOOST_WAVE_RET(T_PUBLIC); } +#line 5235 "cpp_re.inc" +yy719: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'v') goto yy728; + goto yy109; +yy720: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'd') goto yy109; + yyaccept = 60; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy727: +#line 91 "cpp.re" + { BOOST_WAVE_RET(T_PROTECTED); } +#line 5270 "cpp_re.inc" +yy728: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 61; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy732: +#line 90 "cpp.re" + { BOOST_WAVE_RET(T_PRIVATE); } +#line 5291 "cpp_re.inc" +yy733: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy740; + goto yy109; +yy734: + yyaccept = 62; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '@') { + if (yych <= '/') { + if (yych == '$') goto yy108; + } else { + if (yych <= '9') goto yy108; + if (yych == '?') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= 'Z') goto yy108; + if (yych == '\\') goto yy110; + } else { + if (yych <= '_') goto yy736; + if (yych <= '`') goto yy735; + if (yych <= 'z') goto yy108; + } + } +yy735: +#line 233 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OROR_ALT); } +#line 5320 "cpp_re.inc" +yy736: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'q') goto yy109; + yyaccept = 63; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy739: +#line 217 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ORASSIGN_ALT); } +#line 5338 "cpp_re.inc" +yy740: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'o') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 64; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy746: +#line 89 "cpp.re" + { BOOST_WAVE_RET(T_OPERATOR); } +#line 5365 "cpp_re.inc" +yy747: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'm') goto yy772; + goto yy109; +yy748: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'w') goto yy770; + goto yy109; +yy749: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy757; + if (yych == 't') goto yy758; + goto yy109; +yy750: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 65; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy756: +#line 88 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_NULLPTR : T_IDENTIFIER); } +#line 5408 "cpp_re.inc" +yy757: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'x') goto yy764; + goto yy109; +yy758: + yyaccept = 66; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '@') { + if (yych <= '/') { + if (yych == '$') goto yy108; + } else { + if (yych <= '9') goto yy108; + if (yych == '?') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= 'Z') goto yy108; + if (yych == '\\') goto yy110; + } else { + if (yych <= '_') goto yy760; + if (yych <= '`') goto yy759; + if (yych <= 'z') goto yy108; + } + } +yy759: +#line 202 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOT_ALT); } +#line 5437 "cpp_re.inc" +yy760: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'q') goto yy109; + yyaccept = 67; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy763: +#line 225 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOTEQUAL_ALT); } +#line 5455 "cpp_re.inc" +yy764: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 68; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy769: +#line 87 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_NOEXCEPT : T_IDENTIFIER); } +#line 5479 "cpp_re.inc" +yy770: + yyaccept = 69; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy771: +#line 86 "cpp.re" + { BOOST_WAVE_RET(T_NEW); } +#line 5491 "cpp_re.inc" +yy772: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 70; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy779: +#line 85 "cpp.re" + { BOOST_WAVE_RET(T_NAMESPACE); } +#line 5521 "cpp_re.inc" +yy780: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'b') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 71; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy786: +#line 84 "cpp.re" + { BOOST_WAVE_RET(T_MUTABLE); } +#line 5548 "cpp_re.inc" +yy787: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'g') goto yy109; + yyaccept = 72; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy790: +#line 83 "cpp.re" + { BOOST_WAVE_RET(T_LONG); } +#line 5566 "cpp_re.inc" +yy791: + yyaccept = 73; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy792: +#line 79 "cpp.re" + { BOOST_WAVE_RET(T_IF); } +#line 5578 "cpp_re.inc" +yy793: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'p') goto yy802; + goto yy109; +yy794: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'l') goto yy795; + if (yych == 't') goto yy796; + goto yy109; +yy795: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy798; + goto yy109; +yy796: + yyaccept = 74; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy797: +#line 82 "cpp.re" + { BOOST_WAVE_RET(T_INT); } +#line 5606 "cpp_re.inc" +yy798: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 75; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy801: +#line 81 "cpp.re" + { BOOST_WAVE_RET(T_INLINE); } +#line 5624 "cpp_re.inc" +yy802: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'o') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 76; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy806: +#line 80 "cpp.re" + { BOOST_WAVE_RET(s->enable_import_keyword ? T_IMPORT : T_IDENTIFIER); } +#line 5645 "cpp_re.inc" +yy807: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'o') goto yy109; + yyaccept = 77; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy810: +#line 78 "cpp.re" + { BOOST_WAVE_RET(T_GOTO); } +#line 5663 "cpp_re.inc" +yy811: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'l') goto yy826; + goto yy109; +yy812: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'o') goto yy822; + goto yy109; +yy813: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'r') goto yy820; + goto yy109; +yy814: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'd') goto yy109; + yyaccept = 78; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy819: +#line 77 "cpp.re" + { BOOST_WAVE_RET(T_FRIEND); } +#line 5702 "cpp_re.inc" +yy820: + yyaccept = 79; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy821: +#line 76 "cpp.re" + { BOOST_WAVE_RET(T_FOR); } +#line 5714 "cpp_re.inc" +yy822: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 80; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy825: +#line 75 "cpp.re" + { BOOST_WAVE_RET(T_FLOAT); } +#line 5732 "cpp_re.inc" +yy826: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 81; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy829: +#line 74 "cpp.re" + { BOOST_WAVE_RET(T_FALSE); } +#line 5750 "cpp_re.inc" +yy830: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 's') goto yy852; + goto yy109; +yy831: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'u') goto yy849; + goto yy109; +yy832: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'p') goto yy833; + if (yych == 't') goto yy834; + goto yy109; +yy833: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'l') goto yy839; + if (yych == 'o') goto yy840; + goto yy109; +yy834: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 82; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy838: +#line 73 "cpp.re" + { BOOST_WAVE_RET(T_EXTERN); } +#line 5793 "cpp_re.inc" +yy839: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy844; + goto yy109; +yy840: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 83; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy843: +#line 72 "cpp.re" + { BOOST_WAVE_RET(T_EXPORT); } +#line 5816 "cpp_re.inc" +yy844: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 84; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy848: +#line 71 "cpp.re" + { BOOST_WAVE_RET(T_EXPLICIT); } +#line 5837 "cpp_re.inc" +yy849: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'm') goto yy109; + yyaccept = 85; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy851: +#line 70 "cpp.re" + { BOOST_WAVE_RET(T_ENUM); } +#line 5852 "cpp_re.inc" +yy852: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 86; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy854: +#line 69 "cpp.re" + { BOOST_WAVE_RET(T_ELSE); } +#line 5867 "cpp_re.inc" +yy855: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'e') { + if (yych == 'c') goto yy875; + goto yy109; + } else { + if (yych <= 'f') goto yy876; + if (yych == 'l') goto yy877; + goto yy109; + } +yy856: + yyaccept = 87; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'Z') { + if (yych <= '9') { + if (yych == '$') goto yy108; + if (yych >= '0') goto yy108; + } else { + if (yych == '?') goto yy111; + if (yych >= 'A') goto yy108; + } + } else { + if (yych <= '_') { + if (yych == '\\') goto yy110; + if (yych >= '_') goto yy108; + } else { + if (yych <= 't') { + if (yych >= 'a') goto yy108; + } else { + if (yych <= 'u') goto yy870; + if (yych <= 'z') goto yy108; + } + } + } +yy857: +#line 66 "cpp.re" + { BOOST_WAVE_RET(T_DO); } +#line 5906 "cpp_re.inc" +yy858: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'm') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '_') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 88; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy869: +#line 68 "cpp.re" + { BOOST_WAVE_RET(T_DYNAMICCAST); } +#line 5948 "cpp_re.inc" +yy870: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'b') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 89; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy874: +#line 67 "cpp.re" + { BOOST_WAVE_RET(T_DOUBLE); } +#line 5969 "cpp_re.inc" +yy875: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'l') goto yy887; + goto yy109; +yy876: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy882; + goto yy109; +yy877: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 90; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy881: +#line 65 "cpp.re" + { BOOST_WAVE_RET(T_DELETE); } +#line 6000 "cpp_re.inc" +yy882: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'u') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 91; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy886: +#line 64 "cpp.re" + { BOOST_WAVE_RET(T_DEFAULT); } +#line 6021 "cpp_re.inc" +yy887: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'y') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 92; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy892: +#line 63 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_DECLTYPE : T_IDENTIFIER); } +#line 6045 "cpp_re.inc" +yy893: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'r') goto yy109; + if (yych <= 's') goto yy939; + if (yych <= 't') goto yy940; + goto yy109; +yy894: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy926; + goto yy109; +yy895: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy922; + goto yy109; +yy896: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'l') goto yy109; + if (yych <= 'm') goto yy898; + if (yych >= 'o') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'r') goto yy109; + if (yych <= 's') goto yy902; + if (yych <= 't') goto yy903; + goto yy109; +yy898: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 93; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy901: +#line 200 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_COMPL_ALT); } +#line 6092 "cpp_re.inc" +yy902: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 't') goto yy909; + goto yy109; +yy903: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'i') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'u') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 94; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy908: +#line 62 "cpp.re" + { BOOST_WAVE_RET(T_CONTINUE); } +#line 6121 "cpp_re.inc" +yy909: + yyaccept = 95; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= 'Z') { + if (yych <= '9') { + if (yych == '$') goto yy108; + if (yych >= '0') goto yy108; + } else { + if (yych == '?') goto yy111; + if (yych >= 'A') goto yy108; + } + } else { + if (yych <= '_') { + if (yych == '\\') goto yy110; + if (yych >= '_') goto yy911; + } else { + if (yych <= 'd') { + if (yych >= 'a') goto yy108; + } else { + if (yych <= 'e') goto yy912; + if (yych <= 'z') goto yy108; + } + } + } +yy910: +#line 59 "cpp.re" + { BOOST_WAVE_RET(T_CONST); } +#line 6149 "cpp_re.inc" +yy911: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'c') goto yy917; + goto yy109; +yy912: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'x') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'p') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 96; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy916: +#line 60 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_CONSTEXPR : T_IDENTIFIER); } +#line 6175 "cpp_re.inc" +yy917: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 97; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy921: +#line 61 "cpp.re" + { BOOST_WAVE_RET(T_CONSTCAST); } +#line 6196 "cpp_re.inc" +yy922: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 's') goto yy109; + yyaccept = 98; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy925: +#line 58 "cpp.re" + { BOOST_WAVE_RET(T_CLASS); } +#line 6214 "cpp_re.inc" +yy926: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 99; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '>') { + if (yych <= '0') { + if (yych == '$') goto yy108; + if (yych >= '0') goto yy108; + } else { + if (yych <= '2') { + if (yych <= '1') goto yy929; + goto yy108; + } else { + if (yych <= '3') goto yy930; + if (yych <= '9') goto yy108; + } + } + } else { + if (yych <= '\\') { + if (yych <= '@') { + if (yych <= '?') goto yy111; + } else { + if (yych <= 'Z') goto yy108; + if (yych >= '\\') goto yy110; + } + } else { + if (yych <= '_') { + if (yych >= '_') goto yy108; + } else { + if (yych <= '`') goto yy928; + if (yych <= 'z') goto yy108; + } + } + } +yy928: +#line 55 "cpp.re" + { BOOST_WAVE_RET(T_CHAR); } +#line 6254 "cpp_re.inc" +yy929: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '6') goto yy935; + goto yy109; +yy930: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '2') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '_') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 100; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy934: +#line 57 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_CHAR32_T : T_IDENTIFIER); } +#line 6280 "cpp_re.inc" +yy935: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != '_') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 101; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy938: +#line 56 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_CHAR16_T : T_IDENTIFIER); } +#line 6298 "cpp_re.inc" +yy939: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'e') goto yy944; + goto yy109; +yy940: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'c') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'h') goto yy109; + yyaccept = 102; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy943: +#line 54 "cpp.re" + { BOOST_WAVE_RET(T_CATCH); } +#line 6321 "cpp_re.inc" +yy944: + yyaccept = 103; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy945: +#line 53 "cpp.re" + { BOOST_WAVE_RET(T_CASE); } +#line 6333 "cpp_re.inc" +yy946: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 't') goto yy956; + goto yy109; +yy947: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'o') goto yy953; + goto yy109; +yy948: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'a') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'k') goto yy109; + yyaccept = 104; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy952: +#line 52 "cpp.re" + { BOOST_WAVE_RET(T_BREAK); } +#line 6364 "cpp_re.inc" +yy953: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'l') goto yy109; + yyaccept = 105; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy955: +#line 51 "cpp.re" + { BOOST_WAVE_RET(T_BOOL); } +#line 6379 "cpp_re.inc" +yy956: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy957; + if (yych == 'o') goto yy958; + goto yy109; +yy957: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'n') goto yy961; + goto yy109; +yy958: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'r') goto yy109; + yyaccept = 106; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy960: +#line 196 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OR_ALT); } +#line 6405 "cpp_re.inc" +yy961: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'd') goto yy109; + yyaccept = 107; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy963: +#line 194 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_AND_ALT); } +#line 6420 "cpp_re.inc" +yy964: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'i') goto yy979; + goto yy109; +yy965: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'd') goto yy973; + goto yy109; +yy966: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'm') goto yy971; + goto yy109; +yy967: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 't') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'o') goto yy109; + yyaccept = 108; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy970: +#line 50 "cpp.re" + { BOOST_WAVE_RET(T_AUTO); } +#line 6453 "cpp_re.inc" +yy971: + yyaccept = 109; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy972: +#line 49 "cpp.re" + { BOOST_WAVE_RET(T_ASM); } +#line 6465 "cpp_re.inc" +yy973: + yyaccept = 110; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '@') { + if (yych <= '/') { + if (yych == '$') goto yy108; + } else { + if (yych <= '9') goto yy108; + if (yych == '?') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= 'Z') goto yy108; + if (yych == '\\') goto yy110; + } else { + if (yych <= '_') goto yy975; + if (yych <= '`') goto yy974; + if (yych <= 'z') goto yy108; + } + } +yy974: +#line 229 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDAND_ALT); } +#line 6489 "cpp_re.inc" +yy975: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'e') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'q') goto yy109; + yyaccept = 111; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy978: +#line 215 "cpp.re" + { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDASSIGN_ALT); } +#line 6507 "cpp_re.inc" +yy979: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'g') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'n') goto yy109; + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 'a') goto yy982; + if (yych == 'o') goto yy983; + goto yy109; +yy982: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych == 's') goto yy986; + goto yy109; +yy983: + yyaccept = 1; + yych = *(YYMARKER = ++YYCURSOR); + if (yych != 'f') goto yy109; + yyaccept = 112; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy985: +#line 48 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_ALIGNOF : T_IDENTIFIER); } +#line 6539 "cpp_re.inc" +yy986: + yyaccept = 113; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[256+yych] & 32) { + goto yy108; + } + if (yych == '?') goto yy111; + if (yych == '\\') goto yy110; +yy987: +#line 47 "cpp.re" + { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_ALIGNAS : T_IDENTIFIER); } +#line 6551 "cpp_re.inc" +yy988: + ++YYCURSOR; +#line 176 "cpp.re" + { + if (s->act_in_c99_mode) { + --YYCURSOR; + BOOST_WAVE_RET(T_DOT); + } + else { + BOOST_WAVE_RET(T_DOTSTAR); + } + } +#line 6564 "cpp_re.inc" +yy990: + yych = *++YYCURSOR; + if (yych == '.') goto yy992; + goto yy99; +yy991: + yych = *++YYCURSOR; + goto yy7; +yy992: + ++YYCURSOR; +#line 162 "cpp.re" + { BOOST_WAVE_RET(T_ELLIPSIS); } +#line 6576 "cpp_re.inc" +yy994: + ++YYCURSOR; +#line 209 "cpp.re" + { BOOST_WAVE_RET(T_DIVIDEASSIGN); } +#line 6581 "cpp_re.inc" +yy996: + ++YYCURSOR; +#line 44 "cpp.re" + { goto cppcomment; } +#line 6586 "cpp_re.inc" +yy998: + ++YYCURSOR; +#line 43 "cpp.re" + { goto ccomment; } +#line 6591 "cpp_re.inc" +} +#line 348 "cpp.re" + + +ccomment: + +#line 6598 "cpp_re.inc" +{ + YYCTYPE yych; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '\f') { + if (yych <= 0x08) { + if (yych <= 0x00) goto yy1009; + goto yy1011; + } else { + if (yych == '\n') goto yy1004; + goto yy1007; + } + } else { + if (yych <= 0x1F) { + if (yych <= '\r') goto yy1006; + goto yy1011; + } else { + if (yych != '*') goto yy1008; + } + } + ++YYCURSOR; + if ((yych = *YYCURSOR) == '/') goto yy1014; +yy1003: +#line 363 "cpp.re" + { goto ccomment; } +#line 6624 "cpp_re.inc" +yy1004: + ++YYCURSOR; +yy1005: +#line 355 "cpp.re" + { + /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF);*/ + /*s->tok = cursor; */ + s->line += count_backslash_newlines(s, cursor) +1; + cursor.column = 1; + goto ccomment; + } +#line 6636 "cpp_re.inc" +yy1006: + yych = *++YYCURSOR; + if (yych == '\n') goto yy1013; + goto yy1005; +yy1007: + yych = *++YYCURSOR; + goto yy1003; +yy1008: + yych = *++YYCURSOR; + goto yy1003; +yy1009: + ++YYCURSOR; +#line 366 "cpp.re" + { + if(cursor == s->eof) + { + BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor + (*s->error_proc)(s, lexing_exception::generic_lexing_warning, + "Unterminated 'C' style comment"); + } + else + { + --YYCURSOR; // next call returns T_EOF + BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor + (*s->error_proc)(s, lexing_exception::generic_lexing_error, + "invalid character: '\\000' in input stream"); + } + } +#line 6665 "cpp_re.inc" +yy1011: + ++YYCURSOR; +#line 383 "cpp.re" + { + // flag the error + BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor + (*s->error_proc)(s, lexing_exception::generic_lexing_error, + "invalid character '\\%03o' in input stream", *--YYCURSOR); + } +#line 6675 "cpp_re.inc" +yy1013: + yych = *++YYCURSOR; + goto yy1005; +yy1014: + ++YYCURSOR; +#line 352 "cpp.re" + { BOOST_WAVE_RET(T_CCOMMENT); } +#line 6683 "cpp_re.inc" +} +#line 389 "cpp.re" + + +cppcomment: + +#line 6690 "cpp_re.inc" +{ + YYCTYPE yych; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= '\n') { + if (yych <= 0x00) goto yy1024; + if (yych <= 0x08) goto yy1026; + if (yych <= '\t') goto yy1021; + } else { + if (yych <= '\f') goto yy1021; + if (yych <= '\r') goto yy1020; + if (yych <= 0x1F) goto yy1026; + goto yy1023; + } + ++YYCURSOR; +yy1019: +#line 394 "cpp.re" + { + /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF); */ + /*s->tok = cursor; */ + s->line++; + cursor.column = 1; + BOOST_WAVE_RET(T_CPPCOMMENT); + } +#line 6715 "cpp_re.inc" +yy1020: + yych = *++YYCURSOR; + if (yych == '\n') goto yy1028; + goto yy1019; +yy1021: + ++YYCURSOR; +yy1022: +#line 402 "cpp.re" + { goto cppcomment; } +#line 6725 "cpp_re.inc" +yy1023: + yych = *++YYCURSOR; + goto yy1022; +yy1024: + ++YYCURSOR; +#line 405 "cpp.re" + { + if (s->eof && cursor != s->eof) + { + --YYCURSOR; // next call returns T_EOF + BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor + (*s->error_proc)(s, lexing_exception::generic_lexing_error, + "invalid character '\\000' in input stream"); + } + + --YYCURSOR; // next call returns T_EOF + if (!s->single_line_only) + { + BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor + (*s->error_proc)(s, lexing_exception::generic_lexing_warning, + "Unterminated 'C++' style comment"); + } + BOOST_WAVE_RET(T_CPPCOMMENT); + } +#line 6750 "cpp_re.inc" +yy1026: + ++YYCURSOR; +#line 425 "cpp.re" + { + // flag the error + BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor + (*s->error_proc)(s, lexing_exception::generic_lexing_error, + "invalid character '\\%03o' in input stream", *--YYCURSOR); + } +#line 6760 "cpp_re.inc" +yy1028: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy1019; +} +#line 431 "cpp.re" + + +/* this subscanner is called whenever a pp_number has been started */ +pp_number: +{ + cursor = uchar_wrapper(s->tok = s->cur, s->column = s->curr_column); + marker = uchar_wrapper(s->ptr); + limit = uchar_wrapper(s->lim); + + if (s->detect_pp_numbers) { + +#line 6778 "cpp_re.inc" +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 0, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 0, 0, 0, 0, 0, 0, + 0, 64, 64, 64, 64, 128, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 0, 0, 0, 0, 64, + 0, 64, 64, 64, 64, 128, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych == '.') goto yy1032; + if (yych <= '/') goto yy1031; + if (yych <= '9') goto yy1033; +yy1031: + YYCURSOR = YYMARKER; + goto yy1035; +yy1032: + yych = *++YYCURSOR; + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; +yy1033: + YYMARKER = ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy1033; + } + if (yych <= 'Z') { + if (yych == '?') goto yy1039; + if (yych >= 'A') goto yy1036; + } else { + if (yych <= '\\') { + if (yych >= '\\') goto yy1038; + } else { + if (yych == 'e') goto yy1036; + } + } +yy1035: +#line 443 "cpp.re" + { BOOST_WAVE_RET(T_PP_NUMBER); } +#line 6847 "cpp_re.inc" +yy1036: + YYMARKER = ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy1036; + } + if (yych <= '>') { + if (yych <= '+') { + if (yych == '$') goto yy1033; + if (yych <= '*') goto yy1035; + goto yy1033; + } else { + if (yych <= '.') { + if (yych <= ',') goto yy1035; + goto yy1033; + } else { + if (yych <= '/') goto yy1035; + if (yych <= '9') goto yy1033; + goto yy1035; + } + } + } else { + if (yych <= '\\') { + if (yych <= '@') { + if (yych <= '?') goto yy1039; + goto yy1035; + } else { + if (yych <= 'Z') goto yy1033; + if (yych <= '[') goto yy1035; + } + } else { + if (yych <= '_') { + if (yych <= '^') goto yy1035; + goto yy1033; + } else { + if (yych <= '`') goto yy1035; + if (yych <= 'z') goto yy1033; + goto yy1035; + } + } + } +yy1038: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == 'U') goto yy1042; + if (yych == 'u') goto yy1041; + goto yy1031; +yy1039: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych != '?') goto yy1031; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych == '/') goto yy1038; + goto yy1031; +yy1041: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych <= '9') goto yy1050; + goto yy1031; + } else { + if (yych <= 'F') goto yy1050; + if (yych <= '`') goto yy1031; + if (yych <= 'f') goto yy1050; + goto yy1031; + } +yy1042: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1043; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1043: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1044; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1044: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1045; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1045: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1046; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1046: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1047; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1047: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1048; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1048: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1049; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1049: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych <= '9') goto yy1033; + goto yy1031; + } else { + if (yych <= 'F') goto yy1033; + if (yych <= '`') goto yy1031; + if (yych <= 'f') goto yy1033; + goto yy1031; + } +yy1050: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1051; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1051: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych >= ':') goto yy1031; + } else { + if (yych <= 'F') goto yy1052; + if (yych <= '`') goto yy1031; + if (yych >= 'g') goto yy1031; + } +yy1052: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1031; + if (yych <= '9') goto yy1033; + goto yy1031; + } else { + if (yych <= 'F') goto yy1033; + if (yych <= '`') goto yy1031; + if (yych <= 'f') goto yy1033; + goto yy1031; + } +} +#line 444 "cpp.re" + + } + else { + +#line 7063 "cpp_re.inc" +{ + YYCTYPE yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 224, 224, 224, 224, 224, 224, 224, 224, + 160, 160, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); + yych = *YYCURSOR; + if (yych <= '/') { + if (yych == '.') goto yy1060; + } else { + if (yych <= '0') goto yy1056; + if (yych <= '9') goto yy1058; + } +yy1055: + YYCURSOR = YYMARKER; + if (yyaccept <= 0) { + goto yy1057; + } else { + goto yy1063; + } +yy1056: + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 64) { + goto yy1075; + } + if (yych <= 'E') { + if (yych <= '/') { + if (yych == '.') goto yy1061; + } else { + if (yych <= '9') goto yy1078; + if (yych >= 'E') goto yy1071; + } + } else { + if (yych <= 'd') { + if (yych == 'X') goto yy1077; + } else { + if (yych <= 'e') goto yy1071; + if (yych == 'x') goto yy1077; + } + } +yy1057: +#line 451 "cpp.re" + { goto integer_suffix; } +#line 7140 "cpp_re.inc" +yy1058: + yyaccept = 0; + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy1058; + } + if (yych <= 'D') { + if (yych == '.') goto yy1061; + goto yy1057; + } else { + if (yych <= 'E') goto yy1071; + if (yych == 'e') goto yy1071; + goto yy1057; + } +yy1060: + yych = *++YYCURSOR; + if (yych <= '/') goto yy1055; + if (yych >= ':') goto yy1055; +yy1061: + yyaccept = 1; + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yych <= 'K') { + if (yych <= 'D') { + if (yych <= '/') goto yy1063; + if (yych <= '9') goto yy1061; + } else { + if (yych <= 'E') goto yy1064; + if (yych <= 'F') goto yy1065; + } + } else { + if (yych <= 'e') { + if (yych <= 'L') goto yy1066; + if (yych >= 'e') goto yy1064; + } else { + if (yych <= 'f') goto yy1065; + if (yych == 'l') goto yy1066; + } + } +yy1063: +#line 449 "cpp.re" + { BOOST_WAVE_RET(T_FLOATLIT); } +#line 7186 "cpp_re.inc" +yy1064: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych == '+') goto yy1068; + goto yy1055; + } else { + if (yych <= '-') goto yy1068; + if (yych <= '/') goto yy1055; + if (yych <= '9') goto yy1069; + goto yy1055; + } +yy1065: + yych = *++YYCURSOR; + if (yych == 'L') goto yy1067; + if (yych == 'l') goto yy1067; + goto yy1063; +yy1066: + yych = *++YYCURSOR; + if (yych == 'F') goto yy1067; + if (yych != 'f') goto yy1063; +yy1067: + yych = *++YYCURSOR; + goto yy1063; +yy1068: + yych = *++YYCURSOR; + if (yych <= '/') goto yy1055; + if (yych >= ':') goto yy1055; +yy1069: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= 'K') { + if (yych <= '9') { + if (yych <= '/') goto yy1063; + goto yy1069; + } else { + if (yych == 'F') goto yy1065; + goto yy1063; + } + } else { + if (yych <= 'f') { + if (yych <= 'L') goto yy1066; + if (yych <= 'e') goto yy1063; + goto yy1065; + } else { + if (yych == 'l') goto yy1066; + goto yy1063; + } + } +yy1071: + yych = *++YYCURSOR; + if (yych <= ',') { + if (yych != '+') goto yy1055; + } else { + if (yych <= '-') goto yy1072; + if (yych <= '/') goto yy1055; + if (yych <= '9') goto yy1073; + goto yy1055; + } +yy1072: + yych = *++YYCURSOR; + if (yych <= '/') goto yy1055; + if (yych >= ':') goto yy1055; +yy1073: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= 'K') { + if (yych <= '9') { + if (yych <= '/') goto yy1063; + goto yy1073; + } else { + if (yych == 'F') goto yy1065; + goto yy1063; + } + } else { + if (yych <= 'f') { + if (yych <= 'L') goto yy1066; + if (yych <= 'e') goto yy1063; + goto yy1065; + } else { + if (yych == 'l') goto yy1066; + goto yy1063; + } + } +yy1075: + yyaccept = 0; + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy1075; + } + if (yych <= '9') { + if (yych == '.') goto yy1061; + if (yych <= '/') goto yy1057; + goto yy1078; + } else { + if (yych <= 'E') { + if (yych <= 'D') goto yy1057; + goto yy1071; + } else { + if (yych == 'e') goto yy1071; + goto yy1057; + } + } +yy1077: + yych = *++YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy1080; + } + goto yy1055; +yy1078: + ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych == '.') goto yy1061; + if (yych <= '/') goto yy1055; + goto yy1078; + } else { + if (yych <= 'E') { + if (yych <= 'D') goto yy1055; + goto yy1071; + } else { + if (yych == 'e') goto yy1071; + goto yy1055; + } + } +yy1080: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy1080; + } + goto yy1057; +} +#line 452 "cpp.re" + + } +} + +/* this subscanner is called, whenever an Integer was recognized */ +integer_suffix: +{ + if (s->enable_ms_extensions) { + +#line 7335 "cpp_re.inc" +{ + YYCTYPE yych; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *(YYMARKER = YYCURSOR); + if (yych <= 'h') { + if (yych <= 'L') { + if (yych >= 'L') goto yy1086; + } else { + if (yych == 'U') goto yy1085; + } + } else { + if (yych <= 'l') { + if (yych <= 'i') goto yy1087; + if (yych >= 'l') goto yy1086; + } else { + if (yych == 'u') goto yy1085; + } + } +yy1084: +#line 465 "cpp.re" + { BOOST_WAVE_RET(T_INTLIT); } +#line 7357 "cpp_re.inc" +yy1085: + yych = *++YYCURSOR; + if (yych == 'L') goto yy1094; + if (yych == 'l') goto yy1094; + goto yy1084; +yy1086: + yych = *++YYCURSOR; + if (yych <= 'U') { + if (yych == 'L') goto yy1093; + if (yych <= 'T') goto yy1084; + goto yy1092; + } else { + if (yych <= 'l') { + if (yych <= 'k') goto yy1084; + goto yy1093; + } else { + if (yych == 'u') goto yy1092; + goto yy1084; + } + } +yy1087: + yych = *++YYCURSOR; + if (yych == '6') goto yy1089; +yy1088: + YYCURSOR = YYMARKER; + goto yy1084; +yy1089: + yych = *++YYCURSOR; + if (yych != '4') goto yy1088; +yy1090: + ++YYCURSOR; +yy1091: +#line 462 "cpp.re" + { BOOST_WAVE_RET(T_LONGINTLIT); } +#line 7392 "cpp_re.inc" +yy1092: + yych = *++YYCURSOR; + goto yy1084; +yy1093: + yych = *++YYCURSOR; + if (yych == 'U') goto yy1090; + if (yych == 'u') goto yy1090; + goto yy1091; +yy1094: + ++YYCURSOR; + if ((yych = *YYCURSOR) == 'L') goto yy1090; + if (yych == 'l') goto yy1090; + goto yy1084; +} +#line 466 "cpp.re" + + } + else { + +#line 7412 "cpp_re.inc" +{ + YYCTYPE yych; + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if (yych <= 'U') { + if (yych == 'L') goto yy1099; + if (yych >= 'U') goto yy1098; + } else { + if (yych <= 'l') { + if (yych >= 'l') goto yy1099; + } else { + if (yych == 'u') goto yy1098; + } + } +yy1097: +#line 474 "cpp.re" + { BOOST_WAVE_RET(T_INTLIT); } +#line 7430 "cpp_re.inc" +yy1098: + yych = *++YYCURSOR; + if (yych == 'L') goto yy1104; + if (yych == 'l') goto yy1104; + goto yy1097; +yy1099: + yych = *++YYCURSOR; + if (yych <= 'U') { + if (yych == 'L') goto yy1101; + if (yych <= 'T') goto yy1097; + } else { + if (yych <= 'l') { + if (yych <= 'k') goto yy1097; + goto yy1101; + } else { + if (yych != 'u') goto yy1097; + } + } + yych = *++YYCURSOR; + goto yy1097; +yy1101: + ++YYCURSOR; + if ((yych = *YYCURSOR) == 'U') goto yy1103; + if (yych == 'u') goto yy1103; +yy1102: +#line 471 "cpp.re" + { BOOST_WAVE_RET(T_LONGINTLIT); } +#line 7458 "cpp_re.inc" +yy1103: + yych = *++YYCURSOR; + goto yy1102; +yy1104: + ++YYCURSOR; + if ((yych = *YYCURSOR) == 'L') goto yy1103; + if (yych == 'l') goto yy1103; + goto yy1097; +} +#line 475 "cpp.re" + + } +} + +/* this subscanner is invoked for C++0x extended character literals */ +extcharlit: +{ + +#line 7477 "cpp_re.inc" +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + if ((YYLIMIT - YYCURSOR) < 13) YYFILL(13); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy1107; + if (yych <= '\t') goto yy1108; + goto yy1112; + } else { + if (yych <= '\f') goto yy1108; + if (yych <= '\r') goto yy1112; + } + } else { + if (yych <= '>') { + if (yych == '\'') goto yy1112; + goto yy1108; + } else { + if (yych <= '?') goto yy1110; + if (yych == '\\') goto yy1111; + goto yy1108; + } + } +yy1107: + YYCURSOR = YYMARKER; + goto yy1109; +yy1108: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '\'') goto yy1120; +yy1109: +#line 487 "cpp.re" + { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); } +#line 7544 "cpp_re.inc" +yy1110: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '\'') goto yy1120; + if (yych == '?') goto yy1135; + goto yy1109; +yy1111: + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '`') { + if (yych <= '7') { + if (yych <= '&') { + if (yych == '"') goto yy1115; + goto yy1109; + } else { + if (yych <= '\'') goto yy1115; + if (yych <= '/') goto yy1109; + goto yy1118; + } + } else { + if (yych <= 'T') { + if (yych == '?') goto yy1116; + goto yy1109; + } else { + if (yych <= 'U') goto yy1114; + if (yych == '\\') goto yy1115; + goto yy1109; + } + } + } else { + if (yych <= 'r') { + if (yych <= 'f') { + if (yych <= 'b') goto yy1115; + if (yych <= 'e') goto yy1109; + goto yy1115; + } else { + if (yych == 'n') goto yy1115; + if (yych <= 'q') goto yy1109; + goto yy1115; + } + } else { + if (yych <= 'u') { + if (yych <= 's') goto yy1109; + if (yych <= 't') goto yy1115; + goto yy1113; + } else { + if (yych <= 'v') goto yy1115; + if (yych == 'x') goto yy1117; + goto yy1109; + } + } + } +yy1112: + yych = *++YYCURSOR; + goto yy1109; +yy1113: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych <= '9') goto yy1132; + goto yy1107; + } else { + if (yych <= 'F') goto yy1132; + if (yych <= '`') goto yy1107; + if (yych <= 'f') goto yy1132; + goto yy1107; + } +yy1114: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych <= '9') goto yy1125; + goto yy1107; + } else { + if (yych <= 'F') goto yy1125; + if (yych <= '`') goto yy1107; + if (yych <= 'f') goto yy1125; + goto yy1107; + } +yy1115: + yych = *++YYCURSOR; + if (yych == '\'') goto yy1120; + goto yy1107; +yy1116: + yych = *++YYCURSOR; + if (yych == '\'') goto yy1120; + if (yych == '?') goto yy1124; + goto yy1107; +yy1117: + yych = *++YYCURSOR; + if (yych == '\'') goto yy1107; + goto yy1123; +yy1118: + yych = *++YYCURSOR; + if (yych == '\'') goto yy1120; + if (yych <= '/') goto yy1107; + if (yych >= '8') goto yy1107; + yych = *++YYCURSOR; + if (yych == '\'') goto yy1120; + if (yych <= '/') goto yy1107; + if (yych <= '7') goto yy1115; + goto yy1107; +yy1120: + ++YYCURSOR; +#line 484 "cpp.re" + { BOOST_WAVE_RET(T_CHARLIT); } +#line 7649 "cpp_re.inc" +yy1122: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy1123: + if (yybm[0+yych] & 128) { + goto yy1122; + } + if (yych == '\'') goto yy1120; + goto yy1107; +yy1124: + yych = *++YYCURSOR; + if (yych == '/') goto yy1115; + goto yy1107; +yy1125: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych >= ':') goto yy1107; + } else { + if (yych <= 'F') goto yy1126; + if (yych <= '`') goto yy1107; + if (yych >= 'g') goto yy1107; + } +yy1126: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych >= ':') goto yy1107; + } else { + if (yych <= 'F') goto yy1127; + if (yych <= '`') goto yy1107; + if (yych >= 'g') goto yy1107; + } +yy1127: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych >= ':') goto yy1107; + } else { + if (yych <= 'F') goto yy1128; + if (yych <= '`') goto yy1107; + if (yych >= 'g') goto yy1107; + } +yy1128: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych >= ':') goto yy1107; + } else { + if (yych <= 'F') goto yy1129; + if (yych <= '`') goto yy1107; + if (yych >= 'g') goto yy1107; + } +yy1129: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych >= ':') goto yy1107; + } else { + if (yych <= 'F') goto yy1130; + if (yych <= '`') goto yy1107; + if (yych >= 'g') goto yy1107; + } +yy1130: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych >= ':') goto yy1107; + } else { + if (yych <= 'F') goto yy1131; + if (yych <= '`') goto yy1107; + if (yych >= 'g') goto yy1107; + } +yy1131: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych <= '9') goto yy1115; + goto yy1107; + } else { + if (yych <= 'F') goto yy1115; + if (yych <= '`') goto yy1107; + if (yych <= 'f') goto yy1115; + goto yy1107; + } +yy1132: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych >= ':') goto yy1107; + } else { + if (yych <= 'F') goto yy1133; + if (yych <= '`') goto yy1107; + if (yych >= 'g') goto yy1107; + } +yy1133: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych >= ':') goto yy1107; + } else { + if (yych <= 'F') goto yy1134; + if (yych <= '`') goto yy1107; + if (yych >= 'g') goto yy1107; + } +yy1134: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1107; + if (yych <= '9') goto yy1115; + goto yy1107; + } else { + if (yych <= 'F') goto yy1115; + if (yych <= '`') goto yy1107; + if (yych <= 'f') goto yy1115; + goto yy1107; + } +yy1135: + yych = *++YYCURSOR; + if (yych != '/') goto yy1107; + ++YYCURSOR; + if ((yych = *YYCURSOR) <= '`') { + if (yych <= '7') { + if (yych <= '&') { + if (yych == '"') goto yy1115; + goto yy1107; + } else { + if (yych <= '\'') goto yy1115; + if (yych <= '/') goto yy1107; + goto yy1118; + } + } else { + if (yych <= 'T') { + if (yych == '?') goto yy1116; + goto yy1107; + } else { + if (yych <= 'U') goto yy1114; + if (yych == '\\') goto yy1115; + goto yy1107; + } + } + } else { + if (yych <= 'r') { + if (yych <= 'f') { + if (yych <= 'b') goto yy1115; + if (yych <= 'e') goto yy1107; + goto yy1115; + } else { + if (yych == 'n') goto yy1115; + if (yych <= 'q') goto yy1107; + goto yy1115; + } + } else { + if (yych <= 'u') { + if (yych <= 's') goto yy1107; + if (yych <= 't') goto yy1115; + goto yy1113; + } else { + if (yych <= 'v') goto yy1115; + if (yych == 'x') goto yy1117; + goto yy1107; + } + } + } +} +#line 488 "cpp.re" + +} + +/* this subscanner is invoked for C++0x extended character string literals */ +extstringlit: +{ + +#line 7824 "cpp_re.inc" +{ + YYCTYPE yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 16, 0, 16, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 0, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 16, 16, 16, 16, 16, 32, + 16, 144, 144, 144, 144, 144, 144, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 64, 16, 16, 16, + 16, 144, 144, 144, 144, 144, 144, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + }; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy1139; + if (yych <= '\t') goto yy1140; + goto yy1146; + } else { + if (yych <= '\f') goto yy1140; + if (yych <= '\r') goto yy1146; + } + } else { + if (yych <= '>') { + if (yych == '"') goto yy1144; + goto yy1140; + } else { + if (yych <= '?') goto yy1142; + if (yych == '\\') goto yy1143; + goto yy1140; + } + } +yy1139: + YYCURSOR = YYMARKER; + if (yyaccept <= 0) { + goto yy1141; + } else { + goto yy1145; + } +yy1140: + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '\n') { + if (yych == '\t') goto yy1150; + } else { + if (yych <= '\f') goto yy1150; + if (yych >= ' ') goto yy1150; + } +yy1141: +#line 499 "cpp.re" + { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); } +#line 7902 "cpp_re.inc" +yy1142: + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yybm[0+yych] & 32) { + goto yy1158; + } + if (yych <= '\n') { + if (yych == '\t') goto yy1150; + goto yy1141; + } else { + if (yych <= '\f') goto yy1150; + if (yych <= 0x1F) goto yy1141; + goto yy1150; + } +yy1143: + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if (yych <= '`') { + if (yych <= '7') { + if (yych <= '&') { + if (yych == '"') goto yy1149; + goto yy1141; + } else { + if (yych <= '\'') goto yy1149; + if (yych <= '/') goto yy1141; + goto yy1153; + } + } else { + if (yych <= 'T') { + if (yych == '?') goto yy1151; + goto yy1141; + } else { + if (yych <= 'U') goto yy1148; + if (yych == '\\') goto yy1149; + goto yy1141; + } + } + } else { + if (yych <= 'r') { + if (yych <= 'f') { + if (yych <= 'b') goto yy1149; + if (yych <= 'e') goto yy1141; + goto yy1149; + } else { + if (yych == 'n') goto yy1149; + if (yych <= 'q') goto yy1141; + goto yy1149; + } + } else { + if (yych <= 'u') { + if (yych <= 's') goto yy1141; + if (yych <= 't') goto yy1149; + goto yy1147; + } else { + if (yych <= 'v') goto yy1149; + if (yych == 'x') goto yy1152; + goto yy1141; + } + } + } +yy1144: + ++YYCURSOR; +yy1145: +#line 496 "cpp.re" + { BOOST_WAVE_RET(T_STRINGLIT); } +#line 7968 "cpp_re.inc" +yy1146: + yych = *++YYCURSOR; + goto yy1141; +yy1147: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych <= '9') goto yy1187; + goto yy1139; + } else { + if (yych <= 'F') goto yy1187; + if (yych <= '`') goto yy1139; + if (yych <= 'f') goto yy1187; + goto yy1139; + } +yy1148: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych <= '9') goto yy1180; + goto yy1139; + } else { + if (yych <= 'F') goto yy1180; + if (yych <= '`') goto yy1139; + if (yych <= 'f') goto yy1180; + goto yy1139; + } +yy1149: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy1150: + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1139; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1156; + goto yy1157; +yy1151: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1139; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1179; + goto yy1157; +yy1152: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy1166; + } + goto yy1139; +yy1153: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '"') { + if (yych <= '\n') { + if (yych == '\t') goto yy1149; + goto yy1139; + } else { + if (yych <= '\f') goto yy1149; + if (yych <= 0x1F) goto yy1139; + if (yych <= '!') goto yy1149; + goto yy1155; + } + } else { + if (yych <= '>') { + if (yych <= '/') goto yy1149; + if (yych >= '8') goto yy1149; + } else { + if (yych <= '?') goto yy1156; + if (yych == '\\') goto yy1157; + goto yy1149; + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1139; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1156; + goto yy1157; +yy1155: + yych = *++YYCURSOR; + goto yy1145; +yy1156: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1139; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1158; +yy1157: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '`') { + if (yych <= '7') { + if (yych <= '&') { + if (yych == '"') goto yy1149; + goto yy1139; + } else { + if (yych <= '\'') goto yy1149; + if (yych <= '/') goto yy1139; + goto yy1153; + } + } else { + if (yych <= 'T') { + if (yych == '?') goto yy1151; + goto yy1139; + } else { + if (yych <= 'U') goto yy1148; + if (yych == '\\') goto yy1149; + goto yy1139; + } + } + } else { + if (yych <= 'r') { + if (yych <= 'f') { + if (yych <= 'b') goto yy1149; + if (yych <= 'e') goto yy1139; + goto yy1149; + } else { + if (yych == 'n') goto yy1149; + if (yych <= 'q') goto yy1139; + goto yy1149; + } + } else { + if (yych <= 'u') { + if (yych <= 's') goto yy1139; + if (yych <= 't') goto yy1149; + goto yy1147; + } else { + if (yych <= 'v') goto yy1149; + if (yych == 'x') goto yy1152; + goto yy1139; + } + } + } +yy1158: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy1158; + } + if (yych <= '!') { + if (yych <= '\n') { + if (yych == '\t') goto yy1149; + goto yy1139; + } else { + if (yych <= '\f') goto yy1149; + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } + } else { + if (yych <= '/') { + if (yych <= '"') goto yy1155; + if (yych <= '.') goto yy1149; + } else { + if (yych == '\\') goto yy1157; + goto yy1149; + } + } +yy1160: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 64) { + goto yy1160; + } + if (yych <= '7') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1164; + if (yych <= '/') goto yy1149; + goto yy1153; + } + } + } else { + if (yych <= 'U') { + if (yych == '?') goto yy1165; + if (yych <= 'T') goto yy1149; + goto yy1163; + } else { + if (yych <= 'u') { + if (yych <= 't') goto yy1149; + } else { + if (yych == 'x') goto yy1166; + goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + goto yy1176; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + goto yy1176; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych <= 'f') goto yy1176; + goto yy1149; + } + } + } +yy1163: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + goto yy1169; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + goto yy1169; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych <= 'f') goto yy1169; + goto yy1149; + } + } + } +yy1164: + yyaccept = 1; + YYMARKER = ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1145; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1156; + goto yy1157; +yy1165: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1139; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1168; + goto yy1157; +yy1166: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy1166; + } + if (yych <= '!') { + if (yych <= '\n') { + if (yych == '\t') goto yy1149; + goto yy1139; + } else { + if (yych <= '\f') goto yy1149; + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } + } else { + if (yych <= '?') { + if (yych <= '"') goto yy1155; + if (yych <= '>') goto yy1149; + goto yy1156; + } else { + if (yych == '\\') goto yy1157; + goto yy1149; + } + } +yy1168: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 32) { + goto yy1158; + } + if (yych <= '!') { + if (yych <= '\n') { + if (yych == '\t') goto yy1149; + goto yy1139; + } else { + if (yych <= '\f') goto yy1149; + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } + } else { + if (yych <= '/') { + if (yych <= '"') goto yy1155; + if (yych <= '.') goto yy1149; + goto yy1160; + } else { + if (yych == '\\') goto yy1157; + goto yy1149; + } + } +yy1169: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych >= 'g') goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych >= 'g') goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych >= 'g') goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych >= 'g') goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych >= 'g') goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych >= 'g') goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1139; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1156; + goto yy1157; +yy1176: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych >= 'g') goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '9') { + if (yych <= '\f') { + if (yych == '\t') goto yy1149; + if (yych <= '\n') goto yy1139; + goto yy1149; + } else { + if (yych <= '!') { + if (yych <= 0x1F) goto yy1139; + goto yy1149; + } else { + if (yych <= '"') goto yy1155; + if (yych <= '/') goto yy1149; + } + } + } else { + if (yych <= 'F') { + if (yych == '?') goto yy1156; + if (yych <= '@') goto yy1149; + } else { + if (yych <= '\\') { + if (yych <= '[') goto yy1149; + goto yy1157; + } else { + if (yych <= '`') goto yy1149; + if (yych >= 'g') goto yy1149; + } + } + } + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1139; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1156; + goto yy1157; +yy1179: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 16) { + goto yy1149; + } + if (yych <= '!') goto yy1139; + if (yych <= '"') goto yy1155; + if (yych <= '[') goto yy1158; + goto yy1157; +yy1180: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych >= ':') goto yy1139; + } else { + if (yych <= 'F') goto yy1181; + if (yych <= '`') goto yy1139; + if (yych >= 'g') goto yy1139; + } +yy1181: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych >= ':') goto yy1139; + } else { + if (yych <= 'F') goto yy1182; + if (yych <= '`') goto yy1139; + if (yych >= 'g') goto yy1139; + } +yy1182: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych >= ':') goto yy1139; + } else { + if (yych <= 'F') goto yy1183; + if (yych <= '`') goto yy1139; + if (yych >= 'g') goto yy1139; + } +yy1183: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych >= ':') goto yy1139; + } else { + if (yych <= 'F') goto yy1184; + if (yych <= '`') goto yy1139; + if (yych >= 'g') goto yy1139; + } +yy1184: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych >= ':') goto yy1139; + } else { + if (yych <= 'F') goto yy1185; + if (yych <= '`') goto yy1139; + if (yych >= 'g') goto yy1139; + } +yy1185: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych >= ':') goto yy1139; + } else { + if (yych <= 'F') goto yy1186; + if (yych <= '`') goto yy1139; + if (yych >= 'g') goto yy1139; + } +yy1186: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych <= '9') goto yy1149; + goto yy1139; + } else { + if (yych <= 'F') goto yy1149; + if (yych <= '`') goto yy1139; + if (yych <= 'f') goto yy1149; + goto yy1139; + } +yy1187: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych >= ':') goto yy1139; + } else { + if (yych <= 'F') goto yy1188; + if (yych <= '`') goto yy1139; + if (yych >= 'g') goto yy1139; + } +yy1188: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych >= ':') goto yy1139; + } else { + if (yych <= 'F') goto yy1189; + if (yych <= '`') goto yy1139; + if (yych >= 'g') goto yy1139; + } +yy1189: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1139; + if (yych <= '9') goto yy1149; + goto yy1139; + } else { + if (yych <= 'F') goto yy1149; + if (yych <= '`') goto yy1139; + if (yych <= 'f') goto yy1149; + goto yy1139; + } +} +#line 500 "cpp.re" + +} + +extrawstringlit: +{ + +#line 8743 "cpp_re.inc" +{ + YYCTYPE yych; + static const unsigned char yybm[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 128, 128, 128, 128, 128, 128, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + }; + if ((YYLIMIT - YYCURSOR) < 12) YYFILL(12); + yych = *YYCURSOR; + if (yych <= 0x1F) { + if (yych <= '\n') { + if (yych <= 0x08) goto yy1192; + if (yych <= '\t') goto yy1193; + goto yy1197; + } else { + if (yych <= '\f') goto yy1193; + if (yych <= '\r') goto yy1199; + } + } else { + if (yych <= '>') { + if (yych == '"') goto yy1200; + goto yy1193; + } else { + if (yych <= '?') goto yy1195; + if (yych == '\\') goto yy1196; + goto yy1193; + } + } +yy1192: + YYCURSOR = YYMARKER; + goto yy1194; +yy1193: + ++YYCURSOR; +yy1194: +#line 507 "cpp.re" + { + goto extrawstringlit; + } +#line 8811 "cpp_re.inc" +yy1195: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '?') goto yy1221; + goto yy1194; +yy1196: + yych = *++YYCURSOR; + if (yych <= '`') { + if (yych <= '7') { + if (yych <= '&') { + if (yych == '"') goto yy1193; + goto yy1192; + } else { + if (yych <= '\'') goto yy1193; + if (yych <= '/') goto yy1192; + goto yy1206; + } + } else { + if (yych <= 'T') { + if (yych == '?') goto yy1204; + goto yy1192; + } else { + if (yych <= 'U') goto yy1203; + if (yych == '\\') goto yy1193; + goto yy1192; + } + } + } else { + if (yych <= 'r') { + if (yych <= 'f') { + if (yych <= 'b') goto yy1193; + if (yych <= 'e') goto yy1192; + goto yy1193; + } else { + if (yych == 'n') goto yy1193; + if (yych <= 'q') goto yy1192; + goto yy1193; + } + } else { + if (yych <= 'u') { + if (yych <= 's') goto yy1192; + if (yych <= 't') goto yy1193; + goto yy1202; + } else { + if (yych <= 'v') goto yy1193; + if (yych == 'x') goto yy1205; + goto yy1192; + } + } + } +yy1197: + ++YYCURSOR; +yy1198: +#line 512 "cpp.re" + { + s->line += count_backslash_newlines(s, cursor) +1; + cursor.column = 1; + goto extrawstringlit; + } +#line 8870 "cpp_re.inc" +yy1199: + yych = *++YYCURSOR; + if (yych == '\n') goto yy1197; + goto yy1198; +yy1200: + ++YYCURSOR; +#line 518 "cpp.re" + { BOOST_WAVE_RET(T_RAWSTRINGLIT); } +#line 8879 "cpp_re.inc" +yy1202: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych <= '9') goto yy1218; + goto yy1192; + } else { + if (yych <= 'F') goto yy1218; + if (yych <= '`') goto yy1192; + if (yych <= 'f') goto yy1218; + goto yy1192; + } +yy1203: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych <= '9') goto yy1211; + goto yy1192; + } else { + if (yych <= 'F') goto yy1211; + if (yych <= '`') goto yy1192; + if (yych <= 'f') goto yy1211; + goto yy1192; + } +yy1204: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '?') goto yy1210; + goto yy1194; +yy1205: + yych = *++YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy1208; + } + goto yy1192; +yy1206: + yych = *++YYCURSOR; + if (yych <= '/') goto yy1194; + if (yych >= '8') goto yy1194; + yych = *++YYCURSOR; + if (yych <= '/') goto yy1194; + if (yych <= '7') goto yy1193; + goto yy1194; +yy1208: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if (yybm[0+yych] & 128) { + goto yy1208; + } + goto yy1194; +yy1210: + yych = *++YYCURSOR; + if (yych == '/') goto yy1193; + goto yy1192; +yy1211: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych >= ':') goto yy1192; + } else { + if (yych <= 'F') goto yy1212; + if (yych <= '`') goto yy1192; + if (yych >= 'g') goto yy1192; + } +yy1212: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych >= ':') goto yy1192; + } else { + if (yych <= 'F') goto yy1213; + if (yych <= '`') goto yy1192; + if (yych >= 'g') goto yy1192; + } +yy1213: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych >= ':') goto yy1192; + } else { + if (yych <= 'F') goto yy1214; + if (yych <= '`') goto yy1192; + if (yych >= 'g') goto yy1192; + } +yy1214: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych >= ':') goto yy1192; + } else { + if (yych <= 'F') goto yy1215; + if (yych <= '`') goto yy1192; + if (yych >= 'g') goto yy1192; + } +yy1215: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych >= ':') goto yy1192; + } else { + if (yych <= 'F') goto yy1216; + if (yych <= '`') goto yy1192; + if (yych >= 'g') goto yy1192; + } +yy1216: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych >= ':') goto yy1192; + } else { + if (yych <= 'F') goto yy1217; + if (yych <= '`') goto yy1192; + if (yych >= 'g') goto yy1192; + } +yy1217: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych <= '9') goto yy1193; + goto yy1192; + } else { + if (yych <= 'F') goto yy1193; + if (yych <= '`') goto yy1192; + if (yych <= 'f') goto yy1193; + goto yy1192; + } +yy1218: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych >= ':') goto yy1192; + } else { + if (yych <= 'F') goto yy1219; + if (yych <= '`') goto yy1192; + if (yych >= 'g') goto yy1192; + } +yy1219: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych >= ':') goto yy1192; + } else { + if (yych <= 'F') goto yy1220; + if (yych <= '`') goto yy1192; + if (yych >= 'g') goto yy1192; + } +yy1220: + yych = *++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy1192; + if (yych <= '9') goto yy1193; + goto yy1192; + } else { + if (yych <= 'F') goto yy1193; + if (yych <= '`') goto yy1192; + if (yych <= 'f') goto yy1193; + goto yy1192; + } +yy1221: + ++YYCURSOR; + if ((yych = *YYCURSOR) == '/') goto yy1196; + goto yy1192; +} +#line 519 "cpp.re" + +} diff --git a/extern/shiny/Preprocessor/instantiate_cpp_exprgrammar.cpp b/extern/shiny/Preprocessor/instantiate_cpp_exprgrammar.cpp new file mode 100644 index 000000000..7318c29fa --- /dev/null +++ b/extern/shiny/Preprocessor/instantiate_cpp_exprgrammar.cpp @@ -0,0 +1,52 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include +#include + +#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + +#include +#include + +#include +#include + +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// Explicit instantiation of the expression_grammar_gen template with the +// correct lexer iterator type. This instantiates the corresponding parse +// function, which in turn instantiates the expression_grammar object (see +// wave/grammars/cpp_expression_grammar.hpp) +// +/////////////////////////////////////////////////////////////////////////////// + +// if you want to use your own token type the following line must be adjusted +typedef boost::wave::cpplexer::lex_token<> token_type; + +// no need to change anything below +template struct boost::wave::grammars::expression_grammar_gen; + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + +#endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + diff --git a/extern/shiny/Preprocessor/instantiate_cpp_grammar.cpp b/extern/shiny/Preprocessor/instantiate_cpp_grammar.cpp new file mode 100644 index 000000000..89cc3d7f3 --- /dev/null +++ b/extern/shiny/Preprocessor/instantiate_cpp_grammar.cpp @@ -0,0 +1,56 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include +#include + +#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + +#include +#include + +#include +#include + +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// Explicit instantiation of the cpp_grammar_gen template with the correct +// token type. This instantiates the corresponding pt_parse function, which +// in turn instantiates the cpp_grammar object +// (see wave/grammars/cpp_grammar.hpp) +// +/////////////////////////////////////////////////////////////////////////////// + +// if you want to use your own token type the following line must be adjusted +typedef boost::wave::cpplexer::lex_token<> token_type; + +// no need to change anything below +typedef boost::wave::cpplexer::lex_iterator lexer_type; +typedef std::list > + token_sequence_type; + +template struct boost::wave::grammars::cpp_grammar_gen; + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + +#endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + diff --git a/extern/shiny/Preprocessor/instantiate_cpp_literalgrs.cpp b/extern/shiny/Preprocessor/instantiate_cpp_literalgrs.cpp new file mode 100644 index 000000000..4fbfb87f2 --- /dev/null +++ b/extern/shiny/Preprocessor/instantiate_cpp_literalgrs.cpp @@ -0,0 +1,56 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include +#include + +#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + +#include + +#include +#include + +#include +#include +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// Explicit instantiation of the intlit_grammar_gen and chlit_grammar_gen +// templates with the correct token type. This instantiates the corresponding +// parse function, which in turn instantiates the corresponding parser object. +// +/////////////////////////////////////////////////////////////////////////////// + +typedef boost::wave::cpplexer::lex_token<> token_type; + +// no need to change anything below +template struct boost::wave::grammars::intlit_grammar_gen; +#if BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_AUTOSELECT || \ + BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_FORCE_SIGNED +template struct boost::wave::grammars::chlit_grammar_gen; +#endif +template struct boost::wave::grammars::chlit_grammar_gen; + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + +#endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + diff --git a/extern/shiny/Preprocessor/instantiate_defined_grammar.cpp b/extern/shiny/Preprocessor/instantiate_defined_grammar.cpp new file mode 100644 index 000000000..b7afe3f1e --- /dev/null +++ b/extern/shiny/Preprocessor/instantiate_defined_grammar.cpp @@ -0,0 +1,52 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include +#include + +#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + +#include + +#include +#include + +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// Explicit instantiation of the defined_grammar_gen template +// with the correct token type. This instantiates the corresponding parse +// function, which in turn instantiates the defined_grammar +// object (see wave/grammars/cpp_defined_grammar.hpp) +// +/////////////////////////////////////////////////////////////////////////////// + +// if you want to use your own token type the following line must be adjusted +typedef boost::wave::cpplexer::lex_token<> token_type; + +// no need to change anything below +typedef boost::wave::cpplexer::lex_iterator lexer_type; +template struct boost::wave::grammars::defined_grammar_gen; + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + +#endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + diff --git a/extern/shiny/Preprocessor/instantiate_predef_macros.cpp b/extern/shiny/Preprocessor/instantiate_predef_macros.cpp new file mode 100644 index 000000000..758ad9734 --- /dev/null +++ b/extern/shiny/Preprocessor/instantiate_predef_macros.cpp @@ -0,0 +1,52 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include +#include + +#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + +#include + +#include +#include + +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// Explicit instantiation of the predefined_macros_grammar_gen template +// with the correct token type. This instantiates the corresponding pt_parse +// function, which in turn instantiates the cpp_predefined_macros_grammar +// object (see wave/grammars/cpp_predef_macros_grammar.hpp) +// +/////////////////////////////////////////////////////////////////////////////// + +// if you want to use your own token type the following line must be adjusted +typedef boost::wave::cpplexer::lex_token<> token_type; + +// no need to change anything below +typedef boost::wave::cpplexer::lex_iterator lexer_type; +template struct boost::wave::grammars::predefined_macros_grammar_gen; + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + +#endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 + diff --git a/extern/shiny/Preprocessor/instantiate_re2c_lexer.cpp b/extern/shiny/Preprocessor/instantiate_re2c_lexer.cpp new file mode 100644 index 000000000..cd1b8898f --- /dev/null +++ b/extern/shiny/Preprocessor/instantiate_re2c_lexer.cpp @@ -0,0 +1,65 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + Explicit instantiation of the lex_functor generation function + + http://www.boost.org/ + + Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include +#include // configuration data + +#if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 + +#include + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// The following file needs to be included only once throughout the whole +// program. +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// This instantiates the correct 'new_lexer' function, which generates the +// C++ lexer used in this sample. You will have to instantiate the +// new_lexer_gen<> template with the same iterator type, as you have used for +// instantiating the boost::wave::context<> object. +// +// This is moved into a separate compilation unit to decouple the compilation +// of the C++ lexer from the compilation of the other modules, which helps to +// reduce compilation time. +// +// The template parameter(s) supplied should be identical to the first +// parameter supplied while instantiating the boost::wave::context<> template +// (see the file cpp.cpp). +// +/////////////////////////////////////////////////////////////////////////////// + +// if you want to use another iterator type for the underlying input stream +// a corresponding explicit template instantiation needs to be added below +template struct boost::wave::cpplexer::new_lexer_gen< + BOOST_WAVE_STRINGTYPE::iterator>; +template struct boost::wave::cpplexer::new_lexer_gen< + BOOST_WAVE_STRINGTYPE::const_iterator>; + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + +#endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 diff --git a/extern/shiny/Preprocessor/instantiate_re2c_lexer_str.cpp b/extern/shiny/Preprocessor/instantiate_re2c_lexer_str.cpp new file mode 100644 index 000000000..138ed6c3b --- /dev/null +++ b/extern/shiny/Preprocessor/instantiate_re2c_lexer_str.cpp @@ -0,0 +1,64 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + Explicit instantiation of the lex_functor generation function + + http://www.boost.org/ + + Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include +#include // configuration data + +#if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 + +#include + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// The following file needs to be included only once throughout the whole +// program. +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// If you've used another iterator type as std::string::iterator, you have to +// instantiate the new_lexer_gen<> template for this iterator type too. +// The reason is, that the library internally uses the new_lexer_gen<> +// template with a std::string::iterator. (You just have to undefine the +// following line.) +// +// This is moved into a separate compilation unit to decouple the compilation +// of the C++ lexer from the compilation of the other modules, which helps to +// reduce compilation time. +// +// The template parameter(s) supplied should be identical to the first +// parameter supplied while instantiating the boost::wave::context<> template +// (see the file cpp.cpp). +// +/////////////////////////////////////////////////////////////////////////////// + +#if !defined(BOOST_WAVE_STRINGTYPE_USE_STDSTRING) +template struct boost::wave::cpplexer::new_lexer_gen; +template struct boost::wave::cpplexer::new_lexer_gen; +#endif + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + +#endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 diff --git a/extern/shiny/Preprocessor/token_ids.cpp b/extern/shiny/Preprocessor/token_ids.cpp new file mode 100644 index 000000000..35e7725b4 --- /dev/null +++ b/extern/shiny/Preprocessor/token_ids.cpp @@ -0,0 +1,447 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + The definition of a default set of token identifiers and related + functions. + + http://www.boost.org/ + + Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define BOOST_WAVE_SOURCE 1 + +// disable stupid compiler warnings +#include + +#include +#include +#include + +#include +#include + +// this must occur after all of the includes and before any code appears +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_PREFIX +#endif + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { +namespace wave { + +/////////////////////////////////////////////////////////////////////////////// +// return a token name +BOOST_WAVE_STRINGTYPE +get_token_name(token_id tokid) +{ +// Table of token names +// +// Please note that the sequence of token names must match the sequence of +// token id's defined in then enum token_id above. +static char const *tok_names[] = { + /* 256 */ "AND", + /* 257 */ "ANDAND", + /* 258 */ "ASSIGN", + /* 259 */ "ANDASSIGN", + /* 260 */ "OR", + /* 261 */ "ORASSIGN", + /* 262 */ "XOR", + /* 263 */ "XORASSIGN", + /* 264 */ "COMMA", + /* 265 */ "COLON", + /* 266 */ "DIVIDE", + /* 267 */ "DIVIDEASSIGN", + /* 268 */ "DOT", + /* 269 */ "DOTSTAR", + /* 270 */ "ELLIPSIS", + /* 271 */ "EQUAL", + /* 272 */ "GREATER", + /* 273 */ "GREATEREQUAL", + /* 274 */ "LEFTBRACE", + /* 275 */ "LESS", + /* 276 */ "LESSEQUAL", + /* 277 */ "LEFTPAREN", + /* 278 */ "LEFTBRACKET", + /* 279 */ "MINUS", + /* 280 */ "MINUSASSIGN", + /* 281 */ "MINUSMINUS", + /* 282 */ "PERCENT", + /* 283 */ "PERCENTASSIGN", + /* 284 */ "NOT", + /* 285 */ "NOTEQUAL", + /* 286 */ "OROR", + /* 287 */ "PLUS", + /* 288 */ "PLUSASSIGN", + /* 289 */ "PLUSPLUS", + /* 290 */ "ARROW", + /* 291 */ "ARROWSTAR", + /* 292 */ "QUESTION_MARK", + /* 293 */ "RIGHTBRACE", + /* 294 */ "RIGHTPAREN", + /* 295 */ "RIGHTBRACKET", + /* 296 */ "COLON_COLON", + /* 297 */ "SEMICOLON", + /* 298 */ "SHIFTLEFT", + /* 299 */ "SHIFTLEFTASSIGN", + /* 300 */ "SHIFTRIGHT", + /* 301 */ "SHIFTRIGHTASSIGN", + /* 302 */ "STAR", + /* 303 */ "COMPL", + /* 304 */ "STARASSIGN", + /* 305 */ "ASM", + /* 306 */ "AUTO", + /* 307 */ "BOOL", + /* 308 */ "FALSE", + /* 309 */ "TRUE", + /* 310 */ "BREAK", + /* 311 */ "CASE", + /* 312 */ "CATCH", + /* 313 */ "CHAR", + /* 314 */ "CLASS", + /* 315 */ "CONST", + /* 316 */ "CONSTCAST", + /* 317 */ "CONTINUE", + /* 318 */ "DEFAULT", + /* 319 */ "DELETE", + /* 320 */ "DO", + /* 321 */ "DOUBLE", + /* 322 */ "DYNAMICCAST", + /* 323 */ "ELSE", + /* 324 */ "ENUM", + /* 325 */ "EXPLICIT", + /* 326 */ "EXPORT", + /* 327 */ "EXTERN", + /* 328 */ "FLOAT", + /* 329 */ "FOR", + /* 330 */ "FRIEND", + /* 331 */ "GOTO", + /* 332 */ "IF", + /* 333 */ "INLINE", + /* 334 */ "INT", + /* 335 */ "LONG", + /* 336 */ "MUTABLE", + /* 337 */ "NAMESPACE", + /* 338 */ "NEW", + /* 339 */ "OPERATOR", + /* 340 */ "PRIVATE", + /* 341 */ "PROTECTED", + /* 342 */ "PUBLIC", + /* 343 */ "REGISTER", + /* 344 */ "REINTERPRETCAST", + /* 345 */ "RETURN", + /* 346 */ "SHORT", + /* 347 */ "SIGNED", + /* 348 */ "SIZEOF", + /* 349 */ "STATIC", + /* 350 */ "STATICCAST", + /* 351 */ "STRUCT", + /* 352 */ "SWITCH", + /* 353 */ "TEMPLATE", + /* 354 */ "THIS", + /* 355 */ "THROW", + /* 356 */ "TRY", + /* 357 */ "TYPEDEF", + /* 358 */ "TYPEID", + /* 359 */ "TYPENAME", + /* 360 */ "UNION", + /* 361 */ "UNSIGNED", + /* 362 */ "USING", + /* 363 */ "VIRTUAL", + /* 364 */ "VOID", + /* 365 */ "VOLATILE", + /* 366 */ "WCHART", + /* 367 */ "WHILE", + /* 368 */ "PP_DEFINE", + /* 369 */ "PP_IF", + /* 370 */ "PP_IFDEF", + /* 371 */ "PP_IFNDEF", + /* 372 */ "PP_ELSE", + /* 373 */ "PP_ELIF", + /* 374 */ "PP_ENDIF", + /* 375 */ "PP_ERROR", + /* 376 */ "PP_LINE", + /* 377 */ "PP_PRAGMA", + /* 378 */ "PP_UNDEF", + /* 379 */ "PP_WARNING", + /* 380 */ "IDENTIFIER", + /* 381 */ "OCTALINT", + /* 382 */ "DECIMALINT", + /* 383 */ "HEXAINT", + /* 384 */ "INTLIT", + /* 385 */ "LONGINTLIT", + /* 386 */ "FLOATLIT", + /* 387 */ "CCOMMENT", + /* 388 */ "CPPCOMMENT", + /* 389 */ "CHARLIT", + /* 390 */ "STRINGLIT", + /* 391 */ "CONTLINE", + /* 392 */ "SPACE", + /* 393 */ "SPACE2", + /* 394 */ "NEWLINE", + /* 395 */ "POUND_POUND", + /* 396 */ "POUND", + /* 397 */ "ANY", + /* 398 */ "PP_INCLUDE", + /* 399 */ "PP_QHEADER", + /* 400 */ "PP_HHEADER", + /* 401 */ "EOF", + /* 402 */ "EOI", + /* 403 */ "PP_NUMBER", + + // MS extensions + /* 404 */ "MSEXT_INT8", + /* 405 */ "MSEXT_INT16", + /* 406 */ "MSEXT_INT32", + /* 407 */ "MSEXT_INT64", + /* 408 */ "MSEXT_BASED", + /* 409 */ "MSEXT_DECLSPEC", + /* 410 */ "MSEXT_CDECL", + /* 411 */ "MSEXT_FASTCALL", + /* 412 */ "MSEXT_STDCALL", + /* 413 */ "MSEXT_TRY", + /* 414 */ "MSEXT_EXCEPT", + /* 415 */ "MSEXT_FINALLY", + /* 416 */ "MSEXT_LEAVE", + /* 417 */ "MSEXT_INLINE", + /* 418 */ "MSEXT_ASM", + /* 419 */ "MSEXT_REGION", + /* 420 */ "MSEXT_ENDREGION", + + /* 421 */ "IMPORT", + + /* 422 */ "ALIGNAS", + /* 423 */ "ALIGNOF", + /* 424 */ "CHAR16_T", + /* 425 */ "CHAR32_T", + /* 426 */ "CONSTEXPR", + /* 427 */ "DECLTYPE", + /* 428 */ "NOEXCEPT", + /* 429 */ "NULLPTR", + /* 430 */ "STATIC_ASSERT", + /* 431 */ "THREADLOCAL", + /* 432 */ "RAWSTRINGLIT", + }; + + // make sure, I have not forgotten any commas (as I did more than once) + BOOST_STATIC_ASSERT( + sizeof(tok_names)/sizeof(tok_names[0]) == T_LAST_TOKEN-T_FIRST_TOKEN + ); + + unsigned int id = BASEID_FROM_TOKEN(tokid)-T_FIRST_TOKEN; + return (id < T_LAST_TOKEN-T_FIRST_TOKEN) ? tok_names[id] : ""; +} + +/////////////////////////////////////////////////////////////////////////////// +// return a token name +char const * +get_token_value(token_id tokid) +{ +// Table of token values +// +// Please note that the sequence of token names must match the sequence of +// token id's defined in then enum token_id above. +static char const *tok_values[] = { + /* 256 */ "&", + /* 257 */ "&&", + /* 258 */ "=", + /* 259 */ "&=", + /* 260 */ "|", + /* 261 */ "|=", + /* 262 */ "^", + /* 263 */ "^=", + /* 264 */ ",", + /* 265 */ ":", + /* 266 */ "/", + /* 267 */ "/=", + /* 268 */ ".", + /* 269 */ ".*", + /* 270 */ "...", + /* 271 */ "==", + /* 272 */ ">", + /* 273 */ ">=", + /* 274 */ "{", + /* 275 */ "<", + /* 276 */ "<=", + /* 277 */ "(", + /* 278 */ "[", + /* 279 */ "-", + /* 280 */ "-=", + /* 281 */ "--", + /* 282 */ "%", + /* 283 */ "%=", + /* 284 */ "!", + /* 285 */ "!=", + /* 286 */ "||", + /* 287 */ "+", + /* 288 */ "+=", + /* 289 */ "++", + /* 290 */ "->", + /* 291 */ "->*", + /* 292 */ "?", + /* 293 */ "}", + /* 294 */ ")", + /* 295 */ "]", + /* 296 */ "::", + /* 297 */ ";", + /* 298 */ "<<", + /* 299 */ "<<=", + /* 300 */ ">>", + /* 301 */ ">>=", + /* 302 */ "*", + /* 303 */ "~", + /* 304 */ "*=", + /* 305 */ "asm", + /* 306 */ "auto", + /* 307 */ "bool", + /* 308 */ "false", + /* 309 */ "true", + /* 310 */ "break", + /* 311 */ "case", + /* 312 */ "catch", + /* 313 */ "char", + /* 314 */ "class", + /* 315 */ "const", + /* 316 */ "const_cast", + /* 317 */ "continue", + /* 318 */ "default", + /* 319 */ "delete", + /* 320 */ "do", + /* 321 */ "double", + /* 322 */ "dynamic_cast", + /* 323 */ "else", + /* 324 */ "enum", + /* 325 */ "explicit", + /* 326 */ "export", + /* 327 */ "extern", + /* 328 */ "float", + /* 329 */ "for", + /* 330 */ "friend", + /* 331 */ "goto", + /* 332 */ "if", + /* 333 */ "inline", + /* 334 */ "int", + /* 335 */ "long", + /* 336 */ "mutable", + /* 337 */ "namespace", + /* 338 */ "new", + /* 339 */ "operator", + /* 340 */ "private", + /* 341 */ "protected", + /* 342 */ "public", + /* 343 */ "register", + /* 344 */ "reinterpret_cast", + /* 345 */ "return", + /* 346 */ "short", + /* 347 */ "signed", + /* 348 */ "sizeof", + /* 349 */ "static", + /* 350 */ "static_cast", + /* 351 */ "struct", + /* 352 */ "switch", + /* 353 */ "template", + /* 354 */ "this", + /* 355 */ "throw", + /* 356 */ "try", + /* 357 */ "typedef", + /* 358 */ "typeid", + /* 359 */ "typename", + /* 360 */ "union", + /* 361 */ "unsigned", + /* 362 */ "using", + /* 363 */ "virtual", + /* 364 */ "void", + /* 365 */ "volatile", + /* 366 */ "wchar_t", + /* 367 */ "while", + /* 368 */ "#define", + /* 369 */ "#if", + /* 370 */ "#ifdef", + /* 371 */ "#ifndef", + /* 372 */ "#else", + /* 373 */ "#elif", + /* 374 */ "#endif", + /* 375 */ "#error", + /* 376 */ "#line", + /* 377 */ "#pragma", + /* 378 */ "#undef", + /* 379 */ "#warning", + /* 380 */ "", // identifier + /* 381 */ "", // octalint + /* 382 */ "", // decimalint + /* 383 */ "", // hexlit + /* 384 */ "", // intlit + /* 385 */ "", // longintlit + /* 386 */ "", // floatlit + /* 387 */ "", // ccomment + /* 388 */ "", // cppcomment + /* 389 */ "", // charlit + /* 390 */ "", // stringlit + /* 391 */ "", // contline + /* 392 */ "", // space + /* 393 */ "", // space2 + /* 394 */ "\n", + /* 395 */ "##", + /* 396 */ "#", + /* 397 */ "", // any + /* 398 */ "#include", + /* 399 */ "#include", + /* 400 */ "#include", + /* 401 */ "", // eof + /* 402 */ "", // eoi + /* 403 */ "", // pp-number + + // MS extensions + /* 404 */ "__int8", + /* 405 */ "__int16", + /* 406 */ "__int32", + /* 407 */ "__int64", + /* 408 */ "__based", + /* 409 */ "__declspec", + /* 410 */ "__cdecl", + /* 411 */ "__fastcall", + /* 412 */ "__stdcall", + /* 413 */ "__try", + /* 414 */ "__except", + /* 415 */ "__finally", + /* 416 */ "__leave", + /* 417 */ "__inline", + /* 418 */ "__asm", + /* 419 */ "#region", + /* 420 */ "#endregion", + + /* 421 */ "import", + + /* 422 */ "alignas", + /* 423 */ "alignof", + /* 424 */ "char16_t", + /* 425 */ "char32_t", + /* 426 */ "constexpr", + /* 427 */ "decltype", + /* 428 */ "noexcept", + /* 429 */ "nullptr", + /* 430 */ "static_assert", + /* 431 */ "threadlocal", + /* 432 */ "", // extrawstringlit + }; + + // make sure, I have not forgotten any commas (as I did more than once) + BOOST_STATIC_ASSERT( + sizeof(tok_values)/sizeof(tok_values[0]) == T_LAST_TOKEN-T_FIRST_TOKEN + ); + + unsigned int id = BASEID_FROM_TOKEN(tokid)-T_FIRST_TOKEN; + return (id < T_LAST_TOKEN-T_FIRST_TOKEN) ? tok_values[id] : ""; +} + +/////////////////////////////////////////////////////////////////////////////// +} // namespace wave +} // namespace boost + +// the suffix header occurs after all of the code +#ifdef BOOST_HAS_ABI_HEADERS +#include BOOST_ABI_SUFFIX +#endif + + diff --git a/extern/shiny/Readme.txt b/extern/shiny/Readme.txt new file mode 100644 index 000000000..613321990 --- /dev/null +++ b/extern/shiny/Readme.txt @@ -0,0 +1,33 @@ +shiny - a shader and material management library for OGRE + +FEATURES + +- High-level layer on top of OGRE's material system. It allows you to generate multiple techniques for all your materials from a set of high-level per-material properties. + +- Several available Macros in shader source files. Just a few examples of the possibilities: binding OGRE auto constants, binding uniforms to material properties, foreach loops (repeat shader source a given number of times), retrieving per-material properties in an #if condition, automatic packing for vertex to fragment passthroughs. These macros allow you to generate even very complex shaders (for example the Ogre::Terrain shader) without assembling them in C++ code. + +- Integrated preprocessor (no, I didn't reinvent the wheel, I used boost::wave which turned out to be an excellent choice) that allows me to blend out macros that shouldn't be in use because e.g. the shader permutation doesn't need this specific feature. + +- User settings integration. They can be set by a C++ interface and retrieved through a macro in shader files. + +- Automatic handling of shader permutations, i.e. shaders are shared between materials in a smart way. + +- An optional "meta-language" (well, actually it's just a small header with some conditional defines) that you may use to compile the same shader source for different target languages. If you don't like it, you can still code in GLSL / CG etc separately. You can also switch between the languages at runtime. + +- On-demand material and shader creation. It uses Ogre's material listener to compile the shaders as soon as they are needed for rendering, and not earlier. + +- Shader changes are fully dynamic and real-time. Changing a user setting will recompile all shaders affected by this setting when they are next needed. + +- Serialization system that extends Ogre's material script system, it uses Ogre's script parser, but also adds some additional properties that are not available in Ogre's material system. + +- A concept called "Configuration" allowing you to create a different set of your shaders, doing the same thing except for some minor differences: the properties that are overridden by the active configuration. Possible uses for this are using simpler shaders (no shadows, no fog etc) when rendering for example realtime reflections or a minimap. You can easily switch between configurations by changing the active Ogre material scheme (for example on a viewport level). + +- Fixed function support. You can globally enable or disable shaders at any time, and for texture units you can specify if they're only needed for the shader-based path (e.g. normal maps) or if they should also be created in the fixed function path. + +LICENSE + +see License.txt + +AUTHOR + +scrawl From f029a9011aea60f54ad63617cb9eaf3613ee72b0 Mon Sep 17 00:00:00 2001 From: Michal Sciubidlo Date: Sun, 27 Jan 2013 22:40:38 +0100 Subject: [PATCH 15/43] Move datafilespage to shared space. --- apps/launcher/CMakeLists.txt | 33 ------------------- apps/launcher/graphicspage.cpp | 3 +- apps/launcher/maindialog.cpp | 3 +- cmake/OpenMWMacros.cmake | 16 +++++++++ components/CMakeLists.txt | 12 ++++++- .../file_order_list}/datafilespage.cpp | 0 .../file_order_list}/datafilespage.hpp | 0 .../file_order_list}/model/datafilesmodel.cpp | 0 .../file_order_list}/model/datafilesmodel.hpp | 0 .../file_order_list}/model/esm/esmfile.cpp | 0 .../file_order_list}/model/esm/esmfile.hpp | 0 .../file_order_list}/model/modelitem.cpp | 0 .../file_order_list}/model/modelitem.hpp | 0 .../file_order_list}/utils/filedialog.cpp | 0 .../file_order_list}/utils/filedialog.hpp | 0 .../file_order_list}/utils/lineedit.cpp | 0 .../file_order_list}/utils/lineedit.hpp | 0 .../file_order_list}/utils/naturalsort.cpp | 0 .../file_order_list}/utils/naturalsort.hpp | 0 .../utils/profilescombobox.cpp | 0 .../utils/profilescombobox.hpp | 0 .../utils/textinputdialog.cpp | 0 .../utils/textinputdialog.hpp | 0 23 files changed, 30 insertions(+), 37 deletions(-) rename {apps/launcher => components/file_order_list}/datafilespage.cpp (100%) rename {apps/launcher => components/file_order_list}/datafilespage.hpp (100%) rename {apps/launcher => components/file_order_list}/model/datafilesmodel.cpp (100%) rename {apps/launcher => components/file_order_list}/model/datafilesmodel.hpp (100%) rename {apps/launcher => components/file_order_list}/model/esm/esmfile.cpp (100%) rename {apps/launcher => components/file_order_list}/model/esm/esmfile.hpp (100%) rename {apps/launcher => components/file_order_list}/model/modelitem.cpp (100%) rename {apps/launcher => components/file_order_list}/model/modelitem.hpp (100%) rename {apps/launcher => components/file_order_list}/utils/filedialog.cpp (100%) rename {apps/launcher => components/file_order_list}/utils/filedialog.hpp (100%) rename {apps/launcher => components/file_order_list}/utils/lineedit.cpp (100%) rename {apps/launcher => components/file_order_list}/utils/lineedit.hpp (100%) rename {apps/launcher => components/file_order_list}/utils/naturalsort.cpp (100%) rename {apps/launcher => components/file_order_list}/utils/naturalsort.hpp (100%) rename {apps/launcher => components/file_order_list}/utils/profilescombobox.cpp (100%) rename {apps/launcher => components/file_order_list}/utils/profilescombobox.hpp (100%) rename {apps/launcher => components/file_order_list}/utils/textinputdialog.cpp (100%) rename {apps/launcher => components/file_order_list}/utils/textinputdialog.hpp (100%) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 09beaf59d..73efb9ee5 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -1,56 +1,23 @@ set(LAUNCHER - datafilespage.cpp graphicspage.cpp main.cpp maindialog.cpp playpage.cpp - model/datafilesmodel.cpp - model/modelitem.cpp - model/esm/esmfile.cpp - - utils/filedialog.cpp - utils/naturalsort.cpp - utils/lineedit.cpp - utils/profilescombobox.cpp - utils/textinputdialog.cpp - launcher.rc ) set(LAUNCHER_HEADER - datafilespage.hpp graphicspage.hpp maindialog.hpp playpage.hpp - - model/datafilesmodel.hpp - model/modelitem.hpp - model/esm/esmfile.hpp - - utils/lineedit.hpp - utils/filedialog.hpp - utils/naturalsort.hpp - utils/profilescombobox.hpp - utils/textinputdialog.hpp - ) # Headers that must be pre-processed set(LAUNCHER_HEADER_MOC - datafilespage.hpp graphicspage.hpp maindialog.hpp playpage.hpp - - model/datafilesmodel.hpp - model/modelitem.hpp - model/esm/esmfile.hpp - - utils/lineedit.hpp - utils/filedialog.hpp - utils/profilescombobox.hpp - utils/textinputdialog.hpp ) source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER} ${LAUNCHER_HEADER_MOC}) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 2c4f3430c..e69a8c207 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -8,8 +8,7 @@ #include #include #include - -#include "utils/naturalsort.hpp" +#include #include "graphicspage.hpp" diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 674ccdf67..7eb31e76b 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -1,9 +1,10 @@ #include +#include + #include "maindialog.hpp" #include "playpage.hpp" #include "graphicspage.hpp" -#include "datafilespage.hpp" MainDialog::MainDialog() { diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake index e6f45fdb1..398363667 100644 --- a/cmake/OpenMWMacros.cmake +++ b/cmake/OpenMWMacros.cmake @@ -23,6 +23,22 @@ endforeach (u) source_group ("components\\${dir}" FILES ${files}) endmacro (add_component_dir) +macro (add_component_qt_dir dir) +set (files) +foreach (u ${ARGN}) +file (GLOB ALL ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.[ch]pp") +foreach (f ${ALL}) +list (APPEND files "${f}") +list (APPEND COMPONENT_FILES "${f}") +endforeach (f) +file (GLOB MOC_H ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.hpp") +foreach (fi ${MOC_H}) +list (APPEND COMPONENT_MOC_FILES "${fi}") +endforeach (fi) +endforeach (u) +source_group ("components\\${dir}" FILES ${files}) +endmacro (add_component_qt_dir) + macro (copy_all_files source_dir destination_dir files) foreach (f ${files}) get_filename_component(filename ${f} NAME) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 3da09ecb8..a6812dbb3 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -66,9 +66,19 @@ add_component_dir (translation translation ) +add_component_qt_dir (file_order_list + datafilespage model/modelitem model/datafilesmodel model/esm/esmfile + utils/filedialog utils/lineedit utils/profilescombobox utils/textinputdialog utils/naturalsort + ) + +find_package(Qt4 COMPONENTS QtCore QtGUI REQUIRED) +include(${QT_USE_FILE}) + +QT4_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES}) + include_directories(${BULLET_INCLUDE_DIRS}) -add_library(components STATIC ${COMPONENT_FILES}) +add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS}) target_link_libraries(components ${Boost_LIBRARIES} ${OGRE_LIBRARIES}) diff --git a/apps/launcher/datafilespage.cpp b/components/file_order_list/datafilespage.cpp similarity index 100% rename from apps/launcher/datafilespage.cpp rename to components/file_order_list/datafilespage.cpp diff --git a/apps/launcher/datafilespage.hpp b/components/file_order_list/datafilespage.hpp similarity index 100% rename from apps/launcher/datafilespage.hpp rename to components/file_order_list/datafilespage.hpp diff --git a/apps/launcher/model/datafilesmodel.cpp b/components/file_order_list/model/datafilesmodel.cpp similarity index 100% rename from apps/launcher/model/datafilesmodel.cpp rename to components/file_order_list/model/datafilesmodel.cpp diff --git a/apps/launcher/model/datafilesmodel.hpp b/components/file_order_list/model/datafilesmodel.hpp similarity index 100% rename from apps/launcher/model/datafilesmodel.hpp rename to components/file_order_list/model/datafilesmodel.hpp diff --git a/apps/launcher/model/esm/esmfile.cpp b/components/file_order_list/model/esm/esmfile.cpp similarity index 100% rename from apps/launcher/model/esm/esmfile.cpp rename to components/file_order_list/model/esm/esmfile.cpp diff --git a/apps/launcher/model/esm/esmfile.hpp b/components/file_order_list/model/esm/esmfile.hpp similarity index 100% rename from apps/launcher/model/esm/esmfile.hpp rename to components/file_order_list/model/esm/esmfile.hpp diff --git a/apps/launcher/model/modelitem.cpp b/components/file_order_list/model/modelitem.cpp similarity index 100% rename from apps/launcher/model/modelitem.cpp rename to components/file_order_list/model/modelitem.cpp diff --git a/apps/launcher/model/modelitem.hpp b/components/file_order_list/model/modelitem.hpp similarity index 100% rename from apps/launcher/model/modelitem.hpp rename to components/file_order_list/model/modelitem.hpp diff --git a/apps/launcher/utils/filedialog.cpp b/components/file_order_list/utils/filedialog.cpp similarity index 100% rename from apps/launcher/utils/filedialog.cpp rename to components/file_order_list/utils/filedialog.cpp diff --git a/apps/launcher/utils/filedialog.hpp b/components/file_order_list/utils/filedialog.hpp similarity index 100% rename from apps/launcher/utils/filedialog.hpp rename to components/file_order_list/utils/filedialog.hpp diff --git a/apps/launcher/utils/lineedit.cpp b/components/file_order_list/utils/lineedit.cpp similarity index 100% rename from apps/launcher/utils/lineedit.cpp rename to components/file_order_list/utils/lineedit.cpp diff --git a/apps/launcher/utils/lineedit.hpp b/components/file_order_list/utils/lineedit.hpp similarity index 100% rename from apps/launcher/utils/lineedit.hpp rename to components/file_order_list/utils/lineedit.hpp diff --git a/apps/launcher/utils/naturalsort.cpp b/components/file_order_list/utils/naturalsort.cpp similarity index 100% rename from apps/launcher/utils/naturalsort.cpp rename to components/file_order_list/utils/naturalsort.cpp diff --git a/apps/launcher/utils/naturalsort.hpp b/components/file_order_list/utils/naturalsort.hpp similarity index 100% rename from apps/launcher/utils/naturalsort.hpp rename to components/file_order_list/utils/naturalsort.hpp diff --git a/apps/launcher/utils/profilescombobox.cpp b/components/file_order_list/utils/profilescombobox.cpp similarity index 100% rename from apps/launcher/utils/profilescombobox.cpp rename to components/file_order_list/utils/profilescombobox.cpp diff --git a/apps/launcher/utils/profilescombobox.hpp b/components/file_order_list/utils/profilescombobox.hpp similarity index 100% rename from apps/launcher/utils/profilescombobox.hpp rename to components/file_order_list/utils/profilescombobox.hpp diff --git a/apps/launcher/utils/textinputdialog.cpp b/components/file_order_list/utils/textinputdialog.cpp similarity index 100% rename from apps/launcher/utils/textinputdialog.cpp rename to components/file_order_list/utils/textinputdialog.cpp diff --git a/apps/launcher/utils/textinputdialog.hpp b/components/file_order_list/utils/textinputdialog.hpp similarity index 100% rename from apps/launcher/utils/textinputdialog.hpp rename to components/file_order_list/utils/textinputdialog.hpp From ac62dd050d31066ed1c40655bd167e22ff5d2b81 Mon Sep 17 00:00:00 2001 From: Michal Sciubidlo Date: Wed, 30 Jan 2013 21:08:27 +0100 Subject: [PATCH 16/43] Rename datafilespage to datafileslist --- apps/launcher/maindialog.cpp | 20 +++++----- apps/launcher/maindialog.hpp | 4 +- components/CMakeLists.txt | 2 +- .../{datafilespage.cpp => datafileslist.cpp} | 38 +++++++++---------- .../{datafilespage.hpp => datafileslist.hpp} | 8 ++-- 5 files changed, 36 insertions(+), 36 deletions(-) rename components/file_order_list/{datafilespage.cpp => datafileslist.cpp} (97%) rename components/file_order_list/{datafilespage.hpp => datafileslist.hpp} (92%) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 7eb31e76b..43b8f317a 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include "maindialog.hpp" #include "playpage.hpp" @@ -124,16 +124,16 @@ void MainDialog::createPages() { mPlayPage = new PlayPage(this); mGraphicsPage = new GraphicsPage(mCfgMgr, this); - mDataFilesPage = new DataFilesPage(mCfgMgr, this); + mDataFilesList = new DataFilesList(mCfgMgr, this); // Set the combobox of the play page to imitate the combobox on the datafilespage - mPlayPage->mProfilesComboBox->setModel(mDataFilesPage->mProfilesComboBox->model()); - mPlayPage->mProfilesComboBox->setCurrentIndex(mDataFilesPage->mProfilesComboBox->currentIndex()); + mPlayPage->mProfilesComboBox->setModel(mDataFilesList->mProfilesComboBox->model()); + mPlayPage->mProfilesComboBox->setCurrentIndex(mDataFilesList->mProfilesComboBox->currentIndex()); // Add the pages to the stacked widget mPagesWidget->addWidget(mPlayPage); mPagesWidget->addWidget(mGraphicsPage); - mPagesWidget->addWidget(mDataFilesPage); + mPagesWidget->addWidget(mDataFilesList); // Select the first page mIconWidget->setCurrentItem(mIconWidget->item(0), QItemSelectionModel::Select); @@ -142,9 +142,9 @@ void MainDialog::createPages() connect(mPlayPage->mProfilesComboBox, SIGNAL(currentIndexChanged(int)), - mDataFilesPage->mProfilesComboBox, SLOT(setCurrentIndex(int))); + mDataFilesList->mProfilesComboBox, SLOT(setCurrentIndex(int))); - connect(mDataFilesPage->mProfilesComboBox, + connect(mDataFilesList->mProfilesComboBox, SIGNAL(currentIndexChanged(int)), mPlayPage->mProfilesComboBox, SLOT(setCurrentIndex(int))); @@ -190,7 +190,7 @@ bool MainDialog::setup() } // Setup the Data Files page - if (!mDataFilesPage->setupDataFiles()) { + if (!mDataFilesList->setupDataFiles()) { return false; } @@ -208,7 +208,7 @@ void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) void MainDialog::closeEvent(QCloseEvent *event) { // Now write all config files - mDataFilesPage->writeConfig(); + mDataFilesList->writeConfig(); mGraphicsPage->writeConfig(); // Save user settings @@ -221,7 +221,7 @@ void MainDialog::closeEvent(QCloseEvent *event) void MainDialog::play() { // First do a write of all the configs, just to be sure - mDataFilesPage->writeConfig(); + mDataFilesList->writeConfig(); mGraphicsPage->writeConfig(); // Save user settings diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index bf98011cc..5a39c11a9 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -15,7 +15,7 @@ class QString; class PlayPage; class GraphicsPage; -class DataFilesPage; +class DataFilesList; class MainDialog : public QMainWindow { @@ -39,7 +39,7 @@ private: PlayPage *mPlayPage; GraphicsPage *mGraphicsPage; - DataFilesPage *mDataFilesPage; + DataFilesList *mDataFilesList; Files::ConfigurationManager mCfgMgr; Settings::Manager mSettings; diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index a6812dbb3..3798f66b7 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -67,7 +67,7 @@ add_component_dir (translation ) add_component_qt_dir (file_order_list - datafilespage model/modelitem model/datafilesmodel model/esm/esmfile + datafileslist model/modelitem model/datafilesmodel model/esm/esmfile utils/filedialog utils/lineedit utils/profilescombobox utils/textinputdialog utils/naturalsort ) diff --git a/components/file_order_list/datafilespage.cpp b/components/file_order_list/datafileslist.cpp similarity index 97% rename from components/file_order_list/datafilespage.cpp rename to components/file_order_list/datafileslist.cpp index 6b0539c1d..bf4f8cb86 100644 --- a/components/file_order_list/datafilespage.cpp +++ b/components/file_order_list/datafileslist.cpp @@ -12,7 +12,7 @@ #include "utils/naturalsort.hpp" #include "utils/textinputdialog.hpp" -#include "datafilespage.hpp" +#include "datafileslist.hpp" #include /** @@ -46,7 +46,7 @@ bool rowSmallerThan(const QModelIndex &index1, const QModelIndex &index2) return index1.row() <= index2.row(); } -DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, QWidget *parent) +DataFilesList::DataFilesList(Files::ConfigurationManager &cfg, QWidget *parent) : QWidget(parent) , mCfgMgr(cfg) { @@ -180,7 +180,7 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, QWidget *parent) setupConfig(); } -void DataFilesPage::createActions() +void DataFilesList::createActions() { // Refresh the plugins QAction *refreshAction = new QAction(tr("Refresh"), this); @@ -218,7 +218,7 @@ void DataFilesPage::createActions() } -void DataFilesPage::setupConfig() +void DataFilesList::setupConfig() { // Open our config file QString config = QString::fromStdString((mCfgMgr.getUserPath() / "launcher.cfg").string()); @@ -265,7 +265,7 @@ void DataFilesPage::setupConfig() } -void DataFilesPage::readConfig() +void DataFilesList::readConfig() { // Don't read the config if no masters are found if (mMastersModel->rowCount() < 1) @@ -340,7 +340,7 @@ void DataFilesPage::readConfig() } -bool DataFilesPage::showDataFilesWarning() +bool DataFilesList::showDataFilesWarning() { QMessageBox msgBox; @@ -381,7 +381,7 @@ bool DataFilesPage::showDataFilesWarning() return true; } -bool DataFilesPage::setupDataFiles() +bool DataFilesList::setupDataFiles() { // We use the Configuration Manager to retrieve the configuration values boost::program_options::variables_map variables; @@ -451,7 +451,7 @@ bool DataFilesPage::setupDataFiles() return true; } -void DataFilesPage::writeConfig(QString profile) +void DataFilesList::writeConfig(QString profile) { // Don't overwrite the config if no masters are found if (mMastersModel->rowCount() < 1) @@ -606,7 +606,7 @@ void DataFilesPage::writeConfig(QString profile) } -void DataFilesPage::newProfile() +void DataFilesList::newProfile() { if (mNewProfileDialog->exec() == QDialog::Accepted) { @@ -621,7 +621,7 @@ void DataFilesPage::newProfile() } } -void DataFilesPage::updateOkButton(const QString &text) +void DataFilesList::updateOkButton(const QString &text) { if (text.isEmpty()) { mNewProfileDialog->setOkButtonEnabled(false); @@ -633,7 +633,7 @@ void DataFilesPage::updateOkButton(const QString &text) : mNewProfileDialog->setOkButtonEnabled(false); } -void DataFilesPage::deleteProfile() +void DataFilesList::deleteProfile() { QString profile = mProfilesComboBox->currentText(); @@ -670,7 +670,7 @@ void DataFilesPage::deleteProfile() } } -void DataFilesPage::check() +void DataFilesList::check() { // Check the current selection if (!mPluginsTable->selectionModel()->hasSelection()) { @@ -690,7 +690,7 @@ void DataFilesPage::check() } } -void DataFilesPage::uncheck() +void DataFilesList::uncheck() { // uncheck the current selection if (!mPluginsTable->selectionModel()->hasSelection()) { @@ -710,7 +710,7 @@ void DataFilesPage::uncheck() } } -void DataFilesPage::refresh() +void DataFilesList::refresh() { mPluginsModel->sort(0); @@ -722,7 +722,7 @@ void DataFilesPage::refresh() } -void DataFilesPage::setCheckState(QModelIndex index) +void DataFilesList::setCheckState(QModelIndex index) { if (!index.isValid()) return; @@ -751,13 +751,13 @@ void DataFilesPage::setCheckState(QModelIndex index) } -void DataFilesPage::filterChanged(const QString filter) +void DataFilesList::filterChanged(const QString filter) { QRegExp regExp(filter, Qt::CaseInsensitive, QRegExp::FixedString); mPluginsProxyModel->setFilterRegExp(regExp); } -void DataFilesPage::profileChanged(const QString &previous, const QString ¤t) +void DataFilesList::profileChanged(const QString &previous, const QString ¤t) { qDebug() << "Profile is changed from: " << previous << " to " << current; // Prevent the deletion of the default profile @@ -785,7 +785,7 @@ void DataFilesPage::profileChanged(const QString &previous, const QString &curre readConfig(); } -void DataFilesPage::profileRenamed(const QString &previous, const QString ¤t) +void DataFilesList::profileRenamed(const QString &previous, const QString ¤t) { if (previous.isEmpty()) return; @@ -815,7 +815,7 @@ void DataFilesPage::profileRenamed(const QString &previous, const QString &curre readConfig(); } -void DataFilesPage::showContextMenu(const QPoint &point) +void DataFilesList::showContextMenu(const QPoint &point) { // Make sure there are plugins in the view if (!mPluginsTable->selectionModel()->hasSelection()) { diff --git a/components/file_order_list/datafilespage.hpp b/components/file_order_list/datafileslist.hpp similarity index 92% rename from components/file_order_list/datafilespage.hpp rename to components/file_order_list/datafileslist.hpp index 13668ec30..7bb6605ab 100644 --- a/components/file_order_list/datafilespage.hpp +++ b/components/file_order_list/datafileslist.hpp @@ -1,5 +1,5 @@ -#ifndef DATAFILESPAGE_H -#define DATAFILESPAGE_H +#ifndef DATAFILESLIST_H +#define DATAFILESLIST_H #include #include @@ -20,12 +20,12 @@ class TextInputDialog; namespace Files { struct ConfigurationManager; } -class DataFilesPage : public QWidget +class DataFilesList : public QWidget { Q_OBJECT public: - DataFilesPage(Files::ConfigurationManager& cfg, QWidget *parent = 0); + DataFilesList(Files::ConfigurationManager& cfg, QWidget *parent = 0); ProfilesComboBox *mProfilesComboBox; From dc91211b12f7fa6b4b9c0bdd505f2618ed8125fc Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Thu, 31 Jan 2013 00:21:04 +0000 Subject: [PATCH 17/43] Fixed Small bug where scripts were being removed when they shouldn't be. Scripts should only be removed when the item is being moved to another cell, otherwise they should remain active. --- apps/openmw/mwworld/worldimp.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 24d139b37..ddcace338 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -694,10 +694,11 @@ namespace MWWorld bool isPlayer = ptr == mPlayer->getPlayer(); bool haveToMove = mWorldScene->isCellActive(*currCell) || isPlayer; - removeContainerScripts(ptr); if (*currCell != newCell) { + removeContainerScripts(ptr); + if (isPlayer) if (!newCell.isExterior()) changeToInteriorCell(Misc::StringUtils::lowerCase(newCell.mCell->mName), pos); From 09f9557ecb516a0a4d0d3db5e0364712a0c21b8a Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Thu, 31 Jan 2013 00:34:16 +0000 Subject: [PATCH 18/43] Implemented OnPCEquip special variable --- apps/openmw/mwworld/actionequip.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/openmw/mwworld/actionequip.cpp b/apps/openmw/mwworld/actionequip.cpp index 60260a812..c519a3ee5 100644 --- a/apps/openmw/mwworld/actionequip.cpp +++ b/apps/openmw/mwworld/actionequip.cpp @@ -3,6 +3,9 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" +#include "../mwbase/scriptmanager.hpp" + +#include #include "inventorystore.hpp" #include "player.hpp" @@ -35,6 +38,8 @@ namespace MWWorld std::string npcRace = actor.get()->mBase->mRace; + bool equipped = false; + // equip the item in the first free slot for (std::vector::const_iterator slot=slots.first.begin(); slot!=slots.first.end(); ++slot) @@ -91,6 +96,7 @@ namespace MWWorld if (slot == --slots.first.end()) { invStore.equip(*slot, it); + equipped = true; break; } @@ -98,8 +104,16 @@ namespace MWWorld { // slot is not occupied invStore.equip(*slot, it); + equipped = true; break; } } + + /* Set OnPCEquip Variable on item's script, if it has a script with that variable declared */ + if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && MWWorld::Class::get(*it).getScript(*it) != ""){ + int index = MWBase::Environment::get().getScriptManager()->getLocals(MWWorld::Class::get(*it).getScript(*it)).getIndex("onpcequip"); + if(index != -1) + (*it).mRefData->getLocals().mShorts.at (index) = 1; + } } } From 0fc5ee5149534facb779c4eed37f6f8f565856c2 Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Thu, 31 Jan 2013 17:46:16 +0000 Subject: [PATCH 19/43] allow OnPCEquip special variable to be of any type --- apps/openmw/mwworld/actionequip.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/actionequip.cpp b/apps/openmw/mwworld/actionequip.cpp index c519a3ee5..2b238ead9 100644 --- a/apps/openmw/mwworld/actionequip.cpp +++ b/apps/openmw/mwworld/actionequip.cpp @@ -109,11 +109,28 @@ namespace MWWorld } } - /* Set OnPCEquip Variable on item's script, if it has a script with that variable declared */ - if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && MWWorld::Class::get(*it).getScript(*it) != ""){ - int index = MWBase::Environment::get().getScriptManager()->getLocals(MWWorld::Class::get(*it).getScript(*it)).getIndex("onpcequip"); + std::string script = MWWorld::Class::get(*it).getScript(*it); + + /* Set OnPCEquip Variable on item's script, if the player is equipping it, and it has a script with that variable declared */ + if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && script != "") + { + Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); + int index = locals.getIndex("onpcequip"); + char type = locals.getType("onpcequip"); if(index != -1) - (*it).mRefData->getLocals().mShorts.at (index) = 1; + { + switch(type) + { + case 's': + (*it).mRefData->getLocals().mShorts.at (index) = 1; break; + + case 'l': + (*it).mRefData->getLocals().mLongs.at (index) = 1; break; + + case 'f': + (*it).mRefData->getLocals().mFloats.at (index) = 1.0; break; + } + } } } } From 9ad08520fd766e45514e479a2f8ff866be3995b6 Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Thu, 31 Jan 2013 18:45:32 +0000 Subject: [PATCH 20/43] Implemented OnPCDrop special variable Scripts are responsible for resetting to 0, as investigation showed that is how vanilla handled it. --- apps/openmw/mwworld/worldimp.cpp | 44 ++++++++++++++++++++++++++++---- apps/openmw/mwworld/worldimp.hpp | 5 ++-- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index ddcace338..0c8027975 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2,11 +2,13 @@ #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/soundmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/windowmanager.hpp" +#include "../mwbase/scriptmanager.hpp" #include "../mwrender/sky.hpp" #include "../mwrender/player.hpp" @@ -1271,6 +1273,33 @@ namespace MWWorld mRendering->toggleWater(); } + void World::PCDropped (const Ptr& item) + { + std::string script = MWWorld::Class::get(item).getScript(item); + + /* Set OnPCDrop Variable on item's script, if it has a script with that variable declared */ + if(script != "") + { + Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); + int index = locals.getIndex("onpcdrop"); + char type = locals.getType("onpcdrop"); + if(index != -1) + { + switch(type) + { + case 's': + item.mRefData->getLocals().mShorts.at (index) = 1; break; + + case 'l': + item.mRefData->getLocals().mLongs.at (index) = 1; break; + + case 'f': + item.mRefData->getLocals().mFloats.at (index) = 1.0; break; + } + } + } + } + bool World::placeObject (const Ptr& object, float cursorX, float cursorY) { std::pair result = mPhysics->castRay(cursorX, cursorY); @@ -1293,9 +1322,10 @@ namespace MWWorld pos.pos[1] = -result.second[2]; pos.pos[2] = result.second[1]; - copyObjectToCell(object, *cell, pos); + Ptr dropped = copyObjectToCell(object, *cell, pos); + PCDropped(dropped); object.getRefData().setCount(0); - + return true; } @@ -1310,8 +1340,8 @@ namespace MWWorld return true; } - void - World::copyObjectToCell(const Ptr &object, CellStore &cell, const ESM::Position &pos) + + Ptr World::copyObjectToCell(const Ptr &object, CellStore &cell, const ESM::Position &pos) { /// \todo add searching correct cell for position specified MWWorld::Ptr dropped = @@ -1335,6 +1365,8 @@ namespace MWWorld } addContainerScripts(dropped, &cell); } + + return dropped; } void World::dropObjectOnGround (const Ptr& actor, const Ptr& object) @@ -1355,7 +1387,9 @@ namespace MWWorld mPhysics->castRay(orig, dir, len); pos.pos[2] = hit.second.z; - copyObjectToCell(object, *cell, pos); + Ptr dropped = copyObjectToCell(object, *cell, pos); + if(actor == mPlayer->getPlayer()) // Only call if dropped by player + PCDropped(dropped); object.getRefData().setCount(0); } diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index fa5b41038..e8efb6a67 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -91,8 +91,8 @@ namespace MWWorld bool moveObjectImp (const Ptr& ptr, float x, float y, float z); ///< @return true if the active cell (cell player is in) changed - virtual void - copyObjectToCell(const Ptr &ptr, CellStore &cell, const ESM::Position &pos); + + Ptr copyObjectToCell(const Ptr &ptr, CellStore &cell, const ESM::Position &pos); void updateWindowManager (); void performUpdateSceneQueries (); @@ -107,6 +107,7 @@ namespace MWWorld void removeContainerScripts(const Ptr& reference); void addContainerScripts(const Ptr& reference, Ptr::CellStore* cell); + void PCDropped (const Ptr& item); public: From 0f58e03343e3d3db1da04398367a5e0704fd7a91 Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Thu, 31 Jan 2013 19:04:39 +0000 Subject: [PATCH 21/43] Unequipping items will reset OnPCEquip variable --- apps/openmw/mwgui/inventorywindow.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 5390f1602..ebbd69d80 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -7,10 +7,13 @@ #include +#include + #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" +#include "../mwbase/scriptmanager.hpp" #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" @@ -240,6 +243,29 @@ namespace MWGui if (it != invStore.end() && *it == item) { invStore.equip(slot, invStore.end()); + std::string script = MWWorld::Class::get(*it).getScript(*it); + + /* Unset OnPCEquip Variable on item's script, if it has a script with that variable declared */ + if(script != "") + { + Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); + int index = locals.getIndex("onpcequip"); + char type = locals.getType("onpcequip"); + if(index != -1) + { + switch(type) + { + case 's': + (*it).mRefData->getLocals().mShorts.at (index) = 0; break; + + case 'l': + (*it).mRefData->getLocals().mLongs.at (index) = 0; break; + + case 'f': + (*it).mRefData->getLocals().mFloats.at (index) = 0.0; break; + } + } + } return; } } From 492482de7f98091a90bff0fa4471475ae281dfc4 Mon Sep 17 00:00:00 2001 From: Michal Sciubidlo Date: Fri, 1 Feb 2013 00:42:03 +0100 Subject: [PATCH 22/43] Add "open" option in opencs. --- apps/opencs/CMakeLists.txt | 4 +-- apps/opencs/view/doc/view.cpp | 29 ++++++++++++++++++- apps/opencs/view/doc/view.hpp | 5 ++++ components/file_order_list/datafileslist.cpp | 16 ++++++++++ components/file_order_list/datafileslist.hpp | 1 + .../file_order_list/model/datafilesmodel.cpp | 20 +++++++++++++ .../file_order_list/model/datafilesmodel.hpp | 1 + 7 files changed, 73 insertions(+), 3 deletions(-) diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index abbc953ca..68b22c10e 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -17,7 +17,7 @@ set (OPENCS_SRC view/world/table.cpp view/world/tablesubview.cpp view/world/subviews.cpp view/world/util.cpp view/world/dialoguesubview.cpp - view/tools/reportsubview.cpp view/tools/subviews.cpp + view/tools/reportsubview.cpp view/tools/subviews.cpp view/tools/opendialog.cpp ) set (OPENCS_HDR @@ -38,7 +38,7 @@ set (OPENCS_HDR view/world/table.hpp view/world/tablesubview.hpp view/world/subviews.hpp view/world/util.hpp view/world/dialoguesubview.hpp - view/tools/reportsubview.hpp view/tools/subviews.hpp + view/tools/reportsubview.hpp view/tools/subviews.hpp view/tools/opendialog.hpp ) set (OPENCS_US diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 13edb6e74..ebcb9aaa7 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -14,6 +14,8 @@ #include "../tools/subviews.hpp" +#include "../tools/opendialog.hpp" + #include "viewmanager.hpp" #include "operations.hpp" #include "subview.hpp" @@ -31,6 +33,10 @@ void CSVDoc::View::setupFileMenu() QAction *new_ = new QAction (tr ("New"), this); connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest())); file->addAction (new_); + + mLoad = new QAction(tr ("&Load"), this); + connect (mLoad, SIGNAL (triggered()), this, SLOT (load())); + file->addAction (mLoad); mSave = new QAction (tr ("&Save"), this); connect (mSave, SIGNAL (triggered()), this, SLOT (save())); @@ -110,7 +116,7 @@ void CSVDoc::View::updateActions() } CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews) -: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews) +: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews), mOpenDialog(0) { setDockOptions (QMainWindow::AllowNestedDocks); @@ -205,6 +211,27 @@ void CSVDoc::View::save() mDocument->save(); } +void CSVDoc::View::load() +{ + if (!mOpenDialog) { + mOpenDialog = new OpenDialog(this); + connect(mOpenDialog, SIGNAL(accepted()), this, SLOT(loadNewFiles())); + } + + mOpenDialog->show(); + mOpenDialog->raise(); + mOpenDialog->activateWindow(); +} + +void CSVDoc::View::loadNewFiles() +{ + //FIXME close old files + std::vector paths; + mOpenDialog->getFileList(paths); + //FIXME load new files + +} + void CSVDoc::View::verify() { addSubView (mDocument->verify()); diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index b1dedafe9..182252203 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -9,6 +9,7 @@ #include "subviewfactory.hpp" class QAction; +class OpenDialog; namespace CSMDoc { @@ -36,10 +37,12 @@ namespace CSVDoc QAction *mUndo; QAction *mRedo; QAction *mSave; + QAction *mLoad; QAction *mVerify; std::vector mEditingActions; Operations *mOperations; SubViewFactoryManager mSubViewFactory; + OpenDialog * mOpenDialog; // not implemented View (const View&); @@ -92,6 +95,8 @@ namespace CSVDoc void newView(); + void load(); + void loadNewFiles(); void save(); void verify(); diff --git a/components/file_order_list/datafileslist.cpp b/components/file_order_list/datafileslist.cpp index bf4f8cb86..f346407a9 100644 --- a/components/file_order_list/datafileslist.cpp +++ b/components/file_order_list/datafileslist.cpp @@ -451,6 +451,22 @@ bool DataFilesList::setupDataFiles() return true; } +void DataFilesList::getSelectedFiles(std::vector& paths) +{ + QStringList masterPaths = mMastersModel->checkedItemsPaths(); + foreach (const QString &path, masterPaths) + { + paths.push_back(path.toStdString()); + cerr << path.toStdString() << endl; + } + QStringList pluginPaths = mPluginsModel->checkedItemsPaths(); + foreach (const QString &path, pluginPaths) + { + paths.push_back(path.toStdString()); + cerr << path.toStdString() << endl; + } +} + void DataFilesList::writeConfig(QString profile) { // Don't overwrite the config if no masters are found diff --git a/components/file_order_list/datafileslist.hpp b/components/file_order_list/datafileslist.hpp index 7bb6605ab..7bdb5e057 100644 --- a/components/file_order_list/datafileslist.hpp +++ b/components/file_order_list/datafileslist.hpp @@ -32,6 +32,7 @@ public: void writeConfig(QString profile = QString()); bool showDataFilesWarning(); bool setupDataFiles(); + void getSelectedFiles(std::vector& paths); public slots: void setCheckState(QModelIndex index); diff --git a/components/file_order_list/model/datafilesmodel.cpp b/components/file_order_list/model/datafilesmodel.cpp index e84dbe0ac..5bb199679 100644 --- a/components/file_order_list/model/datafilesmodel.cpp +++ b/components/file_order_list/model/datafilesmodel.cpp @@ -292,6 +292,7 @@ void DataFilesModel::addMasters(const QString &path) EsmFile *file = new EsmFile(master); file->setDates(info.lastModified(), info.lastRead()); + file->setPath(info.absoluteFilePath()); // Add the master to the table if (findItem(master) == 0) @@ -427,6 +428,25 @@ QStringList DataFilesModel::checkedItems() return list; } +QStringList DataFilesModel::checkedItemsPaths() +{ + QStringList list; + + QList::ConstIterator it; + QList::ConstIterator itEnd = mFiles.constEnd(); + + int i = 0; + for (it = mFiles.constBegin(); it != itEnd; ++it) { + EsmFile *file = item(i); + ++i; + + if (mCheckStates[file->fileName()] == Qt::Checked && mAvailableFiles.contains(file->fileName())) + list << file->path(); + } + + return list; +} + void DataFilesModel::uncheckAll() { emit layoutAboutToBeChanged(); diff --git a/components/file_order_list/model/datafilesmodel.hpp b/components/file_order_list/model/datafilesmodel.hpp index 29a770a86..adc80eac2 100644 --- a/components/file_order_list/model/datafilesmodel.hpp +++ b/components/file_order_list/model/datafilesmodel.hpp @@ -43,6 +43,7 @@ public: QStringList checkedItems(); QStringList uncheckedItems(); + QStringList checkedItemsPaths(); Qt::CheckState checkState(const QModelIndex &index); void setCheckState(const QModelIndex &index, Qt::CheckState state); From 67a1ec51665822ea03fa89906488a7872566f5c8 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 2 Feb 2013 16:14:58 +0100 Subject: [PATCH 23/43] added provisional startup dialogue --- apps/opencs/CMakeLists.txt | 4 +-- apps/opencs/editor.cpp | 46 ++++++++++++++++++++++++++-- apps/opencs/editor.hpp | 7 ++++- apps/opencs/view/doc/startup.cpp | 20 ++++++++++++ apps/opencs/view/doc/startup.hpp | 24 +++++++++++++++ apps/opencs/view/doc/view.cpp | 4 +++ apps/opencs/view/doc/view.hpp | 2 ++ apps/opencs/view/doc/viewmanager.cpp | 1 + apps/opencs/view/doc/viewmanager.hpp | 2 ++ 9 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 apps/opencs/view/doc/startup.cpp create mode 100644 apps/opencs/view/doc/startup.hpp diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index abbc953ca..d3634a66e 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -12,7 +12,7 @@ set (OPENCS_SRC model/tools/mandatoryid.cpp model/tools/reportmodel.cpp view/doc/viewmanager.cpp view/doc/view.cpp view/doc/operations.cpp view/doc/operation.cpp view/doc/subviewfactory.cpp - view/doc/subview.cpp + view/doc/subview.cpp view/doc/startup.cpp view/world/table.cpp view/world/tablesubview.cpp view/world/subviews.cpp view/world/util.cpp view/world/dialoguesubview.cpp @@ -33,7 +33,7 @@ set (OPENCS_HDR model/tools/mandatoryid.hpp model/tools/reportmodel.hpp view/doc/viewmanager.hpp view/doc/view.hpp view/doc/operations.hpp view/doc/operation.hpp view/doc/subviewfactory.hpp - view/doc/subview.hpp view/doc/subviewfactoryimp.hpp + view/doc/subview.hpp view/doc/subviewfactoryimp.hpp view/doc/startup.hpp view/world/table.hpp view/world/tablesubview.hpp view/world/subviews.hpp view/world/util.hpp view/world/dialoguesubview.hpp diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 1632ed220..2340c71ee 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -11,10 +11,19 @@ CS::Editor::Editor() : mViewManager (mDocumentManager), mNewDocumentIndex (0) { connect (&mViewManager, SIGNAL (newDocumentRequest ()), this, SLOT (createDocument ())); + connect (&mViewManager, SIGNAL (loadDocumentRequest ()), this, SLOT (loadDocument ())); + + connect (&mStartup, SIGNAL (createDocument()), this, SLOT (createDocument ())); + connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ())); } void CS::Editor::createDocument() { + mStartup.hide(); + + /// \todo open the ESX picker instead + /// \todo remove the following code for creating initial records into the document manager + std::ostringstream stream; stream << "NewDocument" << (++mNewDocumentIndex); @@ -23,7 +32,39 @@ void CS::Editor::createDocument() static const char *sGlobals[] = { - "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 + "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 + }; + + for (int i=0; sGlobals[i]; ++i) + { + ESM::Global record; + record.mId = sGlobals[i]; + record.mValue = i==0 ? 1 : 0; + record.mType = ESM::VT_Float; + document->getData().getGlobals().add (record); + } + + document->getData().merge(); /// \todo remove once proper ESX loading is implemented + + mViewManager.addView (document); +} + +void CS::Editor::loadDocument() +{ + mStartup.hide(); + + /// \todo open the ESX picker instead + /// \todo replace the manual record creation and load the ESX files instead + + std::ostringstream stream; + + stream << "Document" << (++mNewDocumentIndex); + + CSMDoc::Document *document = mDocumentManager.addDocument (stream.str()); + + static const char *sGlobals[] = + { + "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 }; for (int i=0; sGlobals[i]; ++i) @@ -42,8 +83,7 @@ void CS::Editor::createDocument() int CS::Editor::run() { - /// \todo Instead of creating an empty document, open a small welcome dialogue window with buttons for new/load/recent projects - createDocument(); + mStartup.show(); return QApplication::exec(); } \ No newline at end of file diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index 60f7beaf1..0cd780f7f 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -4,7 +4,9 @@ #include #include "model/doc/documentmanager.hpp" + #include "view/doc/viewmanager.hpp" +#include "view/doc/startup.hpp" namespace CS { @@ -16,6 +18,7 @@ namespace CS CSMDoc::DocumentManager mDocumentManager; CSVDoc::ViewManager mViewManager; + CSVDoc::StartupDialogue mStartup; // not implemented Editor (const Editor&); @@ -28,9 +31,11 @@ namespace CS int run(); ///< \return error status - public slots: + private slots: void createDocument(); + + void loadDocument(); }; } diff --git a/apps/opencs/view/doc/startup.cpp b/apps/opencs/view/doc/startup.cpp new file mode 100644 index 000000000..7861a1c2e --- /dev/null +++ b/apps/opencs/view/doc/startup.cpp @@ -0,0 +1,20 @@ + +#include "startup.hpp" + +#include +#include + +CSVDoc::StartupDialogue::StartupDialogue() +{ + QHBoxLayout *layout = new QHBoxLayout (this); + + QPushButton *createDocument = new QPushButton ("new", this); + connect (createDocument, SIGNAL (clicked()), this, SIGNAL (createDocument())); + layout->addWidget (createDocument); + + QPushButton *loadDocument = new QPushButton ("load", this); + connect (loadDocument, SIGNAL (clicked()), this, SIGNAL (loadDocument())); + layout->addWidget (loadDocument); + + setLayout (layout); +} \ No newline at end of file diff --git a/apps/opencs/view/doc/startup.hpp b/apps/opencs/view/doc/startup.hpp new file mode 100644 index 000000000..f24d2a64b --- /dev/null +++ b/apps/opencs/view/doc/startup.hpp @@ -0,0 +1,24 @@ +#ifndef CSV_DOC_STARTUP_H +#define CSV_DOC_STARTUP_H + +#include + +namespace CSVDoc +{ + class StartupDialogue : public QWidget + { + Q_OBJECT + + public: + + StartupDialogue(); + + signals: + + void createDocument(); + + void loadDocument(); + }; +} + +#endif diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 13edb6e74..d6639e59c 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -32,6 +32,10 @@ void CSVDoc::View::setupFileMenu() connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest())); file->addAction (new_); + QAction *open = new QAction (tr ("Open"), this); + connect (open, SIGNAL (triggered()), this, SIGNAL (loadDocumentRequest())); + file->addAction (open); + mSave = new QAction (tr ("&Save"), this); connect (mSave, SIGNAL (triggered()), this, SLOT (save())); file->addAction (mSave); diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index b1dedafe9..05d7210dc 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -84,6 +84,8 @@ namespace CSVDoc void newDocumentRequest(); + void loadDocumentRequest(); + public slots: void addSubView (const CSMWorld::UniversalId& id); diff --git a/apps/opencs/view/doc/viewmanager.cpp b/apps/opencs/view/doc/viewmanager.cpp index 22847c78b..b01b9ce34 100644 --- a/apps/opencs/view/doc/viewmanager.cpp +++ b/apps/opencs/view/doc/viewmanager.cpp @@ -57,6 +57,7 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document) view->show(); connect (view, SIGNAL (newDocumentRequest ()), this, SIGNAL (newDocumentRequest())); + connect (view, SIGNAL (loadDocumentRequest ()), this, SIGNAL (loadDocumentRequest())); updateIndices(); diff --git a/apps/opencs/view/doc/viewmanager.hpp b/apps/opencs/view/doc/viewmanager.hpp index 5e4b1be07..91a80d496 100644 --- a/apps/opencs/view/doc/viewmanager.hpp +++ b/apps/opencs/view/doc/viewmanager.hpp @@ -46,6 +46,8 @@ namespace CSVDoc void newDocumentRequest(); + void loadDocumentRequest(); + private slots: void documentStateChanged (int state, CSMDoc::Document *document); From 155cca0c9a23eec9db94f2e9214110029a0a4838 Mon Sep 17 00:00:00 2001 From: Michal Sciubidlo Date: Sat, 2 Feb 2013 16:25:41 +0100 Subject: [PATCH 24/43] Upload missing files. Fix folder name. Keep Qt optional. Move open dialogue from doc to tools. Rename 'load' to 'open'. Deleted wrong comment. --- apps/launcher/graphicspage.cpp | 2 +- apps/launcher/maindialog.cpp | 2 +- apps/opencs/CMakeLists.txt | 8 +++--- apps/opencs/view/doc/opendialog.cpp | 27 +++++++++++++++++++ apps/opencs/view/doc/opendialog.hpp | 17 ++++++++++++ apps/opencs/view/doc/view.cpp | 16 +++++------ apps/opencs/view/doc/view.hpp | 6 ++--- components/CMakeLists.txt | 16 ++++++----- .../datafileslist.cpp | 0 .../datafileslist.hpp | 0 .../model/datafilesmodel.cpp | 0 .../model/datafilesmodel.hpp | 0 .../model/esm/esmfile.cpp | 0 .../model/esm/esmfile.hpp | 0 .../model/modelitem.cpp | 0 .../model/modelitem.hpp | 0 .../utils/filedialog.cpp | 0 .../utils/filedialog.hpp | 0 .../utils/lineedit.cpp | 0 .../utils/lineedit.hpp | 0 .../utils/naturalsort.cpp | 0 .../utils/naturalsort.hpp | 0 .../utils/profilescombobox.cpp | 0 .../utils/profilescombobox.hpp | 0 .../utils/textinputdialog.cpp | 0 .../utils/textinputdialog.hpp | 0 26 files changed, 69 insertions(+), 25 deletions(-) create mode 100644 apps/opencs/view/doc/opendialog.cpp create mode 100644 apps/opencs/view/doc/opendialog.hpp rename components/{file_order_list => fileorderlist}/datafileslist.cpp (100%) rename components/{file_order_list => fileorderlist}/datafileslist.hpp (100%) rename components/{file_order_list => fileorderlist}/model/datafilesmodel.cpp (100%) rename components/{file_order_list => fileorderlist}/model/datafilesmodel.hpp (100%) rename components/{file_order_list => fileorderlist}/model/esm/esmfile.cpp (100%) rename components/{file_order_list => fileorderlist}/model/esm/esmfile.hpp (100%) rename components/{file_order_list => fileorderlist}/model/modelitem.cpp (100%) rename components/{file_order_list => fileorderlist}/model/modelitem.hpp (100%) rename components/{file_order_list => fileorderlist}/utils/filedialog.cpp (100%) rename components/{file_order_list => fileorderlist}/utils/filedialog.hpp (100%) rename components/{file_order_list => fileorderlist}/utils/lineedit.cpp (100%) rename components/{file_order_list => fileorderlist}/utils/lineedit.hpp (100%) rename components/{file_order_list => fileorderlist}/utils/naturalsort.cpp (100%) rename components/{file_order_list => fileorderlist}/utils/naturalsort.hpp (100%) rename components/{file_order_list => fileorderlist}/utils/profilescombobox.cpp (100%) rename components/{file_order_list => fileorderlist}/utils/profilescombobox.hpp (100%) rename components/{file_order_list => fileorderlist}/utils/textinputdialog.cpp (100%) rename components/{file_order_list => fileorderlist}/utils/textinputdialog.hpp (100%) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index e69a8c207..dee84498c 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include "graphicspage.hpp" diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 43b8f317a..7914650fe 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include "maindialog.hpp" #include "playpage.hpp" diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 68b22c10e..76d669e15 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -12,12 +12,12 @@ set (OPENCS_SRC model/tools/mandatoryid.cpp model/tools/reportmodel.cpp view/doc/viewmanager.cpp view/doc/view.cpp view/doc/operations.cpp view/doc/operation.cpp view/doc/subviewfactory.cpp - view/doc/subview.cpp + view/doc/subview.cpp view/doc/opendialog.cpp view/world/table.cpp view/world/tablesubview.cpp view/world/subviews.cpp view/world/util.cpp view/world/dialoguesubview.cpp - view/tools/reportsubview.cpp view/tools/subviews.cpp view/tools/opendialog.cpp + view/tools/reportsubview.cpp view/tools/subviews.cpp ) set (OPENCS_HDR @@ -33,12 +33,12 @@ set (OPENCS_HDR model/tools/mandatoryid.hpp model/tools/reportmodel.hpp view/doc/viewmanager.hpp view/doc/view.hpp view/doc/operations.hpp view/doc/operation.hpp view/doc/subviewfactory.hpp - view/doc/subview.hpp view/doc/subviewfactoryimp.hpp + view/doc/subview.hpp view/doc/subviewfactoryimp.hpp view/doc/opendialog.hpp view/world/table.hpp view/world/tablesubview.hpp view/world/subviews.hpp view/world/util.hpp view/world/dialoguesubview.hpp - view/tools/reportsubview.hpp view/tools/subviews.hpp view/tools/opendialog.hpp + view/tools/reportsubview.hpp view/tools/subviews.hpp ) set (OPENCS_US diff --git a/apps/opencs/view/doc/opendialog.cpp b/apps/opencs/view/doc/opendialog.cpp new file mode 100644 index 000000000..f51cbadb9 --- /dev/null +++ b/apps/opencs/view/doc/opendialog.cpp @@ -0,0 +1,27 @@ +#include +#include + +#include + +#include "opendialog.hpp" + +OpenDialog::OpenDialog(QWidget * parent) : QDialog(parent) +{ + QVBoxLayout *layout = new QVBoxLayout(this); + mFileSelector = new DataFilesList(mCfgMgr, this); + layout->addWidget(mFileSelector); + mFileSelector->setupDataFiles(); + + buttonBox = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Cancel, Qt::Horizontal, this); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + layout->addWidget(buttonBox); + + setLayout(layout); + setWindowTitle(tr("Open")); +} + +void OpenDialog::getFileList(std::vector& paths) +{ + mFileSelector->getSelectedFiles(paths); +} diff --git a/apps/opencs/view/doc/opendialog.hpp b/apps/opencs/view/doc/opendialog.hpp new file mode 100644 index 000000000..6355aea44 --- /dev/null +++ b/apps/opencs/view/doc/opendialog.hpp @@ -0,0 +1,17 @@ +#include +#include + +class DataFilesList; +class QDialogButtonBox; + +class OpenDialog : public QDialog { + Q_OBJECT +public: + OpenDialog(QWidget * parent = 0); + + void getFileList(std::vector& paths); +private: + DataFilesList * mFileSelector; + QDialogButtonBox * buttonBox; + Files::ConfigurationManager mCfgMgr; +}; \ No newline at end of file diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index ebcb9aaa7..112807cca 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -14,8 +14,7 @@ #include "../tools/subviews.hpp" -#include "../tools/opendialog.hpp" - +#include "opendialog.hpp" #include "viewmanager.hpp" #include "operations.hpp" #include "subview.hpp" @@ -34,9 +33,9 @@ void CSVDoc::View::setupFileMenu() connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest())); file->addAction (new_); - mLoad = new QAction(tr ("&Load"), this); - connect (mLoad, SIGNAL (triggered()), this, SLOT (load())); - file->addAction (mLoad); + mOpen = new QAction(tr ("&Open"), this); + connect (mOpen, SIGNAL (triggered()), this, SLOT (open())); + file->addAction (mOpen); mSave = new QAction (tr ("&Save"), this); connect (mSave, SIGNAL (triggered()), this, SLOT (save())); @@ -211,11 +210,11 @@ void CSVDoc::View::save() mDocument->save(); } -void CSVDoc::View::load() +void CSVDoc::View::open() { if (!mOpenDialog) { mOpenDialog = new OpenDialog(this); - connect(mOpenDialog, SIGNAL(accepted()), this, SLOT(loadNewFiles())); + connect(mOpenDialog, SIGNAL(accepted()), this, SLOT(openNewFiles())); } mOpenDialog->show(); @@ -223,9 +222,8 @@ void CSVDoc::View::load() mOpenDialog->activateWindow(); } -void CSVDoc::View::loadNewFiles() +void CSVDoc::View::openNewFiles() { - //FIXME close old files std::vector paths; mOpenDialog->getFileList(paths); //FIXME load new files diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index 182252203..839edf0a5 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -37,7 +37,7 @@ namespace CSVDoc QAction *mUndo; QAction *mRedo; QAction *mSave; - QAction *mLoad; + QAction *mOpen; QAction *mVerify; std::vector mEditingActions; Operations *mOperations; @@ -95,8 +95,8 @@ namespace CSVDoc void newView(); - void load(); - void loadNewFiles(); + void open(); + void openNewFiles(); void save(); void verify(); diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 3798f66b7..63a227621 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -66,15 +66,17 @@ add_component_dir (translation translation ) -add_component_qt_dir (file_order_list - datafileslist model/modelitem model/datafilesmodel model/esm/esmfile - utils/filedialog utils/lineedit utils/profilescombobox utils/textinputdialog utils/naturalsort - ) +find_package(Qt4 COMPONENTS QtCore QtGui) -find_package(Qt4 COMPONENTS QtCore QtGUI REQUIRED) -include(${QT_USE_FILE}) +if(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY) + add_component_qt_dir (fileorderlist + datafileslist model/modelitem model/datafilesmodel model/esm/esmfile + utils/filedialog utils/lineedit utils/profilescombobox utils/textinputdialog utils/naturalsort + ) -QT4_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES}) + include(${QT_USE_FILE}) + QT4_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES}) +endif(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY) include_directories(${BULLET_INCLUDE_DIRS}) diff --git a/components/file_order_list/datafileslist.cpp b/components/fileorderlist/datafileslist.cpp similarity index 100% rename from components/file_order_list/datafileslist.cpp rename to components/fileorderlist/datafileslist.cpp diff --git a/components/file_order_list/datafileslist.hpp b/components/fileorderlist/datafileslist.hpp similarity index 100% rename from components/file_order_list/datafileslist.hpp rename to components/fileorderlist/datafileslist.hpp diff --git a/components/file_order_list/model/datafilesmodel.cpp b/components/fileorderlist/model/datafilesmodel.cpp similarity index 100% rename from components/file_order_list/model/datafilesmodel.cpp rename to components/fileorderlist/model/datafilesmodel.cpp diff --git a/components/file_order_list/model/datafilesmodel.hpp b/components/fileorderlist/model/datafilesmodel.hpp similarity index 100% rename from components/file_order_list/model/datafilesmodel.hpp rename to components/fileorderlist/model/datafilesmodel.hpp diff --git a/components/file_order_list/model/esm/esmfile.cpp b/components/fileorderlist/model/esm/esmfile.cpp similarity index 100% rename from components/file_order_list/model/esm/esmfile.cpp rename to components/fileorderlist/model/esm/esmfile.cpp diff --git a/components/file_order_list/model/esm/esmfile.hpp b/components/fileorderlist/model/esm/esmfile.hpp similarity index 100% rename from components/file_order_list/model/esm/esmfile.hpp rename to components/fileorderlist/model/esm/esmfile.hpp diff --git a/components/file_order_list/model/modelitem.cpp b/components/fileorderlist/model/modelitem.cpp similarity index 100% rename from components/file_order_list/model/modelitem.cpp rename to components/fileorderlist/model/modelitem.cpp diff --git a/components/file_order_list/model/modelitem.hpp b/components/fileorderlist/model/modelitem.hpp similarity index 100% rename from components/file_order_list/model/modelitem.hpp rename to components/fileorderlist/model/modelitem.hpp diff --git a/components/file_order_list/utils/filedialog.cpp b/components/fileorderlist/utils/filedialog.cpp similarity index 100% rename from components/file_order_list/utils/filedialog.cpp rename to components/fileorderlist/utils/filedialog.cpp diff --git a/components/file_order_list/utils/filedialog.hpp b/components/fileorderlist/utils/filedialog.hpp similarity index 100% rename from components/file_order_list/utils/filedialog.hpp rename to components/fileorderlist/utils/filedialog.hpp diff --git a/components/file_order_list/utils/lineedit.cpp b/components/fileorderlist/utils/lineedit.cpp similarity index 100% rename from components/file_order_list/utils/lineedit.cpp rename to components/fileorderlist/utils/lineedit.cpp diff --git a/components/file_order_list/utils/lineedit.hpp b/components/fileorderlist/utils/lineedit.hpp similarity index 100% rename from components/file_order_list/utils/lineedit.hpp rename to components/fileorderlist/utils/lineedit.hpp diff --git a/components/file_order_list/utils/naturalsort.cpp b/components/fileorderlist/utils/naturalsort.cpp similarity index 100% rename from components/file_order_list/utils/naturalsort.cpp rename to components/fileorderlist/utils/naturalsort.cpp diff --git a/components/file_order_list/utils/naturalsort.hpp b/components/fileorderlist/utils/naturalsort.hpp similarity index 100% rename from components/file_order_list/utils/naturalsort.hpp rename to components/fileorderlist/utils/naturalsort.hpp diff --git a/components/file_order_list/utils/profilescombobox.cpp b/components/fileorderlist/utils/profilescombobox.cpp similarity index 100% rename from components/file_order_list/utils/profilescombobox.cpp rename to components/fileorderlist/utils/profilescombobox.cpp diff --git a/components/file_order_list/utils/profilescombobox.hpp b/components/fileorderlist/utils/profilescombobox.hpp similarity index 100% rename from components/file_order_list/utils/profilescombobox.hpp rename to components/fileorderlist/utils/profilescombobox.hpp diff --git a/components/file_order_list/utils/textinputdialog.cpp b/components/fileorderlist/utils/textinputdialog.cpp similarity index 100% rename from components/file_order_list/utils/textinputdialog.cpp rename to components/fileorderlist/utils/textinputdialog.cpp diff --git a/components/file_order_list/utils/textinputdialog.hpp b/components/fileorderlist/utils/textinputdialog.hpp similarity index 100% rename from components/file_order_list/utils/textinputdialog.hpp rename to components/fileorderlist/utils/textinputdialog.hpp From f785659297abf4b23876a875f0da5bdcb0c39ee8 Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Sat, 2 Feb 2013 17:36:12 +0000 Subject: [PATCH 25/43] Implemented OnPCAdd special variable Had to edit OpAddItem in miscextensions.cpp, as local variables were not being initialised for items added through it. Does not get reset on drop, as per original morrowind. --- apps/openmw/mwscript/containerextensions.cpp | 8 ++++++ apps/openmw/mwworld/containerstore.cpp | 28 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index 1fa69d1fd..4cce19b86 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -50,6 +50,14 @@ namespace MWScript MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), item); ref.getPtr().getRefData().setCount (count); + + // Configure item's script variables + std::string script = MWWorld::Class::get(ref.getPtr()).getScript(ref.getPtr()); + if (script != "") + { + const ESM::Script *esmscript = MWBase::Environment::get().getWorld()->getStore().get().find (script); + ref.getPtr().getRefData().setLocals(*esmscript); + } MWWorld::Class::get (ptr).getContainerStore (ptr).add (ref.getPtr()); } diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index bca4073b5..31eabb342 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -8,9 +8,11 @@ #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" +#include "../mwbase/scriptmanager.hpp" #include "manualref.hpp" #include "refdata.hpp" @@ -83,9 +85,31 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr) CellStore *cell; Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer(); - // Items in players inventory have cell set to 0, so their scripts will never be removed + if(&(MWWorld::Class::get (player).getContainerStore (player)) == this) - cell = 0; + { + cell = 0; // Items in players inventory have cell set to 0, so their scripts will never be removed + + // Set OnPCAdd special variable, if it is declared + Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); + int index = locals.getIndex("onpcadd"); + char type = locals.getType("onpcadd"); + + if(index != -1) + { + switch(type) + { + case 's': + item.mRefData->getLocals().mShorts.at (index) = 1; break; + + case 'l': + item.mRefData->getLocals().mLongs.at (index) = 1; break; + + case 'f': + item.mRefData->getLocals().mFloats.at (index) = 1.0; break; + } + } + } else cell = player.getCell(); From ac112ef972927e96879405edca9aaf7c058440aa Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Sun, 3 Feb 2013 13:27:27 +0000 Subject: [PATCH 26/43] refactored special variable code --- apps/openmw/CMakeLists.txt | 2 +- apps/openmw/mwgui/inventorywindow.cpp | 24 ++------------- apps/openmw/mwscript/locals.cpp | 41 ++++++++++++++++++++++++++ apps/openmw/mwscript/locals.hpp | 21 +++++-------- apps/openmw/mwworld/actionequip.cpp | 21 +------------ apps/openmw/mwworld/containerstore.cpp | 21 ++----------- apps/openmw/mwworld/worldimp.cpp | 22 ++------------ 7 files changed, 58 insertions(+), 94 deletions(-) create mode 100644 apps/openmw/mwscript/locals.cpp diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 482007090..f61f5ead2 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -41,7 +41,7 @@ add_openmw_dir (mwscript locals scriptmanagerimp compilercontext interpretercontext cellextensions miscextensions guiextensions soundextensions skyextensions statsextensions containerextensions aiextensions controlextensions extensions globalscripts ref dialogueextensions - animationextensions transformationextensions consoleextensions userextensions + animationextensions transformationextensions consoleextensions userextensions locals ) add_openmw_dir (mwsound diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index ebbd69d80..40771af16 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -13,7 +13,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/scriptmanager.hpp" #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" @@ -245,27 +244,10 @@ namespace MWGui invStore.equip(slot, invStore.end()); std::string script = MWWorld::Class::get(*it).getScript(*it); - /* Unset OnPCEquip Variable on item's script, if it has a script with that variable declared */ + // Unset OnPCEquip Variable on item's script, if it has a script with that variable declared if(script != "") - { - Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); - int index = locals.getIndex("onpcequip"); - char type = locals.getType("onpcequip"); - if(index != -1) - { - switch(type) - { - case 's': - (*it).mRefData->getLocals().mShorts.at (index) = 0; break; - - case 'l': - (*it).mRefData->getLocals().mLongs.at (index) = 0; break; - - case 'f': - (*it).mRefData->getLocals().mFloats.at (index) = 0.0; break; - } - } - } + (*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 0); + return; } } diff --git a/apps/openmw/mwscript/locals.cpp b/apps/openmw/mwscript/locals.cpp new file mode 100644 index 000000000..53f744323 --- /dev/null +++ b/apps/openmw/mwscript/locals.cpp @@ -0,0 +1,41 @@ +#include "locals.hpp" + +#include "../mwbase/environment.hpp" +#include "../mwbase/scriptmanager.hpp" +#include + +namespace MWScript +{ + void Locals::configure (const ESM::Script& script) + { + mShorts.clear(); + mShorts.resize (script.mData.mNumShorts, 0); + mLongs.clear(); + mLongs.resize (script.mData.mNumLongs, 0); + mFloats.clear(); + mFloats.resize (script.mData.mNumFloats, 0); + } + + bool Locals::setVarByInt(const std::string& script, const std::string& var, int val) + { + Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); + int index = locals.getIndex(var); + char type = locals.getType(var); + if(index != -1) + { + switch(type) + { + case 's': + mShorts.at (index) = val; break; + + case 'l': + mLongs.at (index) = val; break; + + case 'f': + mFloats.at (index) = val; break; + } + return true; + } + return false; + } +} diff --git a/apps/openmw/mwscript/locals.hpp b/apps/openmw/mwscript/locals.hpp index ec02e2f12..e933c727f 100644 --- a/apps/openmw/mwscript/locals.hpp +++ b/apps/openmw/mwscript/locals.hpp @@ -8,21 +8,16 @@ namespace MWScript { - struct Locals + class Locals { - std::vector mShorts; - std::vector mLongs; - std::vector mFloats; + public: + std::vector mShorts; + std::vector mLongs; + std::vector mFloats; + + void configure (const ESM::Script& script); + bool setVarByInt(const std::string& script, const std::string& var, int val); - void configure (const ESM::Script& script) - { - mShorts.clear(); - mShorts.resize (script.mData.mNumShorts, 0); - mLongs.clear(); - mLongs.resize (script.mData.mNumLongs, 0); - mFloats.clear(); - mFloats.resize (script.mData.mNumFloats, 0); - } }; } diff --git a/apps/openmw/mwworld/actionequip.cpp b/apps/openmw/mwworld/actionequip.cpp index 2b238ead9..b1236f829 100644 --- a/apps/openmw/mwworld/actionequip.cpp +++ b/apps/openmw/mwworld/actionequip.cpp @@ -3,7 +3,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/scriptmanager.hpp" #include @@ -113,24 +112,6 @@ namespace MWWorld /* Set OnPCEquip Variable on item's script, if the player is equipping it, and it has a script with that variable declared */ if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && script != "") - { - Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); - int index = locals.getIndex("onpcequip"); - char type = locals.getType("onpcequip"); - if(index != -1) - { - switch(type) - { - case 's': - (*it).mRefData->getLocals().mShorts.at (index) = 1; break; - - case 'l': - (*it).mRefData->getLocals().mLongs.at (index) = 1; break; - - case 'f': - (*it).mRefData->getLocals().mFloats.at (index) = 1.0; break; - } - } - } + (*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 1); } } diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 31eabb342..eb2a14d5b 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -88,27 +88,10 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr) if(&(MWWorld::Class::get (player).getContainerStore (player)) == this) { - cell = 0; // Items in players inventory have cell set to 0, so their scripts will never be removed + cell = 0; // Items in player's inventory have cell set to 0, so their scripts will never be removed // Set OnPCAdd special variable, if it is declared - Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); - int index = locals.getIndex("onpcadd"); - char type = locals.getType("onpcadd"); - - if(index != -1) - { - switch(type) - { - case 's': - item.mRefData->getLocals().mShorts.at (index) = 1; break; - - case 'l': - item.mRefData->getLocals().mLongs.at (index) = 1; break; - - case 'f': - item.mRefData->getLocals().mFloats.at (index) = 1.0; break; - } - } + item.mRefData->getLocals().setVarByInt(script, "onpcadd", 1); } else cell = player.getCell(); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 0c8027975..2926b76f8 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1277,27 +1277,9 @@ namespace MWWorld { std::string script = MWWorld::Class::get(item).getScript(item); - /* Set OnPCDrop Variable on item's script, if it has a script with that variable declared */ + // Set OnPCDrop Variable on item's script, if it has a script with that variable declared if(script != "") - { - Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); - int index = locals.getIndex("onpcdrop"); - char type = locals.getType("onpcdrop"); - if(index != -1) - { - switch(type) - { - case 's': - item.mRefData->getLocals().mShorts.at (index) = 1; break; - - case 'l': - item.mRefData->getLocals().mLongs.at (index) = 1; break; - - case 'f': - item.mRefData->getLocals().mFloats.at (index) = 1.0; break; - } - } - } + item.mRefData->getLocals().setVarByInt(script, "onpcdrop", 1); } bool World::placeObject (const Ptr& object, float cursorX, float cursorY) From 4c973a0f6767570a4ed07d0265fe949e7f0f7beb Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 4 Feb 2013 13:46:54 +0100 Subject: [PATCH 27/43] constructing documents from a file list instead of a single name --- apps/opencs/editor.cpp | 12 +++++-- apps/opencs/model/doc/document.cpp | 42 +++++++++++++++++++++-- apps/opencs/model/doc/document.hpp | 10 ++++-- apps/opencs/model/doc/documentmanager.cpp | 5 +-- apps/opencs/model/doc/documentmanager.hpp | 7 +++- 5 files changed, 66 insertions(+), 10 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 2340c71ee..57e31e19e 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -22,13 +22,16 @@ void CS::Editor::createDocument() mStartup.hide(); /// \todo open the ESX picker instead - /// \todo remove the following code for creating initial records into the document manager + /// \todo move the following code for creating initial records into the document manager std::ostringstream stream; stream << "NewDocument" << (++mNewDocumentIndex); - CSMDoc::Document *document = mDocumentManager.addDocument (stream.str()); + std::vector files; + files.push_back (stream.str()); + + CSMDoc::Document *document = mDocumentManager.addDocument (files, true); static const char *sGlobals[] = { @@ -60,7 +63,10 @@ void CS::Editor::loadDocument() stream << "Document" << (++mNewDocumentIndex); - CSMDoc::Document *document = mDocumentManager.addDocument (stream.str()); + std::vector files; + files.push_back (stream.str()); + + CSMDoc::Document *document = mDocumentManager.addDocument (files, false); static const char *sGlobals[] = { diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 9d2694483..93d664314 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -1,10 +1,48 @@ #include "document.hpp" -CSMDoc::Document::Document (const std::string& name) +#include + +void CSMDoc::Document::load (const std::vector::const_iterator& begin, + const std::vector::const_iterator& end) +{ + for (std::vector::const_iterator iter (begin); iter!=end; ++iter) + std::cout << "pretending to load " << iter->string() << std::endl; + + /// \todo load content files +} + +void CSMDoc::Document::createBase() +{ + std::cout << "pretending to create base file records" << std::endl; + + /// \todo create mandatory records for base content file +} + +CSMDoc::Document::Document (const std::vector& files, bool new_) : mTools (mData) { - mName = name; ///< \todo replace with ESX list + if (files.empty()) + throw std::runtime_error ("Empty content file sequence"); + + /// \todo adjust last file name: + /// \li make sure it is located in the data-local directory (adjust path if necessary) + /// \li make sure the extension matches the new scheme (change it if necesarry) + + mName = files.back().filename().string(); + + if (files.size()>1 || !new_) + { + std::vector::const_iterator end = files.end(); + + if (new_) + --end; + + load (files.begin(), end); + } + + if (new_ && files.size()==1) + createBase(); connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool))); diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 43e8bba37..28cc19d44 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -3,6 +3,8 @@ #include +#include + #include #include #include @@ -38,10 +40,14 @@ namespace CSMDoc Document (const Document&); Document& operator= (const Document&); + void load (const std::vector::const_iterator& begin, + const std::vector::const_iterator& end); + + void createBase(); + public: - Document (const std::string& name); - ///< \todo replace name with ESX list + Document (const std::vector& files, bool new_); QUndoStack& getUndoStack(); diff --git a/apps/opencs/model/doc/documentmanager.cpp b/apps/opencs/model/doc/documentmanager.cpp index 8ae2764f2..740c0b582 100644 --- a/apps/opencs/model/doc/documentmanager.cpp +++ b/apps/opencs/model/doc/documentmanager.cpp @@ -14,9 +14,10 @@ CSMDoc::DocumentManager::~DocumentManager() delete *iter; } -CSMDoc::Document *CSMDoc::DocumentManager::addDocument (const std::string& name) +CSMDoc::Document *CSMDoc::DocumentManager::addDocument (const std::vector& files, + bool new_) { - Document *document = new Document (name); + Document *document = new Document (files, new_); mDocuments.push_back (document); diff --git a/apps/opencs/model/doc/documentmanager.hpp b/apps/opencs/model/doc/documentmanager.hpp index 730c7fae1..a307b76a5 100644 --- a/apps/opencs/model/doc/documentmanager.hpp +++ b/apps/opencs/model/doc/documentmanager.hpp @@ -4,6 +4,8 @@ #include #include +#include + namespace CSMDoc { class Document; @@ -21,8 +23,11 @@ namespace CSMDoc ~DocumentManager(); - Document *addDocument (const std::string& name); + Document *addDocument (const std::vector& files, bool new_); ///< The ownership of the returned document is not transferred to the caller. + /// + /// \param new_ Do not load the last content file in \a files and instead create in an + /// appropriate way. bool removeDocument (Document *document); ///< \return last document removed? From ba0d13fc12f2be6b483a09025b329f97974ae9b4 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 4 Feb 2013 13:50:38 +0100 Subject: [PATCH 28/43] moved code for creating new base content records into the Document class --- apps/opencs/editor.cpp | 19 +------------------ apps/opencs/model/doc/document.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 57e31e19e..7156db94e 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -22,7 +22,6 @@ void CS::Editor::createDocument() mStartup.hide(); /// \todo open the ESX picker instead - /// \todo move the following code for creating initial records into the document manager std::ostringstream stream; @@ -33,22 +32,6 @@ void CS::Editor::createDocument() CSMDoc::Document *document = mDocumentManager.addDocument (files, true); - static const char *sGlobals[] = - { - "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 - }; - - for (int i=0; sGlobals[i]; ++i) - { - ESM::Global record; - record.mId = sGlobals[i]; - record.mValue = i==0 ? 1 : 0; - record.mType = ESM::VT_Float; - document->getData().getGlobals().add (record); - } - - document->getData().merge(); /// \todo remove once proper ESX loading is implemented - mViewManager.addView (document); } @@ -57,7 +40,7 @@ void CS::Editor::loadDocument() mStartup.hide(); /// \todo open the ESX picker instead - /// \todo replace the manual record creation and load the ESX files instead + /// \todo remove the manual record creation and load the ESX files instead std::ostringstream stream; diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 93d664314..14e34d0ba 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -14,9 +14,19 @@ void CSMDoc::Document::load (const std::vector::const_i void CSMDoc::Document::createBase() { - std::cout << "pretending to create base file records" << std::endl; + static const char *sGlobals[] = + { + "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 + }; - /// \todo create mandatory records for base content file + for (int i=0; sGlobals[i]; ++i) + { + ESM::Global record; + record.mId = sGlobals[i]; + record.mValue = i==0 ? 1 : 0; + record.mType = ESM::VT_Float; + getData().getGlobals().add (record); + } } CSMDoc::Document::Document (const std::vector& files, bool new_) From 66ec4ca7d9e8cd9abaea4dbee0a3b345ae66cabb Mon Sep 17 00:00:00 2001 From: Michal Sciubidlo Date: Mon, 4 Feb 2013 22:14:14 +0100 Subject: [PATCH 29/43] Split launcher specific code from DataFilesList back to DataFilesPage. --- apps/launcher/CMakeLists.txt | 9 + apps/launcher/datafilespage.cpp | 533 +++++++++++++++++ apps/launcher/datafilespage.hpp | 80 +++ apps/launcher/maindialog.cpp | 21 +- apps/launcher/maindialog.hpp | 4 +- .../launcher}/utils/profilescombobox.cpp | 0 .../launcher}/utils/profilescombobox.hpp | 0 .../launcher}/utils/textinputdialog.cpp | 0 .../launcher}/utils/textinputdialog.hpp | 0 apps/opencs/view/doc/opendialog.cpp | 39 +- components/CMakeLists.txt | 2 +- components/fileorderlist/datafileslist.cpp | 563 +----------------- components/fileorderlist/datafileslist.hpp | 31 +- 13 files changed, 706 insertions(+), 576 deletions(-) create mode 100644 apps/launcher/datafilespage.cpp create mode 100644 apps/launcher/datafilespage.hpp rename {components/fileorderlist => apps/launcher}/utils/profilescombobox.cpp (100%) rename {components/fileorderlist => apps/launcher}/utils/profilescombobox.hpp (100%) rename {components/fileorderlist => apps/launcher}/utils/textinputdialog.cpp (100%) rename {components/fileorderlist => apps/launcher}/utils/textinputdialog.hpp (100%) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 73efb9ee5..ce0649cd6 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -3,6 +3,9 @@ set(LAUNCHER main.cpp maindialog.cpp playpage.cpp + datafilespage.cpp + utils/profilescombobox.cpp + utils/textinputdialog.cpp launcher.rc ) @@ -11,6 +14,9 @@ set(LAUNCHER_HEADER graphicspage.hpp maindialog.hpp playpage.hpp + datafilespage.hpp + utils/profilescombobox.hpp + utils/textinputdialog.hpp ) # Headers that must be pre-processed @@ -18,6 +24,9 @@ set(LAUNCHER_HEADER_MOC graphicspage.hpp maindialog.hpp playpage.hpp + datafilespage.hpp + utils/profilescombobox.hpp + utils/textinputdialog.hpp ) source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER} ${LAUNCHER_HEADER_MOC}) diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp new file mode 100644 index 000000000..52b8c9cbe --- /dev/null +++ b/apps/launcher/datafilespage.cpp @@ -0,0 +1,533 @@ +#include + +#include +#include +#include +#include +#include +#include + +////#include "model/datafilesmodel.hpp" +////#include "model/esm/esmfile.hpp" + +#include "utils/profilescombobox.hpp" +////#include "utils/filedialog.hpp" +////#include "utils/naturalsort.hpp" +#include "utils/textinputdialog.hpp" + +#include "datafilespage.hpp" + +#include +/** + * Workaround for problems with whitespaces in paths in older versions of Boost library + */ +#if (BOOST_VERSION <= 104600) +namespace boost +{ + + template<> + inline boost::filesystem::path lexical_cast(const std::string& arg) + { + return boost::filesystem::path(arg); + } + +} /* namespace boost */ +#endif /* (BOOST_VERSION <= 104600) */ + +using namespace ESM; +using namespace std; + +DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, QWidget *parent) + : QWidget(parent) + , mCfgMgr(cfg) +{ + mDataFilesList = new DataFilesList(mCfgMgr, this); + + // Bottom part with profile options + QLabel *profileLabel = new QLabel(tr("Current Profile: "), this); + + mProfilesComboBox = new ProfilesComboBox(this); + mProfilesComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); + mProfilesComboBox->setInsertPolicy(QComboBox::NoInsert); + mProfilesComboBox->setDuplicatesEnabled(false); + mProfilesComboBox->setEditEnabled(false); + + mProfileToolBar = new QToolBar(this); + mProfileToolBar->setMovable(false); + mProfileToolBar->setIconSize(QSize(16, 16)); + + mProfileToolBar->addWidget(profileLabel); + mProfileToolBar->addWidget(mProfilesComboBox); + + QVBoxLayout *pageLayout = new QVBoxLayout(this); + + pageLayout->addWidget(mDataFilesList); + pageLayout->addWidget(mProfileToolBar); + + // Create a dialog for the new profile name input + mNewProfileDialog = new TextInputDialog(tr("New Profile"), tr("Profile name:"), this); + + connect(mNewProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(updateOkButton(QString))); + + connect(mProfilesComboBox, SIGNAL(profileRenamed(QString,QString)), this, SLOT(profileRenamed(QString,QString))); + connect(mProfilesComboBox, SIGNAL(profileChanged(QString,QString)), this, SLOT(profileChanged(QString,QString))); + + createActions(); + setupConfig(); +} + +void DataFilesPage::createActions() +{ + // Refresh the plugins + QAction *refreshAction = new QAction(tr("Refresh"), this); + refreshAction->setShortcut(QKeySequence(tr("F5"))); + connect(refreshAction, SIGNAL(triggered()), this, SLOT(refresh())); + + // Profile actions + mNewProfileAction = new QAction(QIcon::fromTheme("document-new"), tr("&New Profile"), this); + mNewProfileAction->setToolTip(tr("New Profile")); + mNewProfileAction->setShortcut(QKeySequence(tr("Ctrl+N"))); + connect(mNewProfileAction, SIGNAL(triggered()), this, SLOT(newProfile())); + + mDeleteProfileAction = new QAction(QIcon::fromTheme("edit-delete"), tr("Delete Profile"), this); + mDeleteProfileAction->setToolTip(tr("Delete Profile")); + mDeleteProfileAction->setShortcut(QKeySequence(tr("Delete"))); + connect(mDeleteProfileAction, SIGNAL(triggered()), this, SLOT(deleteProfile())); + + // Add the newly created actions to the toolbar + mProfileToolBar->addSeparator(); + mProfileToolBar->addAction(mNewProfileAction); + mProfileToolBar->addAction(mDeleteProfileAction); +} + +void DataFilesPage::setupConfig() +{ + // Open our config file + QString config = QString::fromStdString((mCfgMgr.getUserPath() / "launcher.cfg").string()); + mLauncherConfig = new QSettings(config, QSettings::IniFormat); + + // Make sure we have no groups open + while (!mLauncherConfig->group().isEmpty()) { + mLauncherConfig->endGroup(); + } + + mLauncherConfig->beginGroup("Profiles"); + QStringList profiles = mLauncherConfig->childGroups(); + + // Add the profiles to the combobox + foreach (const QString &profile, profiles) { + + if (profile.contains(QRegExp("[^a-zA-Z0-9_]"))) + continue; // Profile name contains garbage + + + qDebug() << "adding " << profile; + mProfilesComboBox->addItem(profile); + } + + // Add a default profile + if (mProfilesComboBox->findText(QString("Default")) == -1) { + mProfilesComboBox->addItem(QString("Default")); + } + + QString currentProfile = mLauncherConfig->value("CurrentProfile").toString(); + + if (currentProfile.isEmpty()) { + // No current profile selected + currentProfile = "Default"; + } + + const int currentIndex = mProfilesComboBox->findText(currentProfile); + if (currentIndex != -1) { + // Profile is found + mProfilesComboBox->setCurrentIndex(currentIndex); + } + + mLauncherConfig->endGroup(); +} + + +void DataFilesPage::readConfig() +{ + QString profile = mProfilesComboBox->currentText(); + + // Make sure we have no groups open + while (!mLauncherConfig->group().isEmpty()) { + mLauncherConfig->endGroup(); + } + + mLauncherConfig->beginGroup("Profiles"); + mLauncherConfig->beginGroup(profile); + + QStringList childKeys = mLauncherConfig->childKeys(); + QStringList plugins; + + // Sort the child keys numerical instead of alphabetically + // i.e. Plugin1, Plugin2 instead of Plugin1, Plugin10 + qSort(childKeys.begin(), childKeys.end(), naturalSortLessThanCI); + + foreach (const QString &key, childKeys) { + const QString keyValue = mLauncherConfig->value(key).toString(); + + mDataFilesList->setCheckState(keyValue, Qt::Checked); + } + + qDebug() << plugins; +} + +bool DataFilesPage::showDataFilesWarning() +{ + + QMessageBox msgBox; + msgBox.setWindowTitle("Error detecting Morrowind installation"); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setStandardButtons(QMessageBox::Cancel); + msgBox.setText(tr("
Could not find the Data Files location

\ + The directory containing the data files was not found.

\ + Press \"Browse...\" to specify the location manually.
")); + + QAbstractButton *dirSelectButton = + msgBox.addButton(tr("B&rowse..."), QMessageBox::ActionRole); + + msgBox.exec(); + + if (msgBox.clickedButton() == dirSelectButton) { + + // Show a custom dir selection dialog which only accepts valid dirs + QString selectedDir = FileDialog::getExistingDirectory( + this, tr("Select Data Files Directory"), + QDir::currentPath(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + + // Add the user selected data directory + if (!selectedDir.isEmpty()) { + mDataDirs.push_back(Files::PathContainer::value_type(selectedDir.toStdString())); + mCfgMgr.processPaths(mDataDirs); + } else { + // Cancel from within the dir selection dialog + return false; + } + + } else { + // Cancel + return false; + } + + return true; +} + +bool DataFilesPage::setupDataFiles() +{ + // We use the Configuration Manager to retrieve the configuration values + boost::program_options::variables_map variables; + boost::program_options::options_description desc; + + desc.add_options() + ("data", boost::program_options::value()->default_value(Files::PathContainer(), "data")->multitoken()) + ("data-local", boost::program_options::value()->default_value("")) + ("fs-strict", boost::program_options::value()->implicit_value(true)->default_value(false)) + ("encoding", boost::program_options::value()->default_value("win1252")); + + boost::program_options::notify(variables); + + mCfgMgr.readConfiguration(variables, desc); + + if (variables["data"].empty()) { + if (!showDataFilesWarning()) + return false; + } else { + mDataDirs = Files::PathContainer(variables["data"].as()); + } + + std::string local = variables["data-local"].as(); + if (!local.empty()) { + mDataLocal.push_back(Files::PathContainer::value_type(local)); + } + + mCfgMgr.processPaths(mDataDirs); + mCfgMgr.processPaths(mDataLocal); + + // Second chance to display the warning, the data= entries are invalid + while (mDataDirs.empty()) { + if (!showDataFilesWarning()) + return false; + } + + // Set the charset for reading the esm/esp files + QString encoding = QString::fromStdString(variables["encoding"].as()); + + Files::PathContainer paths; + paths.insert(paths.end(), mDataDirs.begin(), mDataDirs.end()); + paths.insert(paths.end(), mDataLocal.begin(), mDataLocal.end()); + mDataFilesList->setupDataFiles(paths, encoding); + readConfig(); + return true; +} + +void DataFilesPage::writeConfig(QString profile) +{ + QString pathStr = QString::fromStdString(mCfgMgr.getUserPath().string()); + QDir userPath(pathStr); + + if (!userPath.exists()) { + if (!userPath.mkpath(pathStr)) { + QMessageBox msgBox; + msgBox.setWindowTitle("Error creating OpenMW configuration directory"); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
Could not create %0

\ + Please make sure you have the right permissions and try again.
").arg(pathStr)); + msgBox.exec(); + + qApp->quit(); + return; + } + } + // Open the OpenMW config as a QFile + QFile file(pathStr.append("openmw.cfg")); + + if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) { + // File cannot be opened or created + QMessageBox msgBox; + msgBox.setWindowTitle("Error writing OpenMW configuration file"); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
Could not open or create %0

\ + Please make sure you have the right permissions and try again.
").arg(file.fileName())); + msgBox.exec(); + + qApp->quit(); + return; + } + + QTextStream in(&file); + QByteArray buffer; + + // Remove all previous entries from config + while (!in.atEnd()) { + QString line = in.readLine(); + if (!line.startsWith("master") && + !line.startsWith("plugin") && + !line.startsWith("data") && + !line.startsWith("data-local")) + { + buffer += line += "\n"; + } + } + + file.close(); + + // Now we write back the other config entries + if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { + QMessageBox msgBox; + msgBox.setWindowTitle("Error writing OpenMW configuration file"); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
Could not write to %0

\ + Please make sure you have the right permissions and try again.
").arg(file.fileName())); + msgBox.exec(); + + qApp->quit(); + return; + } + + if (!buffer.isEmpty()) { + file.write(buffer); + } + + QTextStream gameConfig(&file); + + // First write the list of data dirs + mCfgMgr.processPaths(mDataDirs); + mCfgMgr.processPaths(mDataLocal); + + QString path; + + // data= directories + for (Files::PathContainer::iterator it = mDataDirs.begin(); it != mDataDirs.end(); ++it) { + path = QString::fromStdString(it->string()); + path.remove(QChar('\"')); + + // Make sure the string is quoted when it contains spaces + if (path.contains(" ")) { + gameConfig << "data=\"" << path << "\"" << endl; + } else { + gameConfig << "data=" << path << endl; + } + } + + // data-local directory + if (!mDataLocal.empty()) { + path = QString::fromStdString(mDataLocal.front().string()); + path.remove(QChar('\"')); + + if (path.contains(" ")) { + gameConfig << "data-local=\"" << path << "\"" << endl; + } else { + gameConfig << "data-local=" << path << endl; + } + } + + + if (profile.isEmpty()) + profile = mProfilesComboBox->currentText(); + + if (profile.isEmpty()) + return; + + // Make sure we have no groups open + while (!mLauncherConfig->group().isEmpty()) { + mLauncherConfig->endGroup(); + } + + mLauncherConfig->beginGroup("Profiles"); + mLauncherConfig->setValue("CurrentProfile", profile); + + // Open the profile-name subgroup + mLauncherConfig->beginGroup(profile); + mLauncherConfig->remove(""); // Clear the subgroup + + // Now write the masters to the configs + const QStringList checkedFiles = mDataFilesList->checkedFiles(); + for(int i=0; i < checkedFiles.size(); i++) + { + if (checkedFiles.at(i).lastIndexOf("esm") != -1) + { + mLauncherConfig->setValue(QString("Master%0").arg(i), checkedFiles.at(i)); + gameConfig << "master=" << checkedFiles.at(i) << endl; + } + else + { + mLauncherConfig->setValue(QString("Plugin%1").arg(i), checkedFiles.at(i)); + gameConfig << "plugin=" << checkedFiles.at(i) << endl; + } + } + + file.close(); + mLauncherConfig->endGroup(); + mLauncherConfig->endGroup(); + mLauncherConfig->sync(); +} + + +void DataFilesPage::newProfile() +{ + if (mNewProfileDialog->exec() == QDialog::Accepted) { + + const QString text = mNewProfileDialog->lineEdit()->text(); + mProfilesComboBox->addItem(text); + + // Copy the currently checked items to cfg + writeConfig(text); + mLauncherConfig->sync(); + + mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(text)); + } +} + +void DataFilesPage::updateOkButton(const QString &text) +{ + if (text.isEmpty()) { + mNewProfileDialog->setOkButtonEnabled(false); + return; + } + + (mProfilesComboBox->findText(text) == -1) + ? mNewProfileDialog->setOkButtonEnabled(true) + : mNewProfileDialog->setOkButtonEnabled(false); +} + +void DataFilesPage::deleteProfile() +{ + QString profile = mProfilesComboBox->currentText(); + + if (profile.isEmpty()) + return; + + QMessageBox msgBox(this); + msgBox.setWindowTitle(tr("Delete Profile")); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setStandardButtons(QMessageBox::Cancel); + msgBox.setText(tr("Are you sure you want to delete %0?").arg(profile)); + + QAbstractButton *deleteButton = + msgBox.addButton(tr("Delete"), QMessageBox::ActionRole); + + msgBox.exec(); + + if (msgBox.clickedButton() == deleteButton) { + // Make sure we have no groups open + while (!mLauncherConfig->group().isEmpty()) { + mLauncherConfig->endGroup(); + } + + mLauncherConfig->beginGroup("Profiles"); + + // Open the profile-name subgroup + mLauncherConfig->beginGroup(profile); + mLauncherConfig->remove(""); // Clear the subgroup + mLauncherConfig->endGroup(); + mLauncherConfig->endGroup(); + + // Remove the profile from the combobox + mProfilesComboBox->removeItem(mProfilesComboBox->findText(profile)); + } +} + +void DataFilesPage::profileChanged(const QString &previous, const QString ¤t) +{ + qDebug() << "Profile is changed from: " << previous << " to " << current; + // Prevent the deletion of the default profile + if (current == QLatin1String("Default")) { + mDeleteProfileAction->setEnabled(false); + mProfilesComboBox->setEditEnabled(false); + } else { + mDeleteProfileAction->setEnabled(true); + mProfilesComboBox->setEditEnabled(true); + } + + if (!previous.isEmpty()) { + writeConfig(previous); + mLauncherConfig->sync(); + + if (mProfilesComboBox->currentIndex() == -1) + return; + + } else { + return; + } + + mDataFilesList->uncheckAll(); + readConfig(); +} + +void DataFilesPage::profileRenamed(const QString &previous, const QString ¤t) +{ + if (previous.isEmpty()) + return; + + // Save the new profile name + writeConfig(current); + + // Make sure we have no groups open + while (!mLauncherConfig->group().isEmpty()) { + mLauncherConfig->endGroup(); + } + + mLauncherConfig->beginGroup("Profiles"); + + // Open the profile-name subgroup + mLauncherConfig->beginGroup(previous); + mLauncherConfig->remove(""); // Clear the subgroup + mLauncherConfig->endGroup(); + mLauncherConfig->endGroup(); + mLauncherConfig->sync(); + + // Remove the profile from the combobox + mProfilesComboBox->removeItem(mProfilesComboBox->findText(previous)); + + mDataFilesList->uncheckAll(); + ////mMastersModel->uncheckAll(); + ////mPluginsModel->uncheckAll(); + readConfig(); +} diff --git a/apps/launcher/datafilespage.hpp b/apps/launcher/datafilespage.hpp new file mode 100644 index 000000000..0584de436 --- /dev/null +++ b/apps/launcher/datafilespage.hpp @@ -0,0 +1,80 @@ +#ifndef DATAFILESPAGE_H +#define DATAFILESPAGE_H + +#include +#include +#include "utils/profilescombobox.hpp" +#include + + +class QTableView; +class QSortFilterProxyModel; +class QSettings; +class QAction; +class QToolBar; +class QMenu; +class ProfilesComboBox; +class DataFilesModel; + +class TextInputDialog; +class DataFilesList; + +namespace Files { struct ConfigurationManager; } + +class DataFilesPage : public QWidget +{ + Q_OBJECT + +public: + DataFilesPage(Files::ConfigurationManager& cfg, QWidget *parent = 0); + + ProfilesComboBox *mProfilesComboBox; + + void writeConfig(QString profile = QString()); + bool showDataFilesWarning(); + bool setupDataFiles(); + +public slots: + void profileChanged(const QString &previous, const QString ¤t); + void profileRenamed(const QString &previous, const QString ¤t); + void updateOkButton(const QString &text); + + // Action slots + void newProfile(); + void deleteProfile(); +// void moveUp(); +// void moveDown(); +// void moveTop(); +// void moveBottom(); + +private: + DataFilesList *mDataFilesList; + + QToolBar *mProfileToolBar; + + QAction *mNewProfileAction; + QAction *mDeleteProfileAction; + +// QAction *mMoveUpAction; +// QAction *mMoveDownAction; +// QAction *mMoveTopAction; +// QAction *mMoveBottomAction; + + Files::ConfigurationManager &mCfgMgr; + Files::PathContainer mDataDirs; + Files::PathContainer mDataLocal; + + QSettings *mLauncherConfig; + + TextInputDialog *mNewProfileDialog; + +// const QStringList checkedPlugins(); +// const QStringList selectedMasters(); + + void createActions(); + void setupConfig(); + void readConfig(); + +}; + +#endif diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 7914650fe..674ccdf67 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -1,10 +1,9 @@ #include -#include - #include "maindialog.hpp" #include "playpage.hpp" #include "graphicspage.hpp" +#include "datafilespage.hpp" MainDialog::MainDialog() { @@ -124,16 +123,16 @@ void MainDialog::createPages() { mPlayPage = new PlayPage(this); mGraphicsPage = new GraphicsPage(mCfgMgr, this); - mDataFilesList = new DataFilesList(mCfgMgr, this); + mDataFilesPage = new DataFilesPage(mCfgMgr, this); // Set the combobox of the play page to imitate the combobox on the datafilespage - mPlayPage->mProfilesComboBox->setModel(mDataFilesList->mProfilesComboBox->model()); - mPlayPage->mProfilesComboBox->setCurrentIndex(mDataFilesList->mProfilesComboBox->currentIndex()); + mPlayPage->mProfilesComboBox->setModel(mDataFilesPage->mProfilesComboBox->model()); + mPlayPage->mProfilesComboBox->setCurrentIndex(mDataFilesPage->mProfilesComboBox->currentIndex()); // Add the pages to the stacked widget mPagesWidget->addWidget(mPlayPage); mPagesWidget->addWidget(mGraphicsPage); - mPagesWidget->addWidget(mDataFilesList); + mPagesWidget->addWidget(mDataFilesPage); // Select the first page mIconWidget->setCurrentItem(mIconWidget->item(0), QItemSelectionModel::Select); @@ -142,9 +141,9 @@ void MainDialog::createPages() connect(mPlayPage->mProfilesComboBox, SIGNAL(currentIndexChanged(int)), - mDataFilesList->mProfilesComboBox, SLOT(setCurrentIndex(int))); + mDataFilesPage->mProfilesComboBox, SLOT(setCurrentIndex(int))); - connect(mDataFilesList->mProfilesComboBox, + connect(mDataFilesPage->mProfilesComboBox, SIGNAL(currentIndexChanged(int)), mPlayPage->mProfilesComboBox, SLOT(setCurrentIndex(int))); @@ -190,7 +189,7 @@ bool MainDialog::setup() } // Setup the Data Files page - if (!mDataFilesList->setupDataFiles()) { + if (!mDataFilesPage->setupDataFiles()) { return false; } @@ -208,7 +207,7 @@ void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) void MainDialog::closeEvent(QCloseEvent *event) { // Now write all config files - mDataFilesList->writeConfig(); + mDataFilesPage->writeConfig(); mGraphicsPage->writeConfig(); // Save user settings @@ -221,7 +220,7 @@ void MainDialog::closeEvent(QCloseEvent *event) void MainDialog::play() { // First do a write of all the configs, just to be sure - mDataFilesList->writeConfig(); + mDataFilesPage->writeConfig(); mGraphicsPage->writeConfig(); // Save user settings diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index 5a39c11a9..bf98011cc 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -15,7 +15,7 @@ class QString; class PlayPage; class GraphicsPage; -class DataFilesList; +class DataFilesPage; class MainDialog : public QMainWindow { @@ -39,7 +39,7 @@ private: PlayPage *mPlayPage; GraphicsPage *mGraphicsPage; - DataFilesList *mDataFilesList; + DataFilesPage *mDataFilesPage; Files::ConfigurationManager mCfgMgr; Settings::Manager mSettings; diff --git a/components/fileorderlist/utils/profilescombobox.cpp b/apps/launcher/utils/profilescombobox.cpp similarity index 100% rename from components/fileorderlist/utils/profilescombobox.cpp rename to apps/launcher/utils/profilescombobox.cpp diff --git a/components/fileorderlist/utils/profilescombobox.hpp b/apps/launcher/utils/profilescombobox.hpp similarity index 100% rename from components/fileorderlist/utils/profilescombobox.hpp rename to apps/launcher/utils/profilescombobox.hpp diff --git a/components/fileorderlist/utils/textinputdialog.cpp b/apps/launcher/utils/textinputdialog.cpp similarity index 100% rename from components/fileorderlist/utils/textinputdialog.cpp rename to apps/launcher/utils/textinputdialog.cpp diff --git a/components/fileorderlist/utils/textinputdialog.hpp b/apps/launcher/utils/textinputdialog.hpp similarity index 100% rename from components/fileorderlist/utils/textinputdialog.hpp rename to apps/launcher/utils/textinputdialog.hpp diff --git a/apps/opencs/view/doc/opendialog.cpp b/apps/opencs/view/doc/opendialog.cpp index f51cbadb9..9a5feb23a 100644 --- a/apps/opencs/view/doc/opendialog.cpp +++ b/apps/opencs/view/doc/opendialog.cpp @@ -10,7 +10,42 @@ OpenDialog::OpenDialog(QWidget * parent) : QDialog(parent) QVBoxLayout *layout = new QVBoxLayout(this); mFileSelector = new DataFilesList(mCfgMgr, this); layout->addWidget(mFileSelector); - mFileSelector->setupDataFiles(); + + //FIXME - same as DataFilesPage::setupDataFiles + // We use the Configuration Manager to retrieve the configuration values + boost::program_options::variables_map variables; + boost::program_options::options_description desc; + + desc.add_options() + ("data", boost::program_options::value()->default_value(Files::PathContainer(), "data")->multitoken()) + ("data-local", boost::program_options::value()->default_value("")) + ("fs-strict", boost::program_options::value()->implicit_value(true)->default_value(false)) + ("encoding", boost::program_options::value()->default_value("win1252")); + + boost::program_options::notify(variables); + + mCfgMgr.readConfiguration(variables, desc); + + Files::PathContainer mDataDirs, mDataLocal; + if (!variables["data"].empty()) { + mDataDirs = Files::PathContainer(variables["data"].as()); + } + + std::string local = variables["data-local"].as(); + if (!local.empty()) { + mDataLocal.push_back(Files::PathContainer::value_type(local)); + } + + mCfgMgr.processPaths(mDataDirs); + mCfgMgr.processPaths(mDataLocal); + + // Set the charset for reading the esm/esp files + QString encoding = QString::fromStdString(variables["encoding"].as()); + + Files::PathContainer dataDirs; + dataDirs.insert(dataDirs.end(), mDataDirs.begin(), mDataDirs.end()); + dataDirs.insert(dataDirs.end(), mDataLocal.begin(), mDataLocal.end()); + mFileSelector->setupDataFiles(dataDirs, encoding); buttonBox = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Cancel, Qt::Horizontal, this); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); @@ -23,5 +58,5 @@ OpenDialog::OpenDialog(QWidget * parent) : QDialog(parent) void OpenDialog::getFileList(std::vector& paths) { - mFileSelector->getSelectedFiles(paths); + mFileSelector->selectedFiles(paths); } diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 63a227621..00342e2ac 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -71,7 +71,7 @@ find_package(Qt4 COMPONENTS QtCore QtGui) if(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY) add_component_qt_dir (fileorderlist datafileslist model/modelitem model/datafilesmodel model/esm/esmfile - utils/filedialog utils/lineedit utils/profilescombobox utils/textinputdialog utils/naturalsort + utils/filedialog utils/lineedit utils/naturalsort ) include(${QT_USE_FILE}) diff --git a/components/fileorderlist/datafileslist.cpp b/components/fileorderlist/datafileslist.cpp index f346407a9..38e0bfb1a 100644 --- a/components/fileorderlist/datafileslist.cpp +++ b/components/fileorderlist/datafileslist.cpp @@ -6,11 +6,9 @@ #include "model/datafilesmodel.hpp" #include "model/esm/esmfile.hpp" -#include "utils/profilescombobox.hpp" #include "utils/filedialog.hpp" #include "utils/lineedit.hpp" #include "utils/naturalsort.hpp" -#include "utils/textinputdialog.hpp" #include "datafileslist.hpp" @@ -137,32 +135,10 @@ DataFilesList::DataFilesList(Files::ConfigurationManager &cfg, QWidget *parent) sizeList << 175 << 200; splitter->setSizes(sizeList); - // Bottom part with profile options - QLabel *profileLabel = new QLabel(tr("Current Profile: "), this); - - mProfilesComboBox = new ProfilesComboBox(this); - mProfilesComboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); - mProfilesComboBox->setInsertPolicy(QComboBox::NoInsert); - mProfilesComboBox->setDuplicatesEnabled(false); - mProfilesComboBox->setEditEnabled(false); - - mProfileToolBar = new QToolBar(this); - mProfileToolBar->setMovable(false); - mProfileToolBar->setIconSize(QSize(16, 16)); - - mProfileToolBar->addWidget(profileLabel); - mProfileToolBar->addWidget(mProfilesComboBox); - QVBoxLayout *pageLayout = new QVBoxLayout(this); pageLayout->addWidget(filterToolBar); pageLayout->addWidget(splitter); - pageLayout->addWidget(mProfileToolBar); - - // Create a dialog for the new profile name input - mNewProfileDialog = new TextInputDialog(tr("New Profile"), tr("Profile name:"), this); - - connect(mNewProfileDialog->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(updateOkButton(QString))); connect(mPluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex))); connect(mMastersTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckState(QModelIndex))); @@ -173,11 +149,7 @@ DataFilesList::DataFilesList(Files::ConfigurationManager &cfg, QWidget *parent) connect(mPluginsTable, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); - connect(mProfilesComboBox, SIGNAL(profileRenamed(QString,QString)), this, SLOT(profileRenamed(QString,QString))); - connect(mProfilesComboBox, SIGNAL(profileChanged(QString,QString)), this, SLOT(profileChanged(QString,QString))); - createActions(); - setupConfig(); } void DataFilesList::createActions() @@ -187,22 +159,6 @@ void DataFilesList::createActions() refreshAction->setShortcut(QKeySequence(tr("F5"))); connect(refreshAction, SIGNAL(triggered()), this, SLOT(refresh())); - // Profile actions - mNewProfileAction = new QAction(QIcon::fromTheme("document-new"), tr("&New Profile"), this); - mNewProfileAction->setToolTip(tr("New Profile")); - mNewProfileAction->setShortcut(QKeySequence(tr("Ctrl+N"))); - connect(mNewProfileAction, SIGNAL(triggered()), this, SLOT(newProfile())); - - mDeleteProfileAction = new QAction(QIcon::fromTheme("edit-delete"), tr("Delete Profile"), this); - mDeleteProfileAction->setToolTip(tr("Delete Profile")); - mDeleteProfileAction->setShortcut(QKeySequence(tr("Delete"))); - connect(mDeleteProfileAction, SIGNAL(triggered()), this, SLOT(deleteProfile())); - - // Add the newly created actions to the toolbar - mProfileToolBar->addSeparator(); - mProfileToolBar->addAction(mNewProfileAction); - mProfileToolBar->addAction(mDeleteProfileAction); - // Context menu actions mCheckAction = new QAction(tr("Check selected"), this); connect(mCheckAction, SIGNAL(triggered()), this, SLOT(check())); @@ -218,223 +174,16 @@ void DataFilesList::createActions() } -void DataFilesList::setupConfig() +bool DataFilesList::setupDataFiles(Files::PathContainer dataDirs, const QString encoding) { - // Open our config file - QString config = QString::fromStdString((mCfgMgr.getUserPath() / "launcher.cfg").string()); - mLauncherConfig = new QSettings(config, QSettings::IniFormat); - - // Make sure we have no groups open - while (!mLauncherConfig->group().isEmpty()) { - mLauncherConfig->endGroup(); - } - - mLauncherConfig->beginGroup("Profiles"); - QStringList profiles = mLauncherConfig->childGroups(); - - // Add the profiles to the combobox - foreach (const QString &profile, profiles) { - - if (profile.contains(QRegExp("[^a-zA-Z0-9_]"))) - continue; // Profile name contains garbage - - - qDebug() << "adding " << profile; - mProfilesComboBox->addItem(profile); - } - - // Add a default profile - if (mProfilesComboBox->findText(QString("Default")) == -1) { - mProfilesComboBox->addItem(QString("Default")); - } - - QString currentProfile = mLauncherConfig->value("CurrentProfile").toString(); - - if (currentProfile.isEmpty()) { - // No current profile selected - currentProfile = "Default"; - } - - const int currentIndex = mProfilesComboBox->findText(currentProfile); - if (currentIndex != -1) { - // Profile is found - mProfilesComboBox->setCurrentIndex(currentIndex); - } - - mLauncherConfig->endGroup(); -} - - -void DataFilesList::readConfig() -{ - // Don't read the config if no masters are found - if (mMastersModel->rowCount() < 1) - return; - - QString profile = mProfilesComboBox->currentText(); - - // Make sure we have no groups open - while (!mLauncherConfig->group().isEmpty()) { - mLauncherConfig->endGroup(); - } - - mLauncherConfig->beginGroup("Profiles"); - mLauncherConfig->beginGroup(profile); - - QStringList childKeys = mLauncherConfig->childKeys(); - QStringList plugins; - - // Sort the child keys numerical instead of alphabetically - // i.e. Plugin1, Plugin2 instead of Plugin1, Plugin10 - qSort(childKeys.begin(), childKeys.end(), naturalSortLessThanCI); - - foreach (const QString &key, childKeys) { - const QString keyValue = mLauncherConfig->value(key).toString(); - - if (key.startsWith("Plugin")) { - //QStringList checked = mPluginsModel->checkedItems(); - EsmFile *file = mPluginsModel->findItem(keyValue); - QModelIndex index = mPluginsModel->indexFromItem(file); - - mPluginsModel->setCheckState(index, Qt::Checked); - // Move the row to the top of te view - //mPluginsModel->moveRow(index.row(), checked.count()); - plugins << keyValue; - } - - if (key.startsWith("Master")) { - EsmFile *file = mMastersModel->findItem(keyValue); - mMastersModel->setCheckState(mMastersModel->indexFromItem(file), Qt::Checked); - } - } - - qDebug() << plugins; - - -// // Set the checked item positions -// const QStringList checked = mPluginsModel->checkedItems(); -// for (int i = 0; i < plugins.size(); ++i) { -// EsmFile *file = mPluginsModel->findItem(plugins.at(i)); -// QModelIndex index = mPluginsModel->indexFromItem(file); -// mPluginsModel->moveRow(index.row(), i); -// qDebug() << "Moving: " << plugins.at(i) << " from: " << index.row() << " to: " << i << " count: " << checked.count(); - -// } - - // Iterate over the plugins to set their checkstate and position -// for (int i = 0; i < plugins.size(); ++i) { -// const QString plugin = plugins.at(i); - -// const QList pluginList = mPluginsModel->findItems(plugin); - -// if (!pluginList.isEmpty()) -// { -// foreach (const QStandardItem *currentPlugin, pluginList) { -// mPluginsModel->setData(currentPlugin->index(), Qt::Checked, Qt::CheckStateRole); - -// // Move the plugin to the position specified in the config file -// mPluginsModel->insertRow(i, mPluginsModel->takeRow(currentPlugin->row())); -// } -// } -// } - -} - -bool DataFilesList::showDataFilesWarning() -{ - - QMessageBox msgBox; - msgBox.setWindowTitle("Error detecting Morrowind installation"); - msgBox.setIcon(QMessageBox::Warning); - msgBox.setStandardButtons(QMessageBox::Cancel); - msgBox.setText(tr("
Could not find the Data Files location

\ - The directory containing the data files was not found.

\ - Press \"Browse...\" to specify the location manually.
")); - - QAbstractButton *dirSelectButton = - msgBox.addButton(tr("B&rowse..."), QMessageBox::ActionRole); - - msgBox.exec(); - - if (msgBox.clickedButton() == dirSelectButton) { - - // Show a custom dir selection dialog which only accepts valid dirs - QString selectedDir = FileDialog::getExistingDirectory( - this, tr("Select Data Files Directory"), - QDir::currentPath(), - QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - - // Add the user selected data directory - if (!selectedDir.isEmpty()) { - mDataDirs.push_back(Files::PathContainer::value_type(selectedDir.toStdString())); - mCfgMgr.processPaths(mDataDirs); - } else { - // Cancel from within the dir selection dialog - return false; - } - - } else { - // Cancel - return false; - } - - return true; -} - -bool DataFilesList::setupDataFiles() -{ - // We use the Configuration Manager to retrieve the configuration values - boost::program_options::variables_map variables; - boost::program_options::options_description desc; - - desc.add_options() - ("data", boost::program_options::value()->default_value(Files::PathContainer(), "data")->multitoken()) - ("data-local", boost::program_options::value()->default_value("")) - ("fs-strict", boost::program_options::value()->implicit_value(true)->default_value(false)) - ("encoding", boost::program_options::value()->default_value("win1252")); - - boost::program_options::notify(variables); - - mCfgMgr.readConfiguration(variables, desc); - - if (variables["data"].empty()) { - if (!showDataFilesWarning()) - return false; - } else { - mDataDirs = Files::PathContainer(variables["data"].as()); - } - - std::string local = variables["data-local"].as(); - if (!local.empty()) { - mDataLocal.push_back(Files::PathContainer::value_type(local)); - } - - mCfgMgr.processPaths(mDataDirs); - mCfgMgr.processPaths(mDataLocal); - - // Second chance to display the warning, the data= entries are invalid - while (mDataDirs.empty()) { - if (!showDataFilesWarning()) - return false; - } - // Set the charset for reading the esm/esp files - QString encoding = QString::fromStdString(variables["encoding"].as()); if (!encoding.isEmpty() && encoding != QLatin1String("win1252")) { mMastersModel->setEncoding(encoding); mPluginsModel->setEncoding(encoding); } // Add the paths to the respective models - for (Files::PathContainer::iterator it = mDataDirs.begin(); it != mDataDirs.end(); ++it) { - QString path = QString::fromStdString(it->string()); - path.remove(QChar('\"')); - mMastersModel->addMasters(path); - mPluginsModel->addPlugins(path); - } - - // Same for the data-local paths - for (Files::PathContainer::iterator it = mDataLocal.begin(); it != mDataLocal.end(); ++it) { + for (Files::PathContainer::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) { QString path = QString::fromStdString(it->string()); path.remove(QChar('\"')); mMastersModel->addMasters(path); @@ -446,12 +195,10 @@ bool DataFilesList::setupDataFiles() // mMastersTable->sortByColumn(3, Qt::AscendingOrder); // mPluginsTable->sortByColumn(3, Qt::AscendingOrder); - - readConfig(); return true; } -void DataFilesList::getSelectedFiles(std::vector& paths) +void DataFilesList::selectedFiles(std::vector& paths) { QStringList masterPaths = mMastersModel->checkedItemsPaths(); foreach (const QString &path, masterPaths) @@ -467,225 +214,6 @@ void DataFilesList::getSelectedFiles(std::vector& paths } } -void DataFilesList::writeConfig(QString profile) -{ - // Don't overwrite the config if no masters are found - if (mMastersModel->rowCount() < 1) - return; - - QString pathStr = QString::fromStdString(mCfgMgr.getUserPath().string()); - QDir userPath(pathStr); - - if (!userPath.exists()) { - if (!userPath.mkpath(pathStr)) { - QMessageBox msgBox; - msgBox.setWindowTitle("Error creating OpenMW configuration directory"); - msgBox.setIcon(QMessageBox::Critical); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setText(tr("
Could not create %0

\ - Please make sure you have the right permissions and try again.
").arg(pathStr)); - msgBox.exec(); - - qApp->quit(); - return; - } - } - // Open the OpenMW config as a QFile - QFile file(pathStr.append("openmw.cfg")); - - if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) { - // File cannot be opened or created - QMessageBox msgBox; - msgBox.setWindowTitle("Error writing OpenMW configuration file"); - msgBox.setIcon(QMessageBox::Critical); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setText(tr("
Could not open or create %0

\ - Please make sure you have the right permissions and try again.
").arg(file.fileName())); - msgBox.exec(); - - qApp->quit(); - return; - } - - QTextStream in(&file); - QByteArray buffer; - - // Remove all previous entries from config - while (!in.atEnd()) { - QString line = in.readLine(); - if (!line.startsWith("master") && - !line.startsWith("plugin") && - !line.startsWith("data") && - !line.startsWith("data-local")) - { - buffer += line += "\n"; - } - } - - file.close(); - - // Now we write back the other config entries - if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { - QMessageBox msgBox; - msgBox.setWindowTitle("Error writing OpenMW configuration file"); - msgBox.setIcon(QMessageBox::Critical); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setText(tr("
Could not write to %0

\ - Please make sure you have the right permissions and try again.
").arg(file.fileName())); - msgBox.exec(); - - qApp->quit(); - return; - } - - if (!buffer.isEmpty()) { - file.write(buffer); - } - - QTextStream gameConfig(&file); - - // First write the list of data dirs - mCfgMgr.processPaths(mDataDirs); - mCfgMgr.processPaths(mDataLocal); - - QString path; - - // data= directories - for (Files::PathContainer::iterator it = mDataDirs.begin(); it != mDataDirs.end(); ++it) { - path = QString::fromStdString(it->string()); - path.remove(QChar('\"')); - - // Make sure the string is quoted when it contains spaces - if (path.contains(" ")) { - gameConfig << "data=\"" << path << "\"" << endl; - } else { - gameConfig << "data=" << path << endl; - } - } - - // data-local directory - if (!mDataLocal.empty()) { - path = QString::fromStdString(mDataLocal.front().string()); - path.remove(QChar('\"')); - - if (path.contains(" ")) { - gameConfig << "data-local=\"" << path << "\"" << endl; - } else { - gameConfig << "data-local=" << path << endl; - } - } - - - if (profile.isEmpty()) - profile = mProfilesComboBox->currentText(); - - if (profile.isEmpty()) - return; - - // Make sure we have no groups open - while (!mLauncherConfig->group().isEmpty()) { - mLauncherConfig->endGroup(); - } - - mLauncherConfig->beginGroup("Profiles"); - mLauncherConfig->setValue("CurrentProfile", profile); - - // Open the profile-name subgroup - mLauncherConfig->beginGroup(profile); - mLauncherConfig->remove(""); // Clear the subgroup - - // Now write the masters to the configs - const QStringList masters = mMastersModel->checkedItems(); - - // We don't use foreach because we need i - for (int i = 0; i < masters.size(); ++i) { - const QString currentMaster = masters.at(i); - - mLauncherConfig->setValue(QString("Master%0").arg(i), currentMaster); - gameConfig << "master=" << currentMaster << endl; - - } - - // And finally write all checked plugins - const QStringList plugins = mPluginsModel->checkedItems(); - - for (int i = 0; i < plugins.size(); ++i) { - const QString currentPlugin = plugins.at(i); - mLauncherConfig->setValue(QString("Plugin%1").arg(i), currentPlugin); - gameConfig << "plugin=" << currentPlugin << endl; - } - - file.close(); - mLauncherConfig->endGroup(); - mLauncherConfig->endGroup(); - mLauncherConfig->sync(); -} - - -void DataFilesList::newProfile() -{ - if (mNewProfileDialog->exec() == QDialog::Accepted) { - - const QString text = mNewProfileDialog->lineEdit()->text(); - mProfilesComboBox->addItem(text); - - // Copy the currently checked items to cfg - writeConfig(text); - mLauncherConfig->sync(); - - mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(text)); - } -} - -void DataFilesList::updateOkButton(const QString &text) -{ - if (text.isEmpty()) { - mNewProfileDialog->setOkButtonEnabled(false); - return; - } - - (mProfilesComboBox->findText(text) == -1) - ? mNewProfileDialog->setOkButtonEnabled(true) - : mNewProfileDialog->setOkButtonEnabled(false); -} - -void DataFilesList::deleteProfile() -{ - QString profile = mProfilesComboBox->currentText(); - - if (profile.isEmpty()) - return; - - QMessageBox msgBox(this); - msgBox.setWindowTitle(tr("Delete Profile")); - msgBox.setIcon(QMessageBox::Warning); - msgBox.setStandardButtons(QMessageBox::Cancel); - msgBox.setText(tr("Are you sure you want to delete %0?").arg(profile)); - - QAbstractButton *deleteButton = - msgBox.addButton(tr("Delete"), QMessageBox::ActionRole); - - msgBox.exec(); - - if (msgBox.clickedButton() == deleteButton) { - // Make sure we have no groups open - while (!mLauncherConfig->group().isEmpty()) { - mLauncherConfig->endGroup(); - } - - mLauncherConfig->beginGroup("Profiles"); - - // Open the profile-name subgroup - mLauncherConfig->beginGroup(profile); - mLauncherConfig->remove(""); // Clear the subgroup - mLauncherConfig->endGroup(); - mLauncherConfig->endGroup(); - - // Remove the profile from the combobox - mProfilesComboBox->removeItem(mProfilesComboBox->findText(profile)); - } -} - void DataFilesList::check() { // Check the current selection @@ -733,8 +261,6 @@ void DataFilesList::refresh() // Refresh the plugins table mPluginsTable->scrollToTop(); - writeConfig(); - readConfig(); } @@ -767,70 +293,18 @@ void DataFilesList::setCheckState(QModelIndex index) } +void DataFilesList::uncheckAll() +{ + mMastersModel->uncheckAll(); + mPluginsModel->uncheckAll(); +} + void DataFilesList::filterChanged(const QString filter) { QRegExp regExp(filter, Qt::CaseInsensitive, QRegExp::FixedString); mPluginsProxyModel->setFilterRegExp(regExp); } -void DataFilesList::profileChanged(const QString &previous, const QString ¤t) -{ - qDebug() << "Profile is changed from: " << previous << " to " << current; - // Prevent the deletion of the default profile - if (current == QLatin1String("Default")) { - mDeleteProfileAction->setEnabled(false); - mProfilesComboBox->setEditEnabled(false); - } else { - mDeleteProfileAction->setEnabled(true); - mProfilesComboBox->setEditEnabled(true); - } - - if (!previous.isEmpty()) { - writeConfig(previous); - mLauncherConfig->sync(); - - if (mProfilesComboBox->currentIndex() == -1) - return; - - } else { - return; - } - - mMastersModel->uncheckAll(); - mPluginsModel->uncheckAll(); - readConfig(); -} - -void DataFilesList::profileRenamed(const QString &previous, const QString ¤t) -{ - if (previous.isEmpty()) - return; - - // Save the new profile name - writeConfig(current); - - // Make sure we have no groups open - while (!mLauncherConfig->group().isEmpty()) { - mLauncherConfig->endGroup(); - } - - mLauncherConfig->beginGroup("Profiles"); - - // Open the profile-name subgroup - mLauncherConfig->beginGroup(previous); - mLauncherConfig->remove(""); // Clear the subgroup - mLauncherConfig->endGroup(); - mLauncherConfig->endGroup(); - mLauncherConfig->sync(); - - // Remove the profile from the combobox - mProfilesComboBox->removeItem(mProfilesComboBox->findText(previous)); - - mMastersModel->uncheckAll(); - mPluginsModel->uncheckAll(); - readConfig(); -} - void DataFilesList::showContextMenu(const QPoint &point) { // Make sure there are plugins in the view @@ -858,3 +332,22 @@ void DataFilesList::showContextMenu(const QPoint &point) // Show menu mContextMenu->exec(globalPos); } + +void DataFilesList::setCheckState(const QString& element, Qt::CheckState state) +{ + EsmFile *file = mPluginsModel->findItem(element); + if (file) + { + mPluginsModel->setCheckState(mPluginsModel->indexFromItem(file), Qt::Checked); + } + else + { + file = mMastersModel->findItem(element); + mMastersModel->setCheckState(mMastersModel->indexFromItem(file), Qt::Checked); + } +} + +QStringList DataFilesList::checkedFiles() +{ + return mMastersModel->checkedItems() + mPluginsModel->checkedItems(); +} \ No newline at end of file diff --git a/components/fileorderlist/datafileslist.hpp b/components/fileorderlist/datafileslist.hpp index 7bdb5e057..4b158d316 100644 --- a/components/fileorderlist/datafileslist.hpp +++ b/components/fileorderlist/datafileslist.hpp @@ -3,7 +3,6 @@ #include #include -#include "utils/profilescombobox.hpp" #include @@ -27,25 +26,20 @@ class DataFilesList : public QWidget public: DataFilesList(Files::ConfigurationManager& cfg, QWidget *parent = 0); - ProfilesComboBox *mProfilesComboBox; - - void writeConfig(QString profile = QString()); - bool showDataFilesWarning(); - bool setupDataFiles(); - void getSelectedFiles(std::vector& paths); + bool setupDataFiles(Files::PathContainer dataDirs, const QString encoding); + void selectedFiles(std::vector& paths); + void uncheckAll(); + QStringList checkedFiles(); + void setCheckState(const QString& element, Qt::CheckState); + public slots: void setCheckState(QModelIndex index); void filterChanged(const QString filter); void showContextMenu(const QPoint &point); - void profileChanged(const QString &previous, const QString ¤t); - void profileRenamed(const QString &previous, const QString ¤t); - void updateOkButton(const QString &text); // Action slots - void newProfile(); - void deleteProfile(); // void moveUp(); // void moveDown(); // void moveTop(); @@ -63,12 +57,8 @@ private: QTableView *mMastersTable; QTableView *mPluginsTable; - QToolBar *mProfileToolBar; QMenu *mContextMenu; - QAction *mNewProfileAction; - QAction *mDeleteProfileAction; - // QAction *mMoveUpAction; // QAction *mMoveDownAction; // QAction *mMoveTopAction; @@ -77,20 +67,11 @@ private: QAction *mUncheckAction; Files::ConfigurationManager &mCfgMgr; - Files::PathContainer mDataDirs; - Files::PathContainer mDataLocal; - - QSettings *mLauncherConfig; - - TextInputDialog *mNewProfileDialog; // const QStringList checkedPlugins(); // const QStringList selectedMasters(); void createActions(); - void setupConfig(); - void readConfig(); - }; #endif From 347a734364fa28e045bc1809b3e0a9ca540ca870 Mon Sep 17 00:00:00 2001 From: Michal Sciubidlo Date: Tue, 5 Feb 2013 22:06:36 +0100 Subject: [PATCH 30/43] Move OpenDialog to editor and use it in startup dialogue. Remove debug output from DataFilesList. --- apps/opencs/editor.cpp | 32 +++++++++++----------- apps/opencs/editor.hpp | 3 ++ apps/opencs/view/doc/view.cpp | 29 ++------------------ apps/opencs/view/doc/view.hpp | 5 ---- components/fileorderlist/datafileslist.cpp | 2 -- 5 files changed, 21 insertions(+), 50 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 7156db94e..02b494d3d 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -15,6 +15,8 @@ CS::Editor::Editor() : mViewManager (mDocumentManager), mNewDocumentIndex (0) connect (&mStartup, SIGNAL (createDocument()), this, SLOT (createDocument ())); connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ())); + + connect (&mOpenDialog, SIGNAL(accepted()), this, SLOT(openFiles())); } void CS::Editor::createDocument() @@ -36,26 +38,24 @@ void CS::Editor::createDocument() } void CS::Editor::loadDocument() +{ + mOpenDialog.show(); + mOpenDialog.raise(); + mOpenDialog.activateWindow(); +} + +void CS::Editor::openFiles() { mStartup.hide(); - - /// \todo open the ESX picker instead - /// \todo remove the manual record creation and load the ESX files instead - - std::ostringstream stream; - - stream << "Document" << (++mNewDocumentIndex); - - std::vector files; - files.push_back (stream.str()); - - CSMDoc::Document *document = mDocumentManager.addDocument (files, false); - + std::vector paths; + mOpenDialog.getFileList(paths); + CSMDoc::Document *document = mDocumentManager.addDocument(paths, false); + static const char *sGlobals[] = { "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 }; - + for (int i=0; sGlobals[i]; ++i) { ESM::Global record; @@ -64,9 +64,9 @@ void CS::Editor::loadDocument() record.mType = ESM::VT_Float; document->getData().getGlobals().add (record); } - + document->getData().merge(); /// \todo remove once proper ESX loading is implemented - + mViewManager.addView (document); } diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index 0cd780f7f..024475bf0 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -7,6 +7,7 @@ #include "view/doc/viewmanager.hpp" #include "view/doc/startup.hpp" +#include "view/doc/opendialog.hpp" namespace CS { @@ -19,6 +20,7 @@ namespace CS CSMDoc::DocumentManager mDocumentManager; CSVDoc::ViewManager mViewManager; CSVDoc::StartupDialogue mStartup; + OpenDialog mOpenDialog; // not implemented Editor (const Editor&); @@ -36,6 +38,7 @@ namespace CS void createDocument(); void loadDocument(); + void openFiles(); }; } diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 146e6634e..f5cc3d85b 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -14,7 +14,6 @@ #include "../tools/subviews.hpp" -#include "opendialog.hpp" #include "viewmanager.hpp" #include "operations.hpp" #include "subview.hpp" @@ -32,12 +31,8 @@ void CSVDoc::View::setupFileMenu() QAction *new_ = new QAction (tr ("New"), this); connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest())); file->addAction (new_); - - mOpen = new QAction(tr ("&Open"), this); - connect (mOpen, SIGNAL (triggered()), this, SLOT (open())); - file->addAction (mOpen); - QAction *open = new QAction (tr ("Open"), this); + QAction *open = new QAction (tr ("&Open"), this); connect (open, SIGNAL (triggered()), this, SIGNAL (loadDocumentRequest())); file->addAction (open); @@ -119,7 +114,7 @@ void CSVDoc::View::updateActions() } CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews) -: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews), mOpenDialog(0) +: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews) { setDockOptions (QMainWindow::AllowNestedDocks); @@ -214,26 +209,6 @@ void CSVDoc::View::save() mDocument->save(); } -void CSVDoc::View::open() -{ - if (!mOpenDialog) { - mOpenDialog = new OpenDialog(this); - connect(mOpenDialog, SIGNAL(accepted()), this, SLOT(openNewFiles())); - } - - mOpenDialog->show(); - mOpenDialog->raise(); - mOpenDialog->activateWindow(); -} - -void CSVDoc::View::openNewFiles() -{ - std::vector paths; - mOpenDialog->getFileList(paths); - //FIXME load new files - -} - void CSVDoc::View::verify() { addSubView (mDocument->verify()); diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index bb3763bb9..05d7210dc 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -9,7 +9,6 @@ #include "subviewfactory.hpp" class QAction; -class OpenDialog; namespace CSMDoc { @@ -37,12 +36,10 @@ namespace CSVDoc QAction *mUndo; QAction *mRedo; QAction *mSave; - QAction *mOpen; QAction *mVerify; std::vector mEditingActions; Operations *mOperations; SubViewFactoryManager mSubViewFactory; - OpenDialog * mOpenDialog; // not implemented View (const View&); @@ -97,8 +94,6 @@ namespace CSVDoc void newView(); - void open(); - void openNewFiles(); void save(); void verify(); diff --git a/components/fileorderlist/datafileslist.cpp b/components/fileorderlist/datafileslist.cpp index 38e0bfb1a..d25060baa 100644 --- a/components/fileorderlist/datafileslist.cpp +++ b/components/fileorderlist/datafileslist.cpp @@ -204,13 +204,11 @@ void DataFilesList::selectedFiles(std::vector& paths) foreach (const QString &path, masterPaths) { paths.push_back(path.toStdString()); - cerr << path.toStdString() << endl; } QStringList pluginPaths = mPluginsModel->checkedItemsPaths(); foreach (const QString &path, pluginPaths) { paths.push_back(path.toStdString()); - cerr << path.toStdString() << endl; } } From 6e3c016351ed60c3b029d5e6b5ae605be6883685 Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Sun, 3 Feb 2013 17:42:58 +0100 Subject: [PATCH 31/43] Add archives to settings imported by mwiniimporter Add Morrowind.bsa by default. --- apps/mwiniimporter/importer.cpp | 33 +++++++++++++++++++++++++++++++++ apps/mwiniimporter/importer.hpp | 1 + apps/mwiniimporter/main.cpp | 5 +++++ 3 files changed, 39 insertions(+) diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index 077b62be1..87a87f630 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -777,6 +777,39 @@ void MwIniImporter::insertMultistrmap(multistrmap &cfg, std::string key, std::st cfg[key].push_back(value); } +void MwIniImporter::importArchives(multistrmap &cfg, multistrmap &ini) { + std::vector archives; + std::string baseArchive("Archives:Archive "); + std::string archive; + + // Search archives listed in ini file + multistrmap::iterator it = ini.begin(); + for(int i=0; it != ini.end(); i++) { + archive = baseArchive; + archive.append(this->numberToString(i)); + + it = ini.find(archive); + if(it == ini.end()) { + break; + } + + for(std::vector::iterator entry = it->second.begin(); entry!=it->second.end(); ++entry) { + archives.push_back(*entry); + } + } + + cfg.erase("fallback-archive"); + cfg.insert( std::make_pair > ("fallback-archive", std::vector())); + + // Add Morrowind.bsa by default, since Vanilla loads this archive even if it + // does not appears in the ini file + cfg["fallback-archive"].push_back("Morrowind.bsa"); + + for(std::vector::iterator it=archives.begin(); it!=archives.end(); ++it) { + cfg["fallback-archive"].push_back(*it); + } +} + void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) { std::vector esmFiles; std::vector espFiles; diff --git a/apps/mwiniimporter/importer.hpp b/apps/mwiniimporter/importer.hpp index c87fd3e16..6b99810bc 100644 --- a/apps/mwiniimporter/importer.hpp +++ b/apps/mwiniimporter/importer.hpp @@ -23,6 +23,7 @@ class MwIniImporter { void merge(multistrmap &cfg, multistrmap &ini); void mergeFallback(multistrmap &cfg, multistrmap &ini); void importGameFiles(multistrmap &cfg, multistrmap &ini); + void importArchives(multistrmap &cfg, multistrmap &ini); void writeToFile(boost::iostreams::stream &out, multistrmap &cfg); private: diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index e90f26dd2..c9d88c0bb 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -18,6 +18,7 @@ int main(int argc, char *argv[]) { ("cfg,c", bpo::value(), "openmw.cfg file") ("output,o", bpo::value()->default_value(""), "openmw.cfg file") ("game-files,g", "import esm and esp files") + ("no-archives,A", "disable bsa archives import") ("encoding,e", bpo::value()-> default_value("win1252"), "Character encoding used in OpenMW game messages:\n" "\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian languages\n" @@ -76,6 +77,10 @@ int main(int argc, char *argv[]) { importer.importGameFiles(cfg, ini); } + if(!vm.count("no-archives")) { + importer.importArchives(cfg, ini); + } + std::cout << "write to: " << outputFile << std::endl; boost::iostreams::stream file(outputFile); importer.writeToFile(file, cfg); From a4f051e85a9e423b94759136db60753addc435ca Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Tue, 5 Feb 2013 20:38:15 +0100 Subject: [PATCH 32/43] Fix game files import --- apps/mwiniimporter/importer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index 87a87f630..fc9ce417c 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -827,7 +827,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) { } for(std::vector::iterator entry = it->second.begin(); entry!=it->second.end(); ++entry) { - std::string filetype(entry->substr(entry->length()-4, 3)); + std::string filetype(entry->substr(entry->length()-3)); Misc::StringUtils::toLower(filetype); if(filetype.compare("esm") == 0) { From 814969dcae6ab8428b582bc86921ca38d072274e Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 7 Feb 2013 02:23:41 +0100 Subject: [PATCH 33/43] Cache integrity check uses relative paths, so that changing the build folder works without reset --- extern/shiny/Main/Factory.cpp | 99 ++++++++++++++++++++--------------- extern/shiny/Main/Factory.hpp | 2 + 2 files changed, 58 insertions(+), 43 deletions(-) diff --git a/extern/shiny/Main/Factory.cpp b/extern/shiny/Main/Factory.cpp index c63a9e367..21f13e30b 100644 --- a/extern/shiny/Main/Factory.cpp +++ b/extern/shiny/Main/Factory.cpp @@ -50,7 +50,7 @@ namespace sh { assert(mCurrentLanguage != Language_None); - bool anyShaderDirty = false; + bool removeBinaryCache = false; if (boost::filesystem::exists (mPlatform->getCacheFolder () + "/lastModified.txt")) { @@ -182,57 +182,33 @@ namespace sh } } - std::string sourceFile = mPlatform->getBasePath() + "/" + it->second->findChild("source")->getValue(); + std::string sourceAbsolute = mPlatform->getBasePath() + "/" + it->second->findChild("source")->getValue(); + std::string sourceRelative = it->second->findChild("source")->getValue(); ShaderSet newSet (it->second->findChild("type")->getValue(), cg_profile, hlsl_profile, - sourceFile, + sourceAbsolute, mPlatform->getBasePath(), it->first, &mGlobalSettings); - int lastModified = boost::filesystem::last_write_time (boost::filesystem::path(sourceFile)); - mShadersLastModifiedNew[sourceFile] = lastModified; - if (mShadersLastModified.find(sourceFile) != mShadersLastModified.end() - && mShadersLastModified[sourceFile] != lastModified) + int lastModified = boost::filesystem::last_write_time (boost::filesystem::path(sourceAbsolute)); + mShadersLastModifiedNew[sourceRelative] = lastModified; + if (mShadersLastModified.find(sourceRelative) != mShadersLastModified.end()) { - // delete any outdated shaders based on this shader set. - if ( boost::filesystem::exists(mPlatform->getCacheFolder()) - && boost::filesystem::is_directory(mPlatform->getCacheFolder())) + if (mShadersLastModified[sourceRelative] != lastModified) { - boost::filesystem::directory_iterator end_iter; - for( boost::filesystem::directory_iterator dir_iter(mPlatform->getCacheFolder()) ; dir_iter != end_iter ; ++dir_iter) - { - if (boost::filesystem::is_regular_file(dir_iter->status()) ) - { - boost::filesystem::path file = dir_iter->path(); - - std::string pathname = file.filename().string(); - - // get first part of filename, e.g. main_fragment_546457654 -> main_fragment - // there is probably a better method for this... - std::vector tokens; - boost::split(tokens, pathname, boost::is_any_of("_")); - tokens.erase(--tokens.end()); - std::string shaderName; - for (std::vector::const_iterator vector_iter = tokens.begin(); vector_iter != tokens.end();) - { - shaderName += *(vector_iter++); - if (vector_iter != tokens.end()) - shaderName += "_"; - } - - if (shaderName == it->first) - { - boost::filesystem::remove(file); - std::cout << "Removing outdated file: " << file << std::endl; - } - } - } + // delete any outdated shaders based on this shader set + removeCache (it->first); + // remove the whole binary cache (removing only the individual shaders does not seem to be possible at this point with OGRE) + removeBinaryCache = true; } - - anyShaderDirty = true; } - + else + { + // if we get here, this is either the first run or a new shader file was added + // in both cases we can safely delete + removeCache (it->first); + } mShaderSets.insert(std::make_pair(it->first, newSet)); } } @@ -326,7 +302,7 @@ namespace sh } } - if (mPlatform->supportsShaderSerialization () && mReadMicrocodeCache && !anyShaderDirty) + if (mPlatform->supportsShaderSerialization () && mReadMicrocodeCache && !removeBinaryCache) { std::string file = mPlatform->getCacheFolder () + "/shShaderCache.txt"; if (boost::filesystem::exists(file)) @@ -613,4 +589,41 @@ namespace sh assert(m); m->createForConfiguration (configuration, 0); } + + void Factory::removeCache(const std::string& pattern) + { + if ( boost::filesystem::exists(mPlatform->getCacheFolder()) + && boost::filesystem::is_directory(mPlatform->getCacheFolder())) + { + boost::filesystem::directory_iterator end_iter; + for( boost::filesystem::directory_iterator dir_iter(mPlatform->getCacheFolder()) ; dir_iter != end_iter ; ++dir_iter) + { + if (boost::filesystem::is_regular_file(dir_iter->status()) ) + { + boost::filesystem::path file = dir_iter->path(); + + std::string pathname = file.filename().string(); + + // get first part of filename, e.g. main_fragment_546457654 -> main_fragment + // there is probably a better method for this... + std::vector tokens; + boost::split(tokens, pathname, boost::is_any_of("_")); + tokens.erase(--tokens.end()); + std::string shaderName; + for (std::vector::const_iterator vector_iter = tokens.begin(); vector_iter != tokens.end();) + { + shaderName += *(vector_iter++); + if (vector_iter != tokens.end()) + shaderName += "_"; + } + + if (shaderName == pattern) + { + boost::filesystem::remove(file); + std::cout << "Removing outdated shader: " << file << std::endl; + } + } + } + } + } } diff --git a/extern/shiny/Main/Factory.hpp b/extern/shiny/Main/Factory.hpp index 1062c079c..6d4175c97 100644 --- a/extern/shiny/Main/Factory.hpp +++ b/extern/shiny/Main/Factory.hpp @@ -202,6 +202,8 @@ namespace sh MaterialInstance* findInstance (const std::string& name); MaterialInstance* searchInstance (const std::string& name); + + void removeCache (const std::string& pattern); }; } From 7d112e4d5c033b358638fb89255b4da9f5ed12fe Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 7 Feb 2013 11:33:08 +0100 Subject: [PATCH 34/43] rewrote logic of content file loading --- apps/opencs/model/doc/document.cpp | 28 ++++++++++++++++++---------- apps/opencs/model/doc/document.hpp | 3 ++- apps/opencs/model/world/data.cpp | 5 +++++ apps/opencs/model/world/data.hpp | 5 +++++ 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 14e34d0ba..796135c3f 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -1,15 +1,23 @@ #include "document.hpp" -#include +#include void CSMDoc::Document::load (const std::vector::const_iterator& begin, - const std::vector::const_iterator& end) + const std::vector::const_iterator& end, bool lastAsModified) { - for (std::vector::const_iterator iter (begin); iter!=end; ++iter) - std::cout << "pretending to load " << iter->string() << std::endl; + assert (begin!=end); - /// \todo load content files + std::vector::const_iterator end2 (end); + + if (lastAsModified) + --end2; + + for (std::vector::const_iterator iter (begin); iter!=end2; ++iter) + getData().loadFile (*iter, true); + + if (lastAsModified) + getData().loadFile (*end2, false); } void CSMDoc::Document::createBase() @@ -48,7 +56,7 @@ CSMDoc::Document::Document (const std::vector& files, b if (new_) --end; - load (files.begin(), end); + load (files.begin(), end, !new_); } if (new_ && files.size()==1) @@ -134,10 +142,10 @@ void CSMDoc::Document::saving() if (mSaveCount>15) { - mSaveCount = 0; - mSaveTimer.stop(); - mUndoStack.setClean(); - emit stateChanged (getState(), this); + mSaveCount = 0; + mSaveTimer.stop(); + mUndoStack.setClean(); + emit stateChanged (getState(), this); } } diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 28cc19d44..0162681bc 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -41,7 +41,8 @@ namespace CSMDoc Document& operator= (const Document&); void load (const std::vector::const_iterator& begin, - const std::vector::const_iterator& end); + const std::vector::const_iterator& end, bool lastAsModified); + ///< \param lastAsModified Store the last file in Modified instead of merging it into Base. void createBase(); diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index a3522503e..5d4e63b27 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -59,4 +59,9 @@ QAbstractTableModel *CSMWorld::Data::getTableModel (const UniversalId& id) void CSMWorld::Data::merge() { mGlobals.merge(); +} + +void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base) +{ + std::cout << "pretending to load " << path.string() << std::endl; } \ No newline at end of file diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index f7748cb5d..8a6cd736b 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -4,6 +4,8 @@ #include #include +#include + #include #include "idcollection.hpp" @@ -44,6 +46,9 @@ namespace CSMWorld void merge(); ///< Merge modified into base. + + void loadFile (const boost::filesystem::path& path, bool base); + ///< Merging content of a file into base or modified. }; } From adcaea464bda920b74ce9eea527eb4b004e41531 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 7 Feb 2013 12:52:01 +0100 Subject: [PATCH 35/43] basic globals record loading --- apps/opencs/editor.cpp | 20 ++--------- apps/opencs/model/world/data.cpp | 24 ++++++++++++- apps/opencs/model/world/idcollection.cpp | 2 +- apps/opencs/model/world/idcollection.hpp | 45 ++++++++++++++++++++++-- 4 files changed, 69 insertions(+), 22 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 02b494d3d..9161072f8 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -15,7 +15,7 @@ CS::Editor::Editor() : mViewManager (mDocumentManager), mNewDocumentIndex (0) connect (&mStartup, SIGNAL (createDocument()), this, SLOT (createDocument ())); connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ())); - + connect (&mOpenDialog, SIGNAL(accepted()), this, SLOT(openFiles())); } @@ -50,23 +50,7 @@ void CS::Editor::openFiles() std::vector paths; mOpenDialog.getFileList(paths); CSMDoc::Document *document = mDocumentManager.addDocument(paths, false); - - static const char *sGlobals[] = - { - "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 - }; - - for (int i=0; sGlobals[i]; ++i) - { - ESM::Global record; - record.mId = sGlobals[i]; - record.mValue = i==0 ? 1 : 0; - record.mType = ESM::VT_Float; - document->getData().getGlobals().add (record); - } - - document->getData().merge(); /// \todo remove once proper ESX loading is implemented - + mViewManager.addView (document); } diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 5d4e63b27..9b89533a6 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -5,6 +5,7 @@ #include +#include #include #include "idtable.hpp" @@ -63,5 +64,26 @@ void CSMWorld::Data::merge() void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base) { - std::cout << "pretending to load " << path.string() << std::endl; + ESM::ESMReader reader; + /// \todo set encoder + reader.open (path.string()); + + // Note: We do not need to send update signals here, because at this point the model is not connected + // to any view. + while (reader.hasMoreRecs()) + { + ESM::NAME n = reader.getRecName(); + reader.getRecHeader(); + + switch (n.val) + { + case ESM::REC_GLOB: mGlobals.load (reader, base); break; + + + default: + + /// \todo throw an exception instead, once all records are implemented + reader.skipRecord(); + } + } } \ No newline at end of file diff --git a/apps/opencs/model/world/idcollection.cpp b/apps/opencs/model/world/idcollection.cpp index fc4bb1ef6..5ea953279 100644 --- a/apps/opencs/model/world/idcollection.cpp +++ b/apps/opencs/model/world/idcollection.cpp @@ -3,4 +3,4 @@ CSMWorld::IdCollectionBase::IdCollectionBase() {} -CSMWorld::IdCollectionBase::~IdCollectionBase() {} \ No newline at end of file +CSMWorld::IdCollectionBase::~IdCollectionBase() {} diff --git a/apps/opencs/model/world/idcollection.hpp b/apps/opencs/model/world/idcollection.hpp index 963997924..dd8fbcb38 100644 --- a/apps/opencs/model/world/idcollection.hpp +++ b/apps/opencs/model/world/idcollection.hpp @@ -11,9 +11,12 @@ #include -#include "columnbase.hpp" +#include + #include +#include "columnbase.hpp" + namespace CSMWorld { class IdCollectionBase @@ -67,9 +70,11 @@ namespace CSMWorld virtual std::string getId (const RecordBase& record) const = 0; ///< Return ID for \a record. /// - /// \attention Throw san exception, if the type of \a record does not match. + /// \attention Throws an exception, if the type of \a record does not match. virtual const RecordBase& getRecord (const std::string& id) const = 0; + + virtual void load (ESM::ESMReader& reader, bool base) = 0; }; ///< \brief Collection of ID-based records @@ -136,6 +141,8 @@ namespace CSMWorld virtual const RecordBase& getRecord (const std::string& id) const; + virtual void load (ESM::ESMReader& reader, bool base); + void addColumn (Column *column); }; @@ -309,6 +316,40 @@ namespace CSMWorld return (record2.isModified() ? record2.mModified : record2.mBase).mId; } + template + void IdCollection::load (ESM::ESMReader& reader, bool base) + { + std::string id = reader.getHNOString ("NAME"); + + /// \todo deal with deleted flag + + ESXRecordT record; + record.mId = id; + record.load (reader); + + int index = searchId (id); + + if (index==-1) + { + // new record + Record record2; + record2.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly; + (base ? record2.mBase : record2.mModified) = record; + + appendRecord (record2); + } + else + { + // old record + Record& record2 = mRecords[index]; + + if (base) + record2.mBase = record; + else + record2.setModified (record); + } + } + template const RecordBase& IdCollection::getRecord (const std::string& id) const { From 21733e8181e11d23fc9358d6de2ca9fb61009d89 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 7 Feb 2013 13:11:41 +0100 Subject: [PATCH 36/43] hide startup dialogue when opening open dialogue --- apps/opencs/editor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 9161072f8..5cc659ff9 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -39,6 +39,7 @@ void CS::Editor::createDocument() void CS::Editor::loadDocument() { + mStartup.hide(); mOpenDialog.show(); mOpenDialog.raise(); mOpenDialog.activateWindow(); From c1cd8305bc9a01c2871aa097c6ad004dea8743c0 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 7 Feb 2013 13:13:06 +0100 Subject: [PATCH 37/43] a bit of cleanup for the previous commit --- apps/opencs/editor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 5cc659ff9..e2df365a2 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -47,7 +47,6 @@ void CS::Editor::loadDocument() void CS::Editor::openFiles() { - mStartup.hide(); std::vector paths; mOpenDialog.getFileList(paths); CSMDoc::Document *document = mDocumentManager.addDocument(paths, false); From dd2b7d5c63a050acf26a82399aecf9f967429b62 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 7 Feb 2013 13:26:00 +0100 Subject: [PATCH 38/43] handle deleted records --- apps/opencs/model/world/idcollection.hpp | 56 +++++++++++++++++------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/apps/opencs/model/world/idcollection.hpp b/apps/opencs/model/world/idcollection.hpp index dd8fbcb38..5a1d21ae4 100644 --- a/apps/opencs/model/world/idcollection.hpp +++ b/apps/opencs/model/world/idcollection.hpp @@ -321,32 +321,54 @@ namespace CSMWorld { std::string id = reader.getHNOString ("NAME"); - /// \todo deal with deleted flag - - ESXRecordT record; - record.mId = id; - record.load (reader); - int index = searchId (id); - if (index==-1) + if (reader.isNextSub ("DELE")) { - // new record - Record record2; - record2.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly; - (base ? record2.mBase : record2.mModified) = record; + reader.skipRecord(); - appendRecord (record2); + if (index==-1) + { + // deleting a record that does not exist + + // ignore it for now + + /// \todo report the problem to the user + } + else if (base) + { + removeRows (index, 1); + } + else + { + mRecords[index].mState = RecordBase::State_Deleted; + } } else { - // old record - Record& record2 = mRecords[index]; + ESXRecordT record; + record.mId = id; + record.load (reader); - if (base) - record2.mBase = record; + if (index==-1) + { + // new record + Record record2; + record2.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly; + (base ? record2.mBase : record2.mModified) = record; + + appendRecord (record2); + } else - record2.setModified (record); + { + // old record + Record& record2 = mRecords[index]; + + if (base) + record2.mBase = record; + else + record2.setModified (record); + } } } From d5dd0640c7354661c9e660aef17680efbc1b2a8c Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 8 Feb 2013 09:58:19 +0100 Subject: [PATCH 39/43] basic gmst support --- apps/opencs/model/world/data.cpp | 7 +++++++ apps/opencs/model/world/data.hpp | 2 ++ apps/opencs/model/world/universalid.cpp | 2 ++ apps/opencs/model/world/universalid.hpp | 6 +++--- apps/opencs/view/doc/view.cpp | 9 +++++++++ apps/opencs/view/doc/view.hpp | 2 ++ apps/opencs/view/world/subviews.cpp | 3 +++ components/esm/loadgmst.cpp | 23 ++++++++++++++++++++++- components/esm/loadgmst.hpp | 11 ++++++++--- 9 files changed, 58 insertions(+), 7 deletions(-) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 9b89533a6..89c19f032 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -28,7 +28,13 @@ CSMWorld::Data::Data() mGlobals.addColumn (new FixedRecordTypeColumn (UniversalId::Type_Global)); mGlobals.addColumn (new FloatValueColumn); + mGmsts.addColumn (new StringIdColumn); + mGmsts.addColumn (new RecordStateColumn); + mGmsts.addColumn (new FixedRecordTypeColumn (UniversalId::Type_Gmst)); + ///< \todo add type and value + addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global); + addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst); } CSMWorld::Data::~Data() @@ -78,6 +84,7 @@ void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base) switch (n.val) { case ESM::REC_GLOB: mGlobals.load (reader, base); break; + case ESM::REC_GMST: mGmsts.load (reader, base); break; default: diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index 8a6cd736b..519817a3b 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -7,6 +7,7 @@ #include #include +#include #include "idcollection.hpp" #include "universalid.hpp" @@ -18,6 +19,7 @@ namespace CSMWorld class Data { IdCollection mGlobals; + IdCollection mGmsts; std::vector mModels; std::map mModelIndex; diff --git a/apps/opencs/model/world/universalid.cpp b/apps/opencs/model/world/universalid.cpp index d8775643a..c006852bc 100644 --- a/apps/opencs/model/world/universalid.cpp +++ b/apps/opencs/model/world/universalid.cpp @@ -18,6 +18,7 @@ namespace { { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, "empty" }, { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Globals, "Global Variables" }, + { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Gmsts, "Game Settings" }, { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker }; @@ -25,6 +26,7 @@ namespace static const TypeData sIdArg[] = { { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Global, "Global Variable" }, + { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Gmst, "Game Setting" }, { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0 } // end marker }; diff --git a/apps/opencs/model/world/universalid.hpp b/apps/opencs/model/world/universalid.hpp index 4a73feb12..9ff7d17b1 100644 --- a/apps/opencs/model/world/universalid.hpp +++ b/apps/opencs/model/world/universalid.hpp @@ -33,12 +33,12 @@ namespace CSMWorld enum Type { Type_None, - Type_Globals, - Type_Global, + Type_VerificationResults, + Type_Gmsts, + Type_Gmst - Type_VerificationResults }; private: diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index f5cc3d85b..4fd03041f 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -71,6 +71,10 @@ void CSVDoc::View::setupWorldMenu() connect (globals, SIGNAL (triggered()), this, SLOT (addGlobalsSubView())); world->addAction (globals); + QAction *gmsts = new QAction (tr ("Game settings"), this); + connect (gmsts, SIGNAL (triggered()), this, SLOT (addGmstsSubView())); + world->addAction (gmsts); + mVerify = new QAction (tr ("&Verify"), this); connect (mVerify, SIGNAL (triggered()), this, SLOT (verify())); world->addAction (mVerify); @@ -217,4 +221,9 @@ void CSVDoc::View::verify() void CSVDoc::View::addGlobalsSubView() { addSubView (CSMWorld::UniversalId::Type_Globals); +} + +void CSVDoc::View::addGmstsSubView() +{ + addSubView (CSMWorld::UniversalId::Type_Gmsts); } \ No newline at end of file diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index 05d7210dc..6bdd54e6b 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -99,6 +99,8 @@ namespace CSVDoc void verify(); void addGlobalsSubView(); + + void addGmstsSubView(); }; } diff --git a/apps/opencs/view/world/subviews.cpp b/apps/opencs/view/world/subviews.cpp index 080a175ea..351007ded 100644 --- a/apps/opencs/view/world/subviews.cpp +++ b/apps/opencs/view/world/subviews.cpp @@ -11,6 +11,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager) manager.add (CSMWorld::UniversalId::Type_Globals, new CSVDoc::SubViewFactoryWithCreateFlag (true)); + manager.add (CSMWorld::UniversalId::Type_Gmsts, + new CSVDoc::SubViewFactoryWithCreateFlag (false)); + manager.add (CSMWorld::UniversalId::Type_Global, new CSVDoc::SubViewFactoryWithCreateFlag (true)); } \ No newline at end of file diff --git a/components/esm/loadgmst.cpp b/components/esm/loadgmst.cpp index a73095a66..e9852ec07 100644 --- a/components/esm/loadgmst.cpp +++ b/components/esm/loadgmst.cpp @@ -76,8 +76,29 @@ std::string GameSetting::getString() const { if (mType==VT_String) return mStr; - + throw std::runtime_error ("GMST " + mId + " is not a string"); } + void GameSetting::blank() + { + mStr.clear(); + mI = 0; + mF = 0; + mType = VT_Float; + } + + bool operator== (const GameSetting& left, const GameSetting& right) + { + if (left.mType!=right.mType) + return false; + + switch (left.mType) + { + case VT_Float: return left.mF==right.mF; + case VT_Int: return left.mI==right.mI; + case VT_String: return left.mStr==right.mStr; + default: return false; + } + } } diff --git a/components/esm/loadgmst.hpp b/components/esm/loadgmst.hpp index ab9a9551e..f7aec5c76 100644 --- a/components/esm/loadgmst.hpp +++ b/components/esm/loadgmst.hpp @@ -26,17 +26,22 @@ struct GameSetting VarType mType; void load(ESMReader &esm); - + int getInt() const; ///< Throws an exception if GMST is not of type int or float. - + float getFloat() const; ///< Throws an exception if GMST is not of type int or float. - + std::string getString() const; ///< Throwns an exception if GMST is not of type string. void save(ESMWriter &esm); + + void blank(); + ///< Set record to default state (does not touch the ID). }; + + bool operator== (const GameSetting& left, const GameSetting& right); } #endif From cce2d63433a137fa47856670bc433291e4321852 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 8 Feb 2013 12:20:03 +0100 Subject: [PATCH 40/43] added type column to gmst table --- apps/opencs/model/world/columns.hpp | 23 +++++++++++++++++++++++ apps/opencs/model/world/data.cpp | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/opencs/model/world/columns.hpp b/apps/opencs/model/world/columns.hpp index 1e2de9265..747387676 100644 --- a/apps/opencs/model/world/columns.hpp +++ b/apps/opencs/model/world/columns.hpp @@ -91,6 +91,29 @@ namespace CSMWorld return false; } }; + + template + struct VarTypeColumn : public Column + { + VarTypeColumn() : Column ("Type", ColumnBase::Display_Float) {} + + virtual QVariant get (const Record& record) const + { + return static_cast (record.get().mType); + } + + virtual void set (Record& record, const QVariant& data) + { + ESXRecordT base = record.getBase(); + base.mType = static_cast (data.toInt()); + record.setModified (base); + } + + virtual bool isEditable() const + { + return true; + } + }; } #endif \ No newline at end of file diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 89c19f032..69e62db01 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -31,7 +31,8 @@ CSMWorld::Data::Data() mGmsts.addColumn (new StringIdColumn); mGmsts.addColumn (new RecordStateColumn); mGmsts.addColumn (new FixedRecordTypeColumn (UniversalId::Type_Gmst)); - ///< \todo add type and value + mGmsts.addColumn (new VarTypeColumn); + ///< \todo add value addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global); addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst); From 828695f295e07cd9ece9cbc6333a83c49cf033b3 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 8 Feb 2013 14:48:38 +0100 Subject: [PATCH 41/43] added value column to gmst table --- apps/opencs/model/world/columnbase.hpp | 3 +- apps/opencs/model/world/columns.hpp | 41 +++++++++++++++++++++- apps/opencs/model/world/data.cpp | 2 +- apps/opencs/view/world/dialoguesubview.cpp | 4 +++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/apps/opencs/model/world/columnbase.hpp b/apps/opencs/model/world/columnbase.hpp index 38b73ee3f..f1871a6a9 100644 --- a/apps/opencs/model/world/columnbase.hpp +++ b/apps/opencs/model/world/columnbase.hpp @@ -28,7 +28,8 @@ namespace CSMWorld { Display_String, Display_Integer, - Display_Float + Display_Float, + Display_Var }; std::string mTitle; diff --git a/apps/opencs/model/world/columns.hpp b/apps/opencs/model/world/columns.hpp index 747387676..fb94cbf59 100644 --- a/apps/opencs/model/world/columns.hpp +++ b/apps/opencs/model/world/columns.hpp @@ -95,7 +95,7 @@ namespace CSMWorld template struct VarTypeColumn : public Column { - VarTypeColumn() : Column ("Type", ColumnBase::Display_Float) {} + VarTypeColumn() : Column ("Type", ColumnBase::Display_Integer) {} virtual QVariant get (const Record& record) const { @@ -114,6 +114,45 @@ namespace CSMWorld return true; } }; + + template + struct VarValueColumn : public Column + { + VarValueColumn() : Column ("Value", ColumnBase::Display_Var) {} + + virtual QVariant get (const Record& record) const + { + switch (record.get().mType) + { + case ESM::VT_String: return record.get().mStr.c_str(); break; + case ESM::VT_Int: return record.get().mI; break; + case ESM::VT_Float: return record.get().mF; break; + + default: return QVariant(); + } + } + + virtual void set (Record& record, const QVariant& data) + { + ESXRecordT base = record.getBase(); + + switch (record.get().mType) + { + case ESM::VT_String: base.mStr = data.toString().toUtf8().constData(); break; + case ESM::VT_Int: base.mI = data.toInt(); break; + case ESM::VT_Float: base.mF = data.toFloat(); break; + + default: break; + } + + record.setModified (base); + } + + virtual bool isEditable() const + { + return true; + } + }; } #endif \ No newline at end of file diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 69e62db01..f120c75f1 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -32,7 +32,7 @@ CSMWorld::Data::Data() mGmsts.addColumn (new RecordStateColumn); mGmsts.addColumn (new FixedRecordTypeColumn (UniversalId::Type_Gmst)); mGmsts.addColumn (new VarTypeColumn); - ///< \todo add value + mGmsts.addColumn (new VarValueColumn); addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global); addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst); diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 2bf6577b1..e16de99ef 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -64,6 +64,8 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM /// \todo configure widget properly (range, format?) layout->addWidget (widget = new QDoubleSpinBox, i, 1); break; + + default: break; // silence warnings for other times for now } } else @@ -76,6 +78,8 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM layout->addWidget (widget = new QLabel, i, 1); break; + + default: break; // silence warnings for other times for now } } From eefbdde6de862e15f27ae90c410687eb8a988729 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sat, 9 Feb 2013 13:00:57 +0100 Subject: [PATCH 42/43] - For pull request: remove all instances of maps used to track refnumbers. - new file: apps/openmw/mwworld/store.cpp, had to move reference merging method out of the header file to prevent three-way recursion/unresolved forward references in custom compare operators. --- apps/openmw/main.cpp | 6 +- apps/openmw/mwworld/cells.cpp | 12 ++-- apps/openmw/mwworld/cellstore.cpp | 42 ++++++++++++- apps/openmw/mwworld/cellstore.hpp | 84 ++++---------------------- apps/openmw/mwworld/containerstore.cpp | 28 ++++----- apps/openmw/mwworld/containerstore.hpp | 72 +++++++++++----------- apps/openmw/mwworld/localscripts.cpp | 6 +- apps/openmw/mwworld/scene.cpp | 6 +- apps/openmw/mwworld/store.cpp | 65 ++++++++++++++++++++ apps/openmw/mwworld/store.hpp | 64 +++----------------- apps/openmw/mwworld/worldimp.cpp | 14 ++--- components/esm/loadcell.cpp | 26 +++++--- components/esm/loadcell.hpp | 33 +++++----- 13 files changed, 233 insertions(+), 225 deletions(-) create mode 100644 apps/openmw/mwworld/store.cpp diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 1be669ae0..86978c9b1 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -213,8 +213,10 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat StringsVector plugin = variables["plugin"].as(); // Removed check for 255 files, which would be the hard-coded limit in Morrowind. - // I'll keep the following variable in, maybe we can use it for somethng different. - int cnt = master.size() + plugin.size(); + // I'll keep the following variable in, maybe we can use it for something different. + // Say, a feedback like "loading file x/cnt". + // Commenting this out for now to silence compiler warning. + //int cnt = master.size() + plugin.size(); // Prepare loading master/plugin files (i.e. send filenames to engine) for (std::vector::size_type i = 0; i < master.size(); i++) diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index 7e421dc55..59c62e37d 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -42,30 +42,30 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore) cellStore.mContainers.mList.begin()); iter!=cellStore.mContainers.mList.end(); ++iter) { - Ptr container (&iter->second, &cellStore); + Ptr container (&*iter, &cellStore); Class::get (container).getContainerStore (container).fill ( - iter->second.mBase->mInventory, mStore); + iter->mBase->mInventory, mStore); } for (CellRefList::List::iterator iter ( cellStore.mCreatures.mList.begin()); iter!=cellStore.mCreatures.mList.end(); ++iter) { - Ptr container (&iter->second, &cellStore); + Ptr container (&*iter, &cellStore); Class::get (container).getContainerStore (container).fill ( - iter->second.mBase->mInventory, mStore); + iter->mBase->mInventory, mStore); } for (CellRefList::List::iterator iter ( cellStore.mNpcs.mList.begin()); iter!=cellStore.mNpcs.mList.end(); ++iter) { - Ptr container (&iter->second, &cellStore); + Ptr container (&*iter, &cellStore); Class::get (container).getContainerStore (container).fill ( - iter->second.mBase->mInventory, mStore); + iter->mBase->mInventory, mStore); } } diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 7f1cdc469..baf4fea32 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -10,6 +10,41 @@ namespace MWWorld { + + template + void CellRefList::load(ESM::CellRef &ref, const MWWorld::ESMStore &esmStore) + { + // Get existing reference, in case we need to overwrite it. + typename std::list::iterator iter = std::find(mList.begin(), mList.end(), ref.mRefnum); + + // Skip this when reference was deleted. + // TODO: Support respawning references, in this case, we need to track it somehow. + if (ref.mDeleted) { + mList.erase(iter); + return; + } + + // for throwing exception on unhandled record type + const MWWorld::Store &store = esmStore.get(); + const X *ptr = store.search(ref.mRefID); + + /// \note no longer redundant - changed to Store::search(), don't throw + /// an exception on miss, try to continue (that's how MW does it, anyway) + if (ptr == NULL) { + std::cout << "Warning: could not resolve cell reference " << ref.mRefID << ", trying to continue anyway" << std::endl; + } else { + if (iter != mList.end()) + *iter = LiveRef(ref, ptr); + else + mList.push_back(LiveRef(ref, ptr)); + } + } + + template bool operator==(const LiveCellRef& ref, int pRefnum) + { + return (ref.mRef.mRefnum == pRefnum); + } + CellStore::CellStore (const ESM::Cell *cell) : mCell (cell), mState (State_Unloaded) { @@ -95,7 +130,8 @@ namespace MWWorld { // Don't load reference if it was moved to a different cell. std::string lowerCase = Misc::StringUtils::lowerCase(ref.mRefID); - if (mCell->mMovedRefs.find(ref.mRefnum) != mCell->mMovedRefs.end()) { + ESM::MovedCellRefTracker::const_iterator iter = std::find(mCell->mMovedRefs.begin(), mCell->mMovedRefs.end(), ref.mRefnum); + if (iter != mCell->mMovedRefs.end()) { continue; } int rec = store.find(ref.mRefID); @@ -141,8 +177,8 @@ namespace MWWorld for (ESM::CellRefTracker::const_iterator it = mCell->mLeasedRefs.begin(); it != mCell->mLeasedRefs.end(); it++) { // Doesn't seem to work in one line... huh? Too sleepy to check... - //const ESM::CellRef &ref0 = it->second; - ESM::CellRef &ref = const_cast(it->second); + ESM::CellRef &ref = const_cast(*it); + //ESM::CellRef &ref = const_cast(it->second); std::string lowerCase; diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index cbaf56458..c182f196b 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -9,11 +9,12 @@ #include "refdata.hpp" #include "esmstore.hpp" +struct C; namespace MWWorld { class Ptr; class ESMStore; - + /// A reference to one object (of any type) in a cell. /// /// Constructing this with a CellRef instance in the constructor means that @@ -42,88 +43,25 @@ namespace MWWorld /// runtime-data RefData mData; }; + + template bool operator==(const LiveCellRef& ref, int pRefnum); /// A list of cell references template struct CellRefList { typedef LiveCellRef LiveRef; - typedef std::map List; + typedef std::list List; List mList; // Search for the given reference in the given reclist from // ESMStore. Insert the reference into the list if a match is // found. If not, throw an exception. - /// Searches for reference of appropriate type in given ESMStore. - /// If reference exists, loads it into container, throws an exception - /// on miss - void load(ESM::CellRef &ref, const MWWorld::ESMStore &esmStore) - { - // Skip this when reference was deleted. - // TODO: Support respawning references, in this case, we need to track it somehow. - if (ref.mDeleted) { - mList.erase(ref.mRefnum); - return; - } - - // for throwing exception on unhandled record type - const MWWorld::Store &store = esmStore.get(); - const X *ptr = store.search(ref.mRefID); - - /// \note no longer redundant - changed to Store::search(), don't throw - /// an exception on miss, try to continue (that's how MW does it, anyway) - if (ptr == NULL) { - std::cout << "Warning: could not resolve cell reference " << ref.mRefID << ", trying to continue anyway" << std::endl; - } else - mList[ref.mRefnum] = LiveRef(ref, ptr); - } - - LiveRef *find (const std::string& name) - { - for (typename std::map::iterator iter (mList.begin()); iter!=mList.end(); ++iter) - { - if (iter->second.mData.getCount() > 0 && iter->second.mRef.mRefID == name) - return &iter->second; - } - - return 0; - } - - LiveRef &insert(const LiveRef &item) { - mList[item.mRef.mRefnum] = item; - return mList[item.mRef.mRefnum]; - } - }; - - /// A list of container references. These references do not track their mRefnumber. - /// Otherwise, taking 1 of 20 instances of an object would produce multiple objects - /// with the same reference. - /// Unfortunately, this also means that we need a different STL container. - /// (cells use CellRefList, where refs can be located according to their refnumner, - /// which uses a map; container items do not make use of the refnumber, so we - /// can't use a map with refnumber keys.) - template - struct ContainerRefList - { - typedef LiveCellRef LiveRef; - typedef std::list List; - List mList; - - /// Searches for reference of appropriate type in given ESMStore. - /// If reference exists, loads it into container, throws an exception - /// on miss - void load(ESM::CellRef &ref, const MWWorld::ESMStore &esmStore) - { - // for throwing exception on unhandled record type - const MWWorld::Store &store = esmStore.get(); - const X *ptr = store.find(ref.mRefID); - - /// \note redundant because Store::find() throws exception on miss - if (ptr == NULL) { - throw std::runtime_error("Error resolving cell reference " + ref.mRefID); - } - mList.push_back(LiveRef(ref, ptr)); - } + // Moved to cpp file, as we require a custom compare operator for it, + // and the build will fail with an ugly three-way cyclic header dependence + // so we need to pass the instantiation of the method to the lnker, when + // all methods are known. + void load(ESM::CellRef &ref, const MWWorld::ESMStore &esmStore); LiveRef *find (const std::string& name) { @@ -236,7 +174,7 @@ namespace MWWorld { for (typename List::List::iterator iter (list.mList.begin()); iter!=list.mList.end(); ++iter) - if (!functor (iter->second.mRef, iter->second.mData)) + if (!functor (iter->mRef, iter->mData)) return false; return true; diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 36addee86..bca4073b5 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -21,11 +21,11 @@ namespace { template - float getTotalWeight (const MWWorld::ContainerRefList& cellRefList) + float getTotalWeight (const MWWorld::CellRefList& cellRefList) { float sum = 0; - for (typename MWWorld::ContainerRefList::List::const_iterator iter ( + for (typename MWWorld::CellRefList::List::const_iterator iter ( cellRefList.mList.begin()); iter!=cellRefList.mList.end(); ++iter) @@ -300,29 +300,29 @@ MWWorld::ContainerStoreIterator::ContainerStoreIterator (int mask, ContainerStor ++*this; } -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Potion), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mPotion(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Apparatus), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mApparatus(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Armor), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mArmor(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Book), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mBook(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Clothing), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mClothing(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Ingredient), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mIngredient(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Light), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLight(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Lockpick), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mLockpick(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Miscellaneous), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mMiscellaneous(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Probe), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mProbe(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Repair), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mRepair(iterator){} -MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator iterator) +MWWorld::ContainerStoreIterator::ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator iterator) : mType(MWWorld::ContainerStore::Type_Weapon), mMask(MWWorld::ContainerStore::Type_All), mContainer(container), mWeapon(iterator){} void MWWorld::ContainerStoreIterator::incType() diff --git a/apps/openmw/mwworld/containerstore.hpp b/apps/openmw/mwworld/containerstore.hpp index 63695c0df..e4f75d547 100644 --- a/apps/openmw/mwworld/containerstore.hpp +++ b/apps/openmw/mwworld/containerstore.hpp @@ -37,18 +37,18 @@ namespace MWWorld private: - MWWorld::ContainerRefList potions; - MWWorld::ContainerRefList appas; - MWWorld::ContainerRefList armors; - MWWorld::ContainerRefList books; - MWWorld::ContainerRefList clothes; - MWWorld::ContainerRefList ingreds; - MWWorld::ContainerRefList lights; - MWWorld::ContainerRefList lockpicks; - MWWorld::ContainerRefList miscItems; - MWWorld::ContainerRefList probes; - MWWorld::ContainerRefList repairs; - MWWorld::ContainerRefList weapons; + MWWorld::CellRefList potions; + MWWorld::CellRefList appas; + MWWorld::CellRefList armors; + MWWorld::CellRefList books; + MWWorld::CellRefList clothes; + MWWorld::CellRefList ingreds; + MWWorld::CellRefList lights; + MWWorld::CellRefList lockpicks; + MWWorld::CellRefList miscItems; + MWWorld::CellRefList probes; + MWWorld::CellRefList repairs; + MWWorld::CellRefList weapons; int mStateId; mutable float mCachedWeight; mutable bool mWeightUpToDate; @@ -120,18 +120,18 @@ namespace MWWorld ContainerStore *mContainer; mutable Ptr mPtr; - MWWorld::ContainerRefList::List::iterator mPotion; - MWWorld::ContainerRefList::List::iterator mApparatus; - MWWorld::ContainerRefList::List::iterator mArmor; - MWWorld::ContainerRefList::List::iterator mBook; - MWWorld::ContainerRefList::List::iterator mClothing; - MWWorld::ContainerRefList::List::iterator mIngredient; - MWWorld::ContainerRefList::List::iterator mLight; - MWWorld::ContainerRefList::List::iterator mLockpick; - MWWorld::ContainerRefList::List::iterator mMiscellaneous; - MWWorld::ContainerRefList::List::iterator mProbe; - MWWorld::ContainerRefList::List::iterator mRepair; - MWWorld::ContainerRefList::List::iterator mWeapon; + MWWorld::CellRefList::List::iterator mPotion; + MWWorld::CellRefList::List::iterator mApparatus; + MWWorld::CellRefList::List::iterator mArmor; + MWWorld::CellRefList::List::iterator mBook; + MWWorld::CellRefList::List::iterator mClothing; + MWWorld::CellRefList::List::iterator mIngredient; + MWWorld::CellRefList::List::iterator mLight; + MWWorld::CellRefList::List::iterator mLockpick; + MWWorld::CellRefList::List::iterator mMiscellaneous; + MWWorld::CellRefList::List::iterator mProbe; + MWWorld::CellRefList::List::iterator mRepair; + MWWorld::CellRefList::List::iterator mWeapon; private: @@ -142,18 +142,18 @@ namespace MWWorld ///< Begin-iterator // construct iterator using a CellRefList iterator - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); - ContainerStoreIterator (ContainerStore *container, MWWorld::ContainerRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); + ContainerStoreIterator (ContainerStore *container, MWWorld::CellRefList::List::iterator); void incType(); diff --git a/apps/openmw/mwworld/localscripts.cpp b/apps/openmw/mwworld/localscripts.cpp index 91622c354..5ec5ca9b5 100644 --- a/apps/openmw/mwworld/localscripts.cpp +++ b/apps/openmw/mwworld/localscripts.cpp @@ -17,9 +17,9 @@ namespace cellRefList.mList.begin()); iter!=cellRefList.mList.end(); ++iter) { - if (!iter->second.mBase->mScript.empty() && iter->second.mData.getCount()) + if (!iter->mBase->mScript.empty() && iter->mData.getCount()) { - localScripts.add (iter->second.mBase->mScript, MWWorld::Ptr (&iter->second, cell)); + localScripts.add (iter->mBase->mScript, MWWorld::Ptr (&*iter, cell)); } } } @@ -34,7 +34,7 @@ namespace iter!=cellRefList.mList.end(); ++iter) { - MWWorld::Ptr containerPtr (&iter->second, cell); + MWWorld::Ptr containerPtr (&*iter, cell); MWWorld::ContainerStore& container = MWWorld::Class::get(containerPtr).getContainerStore(containerPtr); for(MWWorld::ContainerStoreIterator it3 = container.begin(); it3 != container.end(); ++it3) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 768ca9e11..b917a8916 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -23,7 +23,7 @@ namespace if (!cellRefList.mList.empty()) { const MWWorld::Class& class_ = - MWWorld::Class::get (MWWorld::Ptr (&cellRefList.mList.begin()->second, &cell)); + MWWorld::Class::get (MWWorld::Ptr (&*cellRefList.mList.begin(), &cell)); int numRefs = cellRefList.mList.size(); int current = 0; @@ -33,9 +33,9 @@ namespace MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 1, current, numRefs); ++current; - if (it->second.mData.getCount() || it->second.mData.isEnabled()) + if (it->mData.getCount() || it->mData.isEnabled()) { - MWWorld::Ptr ptr (&it->second, &cell); + MWWorld::Ptr ptr (&*it, &cell); try { diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp new file mode 100644 index 000000000..005601cd1 --- /dev/null +++ b/apps/openmw/mwworld/store.cpp @@ -0,0 +1,65 @@ +#include "store.hpp" + +namespace MWWorld { + + +void Store::load(ESM::ESMReader &esm, const std::string &id) +{ + // Don't automatically assume that a new cell must be spawned. Multiple plugins write to the same cell, + // and we merge all this data into one Cell object. However, we can't simply search for the cell id, + // as many exterior cells do not have a name. Instead, we need to search by (x,y) coordinates - and they + // are not available until both cells have been loaded! So first, proceed as usual. + + // All cells have a name record, even nameless exterior cells. + std::string idLower = Misc::StringUtils::lowerCase(id); + ESM::Cell *cell = new ESM::Cell; + cell->mName = id; + + // The cell itself takes care of some of the hairy details + cell->load(esm, *mEsmStore); + + if(cell->mData.mFlags & ESM::Cell::Interior) + { + // Store interior cell by name, try to merge with existing parent data. + ESM::Cell *oldcell = const_cast(search(idLower)); + if (oldcell) { + // push the new references on the list of references to manage + oldcell->mContextList.push_back(cell->mContextList.at(0)); + // copy list into new cell + cell->mContextList = oldcell->mContextList; + // have new cell replace old cell + *oldcell = *cell; + } else + mInt[idLower] = *cell; + } + else + { + // Store exterior cells by grid position, try to merge with existing parent data. + ESM::Cell *oldcell = const_cast(search(cell->getGridX(), cell->getGridY())); + if (oldcell) { + // push the new references on the list of references to manage + oldcell->mContextList.push_back(cell->mContextList.at(0)); + // copy list into new cell + cell->mContextList = oldcell->mContextList; + // merge lists of leased references, use newer data in case of conflict + for (ESM::MovedCellRefTracker::const_iterator it = cell->mMovedRefs.begin(); it != cell->mMovedRefs.end(); it++) { + // remove reference from current leased ref tracker and add it to new cell + ESM::MovedCellRefTracker::iterator itold = std::find(oldcell->mMovedRefs.begin(), oldcell->mMovedRefs.end(), it->mRefnum); + if (itold != oldcell->mMovedRefs.end()) { + ESM::MovedCellRef target0 = *itold; + ESM::Cell *wipecell = const_cast(search(target0.mTarget[0], target0.mTarget[1])); + ESM::CellRefTracker::iterator it_lease = std::find(wipecell->mLeasedRefs.begin(), wipecell->mLeasedRefs.end(), it->mRefnum); + wipecell->mLeasedRefs.erase(it_lease); + *itold = *it; + } + } + cell->mMovedRefs = oldcell->mMovedRefs; + // have new cell replace old cell + *oldcell = *cell; + } else + mExt[std::make_pair(cell->mData.mX, cell->mData.mY)] = *cell; + } + delete cell; +} + +} \ No newline at end of file diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index dbad7432f..cb18873cc 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -187,7 +187,7 @@ namespace MWWorld T item; item.mId = Misc::StringUtils::lowerCase(id); - typename std::map::const_iterator it = mStatic.find(item.mId); + typename std::map::iterator it = mStatic.find(item.mId); if (it != mStatic.end() && Misc::StringUtils::ciEqual(it->second.mId, id)) { mStatic.erase(it); @@ -523,62 +523,12 @@ namespace MWWorld } } - void load(ESM::ESMReader &esm, const std::string &id) { - // Don't automatically assume that a new cell must be spawned. Multiple plugins write to the same cell, - // and we merge all this data into one Cell object. However, we can't simply search for the cell id, - // as many exterior cells do not have a name. Instead, we need to search by (x,y) coordinates - and they - // are not available until both cells have been loaded! So first, proceed as usual. - - // All cells have a name record, even nameless exterior cells. - std::string idLower = Misc::StringUtils::lowerCase(id); - ESM::Cell *cell = new ESM::Cell; - cell->mName = id; - - // The cell itself takes care of all the hairy details - cell->load(esm, *mEsmStore); - - if(cell->mData.mFlags & ESM::Cell::Interior) - { - // Store interior cell by name, try to merge with existing parent data. - ESM::Cell *oldcell = const_cast(search(idLower)); - if (oldcell) { - // push the new references on the list of references to manage - oldcell->mContextList.push_back(cell->mContextList.at(0)); - // copy list into new cell - cell->mContextList = oldcell->mContextList; - // have new cell replace old cell - *oldcell = *cell; - } else - mInt[idLower] = *cell; - } - else - { - // Store exterior cells by grid position, try to merge with existing parent data. - ESM::Cell *oldcell = const_cast(search(cell->getGridX(), cell->getGridY())); - if (oldcell) { - // push the new references on the list of references to manage - oldcell->mContextList.push_back(cell->mContextList.at(0)); - // copy list into new cell - cell->mContextList = oldcell->mContextList; - // merge lists of leased references, use newer data in case of conflict - for (ESM::MovedCellRefTracker::const_iterator it = cell->mMovedRefs.begin(); it != cell->mMovedRefs.end(); it++) { - // remove reference from current leased ref tracker and add it to new cell - if (oldcell->mMovedRefs.find(it->second.mRefnum) != oldcell->mMovedRefs.end()) { - ESM::MovedCellRef target0 = oldcell->mMovedRefs[it->second.mRefnum]; - ESM::Cell *wipecell = const_cast(search(target0.mTarget[0], target0.mTarget[1])); - wipecell->mLeasedRefs.erase(it->second.mRefnum); - } - oldcell->mMovedRefs[it->second.mRefnum] = it->second; - } - cell->mMovedRefs = oldcell->mMovedRefs; - // have new cell replace old cell - *oldcell = *cell; - } else - mExt[std::make_pair(cell->mData.mX, cell->mData.mY)] = *cell; - } - delete cell; - } - + // HACK: Method implementation had to be moved to a separate cpp file, as we would otherwise get + // errors related to the compare operator used in std::find for ESM::MovedCellRefTracker::find. + // There some nasty three-way cyclic header dependency involved, which I could only fix by moving + // this method. + void load(ESM::ESMReader &esm, const std::string &id); + iterator intBegin() const { return iterator(mSharedInt.begin()); } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 62b4f3037..db4fb67ff 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -33,13 +33,13 @@ namespace cellRefList.mList.begin()); iter!=cellRefList.mList.end(); ++iter) { - if (!iter->second.mBase->mScript.empty() && iter->second.mData.getCount()) + if (!iter->mBase->mScript.empty() && iter->mData.getCount()) { - if (const ESM::Script *script = store.get().find (iter->second.mBase->mScript)) + if (const ESM::Script *script = store.get().find (iter->mBase->mScript)) { iter->mData.setLocals (*script); - localScripts.add (iter->second.mBase->mScript, MWWorld::Ptr (&iter->second, cell)); + localScripts.add (iter->mBase->mScript, MWWorld::Ptr (&*iter, cell)); } } } @@ -53,10 +53,10 @@ namespace for (iterator iter (refList.mList.begin()); iter!=refList.mList.end(); ++iter) { - if (iter->second.mData.getCount() > 0 && iter->second.mData.getBaseNode()){ - if (iter->second.mData.getHandle()==handle) + if (iter->mData.getCount() > 0 && iter->mData.getBaseNode()){ + if (iter->mData.getHandle()==handle) { - return &iter->second; + return &*iter; } } } @@ -1261,7 +1261,7 @@ namespace MWWorld CellRefList::List& refList = doors.mList; for (CellRefList::List::iterator it = refList.begin(); it != refList.end(); ++it) { - MWWorld::LiveCellRef& ref = it->second; + MWWorld::LiveCellRef& ref = *it; if (ref.mRef.mTeleport) { diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index 76a1e4f95..7400fd026 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -14,6 +14,17 @@ namespace ESM { +/// Some overloaded copare operators. +bool operator==(const MovedCellRef& ref, int pRefnum) +{ + return (ref.mRefnum == pRefnum); +} + +bool operator==(const CellRef& ref, int pRefnum) +{ + return (ref.mRefnum == pRefnum); +} + void CellRef::save(ESMWriter &esm) { esm.writeHNT("FRMR", mRefnum); @@ -134,13 +145,14 @@ void Cell::load(ESMReader &esm, MWWorld::ESMStore &store) (int(*)(int)) std::tolower); // Add data required to make reference appear in the correct cell. - /* - std::cout << "Moving refnumber! First cell: " << mData.mX << " " << mData.mY << std::endl; - std::cout << " New cell: " << cMRef.mTarget[0] << " " << cMRef.mTarget[0] << std::endl; - std::cout << "Refnumber (MVRF): " << cMRef.mRefnum << " (FRMR) " << ref.mRefnum << std::endl; - */ - mMovedRefs[cMRef.mRefnum] = cMRef; - cellAlt->mLeasedRefs[ref.mRefnum] = ref; + // We should not need to test for duplicates, as this part of the code is pre-cell merge. + mMovedRefs.push_back(cMRef); + // But there may be duplicates here! + ESM::CellRefTracker::iterator iter = std::find(cellAlt->mLeasedRefs.begin(), cellAlt->mLeasedRefs.end(), ref.mRefnum); + if (iter == cellAlt->mLeasedRefs.end()) + cellAlt->mLeasedRefs.push_back(ref); + else + *iter = ref; } // Save position of the cell references and move on diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index 6862dbc5c..27bdd77ce 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -6,7 +6,7 @@ #include "esmcommon.hpp" #include "defs.hpp" -#include +#include "apps/openmw/mwbase/world.hpp" /* namespace MWWorld { @@ -95,24 +95,29 @@ public: }; /* Moved cell reference tracking object. This mainly stores the target cell - of the reference, so we can easily know where it has been moved when another - plugin tries to move it independently. - */ + of the reference, so we can easily know where it has been moved when another + plugin tries to move it independently. + Unfortunately, we need to implement this here. + */ class MovedCellRef { public: - int mRefnum; - - // Target cell (if exterior) - int mTarget[2]; - - // TODO: Support moving references between exterior and interior cells! - // This may happen in saves, when an NPC follows the player. Tribunal - // introduces a henchman (which no one uses), so we may need this as well. + int mRefnum; + + // Target cell (if exterior) + int mTarget[2]; + + // TODO: Support moving references between exterior and interior cells! + // This may happen in saves, when an NPC follows the player. Tribunal + // introduces a henchman (which no one uses), so we may need this as well. }; -typedef std::map MovedCellRefTracker; -typedef std::map CellRefTracker; +/// Overloaded copare operator used to search inside a list of cell refs. +bool operator==(const MovedCellRef& ref, int pRefnum); +bool operator==(const CellRef& ref, int pRefnum); + +typedef std::list MovedCellRefTracker; +typedef std::list CellRefTracker; /* Cells hold data about objects, creatures, statics (rocks, walls, buildings) and landscape (for exterior cells). Cells frequently From d40ee068975ec80a5acecc7ca686772a554106dd Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 9 Feb 2013 15:25:50 +0100 Subject: [PATCH 43/43] fixed base/modified logic --- apps/opencs/model/world/columns.hpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/opencs/model/world/columns.hpp b/apps/opencs/model/world/columns.hpp index fb94cbf59..cfbd804a5 100644 --- a/apps/opencs/model/world/columns.hpp +++ b/apps/opencs/model/world/columns.hpp @@ -17,9 +17,9 @@ namespace CSMWorld virtual void set (Record& record, const QVariant& data) { - ESXRecordT base = record.getBase(); - base.mValue = data.toFloat(); - record.setModified (base); + ESXRecordT record2 = record.get(); + record2.mValue = data.toFloat(); + record.setModified (record2); } virtual bool isEditable() const @@ -104,9 +104,9 @@ namespace CSMWorld virtual void set (Record& record, const QVariant& data) { - ESXRecordT base = record.getBase(); - base.mType = static_cast (data.toInt()); - record.setModified (base); + ESXRecordT record2 = record.get(); + record2.mType = static_cast (data.toInt()); + record.setModified (record2); } virtual bool isEditable() const @@ -134,18 +134,18 @@ namespace CSMWorld virtual void set (Record& record, const QVariant& data) { - ESXRecordT base = record.getBase(); + ESXRecordT record2 = record.get(); - switch (record.get().mType) + switch (record2.mType) { - case ESM::VT_String: base.mStr = data.toString().toUtf8().constData(); break; - case ESM::VT_Int: base.mI = data.toInt(); break; - case ESM::VT_Float: base.mF = data.toFloat(); break; + case ESM::VT_String: record2.mStr = data.toString().toUtf8().constData(); break; + case ESM::VT_Int: record2.mI = data.toInt(); break; + case ESM::VT_Float: record2.mF = data.toFloat(); break; default: break; } - record.setModified (base); + record.setModified (record2); } virtual bool isEditable() const