Supercedes the previous one.

-- 
Bryan C. Warnock
[EMAIL PROTECTED]

Index: basic_opcodes.ops
===================================================================
RCS file: /home/perlcvs/parrot/basic_opcodes.ops,v
retrieving revision 1.33
diff -u -r1.33 basic_opcodes.ops
--- basic_opcodes.ops   2001/10/07 15:27:42     1.33
+++ basic_opcodes.ops   2001/10/08 14:52:17
@@ -383,6 +383,26 @@
   Parrot_push_p(interpreter);
 }
 
+/* PUSH_I_C */
+AUTO_OP push_i_c {
+  Parrot_push_i_c(interpreter);
+}
+
+/* PUSH_N_C */
+AUTO_OP push_n_c {
+  Parrot_push_n_c(interpreter);
+}
+
+/* PUSH_S_C */
+AUTO_OP push_s_c {
+  Parrot_push_s_c(interpreter);
+}
+
+/* PUSH_P_C */
+AUTO_OP push_p_c {
+  Parrot_push_p_c(interpreter);
+}
+
 /* POP_I */
 AUTO_OP pop_i {
   Parrot_pop_i(interpreter);
Index: opcheck.pl
===================================================================
RCS file: /home/perlcvs/parrot/opcheck.pl,v
retrieving revision 1.1
diff -u -r1.1 opcheck.pl
--- opcheck.pl  2001/09/17 12:29:41     1.1
+++ opcheck.pl  2001/10/08 14:52:17
@@ -66,6 +66,11 @@
   push_n => 1,
   push_p => 1,
   push_s => 1,
+
+  push_i_c => 1,
+  push_n_c => 1,
+  push_p_c => 1,
+  push_s_c => 1,
 );
 
 my $error_count;
Index: opcode_table
===================================================================
RCS file: /home/perlcvs/parrot/opcode_table,v
retrieving revision 1.23
diff -u -r1.23 opcode_table
--- opcode_table        2001/10/07 15:27:42     1.23
+++ opcode_table        2001/10/08 14:52:18
@@ -120,6 +120,10 @@
 push_s 0
 push_n 0
 push_p 0
+push_i_c       0
+push_s_c       0
+push_n_c       0
+push_p_c       0
 pop_i  0
 pop_s  0
 pop_n  0
Index: register.c
===================================================================
RCS file: /home/perlcvs/parrot/register.c,v
retrieving revision 1.10
diff -u -r1.10 register.c
--- register.c  2001/10/02 14:01:30     1.10
+++ register.c  2001/10/08 14:52:18
@@ -38,6 +38,21 @@
     }
 }
 
+/*=for api register Parrot_push_i_c
+  pushes a new integer register frame on the frame stack,
+  'preserving' the register contents.
+*/
+void
+Parrot_push_i_c(struct Parrot_Interp *interpreter) {
+    INTVAL *current_set = interpreter->int_reg->registers;
+    
+    Parrot_push_i(interpreter);
+    
+    mem_sys_memcopy(interpreter->int_reg->registers, current_set,
+                    sizeof(INTVAL) * NUM_REGISTERS);
+    
+}
+
 /*=for api register Parrot_pop_i
   pops an integer register frame off of the frame stack
 */
@@ -107,6 +122,21 @@
     }
 }
 
+/*=for api register Parrot_push_s_c
+  pushes a new integer register frame on the frame stack,
+  'preserving' the register contents.
+*/
+void
+Parrot_push_s_c(struct Parrot_Interp *interpreter) {
+    STRING **current_set = interpreter->string_reg->registers;
+    
+    Parrot_push_s(interpreter);
+    
+    mem_sys_memcopy(interpreter->string_reg->registers, current_set,
+                    sizeof(STRING *) * NUM_REGISTERS);
+    
+}
+
 /*=for api register Parrot_pop_s
   pops a string register frame off of the frame stack
 */
@@ -173,6 +203,21 @@
     }
 }
 
+/*=for api register Parrot_push_n_c
+  pushes a new integer register frame on the frame stack,
+  'preserving' the register contents.
+*/
+void
+Parrot_push_n_c(struct Parrot_Interp *interpreter) {
+    FLOATVAL *current_set = interpreter->num_reg->registers;
+    
+    Parrot_push_n(interpreter);
+    
+    mem_sys_memcopy(interpreter->num_reg->registers, current_set,
+                    sizeof(FLOATVAL) * NUM_REGISTERS);
+    
+}
+
 /*=for api register Parrot_pop_n
   pops a numeric register frame off of the frame stack
 */
@@ -241,6 +286,20 @@
     }
 }
 
+/*=for api register Parrot_push_p_c
+  pushes a new integer register frame on the frame stack,
+  'preserving' the register contents.
+*/
+void
+Parrot_push_p_c(struct Parrot_Interp *interpreter) {
+    PMC **current_set = interpreter->pmc_reg->registers;
+    
+    Parrot_push_p(interpreter);
+    
+    mem_sys_memcopy(interpreter->pmc_reg->registers, current_set,
+                    sizeof(PMC *) * NUM_REGISTERS);
+    
+}
 /*=for api register Parrot_pop_p
   pops a pmc register frame off of the frame stack
 */
Index: include/parrot/register.h
===================================================================
RCS file: /home/perlcvs/parrot/include/parrot/register.h,v
retrieving revision 1.6
diff -u -r1.6 register.h
--- include/parrot/register.h   2001/10/06 01:04:47     1.6
+++ include/parrot/register.h   2001/10/08 14:52:19
@@ -77,6 +77,11 @@
 void Parrot_push_s(struct Parrot_Interp *);
 void Parrot_push_p(struct Parrot_Interp *);
 
+void Parrot_push_i_c(struct Parrot_Interp *);
+void Parrot_push_n_c(struct Parrot_Interp *);
+void Parrot_push_s_c(struct Parrot_Interp *);
+void Parrot_push_p_c(struct Parrot_Interp *);
+
 void Parrot_pop_i(struct Parrot_Interp *);
 void Parrot_pop_n(struct Parrot_Interp *);
 void Parrot_pop_s(struct Parrot_Interp *);
Index: t/op/stacks.t
===================================================================
RCS file: /home/perlcvs/parrot/t/op/stacks.t,v
retrieving revision 1.2
diff -u -r1.2 stacks.t
--- t/op/stacks.t       2001/09/26 18:13:50     1.2
+++ t/op/stacks.t       2001/10/08 16:08:32
@@ -10,12 +10,12 @@

 use Parrot::Test tests => 9;

-output_is( <<"CODE", <<'OUTPUT', "push_i & pop_i" );
+output_is( <<"CODE", <<'OUTPUT', "push_i, save_i, & pop_i" );
 @{[ set_int_regs( sub { $_[0]} )]}
        push_i
 @{[ set_int_regs( sub {-$_[0]} )]}
 @{[ print_int_regs() ]}
-       pop_i
+    pop_i
 @{[ print_int_regs() ]}
        end
 CODE
@@ -35,7 +35,6 @@
 3031
 OUTPUT

-SKIP: {skip("push_i_c not implemented",1);
 output_is(<<"CODE", <<'OUTPUT', "push_i_c & pop_i");
 @{[ set_int_regs( sub {$_[0]}) ]}
        push_i_c
@@ -68,7 +67,7 @@
 2526272829
 3031
 OUTPUT
-}
+
 
 output_is(<<"CODE", <<'OUTPUT', 'push_s & pop_s');
 @{[ set_str_regs( sub {$_[0]%2} ) ]}
@@ -85,7 +84,6 @@
 01010101010101010101010101010101
 OUTPUT
 
-SKIP: {skip("push_s_c not implemented", 1);
 output_is(<<"CODE", <<'OUTPUT', 'push_s_c & pop_s');
 @{[ set_str_regs( sub {$_[0]%2} ) ]}
        push_s_c
@@ -103,8 +101,8 @@
 10101010101010101010101010101010
 01010101010101010101010101010101
 OUTPUT
-}
 
+
 output_is(<<"CODE", <<'OUTPUT', 'push_n & pop_n');
 @{[ set_num_regs( sub { "1.0".$_ } ) ]}
        push_n
@@ -122,7 +120,6 @@
 Seem to have positive Nx after pop
 OUTPUT
 
-SKIP: { skip("push_n_c not yet implemented",1);
 output_is(<<"CODE", <<'OUTPUT', 'push_n_c & pop_n');
 @{[ set_num_regs( sub { "1.0".$_ } ) ]}
        push_n_c
@@ -142,7 +139,7 @@
 Seem to have negative Nx
 Seem to have positive Nx after pop
 OUTPUT
-}
+
 
 # Now, to make it do BAD THINGS!
 output_is(<<"CODE",'No more I register frames to pop!','ENO I frames');
 
k

Reply via email to