meta
This commit is contained in:
@@ -71,21 +71,21 @@ argi(N,I,I1) :-
|
||||
python_query( Caller, String ) :-
|
||||
writeln(String),
|
||||
atomic_to_term( String, Goal, VarNames ),
|
||||
query_to_answer( Goal, VarNames, Status, Bindings),
|
||||
query_to_answer( Goal, VarNames, Status, Bindings),
|
||||
Caller.q.port := Status,
|
||||
% := print( gc.get_referrers(Caller.port)),
|
||||
write_query_answer( Bindings ),
|
||||
nl(user_error),
|
||||
Caller.q.answer := {},
|
||||
maplist(in_dict(Caller.answer), Bindings).
|
||||
maplist(in_dict(Caller.q.answer), Bindings).
|
||||
% := print( "b", gc.get_referrers(Caller.answer)).
|
||||
|
||||
in_dict(Dict, var([V0,V|Vs])) :- !,
|
||||
Dict[V] := V0,
|
||||
in_dict( Dict, var([V0|Vs])).
|
||||
in_dict(Dict, var([],_G)) :- !.
|
||||
in_dict(_Dict, var([_],_G)) :- !.
|
||||
in_dict(Dict, nonvar([V0|Vs],G)) :- !,
|
||||
Dict[V0] := G,
|
||||
in_dict( Dict, var([V0|Vs])).
|
||||
in_dict(Dict, nonvar([],_G)) :- !.
|
||||
in_dict( Dict, nonvar(Vs, Gs)).
|
||||
in_dict(_Dict, nonvar([],_G)) :- !.
|
||||
in_dict(_, _).
|
||||
|
@@ -65,11 +65,11 @@ if platform.system() == 'Windows':
|
||||
win_libs = ['wsock32','ws2_32']
|
||||
my_extra_link_args = ['-Wl,-export-all-symbols']
|
||||
elif platform.system() == 'Darwin':
|
||||
my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/usr/local/lib','-Wl,-rpath,../yap4py']
|
||||
my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/lib','-Wl,-rpath,../yap4py']
|
||||
win_libs = []
|
||||
local_libs = ['Py4YAP']
|
||||
elif platform.system() == 'Linux':
|
||||
my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/usr/local/lib','-Wl,-rpath,'+join('/usr/local/lib','..'),'-Wl,-rpath,../yap4py']
|
||||
my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/lib','-Wl,-rpath,'+join('/lib','..'),'-Wl,-rpath,../yap4py']
|
||||
win_libs = []
|
||||
local_libs = ['Py4YAP']
|
||||
|
||||
@@ -90,10 +90,10 @@ extensions = [Extension('_yap', native_sources,
|
||||
('YAP_PYTHON', '1'),
|
||||
('_GNU_SOURCE', '1')],
|
||||
runtime_library_dirs=[
|
||||
abspath(join(sysconfig.get_path('platlib'),'yap4py')), abspath(sysconfig.get_path('platlib')),'/usr/local/lib'],
|
||||
abspath(join(sysconfig.get_path('platlib'),'yap4py')), abspath(sysconfig.get_path('platlib')),'/lib'],
|
||||
swig_opts=['-modern', '-c++', '-py3',
|
||||
'-DX_API', '-Iyap4py/include' ],
|
||||
library_dirs=[".",'../../..','/usr/local/lib'],
|
||||
library_dirs=[".",'../../..','/lib'],
|
||||
extra_link_args=my_extra_link_args,
|
||||
libraries=['Yap','gmp']+win_libs+local_libs,
|
||||
include_dirs=['/home/vsc/github/yap-6.3/H',
|
||||
|
@@ -71,14 +71,16 @@ class Query:
|
||||
def __next__(self):
|
||||
if not self.q:
|
||||
raise StopIteration()
|
||||
if self.port == "exit":
|
||||
self.close()
|
||||
return
|
||||
if self.q.next():
|
||||
rc = self.q.answer
|
||||
# if self.q.port == "exit":
|
||||
rc = self.answer
|
||||
return rc
|
||||
else:
|
||||
if self:
|
||||
if self.q:
|
||||
self.close()
|
||||
raise StopIteration()
|
||||
raise RuntimeError()
|
||||
|
||||
def close( self ):
|
||||
if self.q:
|
||||
@@ -189,7 +191,7 @@ class YAPShell:
|
||||
self.q = None
|
||||
print("Exception",e)
|
||||
e.errorNo = 0
|
||||
return False, None
|
||||
raise
|
||||
|
||||
def live(self, engine, **kwargs):
|
||||
loop = True
|
||||
@@ -204,6 +206,7 @@ class YAPShell:
|
||||
self.query_prolog(s)
|
||||
except SyntaxError as err:
|
||||
print("Syntax Error error: {0}".format(err))
|
||||
continue
|
||||
except EOFError:
|
||||
return
|
||||
except RuntimeError as err:
|
||||
|
Reference in New Issue
Block a user