diff --git a/C/c_interface.c b/C/c_interface.c
index a48707cf2..b6565a6fc 100755
--- a/C/c_interface.c
+++ b/C/c_interface.c
@@ -519,6 +519,7 @@ X_API int STD_PROTO(YAP_Erase,(void *));
X_API int STD_PROTO(YAP_Variant,(Term, Term));
X_API int STD_PROTO(YAP_ExactlyEqual,(Term, Term));
X_API Int STD_PROTO(YAP_TermHash,(Term, Int, Int, int));
+X_API int STD_PROTO(YAP_SetYAPFlag,(yap_flag_t, int));
static int (*do_getf)(void);
@@ -3100,4 +3101,28 @@ YAP_SlotsToArgs(int n, Int slot)
}
+X_API int
+YAP_SetYAPFlag(yap_flag_t flag, int val)
+{
+ switch (flag) {
+ case YAPC_ENABLE_GC:
+ if (val) {
+ Yap_PutValue(AtomGc, MkAtomTerm(AtomTrue));
+ } else {
+ Yap_PutValue(AtomGc, TermNil);
+ }
+ return TRUE;
+ case YAPC_ENABLE_AGC:
+ if (val) {
+ AGcThreshold = 10000;
+ } else {
+ AGcThreshold = 0;
+ }
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+
diff --git a/changes-6.0.html b/changes-6.0.html
index a15408ad8..be67a39b7 100644
--- a/changes-6.0.html
+++ b/changes-6.0.html
@@ -17,6 +17,7 @@
Yap-6.0.7:
+- NEW: support div/2 as per WG17.
- FIXED: restore from / file should just try that file.
- FIXED: bad things can happen to P when user code is called (obs
from Ingo Thon).
diff --git a/docs/yap.tex b/docs/yap.tex
index e638bb81a..13e4cee77 100644
--- a/docs/yap.tex
+++ b/docs/yap.tex
@@ -300,6 +300,7 @@ Subnodes of C-Interface
* Utility Functions:: From character arrays to Lists of codes and back
* Calling YAP From C:: From C to YAP to C to YAP
* Module Manipulation in C:: Create and Test Modules from within C
+* Miscellaneous C-Functions:: Other Helpful Interface Functions
* Writing C:: Writing Predicates in C
* Loading Objects:: Loading Object Files
* Save&Rest:: Saving and Restoring
@@ -15232,6 +15233,7 @@ The rest of this appendix describes exhaustively how to interface C to YAP.
* Utility Functions:: From character arrays to Lists of codes and back
* Calling YAP From C:: From C to YAP to C to YAP
* Module Manipulation in C:: Create and Test Modules from within C
+* Miscellaneous C-Functions:: Other Helpful Interface Functions
* Writing C:: Writing Predicates in C
* Loading Objects:: Loading Object Files
* Save&Rest:: Saving and Restoring
@@ -15901,7 +15903,7 @@ finding the first solution to the goal, but you can call
Notice that during execution, garbage collection or stack shifting may
have moved the terms
-@node Module Manipulation in C, Writing C, Calling YAP From C, C-Interface
+@node Module Manipulation in C, Miscellaneous C-Functions, Calling YAP From C, C-Interface
@section Module Manipulation in C
YAP allows one to create a new module from C-code. To create the new
@@ -15925,7 +15927,22 @@ possible by using:
Notice that this function returns a term, and not an atom. You can
@code{YAP_AtomOfTerm} to extract the corresponding Prolog atom.
-@node Writing C, Loading Objects, Module Manipulation in C, C-Interface
+@node Miscellaneous C-Functions, Writing C, Module Manipulation in C, C-Interface
+@section Miscellaneous C Functions
+
+@table @code
+@item @code{int} YAP_SetYAPFlag(@code{yap_flag_t flag, int value})
+@findex YAP_SetYAPFlag (C-Interface function)
+
+This function allows setting some YAP flags from @code{C} .Currently,
+only two boolean flags are accepted: @code{YAPC_ENABLE_GC} and
+@code{YAPC_ENABLE_AGC}. The first enables/disables the standard garbage
+collector, the second does the same for the atom garbage collector.`
+
+@end table
+
+
+@node Writing C, Loading Objects, Miscellaneous C-Functions, C-Interface
@section Writing predicates in C
We will distinguish two kinds of predicates:
diff --git a/include/YapInterface.h b/include/YapInterface.h
index 163b179c6..f74dc11bc 100755
--- a/include/YapInterface.h
+++ b/include/YapInterface.h
@@ -510,6 +510,9 @@ extern X_API int PROTO(YAP_Variant,(YAP_Term,YAP_Term));
extern X_API int PROTO(YAP_ExactlyEqual,(YAP_Term,YAP_Term));
extern X_API YAP_Int PROTO(YAP_TermHash,(YAP_Term, YAP_Int, YAP_Int, int));
+/* stack expansion control */
+extern X_API int PROTO(YAP_SetYAPFlag,(yap_flag_t,int));
+
#define YAP_InitCPred(N,A,F) YAP_UserCPredicate(N,F,A)
__END_DECLS
diff --git a/include/yap_structs.h b/include/yap_structs.h
index d2e5faf70..8af71228b 100755
--- a/include/yap_structs.h
+++ b/include/yap_structs.h
@@ -187,3 +187,11 @@ typedef enum
YAPC_COMPILE_ALL /* compile all predicates */
} yapc_exec_mode;
+/********* YAP C-Flags ***********************/
+
+typedef enum
+ {
+ YAPC_ENABLE_GC, /* enable or disable garbage collection */
+ YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
+ } yap_flag_t;
+