[svn:parrot] r42276 - trunk/src/pmc
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Thu Nov 5 22:08:52 UTC 2009
Author: darbelo
Date: Thu Nov 5 22:08:52 2009
New Revision: 42276
URL: https://trac.parrot.org/parrot/changeset/42276
Log:
Remove the now unused instantiate_str() VTABLE from all four PMC that implemented it.
Modified:
trunk/src/pmc/fixedintegerarray.pmc
trunk/src/pmc/float.pmc
trunk/src/pmc/integer.pmc
trunk/src/pmc/string.pmc
Modified: trunk/src/pmc/fixedintegerarray.pmc
==============================================================================
--- trunk/src/pmc/fixedintegerarray.pmc Thu Nov 5 22:07:43 2009 (r42275)
+++ trunk/src/pmc/fixedintegerarray.pmc Thu Nov 5 22:08:52 2009 (r42276)
@@ -45,99 +45,6 @@
/*
-=item C<PMC instantiate_str(STRING *rep, INTVAL flags)>
-
-Class method to construct an array from the string representation C<rep>,
-which is a string I<"(el0, el1, ...)">. C<flags> may have the
-C<PObj_constant_FLAG> bit set, which will be honored to create a PMC
-in the constant PMC pool.
-
-=cut
-
-*/
- VTABLE PMC *instantiate_str(STRING *rep, INTVAL flags) {
- const INTVAL type = SELF->vtable->base_type;
- INTVAL n, elem, i, l;
- char *source, *p, *start;
- int base;
-
- if (flags & PObj_constant_FLAG)
- SELF = constant_pmc_new(INTERP, type);
- else
- SELF = pmc_new(INTERP, type);
-
- l = Parrot_str_byte_length(INTERP, rep);
-
- if (!l)
- return SELF;
-
- if (rep->encoding != Parrot_fixed_8_encoding_ptr)
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_ENCODING,
- "unhandled string encoding in constructor");
-
- source = Parrot_str_to_cstring(interp, rep);
-
- /* "()" - no args */
- if (l <= 2 && *source == '(') {
- Parrot_str_free_cstring(source);
- return SELF;
- }
-
- /* count commas */
- p = source;
- n = 0;
- while (*p) {
- if (*p == ',')
- ++n;
- p++;
- }
-
- /* presize the array */
- SELF.set_integer_native(n + 1);
-
- /* parse string */
- p = source;
-
- for (i = l, n = 0; i; --i, ++p) {
- switch (*p) {
- case ' ': continue;
- case '\t': continue;
- case '(': continue;
- case ')': break;
- case ',':
- n++;
- break;
- default:
- base = 10;
- if (*p == '0') {
- ++p;
- --i;
- if (*p == 'b' || *p == 'B') {
- base = 2;
- ++p;
- --i;
- }
- else if (*p == 'x' || *p == 'X') {
- base = 16;
- ++p;
- --i;
- }
- }
- start = p;
- elem = strtoul(p, &p, base);
- --p;
- i -= (p - start);
- SELF.set_integer_keyed_int(n, elem);
- break;
- }
- }
-
- Parrot_str_free_cstring(source);
- return SELF;
- }
-
-/*
-
=item C<void destroy()>
Destroys the array.
Modified: trunk/src/pmc/float.pmc
==============================================================================
--- trunk/src/pmc/float.pmc Thu Nov 5 22:07:43 2009 (r42275)
+++ trunk/src/pmc/float.pmc Thu Nov 5 22:08:52 2009 (r42276)
@@ -55,26 +55,6 @@
/*
-=item C<PMC *instantiate_str(STRING *rep, INTVAL flags)>
-
-Class method to construct an Integer from the string representation C<rep>.
-
-=cut
-
-*/
- VTABLE PMC *instantiate_str(STRING *rep, INTVAL flags) {
- const INTVAL type = SELF->vtable->base_type;
- PMC * const res =
- (flags & PObj_constant_FLAG)
- ? constant_pmc_new(INTERP, type)
- : pmc_new(INTERP, type);
-
- SET_ATTR_fv(INTERP, res, Parrot_str_to_num(INTERP, rep));
- return res;
- }
-
-/*
-
=item C<FLOATVAL get_number()>
Returns the value of the number.
Modified: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc Thu Nov 5 22:07:43 2009 (r42275)
+++ trunk/src/pmc/integer.pmc Thu Nov 5 22:08:52 2009 (r42276)
@@ -91,29 +91,6 @@
/*
-=item C<PMC instantiate_str(STRING *rep)>
-
-Class method to construct an Integer from the string representation C<rep>.
-
-=cut
-
-*/
-
- VTABLE PMC *instantiate_str(STRING *rep, INTVAL flags) {
- const INTVAL type = SELF->vtable->base_type;
- PMC * const res = (flags & PObj_constant_FLAG)
- ? constant_pmc_new(INTERP, type)
- : pmc_new(INTERP, type);
-
- /* Parrot_str_to_int catches overflow automatically, so we don't need to
- worry about it here. */
- VTABLE_set_integer_native(INTERP, res, Parrot_str_to_int(INTERP, rep));
- return res;
- }
-
-
-/*
-
=item C<void set_pmc(PMC *value)>
Sets the value of the integer to the value in C<*value>.
Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc Thu Nov 5 22:07:43 2009 (r42275)
+++ trunk/src/pmc/string.pmc Thu Nov 5 22:08:52 2009 (r42276)
@@ -42,28 +42,6 @@
/*
-=item C<PMC instantiate_str(STRING *rep)>
-
-Class method to construct a String from the string representation C<rep>.
-
-=cut
-
-*/
- VTABLE PMC *instantiate_str(STRING *rep, INTVAL flags) {
- PMC *res;
- const INTVAL type = SELF->vtable->base_type;
-
- if (flags & PObj_constant_FLAG)
- res = constant_pmc_new(INTERP, type);
- else
- res = pmc_new(INTERP, type);
-
- SET_ATTR_str_val(INTERP, res, rep);
- return res;
- }
-
-/*
-
=item C<void mark()>
Marks the string as live.
More information about the parrot-commits
mailing list