diff --git a/packages/PLStream/atoms.h b/packages/PLStream/atoms.h index 0de6c8396..a1849a08e 100644 --- a/packages/PLStream/atoms.h +++ b/packages/PLStream/atoms.h @@ -342,6 +342,7 @@ #define ATOM_natural MK_ATOM("natural") #define ATOM_newline MK_ATOM("newline") #define ATOM_nil MK_ATOM("[]") +#define ATOM_nlink MK_ATOM("nlink") #define ATOM_no_memory MK_ATOM("no_memory") #define ATOM_nodebug MK_ATOM("nodebug") #define ATOM_non_empty_list MK_ATOM("non_empty_list") @@ -593,6 +594,8 @@ #define ATOM_yfx MK_ATOM("yfx") #define ATOM_yfy MK_ATOM("yfy") #define ATOM_zero_divisor MK_ATOM("zero_divisor") + + #define FUNCTOR_abs1 MKFUNCTOR(ATOM_abs,1) #define FUNCTOR_access1 MKFUNCTOR(ATOM_access,1) #define FUNCTOR_acos1 MKFUNCTOR(ATOM_acos,1) @@ -714,6 +717,7 @@ #define FUNCTOR_mode1 MKFUNCTOR(ATOM_mode,1) #define FUNCTOR_msb1 MKFUNCTOR(ATOM_msb,1) #define FUNCTOR_newline1 MKFUNCTOR(ATOM_newline,1) +#define FUNCTOR_nlink1 MKFUNCTOR(ATOM_nlink,1) #define FUNCTOR_not_implemented2 MKFUNCTOR(ATOM_not_implemented,2) #define FUNCTOR_not_provable1 MKFUNCTOR(ATOM_not_provable,1) #define FUNCTOR_occurs_check2 MKFUNCTOR(ATOM_occurs_check,2) diff --git a/packages/PLStream/pl-incl.h b/packages/PLStream/pl-incl.h index 461e0db12..ecd9b32f3 100644 --- a/packages/PLStream/pl-incl.h +++ b/packages/PLStream/pl-incl.h @@ -37,7 +37,7 @@ typedef int bool; *********************************/ #include "pl-table.h" -#include "pl-stream.h" +#include "SWI-Stream.h" #include "pl-os.h" #include "pl-error.h" @@ -53,6 +53,12 @@ typedef int bool; #include "pl-opts.h" + /******************************* + * LIST BUILDING * + *******************************/ + +#include "pl-privitf.h" + // numbers typedef enum @@ -94,6 +100,10 @@ typedef struct { int io_initialised; cleanup_status cleaning; /* Inside PL_cleanup() */ + struct + { Table table; /* global (read-only) features */ + } prolog_flag; + struct { TempFile _tmpfile_head; TempFile _tmpfile_tail; @@ -122,6 +132,15 @@ extern gds_t gds; #define GD (&gds) #define GLOBAL_LD (&gds) +typedef struct +{ unsigned long flags; /* Fast access to some boolean Prolog flags */ +} pl_features_t; + +#define truePrologFlag(flag) true(&LD->prolog_flag.mask, flag) +#define setPrologFlagMask(flag) set(&LD->prolog_flag.mask, flag) +#define clearPrologFlagMask(flag) clear(&LD->prolog_flag.mask, flag) + + // LOCAL variables (heap will get this form LOCAL #define FT_ATOM 0 /* atom feature */ @@ -134,9 +153,28 @@ extern gds_t gds; #define FF_READONLY 0x10 /* feature is read-only */ #define FF_KEEP 0x20 /* keep value it already set */ -typedef struct -{ unsigned long flags; /* the feature flags */ -} pl_features_t; +#define PLFLAG_CHARESCAPE 0x000001 /* handle \ in atoms */ +#define PLFLAG_GC 0x000002 /* do GC */ +#define PLFLAG_TRACE_GC 0x000004 /* verbose gc */ +#define PLFLAG_TTY_CONTROL 0x000008 /* allow for tty control */ +#define PLFLAG_READLINE 0x000010 /* readline is loaded */ +#define PLFLAG_DEBUG_ON_ERROR 0x000020 /* start tracer on error */ +#define PLFLAG_REPORT_ERROR 0x000040 /* print error message */ +#define PLFLAG_FILE_CASE 0x000080 /* file names are case sensitive */ +#define PLFLAG_FILE_CASE_PRESERVING 0x000100 /* case preserving file names */ +#define PLFLAG_DOS_FILE_NAMES 0x000200 /* dos (8+3) file names */ +#define ALLOW_VARNAME_FUNCTOR 0x000400 /* Read Foo(x) as 'Foo'(x) */ +#define PLFLAG_ISO 0x000800 /* Strict ISO compliance */ +#define PLFLAG_OPTIMISE 0x001000 /* -O: optimised compilation */ +#define PLFLAG_FILEVARS 0x002000 /* Expand $var and ~ in filename */ +#define PLFLAG_AUTOLOAD 0x004000 /* do autoloading */ +#define PLFLAG_CHARCONVERSION 0x008000 /* do character-conversion */ +#define PLFLAG_LASTCALL 0x010000 /* Last call optimization enabled? */ +#define PLFLAG_EX_ABORT 0x020000 /* abort with exception */ +#define PLFLAG_BACKQUOTED_STRING 0x040000 /* `a string` */ +#define PLFLAG_SIGNALS 0x080000 /* Handle signals */ +#define PLFLAG_DEBUGINFO 0x100000 /* generate debug info */ +#define PLFLAG_FILEERRORS 0x200000 /* Edinburgh file errors */ typedef enum { OCCURS_CHECK_FALSE = 0, @@ -213,6 +251,13 @@ typedef struct PL_local_data { int next; /* prompt on next read operation */ } prompt; + struct + { Table table; /* Feature table */ + pl_features_t mask; /* Masked access to booleans */ + int write_attributes; /* how to write attvars? */ + occurs_check_t occurs_check; /* Unify and occurs check */ + } prolog_flag; + IOENC encoding; /* default I/O encoding */ struct @@ -298,7 +343,6 @@ extern int ttymode; #define FILE_CASE_FEATURE 0x00080 /* file names are case sensitive */ #define FILE_CASE_PRESERVING_FEATURE 0x0100 /* case preserving file names */ #define DOS_FILE_NAMES_FEATURE 0x00200 /* dos (8+3) file names */ -#define ALLOW_VARNAME_FUNCTOR 0x00400 /* Read Foo(x) as 'Foo'(x) */ #define ISO_FEATURE 0x00800 /* Strict ISO compliance */ #define OPTIMISE_FEATURE 0x01000 /* -O: optimised compilation */ #define FILEVARS_FEATURE 0x02000 /* Expand $var and ~ in filename */ diff --git a/packages/PLStream/pl-stream.c b/packages/PLStream/pl-stream.c index 57de83858..976eade6f 100644 --- a/packages/PLStream/pl-stream.c +++ b/packages/PLStream/pl-stream.c @@ -70,7 +70,7 @@ locking is required. #define PL_KERNEL 1 #include typedef wchar_t pl_wchar_t; -#include "pl-stream.h" +#include "SWI-Stream.h" #include "pl-utf8.h" #include #ifdef HAVE_SYS_TIME_H