--- OpenCL/gengetinfo 2012/04/19 13:06:55 1.7 +++ OpenCL/gengetinfo 2012/05/04 14:29:35 1.13 @@ -89,7 +89,7 @@ while (<$fh>) { chomp; - my ($class, $name, $ctype) = split /,\s*/, $_, 3; + my ($class, $name, $ctype) = split /\s*,\s*/, $_, 3; next unless $class eq "cl_$CLASS\_info"; next if $name eq "CL_IMAGE_FORMAT"; # struct next if $name eq "CL_PROGRAM_BINARIES"; # needs multiple calls @@ -99,6 +99,7 @@ my $cbase = $class; $cbase =~ s/_(.)/\U$1/g; + $cbase =~ s/Gl(?=[A-Z])/GL/g; $cbase =~ s/^cl//; $cbase =~ s/Info$//; $cbase = "MemObject" if $cbase eq "Mem"; @@ -155,7 +156,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 @@ -190,9 +193,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 .= " PUSHs (NEW_MORTAL_OBJ (\"$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";