[svn:parrot] r43835 - in branches/vtable_massacre: docs docs/pdds src src/pmc tools/dev
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Tue Feb 9 23:08:20 UTC 2010
Author: darbelo
Date: Tue Feb 9 23:08:18 2010
New Revision: 43835
URL: https://trac.parrot.org/parrot/changeset/43835
Log:
Remove the get_bignum() VTABLE.
Modified:
branches/vtable_massacre/docs/embed.pod
branches/vtable_massacre/docs/pdds/pdd17_pmc.pod
branches/vtable_massacre/docs/pdds/pdd28_strings.pod
branches/vtable_massacre/src/pmc/bigint.pmc
branches/vtable_massacre/src/pmc/bignum.pmc
branches/vtable_massacre/src/pmc/integer.pmc
branches/vtable_massacre/src/pmc/string.pmc
branches/vtable_massacre/src/vtable.tbl
branches/vtable_massacre/tools/dev/vtablize.pl
Modified: branches/vtable_massacre/docs/embed.pod
==============================================================================
--- branches/vtable_massacre/docs/embed.pod Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/docs/embed.pod Tue Feb 9 23:08:18 2010 (r43835)
@@ -1163,8 +1163,6 @@
=item C<Parrot_PMC_get_attr_str>
-=item C<Parrot_PMC_get_bignum>
-
=item C<Parrot_PMC_get_bool>
=item C<Parrot_PMC_get_class>
Modified: branches/vtable_massacre/docs/pdds/pdd17_pmc.pod
==============================================================================
--- branches/vtable_massacre/docs/pdds/pdd17_pmc.pod Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/docs/pdds/pdd17_pmc.pod Tue Feb 9 23:08:18 2010 (r43835)
@@ -628,12 +628,6 @@
Return the native floating-point value of the PMC.
-=item get_bignum
-
- PMC* get_bignum(INTERP, PMC *self)
-
-Return the extended precision numeric value of the PMC as a new bignum PMC.
-
=item get_string
STRING* get_string(INTERP, PMC *self)
Modified: branches/vtable_massacre/docs/pdds/pdd28_strings.pod
==============================================================================
--- branches/vtable_massacre/docs/pdds/pdd28_strings.pod Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/docs/pdds/pdd28_strings.pod Tue Feb 9 23:08:18 2010 (r43835)
@@ -666,10 +666,6 @@
Return the floating-point representation of the string.
-=item get_bignum
-
-Return the big number representation of the string.
-
=item get_string
Return the string value of the String PMC.
Modified: branches/vtable_massacre/src/pmc/bigint.pmc
==============================================================================
--- branches/vtable_massacre/src/pmc/bigint.pmc Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/src/pmc/bigint.pmc Tue Feb 9 23:08:18 2010 (r43835)
@@ -701,20 +701,6 @@
/*
-=item C<PMC *get_bignum()>
-
-Returns SELF
-
-=cut
-
-*/
-
- VTABLE PMC *get_bignum() {
- return SELF;
- }
-
-/*
-
=item C<INTVAL get_bool()>
Returns the boolean value of the integer.
Modified: branches/vtable_massacre/src/pmc/bignum.pmc
==============================================================================
--- branches/vtable_massacre/src/pmc/bignum.pmc Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/src/pmc/bignum.pmc Tue Feb 9 23:08:18 2010 (r43835)
@@ -929,20 +929,6 @@
/*
-=item C<PMC *get_bignum()>
-
-Returns SELF, keeping floating point precision.
-
-=cut
-
-*/
-
- VTABLE PMC *get_bignum() {
- return SELF;
- }
-
-/*
-
=item C<FLOATVAL get_bigint()>
Trunc the BigNum to an BigInt.
Modified: branches/vtable_massacre/src/pmc/integer.pmc
==============================================================================
--- branches/vtable_massacre/src/pmc/integer.pmc Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/src/pmc/integer.pmc Tue Feb 9 23:08:18 2010 (r43835)
@@ -179,24 +179,6 @@
/*
-=item C<PMC *get_bignum()>
-
-Return a new BigInt PMC with the value of C<SELF>.
-
-=cut
-
-*/
-
- VTABLE PMC *get_bignum() {
- const INTVAL val = SELF.get_integer();
- PMC * const ret = pmc_new(INTERP, enum_class_BigInt);
- VTABLE_set_integer_native(INTERP, ret, val);
- return ret;
- }
-
-
-/*
-
=item C<STRING *get_string()>
=item C<STRING *get_repr()>
@@ -301,7 +283,8 @@
else {
PMC * temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_add(interp, temp, value, dest);
}
}
@@ -323,7 +306,8 @@
MULTI PMC *add(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_add(interp, temp, value, dest);
}
@@ -350,7 +334,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_add_int(interp, temp, b, dest);
}
}
@@ -390,17 +375,17 @@
}
- VTABLE void i_add_int(INTVAL b) {
- const INTVAL a = SELF.get_integer();
- const INTVAL c = a + b;
-
- if ((c^a) >= 0 || (c^b) >= 0)
- VTABLE_set_integer_native(INTERP, SELF, c);
- else {
- PMC *temp;
+ VTABLE void i_add_int(INTVAL b) { //
+ const INTVAL a = SELF.get_integer(); //
+ const INTVAL c = a + b; //
+
+ if ((c^a) >= 0 || (c^b) >= 0) //
+ VTABLE_set_integer_native(INTERP, SELF, c); //
+ else { //
+ PMC *temp; //
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
- VTABLE_i_add_int(interp, temp, b);
+ SELF = upgrade_self_to_bignum(interp, SELF);
+ VTABLE_i_add_int(interp, SELF, b);
}
}
@@ -439,7 +424,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_subtract(interp, temp, value, dest);
}
}
@@ -461,7 +447,8 @@
MULTI PMC *subtract(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_subtract(interp, temp, value, dest);
}
@@ -498,7 +485,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(interp);
- temp = VTABLE_get_bignum(interp, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_subtract_int(interp, temp, b, dest);
}
}
@@ -597,7 +585,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_multiply(INTERP, temp, value, dest);
}
}
@@ -641,7 +630,8 @@
else {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_multiply_int(INTERP, temp, b, dest);
}
}
@@ -727,7 +717,8 @@
MULTI PMC *divide(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_divide(INTERP, temp, value, dest);
}
@@ -787,7 +778,8 @@
MULTI PMC *floor_divide(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_floor_divide(INTERP, temp, value, dest);
}
@@ -909,7 +901,8 @@
MULTI PMC *modulus(BigInt value, PMC *dest) {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, SELF.get_integer());
return VTABLE_modulus(INTERP, temp, value, dest);
}
@@ -1045,7 +1038,8 @@
if (r / temp != prev) {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_pow_int(INTERP, temp, orig_b, dest);
}
}
@@ -1060,7 +1054,8 @@
if (prev != 0 && temp / prev != prev) {
PMC *temp;
maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
+ temp = pmc_new(interp, enum_class_BigInt);
+ VTABLE_set_integer_native(interp, temp, a);
return VTABLE_pow_int(INTERP, temp, orig_b, dest);
}
}
Modified: branches/vtable_massacre/src/pmc/string.pmc
==============================================================================
--- branches/vtable_massacre/src/pmc/string.pmc Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/src/pmc/string.pmc Tue Feb 9 23:08:18 2010 (r43835)
@@ -108,23 +108,6 @@
/*
-=item C<PMC *get_bignum()>
-
-Returns the big numbers representation of the string.
-
-=cut
-
-*/
-
- VTABLE PMC *get_bignum() {
- STRING * const s = SELF.get_string();
- PMC * const ret = pmc_new(INTERP, enum_class_BigInt);
- VTABLE_set_string_native(INTERP, ret, s);
- return ret;
- }
-
-/*
-
=item C<STRING *get_string()>
Returns the string itself.
Modified: branches/vtable_massacre/src/vtable.tbl
==============================================================================
--- branches/vtable_massacre/src/vtable.tbl Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/src/vtable.tbl Tue Feb 9 23:08:18 2010 (r43835)
@@ -41,8 +41,6 @@
FLOATVAL get_number_keyed_int(INTVAL key)
FLOATVAL get_number_keyed_str(STRING* key)
-PMC* get_bignum()
-
STRING* get_string()
STRING* get_repr()
STRING* get_string_keyed(PMC* key)
Modified: branches/vtable_massacre/tools/dev/vtablize.pl
==============================================================================
--- branches/vtable_massacre/tools/dev/vtablize.pl Tue Feb 9 22:59:20 2010 (r43834)
+++ branches/vtable_massacre/tools/dev/vtablize.pl Tue Feb 9 23:08:18 2010 (r43835)
@@ -63,7 +63,6 @@
s/^(\s*)(PMC\s+\*get_pmc_keyed\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(PMC\s+\*get_pmc_keyed_int\(INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(PMC\s+\*get_pmc_keyed_str\(STRING\s+\*\w*\)\s+{)/$1VTABLE $2/;
-s/^(\s*)(PMC\s+\*get_bignum\(\)\s+{)/$1VTABLE $2/;
s/^(\s*)(PMC\s+\*slice\(PMC\s+\*\w*,\s+INTVAL\s+\w*\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+\*get_pointer\(\)\s+{)/$1VTABLE $2/;
s/^(\s*)(void\s+\*get_pointer_keyed\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
More information about the parrot-commits
mailing list