3 # This script is called thus :
5 # make_opengl path_to_spec_file opengl_version
7 # - path_to_spec_file is the path to the directory where the OpenGL
8 # spec files are located. These files are part of the OpenGL
9 # sample implementation CVS tree and are located in
10 # CVS_ROOT/projects/ogl-sample/main/doc/registry/specs.
11 # You can find them on the web at the following URL :
12 # http://oss.sgi.com/cgi-bin/cvsweb.cgi/projects/ogl-sample/main/doc/registry/specs/
14 # - opengl_version is the OpenGL version emulated by the library
15 # (can be 1.0 to 1.2).
17 # This script generates the three following files :
19 # - opengl32.spec : the spec file giving all the exported functions
20 # of the OpenGL32.DLL library. These functions are the one an
21 # application can directly link to (and are all the functions
22 # defined in the OpenGL core for the version defined by
25 # - opengl_norm.c : this file contains the thunks for all OpenGL
26 # functions that are defined in 'opengl32.spec'. The corresponding
27 # functions NEED to be defined in Linux's libGL or the library
28 # won't be able to be linked in.
30 # - opengl_ext.c : in this file are stored thunks for ALL possible
31 # OpenGL extensions (at least, all the extensions that are defined
32 # in the OpenGL extension registry). Contrary to 'opengl_norm.c',
33 # you do not need to have these extensions in your libGL to have
34 # OpenGL work (as they are resolved at run-time using
35 # glXGetProcAddressARB).
37 # Copyright 2000 Lionel Ulmer
39 # This library is free software; you can redistribute it and/or
40 # modify it under the terms of the GNU Lesser General Public
41 # License as published by the Free Software Foundation; either
42 # version 2.1 of the License, or (at your option) any later version.
44 # This library is distributed in the hope that it will be useful,
45 # but WITHOUT ANY WARRANTY; without even the implied warranty of
46 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
47 # Lesser General Public License for more details.
49 # You should have received a copy of the GNU Lesser General Public
50 # License along with this library; if not, write to the Free Software
51 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
57 $spec_file = "opengl32.spec";
58 $norm_file = "opengl_norm.c";
59 $ext_file = "opengl_ext.c";
61 # Set to 0 for removing the ENTER / LEAVE GL calls
63 # Prefix used for the local variables
64 $ext_prefix = "func_";
65 # If set to 1, generate TRACEs for each OpenGL function
69 # List of categories to put in the 'opengl_norm.c' file
71 %cat_1_0 = ( "display-list" => 1,
73 "drawing-control" => 1,
82 %cat_1_1 = ( %cat_1_0,
84 %cat_1_2 = ( %cat_1_1,
86 %cat_1_3 = ( %cat_1_2,
88 %cat_1_4 = ( %cat_1_3,
90 %cat_1_5 = ( %cat_1_4,
93 %norm_categories = ();
96 # This hash table gives the conversion between OpenGL types and what
97 # is used by the TRACE printfs
100 ("GLbitfield" => "%d",
116 "GLintptrARB" => "%d",
117 "GLsizeiptrARB" => "%d",
119 "GLsizeiptr" => "%d",
120 "GLhandleARB" => "%d",
122 "GLvoid" => "(void)",
123 "_GLfuncptr" => "%p");
126 # This hash table gives the conversion between OpenGL types and what
127 # is used in the .spec file
130 ("GLbitfield" => [ "long", 4 ],
131 "GLboolean" => [ "long", 4 ],
132 "GLbyte" => [ "long", 4 ],
133 "GLclampd" => [ "double", 8 ],
134 "GLclampf" => [ "long", 4 ],
135 "GLdouble" => [ "double", 8 ],
136 "GLenum" => [ "long", 4 ],
137 "GLfloat" => [ "long", 4 ],
138 "GLint" => [ "long", 4 ],
139 "GLshort" => [ "long", 4 ],
140 "GLsizei" => [ "long", 4 ],
141 "GLstring" => [ "str", 4 ],
142 "GLubyte" => [ "long", 4 ],
143 "GLuint" => [ "long", 4 ],
144 "GLushort" => [ "long", 4 ],
145 "GLhalfNV" => [ "long", 4 ],
146 "GLintptrARB" => [ "long", 4 ],
147 "GLsizeiptrARB" => [ "long", 4 ],
148 "GLhandleARB" => [ "long", 4 ],
149 "GLcharARB" => [ "long", 4 ],
150 "GLintptr" => [ "long", 4 ],
151 "GLsizeiptr" => [ "long", 4 ],
152 "GLvoid" => [ "void", 4 ],
153 "_GLfuncptr" => [ "ptr", 4 ]);
156 # Used to convert some types
161 %hash = ( "GLstring" => "const GLubyte *",
162 "GLintptrARB" => "ptrdiff_t",
163 "GLsizeiptrARB" => "ptrdiff_t",
164 "GLintptr" => "ptrdiff_t",
165 "GLsizeiptr" => "ptrdiff_t",
166 "GLhandleARB" => "unsigned int",
167 "GLcharARB" => "char",
168 "GLhalfNV" => "unsigned short" );
170 foreach $org (reverse(sort(keys %hash))) {
171 if ($type =~ /$org/) {
172 ($before, $after) = ($type =~ /^(.*)$org(.*)$/);
173 return "$before$hash{$org}$after";
180 # Used to convert some variable names
185 %hash = ( "near" => "nearParam",
186 "far" => "farParam" );
188 foreach $org (keys %hash) {
189 if ($type =~ /$org/) {
190 ($before, $after) = ($type =~ /^(.*)$org(.*)$/);
191 return "$before$hash{$org}$after";
198 # This functions generates the thunk for a given function.
201 my ($func_ref, $comment, $prefix, $thread_safe) = @_;
203 my ($call_arg) = ("");
204 my ($trace_arg) = ("");
205 my ($wine_func_ref_name) = ("");
207 # If for opengl_norm.c, generate a nice heading otherwise Patrik won't be happy :-)
208 # Patrik says: Well I would be even happier if a (OPENGL32.@) was added as well. Done. :-)
210 $ret = $ret . "/***********************************************************************\n";
211 $ret = $ret . " * " . $func_ref->[0] . " (OPENGL32.@)\n";
212 $ret = $ret . " */\n";
214 $ret = $ret . ConvertType($func_ref->[1]) . " WINAPI wine_" . $func_ref->[0] . "( ";
215 for ($i = 0; $i <= $#{@{$func_ref->[2]}}; $i++) {
216 ## Quick debug code :-)
217 ## print $func_ref->[2]->[$i]->[1] . "\n";
218 $type = $func_ref->[2]->[$i]->[0];
219 $name = ConvertVarName($func_ref->[2]->[$i]->[1]);
220 $ret = $ret . ConvertType($type) . " $name";
221 $call_arg = $call_arg . "$name";
223 $trace_arg = $trace_arg . "%p";
225 $trace_arg = $trace_arg . $debug_conv{$type};
227 if ($i != $#{@{$func_ref->[2]}}) {
229 $call_arg = $call_arg . ", ";
230 $trace_arg = $trace_arg . ", ";
233 $call_arg = $call_arg . " ";
236 $ret = $ret . ") {\n";
237 if ($func_ref->[1] ne "void") {
238 $ret = $ret . " " . ConvertType($func_ref->[1]) . " ret_value;\n";
241 $ret = $ret . " TRACE(\"(" . $trace_arg . ")\\n\"";
242 if ($trace_arg ne "") {
243 $ret = $ret . ", " . $call_arg;
245 $ret = $ret . ");\n";
248 $ret = $ret . " ENTER_GL();\n";
251 if ($func_ref->[1] ne "void") {
252 $ret = $ret . "ret_value = ";
254 $wine_func_ref_name = $func_ref->[0];
255 if ( $func_ref->[0] eq "glGetString" ) {
256 $wine_func_ref_name = "internal_glGetString";
258 $ret = $ret . $prefix . $wine_func_ref_name . "( " . $call_arg . ");\n";
260 $ret = $ret . " LEAVE_GL();\n";
262 if ($func_ref->[1] ne "void") {
263 $ret = $ret . " return ret_value;\n"
267 # Return this string....
272 # Extract and checks the number of arguments
275 die "Usage : make_opengl OpenGL_registry_location OpenGL_version.\n";
277 $registry_path = shift @ARGV;
278 $version = shift @ARGV;
279 if ($version eq "1.0") {
280 %norm_categories = %cat_1_0;
281 } elsif ($version eq "1.1") {
282 %norm_categories = %cat_1_1;
283 } elsif ($version eq "1.2") {
284 %norm_categories = %cat_1_2;
285 } elsif ($version eq "1.3") {
286 %norm_categories = %cat_1_3;
287 } elsif ($version eq "1.4") {
288 %norm_categories = %cat_1_4;
289 } elsif ($version eq "1.5") {
290 %norm_categories = %cat_1_5;
292 die "Incorrect OpenGL version.\n";
296 # Open the registry files
298 open(TYPES, $registry_path . "/gl.tm") || die "Could not open 'gl.tm'. Please check your path the the registry files.\n";
299 open(REGISTRY, $registry_path . "/gl.spec") || die "Could not open 'gl.spec'. Please check your path the the registry files.\n";
302 # First, create a mapping between the pseudo types used in the spec file
303 # and OpenGL types using the 'gl.tm' file.
305 %pseudo_to_opengl = ();
306 while ($line = <TYPES>) {
307 if ($line !~ /\w*\#/) {
308 ($pseudo, $opengl) = ($line =~ /(\w*),\*,\*,\s*(.*),\*,\*/);
309 $pseudo_to_opengl{$pseudo} = $opengl;
312 # This is to override the 'void' -> '*' bogus conversion
313 $pseudo_to_opengl{"void"} = "void";
314 # This is a bug in the spec file...
315 $pseudo_to_opengl{"FfdTargetSGIX"} = "GLint";
316 $pseudo_to_opengl{"FfdMaskSGIX"} = "GLint";
317 $pseudo_to_opengl{"IglooFunctionSelectSGIX"} = "GLint";
318 $pseudo_to_opengl{"IglooParameterSGIX"} = "GLint";
321 # Then, create the list of all OpenGL functions using the 'gl.spec'
322 # file. This will create two hash-tables, one with all the function
323 # whose category matches the one listed in '@norm_categories', the other
324 # with all other functions.
326 # An element of the hash table is a reference to an array with these
333 # - reference to an array giving the list of arguments (an empty array
334 # for a 'void' function).
336 # The list of arguments is itself an array of reference to arrays. Each
337 # of these arrays represents the argument type and the argument name.
341 # void glBitmap( GLsizei width, GLsizei height,
342 # GLfloat xorig, GLfloat yorig,
343 # GLfloat xmove, GLfloat ymove,
344 # const GLubyte *bitmap );
346 # Would give something like that :
350 # [ [ "GLsizei", "width" ],
351 # [ "GLsizei", "height" ],
352 # [ "GLfloat", "xorig" ],
353 # [ "GLfloat", "yorig" ],
354 # [ "GLfloat", "xmove" ],
355 # [ "GLfloat", "ymove" ],
356 # [ "GLubyte *", "bitmap"] ] ];
358 %norm_functions = ();
361 # This stores various extensions NOT part of the GL extension registry but still
362 # implemented by most OpenGL libraries out there...
365 ( "glDeleteBufferRegion" => [ "glDeleteBufferRegion", "void", [ [ "GLenum", "region" ] ], "glDeleteBufferRegion" ],
366 "glReadBufferRegion" => [ "glReadBufferRegion", "void", [ [ "GLenum", "region" ],
369 [ "GLsizei", "width" ],
370 [ "GLsizei", "height" ] ], "glReadBufferRegion" ],
371 "glDrawBufferRegion" => [ "glDrawBufferRegion", "void", [ [ "GLenum", "region" ],
374 [ "GLsizei", "width" ],
375 [ "GLsizei", "height" ],
376 [ "GLint", "xDest" ],
377 [ "GLint", "yDest" ] ], "glDrawBufferRegion" ],
378 "glBufferRegionEnabled" => [ "glBufferRegionEnabled", "GLuint", [ ], "glBufferRegionEnabled" ],
379 "glNewBufferRegion" => [ "glNewBufferRegion", "GLuint", [ [ "GLenum", "type" ] ], "glNewBufferRegion" ],
380 "glMTexCoord2fSGIS" => [ "glMTexCoord2fSGIS", "void", [ [ "GLenum", "target" ],
382 [ "GLfloat", "t" ] ], "glMTexCoord2fSGIS" ],
383 "glMTexCoord2fvSGIS" => [ "glMTexCoord2fvSGIS", "void", [ [ "GLenum", "target" ],
384 [ "GLfloat *", "v" ] ], "glMTexCoord2fvSGIS" ],
385 "glMultiTexCoord1dSGIS" => [ "glMultiTexCoord1dSGIS", "void", [ [ "GLenum", "target" ],
386 [ "GLdouble", "s" ] ], "glMultiTexCoord1dSGIS" ],
387 "glMultiTexCoord1dvSGIS" => [ "glMultiTexCoord1dvSGIS", "void", [ [ "GLenum", "target" ],
388 [ "GLdouble *", "v" ] ], "glMultiTexCoord1dvSGIS" ],
389 "glMultiTexCoord1fSGIS" => [ "glMultiTexCoord1fSGIS", "void", [ [ "GLenum", "target" ],
390 [ "GLfloat", "s" ] ], "glMultiTexCoord1fSGIS" ],
391 "glMultiTexCoord1fvSGIS" => [ "glMultiTexCoord1fvSGIS", "void", [ [ "GLenum", "target" ],
392 [ "const GLfloat *", "v" ] ], "glMultiTexCoord1fvSGIS" ],
393 "glMultiTexCoord1iSGIS" => [ "glMultiTexCoord1iSGIS", "void", [ [ "GLenum", "target" ],
394 [ "GLint", "s" ] ], "glMultiTexCoord1iSGIS" ],
395 "glMultiTexCoord1ivSGIS" => [ "glMultiTexCoord1ivSGIS", "void", [ [ "GLenum", "target" ],
396 [ "GLint *", "v" ] ], "glMultiTexCoord1ivSGIS" ],
397 "glMultiTexCoord1sSGIS" => [ "glMultiTexCoord1sSGIS", "void", [ [ "GLenum", "target" ],
398 [ "GLshort", "s" ] ], "glMultiTexCoord1sSGIS" ],
399 "glMultiTexCoord1svSGIS" => [ "glMultiTexCoord1svSGIS", "void", [ [ "GLenum", "target" ],
400 [ "GLshort *", "v" ] ], "glMultiTexCoord1svSGIS" ],
401 "glMultiTexCoord2dSGIS" => [ "glMultiTexCoord2dSGIS", "void", [ [ "GLenum", "target" ],
403 [ "GLdouble", "t" ] ], "glMultiTexCoord2dSGIS" ],
404 "glMultiTexCoord2dvSGIS" => [ "glMultiTexCoord2dvSGIS", "void", [ [ "GLenum", "target" ],
405 [ "GLdouble *", "v" ] ], "glMultiTexCoord2dvSGIS" ],
406 "glMultiTexCoord2fSGIS" => [ "glMultiTexCoord2fSGIS", "void", [ [ "GLenum", "target" ],
408 [ "GLfloat", "t" ] ], "glMultiTexCoord2fSGIS" ],
409 "glMultiTexCoord2fvSGIS" => [ "glMultiTexCoord2fvSGIS", "void", [ [ "GLenum", "target" ],
410 [ "GLfloat *", "v" ] ], "glMultiTexCoord2fvSGIS" ],
411 "glMultiTexCoord2iSGIS" => [ "glMultiTexCoord2iSGIS", "void", [ [ "GLenum", "target" ],
413 [ "GLint", "t" ] ], "glMultiTexCoord2iSGIS" ],
414 "glMultiTexCoord2ivSGIS" => [ "glMultiTexCoord2ivSGIS", "void", [ [ "GLenum", "target" ],
415 [ "GLint *", "v" ] ], "glMultiTexCoord2ivSGIS" ],
416 "glMultiTexCoord2sSGIS" => [ "glMultiTexCoord2sSGIS", "void", [ [ "GLenum", "target" ],
418 [ "GLshort", "t" ] ], "glMultiTexCoord2sSGIS" ],
419 "glMultiTexCoord2svSGIS" => [ "glMultiTexCoord2svSGIS", "void", [ [ "GLenum", "target" ],
420 [ "GLshort *", "v" ] ], "glMultiTexCoord2svSGIS" ],
421 "glMultiTexCoord3dSGIS" => [ "glMultiTexCoord3dSGIS", "void", [ [ "GLenum", "target" ],
424 [ "GLdouble", "r" ] ], "glMultiTexCoord3dSGIS" ],
425 "glMultiTexCoord3dvSGIS" => [ "glMultiTexCoord3dvSGIS", "void", [ [ "GLenum", "target" ],
426 [ "GLdouble *", "v" ] ], "glMultiTexCoord3dvSGIS" ],
427 "glMultiTexCoord3fSGIS" => [ "glMultiTexCoord3fSGIS", "void", [ [ "GLenum", "target" ],
430 [ "GLfloat", "r" ] ], "glMultiTexCoord3fSGIS" ],
431 "glMultiTexCoord3fvSGIS" => [ "glMultiTexCoord3fvSGIS", "void", [ [ "GLenum", "target" ],
432 [ "GLfloat *", "v" ] ], "glMultiTexCoord3fvSGIS" ],
433 "glMultiTexCoord3iSGIS" => [ "glMultiTexCoord3iSGIS", "void", [ [ "GLenum", "target" ],
436 [ "GLint", "r" ] ], "glMultiTexCoord3iSGIS" ],
437 "glMultiTexCoord3ivSGIS" => [ "glMultiTexCoord3ivSGIS", "void", [ [ "GLenum", "target" ],
438 [ "GLint *", "v" ] ], "glMultiTexCoord3ivSGIS" ],
439 "glMultiTexCoord3sSGIS" => [ "glMultiTexCoord3sSGIS", "void", [ [ "GLenum", "target" ],
442 [ "GLshort", "r" ] ], "glMultiTexCoord3sSGIS" ],
443 "glMultiTexCoord3svSGIS" => [ "glMultiTexCoord3svSGIS", "void", [ [ "GLenum", "target" ],
444 [ "GLshort *", "v" ] ], "glMultiTexCoord3svSGIS" ],
445 "glMultiTexCoord4dSGIS" => [ "glMultiTexCoord4dSGIS", "void", [ [ "GLenum", "target" ],
449 [ "GLdouble", "q" ] ], "glMultiTexCoord4dSGIS" ],
450 "glMultiTexCoord4dvSGIS" => [ "glMultiTexCoord4dvSGIS", "void", [ [ "GLenum", "target" ],
451 [ "GLdouble *", "v" ] ], "glMultiTexCoord4dvSGIS" ],
452 "glMultiTexCoord4fSGIS" => [ "glMultiTexCoord4fSGIS", "void", [ [ "GLenum", "target" ],
456 [ "GLfloat", "q" ] ], "glMultiTexCoord4fSGIS" ],
457 "glMultiTexCoord4fvSGIS" => [ "glMultiTexCoord4fvSGIS", "void", [ [ "GLenum", "target" ],
458 [ "GLfloat *", "v" ] ], "glMultiTexCoord4fvSGIS" ],
459 "glMultiTexCoord4iSGIS" => [ "glMultiTexCoord4iSGIS", "void", [ [ "GLenum", "target" ],
463 [ "GLint", "q" ] ], "glMultiTexCoord4iSGIS" ],
464 "glMultiTexCoord4ivSGIS" => [ "glMultiTexCoord4ivSGIS", "void", [ [ "GLenum", "target" ],
465 [ "GLint *", "v" ] ], "glMultiTexCoord4ivSGIS" ],
466 "glMultiTexCoord4sSGIS" => [ "glMultiTexCoord4sSGIS", "void", [ [ "GLenum", "target" ],
470 [ "GLshort", "q" ] ], "glMultiTexCoord4sSGIS" ],
471 "glMultiTexCoord4svSGIS" => [ "glMultiTexCoord4svSGIS", "void", [ [ "GLenum", "target" ],
472 [ "GLshort *", "v" ] ], "glMultiTexCoord4svSGIS" ],
473 "glMultiTexCoordPointerSGIS" => [ "glMultiTexCoordPointerSGIS", "void", [ [ "GLenum", "target" ],
475 [ "GLenum", "type" ],
476 [ "GLsizei", "stride" ],
477 [ "GLvoid *", "pointer" ] ], "glMultiTexCoordPointerSGIS" ],
478 "glSelectTextureSGIS" => [ "glSelectTextureSGIS", "void", [ [ "GLenum", "target" ] ], "glSelectTextureSGIS" ],
479 "glSelectTextureCoordSetSGIS" => [ "glSelectTextureCoordSetSGIS", "void", [ [ "GLenum", "target" ] ], "glSelectTextureCoordSetSGIS" ],
480 "wglAllocateMemoryNV" => [ "wglAllocateMemoryNV", "void *", [ [ "GLsizei", "size" ],
481 [ "GLfloat", "readfreq" ],
482 [ "GLfloat", "writefreq"],
483 [ "GLfloat", "priority" ] ], "glXAllocateMemoryNV" ],
484 "wglFreeMemoryNV" => [ "wglFreeMemoryNV", "void", [ [ "GLvoid *", "pointer" ] ], "glXFreeMemoryNV" ],
485 "glDeleteObjectBufferATI" => [ "glDeleteObjectBufferATI", "void", [ [ "GLuint", "buffer" ] ], "glDeleteObjectBufferATI" ]
489 while ($line = <REGISTRY>) {
490 if ($line =~ /^\w*\(.*\)/) {
491 # Get the function name (NOTE: the 'gl' prefix needs to be added later)
492 ($funcname, $args) = ($line =~ /^(\w*)\((.*)\)/);
493 # and the argument names
494 @arg_names = split /\s*,\s*/, $args;
498 # - the argument types
499 # - the category the function belongs
505 unless (defined($line)) {
507 } elsif ($line =~ /^\s*$/) {
508 if (($category eq "") || ($ret_type eq "")) {
509 die "Missing 'category' line in function $funcname.\n";
512 } elsif ($line =~ /\t*return\t*(\w*)/) {
513 ($ret_type) = ($line =~ /\t*return\s*(\w*)/);
514 $ret_type = $pseudo_to_opengl{$ret_type};
515 unless (defined($ret_type)) {
516 die "Unsupported return type in function $funcname\n";
518 } elsif ($line =~ /^\t*category/) {
519 ($category) = ($line =~ /^\t*category\s*([\w-]*)/);
520 } elsif ($line =~ /^\t*param/) {
521 ($name, $base_type, $ext) = ($line =~ /\t*param\s*(\w*)\s*(\w*) (.*)/);
523 unless (defined($name)) {
525 die "Broken spec file line $line in function $funcname\n";
528 if ($ext =~ /array/) {
531 } elsif ($ext =~ /value/) {
532 # And this a 'normal' value
536 die "Unsupported type : $line in function $funcname\n";
538 # Get the 'real' type and append a '*' in case of a pointer
539 $type = $pseudo_to_opengl{$base_type};
540 unless (defined($type)) {
542 die "Unsupported return type in function $funcname for type $base_type (line $line)\n";
548 $arg_types{$name} = $type;
552 # Now, build the argument reference
554 for ($i = 0; $i <= $#arg_names; $i++) {
555 unless (defined($arg_types{$arg_names[$i]})) {
556 print "@arg_names\n";
557 foreach (sort keys %arg_types) {
558 print "$_ => $arg_types{$_}\n";
560 die "Undefined type for $arg_names[$i] in function $funcname\n";
563 push @$arg_ref, [ $arg_types{$arg_names[$i]}, $arg_names[$i] ];
565 $func_ref = [ "gl" . $funcname,
570 # Now, put in one or the other hash table
571 if ($norm_categories{$category}) {
572 $norm_functions{"gl" . $funcname} = $func_ref;
574 $ext_functions{"gl" . $funcname} = $func_ref;
580 # Clean up the input files
586 # Now, generate the output files. First, the spec file.
588 open(SPEC, ">" . $spec_file);
590 print SPEC "@ stdcall wglCreateContext(long)
591 @ stdcall wglCreateLayerContext(long long)
592 @ stdcall wglCopyContext(long long long)
593 @ stdcall wglDeleteContext(long)
594 @ stdcall wglDescribeLayerPlane(long long long long ptr)
595 @ stdcall wglGetCurrentContext()
596 @ stdcall wglGetCurrentDC()
597 @ stdcall wglGetLayerPaletteEntries(long long long long ptr)
598 @ stdcall wglGetProcAddress(str)
599 @ stdcall wglMakeCurrent(long long)
600 @ stdcall wglRealizeLayerPalette(long long long)
601 @ stdcall wglSetLayerPaletteEntries(long long long long ptr)
602 @ stdcall wglShareLists(long long)
603 @ stdcall wglSwapLayerBuffers(long long)
604 @ stdcall wglUseFontBitmapsA(long long long long)
605 @ stdcall wglUseFontOutlinesA(long long long long long long long ptr)
606 @ stub glGetLevelParameterfv
607 @ stub glGetLevelParameteriv
608 @ stdcall wglUseFontBitmapsW(long long long long)
609 @ stub wglUseFontOutlinesW
610 @ stub wglGetDefaultProcAddress
611 @ stdcall wglChoosePixelFormat(long ptr) gdi32.ChoosePixelFormat
612 @ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat
613 @ stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat
614 @ stdcall wglSetPixelFormat(long long ptr) gdi32.SetPixelFormat
615 @ stdcall wglSwapBuffers(long) gdi32.SwapBuffers
618 foreach (sort keys %norm_functions) {
619 $func_name = $norm_functions{$_}->[0];
620 print SPEC "@ stdcall $func_name( ";
621 for ($i = 0; $i <= $#{@{$norm_functions{$_}->[2]}}; $i++) {
622 $type = $norm_functions{$_}->[2]->[$i]->[0];
625 } elsif (defined($arg_conv{$type})) {
626 print SPEC "$@$arg_conv{$type}[0] ";
628 die "No convertion for GL type $type...\n";
631 print SPEC ") wine_$func_name\n";
636 # After the spec file, the opengl_norm.c file
638 open(NORM, ">" . $norm_file);
640 /* Auto-generated file... Do not edit ! */
642 #include \"config.h\"
643 #include \"opengl_ext.h\"
644 #include \"wine/debug.h\"
646 WINE_DEFAULT_DEBUG_CHANNEL(opengl);
648 foreach (sort keys %norm_functions) {
649 $string = GenerateThunk($norm_functions{$_}, 1, "", $gen_thread_safe);
651 print NORM "\n$string";
656 # Finally, more complex, the opengl_ext.c file
658 open(EXT, ">" . $ext_file);
660 /* Auto-generated file... Do not edit ! */
662 #include \"config.h\"
663 #include \"opengl_ext.h\"
664 #include \"wine/debug.h\"
666 WINE_DEFAULT_DEBUG_CHANNEL(opengl);
670 # First, generate the function pointers
671 foreach (sort keys %ext_functions) {
672 $func_ref = $ext_functions{$_};
673 print EXT ConvertType($func_ref->[1]) . " (*" . $ext_prefix . $func_ref->[0] . ")( ";
674 for ($i = 0; $i <= $#{@{$func_ref->[2]}}; $i++) {
675 $type = ConvertType($func_ref->[2]->[$i]->[0]);
677 if ($i != $#{@{$func_ref->[2]}}) {
683 print EXT ") = (void *) 0xdeadbeef;\n";
686 # Then, the function prototypes
687 print EXT "\n\n/* The function prototypes */\n";
688 foreach (sort keys %ext_functions) {
689 $func_ref = $ext_functions{$_};
690 print EXT ConvertType($func_ref->[1]) . " WINAPI " . "wine_" . $func_ref->[0] . "( ";
691 for ($i = 0; $i <= $#{@{$func_ref->[2]}}; $i++) {
692 $type = ConvertType($func_ref->[2]->[$i]->[0]);
694 if ($i != $#{@{$func_ref->[2]}}) {
703 # Then the table giving the string <-> function correspondance */
704 print EXT "\n\n/* The table giving the correspondance between names and functions */\n";
705 @tmp = keys %ext_functions;
706 print EXT "int extension_registry_size = " . ($#tmp + 1) . ";\n";
707 print EXT "OpenGL_extension extension_registry[" . ($#tmp + 1) . "] = {\n";
709 foreach (sort keys %ext_functions) {
710 $func_ref = $ext_functions{$_};
711 print EXT " { \"" . $func_ref->[0] . "\", \"" . $func_ref->[3] . "\", (void *) wine_" . $func_ref->[0] . ", (void **) (&" . $ext_prefix . $func_ref->[0] . ") }";
720 # And, finally, the thunks themselves....
721 print EXT "\n/* The thunks themselves....*/";
722 foreach (sort keys %ext_functions) {
723 $string = GenerateThunk($ext_functions{$_}, 0, $ext_prefix, $gen_thread_safe);
725 print EXT "\n$string";