summaryrefslogtreecommitdiff
path: root/codegen/command/globals.rs
blob: e522e68999a1073cff90012f7ad072a17c7850a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()
}