This commit is contained in:
Vitor Santos Costa 2018-02-08 10:48:02 +00:00
parent b057ac92e4
commit 84aaa82dbe
3 changed files with 18 additions and 16 deletions

View File

@ -17,7 +17,9 @@ requirements:
- pkgconfig - pkgconfig
- make - make
- libxml2 - libxml2
- backcall
run: run:
- backcall
- jupyterlab - jupyterlab
- python - python
- readline - readline

View File

@ -20,7 +20,7 @@
:- use_module( library(rbtrees) ). :- use_module( library(rbtrees) ).
:- use_module( library(terms) ). :- use_module( library(terms) ).
:- reexport( library(python) ). :- reexport( library(python) ).
w
:- python_import(yap4py.yapi). :- python_import(yap4py.yapi).
%:- start_low_level_trace. %:- start_low_level_trace.

View File

@ -10,13 +10,14 @@
* - * -
*/ */
:- module( jupyter, %% :- module( jupyter,
[jupyter_query/3, %% [jupyter_query/3,
errors/2, %% errors/2,
ready/2, %% ready/2,
completion/2 %% completion/2,
]
). %% ]
%% ).
:- reexport(library(yapi)). :- reexport(library(yapi)).
@ -26,12 +27,11 @@
:- python_import(sys). :- python_import(sys).
user:jupyter_query(Self, Cell, Line ) :- jupyter_query(Self, Cell, Line ) :-
start_low_level_trace,
setup_call_cleanup( setup_call_cleanup(
jupyter: enter_cell(Self), enter_cell(Self),
jupyter:jupyter_cell(Self, Cell, Line), jupyter_cell(Self, Cell, Line),
jupyter:exit_cell(Self) exit_cell(Self)
). ).
jupyter_cell(_Self, Cell, _) :- jupyter_cell(_Self, Cell, _) :-
@ -61,7 +61,7 @@ blankc('\n').
blankc('\t'). blankc('\t').
enter_cell(_Self) :- enter_cell(_Self) :-
open('//python/input', read, _Input, []), %open('//python/input', read, _Input, []),
open('//python/sys.stdout', append, _Output, []), open('//python/sys.stdout', append, _Output, []),
open('//python/sys.stdout', append, _Error, []), open('//python/sys.stdout', append, _Error, []),
%set_prolog_flag(user_input, _Input), %set_prolog_flag(user_input, _Input),
@ -74,7 +74,7 @@ exit_cell(_Self) :-
close( user_error). close( user_error).
user:completions(S, Self) :- completions(S, Self) :-
open_mem_read_stream(S, St), open_mem_read_stream(S, St),
scan_to_list(St, Tokens), scan_to_list(St, Tokens),
close(St), close(St),
@ -180,7 +180,7 @@ ready(Self, Line ) :-
errors( Self, Line ), errors( Self, Line ),
\+ syntax_error(_,_). \+ syntax_error(_,_).
user:errors( Self, Text ) :- errors( Self, Text ) :-
setup_call_cleanup( setup_call_cleanup(
open_events( Self, Text, Stream), open_events( Self, Text, Stream),
clauses(Self, Stream), clauses(Self, Stream),