[cmucl-cvs] CMUCL commit: src/lisp (print.c)

Raymond Toy rtoy at common-lisp.net
Sun Oct 10 12:52:58 UTC 2010


    Date: Sunday, October 10, 2010 @ 08:52:58
  Author: rtoy
    Path: /project/cmucl/cvsroot/src/lisp

Modified: print.c

In brief_otherptr, the name slot of a symbol was not printing out the
name correctly for unicode strings.  It stopped after the first 0
byte, which basically means either nothing or a single byte is
printed.  Just dump out the entire UTF-16 octets in native byte
order.


---------+
 print.c |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)


Index: src/lisp/print.c
diff -u src/lisp/print.c:1.25 src/lisp/print.c:1.26
--- src/lisp/print.c:1.25	Thu Jun 11 12:04:01 2009
+++ src/lisp/print.c	Sun Oct 10 08:52:58 2010
@@ -1,4 +1,4 @@
-/* $Header: /project/cmucl/cvsroot/src/lisp/print.c,v 1.25 2009-06-11 16:04:01 rtoy Rel $ */
+/* $Header: /project/cmucl/cvsroot/src/lisp/print.c,v 1.26 2010-10-10 12:52:58 rtoy Exp $ */
 
 #include <stdio.h>
 #include <string.h>
@@ -376,11 +376,28 @@
       case type_SymbolHeader:
 	  symbol = (struct symbol *) ptr;
 	  vector = (struct vector *) PTR(symbol->name);
+#ifndef UNICODE
 	  for (charptr = (char *) vector->data; *charptr != '\0'; charptr++) {
 	      if (*charptr == '"')
 		  putchar('\\');
 	      putchar(*charptr);
 	  }
+#else
+          {
+              char *charptr = (char *) vector->data;
+              int len = (int) (vector->length >> 2);
+              
+              while (len-- > 0) {
+                  if ((charptr[0] == 0)
+                      && (charptr[1] = '"')) {
+                      putchar('\\');
+                  }
+                  /* Just dump out the UTF-16 data */
+                  putchar(*charptr++);
+                  putchar(*charptr++);
+              }
+          }
+#endif
 	  break;
 
       case type_SimpleString:




More information about the cmucl-cvs mailing list