File: opengl_wrapper.awk

package info (click to toggle)
gliv 1.9.7-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, jessie, jessie-kfreebsd, stretch, wheezy
  • size: 5,780 kB
  • ctags: 4,039
  • sloc: ansic: 30,070; sh: 5,207; makefile: 740; yacc: 291; awk: 185; sed: 16
file content (43 lines) | stat: -rw-r--r-- 860 bytes parent folder | download | duplicates (4)
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
function function_name(name)
{
    match(name, /[^() ]+/, array);
    return array[0];
}

BEGIN {
    print "/* Autogenerated by opengl_wrapper.awk */";
    print "";
}

/MESA|EXT|ARB|glBegin\(|glEnd\(/ {
    next;
}

/glGetError/ {
    /* Infinite recursion ... */
    next;
}

/^GLAPI void GLAPIENTRY .+\( void \);/ {
    f = function_name($4);
    printf "#define %s() OPENGL_VOID_CALL_VOID(%s)\n", f, f;
    next;
}

/^GLAPI void GLAPIENTRY / {
    f = function_name($4);
    printf "#define %s(...) OPENGL_VOID_CALL(%s, __VA_ARGS__)\n", f, f;
    next;
}

/^GLAPI const [^ ]+ GLAPIENTRY / {
    f = function_name($5);
    printf "#define %s(...) OPENGL_CALL(const %s, %s, __VA_ARGS__)\n", f, $3, f;
    next;
}

/^GLAPI [^ ]+ GLAPIENTRY / {
    f = function_name($4);
    printf "#define %s(...) OPENGL_CALL(%s, %s, __VA_ARGS__)\n", f, $2, f;
    next;
}