Reimplemented Unicode case mapping in a slightly more efficient way.
[wine] / dlls / opengl32 / make_opengl_spec
1 #!/usr/bin/perl -w
2
3 #
4 # First, the basics and the wgl functions
5 #
6 print "
7 name opengl32
8 type win32
9
10 @  stdcall wglCreateContext(long) wglCreateContext
11 @  stdcall wglCreateLayerContext(long long) wglCreateLayerContext
12 @  stdcall wglCopyContext(long long long) wglCopyContext
13 @  stdcall wglDeleteContext(long) wglDeleteContext
14 @  stdcall wglDescribeLayerPlane(long long long long ptr) wglDescribeLayerPlane
15 @  stdcall wglGetCurrentContext() wglGetCurrentContext
16 @  stdcall wglGetCurrentDC() wglGetCurrentDC
17 @  stdcall wglGetLayerPaletteEntries(long long long long ptr) wglGetLayerPaletteEntries
18 @  stdcall wglGetProcAddress(str) wglGetProcAddress
19 @  stdcall wglMakeCurrent(long long) wglMakeCurrent
20 @  stdcall wglRealizeLayerPalette(long long long) wglRealizeLayerPalette
21 @  stdcall wglSetLayerPaletteEntries(long long long long ptr) wglSetLayerPaletteEntries
22 @  stdcall wglShareLists(long long) wglShareLists
23 @  stdcall wglSwapLayerBuffers(long long) wglSwapLayerBuffers
24 @  stdcall wglUseFontBitmapsA(long long long long) wglUseFontBitmapsA
25 @  stdcall wglUseFontOutlinesA(long long long long long long long ptr) wglUseFontOutlinesA
26 @  stub    glGetLevelParameterfv
27 @  stub    glGetLevelParameteriv
28 @  stub    wglUseFontBitmapsW
29 @  stub    wglUseFontOutlinesW
30 @  forward wglChoosePixelFormat GDI32.ChoosePixelFormat
31 @  forward wglDescribePixelFormat GDI32.DescribePixelFormat
32 @  forward wglGetPixelFormat GDI32.GetPixelFormat
33 @  forward wglSetPixelFormat GDI32.SetPixelFormat
34 @  forward wglSwapBuffers GDI32.SwapBuffers
35 ";
36
37 #
38 # Now, the functions from the include file
39 #
40 open(INC, "/usr/X11R6/include/GL/gl.h") || die "Could not open GL/gl.h";
41
42 while ($line = <INC>) {
43     if ($line =~ /GLAPI.*GLAPIENTRY/) {
44         # Start of a function declaration
45         ($name, $args) = ($line =~ /GLAPIENTRY *(.*)\((.*)/);
46         
47         # Remove all extensions except the multitexture one (see OpenGL ABI)
48         if (($name !~ /(MESA|PGI|ARB|EXT)/) ||
49             ($name =~ /MultiTexCoord/) ||
50             ($name =~ /ActiveTextureARB/)) {
51             print "@  stdcall $name(";
52
53             # Now, get the parameters
54             while (1) {
55                 @args = split /,/, $args;
56
57                 foreach (@args) {
58                     if ($_ =~ /\)/) {
59                         ($_) = ($_ =~ /(.*)\)/);
60                     }
61
62                     if ($_ =~ /\*/) {
63                         print "ptr ";
64                     } elsif ($_ =~ /[a-zA-Z]/) {
65                         ($type) = ($_ =~ /^ *(.*) +.*/);
66                         if (($type =~ /double/) ||
67                             ($type =~ /clampd/)) {
68                             print "double ";
69                         } elsif ($type !~ /void/) {
70                             print "long ";
71                         }
72                     }
73                 }
74
75                 if ($args !~ /\)/) {
76                     $args = <INC>;
77                 } else {
78                     last;
79                 }
80             }
81             
82             print ") wine_$name\n";
83         }
84     }
85 }
86
87 close(INC);