# New Ticket Created by  Josef Höök 
# Please include the string:  [perl #16934]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=16934 >



Added 2 new opses into core.ops that handles this code:

         new P0, .MultiArray[2;2;2]
         
and

         new P0, .Multiarray[2]

I also changed new (out PMC, in INT, in INT). It now creates a perlint and
calls pmc_new_pmc (in pmc.c) 


/Josef 


-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/36331/29362/dc823d/core_ops.20020830.patch

--- core.ops.orig       Fri Aug 30 21:57:23 2002
+++ core.ops    Fri Aug 30 21:56:55 2002
@@ -3806,6 +3806,10 @@
 
 =item B<new>(out PMC, in INT, in INT)
 
+=item B<new>(out PMC, in INT, in INTKEY)
+
+=item B<new>(out PMC, in INT, in KEY)
+
 Create a new PMC of class $2; look in F<pmc.h> for the base
 vtable types. The assembler allows you to specify PMCs by type
 name as well as by integer - you should do this for compatibility,
@@ -3818,6 +3822,10 @@
 
   new P0, .PerlStruct, 64
 
+or 
+  
+ new P0, MultiArray[2;2;2]
+
 =cut
 
 op new(out PMC, in INT) {
@@ -3835,10 +3843,39 @@
 
 op new(out PMC, in INT, in INT) {
   PMC* newpmc;
+  PMC* new_int_pmc;
+  if ($2 <0 || $2 >= enum_class_max) {
+    abort(); /* Deserve to lose */
+  }
+  /* use a perlint pmc as a wrapper to pass the size to $1 pmc */
+  new_int_pmc = pmc_new(interpreter, enum_class_PerlInt);
+  new_int_pmc->vtable->set_integer_native(interpreter, new_int_pmc, $3);
+  newpmc = pmc_new_pmc(interpreter, $2, new_int_pmc);
+  $1 = newpmc;
+  goto NEXT();
+}
+
+op new(out PMC, in INT, in INTKEY) {
+  PMC* newpmc;
+  PMC* new_key_pmc;
+  INTVAL key = $3;
+  if ($2 <0 || $2 >= enum_class_max) {
+    abort(); /* Deserve to lose */
+  }
+  /* use a key pmc as a wrapper to pass the size to $1 pmc */
+  new_key_pmc = pmc_new(interpreter, enum_class_Key);
+  new_key_pmc->vtable->set_integer_native(interpreter, new_key_pmc, key);
+  newpmc = pmc_new_pmc(interpreter, $2, new_key_pmc);
+  $1 = newpmc;
+  goto NEXT();
+}
+
+op new(out PMC, in INT, in KEY) {
+  PMC* newpmc;
   if ($2 <0 || $2 >= enum_class_max) {
     abort(); /* Deserve to lose */
   }
-  newpmc = pmc_new_sized(interpreter, $2, $3);
+  newpmc = pmc_new_pmc(interpreter, $2, $3);
   $1 = newpmc;
   goto NEXT();
 }

Reply via email to