From 6a433c33a1a12328a9f2e5157e782d5fc872fd09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 19 May 2010 17:17:05 +0100 Subject: [PATCH] fix messup with functors that are atoms. --- library/yap2swi/yap2swi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/yap2swi/yap2swi.c b/library/yap2swi/yap2swi.c index f5fadd14d..ba5551498 100755 --- a/library/yap2swi/yap2swi.c +++ b/library/yap2swi/yap2swi.c @@ -155,8 +155,10 @@ FunctorToSWIFunctor(Functor at) static inline Functor SWIFunctorToFunctor(functor_t at) { - if ((CELL)at & 1) - return SWI_Functors[at>>1]; + if (IsAtomTerm(at)) + return (Functor)at; + if (IsApplTerm(at)) + return SWI_Functors[((CELL)RepAppl((CELL)at))/sizeof(CELL)]; return (Functor)at; } @@ -169,7 +171,7 @@ Yap_InitSWIHash(void) add_to_hash(i*2+1, (ADDR)SWI_Atoms[i]); } for (j=0; j < N_SWI_FUNCTORS; j++) { - add_to_hash(j*2+1, (ADDR)SWI_Functors[j]); + add_to_hash(AbsAppl((CELL *)(j*sizeof(CELL))), (ADDR)SWI_Functors[j]); } }