1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

use syn::*;

pub fn clsid(
    struct_name: &Ident
) -> Ident
{
    Ident::from( format!( "CLSID_{}", struct_name ) )
}

pub fn iid(
    itf_name: &Ident
) -> Ident
{
    Ident::from( format!( "IID_{}", itf_name ) )
}

pub fn method_impl(
    struct_ident : &Ident,
    itf_ident : &Ident,
    method_name: &str
) -> Ident
{
    Ident::from( format!( "__{}_{}_{}",
            struct_ident, itf_ident, method_name ) )
}

pub fn vtable_struct(
    itf_ident : &Ident
) -> Ident
{
    Ident::from( format!( "__{}Vtbl", itf_ident ) )
}

pub fn vtable_instance(
    struct_name : &Ident,
    itf_ident : &Ident,
) -> Ident
{
    Ident::from( format!( "__{}_{}Vtbl_INSTANCE",
                        struct_name,
                        itf_ident ) )
}

pub fn vtable_list(
    struct_ident : &Ident
) -> Ident
{
    Ident::from( format!( "__{}VtblList", struct_ident ) )
}

pub fn vtable_offset(
    s : &Ident,
    i : &Ident
) -> Ident
{
    Ident::from( format!( "__{}_{}Vtbl_offset", s, i ) )
}