diff options
author | Chris Johns <chrisj@rtems.org> | 2014-08-04 09:50:56 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-08-04 09:50:56 +1000 |
commit | 0a2102442e0093e1a6527e4574b714f4a0ddf0a3 (patch) | |
tree | 4d8cae00f7728258b05da4b4132b44663130afb7 /linkers | |
parent | rtems-tld: Add trace configuration support. (diff) | |
download | rtems-tools-0a2102442e0093e1a6527e4574b714f4a0ddf0a3.tar.bz2 |
rtems-tld: Add recursive parsing of headers and defines.
Diffstat (limited to 'linkers')
-rw-r--r-- | linkers/rld.h | 2 | ||||
-rw-r--r-- | linkers/rtems-tld.cpp | 43 | ||||
-rw-r--r-- | linkers/rtems.ini | 6 | ||||
-rw-r--r-- | linkers/test-trace.ini | 8 |
4 files changed, 51 insertions, 8 deletions
diff --git a/linkers/rld.h b/linkers/rld.h index e1cfbf5..70a6913 100644 --- a/linkers/rld.h +++ b/linkers/rld.h @@ -175,7 +175,7 @@ namespace rld { if (e.front () != e.back ()) throw rld::error ("invalid quoting", "string: " + s); - e = e.substr (1, e.length () - 1); + e = e.substr (1, e.length () - (1 + 1)); } } if (empty || !e.empty ()) diff --git a/linkers/rtems-tld.cpp b/linkers/rtems-tld.cpp index 4f17fba..ede5d10 100644 --- a/linkers/rtems-tld.cpp +++ b/linkers/rtems-tld.cpp @@ -121,6 +121,16 @@ namespace rld rld::config::config& config); /** + * Recursive parser for strings. + */ + void parse (rld::config::config& config, + const rld::config::section& section, + const std::string& sec_name, + const std::string& rec_name, + rld::strings& items, + int depth = 0); + + /** * Dump the wrapper. */ void dump (std::ostream& out) const; @@ -261,11 +271,12 @@ namespace rld */ const rld::config::section& section = config.get_section (name); + parse (config, section, "headers", "header", headers); + parse (config, section, "defines", "define", defines); + rld::strings sig_list; - rld::config::parse_items (section, "header", headers); - rld::config::parse_items (section, "define", defines); - rld::config::parse_items (section, "signature", sig_list); + rld::config::parse_items (section, "signatures", sig_list); for (rld::strings::const_iterator sli = sig_list.begin (); sli != sig_list.end (); @@ -283,6 +294,32 @@ namespace rld } void + wrapper::parse (rld::config::config& config, + const rld::config::section& section, + const std::string& sec_name, + const std::string& rec_name, + rld::strings& items, + int depth) + { + if (depth > 32) + throw rld::error ("too deep", "parsing: " + sec_name + '/' + rec_name); + + rld::config::parse_items (section, rec_name, items); + + rld::strings sl; + + rld::config::parse_items (section, sec_name, sl); + + for (rld::strings::const_iterator sli = sl.begin (); + sli != sl.end (); + ++sli) + { + const rld::config::section& sec = config.get_section (*sli); + parse (config, sec, sec_name, rec_name, items, depth + 1); + } + } + + void wrapper::dump (std::ostream& out) const { out << " Wrapper: " << name << std::endl diff --git a/linkers/rtems.ini b/linkers/rtems.ini index cd59f72..f2de480 100644 --- a/linkers/rtems.ini +++ b/linkers/rtems.ini @@ -2,9 +2,9 @@ ; RTEMS API Trace Configurations ; [rtems-api] -header = rtems-api-headers -define = rtems-api-defines -signature = rtems-api-signatures +headers = rtems-api-headers +defines = rtems-api-defines +signatures = rtems-api-signatures [rtems-api-headers] header = "#include <rtems.h>" diff --git a/linkers/test-trace.ini b/linkers/test-trace.ini index 2901952..b4e2306 100644 --- a/linkers/test-trace.ini +++ b/linkers/test-trace.ini @@ -35,7 +35,13 @@ trace = test_trace_1, test_trace_2 trace = test_trace_3 header = '#include "test-trace.h"' define = "#define TEST_TRACE 1" -signature = test-signatures +signatures = test-signatures + +[test-headers] +header = '#include "test-trace.h"' + +[test-defines] +define = "#define TEST_TRACE 1" [test-signatures] test_trace_1 = void, int |