update to newer pl-file.c and pl-write.c.
This commit is contained in:
parent
5ae2ccc416
commit
e85e76cd57
@ -4173,7 +4173,7 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
||||
}
|
||||
/*
|
||||
* debug for(save_total=1; save_total<=N; ++save_total)
|
||||
* plwrite(XREGS[save_total],NULL,30,0,0);
|
||||
* plwrite(XREGS[save_total],NULL,30,0,0,0);
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
3
C/init.c
3
C/init.c
@ -1005,9 +1005,12 @@ InitLogDBErasedMarker(void)
|
||||
static void
|
||||
InitSWIAtoms(void)
|
||||
{
|
||||
extern atom_t ATOM_;
|
||||
|
||||
int i=0, j=0;
|
||||
#include "iswiatoms.h"
|
||||
Yap_InitSWIHash();
|
||||
ATOM_ = PL_new_atom("");
|
||||
}
|
||||
|
||||
static void
|
||||
|
8
H/Yap.h
8
H/Yap.h
@ -121,6 +121,14 @@
|
||||
#define DUMMY_FILLER_FOR_ABS_TYPE int dummy;
|
||||
#endif /* HAVE_GCC */
|
||||
|
||||
#ifdef HAVE___BUILTIN_EXPECT
|
||||
#define likely(x) __builtin_expect((x), 1)
|
||||
#define unlikely(x) __builtin_expect((x), 0)
|
||||
#else
|
||||
#define likely(x) (x)
|
||||
#define unlikely(x) (x)
|
||||
#endif
|
||||
|
||||
#ifdef THREADS
|
||||
#if USE_PTHREAD_LOCKING
|
||||
#ifndef _XOPEN_SOURCE
|
||||
|
@ -8,7 +8,9 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$aborted");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("abs");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("access");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("access_level");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("acos");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("acosh");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("acyclic_term");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("add_import");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("address");
|
||||
@ -32,6 +34,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("as");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("ascii");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("asin");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("asinh");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("assert");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("asserta");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("at");
|
||||
@ -43,6 +46,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("@<");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("@=<");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("atan");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("atanh");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("atan2");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("atom");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("atom_garbage_collection");
|
||||
@ -56,8 +60,10 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("\\");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("backtrace");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("|");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("base");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("begin");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("binary");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("binary_stream");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("bind");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("\\/");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("blobs");
|
||||
@ -67,6 +73,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("boolean");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("brace_term_position");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("break");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("break_level");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("btree");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("buffer");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("buffer_size");
|
||||
@ -80,6 +87,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("canceled");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("case_sensitive_file_names");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("catch");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("category");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("ceil");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("ceiling");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("char_type");
|
||||
@ -90,7 +98,9 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("chdir");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("chmod");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("choice");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("class");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("clause");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("clauses");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("clause_reference");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("close");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("close_on_abort");
|
||||
@ -109,9 +119,11 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("context");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("context_module");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("continue");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("copysign");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("core");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("core_left");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("cos");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("cosh");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("cputime");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("create");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("csym");
|
||||
@ -127,6 +139,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("cut_parent");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("cut");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("cyclic_term");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("cycles");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$and");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("date");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("db_reference");
|
||||
@ -137,8 +150,10 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$cut");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("dde_error");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("dde_handle");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("deadline");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("debug");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("debug_on_error");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("debug_topic");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("debugger_print_options");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("debugger_show_context");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("debugging");
|
||||
@ -170,11 +185,13 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("double_quotes");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("**");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$profile_node");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$query_loop");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$recover_and_rethrow");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$stream");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$thread_init");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$throw");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$time");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$toplevel");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$VAR$");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$wakeup");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("dynamic");
|
||||
@ -268,9 +285,8 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("hash");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("hashed");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("^");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("heap");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("heaplimit");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("heapused");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("heap_gc");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("help");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("hidden");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("hide_childs");
|
||||
@ -278,6 +294,8 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("->");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("ignore");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("ignore_ops");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("import_into");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("import_type");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("imported");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("imported_procedure");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("index");
|
||||
@ -312,9 +330,11 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom(">=");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("level");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("li");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("library");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("limit");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("line");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("line_count");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("line_position");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("list");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("list_position");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("listing");
|
||||
@ -329,6 +349,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("log");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("log10");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("long");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("loose");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("low");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("lower");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("lsb");
|
||||
@ -342,6 +363,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("max_depth");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("max_files");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("max_frame_size");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("max_length");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("max_path_length");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("max_size");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("max_variable_length");
|
||||
@ -361,6 +383,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("mode");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("modify");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("module");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("module_class");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("module_property");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("module_transparent");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("modules");
|
||||
@ -391,6 +414,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("not_unique");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("number");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("number_of_clauses");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("number_of_rules");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("numbervar_option");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("numbervars");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("occurs_check");
|
||||
@ -405,6 +429,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("or");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("order");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("output");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("owner");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("pair");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("paren");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("parent");
|
||||
@ -423,6 +448,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("+");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("popcount");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("portray");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("portray_goal");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("position");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("posix");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("powm");
|
||||
@ -433,6 +459,8 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("priority");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("private_procedure");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("procedure");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("process_comment");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("process_cputime");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("profile_mode");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("profile_no_cpu_time");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("profile_node");
|
||||
@ -457,6 +485,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("quoted");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("radix");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("random");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("random_float");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("random_option");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("rational");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("rationalize");
|
||||
@ -472,6 +501,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("record_position");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("redefine");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("redo");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("redo_in_skip");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("references");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("rem");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("rename");
|
||||
@ -489,6 +519,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("runtime");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("save_class");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("save_option");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("see");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("seed");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("seek_method");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("select");
|
||||
@ -501,15 +532,18 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("shared_object");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("shared_object_handle");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("shell");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("shift_time");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("sign");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("signal");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("signal_handler");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("silent");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("sin");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("singletons");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("sinh");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("size");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("size_t");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("skip");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("skipped");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("<");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("=<");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("*->");
|
||||
@ -528,6 +562,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("*");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("start");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("stat");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("state");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("static_procedure");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("statistics");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("status");
|
||||
@ -538,9 +573,11 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("stream_pair");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("$stream_position");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("stream_property");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("stream_type_check");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("==");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("string");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("string_position");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("strong");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("subterm_positions");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("suffix");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("syntax_error");
|
||||
@ -551,15 +588,19 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("system_thread_id");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("system_time");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("tan");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("tanh");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("temporary_files");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("term");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("term_expansion");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("term_position");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("terminal");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("terminal_capability");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("test");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("text");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("text_stream");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("thread");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("thread_cputime");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("thread_get_message_option");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("thread_initialization");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("thread_local");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("thread_local_procedure");
|
||||
@ -637,6 +678,7 @@
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("wakeup");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("walltime");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("warning");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("weak");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("wchar_t");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("when_condition");
|
||||
SWI_Atoms[i++] = Yap_LookupAtom("white");
|
||||
@ -656,15 +698,18 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_abs),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_access),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_acos),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_acosh),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_alias),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_and),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_ar_equals),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_ar_not_equal),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_asin),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_asinh),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_assert),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_asserta),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_atan),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_atan),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_atanh),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_atan2),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_atom),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_att),3);
|
||||
@ -686,6 +731,7 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_ceiling),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_chars),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_chars),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_class),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_clause),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_close_on_abort),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_close_on_exec),1);
|
||||
@ -694,7 +740,9 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_colon),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_comma),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_context),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_copysign),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_cos),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_cosh),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_cputime),0);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_curl),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_cut_call),1);
|
||||
@ -762,7 +810,9 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_ground),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_hat),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_ifthen),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_import_into),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_input),0);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_input),3);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_integer),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_interrupt),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_io_error),2);
|
||||
@ -792,6 +842,7 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_nonvar),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_not_implemented),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_not_provable),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_not_strict_equal),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_occurs_check),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_or),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_output),0);
|
||||
@ -806,14 +857,17 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_powm),3);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_print),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_print_message),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_priority),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_procedure),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_prove),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_prove),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_punct),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_random),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_random_float),0);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_rational),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_rationalize),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_rdiv),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_redo),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_rem),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_reposition),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_representation_error),1);
|
||||
@ -831,6 +885,7 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_signal),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_sin),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_singletons),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_sinh),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_size),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_smaller),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_smaller_equal),2);
|
||||
@ -848,6 +903,7 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_syntax_error),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_syntax_error),3);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_tan),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_tanh),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_term_expansion),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_term_position),5);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_timeout),1);
|
||||
@ -868,3 +924,4 @@
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_warning),3);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_xor),2);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_xpceref),1);
|
||||
SWI_Functors[j++] = Yap_MkFunctor(SWIAtomToAtom(ATOM_xpceref),2);
|
||||
|
@ -163,6 +163,7 @@ typedef struct PL_local_data {
|
||||
{ IOSTREAM *streams[6]; /* handles for standard streams */
|
||||
struct input_context *input_stack; /* maintain input stream info */
|
||||
struct output_context *output_stack; /* maintain output stream info */
|
||||
st_check stream_type_check; /* Check bin/text streams? */
|
||||
} IO;
|
||||
|
||||
struct
|
||||
@ -253,35 +254,6 @@ extern PL_local_data_t lds;
|
||||
|
||||
#define exception_term (LD->exception.term)
|
||||
|
||||
// THIS HAS TO BE ABSTRACTED
|
||||
|
||||
#define GLOBAL_LD (LOCAL_PL_local_data_p)
|
||||
|
||||
#if !defined(O_PLMT) && !defined(YAPOR)
|
||||
#define LOCAL_LD (GLOBAL_LD)
|
||||
#define LD (GLOBAL_LD)
|
||||
#define ARG1_LD void
|
||||
#define ARG_LD
|
||||
#define GET_LD
|
||||
#define PRED_LD
|
||||
#define PASS_LD
|
||||
#define PASS_LD1
|
||||
|
||||
#else
|
||||
|
||||
#define LOCAL_LD (__PL_ld)
|
||||
#define LD LOCAL_LD
|
||||
|
||||
#define GET_LD CACHE_REGS PL_local_data_t *__PL_ld = GLOBAL_LD;
|
||||
#define ARG1_LD PL_local_data_t *__PL_ld
|
||||
|
||||
#define ARG_LD , ARG1_LD
|
||||
#define PASS_LD1 LD
|
||||
#define PASS_LD , LD
|
||||
#define PRED_LD GET_LD
|
||||
|
||||
#endif
|
||||
|
||||
#define Suser_input (LD->IO.streams[0])
|
||||
#define Suser_output (LD->IO.streams[1])
|
||||
#define Suser_error (LD->IO.streams[2])
|
||||
|
93
H/pl-incl.h
93
H/pl-incl.h
@ -225,6 +225,35 @@ users foreign language code.
|
||||
*******************************/
|
||||
|
||||
#define WM_SIGNALLED (WM_USER+4201) /* how to select a good number!? */
|
||||
#endif
|
||||
|
||||
// THIS HAS TO BE ABSTRACTED
|
||||
|
||||
#define GLOBAL_LD (LOCAL_PL_local_data_p)
|
||||
|
||||
#if !defined(O_PLMT) && !defined(YAPOR)
|
||||
#define LOCAL_LD (GLOBAL_LD)
|
||||
#define LD (GLOBAL_LD)
|
||||
#define ARG1_LD void
|
||||
#define ARG_LD
|
||||
#define GET_LD
|
||||
#define PRED_LD
|
||||
#define PASS_LD
|
||||
#define PASS_LD1
|
||||
|
||||
#else
|
||||
|
||||
#define LOCAL_LD (__PL_ld)
|
||||
#define LD LOCAL_LD
|
||||
|
||||
#define GET_LD CACHE_REGS struct PL_local_data *__PL_ld = GLOBAL_LD;
|
||||
#define ARG1_LD struct PL_local_data *__PL_ld
|
||||
|
||||
#define ARG_LD , ARG1_LD
|
||||
#define PASS_LD1 LD
|
||||
#define PASS_LD , LD
|
||||
#define PRED_LD GET_LD
|
||||
|
||||
#endif
|
||||
|
||||
/********************************
|
||||
@ -481,6 +510,27 @@ typedef struct exception_frame /* PL_throw exception environments */
|
||||
jmp_buf exception_jmp_env; /* longjmp environment */
|
||||
} exception_frame;
|
||||
|
||||
/*******************************
|
||||
* STREAM I/O *
|
||||
*******************************/
|
||||
|
||||
#define REDIR_MAGIC 0x23a9bef3
|
||||
|
||||
typedef struct redir_context
|
||||
{ int magic; /* REDIR_MAGIC */
|
||||
IOSTREAM *stream; /* temporary output */
|
||||
int is_stream; /* redirect to stream */
|
||||
int redirected; /* output is redirected */
|
||||
term_t term; /* redirect target */
|
||||
int out_format; /* output type */
|
||||
int out_arity; /* 2 for difference-list versions */
|
||||
size_t size; /* size of I/O buffer */
|
||||
char *data; /* data written */
|
||||
char buffer[1024]; /* fast temporary buffer */
|
||||
} redir_context;
|
||||
|
||||
#include "pl-file.h"
|
||||
|
||||
/* vsc: global variables */
|
||||
#include "pl-global.h"
|
||||
|
||||
@ -558,25 +608,6 @@ typedef struct wakeup_state
|
||||
} wakeup_state;
|
||||
|
||||
|
||||
/*******************************
|
||||
* STREAM I/O *
|
||||
*******************************/
|
||||
|
||||
#define REDIR_MAGIC 0x23a9bef3
|
||||
|
||||
typedef struct redir_context
|
||||
{ int magic; /* REDIR_MAGIC */
|
||||
IOSTREAM *stream; /* temporary output */
|
||||
int is_stream; /* redirect to stream */
|
||||
int redirected; /* output is redirected */
|
||||
term_t term; /* redirect target */
|
||||
int out_format; /* output type */
|
||||
int out_arity; /* 2 for difference-list versions */
|
||||
size_t size; /* size of I/O buffer */
|
||||
char *data; /* data written */
|
||||
char buffer[1024]; /* fast temporary buffer */
|
||||
} redir_context;
|
||||
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Defining built-in predicates using the new interface
|
||||
@ -740,7 +771,19 @@ PL_EXPORT(int) PL_release_stream(IOSTREAM *s);
|
||||
COMMON(atom_t) fileNameStream(IOSTREAM *s);
|
||||
COMMON(int) streamStatus(IOSTREAM *s);
|
||||
|
||||
COMMON(int) getOutputStream(term_t t, IOSTREAM **s);
|
||||
#define getOutputStream(t, k, s) getOutputStream__LD(t, k, s PASS_LD)
|
||||
#define getTextOutputStream(t, s) getTextOutputStream__LD(t, s PASS_LD)
|
||||
#define getBinaryOutputStream(t, s) getBinaryOutputStream__LD(t, s PASS_LD)
|
||||
|
||||
#define getInputStream(t, k, s) getInputStream__LD(t, k, s PASS_LD)
|
||||
#define getTextInputStream(t, s) getTextInputStream__LD(t, s PASS_LD)
|
||||
#define getBinaryInputStream(t, s) getBinaryInputStream__LD(t, s PASS_LD)
|
||||
|
||||
COMMON(int) getTextOutputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
COMMON(int) getBinaryOutputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
COMMON(int) getTextInputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
COMMON(int) getBinaryInputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
|
||||
COMMON(void) pushOutputContext(void);
|
||||
COMMON(void) popOutputContext(void);
|
||||
COMMON(int) getSingleChar(IOSTREAM *s, int signals);
|
||||
@ -869,7 +912,6 @@ setBoolean(int *flag, term_t old, term_t new)
|
||||
succeed;
|
||||
}
|
||||
|
||||
COMMON(int) getInputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
|
||||
COMMON(int) PL_get_atom__LD(term_t t1, atom_t *a ARG_LD);
|
||||
COMMON(int) PL_get_atom_ex__LD(term_t t, atom_t *a ARG_LD);
|
||||
@ -901,7 +943,14 @@ static inline void *allocHeap__LD(size_t n ARG_LD)
|
||||
return YAP_AllocSpaceFromYap(n);
|
||||
}
|
||||
|
||||
static inline void freeHeap__LD(void *mem, size_t n ARG_LD)
|
||||
static inline void *allocHeapOrHalt(size_t n)
|
||||
{
|
||||
void *ptr = YAP_AllocSpaceFromYap(n);
|
||||
if (!ptr) Yap_exit(1);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static inline void freeHeap(void *mem, size_t n)
|
||||
{
|
||||
YAP_FreeSpaceFromYap(mem);
|
||||
}
|
||||
|
10
H/pl-yap.h
10
H/pl-yap.h
@ -101,7 +101,6 @@ extern word globalString(size_t size, char *s);
|
||||
extern word globalWString(size_t size, wchar_t *s);
|
||||
|
||||
#define allocHeap(n) allocHeap__LD(n PASS_LD)
|
||||
#define freeHeap(p, n) freeHeap__LD(p, n PASS_LD)
|
||||
|
||||
#define valHandle(r) valHandle__LD(r PASS_LD)
|
||||
|
||||
@ -150,6 +149,10 @@ atomLength(Atom atom)
|
||||
#define _PL_predicate(A,B,C,D) PL_predicate(A,B,C)
|
||||
#define predicateHasClauses(A) (YAP_NumberOfClausesForPredicate((YAP_PredEntryPtr)A) != 0)
|
||||
#define lookupModule(A) Yap_Module(MkAtomTerm(YAP_AtomFromSWIAtom(A)))
|
||||
|
||||
#define BEGIN_NUMBERVARS(X)
|
||||
#define END_NUMBERVARS(X)
|
||||
|
||||
#define charEscapeWriteOption(A) FALSE // VSC: to implement
|
||||
#define wordToTermRef(A) YAP_InitSlot(*(A))
|
||||
#define isTaggedInt(A) IsIntegerTerm(A)
|
||||
@ -179,8 +182,6 @@ charCode(Term w)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define getInputStream(t, s) getInputStream__LD(t, s PASS_LD)
|
||||
|
||||
#define PL_get_atom(t, a) PL_get_atom__LD(t, a PASS_LD)
|
||||
#define PL_get_atom_ex(t, a) PL_get_atom_ex__LD(t, a PASS_LD)
|
||||
#define PL_get_text(l, t, f) PL_get_text__LD(l, t, f PASS_LD)
|
||||
@ -227,5 +228,8 @@ unblockSignal(int sig)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define suspendTrace(x)
|
||||
|
||||
atom_t ATOM_;
|
||||
|
||||
#endif /* PL_YAP_H */
|
||||
|
@ -373,6 +373,10 @@ PL_EXPORT(IOSTREAM *)*_PL_streams(void); /* base of streams */
|
||||
PL_WRT_ATTVAR_WRITE | \
|
||||
PL_WRT_ATTVAR_PORTRAY)
|
||||
#define PL_WRT_BLOB_PORTRAY 0x400 /* Use portray to emit non-text blobs */
|
||||
#define PL_WRT_NO_CYCLES 0x800 /* Never emit @(Template,Subst) */
|
||||
#define PL_WRT_LIST 0x1000 /* Write [...], even with ignoreops */
|
||||
#define PL_WRT_NEWLINE 0x2000 /* Add a newline */
|
||||
#define PL_WRT_VARNAMES 0x4000 /* Internal: variable_names(List) */
|
||||
|
||||
PL_EXPORT(int) PL_write_term(IOSTREAM *s,
|
||||
term_t term,
|
||||
|
1775
include/dswiatoms.h
1775
include/dswiatoms.h
File diff suppressed because it is too large
Load Diff
@ -2784,6 +2784,11 @@ PL_query(int query)
|
||||
}
|
||||
}
|
||||
|
||||
X_API void
|
||||
PL_cleanup_fork(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
X_API void (*PL_signal(int sig, void (*func)(int)))(int)
|
||||
{
|
||||
|
@ -14,7 +14,9 @@ A abort "abort"
|
||||
A aborted "$aborted"
|
||||
A abs "abs"
|
||||
A access "access"
|
||||
A access_level "access_level"
|
||||
A acos "acos"
|
||||
A acosh "acosh"
|
||||
A acyclic_term "acyclic_term"
|
||||
A add_import "add_import"
|
||||
A address "address"
|
||||
@ -38,6 +40,7 @@ A argumentlimit "argumentlimit"
|
||||
A as "as"
|
||||
A ascii "ascii"
|
||||
A asin "asin"
|
||||
A asinh "asinh"
|
||||
A assert "assert"
|
||||
A asserta "asserta"
|
||||
A at "at"
|
||||
@ -49,6 +52,7 @@ A at_not_equals "\\=@="
|
||||
A at_smaller "@<"
|
||||
A at_smaller_eq "@=<"
|
||||
A atan "atan"
|
||||
A atanh "atanh"
|
||||
A atan2 "atan2"
|
||||
A atom "atom"
|
||||
A atom_garbage_collection "atom_garbage_collection"
|
||||
@ -62,8 +66,10 @@ A backquoted_string "backquoted_string"
|
||||
A backslash "\\"
|
||||
A backtrace "backtrace"
|
||||
A bar "|"
|
||||
A base "base"
|
||||
A begin "begin"
|
||||
A binary "binary"
|
||||
A binary_stream "binary_stream"
|
||||
A bind "bind"
|
||||
A bitor "\\/"
|
||||
A blobs "blobs"
|
||||
@ -73,6 +79,7 @@ A bool "bool"
|
||||
A boolean "boolean"
|
||||
A brace_term_position "brace_term_position"
|
||||
A break "break"
|
||||
A break_level "break_level"
|
||||
A btree "btree"
|
||||
A buffer "buffer"
|
||||
A buffer_size "buffer_size"
|
||||
@ -86,6 +93,7 @@ A callpred "$callpred"
|
||||
A canceled "canceled"
|
||||
A case_sensitive_file_names "case_sensitive_file_names"
|
||||
A catch "catch"
|
||||
A category "category"
|
||||
A ceil "ceil"
|
||||
A ceiling "ceiling"
|
||||
A char_type "char_type"
|
||||
@ -96,11 +104,13 @@ A chars "chars"
|
||||
A chdir "chdir"
|
||||
A chmod "chmod"
|
||||
A choice "choice"
|
||||
A class "class"
|
||||
A clause "clause"
|
||||
A clauses "clauses"
|
||||
A clause_reference "clause_reference"
|
||||
A close "close"
|
||||
A close_on_abort "close_on_abort"
|
||||
A close_on_exec "close_on_exec"
|
||||
A close_on_exec "close_on_exec"
|
||||
A close_option "close_option"
|
||||
A cm "cm"
|
||||
A cntrl "cntrl"
|
||||
@ -115,9 +125,11 @@ A compound "compound"
|
||||
A context "context"
|
||||
A context_module "context_module"
|
||||
A continue "continue"
|
||||
A copysign "copysign"
|
||||
A core "core"
|
||||
A core_left "core_left"
|
||||
A cos "cos"
|
||||
A cosh "cosh"
|
||||
A cputime "cputime"
|
||||
A create "create"
|
||||
A csym "csym"
|
||||
@ -133,6 +145,7 @@ A cut_exit "cut_exit"
|
||||
A cut_parent "cut_parent"
|
||||
A cutted "cut"
|
||||
A cyclic_term "cyclic_term"
|
||||
A cycles "cycles"
|
||||
A dand "$and"
|
||||
A date "date"
|
||||
A db_reference "db_reference"
|
||||
@ -143,8 +156,10 @@ A dcatch "$catch"
|
||||
A dcut "$cut"
|
||||
A dde_error "dde_error"
|
||||
A dde_handle "dde_handle"
|
||||
A deadline "deadline"
|
||||
A debug "debug"
|
||||
A debug_on_error "debug_on_error"
|
||||
A debug_topic "debug_topic"
|
||||
A debugger_print_options "debugger_print_options"
|
||||
A debugger_show_context "debugger_show_context"
|
||||
A debugging "debugging"
|
||||
@ -176,11 +191,13 @@ A dots "dots"
|
||||
A double_quotes "double_quotes"
|
||||
A doublestar "**"
|
||||
A dprof_node "$profile_node"
|
||||
A dquery_loop "$query_loop"
|
||||
A drecover_and_rethrow "$recover_and_rethrow"
|
||||
A dstream "$stream"
|
||||
A dthread_init "$thread_init"
|
||||
A dthrow "$throw"
|
||||
A dtime "$time"
|
||||
A dtoplevel "$toplevel"
|
||||
A dvard "$VAR$"
|
||||
A dwakeup "$wakeup"
|
||||
A dynamic "dynamic"
|
||||
@ -274,9 +291,8 @@ A has_alternatives "has_alternatives"
|
||||
A hash "hash"
|
||||
A hashed "hashed"
|
||||
A hat "^"
|
||||
A heap "heap"
|
||||
A heaplimit "heaplimit"
|
||||
A heapused "heapused"
|
||||
A heap_gc "heap_gc"
|
||||
A help "help"
|
||||
A hidden "hidden"
|
||||
A hide_childs "hide_childs"
|
||||
@ -284,6 +300,8 @@ A history_depth "history_depth"
|
||||
A ifthen "->"
|
||||
A ignore "ignore"
|
||||
A ignore_ops "ignore_ops"
|
||||
A import_into "import_into"
|
||||
A import_type "import_type"
|
||||
A imported "imported"
|
||||
A imported_procedure "imported_procedure"
|
||||
A index "index"
|
||||
@ -292,7 +310,7 @@ A inf "inf"
|
||||
A inferences "inferences"
|
||||
A infinite "infinite"
|
||||
A informational "informational"
|
||||
A init_file "init_file"
|
||||
A init_file "init_file"
|
||||
A initialization "initialization"
|
||||
A input "input"
|
||||
A inserted_char "inserted_char"
|
||||
@ -318,9 +336,11 @@ A larger ">"
|
||||
A larger_equal ">="
|
||||
A level "level"
|
||||
A li "li"
|
||||
A library "library"
|
||||
A limit "limit"
|
||||
A line "line"
|
||||
A line_count "line_count"
|
||||
A line_position "line_position"
|
||||
A list "list"
|
||||
A list_position "list_position"
|
||||
A listing "listing"
|
||||
@ -335,6 +355,7 @@ A locked "locked"
|
||||
A log "log"
|
||||
A log10 "log10"
|
||||
A long "long"
|
||||
A loose "loose"
|
||||
A low "low"
|
||||
A lower "lower"
|
||||
A lsb "lsb"
|
||||
@ -348,6 +369,7 @@ A max_dde_handles "max_dde_handles"
|
||||
A max_depth "max_depth"
|
||||
A max_files "max_files"
|
||||
A max_frame_size "max_frame_size"
|
||||
A max_length "max_length"
|
||||
A max_path_length "max_path_length"
|
||||
A max_size "max_size"
|
||||
A max_variable_length "max_variable_length"
|
||||
@ -367,6 +389,7 @@ A mod "mod"
|
||||
A mode "mode"
|
||||
A modify "modify"
|
||||
A module "module"
|
||||
A module_class "module_class"
|
||||
A module_property "module_property"
|
||||
A module_transparent "module_transparent"
|
||||
A modules "modules"
|
||||
@ -393,15 +416,16 @@ A not_implemented "not_implemented"
|
||||
A not_less_than_one "not_less_than_one"
|
||||
A not_less_than_zero "not_less_than_zero"
|
||||
A not_provable "\\+"
|
||||
A not_strickt_equals "\\=="
|
||||
A not_strict_equal "\\=="
|
||||
A not_unique "not_unique"
|
||||
A number "number"
|
||||
A number_of_clauses "number_of_clauses"
|
||||
A number_of_rules "number_of_rules"
|
||||
A numbervar_option "numbervar_option"
|
||||
A numbervars "numbervars"
|
||||
A occurs_check "occurs_check"
|
||||
A octet "octet"
|
||||
A off "off"
|
||||
A off "off"
|
||||
A on "on"
|
||||
A open "open"
|
||||
A operator "operator"
|
||||
@ -411,6 +435,7 @@ A optimise "optimise"
|
||||
A or "or"
|
||||
A order "order"
|
||||
A output "output"
|
||||
A owner "owner"
|
||||
A pair "pair"
|
||||
A paren "paren"
|
||||
A parent "parent"
|
||||
@ -429,6 +454,7 @@ A plain "plain"
|
||||
A plus "+"
|
||||
A popcount "popcount"
|
||||
A portray "portray"
|
||||
A portray_goal "portray_goal"
|
||||
A position "position"
|
||||
A posix "posix"
|
||||
A powm "powm"
|
||||
@ -439,6 +465,8 @@ A print_message "print_message"
|
||||
A priority "priority"
|
||||
A private_procedure "private_procedure"
|
||||
A procedure "procedure"
|
||||
A process_comment "process_comment"
|
||||
A process_cputime "process_cputime"
|
||||
A profile_mode "profile_mode"
|
||||
A profile_no_cpu_time "profile_no_cpu_time"
|
||||
A profile_node "profile_node"
|
||||
@ -463,6 +491,7 @@ A quote "quote"
|
||||
A quoted "quoted"
|
||||
A radix "radix"
|
||||
A random "random"
|
||||
A random_float "random_float"
|
||||
A random_option "random_option"
|
||||
A rational "rational"
|
||||
A rationalize "rationalize"
|
||||
@ -478,6 +507,7 @@ A record "record"
|
||||
A record_position "record_position"
|
||||
A redefine "redefine"
|
||||
A redo "redo"
|
||||
A redo_in_skip "redo_in_skip"
|
||||
A references "references"
|
||||
A rem "rem"
|
||||
A rename "rename"
|
||||
@ -495,6 +525,7 @@ A running "running"
|
||||
A runtime "runtime"
|
||||
A save_class "save_class"
|
||||
A save_option "save_option"
|
||||
A see "see"
|
||||
A seed "seed"
|
||||
A seek_method "seek_method"
|
||||
A select "select"
|
||||
@ -507,15 +538,18 @@ A shared "shared"
|
||||
A shared_object "shared_object"
|
||||
A shared_object_handle "shared_object_handle"
|
||||
A shell "shell"
|
||||
A shift_time "shift_time"
|
||||
A sign "sign"
|
||||
A signal "signal"
|
||||
A signal_handler "signal_handler"
|
||||
A silent "silent"
|
||||
A sin "sin"
|
||||
A singletons "singletons"
|
||||
A sinh "sinh"
|
||||
A size "size"
|
||||
A size_t "size_t"
|
||||
A skip "skip"
|
||||
A skipped "skipped"
|
||||
A smaller "<"
|
||||
A smaller_equal "=<"
|
||||
A softcut "*->"
|
||||
@ -534,6 +568,7 @@ A standard "standard"
|
||||
A star "*"
|
||||
A start "start"
|
||||
A stat "stat"
|
||||
A state "state"
|
||||
A static_procedure "static_procedure"
|
||||
A statistics "statistics"
|
||||
A status "status"
|
||||
@ -544,9 +579,11 @@ A stream_or_alias "stream_or_alias"
|
||||
A stream_pair "stream_pair"
|
||||
A stream_position "$stream_position"
|
||||
A stream_property "stream_property"
|
||||
A stream_type_check "stream_type_check"
|
||||
A strict_equal "=="
|
||||
A string "string"
|
||||
A string_position "string_position"
|
||||
A strong "strong"
|
||||
A subterm_positions "subterm_positions"
|
||||
A suffix "suffix"
|
||||
A syntax_error "syntax_error"
|
||||
@ -554,18 +591,22 @@ A syntax_errors "syntax_errors"
|
||||
A system "system"
|
||||
A system_error "system_error"
|
||||
A system_init_file "system_init_file"
|
||||
A system_thread_id "system_thread_id"
|
||||
A system_thread_id "system_thread_id"
|
||||
A system_time "system_time"
|
||||
A tan "tan"
|
||||
A tanh "tanh"
|
||||
A temporary_files "temporary_files"
|
||||
A term "term"
|
||||
A term_expansion "term_expansion"
|
||||
A term_position "term_position"
|
||||
A terminal "terminal"
|
||||
A terminal_capability "terminal_capability"
|
||||
A test "test"
|
||||
A text "text"
|
||||
A text_stream "text_stream"
|
||||
A thread "thread"
|
||||
A thread_cputime "thread_cputime"
|
||||
A thread_get_message_option "thread_get_message_option"
|
||||
A thread_initialization "thread_initialization"
|
||||
A thread_local "thread_local"
|
||||
A thread_local_procedure "thread_local_procedure"
|
||||
@ -583,7 +624,7 @@ A timezone "timezone"
|
||||
A to_lower "to_lower"
|
||||
A to_upper "to_upper"
|
||||
A top "top"
|
||||
A top_level "top_level"
|
||||
A top_level "top_level"
|
||||
A toplevel "toplevel"
|
||||
A trace "trace"
|
||||
A trace_any "trace_any"
|
||||
@ -643,6 +684,7 @@ A wait "wait"
|
||||
A wakeup "wakeup"
|
||||
A walltime "walltime"
|
||||
A warning "warning"
|
||||
A weak "weak"
|
||||
A wchar_t "wchar_t"
|
||||
A when_condition "when_condition"
|
||||
A white "white"
|
||||
@ -663,15 +705,18 @@ A zero_divisor "zero_divisor"
|
||||
F abs 1
|
||||
F access 1
|
||||
F acos 1
|
||||
F acosh 1
|
||||
F alias 1
|
||||
F and 2
|
||||
F ar_equals 2
|
||||
F ar_not_equal 2
|
||||
F asin 1
|
||||
F asinh 1
|
||||
F assert 1
|
||||
F asserta 1
|
||||
F atan 1
|
||||
F atan 2
|
||||
F atanh 1
|
||||
F atan2 2
|
||||
F atom 1
|
||||
F att 3
|
||||
@ -693,15 +738,18 @@ F ceil 1
|
||||
F ceiling 1
|
||||
F chars 1
|
||||
F chars 2
|
||||
F class 1
|
||||
F clause 1
|
||||
F close_on_abort 1
|
||||
F close_on_exec 1
|
||||
F close_on_exec 1
|
||||
F codes 1
|
||||
F codes 2
|
||||
F colon 2
|
||||
F comma 2
|
||||
F context 2
|
||||
F copysign 2
|
||||
F cos 1
|
||||
F cosh 1
|
||||
F cputime 0
|
||||
F curl 1
|
||||
F cut_call 1
|
||||
@ -717,7 +765,7 @@ F debugging 1
|
||||
F detached 1
|
||||
F dexit 2
|
||||
F dforeign_registered 2
|
||||
F dgarbage_collect 1
|
||||
F dgarbage_collect 1
|
||||
F div 2
|
||||
F gdiv 2
|
||||
F divide 2
|
||||
@ -769,7 +817,9 @@ F goal_expansion 2
|
||||
F ground 1
|
||||
F hat 2
|
||||
F ifthen 2
|
||||
F import_into 1
|
||||
F input 0
|
||||
F input 3
|
||||
F integer 1
|
||||
F interrupt 1
|
||||
F io_error 2
|
||||
@ -799,6 +849,7 @@ F nlink 1
|
||||
F nonvar 1
|
||||
F not_implemented 2
|
||||
F not_provable 1
|
||||
F not_strict_equal 2
|
||||
F occurs_check 2
|
||||
F or 1
|
||||
F output 0
|
||||
@ -813,14 +864,17 @@ F position 1
|
||||
F powm 3
|
||||
F print 1
|
||||
F print_message 2
|
||||
F priority 1
|
||||
F procedure 2
|
||||
F prove 1
|
||||
F prove 2
|
||||
F punct 2
|
||||
F random 1
|
||||
F random_float 0
|
||||
F rational 1
|
||||
F rationalize 1
|
||||
F rdiv 2
|
||||
F redo 1
|
||||
F rem 2
|
||||
F reposition 1
|
||||
F representation_error 1
|
||||
@ -838,6 +892,7 @@ F signal 1
|
||||
F signal 2
|
||||
F sin 1
|
||||
F singletons 1
|
||||
F sinh 1
|
||||
F size 1
|
||||
F smaller 2
|
||||
F smaller_equal 2
|
||||
@ -855,6 +910,7 @@ F string_position 2
|
||||
F syntax_error 1
|
||||
F syntax_error 3
|
||||
F tan 1
|
||||
F tanh 1
|
||||
F term_expansion 2
|
||||
F term_position 5
|
||||
F timeout 1
|
||||
@ -875,3 +931,4 @@ F wakeup 3
|
||||
F warning 3
|
||||
F xor 2
|
||||
F xpceref 1
|
||||
F xpceref 2
|
||||
|
@ -163,6 +163,7 @@ typedef struct io_stream
|
||||
unsigned references : 4; /* Reference-count */
|
||||
int io_errno; /* Save errno value */
|
||||
void * exception; /* pending exception (record_t) */
|
||||
void * context; /* getStreamContext() */
|
||||
intptr_t reserved[2]; /* reserved for extension */
|
||||
} IOSTREAM;
|
||||
|
||||
|
607
os/pl-file.c
607
os/pl-file.c
File diff suppressed because it is too large
Load Diff
81
os/pl-file.h
Normal file
81
os/pl-file.h
Normal file
@ -0,0 +1,81 @@
|
||||
/* $Id$
|
||||
|
||||
Part of SWI-Prolog
|
||||
|
||||
Author: Jan Wielemaker
|
||||
E-mail: J.Wielemaker@uva.nl
|
||||
WWW: http://www.swi-prolog.org
|
||||
Copyright (C): 1985-2011, University of Amsterdam
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef PL_FILE_H_INCLUDED
|
||||
#define PL_FILE_H_INCLUDED
|
||||
|
||||
typedef enum
|
||||
{ ST_FALSE = -1, /* Do not check stream types */
|
||||
ST_LOOSE = 0, /* Default: accept latin-1 for binary */
|
||||
ST_TRUE = 1 /* Strict checking */
|
||||
} st_check;
|
||||
|
||||
/* pl-file.c */
|
||||
COMMON(void) initIO(void);
|
||||
COMMON(void) dieIO(void);
|
||||
COMMON(void) closeFiles(int all);
|
||||
COMMON(int) openFileDescriptors(unsigned char *buf, int size);
|
||||
COMMON(void) protocol(const char *s, size_t n);
|
||||
COMMON(int) getTextInputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
COMMON(int) getBinaryInputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
COMMON(int) getTextOutputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
COMMON(int) getBinaryOutputStream__LD(term_t t, IOSTREAM **s ARG_LD);
|
||||
COMMON(int) reportStreamError(IOSTREAM *s);
|
||||
COMMON(int) streamStatus(IOSTREAM *s);
|
||||
COMMON(atom_t) fileNameStream(IOSTREAM *s);
|
||||
COMMON(int) getSingleChar(IOSTREAM *s, int signals);
|
||||
COMMON(int) readLine(IOSTREAM *in, IOSTREAM *out, char *buffer);
|
||||
COMMON(int) LockStream(void);
|
||||
COMMON(int) UnlockStream(void);
|
||||
COMMON(IOSTREAM *) PL_current_input(void);
|
||||
COMMON(IOSTREAM *) PL_current_output(void);
|
||||
COMMON(int) pl_see(term_t f);
|
||||
COMMON(int) pl_seen(void);
|
||||
COMMON(int) seeString(const char *s);
|
||||
COMMON(int) seeingString(void);
|
||||
COMMON(int) seenString(void);
|
||||
COMMON(int) tellString(char **s, size_t *size, IOENC enc);
|
||||
COMMON(int) toldString(void);
|
||||
COMMON(void) prompt1(atom_t prompt);
|
||||
COMMON(atom_t) PrologPrompt(void);
|
||||
COMMON(int) streamNo(term_t spec, int mode);
|
||||
COMMON(void) release_stream_handle(term_t spec);
|
||||
COMMON(int) unifyTime(term_t t, time_t time);
|
||||
#ifdef __WINDOWS__
|
||||
COMMON(word) pl_make_fat_filemap(term_t dir);
|
||||
#endif
|
||||
COMMON(int) PL_unify_stream_or_alias(term_t t, IOSTREAM *s);
|
||||
COMMON(void) pushOutputContext(void);
|
||||
COMMON(void) popOutputContext(void);
|
||||
COMMON(IOENC) atom_to_encoding(atom_t a);
|
||||
COMMON(atom_t) encoding_to_atom(IOENC enc);
|
||||
COMMON(int) setupOutputRedirect(term_t to,
|
||||
redir_context *ctx,
|
||||
int redir);
|
||||
COMMON(int) closeOutputRedirect(redir_context *ctx);
|
||||
COMMON(void) discardOutputRedirect(redir_context *ctx);
|
||||
COMMON(int) push_input_context(atom_t type);
|
||||
COMMON(int) pop_input_context(void);
|
||||
|
||||
#endif /*PL_FILE_H_INCLUDED*/
|
@ -943,7 +943,7 @@ pl_raw_read2(term_t from, term_t term)
|
||||
int chr;
|
||||
PL_chars_t txt;
|
||||
|
||||
if ( !getInputStream(from, &in) )
|
||||
if ( !getTextInputStream(from, &in) )
|
||||
fail;
|
||||
|
||||
init_read_data(&rd, in PASS_LD);
|
||||
|
@ -46,26 +46,43 @@ extern void freeSimpleMutex(counting_mutex *m);
|
||||
|
||||
extern counting_mutex _PL_mutexes[]; /* Prolog mutexes */
|
||||
|
||||
#define L_MISC 0
|
||||
#define L_ALLOC 1
|
||||
#define L_ATOM 2
|
||||
#define L_FLAG 3
|
||||
#define L_FUNCTOR 4
|
||||
#define L_RECORD 5
|
||||
#define L_THREAD 6
|
||||
#define L_PREDICATE 7
|
||||
#define L_MODULE 8
|
||||
#define L_TABLE 9
|
||||
#define L_BREAK 10
|
||||
#define L_FILE 11
|
||||
#define L_PLFLAG 12
|
||||
#define L_OP 13
|
||||
#define L_INIT 14
|
||||
#define L_TERM 15
|
||||
#define L_GC 16
|
||||
#define L_AGC 17
|
||||
#define L_FOREIGN 18
|
||||
#define L_OS 19
|
||||
#define L_MISC 0
|
||||
#define L_ALLOC 1
|
||||
#define L_ATOM 2
|
||||
#define L_FLAG 3
|
||||
#define L_FUNCTOR 4
|
||||
#define L_RECORD 5
|
||||
#define L_THREAD 6
|
||||
#define L_PREDICATE 7
|
||||
#define L_MODULE 8
|
||||
#define L_TABLE 9
|
||||
#define L_BREAK 10
|
||||
#define L_FILE 11
|
||||
#define L_SEETELL 12
|
||||
#define L_PLFLAG 13
|
||||
#define L_OP 14
|
||||
#define L_INIT 15
|
||||
#define L_TERM 16
|
||||
#define L_GC 17
|
||||
#define L_AGC 18
|
||||
#define L_STOPTHEWORLD 19
|
||||
#define L_FOREIGN 20
|
||||
#define L_OS 21
|
||||
#ifdef __WINDOWS__
|
||||
#define L_DDE 22
|
||||
#define L_CSTACK 23
|
||||
#endif
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
The IF_MT(id, g) macro is used to bypass mutexes if threading is
|
||||
disabled. We cannot do this for the L_THREAD mutex however as we need to
|
||||
control when threads can be created.
|
||||
|
||||
We assume id == L_THREAD is optimized away if id is known at
|
||||
compile-time
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#define IF_MT(id, g) if ( id == L_THREAD || GD->thread.enabled ) g
|
||||
|
||||
#ifdef O_CONTENTION_STATISTICS
|
||||
#define countingMutexLock(cm) \
|
||||
|
225
os/pl-write.c
225
os/pl-write.c
@ -60,16 +60,19 @@ typedef struct
|
||||
int max_depth; /* depth limit */
|
||||
int depth; /* current depth */
|
||||
atom_t spacing; /* Where to insert spaces */
|
||||
Term module; /* Module for operators */
|
||||
Term module; /* Module for operators */
|
||||
IOSTREAM *out; /* stream to write to */
|
||||
visited *visited; /* visited (attributed-) variables */
|
||||
term_t portray_goal; /* call/2 activated portray hook */
|
||||
term_t write_options; /* original write options */
|
||||
term_t prec_opt; /* term in write options with prec */
|
||||
} write_options;
|
||||
|
||||
word
|
||||
pl_nl1(term_t stream)
|
||||
{ IOSTREAM *s;
|
||||
{ GET_LD
|
||||
IOSTREAM *s;
|
||||
|
||||
if ( getOutputStream(stream, &s) )
|
||||
if ( getTextOutputStream(stream, &s) )
|
||||
{ Sputcode('\n', s);
|
||||
return streamStatus(s);
|
||||
}
|
||||
@ -183,7 +186,7 @@ varName(term_t t, char *name)
|
||||
|
||||
|
||||
static bool
|
||||
writeTerm(term_t t, int prec, write_options *options)
|
||||
writeTopTerm(term_t t, int prec, write_options *options)
|
||||
{
|
||||
CACHE_REGS
|
||||
UInt yap_flag = Use_SWI_Stream_f;
|
||||
@ -221,21 +224,6 @@ writeAtomToStream(IOSTREAM *s, atom_t atom)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
writeAttributeMask(atom_t a)
|
||||
{ if ( a == ATOM_ignore )
|
||||
{ return PL_WRT_ATTVAR_IGNORE;
|
||||
} else if ( a == ATOM_dots )
|
||||
{ return PL_WRT_ATTVAR_DOTS;
|
||||
} else if ( a == ATOM_write )
|
||||
{ return PL_WRT_ATTVAR_WRITE;
|
||||
} else if ( a == ATOM_portray )
|
||||
{ return PL_WRT_ATTVAR_PORTRAY;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
writeBlobMask(atom_t a)
|
||||
{ if ( a == ATOM_default )
|
||||
@ -247,23 +235,6 @@ writeBlobMask(atom_t a)
|
||||
}
|
||||
|
||||
|
||||
static const opt_spec write_term_options[] =
|
||||
{ { ATOM_quoted, OPT_BOOL },
|
||||
{ ATOM_ignore_ops, OPT_BOOL },
|
||||
{ ATOM_numbervars, OPT_BOOL },
|
||||
{ ATOM_portray, OPT_BOOL },
|
||||
{ ATOM_character_escapes, OPT_BOOL },
|
||||
{ ATOM_max_depth, OPT_INT },
|
||||
{ ATOM_module, OPT_ATOM },
|
||||
{ ATOM_backquoted_string, OPT_BOOL },
|
||||
{ ATOM_attributes, OPT_ATOM },
|
||||
{ ATOM_priority, OPT_INT },
|
||||
{ ATOM_partial, OPT_BOOL },
|
||||
{ ATOM_spacing, OPT_ATOM },
|
||||
{ ATOM_blobs, OPT_ATOM },
|
||||
{ NULL_ATOM, 0 }
|
||||
};
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PutOpenToken() inserts a space in the output stream if the last-written
|
||||
and given character require a space to ensure a token-break.
|
||||
@ -317,6 +288,84 @@ PutOpenToken(int c, IOSTREAM *s)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* TOPLEVEL *
|
||||
*******************************/
|
||||
|
||||
int
|
||||
writeAttributeMask(atom_t a)
|
||||
{ if ( a == ATOM_ignore )
|
||||
{ return PL_WRT_ATTVAR_IGNORE;
|
||||
} else if ( a == ATOM_dots )
|
||||
{ return PL_WRT_ATTVAR_DOTS;
|
||||
} else if ( a == ATOM_write )
|
||||
{ return PL_WRT_ATTVAR_WRITE;
|
||||
} else if ( a == ATOM_portray )
|
||||
{ return PL_WRT_ATTVAR_PORTRAY;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const opt_spec write_term_options[] =
|
||||
{ { ATOM_quoted, OPT_BOOL },
|
||||
{ ATOM_ignore_ops, OPT_BOOL },
|
||||
{ ATOM_numbervars, OPT_BOOL },
|
||||
{ ATOM_portray, OPT_BOOL },
|
||||
{ ATOM_portray_goal, OPT_TERM },
|
||||
{ ATOM_character_escapes, OPT_BOOL },
|
||||
{ ATOM_max_depth, OPT_INT },
|
||||
{ ATOM_module, OPT_ATOM },
|
||||
{ ATOM_backquoted_string, OPT_BOOL },
|
||||
{ ATOM_attributes, OPT_ATOM },
|
||||
{ ATOM_priority, OPT_INT },
|
||||
{ ATOM_partial, OPT_BOOL },
|
||||
{ ATOM_spacing, OPT_ATOM },
|
||||
{ ATOM_blobs, OPT_ATOM },
|
||||
{ ATOM_cycles, OPT_BOOL },
|
||||
{ ATOM_variable_names, OPT_TERM },
|
||||
{ NULL_ATOM, 0 }
|
||||
};
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Call user:portray/1 if defined.
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
static int
|
||||
put_write_options(term_t opts_in, write_options *options)
|
||||
{ GET_LD
|
||||
term_t newlist = PL_new_term_ref();
|
||||
term_t precopt = PL_new_term_ref();
|
||||
fid_t fid = PL_open_foreign_frame();
|
||||
term_t head = PL_new_term_ref();
|
||||
term_t tail = PL_copy_term_ref(opts_in);
|
||||
term_t newhead = PL_new_term_ref();
|
||||
term_t newtail = PL_copy_term_ref(newlist);
|
||||
int rc = TRUE;
|
||||
|
||||
while(rc && PL_get_list(tail, head, tail))
|
||||
{ if ( !PL_is_functor(head, FUNCTOR_priority1) )
|
||||
rc = ( PL_unify_list(newtail, newhead, newtail) &&
|
||||
PL_unify(newhead, head) );
|
||||
}
|
||||
|
||||
if ( rc )
|
||||
{ rc = ( PL_unify_list(newtail, head, newtail) &&
|
||||
PL_unify_functor(head, FUNCTOR_priority1) &&
|
||||
PL_get_arg(1, head, precopt) &&
|
||||
PL_unify_nil(newtail) );
|
||||
}
|
||||
if ( rc )
|
||||
{ options->write_options = newlist;
|
||||
options->prec_opt = precopt;
|
||||
}
|
||||
|
||||
PL_close_foreign_frame(fid);
|
||||
return rc;
|
||||
}
|
||||
|
||||
word
|
||||
pl_write_term3(term_t stream, term_t term, term_t opts)
|
||||
{ GET_LD
|
||||
@ -324,6 +373,7 @@ pl_write_term3(term_t stream, term_t term, term_t opts)
|
||||
bool ignore_ops = FALSE;
|
||||
bool numbervars = -1; /* not set */
|
||||
bool portray = FALSE;
|
||||
term_t gportray = 0;
|
||||
bool bqstring = truePrologFlag(PLFLAG_BACKQUOTED_STRING);
|
||||
bool charescape = -1; /* not set */
|
||||
atom_t mname = ATOM_user;
|
||||
@ -331,7 +381,10 @@ pl_write_term3(term_t stream, term_t term, term_t opts)
|
||||
atom_t blobs = ATOM_nil;
|
||||
int priority = 1200;
|
||||
bool partial = FALSE;
|
||||
IOSTREAM *s;
|
||||
bool cycles = TRUE;
|
||||
term_t varnames = 0;
|
||||
int local_varnames;
|
||||
IOSTREAM *s = NULL;
|
||||
write_options options;
|
||||
int rc;
|
||||
|
||||
@ -339,10 +392,10 @@ pl_write_term3(term_t stream, term_t term, term_t opts)
|
||||
options.spacing = ATOM_standard;
|
||||
|
||||
if ( !scan_options(opts, 0, ATOM_write_option, write_term_options,
|
||||
"ed, &ignore_ops, &numbervars, &portray,
|
||||
"ed, &ignore_ops, &numbervars, &portray, &gportray,
|
||||
&charescape, &options.max_depth, &mname,
|
||||
&bqstring, &attr, &priority, &partial, &options.spacing,
|
||||
&blobs) )
|
||||
&blobs, &cycles, &varnames) )
|
||||
fail;
|
||||
|
||||
if ( attr == ATOM_nil )
|
||||
@ -381,14 +434,19 @@ pl_write_term3(term_t stream, term_t term, term_t opts)
|
||||
}
|
||||
}
|
||||
|
||||
if ( !getOutputStream(stream, &s) )
|
||||
fail;
|
||||
|
||||
options.module = lookupModule(mname);
|
||||
/* vsc
|
||||
if ( charescape == TRUE ||
|
||||
// (charescape == -1 && true(options.module, CHARESCAPE)) )
|
||||
charEscapeWriteOption(options))
|
||||
options.flags |= PL_WRT_CHARESCAPES;
|
||||
(charescape == -1 && true(options.module, M_CHARESCAPE)) )
|
||||
options.flags |= PL_WRT_CHARESCAPES;
|
||||
if ( gportray )
|
||||
{ options.portray_goal = gportray;
|
||||
if ( !put_write_options(opts, &options) ||
|
||||
!PL_qualify(options.portray_goal, options.portray_goal) )
|
||||
return FALSE;
|
||||
portray = TRUE;
|
||||
}
|
||||
*/
|
||||
if ( numbervars == -1 )
|
||||
numbervars = (portray ? TRUE : FALSE);
|
||||
|
||||
@ -397,19 +455,37 @@ pl_write_term3(term_t stream, term_t term, term_t opts)
|
||||
if ( numbervars ) options.flags |= PL_WRT_NUMBERVARS;
|
||||
if ( portray ) options.flags |= PL_WRT_PORTRAY;
|
||||
if ( bqstring ) options.flags |= PL_WRT_BACKQUOTED_STRING;
|
||||
if ( !cycles ) options.flags |= PL_WRT_NO_CYCLES;
|
||||
|
||||
local_varnames = (varnames && false(&options, PL_WRT_NUMBERVARS));
|
||||
|
||||
BEGIN_NUMBERVARS(local_varnames);
|
||||
/* vsc
|
||||
if ( varnames )
|
||||
{ if ( (rc=bind_varnames(varnames PASS_LD)) )
|
||||
options.flags |= PL_WRT_VARNAMES;
|
||||
else
|
||||
goto out;
|
||||
}
|
||||
*/
|
||||
if ( !(rc=getTextOutputStream(stream, &s)) )
|
||||
goto out;
|
||||
|
||||
options.out = s;
|
||||
if ( !partial )
|
||||
PutOpenToken(EOF, s); /* reset this */
|
||||
if ( (options.flags & PL_WRT_QUOTED) && !(s->flags&SIO_REPPL) )
|
||||
{ s->flags |= SIO_REPPL;
|
||||
rc = writeTerm(term, priority, &options);
|
||||
rc = writeTopTerm(term, priority, &options);
|
||||
s->flags &= ~SIO_REPPL;
|
||||
} else
|
||||
{ rc = writeTerm(term, priority, &options);
|
||||
{ rc = writeTopTerm(term, priority, &options);
|
||||
}
|
||||
|
||||
return streamStatus(s) && rc;
|
||||
out:
|
||||
END_NUMBERVARS(local_varnames);
|
||||
|
||||
return (!s || streamStatus(s)) && rc;
|
||||
}
|
||||
|
||||
|
||||
@ -426,10 +502,10 @@ PL_write_term(IOSTREAM *s, term_t term, int precedence, int flags)
|
||||
memset(&options, 0, sizeof(options));
|
||||
options.flags = flags;
|
||||
options.out = s;
|
||||
options.module = USER_MODULE; //MODULE_user;
|
||||
options.module = MODULE_user;
|
||||
|
||||
PutOpenToken(EOF, s); /* reset this */
|
||||
return writeTerm(term, precedence, &options);
|
||||
return writeTopTerm(term, precedence, &options);
|
||||
}
|
||||
|
||||
|
||||
@ -438,22 +514,24 @@ do_write2(term_t stream, term_t term, int flags)
|
||||
{ GET_LD
|
||||
IOSTREAM *s;
|
||||
|
||||
if ( getOutputStream(stream, &s) )
|
||||
if ( getTextOutputStream(stream, &s) )
|
||||
{ write_options options;
|
||||
int rc;
|
||||
|
||||
memset(&options, 0, sizeof(options));
|
||||
options.flags = flags;
|
||||
options.out = s;
|
||||
options.module = USER_MODULE; // MODULE_user;
|
||||
// if ( options.module && true(options.module, CHARESCAPE) )
|
||||
if (charEscapeWriteOption(options))
|
||||
options.module = MODULE_user;
|
||||
/* vsc if ( options.module && true(options.module, M_CHARESCAPE) )
|
||||
options.flags |= PL_WRT_CHARESCAPES;
|
||||
*/
|
||||
if ( truePrologFlag(PLFLAG_BACKQUOTED_STRING) )
|
||||
options.flags |= PL_WRT_BACKQUOTED_STRING;
|
||||
|
||||
PutOpenToken(EOF, s); /* reset this */
|
||||
rc = writeTerm(term, 1200, &options);
|
||||
rc = writeTopTerm(term, 1200, &options);
|
||||
if ( rc && (flags&PL_WRT_NEWLINE) )
|
||||
rc = Putc('\n', s);
|
||||
|
||||
return streamStatus(s) && rc;
|
||||
}
|
||||
@ -481,25 +559,22 @@ pl_print2(term_t stream, term_t term)
|
||||
word
|
||||
pl_write_canonical2(term_t stream, term_t term)
|
||||
{ GET_LD
|
||||
fid_t fid;
|
||||
nv_options options;
|
||||
word rc;
|
||||
|
||||
if ( !(fid = PL_open_foreign_frame()) )
|
||||
return FALSE;
|
||||
BEGIN_NUMBERVARS(TRUE);
|
||||
|
||||
options.functor = FUNCTOR_isovar1;
|
||||
options.on_attvar = AV_SKIP;
|
||||
options.singletons = TRUE;
|
||||
#if __YAP_PROLOG__
|
||||
LOCAL_FunctorVar = FunctorHiddenVar;
|
||||
#endif
|
||||
numberVars(term, &options, 0 PASS_LD);
|
||||
rc = do_write2(stream, term,
|
||||
PL_WRT_QUOTED|PL_WRT_IGNOREOPS|PL_WRT_NUMBERVARS);
|
||||
#if __YAP_PROLOG__
|
||||
LOCAL_FunctorVar = FunctorVar;
|
||||
#endif
|
||||
PL_discard_foreign_frame(fid);
|
||||
// VSC options.singletons = PL_is_acyclic(term);
|
||||
//options.numbered_check = FALSE;
|
||||
|
||||
rc = ( numberVars(term, &options, 0 PASS_LD) >= 0 &&
|
||||
do_write2(stream, term,
|
||||
PL_WRT_QUOTED|PL_WRT_IGNOREOPS|PL_WRT_NUMBERVARS)
|
||||
);
|
||||
|
||||
END_NUMBERVARS(TRUE);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -524,17 +599,13 @@ pl_write_canonical(term_t term)
|
||||
{ return pl_write_canonical2(0, term);
|
||||
}
|
||||
|
||||
word /* for debugging purposes! */
|
||||
word
|
||||
pl_writeln(term_t term)
|
||||
{ if ( PL_write_term(Serror, term, 1200,
|
||||
PL_WRT_QUOTED|PL_WRT_NUMBERVARS) &&
|
||||
Sdprintf("\n") >= 0 )
|
||||
succeed;
|
||||
|
||||
fail;
|
||||
{ return do_write2(0, term, PL_WRT_NUMBERVARS|PL_WRT_NEWLINE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************
|
||||
* PUBLISH PREDICATES *
|
||||
*******************************/
|
||||
|
Reference in New Issue
Block a user