mail[Wesnoth-commits] r40180 - in /branches/fendrin_gui_stuff/src: ./ ai/ serialization/


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by fabianmueller5 on December 10, 2009 - 01:16:
Author: fendrin
Date: Thu Dec 10 01:15:59 2009
New Revision: 40180

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40180&view=rev
Log:
activated the frogatto wml parser

Modified:
    branches/fendrin_gui_stuff/src/CMakeLists.txt
    branches/fendrin_gui_stuff/src/SConscript
    branches/fendrin_gui_stuff/src/ai/configuration.cpp
    branches/fendrin_gui_stuff/src/config.cpp
    branches/fendrin_gui_stuff/src/config.hpp
    branches/fendrin_gui_stuff/src/config_cache.cpp
    branches/fendrin_gui_stuff/src/game.cpp
    branches/fendrin_gui_stuff/src/serialization/tokenizer.hpp

Modified: branches/fendrin_gui_stuff/src/CMakeLists.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/CMakeLists.txt?rev=40180&r1=40179&r2=40180&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/CMakeLists.txt (original)
+++ branches/fendrin_gui_stuff/src/CMakeLists.txt Thu Dec 10 01:15:59 2009
@@ -128,6 +128,18 @@
     tstring.cpp
     util.cpp
     version.cpp
+    wml/wml_formula_adapter.cpp
+    wml/wml_modify.cpp 
+    wml/wml_node.cpp   
+    wml/wml_preprocessor.cpp
+    wml/wml_schema.cpp 
+    wml/wml_utils.cpp 
+    wml/wml_parser.cpp  
+    wml/wml_parser_test.cpp  
+    wml/wml_writer.cpp
+    wml/string_utils.cpp
+    wml/unit_test.cpp
+    wml/preprocessor.cpp
     serialization/binary_or_text.cpp
     serialization/binary_wml.cpp
     serialization/parser.cpp
@@ -198,18 +210,6 @@
     ai/testing/stage_rca.cpp
     ai/testing/stage_fallback.cpp
     ai/testing.cpp
-    wml/wml_formula_adapter.cpp
-    wml/wml_modify.cpp 
-    wml/wml_node.cpp   
-    wml/wml_preprocessor.cpp
-    wml/wml_schema.cpp 
-    wml/wml_utils.cpp 
-    wml/wml_parser.cpp  
-    wml/wml_parser_test.cpp  
-    wml/wml_writer.cpp
-    wml/string_utils.cpp
-    wml/unit_test.cpp
-    wml/preprocessor.cpp
     animated_game.cpp
     attack_prediction.cpp
     attack_prediction_display.cpp

Modified: branches/fendrin_gui_stuff/src/SConscript
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/SConscript?rev=40180&r1=40179&r2=40180&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/SConscript (original)
+++ branches/fendrin_gui_stuff/src/SConscript Thu Dec 10 01:15:59 2009
@@ -33,6 +33,18 @@
     serialization/preprocessor.cpp
     serialization/string_utils.cpp
     serialization/tokenizer.cpp
+    wml/wml_formula_adapter.cpp
+    wml/wml_modify.cpp 
+    wml/wml_node.cpp   
+    wml/wml_preprocessor.cpp
+    wml/wml_schema.cpp 
+    wml/wml_utils.cpp 
+    wml/wml_parser.cpp  
+    wml/wml_parser_test.cpp  
+    wml/wml_writer.cpp
+    wml/string_utils.cpp
+    wml/unit_test.cpp
+    wml/preprocessor.cpp
     """)
 if env["pool_alloc"]:
     libwesnoth_core_sources.extend(Split("""

Modified: branches/fendrin_gui_stuff/src/ai/configuration.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/ai/configuration.cpp?rev=40180&r1=40179&r2=40180&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/ai/configuration.cpp (original)
+++ branches/fendrin_gui_stuff/src/ai/configuration.cpp Thu Dec 10 01:15:59 
2009
@@ -84,7 +84,10 @@
        well_known_aspects.push_back(well_known_aspect("village_value"));
        well_known_aspects.push_back(well_known_aspect("villages_per_scout"));
 
+       ERR_AI_CONFIGURATION << "output the game_config:\n" << 
game_config.debug();
        const config &ais = game_config.child("ais");
+
+
        default_config_ = ais.child("default_config");
        if (!default_config_) {
                ERR_AI_CONFIGURATION << "Missing AI [default_config]. 
Therefore, default_config_ set to empty." << std::endl;

Modified: branches/fendrin_gui_stuff/src/config.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/config.cpp?rev=40180&r1=40179&r2=40180&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/config.cpp (original)
+++ branches/fendrin_gui_stuff/src/config.cpp Thu Dec 10 01:15:59 2009
@@ -23,6 +23,7 @@
 #include "config.hpp"
 #include "foreach.hpp"
 #include "log.hpp"
+#include "wml/wml_node.hpp"
 
 #include <cstring>
 #include <deque>
@@ -53,6 +54,31 @@
        cfg.check_valid();
        append(cfg);
 }
+
+config::config(wml::node_ptr wml_node) : values(), children(), 
ordered_children()
+{
+
+//     wml::node::const_attr_iterator attr_begin = wml_node->begin_attr();
+//     wml::node::const_attr_iterator attr_end = wml_node->end_attr();
+
+
+       for(wml::node::const_attr_iterator j = (*wml_node).begin_attr(); j != 
(*wml_node).end_attr(); ++j) {
+               values[j->first] = j->second;
+               }
+
+       for(wml::node::all_child_iterator j = (*wml_node).begin_children(); j 
!= (*wml_node).end_children(); ++j) {
+                       add_child((*j)->name(), config(*j));
+                       }
+
+
+       //
+//     for(wml::node::const_all_child_iterator j = 
wml_node->begin_children())
+
+
+}
+
+
+
 
 config::config(const std::string& child) : values(), children(), 
ordered_children()
 {
@@ -79,6 +105,11 @@
 
 bool config::has_attribute(const std::string &key) const
 {
+
+//     wml::node::const_attr_iterator attr_begin = wml_node->begin_attr();
+//     wml::node::const_attr_iterator attr_end = wml_node->end_attr();
+
+
        check_valid();
        return values.find(key) != values.end();
 }

Modified: branches/fendrin_gui_stuff/src/config.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/config.hpp?rev=40180&r1=40179&r2=40180&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/config.hpp (original)
+++ branches/fendrin_gui_stuff/src/config.hpp Thu Dec 10 01:15:59 2009
@@ -40,6 +40,9 @@
 #include "game_errors.hpp"
 #include "tstring.hpp"
 #include "serialization/string_utils.hpp"
+//TODO
+#include "wml/wml_node_fwd.hpp"
+#include "wml/wml_node.hpp"
 
 #include "shared_string.hpp"
 
@@ -83,6 +86,9 @@
        config();
 
        config(const config& cfg);
+
+       //TODO
+       config(wml::node_ptr node);
 
        /**
         * Creates a config object with an empty child of name @a child.

Modified: branches/fendrin_gui_stuff/src/config_cache.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/config_cache.cpp?rev=40180&r1=40179&r2=40180&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/config_cache.cpp (original)
+++ branches/fendrin_gui_stuff/src/config_cache.cpp Thu Dec 10 01:15:59 2009
@@ -25,9 +25,14 @@
 #include "show_dialog.hpp"
 #include "sha1.hpp"
 #include "serialization/binary_or_text.hpp"
+
+//TODO disable the include for the old parser
 #include "serialization/parser.hpp"
+#include "wml/wml_parser.hpp"
 
 #include <boost/algorithm/string/replace.hpp>
+
+#include <fstream>
 
 static lg::log_domain log_cache("cache");
 #define ERR_CACHE LOG_STREAM(err, log_cache)
@@ -155,15 +160,41 @@
 
        void config_cache::read_configs(const std::string& path, config& cfg, 
preproc_map& defines_map)
        {
+//             exit(0);
+               //TODO
+//             ERR_CACHE << "reading file" << path << "\n";
+//             LOG_CACHE << "reading file" << path << "\n";
+
                std::string error_log;
                //read the file and then write to the cache
-               scoped_istream stream = preprocess_file(path, &defines_map, 
&error_log);
-
-               read(cfg, *stream, &error_log);
+               scoped_istream wml_stream = preprocess_file(path, 
&defines_map, &error_log);
+
+//             read(cfg, *wml_stream, &error_log);
                if (!error_log.empty())
                {
                        throw config::error(error_log);
                }
+
+//             std::ifstream streeamamma = 
std::ifstream(*wml_stream->rdbuf());
+
+//             std::istream streamblah = *stream;
+//             std::stringstream document;
+
+               std::stringstream document;
+               document << wml_stream->rdbuf();
+
+
+//             streamblah.
+
+//             document << streamblah;
+
+//             ERR_CACHE << document;
+
+               wml::node_ptr doc_node = wml::parse_wml(document.str());
+
+
+               cfg = config(doc_node);
+
        }
 
        void config_cache::read_cache(const std::string& path, config& cfg)

Modified: branches/fendrin_gui_stuff/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/game.cpp?rev=40180&r1=40179&r2=40180&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/game.cpp (original)
+++ branches/fendrin_gui_stuff/src/game.cpp Thu Dec 10 01:15:59 2009
@@ -635,6 +635,9 @@
        load_game_cfg(force);
 
        const config &cfg = game_config_.child("game_config");
+
+       std::cerr << "game_config after load_game_cfg in game.cpp: \n" << cfg;
+
        game_config::load_config(cfg ? &cfg : NULL);
        hotkey::deactivate_all_scopes();
        hotkey::set_scope_active(hotkey::SCOPE_GENERAL);

Modified: branches/fendrin_gui_stuff/src/serialization/tokenizer.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/fendrin_gui_stuff/src/serialization/tokenizer.hpp?rev=40180&r1=40179&r2=40180&view=diff
==============================================================================
--- branches/fendrin_gui_stuff/src/serialization/tokenizer.hpp (original)
+++ branches/fendrin_gui_stuff/src/serialization/tokenizer.hpp Thu Dec 10 
01:15:59 2009
@@ -220,7 +220,7 @@
                                }
                        }while (UNLIKELY(current_ == '\r'));
 #if 0
-                       // @todo: disabled untill campaign server is fixed
+                       // @todo: disabled until campaign server is fixed
                        if(LIKELY(in_.good())) {
                                current_ = in_.get();
                                if (UNLIKELY(current_ == '\r'))




Related Messages


Powered by MHonArc, Updated Thu Dec 10 17:00:07 2009