-bad typing in SWI emulation.
This commit is contained in:
parent
dd22039a59
commit
3bcde55a77
@ -3232,7 +3232,7 @@ PRED_IMPL("prompt1", 1, prompt1, 0)
|
|||||||
if ( PL_get_atom(A1, &a) )
|
if ( PL_get_atom(A1, &a) )
|
||||||
{ prompt1(a);
|
{ prompt1(a);
|
||||||
} else if ( PL_get_text(A1, &txt, CVT_ALL|CVT_EXCEPTION) )
|
} else if ( PL_get_text(A1, &txt, CVT_ALL|CVT_EXCEPTION) )
|
||||||
{ prompt1(textToAtom(&txt));
|
{ prompt1(YAP_SWIAtomFromAtom(textToAtom(&txt)));
|
||||||
} else
|
} else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -3373,7 +3373,7 @@ fn_to_atom(const char *fn)
|
|||||||
text.length = strlen(fn);
|
text.length = strlen(fn);
|
||||||
text.canonical = FALSE;
|
text.canonical = FALSE;
|
||||||
|
|
||||||
a = textToAtom(&text);
|
a = YAP_SWIAtomFromAtom(textToAtom(&text));
|
||||||
PL_free_text(&text);
|
PL_free_text(&text);
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
|
@ -981,8 +981,8 @@ PRED_IMPL("file_directory_name", 2, file_directory_name, 0)
|
|||||||
|
|
||||||
if ( !PL_get_chars(A1, &n, CVT_ALL|REP_FN|CVT_EXCEPTION) )
|
if ( !PL_get_chars(A1, &n, CVT_ALL|REP_FN|CVT_EXCEPTION) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
int out = PL_unify_chars(A2, PL_ATOM|REP_FN, -1, DirName(n, tmp));
|
||||||
return PL_unify_chars(A2, PL_ATOM|REP_FN, -1, DirName(n, tmp));
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ setPrologFlag(const char *name, int flags, ...)
|
|||||||
text.length = strlen(text.text.t);
|
text.length = strlen(text.text.t);
|
||||||
text.canonical = FALSE;
|
text.canonical = FALSE;
|
||||||
|
|
||||||
f->value.a = textToAtom(&text); /* registered: ok */
|
f->value.a = YAP_SWIAtomFromAtom(textToAtom(&text)); /* registered: ok */
|
||||||
|
|
||||||
PL_free_text(&text);
|
PL_free_text(&text);
|
||||||
|
|
||||||
|
17
os/pl-text.c
17
os/pl-text.c
@ -354,16 +354,18 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
atom_t
|
Atom
|
||||||
textToAtom(PL_chars_t *text)
|
textToAtom(PL_chars_t *text)
|
||||||
{ if ( !PL_canonise_text(text) )
|
{ if ( !PL_canonise_text(text) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Atom w;
|
||||||
if ( text->encoding == ENC_ISO_LATIN_1 )
|
if ( text->encoding == ENC_ISO_LATIN_1 )
|
||||||
{ return lookupAtom(text->text.t, text->length);
|
{ w = lookupAtom(text->text.t, text->length);
|
||||||
} else
|
} else
|
||||||
{ return lookupUCSAtom(text->text.w, text->length);
|
{ w = lookupUCSAtom(text->text.w, text->length);
|
||||||
}
|
}
|
||||||
|
return w ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -383,13 +385,14 @@ textToString(PL_chars_t *text)
|
|||||||
int
|
int
|
||||||
PL_unify_text(term_t term, term_t tail, PL_chars_t *text, int type)
|
PL_unify_text(term_t term, term_t tail, PL_chars_t *text, int type)
|
||||||
{ switch(type)
|
{ switch(type)
|
||||||
{ case PL_ATOM:
|
{ case PL_ATOM:
|
||||||
{ atom_t a = textToAtom(text);
|
{ Atom at = textToAtom(text);
|
||||||
|
Term a = MkAtomTerm(at);
|
||||||
|
|
||||||
if ( a )
|
if ( a )
|
||||||
{ int rval = _PL_unify_atomic(term, a);
|
{ int rval = _PL_unify_atomic(term, a);
|
||||||
|
|
||||||
PL_unregister_atom(a);
|
PL_unregister_atom(YAP_SWIAtomFromAtom(AtomOfTerm(a)));
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -71,7 +71,7 @@ void PL_free_text(PL_chars_t *text);
|
|||||||
void PL_save_text(PL_chars_t *text, int flags);
|
void PL_save_text(PL_chars_t *text, int flags);
|
||||||
|
|
||||||
COMMON(int) PL_get_text__LD(term_t l, PL_chars_t *text, int flags ARG_LD);
|
COMMON(int) PL_get_text__LD(term_t l, PL_chars_t *text, int flags ARG_LD);
|
||||||
COMMON(atom_t) textToAtom(PL_chars_t *text);
|
COMMON(Atom) textToAtom(PL_chars_t *text);
|
||||||
|
|
||||||
COMMON(IOSTREAM *) Sopen_text(PL_chars_t *text, const char *mode);
|
COMMON(IOSTREAM *) Sopen_text(PL_chars_t *text, const char *mode);
|
||||||
COMMON(void) PL_text_recode(PL_chars_t *text, IOENC encoding);
|
COMMON(void) PL_text_recode(PL_chars_t *text, IOENC encoding);
|
||||||
|
Reference in New Issue
Block a user