cvsuser 04/04/01 04:46:08
Modified: ops ops.num string.ops
t/op string.t
Log:
op isnull(in STR, labelconst INT)
Courtesy of Jens Rieks <[EMAIL PROTECTED]>
Revision Changes Path
1.33 +2 -0 parrot/ops/ops.num
Index: ops.num
===================================================================
RCS file: /cvs/public/parrot/ops/ops.num,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -w -r1.32 -r1.33
--- ops.num 26 Mar 2004 07:14:46 -0000 1.32
+++ ops.num 1 Apr 2004 12:46:04 -0000 1.33
@@ -1442,3 +1442,5 @@
mmdvtfind_p_ic_i_ic 1415
mmdvtfind_p_i_ic_ic 1416
mmdvtfind_p_ic_ic_ic 1417
+isnull_s_ic 1418
+isnull_sc_ic 1419
1.19 +13 -0 parrot/ops/string.ops
Index: string.ops
===================================================================
RCS file: /cvs/public/parrot/ops/string.ops,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -w -r1.18 -r1.19
--- string.ops 26 Mar 2004 18:14:19 -0000 1.18
+++ string.ops 1 Apr 2004 12:46:04 -0000 1.19
@@ -696,6 +696,19 @@
goto NEXT();
}
+=item B<isnull>(in STR, labelconst INT)
+
+Branch to $2 if $1 is a NULL string.
+
+=cut
+
+op isnull(in STR, labelconst INT) :base_core {
+ if ($1 == NULL) {
+ goto OFFSET($2);
+ }
+ goto NEXT();
+}
+
=back
=head1 COPYRIGHT
1.70 +17 -2 parrot/t/op/string.t
Index: string.t
===================================================================
RCS file: /cvs/public/parrot/t/op/string.t,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -w -r1.69 -r1.70
--- string.t 27 Mar 2004 08:00:02 -0000 1.69
+++ string.t 1 Apr 2004 12:46:08 -0000 1.70
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: string.t,v 1.69 2004/03/27 08:00:02 leo Exp $
+# $Id: string.t,v 1.70 2004/04/01 12:46:08 leo Exp $
=head1 NAME
@@ -16,7 +16,7 @@
=cut
-use Parrot::Test tests => 130;
+use Parrot::Test tests => 131;
use Test::More;
output_is( <<'CODE', <<OUTPUT, "set_s_s|sc" );
@@ -2397,6 +2397,21 @@
ok 2
ok 3
ok 4
+OUTPUT
+
+output_is( <<'CODE', <<OUTPUT, "isnull_sc_ic");
+ set S0, "foo"
+ isnull S0, ERROR
+ print "ok 1\n"
+ null S0
+ isnull S0, OK
+ERROR: print "error\n"
+ end
+OK: print "ok 2\n"
+ end
+CODE
+ok 1
+ok 2
OUTPUT
1;