fix messages with single atom
This commit is contained in:
parent
66af6f7642
commit
a5095a921a
@ -1520,9 +1520,18 @@ ExportTerm(Term inp, char * buf, size_t len, UInt arity, int newattvs USES_REGS)
|
|||||||
Term t = Deref(inp);
|
Term t = Deref(inp);
|
||||||
tr_fr_ptr TR0 = TR;
|
tr_fr_ptr TR0 = TR;
|
||||||
size_t res = 0;
|
size_t res = 0;
|
||||||
CELL *Hi;
|
CELL *Hi = H;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
if (IsVarTerm(t) || IsIntTerm(t)) {
|
||||||
|
return export_term_to_buffer(t, buf, buf+ 3*sizeof(CELL), &inp, &inp, len);
|
||||||
|
}
|
||||||
|
if (IsAtomTerm(t)) {
|
||||||
|
Atom at = AtomOfTerm(t);
|
||||||
|
char *b = buf+3*sizeof(CELL);
|
||||||
|
export_atom(at, &b, b, len-3*sizeof(CELL));
|
||||||
|
return export_term_to_buffer(t, buf, b, &inp, &inp, len);
|
||||||
|
}
|
||||||
if ((Int)res < 0) {
|
if ((Int)res < 0) {
|
||||||
H = Hi;
|
H = Hi;
|
||||||
TR = TR0;
|
TR = TR0;
|
||||||
@ -1634,16 +1643,14 @@ Yap_ImportTerm(char * buf) {
|
|||||||
CELL *bc = (CELL *)buf;
|
CELL *bc = (CELL *)buf;
|
||||||
size_t sz = bc[1];
|
size_t sz = bc[1];
|
||||||
Term tinp, tret;
|
Term tinp, tret;
|
||||||
|
|
||||||
tinp = bc[2];
|
tinp = bc[2];
|
||||||
if (IsVarTerm(tinp))
|
if (IsVarTerm(tinp))
|
||||||
return MkVarTerm();
|
return MkVarTerm();
|
||||||
if (IsAtomOrIntTerm(tinp)) {
|
else if (IsIntTerm(tinp))
|
||||||
if (IsAtomTerm(tinp)) {
|
return tinp;
|
||||||
char *pt = (char *)AdjustSize(bc+3, buf);
|
else if (IsAtomTerm(tinp)) {
|
||||||
return MkAtomTerm(Yap_LookupAtom(pt));
|
tret = MkAtomTerm(AddAtom(NULL,(char *)(bc+3)));
|
||||||
} else
|
return tret;
|
||||||
return tinp;
|
|
||||||
}
|
}
|
||||||
if (H + sz > ASP)
|
if (H + sz > ASP)
|
||||||
return (Term)0;
|
return (Term)0;
|
||||||
@ -1654,7 +1661,7 @@ Yap_ImportTerm(char * buf) {
|
|||||||
} else {
|
} else {
|
||||||
tret = AbsPair(H);
|
tret = AbsPair(H);
|
||||||
import_pair(H, (char *)H, buf, H);
|
import_pair(H, (char *)H, buf, H);
|
||||||
}
|
}
|
||||||
H += sz;
|
H += sz;
|
||||||
return tret;
|
return tret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user