cvsuser 01/09/17 16:35:53
Modified: . basic_opcodes.ops opcode_table
docs parrot_assembly.pod
t/op string.t
Log:
New concat op. Hey, if I'm going to talk about it in an article, better
implement it...
Revision Changes Path
1.19 +5 -0 parrot/basic_opcodes.ops
Index: basic_opcodes.ops
===================================================================
RCS file: /home/perlcvs/parrot/basic_opcodes.ops,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -w -r1.18 -r1.19
--- basic_opcodes.ops 2001/09/16 16:33:03 1.18
+++ basic_opcodes.ops 2001/09/17 23:35:53 1.19
@@ -351,6 +351,11 @@
STR_REG(P1) = s;
}
+AUTO_OP concat_s {
+ STRING *s = string_concat(STR_REG(P1), STR_REG(P2), 1);
+ STR_REG(P1) = s;
+}
+
/* NOOP */
AUTO_OP noop {
}
1.17 +2 -1 parrot/opcode_table
Index: opcode_table
===================================================================
RCS file: /home/perlcvs/parrot/opcode_table,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -r1.16 -r1.17
--- opcode_table 2001/09/17 18:53:29 1.16
+++ opcode_table 2001/09/17 23:35:53 1.17
@@ -19,7 +19,7 @@
# S String register
# D Destination
#
-# $Id: opcode_table,v 1.16 2001/09/17 18:53:29 gregor Exp $
+# $Id: opcode_table,v 1.17 2001/09/17 23:35:53 mon Exp $
#
@@ -61,6 +61,7 @@
length_i_s 2 I S
chopn_s_ic 2 S i
substr_s_s_i 4 S S I I
+concat_s 2 S S
# Comparators
1.3 +8 -0 parrot/docs/parrot_assembly.pod
Index: parrot_assembly.pod
===================================================================
RCS file: /home/perlcvs/parrot/docs/parrot_assembly.pod,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- parrot_assembly.pod 2001/09/13 16:20:49 1.2
+++ parrot_assembly.pod 2001/09/17 23:35:53 1.3
@@ -246,6 +246,14 @@
Decrement register x by nn. nn is an integer constant. If nn is
omitted, decrement by 1.
+=item length Ix, Sy
+
+Put the length of string y into integer register x.
+
+=item concat Sx, Sy
+
+Add string y to the end of string x.
+
=back
=head2 Transcendental operations
1.2 +12 -1 parrot/t/op/string.t
Index: string.t
===================================================================
RCS file: /home/perlcvs/parrot/t/op/string.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- string.t 2001/09/16 16:21:17 1.1
+++ string.t 2001/09/17 23:35:53 1.2
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 4;
+use Parrot::Test tests => 5;
output_is( <<'CODE', <<OUTPUT, "set_s_sc" );
set S4, "JAPH\n"
@@ -46,3 +46,14 @@
end
CODE
}
+
+output_is( <<'CODE', <<OUTPUT, "concat" );
+ set S1, "fish"
+ set S2, "bone"
+ concat S1, S2
+ print S1
+ set S2, "\n"
+ print S2
+CODE
+fishbone
+OUTPUT