This commit is contained in:
Vitor Santos Costa 2016-07-31 10:26:14 -05:00
parent a8f101cbcf
commit 9ad6bc3120

@ -358,8 +358,10 @@ X_API int PL_get_name_arity(term_t ts, atom_t *name, int *arity) {
CACHE_REGS CACHE_REGS
YAP_Term t = Yap_GetFromSlot(ts); YAP_Term t = Yap_GetFromSlot(ts);
if (IsAtomTerm(t)) { if (IsAtomTerm(t)) {
*name = AtomToSWIAtom(AtomOfTerm(t)); if (name)
*arity = 0; *name = AtomToSWIAtom(AtomOfTerm(t));
if (arity)
*arity = 0;
return 1; return 1;
} }
if (YAP_IsApplTerm(t)) { if (YAP_IsApplTerm(t)) {
@ -367,13 +369,17 @@ X_API int PL_get_name_arity(term_t ts, atom_t *name, int *arity) {
if (IsExtensionFunctor(f)) { if (IsExtensionFunctor(f)) {
return 0; return 0;
} }
*name = AtomToSWIAtom(NameOfFunctor(f)); if (name)
*arity = ArityOfFunctor(f); *name = AtomToSWIAtom(NameOfFunctor(f));
if (arity)
*arity = ArityOfFunctor(f);
return 1; return 1;
} }
if (YAP_IsPairTerm(t)) { if (YAP_IsPairTerm(t)) {
*name = AtomToSWIAtom(AtomDot); if (name)
*arity = 2; *name = AtomToSWIAtom(AtomDot);
if (arity)
*arity = 2;
return 1; return 1;
} }
return 0; return 0;
@ -2163,8 +2169,8 @@ X_API int PL_initialise(int myargc, char **myargv) {
GLOBAL_PL_Argc = myargc; GLOBAL_PL_Argc = myargc;
GLOBAL_PL_Argv = myargv; GLOBAL_PL_Argv = myargv;
GLOBAL_InitialisedFromPL = TRUE; GLOBAL_InitialisedFromPL = true;
int rc = YAP_Init(&init_args) != YAP_BOOT_ERROR; YAP_file_type_t rc = YAP_Init(&init_args) != YAP_FOUND_BOOT_ERROR;
ATOM_nil = YAP_SWIAtomFromAtom(AtomNil); ATOM_nil = YAP_SWIAtomFromAtom(AtomNil);
return rc; return rc;
} }