# New Ticket Created by  "Sean O'Rourke" 
# Please include the string:  [netlabs #769]
# in the subject line of all future correspondence about this issue. 
# <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=769 >


imcc currently only seems to support string and integer comparisons.  This
patch lets you use if PMC, INTCONST.

/s

Index: imcc.y
===================================================================
RCS file: /cvs/public/parrot/languages/imcc/imcc.y,v
retrieving revision 1.7
diff -p -u -r1.7 imcc.y
--- imcc.y      4 Jul 2002 16:21:53 -0000       1.7
+++ imcc.y      7 Jul 2002 20:55:01 -0000
@@ -180,6 +180,16 @@ SymReg * iIF(int relop, SymReg * r0, Sym
     return 0;
 }

+SymReg * iIF_PMC(SymReg * r0, SymReg * dest)
+{
+    Instruction * i;
+    char op[256];
+    strcpy(op, "if %s, %s");
+    i = emitb(mk_instruction(op, r0, dest, 0, NULL, IF_r0_read |
IF_r1_branch));
+    i->type = ITBRANCH;
+    return 0;
+}
+
 SymReg * iNEW(SymReg * r0, char * type) {
     char op[256];
     strcpy(op, "new %s, .");
@@ -350,6 +360,8 @@ assignment:
 if_statement:
        labels IF var relop var GOTO IDENTIFIER
        { $$ = iIF($4, $3, $5, mk_address($7)); }
+    |  labels IF var GOTO IDENTIFIER
+       { $$ = iIF_PMC($3, mk_address($5)); }
     ;

 relop:




Reply via email to