develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34676 - trunk/src/pmc

From:
chromatic
Date:
December 30, 2008 14:19
Subject:
[svn:parrot] r34676 - trunk/src/pmc
Message ID:
20081230221945.9B5A7CB9FA@x12.develooper.com
Author: chromatic
Date: Tue Dec 30 14:19:44 2008
New Revision: 34676

Modified:
   trunk/src/pmc/default.pmc
   trunk/src/pmc/stringhandle.pmc

Log:
[PMC] Added "mro" as an inspectable attribute of PMCs (inherited from default
PMC now; overriders may need to work on this).  See RT #47976.

Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc	(original)
+++ trunk/src/pmc/default.pmc	Tue Dec 30 14:19:44 2008
@@ -946,6 +946,9 @@
                     (INTVAL)PObj_get_FLAGS(SELF));
             return found;
         }
+        else if (string_equal(interp, name, CONST_STRING(interp, "mro")) == 0) {
+            return VTABLE_clone(interp, SELF->vtable->mro);
+        }
         else
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
                 "Unknown introspection value '%S'", name);

Modified: trunk/src/pmc/stringhandle.pmc
==============================================================================
--- trunk/src/pmc/stringhandle.pmc	(original)
+++ trunk/src/pmc/stringhandle.pmc	Tue Dec 30 14:19:44 2008
@@ -171,8 +171,8 @@
         GET_ATTR_stringhandle(INTERP, SELF, old_string);
         if (STRING_IS_NULL(old_string)) {
             GET_ATTR_encoding(INTERP, SELF, encoding);
-            if (!STRING_IS_NULL(encoding) &&
-                    string_equal(INTERP, encoding, const_string(INTERP, "utf8")) == 0)
+            if (!STRING_IS_NULL(encoding)
+            &&  string_equal(INTERP, encoding, CONST_STRING(INTERP, "utf8")) == 0)
                 new_string = string_make(INTERP, "", 0, "unicode", 0);
             else
                 new_string = string_from_cstring(INTERP, "", 0);
@@ -305,8 +305,7 @@
 
         orig_length = string_length(INTERP, string_result);
         GET_ATTR_read_offset(INTERP, SELF, offset);
-        newline_pos = string_str_index(INTERP, string_result,
-                const_string(INTERP, "\n"), offset);
+        newline_pos = string_str_index(INTERP, string_result, CONST_STRING(INTERP, "\n"), offset);
 
         /* No newline found, read the rest of the string. */
         if (newline_pos == -1)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About