cvsuser 03/07/06 02:24:15
Modified: classes perlstring.pmc perlundef.pmc
t/pmc perlint.t perlstring.t
Log:
fix some perlstring and perlundef methods
Revision Changes Path
1.41 +7 -1 parrot/classes/perlstring.pmc
Index: perlstring.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlstring.pmc,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -w -r1.40 -r1.41
--- perlstring.pmc 14 Jun 2003 12:40:33 -0000 1.40
+++ perlstring.pmc 6 Jul 2003 09:24:10 -0000 1.41
@@ -1,7 +1,7 @@
/* perlstring.pmc
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: perlstring.pmc,v 1.40 2003/06/14 12:40:33 leo Exp $
+ * $Id: perlstring.pmc,v 1.41 2003/07/06 09:24:10 leo Exp $
* Overview:
* These are the vtable functions for the PerlString base class
* Data Structure and Algorithms:
@@ -290,6 +290,7 @@
void concatenate (PMC* value, PMC* dest) {
STRING* s = string_copy(INTERP, (STRING*)SELF->cache.string_val);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
dest->cache.string_val =
string_concat(INTERP,
s,
@@ -301,6 +302,7 @@
void concatenate_native (STRING* value, PMC* dest) {
STRING* s = string_copy(INTERP, (STRING*)SELF->cache.string_val);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
dest->cache.string_val =
string_concat(INTERP,
s,
@@ -311,6 +313,7 @@
}
void concatenate_same (PMC* value, PMC* dest) {
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
dest->cache.string_val =
string_concat(INTERP,
SELF->cache.string_val,
@@ -334,6 +337,7 @@
void repeat (PMC* value, PMC* dest) {
DYNSELF.morph(enum_class_PerlString);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
dest->cache.string_val =
string_repeat(INTERP, SELF->cache.string_val,
(UINTVAL)VTABLE_get_integer(INTERP, value), NULL
@@ -342,6 +346,7 @@
void repeat_int (INTVAL value, PMC* dest) {
DYNSELF.morph(enum_class_PerlString);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
dest->cache.string_val = string_repeat(INTERP, SELF->cache.string_val,
(UINTVAL)value, NULL);
}
@@ -355,6 +360,7 @@
void substr (INTVAL offset, INTVAL length, PMC* dest) {
DYNSELF.morph(enum_class_PerlString);
+ VTABLE_morph(INTERP, dest, enum_class_PerlString);
dest->cache.string_val = string_substr(INTERP,
SELF->cache.string_val, offset, length, NULL, 0);
}
1.27 +13 -1 parrot/classes/perlundef.pmc
Index: perlundef.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlundef.pmc,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -r1.26 -r1.27
--- perlundef.pmc 19 May 2003 14:33:36 -0000 1.26
+++ perlundef.pmc 6 Jul 2003 09:24:10 -0000 1.27
@@ -1,7 +1,7 @@
/* perlundef.pmc
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: perlundef.pmc,v 1.26 2003/05/19 14:33:36 leo Exp $
+ * $Id: perlundef.pmc,v 1.27 2003/07/06 09:24:10 leo Exp $
* Overview:
* These are the vtable functions for the perlundef base class
* Data Structure and Algorithms:
@@ -391,4 +391,16 @@
INTVAL defined () {
return 0;
}
+ void increment () {
+ DYNSELF.morph(enum_class_PerlInt);
+ SELF->cache.int_val = 1;
+ }
+
+
+ void decrement () {
+ DYNSELF.morph(enum_class_PerlInt);
+ SELF->cache.int_val = -1;
+ }
+
+
}
1.4 +19 -1 parrot/t/pmc/perlint.t
Index: perlint.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/perlint.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- perlint.t 14 Apr 2003 06:56:44 -0000 1.3
+++ perlint.t 6 Jul 2003 09:24:15 -0000 1.4
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 5;
+use Parrot::Test tests => 6;
use Parrot::PMC '%pmc_types';
my $perlint = $pmc_types{'PerlInt'};
my $ok = '"ok 1\n"';
@@ -150,3 +150,21 @@
12
100
OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "inc/dec a PerlUndef");
+ new P0, .PerlUndef
+ new P1, .PerlUndef
+ inc P0
+ print P0
+ inc P0
+ print P0
+ dec P1
+ print P1
+ dec P1
+ print P1
+ print "\n"
+ end
+CODE
+12-1-2
+OUTPUT
+
1.8 +16 -1 parrot/t/pmc/perlstring.t
Index: perlstring.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/perlstring.t,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- perlstring.t 21 May 2003 13:11:23 -0000 1.7
+++ perlstring.t 6 Jul 2003 09:24:15 -0000 1.8
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 13;
+use Parrot::Test tests => 14;
use Test::More; # Included for skip().
my $fp_equality_macro = <<'ENDOFMACRO';
@@ -426,4 +426,19 @@
25.500000
OUTPUT
+output_is(<<'CODE', <<OUTPUT, "concat must morph dest to a string");
+ new P0, .PerlString
+ new P1, .PerlUndef
+ set P0, "foo"
+ concat P1, P0, P0
+
+ print P0
+ print "\n"
+ print P1
+ print "\n"
+ end
+CODE
+foo
+foofoo
+OUTPUT
1;