--- OpenCL/gengetinfo 2012/04/24 22:45:38 1.11 +++ OpenCL/gengetinfo 2012/05/04 14:46:02 1.14 @@ -125,6 +125,12 @@ $extra_xs_args = ', OpenCL::Device device'; } + if ($CLASS eq "kernel_arg") { + $extra_args = ', idx'; + $extra_perl_args = ' ($idx)'; + $extra_xs_args = ', cl_uint idx'; + } + my $dynamic; my $nelem = "size / sizeof (*value)"; @@ -156,7 +162,9 @@ $perltype = "\$$perltype"; } - $POD .= "=item $perltype = \$$real_class->$perl_name$extra_perl_args\n\nCalls C with C<$name> and returns the result.\n\n"; + (my $perlenum = $name) =~ s/^CL_/OpenCL::/ or die; + + $POD .= "=item $perltype = \$$real_class->$perl_name$extra_perl_args\n\nCalls C with C<$perlenum> and returns the result.\n\n"; # XS1 contains the function before ALIAS, XS2 the function afterwards (the body) # after we generate the bdoy we look for an identical body generated earlier @@ -191,9 +199,13 @@ $oclass = "MemObject" if $oclass eq "Memory"; $oclass = "CommandQueue" if $oclass eq "Queue"; + my $stash = lc $type->[1]; + $stash =~ s/opencl:://; + $stash =~ s/::/_/g; + $XS2 .= " {\n"; - $XS2 .= " NEED_SUCCESS (Retain$oclass, (value [i]));\n" unless $1 eq "Platform" || $1 eq "Device"; - $XS2 .= " PUSH_CLOBJ (\"$type->[1]\", value [i]);\n"; + $XS2 .= " NEED_SUCCESS (Retain$oclass, (value [i]));\n" unless $oclass eq "Platform" || $oclass eq "Device"; + $XS2 .= " PUSH_CLOBJ (stash_$stash, value [i]);\n"; $XS2 .= " }\n"; } else { $XS2 .= " PUSHs (sv_2mortal ($type->[1]));\n";