rom_filter: allow use of input as attribute value

This commit is contained in:
Norman Feske 2017-11-19 23:24:18 +01:00 committed by Christian Helmuth
parent 1514667b42
commit e204b9532b
2 changed files with 29 additions and 3 deletions

View File

@ -34,6 +34,11 @@ The '<output>' node can contain the following sub nodes:
Copies all sub nodes named by the 'sub_node' attribute of the input ROM
specified by the 'name' attribute to the output node.
:'<attribute>':
Adds an attribute with the specified 'name' and 'value'. If the node
has an 'input' attribute, the content of the specified input is taken
as attribute value.
Conditions
----------

View File

@ -283,10 +283,31 @@ void Rom_filter::Main::_evaluate_node(Xml_node node, Xml_generator &xml)
} else
if (node.has_type("attribute")) {
typedef Genode::String<128> String;
xml.attribute(
node.attribute_value("name", String()).string(),
node.attribute_value("value", String()).string());
/* assign input value to attribute value */
if (node.has_attribute("input")) {
Input_name const input_name =
node.attribute_value("input", Input_name());
try {
Input_value const input_value =
_input_rom_registry.query_value(_config.xml(), input_name);
xml.attribute(node.attribute_value("name", String()).string(),
input_value);
}
catch (Input_rom_registry::Nonexistent_input_value) {
Genode::warning("could not obtain input value for input ", input_name);
}
}
/* assign fixed attribute value */
else {
xml.attribute(node.attribute_value("name", String()).string(),
node.attribute_value("value", String()).string());
}
} else
if (node.has_type("inline")) {