Output lisp strings in utf8 format in ldb print.
authorRaymond Toy <toy.raymond@gmail.com>
Wed, 5 Sep 2012 02:49:17 +0000 (19:49 -0700)
committerRaymond Toy <toy.raymond@gmail.com>
Wed, 5 Sep 2012 02:49:17 +0000 (19:49 -0700)
print.c:
 * Use utf16_output to output strings as utf8 instead of raw utf16.

interr.c:
 * Make utf16_output public instead of static.

interr.h:
 * Declare utf16_output.

src/lisp/interr.c
src/lisp/interr.h
src/lisp/print.c

index 5b43b6a..6b46957 100644 (file)
@@ -262,7 +262,7 @@ utf16_codepoint(unsigned short int* utf16, int len, int* consumed)
  * Send the utf-16 Lisp unicode string to standard output as a
  * utf8-encoded sequence of octets.
  */
-static void
+void
 utf16_output(unsigned short int* utf16, int len)
 {
     while (len) {
index 29f4eb7..2611c64 100644 (file)
@@ -14,6 +14,7 @@ extern void lose(char *fmt, ...);
 extern void set_lossage_handler(void fun(void));
 extern void internal_error(os_context_t * context);
 
+extern void utf16_output(unsigned short int* utf16, int len);
 extern lispobj debug_print(lispobj string);
 
 #endif /* _INTERR_H_ */
index 34aa0ce..b4758d8 100644 (file)
@@ -376,14 +376,7 @@ print_string(struct vector* vector)
     uint16_t *charptr = (uint16_t *) vector->data;
     int len = fixnum_value(vector->length);
               
-    while (len-- > 0) {
-        if (*charptr == '"') {
-            putchar('\\');
-        }
-        /* Just dump out the UTF-16 data */
-        fwrite(charptr, sizeof(*charptr), 1,  stdout);
-        charptr++;
-    }
+    utf16_output(charptr, len);
 #endif
 }