On Tue, 2004-10-05 at 07:40, Dan Sugalski wrote:

> We do all the rest... might as well do this one too.

It'd look a little something like this.

Where do PIR tests go, by the way?  I didn't see them in a trivial grep.

(For future reference through search engines, rebuilding Parrot was a
pain here because Configure.pl didn't pick up bison and flex as my yacc
and lex workalikes.)

-- c


Index: imcc/imcc.l
===================================================================
RCS file: /cvs/public/parrot/imcc/imcc.l,v
retrieving revision 1.114
diff -u -u -r1.114 imcc.l
--- imcc/imcc.l	22 Sep 2004 08:46:55 -0000	1.114
+++ imcc/imcc.l	5 Oct 2004 15:32:35 -0000
@@ -258,6 +258,7 @@
 "-="            return(MINUS_ASSIGN);
 "*="            return(MUL_ASSIGN);
 "/="            return(DIV_ASSIGN);
+"%="            return(MOD_ASSIGN);
 "//"            return(FDIV);
 "//="           return(FDIV_ASSIGN);
 "&="            return(BAND_ASSIGN);
Index: imcc/imcc.y
===================================================================
RCS file: /cvs/public/parrot/imcc/imcc.y,v
retrieving revision 1.144
diff -u -u -r1.144 imcc.y
--- imcc/imcc.y	3 Aug 2004 11:21:33 -0000	1.144
+++ imcc/imcc.y	5 Oct 2004 15:32:36 -0000
@@ -268,7 +268,7 @@
 %token <t> SUB SYM LOCAL CONST
 %token <t> INC DEC GLOBAL_CONST
 %token <t> PLUS_ASSIGN MINUS_ASSIGN MUL_ASSIGN DIV_ASSIGN CONCAT_ASSIGN
-%token <t> BAND_ASSIGN BOR_ASSIGN BXOR_ASSIGN FDIV FDIV_ASSIGN
+%token <t> MOD_ASSIGN BAND_ASSIGN BOR_ASSIGN BXOR_ASSIGN FDIV FDIV_ASSIGN
 %token <t> SHR_ASSIGN SHL_ASSIGN SHR_U_ASSIGN
 %token <t> SHIFT_LEFT SHIFT_RIGHT INTV FLOATV STRINGV PMCV OBJECTV  LOG_XOR
 %token <t> RELOP_EQ RELOP_NE RELOP_GT RELOP_GTE RELOP_LT RELOP_LTE
@@ -894,6 +894,8 @@
                    { $$ = MK_I(interp, cur_unit, "sub", 2, $1, $3); }
    | target MUL_ASSIGN var
                    { $$ = MK_I(interp, cur_unit, "mul", 2, $1, $3); }
+   | target MOD_ASSIGN var
+                   { $$ = MK_I(interp, cur_unit, "mod", 2, $1, $3); }
    | target DIV_ASSIGN var
                    { $$ = MK_I(interp, cur_unit, "div", 2, $1, $3); }
    | target FDIV_ASSIGN var
Index: ops/math.ops
===================================================================
RCS file: /cvs/public/parrot/ops/math.ops,v
retrieving revision 1.26
diff -u -u -r1.26 math.ops
--- ops/math.ops	25 Aug 2004 08:03:19 -0000	1.26
+++ ops/math.ops	5 Oct 2004 15:47:03 -0000
@@ -636,6 +636,11 @@
 
 =cut
 
+op mod(inout INT, in INT) :base_core {
+  $1 = intval_mod($1, $2);
+  goto NEXT();
+}
+
 op mod(out INT, in INT, in INT) :base_core {
   $1 = intval_mod($2, $3);
   goto NEXT();
@@ -646,8 +651,8 @@
   goto NEXT();
 }
 
-inline op mod (in PMC, in INT ) :base_core {
-  mmd_dispatch_v_pip(interpreter, $1, $2, $1, MMD_MOD_INT);
+inline op mod (in PMC, in PMC) :base_core {
+  mmd_dispatch_v_ppp(interpreter, $1, $2, $1, MMD_MOD);
   goto NEXT();
 }
 
@@ -656,11 +661,20 @@
   goto NEXT();
 }
 
+inline op mod(in PMC, in INT) :base_core {
+  mmd_dispatch_v_pip(interpreter, $1, $2, $1, MMD_MOD_INT);
+  goto NEXT();
+}
+
 inline op mod(in PMC, in PMC, in NUM) :base_core {
   mmd_dispatch_v_pnp(interpreter, $2, $3, $1, MMD_MOD_FLOAT);
   goto NEXT();
 }
 
+inline op mod(in PMC, in NUM) :base_core {
+  mmd_dispatch_v_pnp(interpreter, $1, $2, $1, MMD_MOD_FLOAT);
+  goto NEXT();
+}
 
 ########################################
 
@@ -685,6 +699,10 @@
   goto NEXT();
 }
 
+op mod(inout NUM, in NUM) :base_core {
+  $1 = floatval_mod($1, $2);
+  goto NEXT();
+}
 
 ########################################
 

Reply via email to