Author: leo
Date: Fri Oct  7 01:09:35 2005
New Revision: 9387

Modified:
   trunk/config/init/hints/linux.pl
   trunk/imcc/pbc.c
   trunk/t/pmc/namespace.t
Log:
Fix non-ascii namespace - revert D_XOPEN_SOURCE

* fix t/pmc/namespace.t tests
* fix charset/encoding handling in pbc codegen
* revert D_XOPEN_SOURCE for linux, doesn't compile at least on linux 2.2


Modified: trunk/config/init/hints/linux.pl
==============================================================================
--- trunk/config/init/hints/linux.pl    (original)
+++ trunk/config/init/hints/linux.pl    Fri Oct  7 01:09:35 2005
@@ -26,7 +26,7 @@ else {
 
 if ( $cflags !~ /-D_XOPEN_SOURCE=/ ) {
     # Request visibility of all POSIX symbols
-    $cflags .= ' -D_XOPEN_SOURCE=600';
+    ## $cflags .= ' -D_XOPEN_SOURCE=600';
 }
 
 Configure::Data->set(

Modified: trunk/imcc/pbc.c
==============================================================================
--- trunk/imcc/pbc.c    (original)
+++ trunk/imcc/pbc.c    Fri Oct  7 01:09:35 2005
@@ -563,12 +563,18 @@ IMCC_string_from_reg(Interp *interpreter
 
     if (r->type & VT_ENCODED) {
         char *p;
+        /*
+         * the lexer parses:   foo:"string"
+         * get first part as charset, rest as string
+         */
         p = strchr(r->name, '"');
-        assert(p);
+        assert(p && p[-1] == ':');
         p[-1] = 0;
         charset = r->name;
         buf = p + 1;        /* past delim */
         s = string_unescape_cstring(interpreter, buf, '"', charset);
+        /* restore colon, as we may reuse this string */
+        p[-1] = ':';
     }
     else if (*buf == '"') {
         buf++;
@@ -934,6 +940,8 @@ add_1_const(Interp *interpreter, SymReg 
             r->color = IMCC_int_from_reg(interpreter, r);
             break;
         case 'S':
+            if (r->type & VT_CONSTP)
+                r = r->reg;
             r->color = add_const_str(interpreter, r);
             break;
         case 'N':

Modified: trunk/t/pmc/namespace.t
==============================================================================
--- trunk/t/pmc/namespace.t     (original)
+++ trunk/t/pmc/namespace.t     Fri Oct  7 01:09:35 2005
@@ -338,35 +338,34 @@ OUTPUT
 }
 
 
-pir_output_is(<<'CODE', <<'OUT', "unicode: default ns encoding is ascii");
-.namespace [ "Fran�ois" ]
+pir_output_is(<<'CODE', <<'OUT', "latin1 namespace, global");
+.namespace [ iso-8859-1:"Fran�ois" ]
 
 .sub '__init'
-       print 'unicode namespaces are fun'
+       print "latin1 namespaces are fun\n"
 .end
 
 .namespace [ "" ]
 
 .sub 'main' :main
-       $P0 = find_global 'Fran�ois', '__init'
+       $P0 = find_global iso-8859-1:"Fran�ois", '__init'
        $P0()
 .end
 CODE
-Malformed string
+latin1 namespaces are fun
 OUT
 
-
-pir_output_is(<<'CODE', <<'OUT', "unicode: accepts namespaces with encoding", 
todo => 'as yet unimplemented');
-.namespace [ unicode:"Fran�ois" ]
+pir_output_is(<<'CODE', <<'OUT', "unicode namespace, global");
+.namespace [ unicode:"Fran\xe7ois" ]
 
 .sub '__init'
-       print 'unicode namespaces are fun'
+       print "unicode namespaces are fun\n"
 .end
 
 .namespace [ "" ]
 
 .sub 'main' :main
-       $P0 = find_global unicode:'Fran�ois', '__init'
+       $P0 = find_global unicode:"Fran\xe7ois", '__init'
        $P0()
 .end
 CODE
@@ -374,5 +373,6 @@ unicode namespaces are fun
 OUT
 
 
+
 # remember to modify the number of tests!
 BEGIN { plan tests => 17; }

Reply via email to