@@ -41,32 +41,33 @@ sub generate_glew_xs {
41
41
print " Skipping $name , already implemented in Modern.xs\n " ;
42
42
next ;
43
43
}
44
- my $argdata = $item -> {argdata };
45
- my @argdata = @{$argdata || []};
46
- my $type = $item -> {restype };
44
+ my @argdata = @{$item -> {argdata } || []};
47
45
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 ;
52
- $type
53
- $binding_name ($args );
54
- XS
55
- $decl .= $xs_args ;
56
46
my $error_check = $name eq " glGetError" ? " " : " OGLM_CHECK_ERR($name )" ;
57
- my $res = $decl . <<XS ;
47
+ my $avail_check = ($item -> {glewtype } eq ' fun' && $glewImpl )
48
+ ? " OGLM_AVAIL_CHECK($glewImpl , $name )\n "
49
+ : " " ;
50
+ my $callarg_list = $item -> {glewtype } eq ' var' ? " " : " (@{[ join ', ', map $_ ->[0], @argdata ]})" ;
51
+ for my $binding_name (bind_names($name , $item )) {
52
+ my @thisargdata = @argdata ;
53
+ my $thistype = $item -> {restype };
54
+ my ($retcap , $retout ) = $thistype eq ' void' ? (' ' ,' ' ) : (' RETVAL = ' , " \n OUTPUT:\n RETVAL" );
55
+ my $args = join ' , ' , map $_ -> [0], @thisargdata ;
56
+ my $decl = <<XS ;
57
+ $thistype
58
+ $binding_name ($args )
59
+ XS
60
+ $decl .= join ' ' , map " $_ ->[1]$_ ->[0];\n " , @thisargdata ;
61
+ my $res = $decl . <<XS ;
58
62
CODE:
59
- OGLM_GLEWINIT@{[$error_check && "\n $error_check "]}
63
+ OGLM_GLEWINIT@{[$error_check && "\n $error_check "]}
60
64
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
65
+ $res .= $avail_check ;
66
+ $res .= <<XS ;
67
+ $retcap$name$callarg_list ;@{[$error_check && "\n $error_check "]}$retout
68
68
XS
69
- $content .= " $res \n " ;
69
+ $content .= " $res \n " ;
70
+ }
70
71
}
71
72
return $content ;
72
73
}
0 commit comments