From 834e3ed5d06fe7a9a1cf4cb85fe598253db2e1f7 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Mon, 19 Jul 2010 14:38:17 +0100 Subject: [PATCH] make arg/3 compatible with SWI for atomic argument (fail silently). --- C/absmi.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index 33ce51927..adb091505 100755 --- a/C/absmi.c +++ b/C/absmi.c @@ -7553,7 +7553,7 @@ Yap_absmi(int inp) FAIL(); } /* in case we call Execute */ - YREG = ENV; + YREG = YENV = ENV; JMPNext(); ENDBOp(); @@ -12155,9 +12155,12 @@ Yap_absmi(int inp) ENDP(pt0); } else { - saveregs(); - Yap_Error(TYPE_ERROR_COMPOUND, d1, "arg 2 of arg/3"); - setregs(); + /* + don't complain here for SWI Prolog compatibility + saveregs(); + Yap_Error(TYPE_ERROR_COMPOUND, d1, "arg 2 of arg/3"); + setregs(); + */ FAIL(); } @@ -12243,9 +12246,12 @@ Yap_absmi(int inp) ENDP(pt0); } else { - saveregs(); - Yap_Error(TYPE_ERROR_COMPOUND, d1, "arg 2 of arg/3"); - setregs(); + /* + keep SWI Prolog compatibility, just fail on trying to obtain an argument of a compound term. + saveregs(); + Yap_Error(TYPE_ERROR_COMPOUND, d1, "arg 2 of arg/3"); + setregs(); + */ FAIL(); } @@ -12350,9 +12356,12 @@ Yap_absmi(int inp) ENDP(pt0); } else { - saveregs(); - Yap_Error(TYPE_ERROR_COMPOUND, d1, "arg 2 of arg/3"); - setregs(); + /* + don't complain here for SWI Prolog compatibility + saveregs(); + Yap_Error(TYPE_ERROR_COMPOUND, d1, "arg 2 of arg/3"); + setregs(); + */ FAIL(); } @@ -12453,9 +12462,12 @@ Yap_absmi(int inp) ENDP(pt0); } else { - saveregs(); - Yap_Error(TYPE_ERROR_COMPOUND, d1, "arg 2 of arg/3"); - setregs(); + /* + don't complain here for SWI Prolog compatibility + saveregs(); + Yap_Error(TYPE_ERROR_COMPOUND, d1, "arg 2 of arg/3"); + setregs(); + */ FAIL(); }