Remove vk:: prefix for types
This commit is contained in:
parent
be08103d1d
commit
6691e7e79f
|
@ -5,7 +5,7 @@ use std::collections::HashMap;
|
|||
use std::io::Write;
|
||||
|
||||
fn main() {
|
||||
let file = File::open("vk_new.xml").expect("vk");
|
||||
let file = File::open("New-Vulkan-XML-Format/vk_new.xml").expect("vknew");
|
||||
let spec = vkxml::Registry::from_file(file).expect("");
|
||||
|
||||
let commands: HashMap<vkxml::Identifier, &vkxml::Command> = spec.elements
|
||||
|
|
|
@ -57,13 +57,22 @@ impl FieldExt for vkxml::Field {
|
|||
}
|
||||
|
||||
fn type_ident(&self) -> Ident {
|
||||
let new_name = match self.basetype.as_str() {
|
||||
"void" => "c_void",
|
||||
"char" => "c_char",
|
||||
"float" => "c_float",
|
||||
"long" => "c_ulong",
|
||||
_ => {
|
||||
let prefix = &self.basetype[0..2];
|
||||
if prefix == "Vk" {
|
||||
Ident::from(&self.basetype[2..])
|
||||
&self.basetype[2..]
|
||||
} else {
|
||||
Ident::from(&self.basetype[..])
|
||||
self.basetype.as_str()
|
||||
}
|
||||
}
|
||||
};
|
||||
Ident::from(new_name)
|
||||
}
|
||||
}
|
||||
use std::collections::HashMap;
|
||||
pub type CommandMap<'a> = HashMap<vkxml::Identifier, &'a vkxml::Command>;
|
||||
|
@ -109,12 +118,12 @@ pub fn gen_load(feature: &vkxml::Feature, commands: &CommandMap) -> quote::Token
|
|||
.map(|field| {
|
||||
let name = field.param_ident();
|
||||
let ty = field.type_ident();
|
||||
quote!{#name: vk::#ty}
|
||||
quote!{#name: #ty}
|
||||
})
|
||||
.collect();
|
||||
let return_ty = cmd.return_type.type_ident();
|
||||
quote!{
|
||||
#fn_name_snake: extern "system" fn(#(#params,)*) -> vk::#return_ty
|
||||
#fn_name_snake: extern "system" fn(#(#params,)*) -> #return_ty
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
|
Loading…
Reference in a new issue