[svn:parrot] r42498 - trunk/config/gen

japhb at svn.parrot.org japhb at svn.parrot.org
Sat Nov 14 01:48:45 UTC 2009


Author: japhb
Date: Sat Nov 14 01:48:45 2009
New Revision: 42498
URL: https://trac.parrot.org/parrot/changeset/42498

Log:
[OpenGL] glut_callbacks.c: Now with more fixed.  (INTVAL casts for arguments to get proper sign extension)

Modified:
   trunk/config/gen/opengl.pm

Modified: trunk/config/gen/opengl.pm
==============================================================================
--- trunk/config/gen/opengl.pm	Sat Nov 14 01:13:29 2009	(r42497)
+++ trunk/config/gen/opengl.pm	Sat Nov 14 01:48:45 2009	(r42498)
@@ -291,6 +291,13 @@
     p => 'P',
 );
 
+my %PCC_CAST = (
+    I => '(INTVAL) ',
+    N => '(FLOATVAL) ',
+    S => '',
+    P => '',
+);
+
 my %OVERRIDE = (
     'glutInit'  => 'v3p',
 );
@@ -939,14 +946,15 @@
 
         my $args   =  $params;
            $args   =~ s/void//;
-           $args   =~ s/(^|, )(\w+ )+/$1/g;
+           $args   =~ s/unsigned //;
+           $args   =~ s/(^|, )((?:\w+ )+)/$1$PCC_CAST{$PCC_TYPE{$NCI_TYPE{(split ' ', $2)[0]}}}/g;
            $args   =  ", $args" if $args;
         my $proto  =  $params;
            $proto  =~ s/ \w+(,|$)/$1/g;
         my $sig    =  $proto;
            $sig    =~ s/void//;
            $sig    =~ s/unsigned //;
-           $sig    =~ s/(\w+)\W*/$PCC_TYPE{$NCI_TYPE{$1}}/eg;
+           $sig    =~ s/(\w+)\W*/$PCC_TYPE{$NCI_TYPE{$1}}/g;
            $sig    =  "$sig->";
 
         my $glutcb =  "glutcb${friendly}Func";
@@ -1082,7 +1090,7 @@
     PMC           *sub   = callback_data[GLUT_CB_TIMER].sub;
 
     if (is_safe(interp, sub))
-        Parrot_ext_call(interp, sub, "I->", data);
+        Parrot_ext_call(interp, sub, "I->", (INTVAL) data);
 }
 
 PARROT_DYNEXT_EXPORT
@@ -1117,7 +1125,8 @@
     PMC           *sub   = callback_data[GLUT_CB_JOYSTICK].sub;
 
     if (is_safe(interp, sub))
-        Parrot_ext_call(interp, sub, "IIII->", buttons, xaxis, yaxis, zaxis);
+        Parrot_ext_call(interp, sub, "IIII->",
+            (INTVAL) buttons, (INTVAL) xaxis, (INTVAL) yaxis, (INTVAL) zaxis);
 }
 
 PARROT_DYNEXT_EXPORT


More information about the parrot-commits mailing list