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.

73 lines
1.6KB

  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. # token
  14. sub make_define($$)
  15. {
  16. return "#define $_[0] $_[1]"
  17. }
  18. # type declaration
  19. sub make_type($$)
  20. {
  21. return "@_;"
  22. }
  23. # function pointer type declaration
  24. sub make_pfn_type($%)
  25. {
  26. our $api;
  27. return join(' ', "typedef", $_[1]->{rtype},
  28. "($api * PFN" . (uc $_[0]) . "PROC)",
  29. "(" . $_[1]->{parms} . ")") . ";";
  30. }
  31. # function name alias
  32. sub make_pfn_alias($%)
  33. {
  34. our $type;
  35. return join(" ", "#define", $_[0], $type . "EW_GET_FUN(" . prefixname($_[0]) . ")")
  36. }
  37. my @extlist = ();
  38. my %extensions = ();
  39. our $api = shift;
  40. our $type = shift;
  41. if (@ARGV)
  42. {
  43. @extlist = @ARGV;
  44. foreach my $ext (sort @extlist)
  45. {
  46. my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
  47. make_separator($extname);
  48. print "#ifndef $extname\n#define $extname 1\n";
  49. output_tokens($tokens, \&make_define);
  50. output_types($types, \&make_type);
  51. output_exacts($exacts, \&make_exact);
  52. output_decls($functions, \&make_pfn_type);
  53. output_decls($functions, \&make_pfn_alias);
  54. my $extvar = $extname;
  55. $extvar =~ s/GL(X*)_/GL$1EW_/;
  56. print "\n#define $extvar " . $type . "EW_GET_VAR(" . prefix_varname($extvar) . ")\n";
  57. print "\n#endif /* $extname */\n\n";
  58. }
  59. }