mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-08 18:31:46 +00:00
rom_filter: optionally skip top-level node
Since the top-level node of the output ROM is always generated by the rom_filter, there is no way to pass-through the content of an input ROM without wrapping in an addition XML node. genodelabs/genode#4326
This commit is contained in:
parent
059c7ed74a
commit
a65807ff08
@ -40,7 +40,8 @@ The '<output>' node can contain the following sub nodes:
|
|||||||
|
|
||||||
:'<input>':
|
:'<input>':
|
||||||
Copies the content of the input specified by the 'name' attribute to the
|
Copies the content of the input specified by the 'name' attribute to the
|
||||||
output node.
|
output node. If the optional attribute 'skip_toplevel' is set and evaluates
|
||||||
|
to true, the top-level XML node from the input will not be copied.
|
||||||
|
|
||||||
:'<attribute>':
|
:'<attribute>':
|
||||||
Adds an attribute with the specified 'name' and 'value'. If the node
|
Adds an attribute with the specified 'name' and 'value'. If the node
|
||||||
|
@ -434,12 +434,16 @@ class Rom_filter::Input_rom_registry
|
|||||||
*
|
*
|
||||||
* \throw Nonexistent_input_node
|
* \throw Nonexistent_input_node
|
||||||
*/
|
*/
|
||||||
void gen_xml(Input_name const &input_name, Genode::Xml_generator &xml)
|
void gen_xml(Input_name const &input_name, Genode::Xml_generator &xml, bool skip_toplevel=false)
|
||||||
{
|
{
|
||||||
Entry const *e = _lookup_entry_by_name(input_name);
|
Entry const *e = _lookup_entry_by_name(input_name);
|
||||||
if (!e)
|
if (!e)
|
||||||
throw Nonexistent_input_node();
|
throw Nonexistent_input_node();
|
||||||
|
|
||||||
|
if (skip_toplevel)
|
||||||
|
e->node().with_raw_content([&] (char const *start, Genode::size_t length) {
|
||||||
|
xml.append(start, length); });
|
||||||
|
else
|
||||||
e->node().with_raw_node([&] (char const *start, Genode::size_t length) {
|
e->node().with_raw_node([&] (char const *start, Genode::size_t length) {
|
||||||
xml.append(start, length); });
|
xml.append(start, length); });
|
||||||
}
|
}
|
||||||
|
@ -350,8 +350,11 @@ void Rom_filter::Main::_evaluate_node(Xml_node node, Xml_generator &xml)
|
|||||||
Input_name const input_name =
|
Input_name const input_name =
|
||||||
node.attribute_value("name", Input_name());
|
node.attribute_value("name", Input_name());
|
||||||
|
|
||||||
|
bool const skip_toplevel =
|
||||||
|
node.attribute_value("skip_toplevel", false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_input_rom_registry.gen_xml(input_name, xml); }
|
_input_rom_registry.gen_xml(input_name, xml, skip_toplevel); }
|
||||||
catch (...) { }
|
catch (...) { }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user