You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.8KB

  1. #!/usr/bin/perl
  2. ##
  3. ## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
  4. ## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
  5. ##
  6. ## This program is distributed under the terms and conditions of the GNU
  7. ## General Public License Version 2 as published by the Free Software
  8. ## Foundation or, at your option, any later version.
  9. use strict;
  10. use warnings;
  11. use lib '.';
  12. do 'bin/make.pl';
  13. #---------------------------------------------------------------------------------------
  14. # function pointer definition
  15. sub make_init_call($%)
  16. {
  17. my $name = prefixname($_[0]);
  18. return " r = r || (" . $_[0] . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress(\"" . $name . "\")) == NULL;";
  19. }
  20. #---------------------------------------------------------------------------------------
  21. my @extlist = ();
  22. my %extensions = ();
  23. if (@ARGV)
  24. {
  25. @extlist = @ARGV;
  26. foreach my $ext (sort @extlist)
  27. {
  28. my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
  29. my $extvar = $extname;
  30. $extvar =~ s/GL(X*)_/GL$1EW_/;
  31. my $extpre = $extname;
  32. $extpre =~ s/^(W?E?)GL(X?).*$/\l$1gl\l$2ew/;
  33. #my $pextvar = prefix_varname($extvar);
  34. if (length($extstring) && $extstring !~ /^GL_/ || keys %$functions)
  35. {
  36. print "#ifdef $extname\n";
  37. }
  38. if (length($extstring) && $extstring !~ /^GL_/)
  39. {
  40. print " " . $extvar . " = _glewSearchExtension(\"$extstring\", extStart, extEnd);\n";
  41. }
  42. if (keys %$functions)
  43. {
  44. if ($extname =~ /WGL_.*/)
  45. {
  46. print " if (glewExperimental || " . $extvar . "|| crippled) " . $extvar . "= !_glewInit_$extname();\n";
  47. }
  48. else
  49. {
  50. print " if (glewExperimental || " . $extvar . ") " . $extvar . " = !_glewInit_$extname();\n";
  51. }
  52. }
  53. if (length($extstring) && $extstring !~ /^GL_/ || keys %$functions)
  54. {
  55. print "#endif /* $extname */\n";
  56. }
  57. }
  58. }