bad typing
This commit is contained in:
parent
3bcde55a77
commit
102c8a1dc1
22
C/pl-yap.c
22
C/pl-yap.c
@ -44,14 +44,14 @@ uncachedCodeToAtom(int chrcode)
|
|||||||
|
|
||||||
tmp[0] = chrcode;
|
tmp[0] = chrcode;
|
||||||
tmp[1] = '\0';
|
tmp[1] = '\0';
|
||||||
return lookupAtom(tmp, 1);
|
return YAP_SWIAtomFromAtom(lookupAtom(tmp, 1));
|
||||||
} else
|
} else
|
||||||
{ pl_wchar_t tmp[2];
|
{ pl_wchar_t tmp[2];
|
||||||
|
|
||||||
tmp[0] = chrcode;
|
tmp[0] = chrcode;
|
||||||
tmp[1] = '\0';
|
tmp[1] = '\0';
|
||||||
|
|
||||||
return (atom_t)YAP_LookupWideAtom(tmp);
|
return YAP_SWIAtomFromAtom(Yap_LookupWideAtom(tmp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,46 +324,46 @@ _PL_unify_string(term_t t, word w)
|
|||||||
return Yap_unify(Yap_GetFromSlot(t PASS_REGS), w);
|
return Yap_unify(Yap_GetFromSlot(t PASS_REGS), w);
|
||||||
}
|
}
|
||||||
|
|
||||||
word lookupAtom(const char *s, size_t len)
|
Atom lookupAtom(const char *s, size_t len)
|
||||||
{
|
{
|
||||||
YAP_Atom at;
|
Atom at;
|
||||||
|
|
||||||
/* dirty trick to ensure s is null terminated */
|
/* dirty trick to ensure s is null terminated */
|
||||||
char *st = (char *)s;
|
char *st = (char *)s;
|
||||||
if (st[len])
|
if (st[len])
|
||||||
st[len] = '\0';
|
st[len] = '\0';
|
||||||
if (len >= strlen(s)) {
|
if (len >= strlen(s)) {
|
||||||
at = YAP_LookupAtom(st);
|
at = Yap_LookupAtom(st);
|
||||||
} else {
|
} else {
|
||||||
char * buf = PL_malloc(len+1);
|
char * buf = PL_malloc(len+1);
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return 0;
|
return 0;
|
||||||
strncpy(buf,s,len);
|
strncpy(buf,s,len);
|
||||||
at = YAP_LookupAtom(buf);
|
at = Yap_LookupAtom(buf);
|
||||||
PL_free(buf);
|
PL_free(buf);
|
||||||
}
|
}
|
||||||
Yap_AtomIncreaseHold(at);
|
Yap_AtomIncreaseHold(at);
|
||||||
return (word)at;
|
return at;
|
||||||
}
|
}
|
||||||
|
|
||||||
atom_t lookupUCSAtom(const pl_wchar_t *s, size_t len)
|
Atom lookupUCSAtom(const pl_wchar_t *s, size_t len)
|
||||||
{
|
{
|
||||||
YAP_Atom at;
|
YAP_Atom at;
|
||||||
|
|
||||||
if (len >= wcslen(s)) {
|
if (len >= wcslen(s)) {
|
||||||
at = YAP_LookupWideAtom(s);
|
at = Yap_LookupWideAtom(s);
|
||||||
} else {
|
} else {
|
||||||
pl_wchar_t * buf = PL_malloc((len+1)*sizeof(pl_wchar_t));
|
pl_wchar_t * buf = PL_malloc((len+1)*sizeof(pl_wchar_t));
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return 0;
|
return 0;
|
||||||
wcsncpy(buf,s,len);
|
wcsncpy(buf,s,len);
|
||||||
at = YAP_LookupWideAtom(buf);
|
at = Yap_LookupWideAtom(buf);
|
||||||
PL_free(buf);
|
PL_free(buf);
|
||||||
}
|
}
|
||||||
Yap_AtomIncreaseHold(at);
|
Yap_AtomIncreaseHold(at);
|
||||||
return (atom_t)at;
|
return at;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user