2001-04-09 20:54:03 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
|
|
|
* YAP Prolog @(#)c_interface.h 2.2 *
|
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: yap_structs.h *
|
|
|
|
* Last rev: 15/5/2000 *
|
|
|
|
* mods: *
|
|
|
|
* comments: Data structures and defines used in the Interface *
|
|
|
|
* *
|
|
|
|
*************************************************************************/
|
2015-01-20 03:00:42 +00:00
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#ifndef _YAPDEFS_H
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#define _YAPDEFS_H 1
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
#include <setjmp.h>
|
2015-06-19 01:30:13 +01:00
|
|
|
#include <stdio.h>
|
2014-05-25 20:48:06 +01:00
|
|
|
#include <stdlib.h>
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2015-01-27 03:25:56 +00:00
|
|
|
#ifdef YAP_H
|
|
|
|
|
2015-01-20 03:00:42 +00:00
|
|
|
/* The YAP main types */
|
|
|
|
#include "YapTerm.h"
|
|
|
|
|
2016-05-12 11:50:53 +01:00
|
|
|
/**
|
|
|
|
This term can never be constructed as a valid term, so it is
|
|
|
|
used as a "BAD" term
|
|
|
|
*/
|
|
|
|
#define TermZERO ((Term)0)
|
|
|
|
|
2015-01-27 03:25:56 +00:00
|
|
|
#else
|
|
|
|
|
2015-02-14 17:11:56 +00:00
|
|
|
#include "YapConfig.h"
|
2015-01-27 03:25:56 +00:00
|
|
|
|
|
|
|
#endif /* YAP_H */
|
|
|
|
|
|
|
|
#if HAVE_STDINT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#endif
|
2016-07-31 16:31:22 +01:00
|
|
|
#if HAVE_INTTYPES_H
|
|
|
|
#include <inttypes.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* truth-values */
|
|
|
|
/* stdbool defines the booleam type, bool,
|
|
|
|
and the constants false and true */
|
2015-01-20 03:00:42 +00:00
|
|
|
#if HAVE_STDBOOL_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#else
|
|
|
|
#ifndef true
|
|
|
|
typedef int _Bool;
|
|
|
|
#define bool _Bool;
|
|
|
|
|
|
|
|
#define false 0
|
|
|
|
#define true 1
|
|
|
|
#endif
|
|
|
|
#endif /* HAVE_STDBOOL_H */
|
|
|
|
|
|
|
|
/**
|
|
|
|
FALSE and TRUE are the pre-standard versions,
|
|
|
|
still widely used.
|
|
|
|
*/
|
|
|
|
#ifndef TRUE
|
2016-04-05 02:27:33 +01:00
|
|
|
#define TRUE true
|
2015-01-20 03:00:42 +00:00
|
|
|
#endif
|
|
|
|
#ifndef FALSE
|
2016-04-05 02:27:33 +01:00
|
|
|
#define FALSE false
|
2015-01-20 03:00:42 +00:00
|
|
|
#endif
|
2015-01-27 03:25:56 +00:00
|
|
|
#ifndef YAP_Bool
|
|
|
|
typedef bool YAP_Bool;
|
|
|
|
#endif
|
2015-01-20 03:00:42 +00:00
|
|
|
|
2011-03-02 23:19:39 +00:00
|
|
|
#ifdef YAP_H
|
|
|
|
|
|
|
|
/* if Yap.h is available, just reexport */
|
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#define YAP_CELL CELL
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#define YAP_Term Term
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2015-04-13 13:28:17 +01:00
|
|
|
#define YAP_Arity arity_t
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2015-01-20 03:00:42 +00:00
|
|
|
#define YAP_Module Term
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
#define YAP_Functor Functor
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#define YAP_Atom Atom
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#define YAP_Int Int
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#define YAP_UInt UInt
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#define YAP_Float Float
|
2011-03-02 23:19:39 +00:00
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
#define YAP_handle_t yhandle_t
|
2014-06-11 19:36:50 +01:00
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#define YAP_PredEntryPtr struct pred_entry *
|
|
|
|
|
|
|
|
#define YAP_UserCPred CPredicate
|
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
#define YAP_agc_hook Agc_hook
|
2014-05-25 20:48:06 +01:00
|
|
|
|
2015-10-08 02:23:45 +01:00
|
|
|
#define YAP_encoding_t encoding_t
|
|
|
|
|
2011-03-02 23:19:39 +00:00
|
|
|
#else
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
/* Type definitions */
|
2016-07-31 16:31:22 +01:00
|
|
|
#if defined(PRIdPTR)
|
|
|
|
typedef uintptr_t YAP_UInt;
|
|
|
|
typedef intptr_t YAP_Int;
|
|
|
|
#elif _WIN64
|
|
|
|
typedef int64_t YAP_Int;
|
|
|
|
typedef uint64_t YAP_UInt;
|
|
|
|
#elif _WIN32
|
|
|
|
typedef int32_t YAP_Int;
|
|
|
|
typedef uint32_t YAP_UInt;
|
2010-05-06 16:32:41 +01:00
|
|
|
#else
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef long int YAP_Int;
|
|
|
|
typedef unsigned long int YAP_UInt;
|
2010-05-06 16:32:41 +01:00
|
|
|
#endif
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef YAP_UInt YAP_CELL;
|
|
|
|
|
2002-09-09 18:40:12 +01:00
|
|
|
typedef YAP_CELL YAP_Term;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef size_t YAP_Arity;
|
2010-05-10 10:22:18 +01:00
|
|
|
|
2004-08-11 17:14:55 +01:00
|
|
|
typedef YAP_Term YAP_Module;
|
|
|
|
|
2002-09-09 18:40:12 +01:00
|
|
|
typedef struct FunctorEntry *YAP_Functor;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-09-09 18:40:12 +01:00
|
|
|
typedef struct AtomEntry *YAP_Atom;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2005-05-25 19:18:02 +01:00
|
|
|
typedef double YAP_Float;
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#ifndef TRUE
|
2016-04-05 02:27:33 +01:00
|
|
|
#define TRUE 1
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
#ifndef FALSE
|
2016-04-05 02:27:33 +01:00
|
|
|
#define FALSE 0
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
|
2014-06-11 19:36:50 +01:00
|
|
|
typedef YAP_Int YAP_handle_t;
|
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
typedef struct YAP_pred_entry *YAP_PredEntryPtr;
|
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
typedef YAP_Bool (*YAP_UserCPred)(void);
|
2014-05-25 20:48:06 +01:00
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
typedef int (*YAP_agc_hook)(void *_Atom);
|
2014-05-25 20:48:06 +01:00
|
|
|
|
2013-10-03 11:25:56 +01:00
|
|
|
#include "YapError.h"
|
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
#include "../os/encoding.h"
|
2015-10-08 02:23:45 +01:00
|
|
|
|
|
|
|
typedef encoding_t YAP_encoding_t;
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
typedef struct YAP_thread_attr_struct {
|
2016-04-05 02:27:33 +01:00
|
|
|
size_t ssize;
|
|
|
|
size_t tsize;
|
|
|
|
size_t sysize;
|
|
|
|
int (*cancel)(int thread);
|
|
|
|
YAP_Term egoal, alias;
|
2014-05-25 20:48:06 +01:00
|
|
|
} YAP_thread_attr;
|
|
|
|
|
2014-06-11 19:36:50 +01:00
|
|
|
#ifdef YAP_H
|
|
|
|
#include <threads.h>
|
|
|
|
#endif
|
2014-05-25 20:48:06 +01:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef enum {
|
|
|
|
YAP_BIN = 0x0001,
|
|
|
|
YAP_TEXT = 0x0002,
|
|
|
|
YAP_SAVED_STATE = 0x0004,
|
|
|
|
YAP_OBJ = 0x0008,
|
|
|
|
YAP_PL = 0x0010,
|
|
|
|
YAP_BOOT_PL = 0x0030,
|
|
|
|
YAP_QLY = 0x0040,
|
|
|
|
YAP_EXE = 0x0080,
|
|
|
|
YAP_FOUND_BOOT_ERROR = 0x0100
|
2016-05-10 08:33:44 +01:00
|
|
|
} YAP_file_type_t;
|
|
|
|
|
|
|
|
#define YAP_ANY_FILE (0x00ff)
|
|
|
|
|
2011-10-27 11:38:22 +01:00
|
|
|
typedef enum {
|
|
|
|
YAP_TAG_ATT = 0x1,
|
|
|
|
YAP_TAG_UNBOUND = 0x2,
|
|
|
|
YAP_TAG_REF = 0x4,
|
|
|
|
YAP_TAG_PAIR = 0x8,
|
|
|
|
YAP_TAG_ATOM = 0x10,
|
|
|
|
YAP_TAG_INT = 0x20,
|
|
|
|
YAP_TAG_LONG_INT = 0x40,
|
|
|
|
YAP_TAG_BIG_INT = 0x80,
|
|
|
|
YAP_TAG_RATIONAL = 0x100,
|
|
|
|
YAP_TAG_FLOAT = 0x200,
|
|
|
|
YAP_TAG_OPAQUE = 0x400,
|
|
|
|
YAP_TAG_APPL = 0x800,
|
2016-07-31 16:31:22 +01:00
|
|
|
YAP_TAG_DBREF = 0x1000,
|
|
|
|
YAP_TAG_STRING = 0x2000,
|
|
|
|
YAP_TAG_ARRAY = 0x4000
|
2011-10-27 11:38:22 +01:00
|
|
|
} YAP_tag_t;
|
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
#define YAP_BOOT_FROM_SAVED_CODE 1
|
2001-04-09 20:54:03 +01:00
|
|
|
#define YAP_BOOT_FROM_SAVED_STACKS 2
|
2016-04-05 02:27:33 +01:00
|
|
|
#define YAP_BOOT_ERROR -1
|
|
|
|
|
|
|
|
#define YAP_WRITE_QUOTED 1
|
|
|
|
#define YAP_WRITE_IGNORE_OPS 2
|
|
|
|
#define YAP_WRITE_HANDLE_VARS 4
|
|
|
|
#define YAP_WRITE_USE_PORTRAY 8
|
|
|
|
#define YAP_WRITE_HANDLE_CYCLES 0x20
|
|
|
|
#define YAP_WRITE_BACKQUOTE_STRING 0x80
|
|
|
|
#define YAP_WRITE_ATTVAR_NONE 0x100
|
|
|
|
#define YAP_WRITE_ATTVAR_DOTS 0x200
|
|
|
|
#define YAP_WRITE_ATTVAR_PORTRAY 0x400
|
|
|
|
#define YAP_WRITE_BLOB_PORTRAY 0x800
|
|
|
|
|
|
|
|
#define YAP_CONSULT_MODE 0
|
|
|
|
#define YAP_RECONSULT_MODE 1
|
|
|
|
#define YAP_BOOT_MODE 2
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2014-04-29 18:17:23 +01:00
|
|
|
typedef struct yap_boot_params {
|
2016-05-10 08:33:44 +01:00
|
|
|
/* boot type as suggested by the user */
|
2016-07-31 16:31:22 +01:00
|
|
|
YAP_file_type_t boot_file_type;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-NULL, path where we can find the saved state */
|
2016-02-13 03:11:25 +00:00
|
|
|
const char *SavedState;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-0, minimal size for Heap or Code Area */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t HeapSize;
|
2009-05-10 18:36:55 +01:00
|
|
|
/* if NON-0, maximal size for Heap or Code Area */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t MaxHeapSize;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-0, minimal size for Local+Global Stack */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t StackSize;
|
2009-05-10 18:36:55 +01:00
|
|
|
/* if NON-0, maximal size for Local+Global Stack */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t MaxStackSize;
|
|
|
|
size_t MaxGlobalSize;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-0, minimal size for Trail */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t TrailSize;
|
2009-05-10 18:36:55 +01:00
|
|
|
/* if NON-0, maximal size for Trail */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t MaxTrailSize;
|
2009-03-27 15:15:54 +00:00
|
|
|
/* if NON-0, minimal size for AttributeVarStack */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t AttsSize;
|
2009-05-10 18:36:55 +01:00
|
|
|
/* if NON-0, maximal size for AttributeVarStack */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t MaxAttsSize;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-NULL, value for YAPLIBDIR */
|
2016-05-10 08:33:44 +01:00
|
|
|
const char *YapLibDir;
|
2002-10-30 17:27:19 +00:00
|
|
|
/* if NON-NULL, name for a Prolog file to use when booting */
|
2016-05-10 08:33:44 +01:00
|
|
|
const char *YapPrologBootFile;
|
2015-11-05 19:25:54 +00:00
|
|
|
/* if NON-NULL, name for a Prolog file to use when initializing */
|
2016-05-10 08:33:44 +01:00
|
|
|
const char *YapPrologInitGoal;
|
2016-04-05 02:27:33 +01:00
|
|
|
/* if NON-NULL, name for a Prolog file to consult before entering top-level */
|
2016-05-10 08:33:44 +01:00
|
|
|
const char *YapPrologRCFile;
|
2005-10-21 17:09:03 +01:00
|
|
|
/* if NON-NULL, a goal to run before top-level */
|
2016-05-10 08:33:44 +01:00
|
|
|
const char *YapPrologGoal;
|
2005-10-21 17:09:03 +01:00
|
|
|
/* if NON-NULL, a goal to run as top-level */
|
2016-05-10 08:33:44 +01:00
|
|
|
const char *YapPrologTopLevelGoal;
|
2005-10-28 18:38:50 +01:00
|
|
|
/* if NON-NULL, a path to extend file-search-path */
|
2016-05-10 08:33:44 +01:00
|
|
|
const char *YapPrologAddPath;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if previous NON-NULL and TRUE, halt after consulting that file */
|
2016-04-12 16:22:53 +01:00
|
|
|
bool HaltAfterConsult;
|
2002-01-27 20:40:10 +00:00
|
|
|
/* ignore .yaprc, .prolog.ini, etc. files. */
|
2016-04-12 16:22:53 +01:00
|
|
|
bool FastBoot;
|
2005-08-04 16:45:56 +01:00
|
|
|
/* the next field only interest YAPTAB */
|
|
|
|
/* if NON-0, maximum size for Table Space */
|
2016-07-31 16:31:22 +01:00
|
|
|
size_t MaxTableSpaceSize;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* the next three fields only interest YAPOR, but we keep them so that
|
|
|
|
users don't need to recompile DLL in order to use YAPOR */
|
|
|
|
/* if NON-0, number of workers we want to have (default=1) */
|
2009-08-20 02:23:52 +01:00
|
|
|
unsigned long int NumberWorkers;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-0, manage the inner scheduler loop (default = 10) */
|
2009-08-20 02:23:52 +01:00
|
|
|
unsigned long int SchedulerLoop;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-0, say how long to keep nodes (default = 3) */
|
2009-08-20 02:23:52 +01:00
|
|
|
unsigned long int DelayedReleaseLoad;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* end of YAPOR fields */
|
2016-11-24 04:35:39 +00:00
|
|
|
/* whether Prolog should handle interrupts. Note that
|
|
|
|
interrupts will always be disabled in embedded mode. */
|
|
|
|
bool PrologCannotHandleInterrupts;
|
2009-04-08 00:46:34 +01:00
|
|
|
/* flag for JIT mode */
|
|
|
|
int ExecutionMode;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* number of arguments that Prolog will see */
|
|
|
|
int Argc;
|
|
|
|
/* array of arguments as seen by Prolog */
|
|
|
|
char **Argv;
|
2016-10-20 04:38:17 +01:00
|
|
|
/* embedded in some other system: no signals, readline, etc */
|
|
|
|
bool Embedded;
|
2008-03-13 18:41:52 +00:00
|
|
|
/* QuietMode */
|
|
|
|
int QuietMode;
|
2012-06-22 09:56:01 +01:00
|
|
|
|
|
|
|
/* nf: Begin ypp preprocessor code */
|
|
|
|
#define YAP_MAX_YPP_DEFS 100
|
|
|
|
char *def_var[YAP_MAX_YPP_DEFS];
|
|
|
|
char *def_value[YAP_MAX_YPP_DEFS];
|
2016-04-05 02:27:33 +01:00
|
|
|
int def_c;
|
2012-06-22 09:56:01 +01:00
|
|
|
/* End preprocessor code */
|
|
|
|
|
2006-02-08 17:29:55 +00:00
|
|
|
#ifdef MYDDAS_MYSQL
|
|
|
|
/* If any myddas option was given */
|
|
|
|
short myddas;
|
|
|
|
/* MYDDAS Fields */
|
|
|
|
char *myddas_user;
|
|
|
|
char *myddas_pass;
|
|
|
|
char *myddas_db;
|
|
|
|
char *myddas_host;
|
|
|
|
#endif
|
2005-03-02 18:35:49 +00:00
|
|
|
/* errornumber */
|
|
|
|
int ErrorNo;
|
|
|
|
/* errorstring */
|
|
|
|
char *ErrorCause;
|
2002-09-09 18:40:12 +01:00
|
|
|
} YAP_init_args;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2014-04-29 18:43:17 +01:00
|
|
|
#ifdef YAP_H
|
2016-07-31 16:31:22 +01:00
|
|
|
YAP_file_type_t Yap_InitDefaults(YAP_init_args *init_args, char saved_state[],
|
|
|
|
int Argc, char *Argv[]);
|
2014-04-29 18:43:17 +01:00
|
|
|
#endif
|
2004-07-22 22:32:23 +01:00
|
|
|
|
2015-04-13 13:28:17 +01:00
|
|
|
/* this should be opaque to the user */
|
2007-06-04 13:28:02 +01:00
|
|
|
typedef struct {
|
2016-04-05 02:27:33 +01:00
|
|
|
unsigned long b; //> choice-point at entry
|
|
|
|
YAP_handle_t CurSlot; //> variables at entry
|
|
|
|
YAP_handle_t EndSlot; //> variables at successful execution
|
|
|
|
struct yami *p; //> Program Counter at entry
|
|
|
|
struct yami *cp; //> Continuation PC at entry
|
2007-06-04 13:28:02 +01:00
|
|
|
} YAP_dogoalinfo;
|
|
|
|
|
2015-04-13 13:28:17 +01:00
|
|
|
// query manipulation support
|
|
|
|
|
|
|
|
typedef struct open_query_struct {
|
|
|
|
int q_open;
|
|
|
|
int q_state;
|
|
|
|
YAP_handle_t q_g;
|
|
|
|
struct pred_entry *q_pe;
|
2016-04-05 02:27:33 +01:00
|
|
|
struct yami *q_p, *q_cp;
|
2015-04-13 13:28:17 +01:00
|
|
|
jmp_buf q_env;
|
|
|
|
int q_flags;
|
|
|
|
YAP_dogoalinfo q_h;
|
|
|
|
struct open_query_struct *oq;
|
|
|
|
} YAP_openQuery;
|
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
typedef void (*YAP_halt_hook)(int exit_code, void *closure);
|
2010-09-24 14:00:53 +01:00
|
|
|
|
2011-07-27 16:50:14 +01:00
|
|
|
typedef YAP_Int YAP_opaque_tag_t;
|
2011-07-22 12:09:33 +01:00
|
|
|
|
2015-01-26 04:02:46 +00:00
|
|
|
typedef YAP_Bool (*YAP_Opaque_CallOnFail)(void *);
|
2016-04-05 02:27:33 +01:00
|
|
|
typedef YAP_Bool (*YAP_Opaque_CallOnWrite)(FILE *, YAP_opaque_tag_t, void *,
|
|
|
|
int);
|
|
|
|
typedef YAP_Int (*YAP_Opaque_CallOnGCMark)(YAP_opaque_tag_t, void *, YAP_Term *,
|
|
|
|
YAP_Int);
|
|
|
|
typedef YAP_Bool (*YAP_Opaque_CallOnGCRelocate)(YAP_opaque_tag_t, void *,
|
|
|
|
YAP_Term *, YAP_Int);
|
2011-07-22 12:09:33 +01:00
|
|
|
|
|
|
|
typedef struct YAP_opaque_handler_struct {
|
2016-04-05 02:27:33 +01:00
|
|
|
YAP_Opaque_CallOnFail fail_handler;
|
2011-07-27 16:50:14 +01:00
|
|
|
YAP_Opaque_CallOnWrite write_handler;
|
2011-12-13 10:01:51 +00:00
|
|
|
YAP_Opaque_CallOnGCMark mark_handler;
|
2011-12-13 18:14:33 +00:00
|
|
|
YAP_Opaque_CallOnGCRelocate relocate_handler;
|
2011-07-22 12:09:33 +01:00
|
|
|
} YAP_opaque_handler_t;
|
|
|
|
|
2009-04-08 00:46:34 +01:00
|
|
|
/********* execution mode ***********************/
|
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
typedef enum {
|
|
|
|
YAPC_INTERPRETED, /* interpreted */
|
|
|
|
YAPC_MIXED_MODE_USER, /* mixed mode only for user predicates */
|
|
|
|
YAPC_MIXED_MODE_ALL, /* mixed mode for all predicates */
|
|
|
|
YAPC_COMPILE_USER, /* compile all user predicates*/
|
|
|
|
YAPC_COMPILE_ALL /* compile all predicates */
|
|
|
|
} yapc_exec_mode;
|
2009-04-08 00:46:34 +01:00
|
|
|
|
2015-06-19 01:30:13 +01:00
|
|
|
/** Stream Modes: */
|
|
|
|
typedef enum stream_f {
|
2016-04-05 02:27:33 +01:00
|
|
|
Free_Stream_f = 0x000001, /**< Free YAP Stream */
|
|
|
|
Input_Stream_f = 0x000002, /**< Input Stream */
|
|
|
|
Output_Stream_f = 0x000004, /**< Output Stream in Truncate Mode */
|
|
|
|
Append_Stream_f = 0x000008, /**< Output Stream in Append Mod */
|
|
|
|
Eof_Stream_f = 0x000010, /**< Stream found an EOF */
|
|
|
|
Null_Stream_f = 0x000020, /**< Stream is /dev/null, or equivant */
|
|
|
|
Tty_Stream_f = 0x000040, /**< Stream is a terminal */
|
|
|
|
Socket_Stream_f = 0x000080, /**< Socket Stream */
|
|
|
|
Binary_Stream_f = 0x000100, /**< Stream is not eof */
|
|
|
|
Eof_Error_Stream_f =
|
|
|
|
0x000200, /**< Stream should generate error on trying to read after EOF */
|
|
|
|
Reset_Eof_Stream_f =
|
|
|
|
0x000400, /**< Stream should be reset on findind an EO (C-D and console.*/
|
|
|
|
Past_Eof_Stream_f = 0x000800, /**< Read EOF from stream */
|
|
|
|
Push_Eof_Stream_f = 0x001000, /**< keep on sending EOFs */
|
|
|
|
Seekable_Stream_f =
|
|
|
|
0x002000, /**< we can jump around the stream (std regular files) */
|
|
|
|
Promptable_Stream_f = 0x004000, /**< Interactive line-by-line stream */
|
|
|
|
Client_Socket_Stream_f = 0x008000, /**< socket in client mode */
|
|
|
|
Server_Socket_Stream_f = 0x010000, /**< socket in server mode */
|
|
|
|
InMemory_Stream_f = 0x020000, /**< buffer */
|
|
|
|
Pipe_Stream_f = 0x040000, /**< FIFO buffer */
|
|
|
|
Popen_Stream_f = 0x080000, /**< popen open, pipes mosylyn */
|
|
|
|
User_Stream_f = 0x100000, /**< usually user_ipiy */
|
|
|
|
HAS_BOM_f = 0x200000, /**< media for streamhas a BOM mar. */
|
|
|
|
RepError_Prolog_f =
|
|
|
|
0x400000, /**< handle representation error as Prolog terms */
|
|
|
|
RepError_Xml_f = 0x800000, /**< handle representation error as XML objects */
|
|
|
|
DoNotCloseOnAbort_Stream_f =
|
|
|
|
0x1000000, /**< do not close the stream after an abort event */
|
|
|
|
Readline_Stream_f = 0x2000000, /**< the stream is a readline stream */
|
|
|
|
FreeOnClose_Stream_f =
|
|
|
|
0x4000000 /**< the stream buffer should be releaed on close */
|
2015-06-19 01:30:13 +01:00
|
|
|
} estream_f;
|
|
|
|
|
|
|
|
typedef uint64_t stream_flags_t;
|
|
|
|
|
2010-08-31 04:25:56 +01:00
|
|
|
/********* YAP C-Flags ***********************/
|
|
|
|
|
2016-04-05 02:27:33 +01:00
|
|
|
typedef enum {
|
|
|
|
YAPC_ENABLE_GC, /* enable or disable garbage collection */
|
|
|
|
YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
|
|
|
|
} yap_flag_gc_t;
|
2010-08-31 04:25:56 +01:00
|
|
|
|
2014-09-22 18:13:35 +01:00
|
|
|
typedef enum yap_enum_reset_t {
|
|
|
|
YAP_EXEC_ABSMI = 0,
|
|
|
|
YAP_FULL_RESET = 1,
|
|
|
|
YAP_RESET_FROM_RESTORE = 3
|
|
|
|
} yap_reset_t;
|
2014-06-11 19:36:50 +01:00
|
|
|
|
2016-07-31 16:31:22 +01:00
|
|
|
typedef bool (*YAP_ModInit_t)(void);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
YAP_ModInit_t f;
|
|
|
|
const char *s;
|
|
|
|
} YAP_delaymodule_t;
|
|
|
|
|
2014-05-25 20:48:06 +01:00
|
|
|
#endif /* _YAPDEFS_H */
|