yapi back to work
This commit is contained in:
Vitor Santos Costa 2018-10-19 16:19:53 +01:00
parent 45439b8b86
commit ced5916aa8
4 changed files with 48 additions and 36 deletions

View File

@ -1,3 +1,4 @@
#CHECK: JavaLibs #CHECK: JavaLibs
set (JPL_SOURCES set (JPL_SOURCES

View File

@ -4,16 +4,25 @@ add_lib(jplYap jpl.h jpl.c hacks.h)
include_directories (${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_PATH} ) include_directories (${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_PATH} )
if (APPLE) if (APPLE)
get_filename_component ( JAVA_AWT_DIR ${JAVA_AWT_LIBRARY} DIRECTORY) set(CMAKE_MACOSX_RPATH 1)
find_library (JLI jli ${JAVA_AWT_DIR}/jli) get_filename_component ( JAVA_AWT_DIR ${JAVA_AWT_LIBRARY} DIRECTORY)
get_filename_component ( JAVA_JNI_DIR ${JAVA_JVM_LIBRARY} DIRECTORY)
find_library (JLI jli ${JAVA_AWT_DIR}/jli)
find_library (JAL JavaApplicationLauncher FRAMEWORK ONLY PATH /System/Library/PrivateFrameworks)
find_library (JL JavaLaunching FRAMEWORK ONLY PATH /System/Library/PrivateFrameworks)
SET(CMAKE_INSTALL_RPATH "${JAVA_AWT_DIR}/jli")
target_link_libraries(jplYap libYap ${JL} ${JAL} -L${JAVA_AWT_DIR}/jli -ljli )
else()
target_link_libraries(jplYap libYap ${JAVA_JVM_LIBRARY})
endif() endif()
target_link_libraries(jplYap libYap ${JLI} ${JNI_LIBRARIES})
set_target_properties(jplYap PROPERTIES set_target_properties(jplYap PROPERTIES
OUTPUT_NAME jpl OUTPUT_NAME jpl
INSTALL_RPATH_USE_LINK_PATH TRUE
) )
# set(YAP_SYSTEM_OPTIONS "jpl " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE) # set(YAP_SYSTEM_OPTIONS "jpl " ${YAP_SYSTEM_OPTIONS} PARENT_SCOPE)

View File

@ -1,4 +1,4 @@
:- module(test_jpl, f:- module(test_jpl,
[ run_tests/0, [ run_tests/0,
run_tests/1 run_tests/1
]). ]).

View File

@ -6,14 +6,14 @@ from traitlets import Bool
from yap4py.yapi import * from yap4py.yapi import *
from yap_ipython.core.completer import Completer from IPython.core.completer import Completer
# import yap_ipython.core # import IPython.core
from traitlets import Instance from traitlets import Instance
from yap_ipython.core.inputsplitter import * from IPython.core.inputsplitter import *
from yap_ipython.core.inputtransformer import * from IPython.core.inputtransformer import *
from yap_ipython.core.interactiveshell import * from IPython.core.interactiveshell import *
from ipython_genutils.py3compat import builtin_mod from ipython_genutils.py3compat import builtin_mod
from yap_ipython.core import interactiveshell from IPython.core import interactiveshell
from collections import namedtuple from collections import namedtuple
import traceback import traceback
@ -198,11 +198,11 @@ class YAPInputSplitter(InputSplitter):
self.reset() self.reset()
def push(self, lines): def push(self, lines):
"""Push one or more lines of yap_ipython input. """Push one or more lines of IPython input.
This stores the given lines and returns a status code indicating This stores the given lines and returns a status code indicating
whether the code forms a complete Python block or not, after processing whether the code forms a complete Python block or not, after processing
all input lines for special yap_ipython syntax. all input lines for special IPython syntax.
Any exceptions generated in compilation are swallowed, but if an Any exceptions generated in compilation are swallowed, but if an
exception was produced, the method returns True. exception was produced, the method returns True.
@ -488,7 +488,7 @@ class YAPCompleter(Completer):
If ``IPCompleter.debug`` is :any:`True` will yield a ``--jedi/ipython--`` If ``IPCompleter.debug`` is :any:`True` will yield a ``--jedi/ipython--``
fake Completion token to distinguish completion returned by Jedi fake Completion token to distinguish completion returned by Jedi
and usual yap_ipython completion. and usual IPython completion.
.. note:: .. note::
@ -507,7 +507,7 @@ class YAPCompleter(Completer):
class YAPRun: class YAPRun(InteractiveShell):
"""An enhanced, interactive shell for YAP.""" """An enhanced, interactive shell for YAP."""
def __init__(self, shell): def __init__(self, shell):
@ -602,28 +602,29 @@ class YAPRun:
return self.result return self.result
def _yrun_cell(self, raw_cell, store_history=True, silent=False, def _yrun_cell(self, raw_cell, store_history=True, silent=False,
shell_futures=True): shell_futures=True):
"""Run a complete IPython cell. """Run a complete IPython cell.
-
Parameters Parameters
---------- ----------
raw_cell : str raw_cell : str
The code (including IPython code such as The code (including IPython code such as
%magic functions) to run. %magic functions) to run.
store_history : bool store_history : bool
If True, the raw and translated cell will be stored in IPython's If True, the raw and translated cell will be stored in IPython's
history. For user code calling back into history. For user code calling back into
IPython's machinery, this IPython's machinery, this
should be set to False. should be set to False.
silent : bool silent : bool
If True, avoid side-effects, such as implicit displayhooks and If True, avoid side-effects, such as implicit displayhooks and
and logging. silent=True forces store_history=False. and logging. silent=True forces store_history=False.
shell_futures : bool shell_futures : bool
If True, the code will share future statements with the interactive If True, the code will share future statements with the interactive
shell. It will both be affected by previous shell. It will both be affected by previous
__future__ imports, and any __future__ imports in the code __future__ imports, and any __future__ imports in the code
will affect the shell. If False, will affect the shell. If False,
__future__ imports are not shared in either direction. __future__ imports are not shared in either direction.
Returns Returns
@ -727,6 +728,7 @@ class YAPRun:
self.result.result = False self.result.result = False
has_raised = False has_raised = False
try: try:
builtin_mod.input = self.shell.sys_raw_input
self.yapeng.mgoal(streams(True),"user", True) self.yapeng.mgoal(streams(True),"user", True)
if cell.strip('\n \t'): if cell.strip('\n \t'):
#create a Trace object, telling it what to ignore, and whether to #create a Trace object, telling it what to ignore, and whether to