From 18190a4633aff2c695189e6ee4064713e21e7f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 13 Dec 2011 23:09:05 +0000 Subject: [PATCH] fix types for return absmi and friends. --- C/c_interface.c | 12 ++++++------ C/exec.c | 10 +++++----- H/Yapproto.h | 2 +- docs/yap.tex | 4 ++-- include/YapInterface.h | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/C/c_interface.c b/C/c_interface.c index 32fe2d040..7728c439d 100644 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -455,8 +455,8 @@ X_API Term STD_PROTO(YAP_NBufferToDiffList, (char *, Term, size_t)); X_API Term STD_PROTO(YAP_WideBufferToDiffList, (wchar_t *, Term)); X_API Term STD_PROTO(YAP_NWideBufferToDiffList, (wchar_t *, Term, size_t)); X_API void STD_PROTO(YAP_Error,(int, Term, char *, ...)); -X_API Term STD_PROTO(YAP_RunGoal,(Term)); -X_API Term STD_PROTO(YAP_RunGoalOnce,(Term)); +X_API Int STD_PROTO(YAP_RunGoal,(Term)); +X_API Int STD_PROTO(YAP_RunGoalOnce,(Term)); X_API int STD_PROTO(YAP_RestartGoal,(void)); X_API int STD_PROTO(YAP_ShutdownGoal,(int)); X_API int STD_PROTO(YAP_EnterGoal,(PredEntry *, Term *, YAP_dogoalinfo *)); @@ -2364,7 +2364,7 @@ YAP_LeaveGoal(int backtrack, YAP_dogoalinfo *dgi) return TRUE; } -X_API Term +X_API Int YAP_RunGoal(Term t) { CACHE_REGS @@ -2388,7 +2388,7 @@ YAP_RunGoal(Term t) } RECOVER_MACHINE_REGS(); - return(out); + return out; } X_API Term @@ -2450,7 +2450,7 @@ YAP_OpaqueObjectFromTerm(Term t) return ExternalBlobFromTerm (t); } -X_API Term +X_API Int YAP_RunGoalOnce(Term t) { CACHE_REGS @@ -2502,7 +2502,7 @@ YAP_RunGoalOnce(Term t) CP = old_CP; LOCAL_AllowRestart = FALSE; RECOVER_MACHINE_REGS(); - return(out); + return out; } X_API int diff --git a/C/exec.c b/C/exec.c index 4a3f91cbb..3d1d6e52c 100644 --- a/C/exec.c +++ b/C/exec.c @@ -941,7 +941,7 @@ p_pred_goal_expansion_on( USES_REGS1 ) { } -static int +static Int exec_absmi(int top USES_REGS) { int lval, out; @@ -1052,11 +1052,11 @@ init_stack(int arity, CELL *pt, int top, choiceptr saved_b USES_REGS) CP = YESCODE; } -static Term +static Int do_goal(Term t, yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS) { choiceptr saved_b = B; - Term out = 0L; + Int out; init_stack(arity, pt, top, saved_b PASS_REGS); P = (yamop *) CodeAdr; @@ -1070,7 +1070,7 @@ do_goal(Term t, yamop *CodeAdr, int arity, CELL *pt, int top USES_REGS) return out; } -int +Int Yap_exec_absmi(int top) { CACHE_REGS @@ -1287,7 +1287,7 @@ Yap_RunTopGoal(Term t) } #endif goal_out = do_goal(t, CodeAdr, arity, pt, TRUE PASS_REGS); - return(goal_out); + return goal_out; } static void diff --git a/H/Yapproto.h b/H/Yapproto.h index 5e34805c4..4428d7af1 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -177,7 +177,7 @@ Int STD_PROTO(Yap_JumpToEnv,(Term)); Term STD_PROTO(Yap_RunTopGoal,(Term)); void STD_PROTO(Yap_ResetExceptionTerm,(void)); Int STD_PROTO(Yap_execute_goal,(Term, int, Term)); -int STD_PROTO(Yap_exec_absmi,(int)); +Int STD_PROTO(Yap_exec_absmi,(int)); void STD_PROTO(Yap_trust_last,(void)); Term STD_PROTO(Yap_GetException,(void)); diff --git a/docs/yap.tex b/docs/yap.tex index f36829186..f1e78292f 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -16664,7 +16664,7 @@ There are several ways to call Prolog code from C-code. By default, the has been initialised before: @example - YAP_RunGoal(YAP_Term Goal) + YAP_Int YAP_RunGoal(YAP_Term Goal) @end example Execute query @var{Goal} and return 1 if the query succeeds, and 0 otherwise. The predicate returns 0 if failure, otherwise it will return @@ -16673,7 +16673,7 @@ an @var{YAP_Term}. Quite often, one wants to run a query once. In this case you should use @var{Goal}: @example - YAP_RunGoalOnce(YAP_Term Goal) + YAP_Int YAP_RunGoalOnce(YAP_Term Goal) @end example The @code{YAP_RunGoal()} function makes sure to recover stack space at the end of execution. diff --git a/include/YapInterface.h b/include/YapInterface.h index 069fdfd0c..c60e34de1 100644 --- a/include/YapInterface.h +++ b/include/YapInterface.h @@ -272,10 +272,10 @@ extern X_API void *PROTO(YAP_ReallocSpaceFromYap,(void*,unsigned int)); extern X_API void PROTO(YAP_FreeSpaceFromYap,(void *)); /* int YAP_RunGoal(YAP_Term) */ -extern X_API YAP_Term PROTO(YAP_RunGoal,(YAP_Term)); +extern X_API YAP_Int PROTO(YAP_RunGoal,(YAP_Term)); /* int YAP_RunGoalOnce(YAP_Term) */ -extern X_API YAP_Term PROTO(YAP_RunGoalOnce,(YAP_Term)); +extern X_API YAP_Int PROTO(YAP_RunGoalOnce,(YAP_Term)); /* int YAP_RestartGoal(void) */ extern X_API YAP_Bool PROTO(YAP_RestartGoal,(void));