jupyter
This commit is contained in:
parent
0c950ce5b3
commit
b4201dd0f3
@ -158,9 +158,9 @@ else if (PyDict_Check(pVal)) {
|
|||||||
Term t0[2], to;
|
Term t0[2], to;
|
||||||
t0[0] = python_to_term__(key);
|
t0[0] = python_to_term__(key);
|
||||||
t0[1] = python_to_term__(value);
|
t0[1] = python_to_term__(value);
|
||||||
to = Yap_MkApplTerm(FunctorEq, 2, t0);
|
to = Yap_MkApplTerm(FunctorModule, 2, t0);
|
||||||
if (left--) {
|
if (left--) {
|
||||||
t = Yap_MkNewApplTerm(FunctorOr, 2);
|
t = Yap_MkNewApplTerm(FunctorComma, 2);
|
||||||
*opt = t;
|
*opt = t;
|
||||||
CELL *pt = RepAppl(t) + 1;
|
CELL *pt = RepAppl(t) + 1;
|
||||||
pt[0] = to;
|
pt[0] = to;
|
||||||
|
@ -130,14 +130,15 @@ static bool py_close(int sno) {
|
|||||||
static bool getLine(StreamDesc *rl_iostream, int sno) {
|
static bool getLine(StreamDesc *rl_iostream, int sno) {
|
||||||
char *myrl_line = NULL;
|
char *myrl_line = NULL;
|
||||||
// term_t ctk = python_acquire_GIL();
|
// term_t ctk = python_acquire_GIL();
|
||||||
PyObject_Print(rl_iostream->u.private_data, stderr, 0);
|
PyObject *readl =
|
||||||
/* window of vulnerability opened */
|
PythonLookup("input", Py_None);
|
||||||
PyObject *readl =
|
PyObject_Print(readl, stderr, 0);fprintf(stderr," input\n");
|
||||||
PyObject_GetAttrString(rl_iostream->u.private_data, "readline");
|
|
||||||
PyObject_Print(readl, stderr, 0);
|
|
||||||
|
|
||||||
myrl_line = PyUnicode_AsUTF8(
|
|
||||||
PyObject_CallFunctionObjArgs(readl, rl_iostream->u.private_data, NULL));
|
PyObject *user_inp = PyObject_CallFunction(readl,NULL);
|
||||||
|
PyObject_Print(user_inp, stderr, 0);fprintf(stderr," input\n");
|
||||||
|
myrl_line = PyUnicode_AsUTF8(user_inp);
|
||||||
|
//PyObject_Print(myrl_line, stderr, 0);fprintf(stderr," myrl_line\n");
|
||||||
// python_release_GIL(ctk);
|
// python_release_GIL(ctk);
|
||||||
PyObject *err;
|
PyObject *err;
|
||||||
if ((err = PyErr_Occurred())) {
|
if ((err = PyErr_Occurred())) {
|
||||||
|
@ -72,7 +72,7 @@ python_query( Caller, String ) :-
|
|||||||
atomic_to_term( String, Goal, VarNames ),
|
atomic_to_term( String, Goal, VarNames ),
|
||||||
query_to_answer( Goal, VarNames, Status, Bindings),
|
query_to_answer( Goal, VarNames, Status, Bindings),
|
||||||
atom_to_string( Status, SStatus ),
|
atom_to_string( Status, SStatus ),
|
||||||
Caller.port := SStatus,
|
% Caller.port := SStatus,
|
||||||
write_query_answer( Bindings ),
|
write_query_answer( Bindings ),
|
||||||
nl(user_error),
|
nl(user_error),
|
||||||
Caller.answer := {},
|
Caller.answer := {},
|
||||||
|
@ -37,7 +37,8 @@ jupyter_cell( _Caller, _, `` ) :- !.
|
|||||||
jupyter_cell( _Caller, _, Line ) :-
|
jupyter_cell( _Caller, _, Line ) :-
|
||||||
blank( Line ),
|
blank( Line ),
|
||||||
!.
|
!.
|
||||||
jupyter_cell(Self, _, Line ) :-
|
jupyter_cell(Caller, _, Line ) :-
|
||||||
|
Self := Caller.query,
|
||||||
catch(
|
catch(
|
||||||
python_query(Self,Line),
|
python_query(Self,Line),
|
||||||
E=error(A,B),
|
E=error(A,B),
|
||||||
|
@ -519,6 +519,10 @@ class YAPRun:
|
|||||||
self.shell.yapeng = self.yapeng
|
self.shell.yapeng = self.yapeng
|
||||||
self._get_exc_info = shell._get_exc_info
|
self._get_exc_info = shell._get_exc_info
|
||||||
|
|
||||||
|
|
||||||
|
def showtraceback(self, tuple):
|
||||||
|
return None
|
||||||
|
|
||||||
def syntaxErrors(self, text):
|
def syntaxErrors(self, text):
|
||||||
"""Return whether a legal query
|
"""Return whether a legal query
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user