Commit 6d197cc6 authored by Erick's avatar Erick

.

parent c0b96b39
......@@ -23,7 +23,7 @@
*
* Author: Erick Gallesio [eg@kaolin.unice.fr]
* Creation date: ??????
* Last file update: 1-May-2011 12:35 (eg)
* Last file update: 5-May-2011 17:50 (eg)
*/
#include <ctype.h>
......@@ -130,16 +130,6 @@ static int charcompi(SCM c1, SCM c2)
}
static void dump_utf8_str(char *str)
{
printf("Dump of '%s' (len = %d)\n", str, strlen(str));
while (*str) {
printf("%03d %02x ", (uint8_t) *str, (uint8_t) *str);
str++;
}
printf("---\n");
}
int STk_string2char(char *s)
/* converts a char name to a char */
{
......
This diff is collapsed.
......@@ -21,7 +21,7 @@
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: ??-Oct-1993 ??:??
* Last file update: 22-Apr-2011 14:39 (eg)
* Last file update: 5-May-2011 16:14 (eg)
*
*/
#include <ctype.h>
......@@ -122,7 +122,10 @@ static void printstring(SCM s, SCM port, int mode)
case '\v' : *buff++ = '\\'; *buff++ = 'v'; break;
case '"' :
case '\\' : *buff++ = '\\'; *buff++ = *p; break;
default : if ((((unsigned char) *p) & 0177) < (unsigned char) ' ') {
default : if (STk_use_utf8)
*buff++ = *p;
else {
if ((((unsigned char) *p) & 0177) < (unsigned char) ' ') {
/* Non printable character (It works only for ISO 8859-x !!) */
*buff++ = '\\';
*buff++ = 'x';
......@@ -130,6 +133,7 @@ static void printstring(SCM s, SCM port, int mode)
*buff++ = printhexa((unsigned char) *p % 16);
}
else *buff++ = *p;
}
}
}
*buff++ = '"';
......@@ -163,7 +167,7 @@ void STk_print(SCM exp, SCM port, int mode)
}
if (CHARACTERP(exp)) {
uint8_t buffer[5];
char buffer[5];
int c = CHARACTER_VAL(exp);
if (mode!=DSP_MODE){
......
......@@ -21,7 +21,7 @@
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 30-Apr-2011 19:46 (eg)
* Last file update: 5-May-2011 16:04 (eg)
* Last file update: 5-May-2011 17:51 (eg)
*/
#include "stklos.h"
......@@ -110,6 +110,7 @@ int STk_char2utf8(int ch, char *str) /* result = length of the UTF-8 repr. */
*buff++ = (ch & 0x3F) | 0x80;
n = 4;
} else {
n = 0; /* to make gcc happy */
STk_error("bad UTF-8 character %d", ch);
}
*buff = '\0';
......@@ -138,6 +139,17 @@ int STk_utf8_strlen(char *s, int max)
}
#ifdef STK_DEBUG
void STk_dump_utf8_str(char *str)
{
printf("Dump of '%s' (len = %d)\n", str, strlen(str));
while (*str) {
printf("%03d %02x ", (uint8_t) *str, (uint8_t) *str);
str++;
}
printf("---\n");
}
#endif
/* ======================================================================
* STklos Primitives
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment