[svn:parrot] r49514 - trunk/src

nwellnhof at svn.parrot.org nwellnhof at svn.parrot.org
Mon Oct 11 18:53:47 UTC 2010


Author: nwellnhof
Date: Mon Oct 11 18:53:46 2010
New Revision: 49514
URL: https://trac.parrot.org/parrot/changeset/49514

Log:
[src] Show string encoding in pbc_dump and pbc_disassemble

Modified:
   trunk/src/debug.c
   trunk/src/packdump.c

Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c	Mon Oct 11 18:40:23 2010	(r49513)
+++ trunk/src/debug.c	Mon Oct 11 18:53:46 2010	(r49514)
@@ -2350,12 +2350,19 @@
           case PARROT_ARG_SC:
             {
                 const STRING *s = interp->code->const_table->str.constants[op[j]];
+
+                if (s->encoding != Parrot_ascii_encoding_ptr) {
+                    strcpy(&dest[size], s->encoding->name);
+                    size += strlen(s->encoding->name);
+                    dest[size++] = ':';
+                }
+
                 dest[size++] = '"';
                 if (s->strlen) {
                     char * const unescaped =
                         Parrot_str_to_cstring(interp, s);
                     char * const escaped =
-                        PDB_escape(interp, unescaped, s->strlen);
+                        PDB_escape(interp, unescaped, s->bufused);
                     if (escaped) {
                         strcpy(&dest[size], escaped);
                         size += strlen(escaped);

Modified: trunk/src/packdump.c
==============================================================================
--- trunk/src/packdump.c	Mon Oct 11 18:40:23 2010	(r49513)
+++ trunk/src/packdump.c	Mon Oct 11 18:53:46 2010	(r49514)
@@ -193,7 +193,7 @@
 
     Parrot_io_printf(interp, "    [ 'PFC_STRING', {\n");
     pobj_flag_dump(interp, (long)PObj_get_FLAGS(self));
-    Parrot_io_printf(interp, "        ENCODING => %ld,\n", self->encoding);
+    Parrot_io_printf(interp, "        ENCODING => %s,\n", self->encoding->name);
     Parrot_io_printf(interp, "        SIZE     => %ld,\n", self->bufused);
     Parrot_io_printf(interp, "        DATA     => \"%Ss\"\n",
             Parrot_str_escape(interp, self));


More information about the parrot-commits mailing list