Skip to content

Commit d0dea6f

Browse files
committed
analysis: Add XML parsing support for external types
These are types either from C itself, or from another Vulkan library, which are referenced in this XML file.
1 parent 7dddad9 commit d0dea6f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

analysis/src/xml.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ fn api_matches(node: &Node, expected: &str) -> bool {
4848
/// Raw representation of Vulkan XML files (`vk.xml`, `video.xml`).
4949
#[derive(Debug, Default)]
5050
pub struct Registry {
51+
pub externals: Vec<External>,
5152
pub basetypes: Vec<BaseType>,
5253
pub bitmask_types: Vec<BitMaskType>,
5354
pub bitmask_aliases: Vec<Alias>,
@@ -127,6 +128,9 @@ impl Registry {
127128
Some("union") => {
128129
registry.unions.push(Structure::from_node(type_node, api));
129130
}
131+
None => {
132+
registry.externals.push(External::from_node(type_node));
133+
}
130134
_ => (),
131135
}
132136
}
@@ -213,6 +217,21 @@ impl Alias {
213217
}
214218
}
215219

220+
#[derive(Debug)]
221+
pub struct External {
222+
pub name: XmlStr,
223+
pub requires: Option<XmlStr>,
224+
}
225+
226+
impl External {
227+
fn from_node(node: Node) -> External {
228+
External {
229+
name: attribute(node, "name").unwrap(),
230+
requires: attribute(node, "requires"),
231+
}
232+
}
233+
}
234+
216235
#[derive(Debug)]
217236
pub struct BaseType {
218237
pub name: XmlStr,

0 commit comments

Comments
 (0)