ios
This commit is contained in:
parent
72a703393f
commit
1201357017
@ -525,7 +525,7 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) {
|
|||||||
q.CurSlot = Yap_StartSlots();
|
q.CurSlot = Yap_StartSlots();
|
||||||
q.p = P;
|
q.p = P;
|
||||||
q.cp = CP;
|
q.cp = CP;
|
||||||
PredEntry *ap;
|
PredEntry *ap = nullptr;
|
||||||
if (IsStringTerm(tmod))
|
if (IsStringTerm(tmod))
|
||||||
tmod = MkAtomTerm(Yap_LookupAtom(StringOfTerm(tmod)));
|
tmod = MkAtomTerm(Yap_LookupAtom(StringOfTerm(tmod)));
|
||||||
YAPPredicate *p = new YAPPredicate(t, tmod, ts, "C++");
|
YAPPredicate *p = new YAPPredicate(t, tmod, ts, "C++");
|
||||||
|
@ -126,8 +126,7 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
`true`. */
|
`true`. */
|
||||||
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
|
YAP_FLAG(CHARACTER_ESCAPES_FLAG, "character_escapes", true, booleanFlag,
|
||||||
"true", NULL),
|
"true", NULL),
|
||||||
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context",
|
YAP_FLAG(COLON_SETS_CALLING_CONTEXT_FLAG, "colon_sets_calling_context", true, booleanFlag, "true", NULL),
|
||||||
true, booleanFlag, "true", NULL),
|
|
||||||
/**< `compiled_at `
|
/**< `compiled_at `
|
||||||
|
|
||||||
Read-only flag that gives the time when the main YAP binary was compiled. It
|
Read-only flag that gives the time when the main YAP binary was compiled. It
|
||||||
@ -145,15 +144,14 @@ opportunity. Initial value is 10,000. May be changed. A value of 0
|
|||||||
YAP_FLAG(DEBUG_INFO_FLAG, "debug_info", true, booleanFlag, "true", NULL),
|
YAP_FLAG(DEBUG_INFO_FLAG, "debug_info", true, booleanFlag, "true", NULL),
|
||||||
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
|
YAP_FLAG(DEBUG_ON_ERROR_FLAG, "debug_on_error", true, booleanFlag, "true",
|
||||||
NULL),
|
NULL),
|
||||||
/**< `debugger_print_options `
|
/**<
|
||||||
|
|
||||||
If bound, set the argument to the `write_term/3` options the
|
If bound, set the argument to the `write_term/3` options the
|
||||||
debugger uses to write terms. If unbound, show the current options.
|
debugger uses to write terms. If unbound, show the current options.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
|
YAP_FLAG(DEBUGGER_PRINT_OPTIONS_FLAG, "debugger_print_options", true,
|
||||||
list_option,
|
list_option,
|
||||||
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
|
"[quoted(true),numbervars(true),portrayed(true),max_depth(10)]",
|
||||||
NULL),
|
NULL),
|
||||||
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
|
YAP_FLAG(DEBUGGER_SHOW_CONTEXT_FLAG, "debugger_show_context", true,
|
||||||
booleanFlag, "false", NULL),
|
booleanFlag, "false", NULL),
|
||||||
/**< `dialect `
|
/**< `dialect `
|
||||||
|
@ -153,7 +153,7 @@ int Yap_open_buf_read_stream(const char *buf, size_t nchars, encoding_t *encp,
|
|||||||
f = st->file = fmemopen((void *)buf, nchars, "r");
|
f = st->file = fmemopen((void *)buf, nchars, "r");
|
||||||
st->vfs = NULL;
|
st->vfs = NULL;
|
||||||
flags = Input_Stream_f | InMemory_Stream_f | Seekable_Stream_f;
|
flags = Input_Stream_f | InMemory_Stream_f | Seekable_Stream_f;
|
||||||
Yap_initStream(sno, f, "memStream", "r", TermNone, encoding, flags, NULL);
|
Yap_initStream(sno, f, "memStream", "r", TermNone, encoding, flags, NULL);
|
||||||
// like any file stream.
|
// like any file stream.
|
||||||
Yap_DefaultStreamOps(st);
|
Yap_DefaultStreamOps(st);
|
||||||
UNLOCK(st->streamlock);
|
UNLOCK(st->streamlock);
|
||||||
@ -171,9 +171,10 @@ open_mem_read_stream(USES_REGS1) /* $open_mem_read_stream(+List,-Stream) */
|
|||||||
int l = push_text_stack();
|
int l = push_text_stack();
|
||||||
buf = Yap_TextTermToText(ti);
|
buf = Yap_TextTermToText(ti);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
|
pop_text_stack(l);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
buf = pop_output_text_stack(l, buf);
|
buf = pop_output_text_stack(l, buf);
|
||||||
sno = Yap_open_buf_read_stream(buf, strlen(buf) + 1, &LOCAL_encoding,
|
sno = Yap_open_buf_read_stream(buf, strlen(buf) + 1, &LOCAL_encoding,
|
||||||
MEM_BUF_MALLOC);
|
MEM_BUF_MALLOC);
|
||||||
t = Yap_MkStream(sno);
|
t = Yap_MkStream(sno);
|
||||||
@ -197,7 +198,7 @@ int Yap_open_buf_write_stream(encoding_t enc, memBufSource src) {
|
|||||||
st->linecount = 1;
|
st->linecount = 1;
|
||||||
st->encoding = enc;
|
st->encoding = enc;
|
||||||
st->vfs = NULL;
|
st->vfs = NULL;
|
||||||
st->buf.on = false;
|
st->buf.on = false;
|
||||||
#if HAVE_OPEN_MEMSTREAM
|
#if HAVE_OPEN_MEMSTREAM
|
||||||
st->file = open_memstream(&st->nbuf, &st->nsize);
|
st->file = open_memstream(&st->nbuf, &st->nsize);
|
||||||
// setbuf(st->file, NULL);
|
// setbuf(st->file, NULL);
|
||||||
|
@ -1127,11 +1127,8 @@ static Int format(Term tf, Term tas, Term tout USES_REGS) {
|
|||||||
f == FunctorCodes || f == FunctorChars1 || f == FunctorChars) ){
|
f == FunctorCodes || f == FunctorChars1 || f == FunctorChars) ){
|
||||||
output_stream = Yap_OpenBufWriteStream(PASS_REGS1);
|
output_stream = Yap_OpenBufWriteStream(PASS_REGS1);
|
||||||
mem_stream = true;
|
mem_stream = true;
|
||||||
}
|
} else {
|
||||||
if (output_stream <0 ||!mem_stream) {
|
output_stream = Yap_CheckStream(tout, Output_Stream_f, "format/3");
|
||||||
UNLOCK(GLOBAL_Stream[output_stream].streamlock);
|
|
||||||
/* needs to change LOCAL_c_output_stream for write */
|
|
||||||
output_stream = Yap_CheckStream(tout, Output_Stream_f, "format/3");
|
|
||||||
}
|
}
|
||||||
if (output_stream == -1) {
|
if (output_stream == -1) {
|
||||||
UNLOCK(GLOBAL_Stream[output_stream].streamlock);
|
UNLOCK(GLOBAL_Stream[output_stream].streamlock);
|
||||||
|
@ -1557,7 +1557,7 @@ int Yap_OpenStream(Term tin, const char *io_mode, Term user_name,
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int sno;
|
int sno;
|
||||||
StreamDesc *st;
|
StreamDesc *st;
|
||||||
struct vfs *vfsp;
|
struct vfs *vfsp = NULL;
|
||||||
int flags;
|
int flags;
|
||||||
const char *fname;
|
const char *fname;
|
||||||
|
|
||||||
@ -1627,7 +1627,7 @@ int Yap_OpenStream(Term tin, const char *io_mode, Term user_name,
|
|||||||
const char *buf;
|
const char *buf;
|
||||||
int i = push_text_stack();
|
int i = push_text_stack();
|
||||||
buf = Yap_TextTermToText(ArgOfTerm(1, tin) PASS_REGS);
|
buf = Yap_TextTermToText(ArgOfTerm(1, tin) PASS_REGS);
|
||||||
if (!buf) {
|
if (buf == NULL) {
|
||||||
pop_text_stack(i);
|
pop_text_stack(i);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,20 +1,19 @@
|
|||||||
/**
|
|
||||||
|
/*!
|
||||||
* @file complete.yap
|
* @file complete.yap
|
||||||
*
|
*
|
||||||
* @brief Prolog completer.
|
* @brief Prolog completer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- module( completer,
|
:- module( completer,
|
||||||
[
|
[completions/2 ]).
|
||||||
completions/2.
|
|
||||||
]).
|
|
||||||
|
|
||||||
:- use_module(library(lists)).
|
:- use_module(library(lists)).
|
||||||
:- use_module(library(maplist)).
|
:- use_module(library(maplist)).
|
||||||
:- use_module(library(python)).
|
:- use_module(library(python)).
|
||||||
|
|
||||||
%% completions( +Text, +PythonCell )
|
%% completions( +Text, +PythonCell )
|
||||||
%
|
%
|
||||||
% Tries to complete the current text. The list with the set of completions
|
% Tries to complete the current text. The list with the set of completions
|
||||||
% is stored in the
|
% is stored in the
|
||||||
% `matches` field of the python object.
|
% `matches` field of the python object.
|
||||||
@ -116,8 +115,3 @@ cont(0, F, P, P0) :-
|
|||||||
atom_concat( F, P, P0 ).
|
atom_concat( F, P, P0 ).
|
||||||
cont( _, F, P, PB ):-
|
cont( _, F, P, PB ):-
|
||||||
atom_concat( [F, P, '( )'], PB ).
|
atom_concat( [F, P, '( )'], PB ).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* @brief JUpyter support.
|
* @brief JUpyter support.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
% :- module( jupyter,
|
% :- module( jupyter,
|
||||||
% [jupyter_query/3,
|
% [jupyter_query/3,
|
||||||
% errors/2,
|
% errors/2,
|
||||||
@ -52,11 +52,13 @@ jupyter_consult(Text) :-
|
|||||||
blank( Text ),
|
blank( Text ),
|
||||||
!.
|
!.
|
||||||
jupyter_consult(Cell) :-
|
jupyter_consult(Cell) :-
|
||||||
open_mem_read_stream( Cell, Stream),
|
|
||||||
% Name = 'Inp',
|
% Name = 'Inp',
|
||||||
% stream_property(Stream, file_name(Name) ),
|
% stream_property(Stream, file_name(Name) ),
|
||||||
load_files(user:'jupyter cell',[stream(Stream)]), !.
|
setup_call_cleanup(
|
||||||
%should load_files close?
|
open_mem_read_stream( Cell, Stream),
|
||||||
|
load_files(user:'jupyter cell',[stream(Stream)]),
|
||||||
|
close(Stream)
|
||||||
|
).
|
||||||
|
|
||||||
blank(Text) :-
|
blank(Text) :-
|
||||||
atom_codes(Text, L),
|
atom_codes(Text, L),
|
||||||
|
@ -804,5 +804,4 @@ class YAPRun:
|
|||||||
if query[-1] == '.':
|
if query[-1] == '.':
|
||||||
return s,'',False,0
|
return s,'',False,0
|
||||||
(query, _,loop, sols) = self.clean_end(query)
|
(query, _,loop, sols) = self.clean_end(query)
|
||||||
print(program, query, loop, sols)
|
|
||||||
return (program, query, loop, sols)
|
return (program, query, loop, sols)
|
||||||
|
Reference in New Issue
Block a user