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 *
|
|
|
|
* *
|
|
|
|
*************************************************************************/
|
|
|
|
|
2009-11-18 23:39:18 +00:00
|
|
|
#if defined(__STDC__) || defined(_MSC_VER)
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#define PROTO(X,ARGS) X ARGS
|
2005-11-05 01:28:28 +00:00
|
|
|
#define CONST const
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define PROTO(X,ARGS) X()
|
2005-11-05 01:28:28 +00:00
|
|
|
#define CONST /* empty */
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAS_YAP_H
|
|
|
|
|
|
|
|
/* Type definitions */
|
|
|
|
|
2010-05-06 16:32:41 +01:00
|
|
|
#if _WIN64
|
|
|
|
typedef unsigned long long YAP_CELL;
|
|
|
|
#else
|
|
|
|
typedef unsigned long YAP_CELL;
|
|
|
|
#endif
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-09-09 18:40:12 +01:00
|
|
|
typedef int YAP_Bool;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-09-09 18:40:12 +01:00
|
|
|
typedef YAP_CELL YAP_Term;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2010-05-10 10:22:18 +01:00
|
|
|
typedef YAP_CELL YAP_Arity;
|
|
|
|
|
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
|
|
|
|
2010-05-06 16:35:53 +01:00
|
|
|
#if _WIN64
|
2010-05-06 16:37:44 +01:00
|
|
|
typedef long long int YAP_Int;
|
2010-05-06 16:35:53 +01:00
|
|
|
|
2010-05-06 16:37:44 +01:00
|
|
|
typedef unsigned long long int YAP_UInt;
|
2010-05-06 16:35:53 +01:00
|
|
|
|
|
|
|
#else
|
2005-05-25 19:18:02 +01:00
|
|
|
typedef long int YAP_Int;
|
|
|
|
|
2006-05-16 19:37:31 +01:00
|
|
|
typedef unsigned long int YAP_UInt;
|
2010-05-06 16:35:53 +01:00
|
|
|
#endif
|
2006-05-16 19:37:31 +01:00
|
|
|
|
2005-05-25 19:18:02 +01:00
|
|
|
typedef double YAP_Float;
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#endif
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define YAP_BOOT_FROM_PROLOG 0
|
|
|
|
#define YAP_BOOT_FROM_SAVED_CODE 1
|
|
|
|
#define YAP_BOOT_FROM_SAVED_STACKS 2
|
2004-01-23 02:23:51 +00:00
|
|
|
#define YAP_FULL_BOOT_FROM_PROLOG 4
|
2005-03-02 18:35:49 +00:00
|
|
|
#define YAP_BOOT_ERROR -1
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
#define YAP_WRITE_QUOTED 0
|
|
|
|
#define YAP_WRITE_HANDLE_VARS 1
|
|
|
|
#define YAP_WRITE_IGNORE_OPS 2
|
|
|
|
|
|
|
|
#define YAP_CONSULT_MODE 0
|
|
|
|
#define YAP_RECONSULT_MODE 1
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/* if NON-NULL, path where we can find the saved state */
|
|
|
|
char *SavedState;
|
|
|
|
/* if NON-0, minimal size for Heap or Code Area */
|
2009-03-27 15:15:54 +00:00
|
|
|
unsigned long int HeapSize;
|
2009-05-10 18:36:55 +01:00
|
|
|
/* if NON-0, maximal size for Heap or Code Area */
|
|
|
|
unsigned long int MaxHeapSize;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-0, minimal size for Local+Global Stack */
|
2009-03-27 15:15:54 +00:00
|
|
|
unsigned long int StackSize;
|
2009-05-10 18:36:55 +01:00
|
|
|
/* if NON-0, maximal size for Local+Global Stack */
|
|
|
|
unsigned long int MaxStackSize;
|
|
|
|
unsigned long int MaxGlobalSize;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-0, minimal size for Trail */
|
2009-03-27 15:15:54 +00:00
|
|
|
unsigned long int TrailSize;
|
2009-05-10 18:36:55 +01:00
|
|
|
/* if NON-0, maximal size for Trail */
|
|
|
|
unsigned long int MaxTrailSize;
|
2009-03-27 15:15:54 +00:00
|
|
|
/* if NON-0, minimal size for AttributeVarStack */
|
|
|
|
unsigned long int AttsSize;
|
2009-05-10 18:36:55 +01:00
|
|
|
/* if NON-0, maximal size for AttributeVarStack */
|
|
|
|
unsigned long int MaxAttsSize;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if NON-NULL, value for YAPLIBDIR */
|
|
|
|
char *YapLibDir;
|
2002-10-30 17:27:19 +00:00
|
|
|
/* if NON-NULL, name for a Prolog file to use when booting */
|
2001-04-09 20:54:03 +01:00
|
|
|
char *YapPrologBootFile;
|
2004-01-23 02:23:51 +00:00
|
|
|
/* if NON-NULL, name for a Prolog file to use when initialising */
|
|
|
|
char *YapPrologInitFile;
|
2002-10-30 17:27:19 +00:00
|
|
|
/* if NON-NULL, name for a Prolog file to consult before entering top-level */
|
|
|
|
char *YapPrologRCFile;
|
2005-10-21 17:09:03 +01:00
|
|
|
/* if NON-NULL, a goal to run before top-level */
|
|
|
|
char *YapPrologGoal;
|
|
|
|
/* if NON-NULL, a goal to run as top-level */
|
|
|
|
char *YapPrologTopLevelGoal;
|
2005-10-28 18:38:50 +01:00
|
|
|
/* if NON-NULL, a path to extend file-search-path */
|
|
|
|
char *YapPrologAddPath;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if previous NON-NULL and TRUE, halt after consulting that file */
|
|
|
|
int HaltAfterConsult;
|
2002-01-27 20:40:10 +00:00
|
|
|
/* ignore .yaprc, .prolog.ini, etc. files. */
|
|
|
|
int FastBoot;
|
2005-08-04 16:45:56 +01:00
|
|
|
/* the next field only interest YAPTAB */
|
|
|
|
/* if NON-0, maximum size for Table Space */
|
2009-03-27 15:15:54 +00:00
|
|
|
unsigned long int 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 */
|
2004-11-18 22:32:40 +00:00
|
|
|
/* whether Prolog should handle interrupts */
|
|
|
|
int PrologShouldHandleInterrupts;
|
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;
|
2008-03-13 18:41:52 +00:00
|
|
|
/* QuietMode */
|
|
|
|
int QuietMode;
|
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
|
|
|
|
2004-07-22 22:32:23 +01:00
|
|
|
|
|
|
|
/* from thread.h */
|
|
|
|
typedef struct {
|
|
|
|
unsigned long int ssize;
|
|
|
|
unsigned long int tsize;
|
2004-08-11 17:14:55 +01:00
|
|
|
YAP_Term alias;
|
2004-07-22 22:32:23 +01:00
|
|
|
int (*cancel)(int);
|
|
|
|
} YAP_thread_attr;
|
|
|
|
|
2007-06-04 13:28:02 +01:00
|
|
|
typedef struct YAP_pred_entry *YAP_PredEntryPtr;
|
|
|
|
|
|
|
|
/* this should be opaque to the user */
|
|
|
|
typedef struct {
|
|
|
|
unsigned long b;
|
|
|
|
struct yami *p;
|
|
|
|
} YAP_dogoalinfo;
|
|
|
|
|
2010-02-10 09:03:03 +00:00
|
|
|
typedef int (*YAP_agc_hook)(void *_Atom);
|
2007-12-05 12:17:25 +00:00
|
|
|
|
2009-04-08 00:46:34 +01:00
|
|
|
/********* execution mode ***********************/
|
|
|
|
|
|
|
|
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;
|
|
|
|
|