cvsuser 04/08/21 02:05:49
Modified: classes perlhash.pmc
imcc pbc.c
t/op literal.t
t/pmc perlhash.t
Log:
really allow upcase B,X for bin hex
* drop negative hex and bin from literal.t
* implement get_<type>_keyed_int in PerlHash
perlhash_20 test is still failing
Revision Changes Path
1.90 +26 -1 parrot/classes/perlhash.pmc
Index: perlhash.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlhash.pmc,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -w -r1.89 -r1.90
--- perlhash.pmc 20 Aug 2004 08:41:35 -0000 1.89
+++ perlhash.pmc 21 Aug 2004 09:05:46 -0000 1.90
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: perlhash.pmc,v 1.89 2004/08/20 08:41:35 leo Exp $
+$Id: perlhash.pmc,v 1.90 2004/08/21 09:05:46 leo Exp $
=head1 NAME
@@ -314,6 +314,8 @@
=item C<INTVAL get_integer_keyed_str(STRING *key)>
+=item C<INTVAL get_integer_keyed_int(INTVAL key)>
+
=cut
*/
@@ -328,6 +330,10 @@
return VTABLE_get_integer(INTERP, (PMC*) b->value);
}
+ INTVAL get_integer_keyed_int (INTVAL key) {
+ STRING *s = string_from_int(interpreter, key);
+ return SELF.get_integer_keyed_str(s);
+ }
/*
=item C<INTVAL get_integer_keyed(PMC *key)>
@@ -376,6 +382,8 @@
=item C<FLOATVAL get_number_keyed_str(STRING *key)>
+=item C<FLOATVAL get_number_keyed_int(INTVAL key)>
+
=cut
*/
@@ -390,6 +398,10 @@
return VTABLE_get_number(INTERP, (PMC*) b->value);
}
+ FLOATVAL get_number_keyed_int (INTVAL key) {
+ STRING *s = string_from_int(interpreter, key);
+ return SELF.get_number_keyed_str(s);
+ }
/*
=item C<FLOATVAL get_number_keyed(PMC *key)>
@@ -481,6 +493,8 @@
=item C<STRING *get_string_keyed_str(STRING *key)>
+=item C<STRING *get_string_keyed_int(INTVAL key)>
+
=cut
*/
@@ -495,6 +509,10 @@
return VTABLE_get_string(INTERP, (PMC*) b->value);
}
+ STRING* get_string_keyed_int (INTVAL key) {
+ STRING *s = string_from_int(interpreter, key);
+ return SELF.get_string_keyed_str(s);
+ }
/*
=item C<STRING *get_string_keyed(PMC *key)>
@@ -567,6 +585,8 @@
=item C<PMC *get_pmc_keyed_str(STRING *key)>
+=item C<PMC *get_pmc_keyed_int(INTVAL key)>
+
=cut
*/
@@ -582,6 +602,11 @@
return b->value;
}
+ PMC* get_pmc_keyed_int (INTVAL key) {
+ STRING *s = string_from_int(interpreter, key);
+ return SELF.get_pmc_keyed_str(s);
+ }
+
/*
=item C<PMC* slice (PMC *key)>
1.88 +3 -2 parrot/imcc/pbc.c
Index: pbc.c
===================================================================
RCS file: /cvs/public/parrot/imcc/pbc.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -w -r1.87 -r1.88
--- pbc.c 1 Aug 2004 09:33:46 -0000 1.87
+++ pbc.c 21 Aug 2004 09:05:47 -0000 1.88
@@ -753,9 +753,10 @@
return;
switch (r->set) {
case 'I':
- if (r->name[0] == '0' && r->name[1] == 'x')
+ if (r->name[0] == '0' && (r->name[1] == 'x' || r->name[1] == 'X'))
r->color = strtoul(r->name+2, 0, 16);
- else if (r->name[0] == '0' && r->name[1] == 'b')
+ else if (r->name[0] == '0' &&
+ (r->name[1] == 'b' || r->name[1] == 'B'))
r->color = strtoul(r->name+2, 0, 2);
else
r->color = strtol(r->name, 0, 10);
1.2 +0 -6 parrot/t/op/literal.t
Index: literal.t
===================================================================
RCS file: /cvs/public/parrot/t/op/literal.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- literal.t 20 Aug 2004 17:09:53 -0000 1.1
+++ literal.t 21 Aug 2004 09:05:48 -0000 1.2
@@ -5,20 +5,14 @@
print "\n"
print 0X2A
print "\n"
- print -0x2a
- print "\n"
print 0b101010
print "\n"
print 0B101010
print "\n"
- print -0B101010
- print "\n"
end
CODE
42
42
--42
42
42
--42
OUTPUT
1.46 +23 -19 parrot/t/pmc/perlhash.t
Index: perlhash.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/perlhash.t,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -w -r1.45 -r1.46
--- perlhash.t 20 Aug 2004 13:39:36 -0000 1.45
+++ perlhash.t 21 Aug 2004 09:05:49 -0000 1.46
@@ -1,7 +1,7 @@
#! perl
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: perlhash.t,v 1.45 2004/08/20 13:39:36 dan Exp $
+# $Id: perlhash.t,v 1.46 2004/08/21 09:05:49 leo Exp $
=head1 NAME
@@ -696,14 +696,18 @@
new P1, .PerlHash
new P2, .PerlInt
set P2, 4
- set P1[0], P2
+ set P1[9], P2
+ set I0, P1[9]
+ print I0
+ print "\n"
set P0["a"], P1
- set I0, P0["a";0]
+ set I0, P0["a";9]
print "Four is "
print I0
print "\n"
end
CODE
+4
Four is 4
OUTPUT