diff options
Diffstat (limited to 'codegen/command/globals.rs')
-rw-r--r-- | codegen/command/globals.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/codegen/command/globals.rs b/codegen/command/globals.rs new file mode 100644 index 0000000..e522e68 --- /dev/null +++ b/codegen/command/globals.rs @@ -0,0 +1,15 @@ +use opengl_registry::command::Command; +use proc_macro2::TokenStream; +use quote::{format_ident, quote}; + +pub fn create_command_globals(commands: &[Command]) -> Vec<TokenStream> +{ + commands.iter().map(|command| { + let command_name = format_ident!("{}", command.prototype().name()); + + quote! { + #[allow(non_upper_case_globals)] + pub static mut #command_name: unsafe extern "C" fn() = function_not_loaded; + } + }).collect() +} |