This commit is contained in:
Vitor Santos Costa 2018-12-11 12:50:52 +00:00
parent afe5780fc1
commit 7e84455117
8 changed files with 47 additions and 54 deletions

View File

@ -904,7 +904,7 @@ static Term syntax_error(TokEntry *errtok, int sno, Term cmod, Int newpos, bool
v_vnames = get_varnames(fe, tokstart);
else
v_vnames = 0L;
if (fe->t && trueGlobalPrologFlag(SINGLE_VAR_WARNINGS_FLAG))
if (fe->t && fe->reading_clause && trueGlobalPrologFlag(SINGLE_VAR_WARNINGS_FLAG))
{
warn_singletons(fe, tokstart);
}

View File

@ -680,12 +680,13 @@ static Int term_to_string(USES_REGS1) {
}
return Yap_unify(ARG2, MkStringTerm(s));
} else if (!IsStringTerm(t2)) {
Yap_Error(TYPE_ERROR_STRING, t2, "string_to_ter®m/2");
Yap_Error(TYPE_ERROR_STRING, t2, "term_to_string/3");
return false;
} else {
s = StringOfTerm(t2);
}
return (rc = readFromBuffer(s, TermNil)) != 0L && Yap_unify(rc, ARG1);
yhandle_t y1 = Yap_InitHandle( t1 );
return (rc = readFromBuffer(s, TermNil)) != 0L && Yap_unify(rc, Yap_PopHandle(y1));
}
static Int term_to_atom(USES_REGS1) {

View File

@ -1,14 +1,16 @@
The YAP Prolog System {#main}
===========
<center>
![The YAP Logo](docs/icons/yap_128x128x32.png)
</center>
NOTE: this version of YAP is still experimental, documentation may be out of date.
## Introduction
Introduction
++++++++++
This document provides User information on version 6.3.4 of
YAP (<em>Yet Another Prolog</em>). The YAP Prolog System is a
YAP (*Yet Another Prolog*). The YAP Prolog System is a
high-performance Prolog compiler developed at Universidade do
Porto. YAP supports stream Input/Output, sockets, modules,
exceptions, Prolog debugger, C-interface, dynamic code, internal
@ -16,7 +18,6 @@ Porto. YAP supports stream Input/Output, sockets, modules,
We explicitly allow both commercial and non-commercial use of YAP.
YAP is based on the David H. D. Warren's WAM (Warren Abstract Machine),
with several optimizations for better performance. YAP follows the
Edinburgh tradition, and was originally designed to be largely
@ -47,47 +48,33 @@ different licenses.
If you have a question about this software, desire to add code, found a
bug, want to request a feature, or wonder how to get further assistance,
please send e-mail to <yap-users AT lists.sourceforge.net>. To
subscribe to the mailing list, visit the page
<https://lists.sourceforge.net/lists/listinfo/yap-users>.
please send e-mail to `yap-users AT lists.sourceforge.net. To
subscribe to the mailing list, visit the [YAP Mailing list page](https://lists.sourceforge.net/lists/listinfo/yap-users).
On-line documentation is available for [YAP](http://www.dcc.fp.pt/~vsc/yap/)
The packages are, in alphabetical order:
+ The CHR package developed by Tom Schrijvers,
Christian Holzbaur, and Jan Wielemaker.
+ The CHR package developed by Tom Schrijvers, Christian Holzbaur, and Jan Wielemaker.
+ The CLP(BN) package and Horus toolkit developed by Tiago Gomes, and Vítor Santos Costa.
+ The CLP(R) package developed by Leslie De Koninck, Bart Demoen, Tom
Schrijvers, and Jan Wielemaker, based on the CLP(Q,R) implementation
by Christian Holzbaur.
+ The CLP(R) package developed by Leslie De Koninck, Bart Demoen, Tom Schrijvers, and Jan Wielemaker, based on the CLP(Q,R) implementation by Christian Holzbaur.
+ The CPLint package developed by Fabrizio Riguzzi's research
laboratory at the [University of Ferrara](http://www.ing.unife.it/Docenti/FabrizioRiguzzi/)
+ The CPLint package developed by Fabrizio Riguzzi's research laboratory at the [University of Ferrara](http://www.ing.unife.it/Docenti/FabrizioRiguzzi/).
+ The CUDA interface package developed by Carlos Martínez, Jorge
Buenabad, Inês Dutra and Vítor Santos Costa.
+ The CUDA interface package developed by Carlos Martínez, Jorge Buenabad, Inês Dutra and Vítor Santos Costa.
+ The [GECODE](http://www.gecode.org) interface package developed by Denys Duchier and Vítor Santos Costa.
+ The [JPL](http://www.swi-prolog.org/packages/jpl/) (Java-Prolog Library) package developed by .
The minisat SAT solver interface developed by Michael Codish,
Vitaly Lagoon, and Peter J. Stuckey.
+ The minisat SAT solver interface developed by Michael Codish, Vitaly Lagoon, and Peter J. Stuckey.
+ The MYDDAS relational data-base interface developed at the
Universidade do Porto by Tiago Soares, Michel Ferreira, and Ricardo Rocha.
+ The MYDDAS relational data-base interface developed at the Universidade do Porto by Tiago Soares, Michel Ferreira, and Ricardo Rocha.
+ The [PRISM](http://rjida.meijo-u.ac.jp/prism/) logic-based
programming system for statistical modeling developed at the Sato
Research Laboratory, TITECH, Japan.
+ The [PRISM](http://rjida.meijo-u.ac.jp/prism/) logic-based programming system for statistical modeling developed at the Sato Research Laboratory, TITECH, Japan.
+ The ProbLog 1 system developed by the [ProbLog](https://dtai.cs.kuleuven.be/problog) team in the
DTAI group of KULeuven.
+ The ProbLog 1 system developed by the [ProbLog](https://dtai.cs.kuleuven.be/problog) team in the DTAI group of KULeuven.
+ The [R](http://stoics.org.uk/~nicos/sware/packs/real/) interface package developed by Nicos Angelopoulos,
Vítor Santos Costa, João Azevedo, Jan Wielemaker, and Rui Camacho.
+ The [R](http://stoics.org.uk/~nicos/sware/packs/real/) interface package developed by Nicos Angelopoulos, Vítor Santos Costa, João Azevedo, Jan Wielemaker, and Rui Camacho.

View File

@ -75,20 +75,24 @@ python_query( Caller, String ) :-
write_query_answer( Bindings ),
nl(user_error),
Caller.answer := {},
maplist(in_dict(Caller.answer), Bindings).
maplist(in_dict(Caller.answer, Bindings), Bindings).
in_dict(Dict, var([V0,V|Vs])) :-
/**
*
*/
in_dict(_Dict, _, var([_V0])) :-
!.
in_dict(Dict, Bindings, var([V0,V|Vs])) :-
!,
atom_string(V0,S0),
atom_string(V,S),
atom_to_string(V0,S0),
atom_to_string(V,S),
Dict[S] := S0,
in_dict( Dict, var([V0|Vs])).
in_dict(Dict, nonvar([V0|Vs], T)) :-
in_dict( Dict, Bindings, var([V0|Vs])).
in_dict(Dict, Bindings, nonvar([V0|Vs], T)) :-
!,
atom_string(V0,S0),
atom_string(T,S),
atom_to_string(V0,S0),
term_to_string(T, S, _Bindings),
Dict[S0] := S,
in_dict( Dict, var([V0|Vs])).
in_dict(_,_).
in_dict( Dict, Bindings, var([V0|Vs])).
in_dict(_, _, _).

View File

@ -2040,7 +2040,7 @@ class InteractiveShell(SingletonConfigurable):
list where you want the completer to be inserted."""
newcomp = types.MethodType(completer,self.Completer)
self.Completer.matchers.insert(pos,newcomp)
self.Completer.matches.insert(pos,newcomp)
def set_completer_frame(self, frame=None):
"""Set the frame of the completer."""

View File

@ -38,7 +38,7 @@ jupyter_cell( _Caller, _, Line ) :-
blank( Line ),
!.
jupyter_cell(Caller, _, Line ) :-
Query = Caller,
Query = Caller,
catch(
python_query(Query,Line),
error(A,B),
@ -67,7 +67,7 @@ jupyter_consult(Cell) :-
(
Options = [],
open_mem_read_stream( Cell, Stream),
load_files(user:'jupyter cell',[stream(Stream)| Options])
load_files(Stream,[stream(Stream)| Options])
),
error(A,B),
(close(Stream), system_error(A,B))
@ -88,11 +88,11 @@ blank(Text) :-
streams(false) :-
%close(user_input),
close(user_input),
close(user_output),
close(user_error).
streams( true) :-
%open('/python/input', read, _Input, [alias(user_input),bom(false),script(false)]),
open('/python/input', read, _Input, [alias(user_input),bom(false),script(false)]),
open('/python/sys.stdout', append, _Output, [alias(user_output)]),
open('/python/sys.stderr', append, _Error, [alias(user_error)]).

View File

@ -739,12 +739,13 @@ class YAPRun(InteractiveShell):
# def f(self, cell, state):
# state = self.jupyter_query( cell )
# run the new command using the given tracer
#
# tracer.runfunc(f,self,cell,state)
self.jupyter_query( cell )
# state = tracer.runfunc(jupyter_query( self, cell ) )
# run the new command using the given tracer
#
# tracer.runfunc(f,self,cell,state)
self.jupyter_query( cell )
# state = tracer.runfunc(jupyter_query( self, cell ) )
self.shell.last_execution_succeeded = True
result.info += [self.answer]
result.result = True
except Exception as e:
has_raised = True
@ -773,7 +774,7 @@ class YAPRun(InteractiveShell):
self.shell.execution_count += 1
self.yapeng.mgoal(streams(False),"user", True)
return result
return result.result
def clean_end(self,s):
"""