simon 01/09/10 03:01:16
Modified: . opcode_table basic_opcodes.ops
Log:
String ops.
Revision Changes Path
1.4 +7 -0 parrot/opcode_table
Index: opcode_table
===================================================================
RCS file: /home/perlcvs/parrot/opcode_table,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- opcode_table 2001/09/07 15:23:39 1.3
+++ opcode_table 2001/09/10 10:01:10 1.4
@@ -33,6 +33,12 @@
27 dec_n 1 i
28 dec_n_nc 2 i n
+# String ops
+
+31 set_s_sc 2 i i
+33 length_s_i 2 i i
+34 chopn_s_ic 2 i i
+
# Comparators
2 eq_i_ic 4 i i i i
@@ -57,3 +63,4 @@
4 print_i 1 i
22 time_n 1 i
23 print_n 1 i
+32 print_s 1 i
1.3 +21 -0 parrot/basic_opcodes.ops
Index: basic_opcodes.ops
===================================================================
RCS file: /home/perlcvs/parrot/basic_opcodes.ops,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- basic_opcodes.ops 2001/09/06 21:07:44 1.2
+++ basic_opcodes.ops 2001/09/10 10:01:10 1.3
@@ -188,3 +188,24 @@
number = NUM_REG(P2);
INT_REG(P1) = number;
}
+
+// SET Sx, CONSTANT
+AUTO_OP set_s_sc {
+ STR_REG(P1) = Parrot_string_constants[P2];
+}
+
+// PRINT Sx
+AUTO_OP print_s {
+ STRING *s = STR_REG(P1);
+ printf("S reg %i is %.*s\n", P1, string_length(s), s->bufstart);
+}
+
+// LEN Ix, Sx
+AUTO_OP length_s_i {
+ INT_REG(P1) = string_length(STR_REG(P2));
+}
+
+// CHOPN Sx, CONSTANT
+AUTO_OP chopn_s_ic {
+ string_chopn(STR_REG(P1), P2);
+}