trail extension support
This commit is contained in:
parent
a1b04dee3e
commit
f99d048cc2
@ -1,24 +1,23 @@
|
|||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* *
|
* *
|
||||||
* YAP Prolog @(#)c_interface.h 2.2 *
|
* YAP Prolog @(#)c_interface.h 2.2 *
|
||||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||||
* *
|
* *
|
||||||
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
||||||
* *
|
* *
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
* *
|
* *
|
||||||
* File: yap_structs.h *
|
* File: yap_structs.h *
|
||||||
* Last rev: 15/5/2000 *
|
* Last rev: 15/5/2000 *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: Data structures and defines used in the Interface *
|
* comments: Data structures and defines used in the Interface *
|
||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifndef _YAPDEFS_H
|
#ifndef _YAPDEFS_H
|
||||||
|
|
||||||
#define _YAPDEFS_H 1
|
#define _YAPDEFS_H 1
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* X_API macro
|
* X_API macro
|
||||||
*
|
*
|
||||||
@ -47,7 +46,6 @@
|
|||||||
#define X_API
|
#define X_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -376,23 +374,38 @@ typedef struct open_query_struct {
|
|||||||
|
|
||||||
typedef void (*YAP_halt_hook)(int exit_code, void *closure);
|
typedef void (*YAP_halt_hook)(int exit_code, void *closure);
|
||||||
|
|
||||||
|
/** Interface to opaque variables */
|
||||||
|
|
||||||
|
/* each type has a tag */
|
||||||
typedef YAP_Int YAP_opaque_tag_t;
|
typedef YAP_Int YAP_opaque_tag_t;
|
||||||
|
|
||||||
typedef YAP_Bool (*YAP_Opaque_CallOnFail)(void *);
|
typedef YAP_Bool (*YAP_Opaque_CallOnFail)(YAP_Term);
|
||||||
|
typedef YAP_Bool (*YAP_Opaque_CallOnCut)(YAP_Term);
|
||||||
typedef YAP_Bool (*YAP_Opaque_CallOnWrite)(FILE *, YAP_opaque_tag_t, void *,
|
typedef YAP_Bool (*YAP_Opaque_CallOnWrite)(FILE *, YAP_opaque_tag_t, void *,
|
||||||
int);
|
int);
|
||||||
typedef YAP_Int (*YAP_Opaque_CallOnGCMark)(YAP_opaque_tag_t, void *, YAP_Term *,
|
typedef YAP_Int (*YAP_Opaque_CallOnGCMark)(YAP_opaque_tag_t, void *, YAP_Term *,
|
||||||
YAP_Int);
|
YAP_Int);
|
||||||
typedef YAP_Bool (*YAP_Opaque_CallOnGCRelocate)(YAP_opaque_tag_t, void *,
|
typedef YAP_Bool (*YAP_Opaque_CallOnGCRelocate)(YAP_opaque_tag_t, void *,
|
||||||
YAP_Term *, YAP_Int);
|
YAP_Term *, YAP_Int);
|
||||||
|
/// opaque variables can interact with the system
|
||||||
typedef struct YAP_opaque_handler_struct {
|
typedef struct YAP_opaque_handler_struct {
|
||||||
YAP_Opaque_CallOnFail fail_handler;
|
YAP_Opaque_CallOnCut cut_handler; //< called at cut, which may be a forward
|
||||||
YAP_Opaque_CallOnWrite write_handler;
|
//cut or an exception.
|
||||||
YAP_Opaque_CallOnGCMark mark_handler;
|
YAP_Opaque_CallOnFail
|
||||||
YAP_Opaque_CallOnGCRelocate relocate_handler;
|
fail_handler; //< called at exit, it can be used to cleanup resources
|
||||||
|
YAP_Opaque_CallOnWrite write_handler; //< text representation
|
||||||
|
YAP_Opaque_CallOnGCMark
|
||||||
|
mark_handler; //< useful if you include pointers to stack
|
||||||
|
YAP_Opaque_CallOnGCRelocate
|
||||||
|
relocate_handler; //< useful if you include pointers to stack
|
||||||
} YAP_opaque_handler_t;
|
} YAP_opaque_handler_t;
|
||||||
|
|
||||||
|
extern YAP_Opaque_CallOnWrite Yap_blob_write_handler_from_slot(YAP_Int slot);
|
||||||
|
extern YAP_Opaque_CallOnGCMark Yap_blob_gc_mark_handler(YAP_Term t);
|
||||||
|
extern YAP_Opaque_CallOnGCRelocate Yap_blob_gc_relocate_handler(YAP_Term t);
|
||||||
|
extern YAP_Int Yap_blob_tag_from_slot(YAP_Int slot);
|
||||||
|
extern void *Yap_blob_info_from_slot(YAP_Int slot);
|
||||||
|
|
||||||
/********* execution mode ***********************/
|
/********* execution mode ***********************/
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
Reference in New Issue
Block a user