@@ -34,41 +34,41 @@ sub munge_GL_args {
3434}
3535
3636sub generate_glew_xs {
37- my $content ;
38- for my $name (@_ ? @_ : sort keys %signature ) {
39- my $item = $signature {$name };
40- if ( is_manual($name ) ) {
41- print " Skipping $name , already implemented in Modern.xs\n " ;
42- next ;
43- }
44- my $argdata = $item -> {argdata };
45- my @argdata = @{$argdata || []};
46- my $type = $item -> {restype };
47- my $glewImpl = $item -> {glewImpl };
48- my $args = join ' , ' , map $_ -> [0], @argdata ;
49- my $xs_args = join ' ' , map " $_ ->[1]$_ ->[0];\n " , @argdata ;
50- my $binding_name = $item -> { has_ptr_arg } ? $ name . ' _c ' : $name ;
51- my $decl = <<XS ;
37+ my $content ;
38+ for my $name (@_ ? @_ : sort keys %signature ) {
39+ my $item = $signature {$name };
40+ if ( is_manual($name ) ) {
41+ print " Skipping $name , already implemented in Modern.xs\n " ;
42+ next ;
43+ }
44+ my $argdata = $item -> {argdata };
45+ my @argdata = @{$argdata || []};
46+ my $type = $item -> {restype };
47+ my $glewImpl = $item -> {glewImpl };
48+ my $args = join ' , ' , map $_ -> [0], @argdata ;
49+ my $xs_args = join ' ' , map " $_ ->[1]$_ ->[0];\n " , @argdata ;
50+ my ( $binding_name ) = bind_names( $ name, $item ) ;
51+ my $decl = <<XS ;
5252$type
5353$binding_name ($args );
5454XS
55- $decl .= $xs_args ;
56- my $error_check = $name eq " glGetError" ? " " : " OGLM_CHECK_ERR($name )" ;
57- my $res = $decl . <<XS ;
55+ $decl .= $xs_args ;
56+ my $error_check = $name eq " glGetError" ? " " : " OGLM_CHECK_ERR($name )" ;
57+ my $res = $decl . <<XS ;
5858CODE:
59- OGLM_GLEWINIT@{[$error_check && "\n $error_check "]}
60- XS
61- if ( $item -> {glewtype } eq ' fun' and $glewImpl ) {
62- $res .= " OGLM_AVAIL_CHECK($glewImpl , $name )\n " ;
63- }
64- my ($retcap , $retout ) = $type eq ' void' ? (' ' ,' ' ) : (' RETVAL = ' , " \n OUTPUT:\n RETVAL" );
65- my $arg_list = $item -> {glewtype } eq ' var' ? " " : " ($args )" ;
66- $res .= <<XS ;
67- $retcap$name$arg_list ;@{[$error_check && "\n $error_check "]}$retout
59+ OGLM_GLEWINIT@{[$error_check && "\n $error_check "]}
6860XS
69- $content .= " $res \n " ;
61+ if ( $item -> {glewtype } eq ' fun' and $glewImpl ) {
62+ $res .= " OGLM_AVAIL_CHECK($glewImpl , $name )\n " ;
7063 }
71- return $content ;
64+ my ($retcap , $retout ) = $type eq ' void' ? (' ' ,' ' ) : (' RETVAL = ' , " \n OUTPUT:\n RETVAL" );
65+ my $arg_list = $item -> {glewtype } eq ' var' ? " " : " ($args )" ;
66+ $res .= <<XS ;
67+ $retcap$name$arg_list ;@{[$error_check && "\n $error_check "]}$retout
68+ XS
69+ $content .= " $res \n " ;
70+ }
71+ return $content ;
7272}
7373
7474my $xs_code = generate_glew_xs(@ARGV );
0 commit comments