fix encoding issues
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1944 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
fd049830a3
commit
a5406ccc02
11
C/scanner.c
11
C/scanner.c
@ -984,7 +984,7 @@ Yap_tokenizer(int inp_stream)
|
|||||||
Yap_ErrorMessage = "Heap Overflow While Scanning: please increase code space (-h)";
|
Yap_ErrorMessage = "Heap Overflow While Scanning: please increase code space (-h)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ch > MAX_ISO_LATIN1){
|
if (!wcharp && ch > MAX_ISO_LATIN1){
|
||||||
/* does not fit in ISO-LATIN */
|
/* does not fit in ISO-LATIN */
|
||||||
wcharp = ch_to_wide(TokImage, charp);
|
wcharp = ch_to_wide(TokImage, charp);
|
||||||
}
|
}
|
||||||
@ -1019,7 +1019,7 @@ Yap_tokenizer(int inp_stream)
|
|||||||
if (scan_next) {
|
if (scan_next) {
|
||||||
ch = QuotedNxtch(inp_stream);
|
ch = QuotedNxtch(inp_stream);
|
||||||
}
|
}
|
||||||
} else if (chtype[ch] == EF) {
|
} else if (chtype[ch] == EF && ch <= MAX_ISO_LATIN1) {
|
||||||
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
|
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
|
||||||
t->Tok = Ord(kind = eot_tok);
|
t->Tok = Ord(kind = eot_tok);
|
||||||
break;
|
break;
|
||||||
@ -1042,10 +1042,11 @@ Yap_tokenizer(int inp_stream)
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wcharp)
|
if (wcharp) {
|
||||||
*wcharp++ = '\0';
|
*wcharp = '\0';
|
||||||
else
|
} else {
|
||||||
*charp = '\0';
|
*charp = '\0';
|
||||||
|
}
|
||||||
if (quote == '"') {
|
if (quote == '"') {
|
||||||
if (wcharp) {
|
if (wcharp) {
|
||||||
mp = AllocScannerMemory(sizeof(wchar_t)*(len+1));
|
mp = AllocScannerMemory(sizeof(wchar_t)*(len+1));
|
||||||
|
20
C/write.c
20
C/write.c
@ -55,10 +55,10 @@ STATIC_PROTO(void wrputn, (Int, wrf));
|
|||||||
STATIC_PROTO(void wrputs, (char *, wrf));
|
STATIC_PROTO(void wrputs, (char *, wrf));
|
||||||
STATIC_PROTO(void wrputf, (Float, wrf));
|
STATIC_PROTO(void wrputf, (Float, wrf));
|
||||||
STATIC_PROTO(void wrputref, (CODEADDR, int, wrf));
|
STATIC_PROTO(void wrputref, (CODEADDR, int, wrf));
|
||||||
STATIC_PROTO(int legalAtom, (char *));
|
STATIC_PROTO(int legalAtom, (unsigned char *));
|
||||||
STATIC_PROTO(int LeftOpToProtect, (Atom, int));
|
STATIC_PROTO(int LeftOpToProtect, (Atom, int));
|
||||||
STATIC_PROTO(int RightOpToProtect, (Atom, int));
|
STATIC_PROTO(int RightOpToProtect, (Atom, int));
|
||||||
STATIC_PROTO(wtype AtomIsSymbols, (char *));
|
STATIC_PROTO(wtype AtomIsSymbols, (unsigned char *));
|
||||||
STATIC_PROTO(void putAtom, (Atom, int, wrf));
|
STATIC_PROTO(void putAtom, (Atom, int, wrf));
|
||||||
STATIC_PROTO(void writeTerm, (Term, int, int, int, struct write_globs *));
|
STATIC_PROTO(void writeTerm, (Term, int, int, int, struct write_globs *));
|
||||||
|
|
||||||
@ -97,8 +97,9 @@ wrputn(Int n, wrf writewch) /* writes an integer */
|
|||||||
static void
|
static void
|
||||||
wrputs(char *s, wrf writewch) /* writes a string */
|
wrputs(char *s, wrf writewch) /* writes a string */
|
||||||
{
|
{
|
||||||
while (*s)
|
while (*s) {
|
||||||
wrputc(*s++, writewch);
|
wrputc(*s++, writewch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -162,10 +163,11 @@ wrputref(CODEADDR ref, int Quote_illegal, wrf writewch) /* writes a data base
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
legalAtom(char *s) /* Is this a legal atom ? */
|
legalAtom(unsigned char *s) /* Is this a legal atom ? */
|
||||||
|
|
||||||
{
|
{
|
||||||
register int ch = *s;
|
wchar_t ch = *s;
|
||||||
|
|
||||||
if (ch == '\0')
|
if (ch == '\0')
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
if (Yap_chtype[ch] != LC) {
|
if (Yap_chtype[ch] != LC) {
|
||||||
@ -205,7 +207,7 @@ static int RightOpToProtect(Atom at, int p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static wtype
|
static wtype
|
||||||
AtomIsSymbols(char *s) /* Is this atom just formed by symbols ? */
|
AtomIsSymbols(unsigned char *s) /* Is this atom just formed by symbols ? */
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
if (Yap_chtype[(int)s[0]] == SL && s[1] == '\0')
|
if (Yap_chtype[(int)s[0]] == SL && s[1] == '\0')
|
||||||
@ -221,7 +223,7 @@ static void
|
|||||||
putAtom(Atom atom, int Quote_illegal, wrf writewch) /* writes an atom */
|
putAtom(Atom atom, int Quote_illegal, wrf writewch) /* writes an atom */
|
||||||
|
|
||||||
{
|
{
|
||||||
char *s = RepAtom(atom)->StrOfAE;
|
unsigned char *s = (unsigned char *)RepAtom(atom)->StrOfAE;
|
||||||
wtype atom_or_symbol = AtomIsSymbols(s);
|
wtype atom_or_symbol = AtomIsSymbols(s);
|
||||||
|
|
||||||
/* #define CRYPT_FOR_STEVE 1*/
|
/* #define CRYPT_FOR_STEVE 1*/
|
||||||
@ -258,7 +260,7 @@ putAtom(Atom atom, int Quote_illegal, wrf writewch) /* writes an atom */
|
|||||||
if (!legalAtom(s) && Quote_illegal) {
|
if (!legalAtom(s) && Quote_illegal) {
|
||||||
wrputc('\'', writewch);
|
wrputc('\'', writewch);
|
||||||
while (*s) {
|
while (*s) {
|
||||||
int ch = *s++;
|
wchar_t ch = *s++;
|
||||||
wrputc(ch, writewch);
|
wrputc(ch, writewch);
|
||||||
if (ch == '\\' && yap_flags[CHARACTER_ESCAPE_FLAG] != CPROLOG_CHARACTER_ESCAPES)
|
if (ch == '\\' && yap_flags[CHARACTER_ESCAPE_FLAG] != CPROLOG_CHARACTER_ESCAPES)
|
||||||
wrputc('\\', writewch); /* be careful about backslashes */
|
wrputc('\\', writewch); /* be careful about backslashes */
|
||||||
@ -267,7 +269,7 @@ putAtom(Atom atom, int Quote_illegal, wrf writewch) /* writes an atom */
|
|||||||
}
|
}
|
||||||
wrputc('\'', writewch);
|
wrputc('\'', writewch);
|
||||||
} else {
|
} else {
|
||||||
wrputs(s, writewch);
|
wrputs((char *)s, writewch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li> FIXED: have has table of preds with repeated functors (obs from
|
<li> FIXED: have has table of preds with repeated functors (obs from
|
||||||
Bernd Gutmann).</li>
|
Bernd Gutmann).</li>
|
||||||
|
<li> FIXED: major bugs in encoding support (obs from
|
||||||
|
Paulo Moura).</li>
|
||||||
<li> FIXED: overflow while gc was storing pointers in trail (obs from Angelika Kimmig).</li>
|
<li> FIXED: overflow while gc was storing pointers in trail (obs from Angelika Kimmig).</li>
|
||||||
<li> FIXED: implement directive encoding/1 (obs from Paulo Moura).</li>
|
<li> FIXED: implement directive encoding/1 (obs from Paulo Moura).</li>
|
||||||
<li> UPGRADED: to current JPL.</li>
|
<li> UPGRADED: to current JPL.</li>
|
||||||
|
Reference in New Issue
Block a user