summaryrefslogtreecommitdiff
path: root/src/bin/eolian_cxx/eolian_cxx.cc
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-05-31 16:32:20 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-06-02 18:27:46 -0300
commit6dcc8dd07faddba6de77fe75428a3724df964f47 (patch)
tree4277b18b671f7969d16ef8627109f02079cbc906 /src/bin/eolian_cxx/eolian_cxx.cc
parentcc708064979314a94971fa00668ae14e6d1cab43 (diff)
eolian-cxx: Fixed compilation error after Eolian_Unit type introduction
Diffstat (limited to 'src/bin/eolian_cxx/eolian_cxx.cc')
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index 18978a3fe9..ee1b39909c 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -33,6 +33,7 @@ struct options_type
33{ 33{
34 std::vector<std::string> include_dirs; 34 std::vector<std::string> include_dirs;
35 std::vector<std::string> in_files; 35 std::vector<std::string> in_files;
36 mutable Eolian_Unit const* unit;
36 std::string out_file; 37 std::string out_file;
37 bool main_header; 38 bool main_header;
38 39
@@ -69,7 +70,7 @@ generate(const Eolian_Class* klass, eolian_cxx::options_type const& opts)
69 else 70 else
70 header_impl_file_name.insert(header_impl_file_name.size(), ".impl"); 71 header_impl_file_name.insert(header_impl_file_name.size(), ".impl");
71 72
72 efl::eolian::grammar::attributes::klass_def klass_def(klass); 73 efl::eolian::grammar::attributes::klass_def klass_def(klass, opts.unit);
73 std::vector<efl::eolian::grammar::attributes::klass_def> klasses{klass_def}; 74 std::vector<efl::eolian::grammar::attributes::klass_def> klasses{klass_def};
74 std::vector<efl::eolian::grammar::attributes::klass_def> forward_klasses{klass_def}; 75 std::vector<efl::eolian::grammar::attributes::klass_def> forward_klasses{klass_def};
75 76
@@ -82,11 +83,11 @@ generate(const Eolian_Class* klass, eolian_cxx::options_type const& opts)
82 auto klass_name_function 83 auto klass_name_function
83 = [&] (efl::eolian::grammar::attributes::klass_name const& name) 84 = [&] (efl::eolian::grammar::attributes::klass_name const& name)
84 { 85 {
85 Eolian_Class const* klass = get_klass(name); 86 Eolian_Class const* klass = get_klass(name, opts.unit);
86 assert(klass); 87 assert(klass);
87 c_headers.insert(eolian_class_file_get(klass) + std::string(".h")); 88 c_headers.insert(eolian_class_file_get(klass) + std::string(".h"));
88 cpp_headers.insert(eolian_class_file_get(klass) + std::string(".hh")); 89 cpp_headers.insert(eolian_class_file_get(klass) + std::string(".hh"));
89 efl::eolian::grammar::attributes::klass_def cls{klass}; 90 efl::eolian::grammar::attributes::klass_def cls{klass, opts.unit};
90 if(std::find(forward_klasses.begin(), forward_klasses.end(), cls) == forward_klasses.end()) 91 if(std::find(forward_klasses.begin(), forward_klasses.end(), cls) == forward_klasses.end())
91 forward_klasses.push_back(cls); 92 forward_klasses.push_back(cls);
92 }; 93 };
@@ -116,17 +117,17 @@ generate(const Eolian_Class* klass, eolian_cxx::options_type const& opts)
116 for(efl::eina::iterator<const char> inherit_iterator ( ::eolian_class_inherits_get(klass)) 117 for(efl::eina::iterator<const char> inherit_iterator ( ::eolian_class_inherits_get(klass))
117 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) 118 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
118 { 119 {
119 Eolian_Class const* inherit = ::eolian_class_get_by_name(&*inherit_iterator); 120 Eolian_Class const* inherit = ::eolian_class_get_by_name(opts.unit, &*inherit_iterator);
120 c_headers.insert(eolian_class_file_get(inherit) + std::string(".h")); 121 c_headers.insert(eolian_class_file_get(inherit) + std::string(".h"));
121 cpp_headers.insert(eolian_class_file_get(inherit) + std::string(".hh")); 122 cpp_headers.insert(eolian_class_file_get(inherit) + std::string(".hh"));
122 efl::eolian::grammar::attributes::klass_def klass{inherit}; 123 efl::eolian::grammar::attributes::klass_def klass{inherit, opts.unit};
123 if(std::find(forward_klasses.begin(), forward_klasses.end(), klass) == forward_klasses.end()) 124 if(std::find(forward_klasses.begin(), forward_klasses.end(), klass) == forward_klasses.end())
124 forward_klasses.push_back(klass); 125 forward_klasses.push_back(klass);
125 126
126 klass_function(inherit); 127 klass_function(inherit);
127 } 128 }
128 129
129 efl::eolian::grammar::attributes::klass_def klass_def(klass); 130 efl::eolian::grammar::attributes::klass_def klass_def(klass, opts.unit);
130 for(auto&& f : klass_def.functions) 131 for(auto&& f : klass_def.functions)
131 { 132 {
132 variant_function(f.return_type); 133 variant_function(f.return_type);
@@ -212,7 +213,7 @@ run(options_type const& opts)
212 const Eolian_Class *klass = NULL; 213 const Eolian_Class *klass = NULL;
213 char* dup = strdup(opts.in_files[0].c_str()); 214 char* dup = strdup(opts.in_files[0].c_str());
214 char* base = basename(dup); 215 char* base = basename(dup);
215 klass = ::eolian_class_get_by_file(base); 216 klass = ::eolian_class_get_by_file(NULL, base);
216 free(dup); 217 free(dup);
217 if (klass) 218 if (klass)
218 { 219 {
@@ -236,15 +237,20 @@ run(options_type const& opts)
236 237
237 for(auto&& name : opts.in_files) 238 for(auto&& name : opts.in_files)
238 { 239 {
239 bool b = ::eolian_file_parse(name.c_str()); 240 Eolian_Unit const* unit = ::eolian_file_parse(name.c_str());
240 if(!b) 241 if(!unit)
241 { 242 {
242 EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) 243 EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain)
243 << "Failed parsing: " << name << "."; 244 << "Failed parsing: " << name << ".";
244 } 245 }
246 else
247 {
248 if(!opts.unit)
249 opts.unit = unit;
250 }
245 char* dup = strdup(name.c_str()); 251 char* dup = strdup(name.c_str());
246 char* base = basename(dup); 252 char* base = basename(dup);
247 Eolian_Class const* klass = ::eolian_class_get_by_file(base); 253 Eolian_Class const* klass = ::eolian_class_get_by_file(unit, base);
248 free(dup); 254 free(dup);
249 if (klass) 255 if (klass)
250 { 256 {