indenting
This commit is contained in:
parent
ac71ba72b5
commit
562ac0251d
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
#define _YAPDEFS_H 1
|
#define _YAPDEFS_H 1
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <setjmp.h>
|
|
||||||
|
|
||||||
#ifdef YAP_H
|
#ifdef YAP_H
|
||||||
|
|
||||||
@ -57,10 +57,10 @@ v
|
|||||||
still widely used.
|
still widely used.
|
||||||
*/
|
*/
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE true
|
#define TRUE true
|
||||||
#endif
|
#endif
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
#define FALSE false
|
#define FALSE false
|
||||||
#endif
|
#endif
|
||||||
#ifndef YAP_Bool
|
#ifndef YAP_Bool
|
||||||
typedef bool YAP_Bool;
|
typedef bool YAP_Bool;
|
||||||
@ -78,7 +78,7 @@ typedef bool YAP_Bool;
|
|||||||
|
|
||||||
#define YAP_Module Term
|
#define YAP_Module Term
|
||||||
|
|
||||||
#define YAP_Functor Functor
|
#define YAP_Functor Functor
|
||||||
|
|
||||||
#define YAP_Atom Atom
|
#define YAP_Atom Atom
|
||||||
|
|
||||||
@ -88,13 +88,13 @@ typedef bool YAP_Bool;
|
|||||||
|
|
||||||
#define YAP_Float Float
|
#define YAP_Float Float
|
||||||
|
|
||||||
#define YAP_handle_t yhandle_t
|
#define YAP_handle_t yhandle_t
|
||||||
|
|
||||||
#define YAP_PredEntryPtr struct pred_entry *
|
#define YAP_PredEntryPtr struct pred_entry *
|
||||||
|
|
||||||
#define YAP_UserCPred CPredicate
|
#define YAP_UserCPred CPredicate
|
||||||
|
|
||||||
#define YAP_agc_hook Agc_hook
|
#define YAP_agc_hook Agc_hook
|
||||||
|
|
||||||
#define YAP_encoding_t encoding_t
|
#define YAP_encoding_t encoding_t
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ typedef bool YAP_Bool;
|
|||||||
/* Type definitions */
|
/* Type definitions */
|
||||||
|
|
||||||
#if _WIN64
|
#if _WIN64
|
||||||
typedef unsigned long long YAP_CELL;
|
typedef unsigned long long YAP_CELL;
|
||||||
#else
|
#else
|
||||||
typedef uintptr_t YAP_CELL;
|
typedef uintptr_t YAP_CELL;
|
||||||
#endif
|
#endif
|
||||||
@ -121,47 +121,45 @@ typedef struct AtomEntry *YAP_Atom;
|
|||||||
#if _WIN64
|
#if _WIN64
|
||||||
typedef long long int YAP_Int;
|
typedef long long int YAP_Int;
|
||||||
|
|
||||||
typedef unsigned long long int YAP_UInt;
|
typedef unsigned long long int YAP_UInt;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
typedef long int YAP_Int;
|
typedef long int YAP_Int;
|
||||||
|
|
||||||
typedef unsigned long int YAP_UInt;
|
typedef unsigned long int YAP_UInt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef double YAP_Float;
|
typedef double YAP_Float;
|
||||||
|
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef YAP_Int YAP_handle_t;
|
typedef YAP_Int YAP_handle_t;
|
||||||
|
|
||||||
typedef struct YAP_pred_entry *YAP_PredEntryPtr;
|
typedef struct YAP_pred_entry *YAP_PredEntryPtr;
|
||||||
|
|
||||||
typedef YAP_Bool (* YAP_UserCPred)(void);
|
typedef YAP_Bool (*YAP_UserCPred)(void);
|
||||||
|
|
||||||
typedef int (*YAP_agc_hook)(void *_Atom);
|
typedef int (*YAP_agc_hook)(void *_Atom);
|
||||||
|
|
||||||
#include "YapError.h"
|
#include "YapError.h"
|
||||||
|
|
||||||
#include <../os/encoding.h>
|
#include "../os/encoding.h"
|
||||||
|
|
||||||
typedef encoding_t YAP_encoding_t;
|
typedef encoding_t YAP_encoding_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct YAP_thread_attr_struct {
|
typedef struct YAP_thread_attr_struct {
|
||||||
size_t ssize;
|
size_t ssize;
|
||||||
size_t tsize;
|
size_t tsize;
|
||||||
size_t sysize;
|
size_t sysize;
|
||||||
int (*cancel)(int thread);
|
int (*cancel)(int thread);
|
||||||
YAP_Term egoal, alias;
|
YAP_Term egoal, alias;
|
||||||
} YAP_thread_attr;
|
} YAP_thread_attr;
|
||||||
|
|
||||||
#ifdef YAP_H
|
#ifdef YAP_H
|
||||||
@ -184,27 +182,27 @@ typedef enum {
|
|||||||
YAP_TAG_DBREF = 0x1000
|
YAP_TAG_DBREF = 0x1000
|
||||||
} YAP_tag_t;
|
} YAP_tag_t;
|
||||||
|
|
||||||
#define YAP_BOOT_FROM_PROLOG 0
|
#define YAP_BOOT_FROM_PROLOG 0
|
||||||
#define YAP_BOOT_FROM_SAVED_CODE 1
|
#define YAP_BOOT_FROM_SAVED_CODE 1
|
||||||
#define YAP_BOOT_FROM_SAVED_STACKS 2
|
#define YAP_BOOT_FROM_SAVED_STACKS 2
|
||||||
#define YAP_FULL_BOOT_FROM_PROLOG 4
|
#define YAP_FULL_BOOT_FROM_PROLOG 4
|
||||||
#define YAP_BOOT_DONE_BEFOREHAND 8
|
#define YAP_BOOT_DONE_BEFOREHAND 8
|
||||||
#define YAP_BOOT_ERROR -1
|
#define YAP_BOOT_ERROR -1
|
||||||
|
|
||||||
#define YAP_WRITE_QUOTED 1
|
#define YAP_WRITE_QUOTED 1
|
||||||
#define YAP_WRITE_IGNORE_OPS 2
|
#define YAP_WRITE_IGNORE_OPS 2
|
||||||
#define YAP_WRITE_HANDLE_VARS 4
|
#define YAP_WRITE_HANDLE_VARS 4
|
||||||
#define YAP_WRITE_USE_PORTRAY 8
|
#define YAP_WRITE_USE_PORTRAY 8
|
||||||
#define YAP_WRITE_HANDLE_CYCLES 0x20
|
#define YAP_WRITE_HANDLE_CYCLES 0x20
|
||||||
#define YAP_WRITE_BACKQUOTE_STRING 0x80
|
#define YAP_WRITE_BACKQUOTE_STRING 0x80
|
||||||
#define YAP_WRITE_ATTVAR_NONE 0x100
|
#define YAP_WRITE_ATTVAR_NONE 0x100
|
||||||
#define YAP_WRITE_ATTVAR_DOTS 0x200
|
#define YAP_WRITE_ATTVAR_DOTS 0x200
|
||||||
#define YAP_WRITE_ATTVAR_PORTRAY 0x400
|
#define YAP_WRITE_ATTVAR_PORTRAY 0x400
|
||||||
#define YAP_WRITE_BLOB_PORTRAY 0x800
|
#define YAP_WRITE_BLOB_PORTRAY 0x800
|
||||||
|
|
||||||
#define YAP_CONSULT_MODE 0
|
#define YAP_CONSULT_MODE 0
|
||||||
#define YAP_RECONSULT_MODE 1
|
#define YAP_RECONSULT_MODE 1
|
||||||
#define YAP_BOOT_MODE 2
|
#define YAP_BOOT_MODE 2
|
||||||
|
|
||||||
typedef struct yap_boot_params {
|
typedef struct yap_boot_params {
|
||||||
/* if NON-NULL, path where we can find the saved state */
|
/* if NON-NULL, path where we can find the saved state */
|
||||||
@ -232,8 +230,8 @@ typedef struct yap_boot_params {
|
|||||||
/* if NON-NULL, name for a Prolog file to use when booting */
|
/* if NON-NULL, name for a Prolog file to use when booting */
|
||||||
char *YapPrologBootFile;
|
char *YapPrologBootFile;
|
||||||
/* if NON-NULL, name for a Prolog file to use when initializing */
|
/* if NON-NULL, name for a Prolog file to use when initializing */
|
||||||
char *YapPrologInitFile;
|
char *YapPrologInitGoal;
|
||||||
/* if NON-NULL, name for a Prolog file to consult before entering top-level */
|
/* if NON-NULL, name for a Prolog file to consult before entering top-level */
|
||||||
char *YapPrologRCFile;
|
char *YapPrologRCFile;
|
||||||
/* if NON-NULL, a goal to run before top-level */
|
/* if NON-NULL, a goal to run before top-level */
|
||||||
char *YapPrologGoal;
|
char *YapPrologGoal;
|
||||||
@ -272,7 +270,7 @@ typedef struct yap_boot_params {
|
|||||||
#define YAP_MAX_YPP_DEFS 100
|
#define YAP_MAX_YPP_DEFS 100
|
||||||
char *def_var[YAP_MAX_YPP_DEFS];
|
char *def_var[YAP_MAX_YPP_DEFS];
|
||||||
char *def_value[YAP_MAX_YPP_DEFS];
|
char *def_value[YAP_MAX_YPP_DEFS];
|
||||||
int def_c;
|
int def_c;
|
||||||
/* End preprocessor code */
|
/* End preprocessor code */
|
||||||
|
|
||||||
#ifdef MYDDAS_MYSQL
|
#ifdef MYDDAS_MYSQL
|
||||||
@ -291,19 +289,18 @@ typedef struct yap_boot_params {
|
|||||||
} YAP_init_args;
|
} YAP_init_args;
|
||||||
|
|
||||||
#ifdef YAP_H
|
#ifdef YAP_H
|
||||||
Int Yap_InitDefaults( YAP_init_args *init_args, char saved_state[] );
|
Int Yap_InitDefaults(YAP_init_args *init_args, char saved_state[]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this should be opaque to the user */
|
/* this should be opaque to the user */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned long b; //> choice-point at entry
|
unsigned long b; //> choice-point at entry
|
||||||
YAP_handle_t CurSlot; //> variables at entry
|
YAP_handle_t CurSlot; //> variables at entry
|
||||||
YAP_handle_t EndSlot; //> variables at successful execution
|
YAP_handle_t EndSlot; //> variables at successful execution
|
||||||
struct yami *p; //> Program Counter at entry
|
struct yami *p; //> Program Counter at entry
|
||||||
struct yami *cp; //> Continuation PC at entry
|
struct yami *cp; //> Continuation PC at entry
|
||||||
} YAP_dogoalinfo;
|
} YAP_dogoalinfo;
|
||||||
|
|
||||||
|
|
||||||
// query manipulation support
|
// query manipulation support
|
||||||
|
|
||||||
typedef struct open_query_struct {
|
typedef struct open_query_struct {
|
||||||
@ -311,24 +308,27 @@ typedef struct open_query_struct {
|
|||||||
int q_state;
|
int q_state;
|
||||||
YAP_handle_t q_g;
|
YAP_handle_t q_g;
|
||||||
struct pred_entry *q_pe;
|
struct pred_entry *q_pe;
|
||||||
struct yami *q_p, *q_cp;
|
struct yami *q_p, *q_cp;
|
||||||
jmp_buf q_env;
|
jmp_buf q_env;
|
||||||
int q_flags;
|
int q_flags;
|
||||||
YAP_dogoalinfo q_h;
|
YAP_dogoalinfo q_h;
|
||||||
struct open_query_struct *oq;
|
struct open_query_struct *oq;
|
||||||
} YAP_openQuery;
|
} YAP_openQuery;
|
||||||
|
|
||||||
typedef void (*YAP_halt_hook)(int exit_code, void *closure);
|
typedef void (*YAP_halt_hook)(int exit_code, void *closure);
|
||||||
|
|
||||||
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)(void *);
|
||||||
typedef YAP_Bool (*YAP_Opaque_CallOnWrite)(FILE *, YAP_opaque_tag_t, void *, int);
|
typedef YAP_Bool (*YAP_Opaque_CallOnWrite)(FILE *, YAP_opaque_tag_t, void *,
|
||||||
typedef YAP_Int (*YAP_Opaque_CallOnGCMark)(YAP_opaque_tag_t, void *, YAP_Term *, YAP_Int);
|
int);
|
||||||
typedef YAP_Bool (*YAP_Opaque_CallOnGCRelocate)(YAP_opaque_tag_t, void *, YAP_Term *, YAP_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);
|
||||||
|
|
||||||
typedef struct YAP_opaque_handler_struct {
|
typedef struct YAP_opaque_handler_struct {
|
||||||
YAP_Opaque_CallOnFail fail_handler;
|
YAP_Opaque_CallOnFail fail_handler;
|
||||||
YAP_Opaque_CallOnWrite write_handler;
|
YAP_Opaque_CallOnWrite write_handler;
|
||||||
YAP_Opaque_CallOnGCMark mark_handler;
|
YAP_Opaque_CallOnGCMark mark_handler;
|
||||||
YAP_Opaque_CallOnGCRelocate relocate_handler;
|
YAP_Opaque_CallOnGCRelocate relocate_handler;
|
||||||
@ -336,62 +336,64 @@ typedef struct YAP_opaque_handler_struct {
|
|||||||
|
|
||||||
/********* execution mode ***********************/
|
/********* execution mode ***********************/
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
YAPC_INTERPRETED, /* interpreted */
|
||||||
YAPC_INTERPRETED, /* interpreted */
|
YAPC_MIXED_MODE_USER, /* mixed mode only for user predicates */
|
||||||
YAPC_MIXED_MODE_USER, /* mixed mode only for user predicates */
|
YAPC_MIXED_MODE_ALL, /* mixed mode for all predicates */
|
||||||
YAPC_MIXED_MODE_ALL, /* mixed mode for all predicates */
|
YAPC_COMPILE_USER, /* compile all user predicates*/
|
||||||
YAPC_COMPILE_USER, /* compile all user predicates*/
|
YAPC_COMPILE_ALL /* compile all predicates */
|
||||||
YAPC_COMPILE_ALL /* compile all predicates */
|
} yapc_exec_mode;
|
||||||
} yapc_exec_mode;
|
|
||||||
|
|
||||||
/** Stream Modes: */
|
/** Stream Modes: */
|
||||||
typedef enum stream_f {
|
typedef enum stream_f {
|
||||||
Free_Stream_f = 0x000001, /**< Free YAP Stream */
|
Free_Stream_f = 0x000001, /**< Free YAP Stream */
|
||||||
Input_Stream_f = 0x000002, /**< Input Stream */
|
Input_Stream_f = 0x000002, /**< Input Stream */
|
||||||
Output_Stream_f = 0x000004, /**< Output Stream in Truncate Mode */
|
Output_Stream_f = 0x000004, /**< Output Stream in Truncate Mode */
|
||||||
Append_Stream_f = 0x000008, /**< Output Stream in Append Mod */
|
Append_Stream_f = 0x000008, /**< Output Stream in Append Mod */
|
||||||
Eof_Stream_f = 0x000010, /**< Stream found an EOF */
|
Eof_Stream_f = 0x000010, /**< Stream found an EOF */
|
||||||
Null_Stream_f = 0x000020, /**< Stream is /dev/null, or equivant */
|
Null_Stream_f = 0x000020, /**< Stream is /dev/null, or equivant */
|
||||||
Tty_Stream_f = 0x000040, /**< Stream is a terminal */
|
Tty_Stream_f = 0x000040, /**< Stream is a terminal */
|
||||||
Socket_Stream_f = 0x000080, /**< Socket Stream */
|
Socket_Stream_f = 0x000080, /**< Socket Stream */
|
||||||
Binary_Stream_f = 0x000100, /**< Stream is not eof */
|
Binary_Stream_f = 0x000100, /**< Stream is not eof */
|
||||||
Eof_Error_Stream_f = 0x000200, /**< Stream should generate error on trying to read after EOF */
|
Eof_Error_Stream_f =
|
||||||
Reset_Eof_Stream_f = 0x000400, /**< Stream should be reset on findind an EO (C-D and console.*/
|
0x000200, /**< Stream should generate error on trying to read after EOF */
|
||||||
Past_Eof_Stream_f = 0x000800, /**< Read EOF from stream */
|
Reset_Eof_Stream_f =
|
||||||
Push_Eof_Stream_f = 0x001000, /**< keep on sending EOFs */
|
0x000400, /**< Stream should be reset on findind an EO (C-D and console.*/
|
||||||
Seekable_Stream_f = 0x002000, /**< we can jump around the stream (std regular files) */
|
Past_Eof_Stream_f = 0x000800, /**< Read EOF from stream */
|
||||||
Promptable_Stream_f = 0x004000, /**< Interactive line-by-line stream */
|
Push_Eof_Stream_f = 0x001000, /**< keep on sending EOFs */
|
||||||
Client_Socket_Stream_f= 0x008000, /**< socket in client mode */
|
Seekable_Stream_f =
|
||||||
Server_Socket_Stream_f= 0x010000, /**< socket in server mode */
|
0x002000, /**< we can jump around the stream (std regular files) */
|
||||||
InMemory_Stream_f = 0x020000, /**< buffer */
|
Promptable_Stream_f = 0x004000, /**< Interactive line-by-line stream */
|
||||||
Pipe_Stream_f = 0x040000, /**< FIFO buffer */
|
Client_Socket_Stream_f = 0x008000, /**< socket in client mode */
|
||||||
Popen_Stream_f = 0x080000, /**< popen open, pipes mosylyn */
|
Server_Socket_Stream_f = 0x010000, /**< socket in server mode */
|
||||||
User_Stream_f = 0x100000, /**< usually user_ipiy */
|
InMemory_Stream_f = 0x020000, /**< buffer */
|
||||||
HAS_BOM_f = 0x200000, /**< media for streamhas a BOM mar. */
|
Pipe_Stream_f = 0x040000, /**< FIFO buffer */
|
||||||
RepError_Prolog_f = 0x400000, /**< handle representation error as Prolog terms */
|
Popen_Stream_f = 0x080000, /**< popen open, pipes mosylyn */
|
||||||
RepError_Xml_f = 0x800000, /**< handle representation error as XML objects */
|
User_Stream_f = 0x100000, /**< usually user_ipiy */
|
||||||
DoNotCloseOnAbort_Stream_f= 0x1000000, /**< do not close the stream after an abort event */
|
HAS_BOM_f = 0x200000, /**< media for streamhas a BOM mar. */
|
||||||
Readline_Stream_f= 0x2000000, /**< the stream is a readline stream */
|
RepError_Prolog_f =
|
||||||
FreeOnClose_Stream_f= 0x4000000 /**< the stream buffer should be releaed on close */
|
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 */
|
||||||
} estream_f;
|
} estream_f;
|
||||||
|
|
||||||
typedef uint64_t stream_flags_t;
|
typedef uint64_t stream_flags_t;
|
||||||
|
|
||||||
|
|
||||||
/********* YAP C-Flags ***********************/
|
/********* YAP C-Flags ***********************/
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
YAPC_ENABLE_GC, /* enable or disable garbage collection */
|
||||||
YAPC_ENABLE_GC, /* enable or disable garbage collection */
|
YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
|
||||||
YAPC_ENABLE_AGC /* enable or disable atom garbage collection */
|
} yap_flag_gc_t;
|
||||||
} yap_flag_gc_t;
|
|
||||||
|
|
||||||
typedef enum yap_enum_reset_t {
|
typedef enum yap_enum_reset_t {
|
||||||
YAP_EXEC_ABSMI = 0,
|
YAP_EXEC_ABSMI = 0,
|
||||||
YAP_FULL_RESET = 1,
|
YAP_FULL_RESET = 1,
|
||||||
YAP_RESET_FROM_RESTORE = 3
|
YAP_RESET_FROM_RESTORE = 3
|
||||||
} yap_reset_t;
|
} yap_reset_t;
|
||||||
\
|
|
||||||
|
|
||||||
#endif /* _YAPDEFS_H */
|
#endif /* _YAPDEFS_H */
|
||||||
|
Reference in New Issue
Block a user