YAP_SetYAP_Flag
This commit is contained in:
parent
8f49db480d
commit
8b9cf7dc2a
@ -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_Variant,(Term, Term));
|
||||||
X_API int STD_PROTO(YAP_ExactlyEqual,(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_TermHash,(Term, Int, Int, int));
|
||||||
|
X_API int STD_PROTO(YAP_SetYAPFlag,(yap_flag_t, int));
|
||||||
|
|
||||||
static int (*do_getf)(void);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
<h2>Yap-6.0.7:</h2>
|
<h2>Yap-6.0.7:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> NEW: support div/2 as per WG17. </li>
|
||||||
<li> FIXED: restore from / file should just try that file. </li>
|
<li> FIXED: restore from / file should just try that file. </li>
|
||||||
<li> FIXED: bad things can happen to P when user code is called (obs
|
<li> FIXED: bad things can happen to P when user code is called (obs
|
||||||
from Ingo Thon). </li>
|
from Ingo Thon). </li>
|
||||||
|
21
docs/yap.tex
21
docs/yap.tex
@ -300,6 +300,7 @@ Subnodes of C-Interface
|
|||||||
* Utility Functions:: From character arrays to Lists of codes and back
|
* Utility Functions:: From character arrays to Lists of codes and back
|
||||||
* Calling YAP From C:: From C to YAP to C to YAP
|
* Calling YAP From C:: From C to YAP to C to YAP
|
||||||
* Module Manipulation in C:: Create and Test Modules from within C
|
* Module Manipulation in C:: Create and Test Modules from within C
|
||||||
|
* Miscellaneous C-Functions:: Other Helpful Interface Functions
|
||||||
* Writing C:: Writing Predicates in C
|
* Writing C:: Writing Predicates in C
|
||||||
* Loading Objects:: Loading Object Files
|
* Loading Objects:: Loading Object Files
|
||||||
* Save&Rest:: Saving and Restoring
|
* 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
|
* Utility Functions:: From character arrays to Lists of codes and back
|
||||||
* Calling YAP From C:: From C to YAP to C to YAP
|
* Calling YAP From C:: From C to YAP to C to YAP
|
||||||
* Module Manipulation in C:: Create and Test Modules from within C
|
* Module Manipulation in C:: Create and Test Modules from within C
|
||||||
|
* Miscellaneous C-Functions:: Other Helpful Interface Functions
|
||||||
* Writing C:: Writing Predicates in C
|
* Writing C:: Writing Predicates in C
|
||||||
* Loading Objects:: Loading Object Files
|
* Loading Objects:: Loading Object Files
|
||||||
* Save&Rest:: Saving and Restoring
|
* 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
|
Notice that during execution, garbage collection or stack shifting may
|
||||||
have moved the terms
|
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
|
@section Module Manipulation in C
|
||||||
|
|
||||||
YAP allows one to create a new module from C-code. To create the new
|
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
|
Notice that this function returns a term, and not an atom. You can
|
||||||
@code{YAP_AtomOfTerm} to extract the corresponding Prolog atom.
|
@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
|
@section Writing predicates in C
|
||||||
|
|
||||||
We will distinguish two kinds of predicates:
|
We will distinguish two kinds of predicates:
|
||||||
|
@ -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 int PROTO(YAP_ExactlyEqual,(YAP_Term,YAP_Term));
|
||||||
extern X_API YAP_Int PROTO(YAP_TermHash,(YAP_Term, YAP_Int, YAP_Int, int));
|
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)
|
#define YAP_InitCPred(N,A,F) YAP_UserCPredicate(N,F,A)
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
@ -187,3 +187,11 @@ typedef enum
|
|||||||
YAPC_COMPILE_ALL /* compile all predicates */
|
YAPC_COMPILE_ALL /* compile all predicates */
|
||||||
} yapc_exec_mode;
|
} 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;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user