From 9448663989e3069101c7099763db186f744e00f0 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 16 Dec 2016 21:32:37 +0100 Subject: [PATCH 001/193] Add first version of PythonPlugin --- rsqueakvm/model/numeric.py | 8 +- rsqueakvm/model/variable.py | 2 +- rsqueakvm/plugins/python_plugin.py | 310 +++++++++++++++++++++++++++++ rsqueakvm/primitives/control.py | 3 +- rsqueakvm/squeakimage.py | 2 +- rsqueakvm/util/shell.py | 2 +- targetrsqueak.py | 18 +- 7 files changed, 330 insertions(+), 15 deletions(-) create mode 100644 rsqueakvm/plugins/python_plugin.py diff --git a/rsqueakvm/model/numeric.py b/rsqueakvm/model/numeric.py index 57700193..6e4d46cf 100644 --- a/rsqueakvm/model/numeric.py +++ b/rsqueakvm/model/numeric.py @@ -225,7 +225,7 @@ def __init__(self, space, w_class, value, size=0): def fillin(self, space, g_self): W_AbstractObjectWithClassReference.fillin(self, space, g_self) bytes = g_self.get_bytes() - value = rbigint.rbigint.frombytes(bytes, 'little', False) + value = rbigint.rbigint.frombytes(''.join(bytes), 'little', False) if self.getclass(space).is_same_object(space.w_LargePositiveInteger): self.value = value else: @@ -256,7 +256,7 @@ def atput0(self, space, n0, w_value): bytes[n0] = chr(space.unwrap_int(w_value)) except ValueError: # when we try to put sth outside of chr range raise error.PrimitiveFailedError - value = rbigint.rbigint.frombytes(bytes, 'little', False) + value = rbigint.rbigint.frombytes(''.join(bytes), 'little', False) if self.getclass(space).is_same_object(space.w_LargePositiveInteger): self.value = value else: @@ -318,7 +318,7 @@ def size(self): def fillin(self, space, g_self): W_AbstractObjectWithClassReference.fillin(self, space, g_self) bytes = g_self.get_bytes() - value = rbigint.rbigint.frombytes(bytes, 'little', False) + value = rbigint.rbigint.frombytes(''.join(bytes), 'little', False) self.value = value.touint() self._exposed_size = len(bytes) @@ -411,7 +411,7 @@ def __init__(self, value): def fillin(self, space, g_self): "This is only called for Large Integers that for us fit in SmallIntegers" bytes = g_self.get_bytes() - value = rbigint.rbigint.frombytes(bytes, 'little', False) + value = rbigint.rbigint.frombytes(''.join(bytes), 'little', False) w_prev_class = g_self.get_class() if not w_prev_class.is_same_object(space.w_LargePositiveInteger): value = value.neg() diff --git a/rsqueakvm/model/variable.py b/rsqueakvm/model/variable.py index 2c7b053c..ea3dd607 100644 --- a/rsqueakvm/model/variable.py +++ b/rsqueakvm/model/variable.py @@ -143,7 +143,7 @@ def unwrap_long_untranslated(self, space): @elidable_for_version_iff(0, cond=lambda self: jit.isconstant(self)) def getrbigint(self): from rpython.rlib.rbigint import rbigint - return rbigint.frombytes(self.getbytes(), 'little', False) + return rbigint.frombytes(''.join(self.getbytes()), 'little', False) def selector_string(self): return "#" + self.unwrap_string(None) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py new file mode 100644 index 00000000..e85d407c --- /dev/null +++ b/rsqueakvm/plugins/python_plugin.py @@ -0,0 +1,310 @@ +from rsqueakvm.util import system +if "PythonPlugin" not in system.optional_plugins: + raise LookupError +else: + system.translationconfig.set(thread=True) + system.translationconfig.set(continuation=True) + +from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.model.numeric import W_Float, W_SmallInteger +from rsqueakvm.model.variable import W_BytesObject +from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash +from rsqueakvm.model.compiled_methods import W_PreSpurCompiledMethod, W_SpurCompiledMethod +from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts +from rsqueakvm.storage_classes import ClassShadow +from rsqueakvm.storage import AbstractCachingShadow +from rsqueakvm.primitives.constants import EXTERNAL_CALL +from rsqueakvm.util.cells import QuasiConstant + +from pypy.interpreter import main +from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject +from pypy.objspace.std.intobject import W_IntObject as WP_IntObject +from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject +from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject +from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject +from pypy.objspace.std.listobject import W_ListObject as WP_ListObject + +from pypy.interpreter.baseobjspace import W_Root +from pypy.interpreter.error import OperationError + +from rpython.rlib import objectmodel, jit + +_DO_NOT_RELOAD = True + + +def _new_pypy_objspace(): + import sys + + # This module is reloaded, but pypy_getudir has already been deleted + from pypy.module import sys as pypy_sys + reload(pypy_sys) + # if 'pypy_getudir' not in Module.interpleveldefs: + # Module.interpleveldefs['pypy_getudir'] = 'foo' + + from pypy.config.pypyoption import get_pypy_config + translating = sys.argv[0] != '.build/run.py' # make better + pypy_config = get_pypy_config(translating=translating) + from pypy.config.pypyoption import enable_allworkingmodules + from pypy.config.pypyoption import enable_translationmodules + enable_allworkingmodules(pypy_config) + enable_translationmodules(pypy_config) + + # pypy_config.translation.check_str_without_nul = True + + # ensures pypy_hooks has a .space + pypy_config.objspace.usemodules.pypyjit = True + + # PyPy needs threads + pypy_config.translation.thread = True + pypy_config.translation.continuation = True + + # pypy_config.objspace.usemodules.pyexpat = False + + # Python objectspace ctor is not Rpython so create it here and + # encapsulate it inside the entry point with a closure. + from pypy.objspace.std import StdObjSpace as PyStdObjSpace + return PyStdObjSpace(pypy_config) +python_space = _new_pypy_objspace() + +# Patch-out virtualizables from Pypy so that translation works +from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver +try: + # TODO: what if first delattr fails? + delattr(PyFrame, "_virtualizable_") + delattr(PyPyJitDriver, "virtualizables") +except AttributeError: + pass + + +class PythonPluginClass(Plugin): + _attrs_ = ["w_python_object_class", "w_python_plugin_send"] + + def __init__(self): + Plugin.__init__(self) + self.w_python_object_class = QuasiConstant( + None, type=W_AbstractObjectWithIdentityHash) + self.w_python_plugin_send = QuasiConstant( + None, type=W_AbstractObjectWithIdentityHash) +PythonPlugin = PythonPluginClass() + + +def startup(space, argv): + PythonPlugin.w_python_plugin_send.set(space.wrap_list_unroll_safe([ + space.wrap_string("PythonPlugin"), + space.wrap_string("send") + ])) + w_python_class = space.smalltalk_at("PythonObject") + if w_python_class is None: + w_python_class = space.w_nil.getclass(space) + PythonPlugin.w_python_object_class.set(w_python_class) + python_space.startup() +PluginStartupScripts.append(startup) + + +@objectmodel.specialize.argtype(0) +def wrap(interp, wp_object): + # import pdb; pdb.set_trace() + space = interp.space + if isinstance(wp_object, WP_FloatObject): + return space.wrap_float(python_space.float_w(wp_object)) + elif isinstance(wp_object, WP_IntObject): + return space.wrap_int(python_space.int_w(wp_object)) + elif isinstance(wp_object, WP_BytesObject): + return space.wrap_string(python_space.str_w(wp_object)) + elif isinstance(wp_object, WP_ListObject): + return space.wrap_list( + [wrap(interp, item) for item in wp_object.getitems()]) + elif isinstance(wp_object, WP_NoneObject): + return space.w_nil + elif wp_object is WP_BoolObject.w_False: + return space.w_false + elif wp_object is WP_BoolObject.w_True: + return space.w_true + else: + return W_PythonObject(wp_object) + + +@objectmodel.specialize.argtype(0) +def unwrap(interp, w_object): + # import pdb; pdb.set_trace() + space = interp.space + if isinstance(w_object, W_PythonObject): + return w_object.wp_object + elif isinstance(w_object, W_Float): + return python_space.newfloat(space.unwrap_float(w_object)) + elif isinstance(w_object, W_SmallInteger): + return python_space.newint(space.unwrap_int(w_object)) + elif isinstance(w_object, W_BytesObject): + # if w_object.getclass(space).is_same_object(space.w_String): + return python_space.newbytes(space.unwrap_string(w_object)) + raise PrimitiveFailedError + + +class W_PythonObject(W_AbstractObjectWithIdentityHash): + _attrs_ = ["wp_object", "s_class"] + _immutable_fields_ = ["wp_object", "s_class?"] + repr_classname = "W_PythonObject" + + def __init__(self, wp_object): + self.wp_object = wp_object + self.s_class = None + + def getclass(self, space): + return W_PythonObject(self.wp_object.getclass(python_space)) + + def class_shadow(self, space): + wp_class = python_space.type(self.wp_object) + return W_PythonObject.pure_class_shadow(space, wp_class) + + @staticmethod + @jit.elidable + def pure_class_shadow(space, wp_class): + return PythonClassShadowCache.setdefault( + wp_class, PythonClassShadow(space, wp_class)) + + def is_same_object(self, other): + return (isinstance(other, W_PythonObject) and + other.wp_object is self.wp_object) + +PythonClassShadowCache = {} + + +class PythonClassShadow(ClassShadow): + _attrs_ = ["wp_class"] + _immutable_fields_ = ["wp_class"] + + def __init__(self, space, wp_class): + assert isinstance(wp_class, W_Root) + self.wp_class = wp_class + self.name = wp_class.name + AbstractCachingShadow.__init__( + self, space, space.w_nil, 0, space.w_nil) + + def changed(self): + pass # Changes to Python classes are handled in Python land + + def lookup(self, w_selector): + w_method = self.make_method(w_selector) + if w_method is None: + w_po = PythonPlugin.w_python_object_class.get() + return w_po.as_class_get_shadow(self.space).lookup(w_selector) + return w_method + + def make_method(self, w_selector): + methodname = self.space.unwrap_string(w_selector) + idx = methodname.find(":") + if idx > 0: + methodname = methodname[0:idx] + python_method = self.wp_class.lookup(methodname) + if python_method is None: + return None + if self.space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 0 + w_cm._primitive = EXTERNAL_CALL + w_cm.literalsize = 2 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.bytes = [] + w_cm.literals = [ + PythonPlugin.w_python_plugin_send.get(), + w_selector + ] + return w_cm + + +@PythonPlugin.expose_primitive(unwrap_spec=[object, str]) +def eval(interp, s_frame, w_rcvr, source): + try: + fake_globals = python_space.newdict() + fake_locals = python_space.newdict() + pycode = main.compilecode(python_space, source, '', 'eval') + retval = pycode.exec_code(python_space, fake_globals, fake_locals) + return wrap(interp, retval) + except OperationError as operationerr: + print operationerr.errorstr(python_space) + raise PrimitiveFailedError + + +def _call_method(interp, wp_rcvr, methodname, args_w): + args_w_len = len(args_w) + if args_w_len == 1: + arg1 = unwrap(interp, args_w[0]) + return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1)) + elif args_w_len == 2: + arg1 = unwrap(interp, args_w[0]) + arg2 = unwrap(interp, args_w[1]) + return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2)) + elif args_w_len == 3: + arg1 = unwrap(interp, args_w[0]) + arg2 = unwrap(interp, args_w[1]) + arg3 = unwrap(interp, args_w[2]) + return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3)) + elif args_w_len == 4: + arg1 = unwrap(interp, args_w[0]) + arg2 = unwrap(interp, args_w[1]) + arg3 = unwrap(interp, args_w[2]) + arg4 = unwrap(interp, args_w[3]) + return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4)) + elif args_w_len == 5: + arg1 = unwrap(interp, args_w[0]) + arg2 = unwrap(interp, args_w[1]) + arg3 = unwrap(interp, args_w[2]) + arg4 = unwrap(interp, args_w[3]) + arg5 = unwrap(interp, args_w[4]) + return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5)) + elif args_w_len == 6: + arg1 = unwrap(interp, args_w[0]) + arg2 = unwrap(interp, args_w[1]) + arg3 = unwrap(interp, args_w[2]) + arg4 = unwrap(interp, args_w[3]) + arg5 = unwrap(interp, args_w[4]) + arg6 = unwrap(interp, args_w[5]) + return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6)) + elif args_w_len == 7: + arg1 = unwrap(interp, args_w[0]) + arg2 = unwrap(interp, args_w[1]) + arg3 = unwrap(interp, args_w[2]) + arg4 = unwrap(interp, args_w[3]) + arg5 = unwrap(interp, args_w[4]) + arg6 = unwrap(interp, args_w[5]) + arg7 = unwrap(interp, args_w[6]) + return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) + elif args_w_len == 8: + arg1 = unwrap(interp, args_w[0]) + arg2 = unwrap(interp, args_w[1]) + arg3 = unwrap(interp, args_w[2]) + arg4 = unwrap(interp, args_w[3]) + arg5 = unwrap(interp, args_w[4]) + arg6 = unwrap(interp, args_w[5]) + arg7 = unwrap(interp, args_w[6]) + arg8 = unwrap(interp, args_w[7]) + return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) + return wrap(interp, python_space.call_method(wp_rcvr, methodname)) + +@PythonPlugin.expose_primitive(compiled_method=True) +@jit.unroll_safe +def send(interp, s_frame, argcount, w_method): + args_w = s_frame.peek_n(argcount) + w_literal2 = w_method.literalat0(interp.space, 2) + methodname = "" + if isinstance(w_literal2, W_BytesObject): + wp_rcvr = unwrap(interp, s_frame.peek(argcount)) + methodname = interp.space.unwrap_string(w_literal2) + elif argcount == 3: + methodname = interp.space.unwrap_string(args_w[0]) + wp_rcvr = unwrap(interp, args_w[1]) + args_w = interp.space.unwrap_array(args_w[2]) + else: + raise PrimitiveFailedError + idx = methodname.find(":") + if idx > 0: + methodname = methodname[0:idx] + try: + return _call_method(interp, wp_rcvr, methodname, args_w) + except OperationError as operationerr: + print operationerr.errorstr(python_space) + raise PrimitiveFailedError diff --git a/rsqueakvm/primitives/control.py b/rsqueakvm/primitives/control.py index d61d7ed0..11b02e42 100644 --- a/rsqueakvm/primitives/control.py +++ b/rsqueakvm/primitives/control.py @@ -119,7 +119,8 @@ def find_plugins(): # The plugin may have decided it doesn't want to be enabled disabled_plugin_names.append(pluginname) continue - reload(module) # always do a one-shot reload + if not hasattr(module, '_DO_NOT_RELOAD'): + reload(module) # always do a one-shot reload plugin = getattr(module, pluginname) plugin_names.append(pluginname) plugins.append(plugin) diff --git a/rsqueakvm/squeakimage.py b/rsqueakvm/squeakimage.py index ec3eee19..583a2794 100644 --- a/rsqueakvm/squeakimage.py +++ b/rsqueakvm/squeakimage.py @@ -378,7 +378,7 @@ def issignedinteger(self, g_object): if not self.islargeinteger(g_object): return False bytes = g_object.get_bytes() - value = rbigint.rbigint.frombytes(bytes, 'little', False) + value = rbigint.rbigint.frombytes(''.join(bytes), 'little', False) if g_object.g_class != self.special_g_object_safe(constants.SO_LARGEPOSITIVEINTEGER_CLASS): value = value.neg() try: diff --git a/rsqueakvm/util/shell.py b/rsqueakvm/util/shell.py index ea0d9b74..eef7fa61 100644 --- a/rsqueakvm/util/shell.py +++ b/rsqueakvm/util/shell.py @@ -226,7 +226,7 @@ def run(self): w_result = None try: w_result = self._execute_code(code) - except: + except Exception as e: print "Error: ", sys.exc_info()[0] import pdb; pdb.set_trace() if w_result: diff --git a/targetrsqueak.py b/targetrsqueak.py index 4e6dd626..dba2882e 100755 --- a/targetrsqueak.py +++ b/targetrsqueak.py @@ -9,6 +9,7 @@ from rpython.jit.codewriter.policy import JitPolicy from rpython.rlib import objectmodel +from pypy.tool.ann_override import PyPyAnnotatorPolicy sys.setrecursionlimit(15000) @@ -32,14 +33,17 @@ def target(driver, args): system.expose_options(driver.config) # We must not import this before the config was exposed from rsqueakvm.main import safe_entry_point - return safe_entry_point, None + return safe_entry_point, None, PyPyAnnotatorPolicy() def jitpolicy(self): - if "JitHooks" in system.optional_plugins: - from rsqueakvm.plugins.vmdebugging.hooks import jitiface - return JitPolicy(jitiface) - else: - return JitPolicy() + from pypy.module.pypyjit.policy import PyPyJitPolicy + from pypy.module.pypyjit.hooks import pypy_hooks + return PyPyJitPolicy(pypy_hooks) + # if "JitHooks" in system.optional_plugins: + # from rsqueakvm.plugins.vmdebugging.hooks import jitiface + # return JitPolicy(jitiface) + # else: + # return JitPolicy() def parser(config): return to_optparse(config, useoptions=["rsqueak.*"]) @@ -65,7 +69,7 @@ def get_additional_config_options(): configargs, args = sys.argv[0:idx], sys.argv[idx:] else: configargs, args = [], sys.argv - f, _ = target(driver, configargs) + f, _, _ = target(driver, configargs) try: sys.exit(f(args)) except SystemExit: From 0682e1a11036bfb6e0b65919c4cb58de8e84c738 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 18 Dec 2016 11:08:04 +0100 Subject: [PATCH 002/193] Fix translation and misc improvements --- rsqueakvm/plugins/python_plugin.py | 113 +++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 32 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index e85d407c..9cee752c 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -23,6 +23,7 @@ from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject from pypy.objspace.std.listobject import W_ListObject as WP_ListObject +from pypy.module.__builtin__ import compiling as py_compiling from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.error import OperationError @@ -33,6 +34,7 @@ def _new_pypy_objspace(): + import os import sys # This module is reloaded, but pypy_getudir has already been deleted @@ -44,6 +46,13 @@ def _new_pypy_objspace(): from pypy.config.pypyoption import get_pypy_config translating = sys.argv[0] != '.build/run.py' # make better pypy_config = get_pypy_config(translating=translating) + + # cpyext causes a lot of "Undefined symbols for architecture x86_64" errors + pypy_config.objspace.usemodules.cpyext = False + + # disabling cffi backend for now, it also causes an undefined symbol error + pypy_config.objspace.usemodules._cffi_backend = False + from pypy.config.pypyoption import enable_allworkingmodules from pypy.config.pypyoption import enable_translationmodules enable_allworkingmodules(pypy_config) @@ -54,17 +63,46 @@ def _new_pypy_objspace(): # ensures pypy_hooks has a .space pypy_config.objspace.usemodules.pypyjit = True - # PyPy needs threads - pypy_config.translation.thread = True pypy_config.translation.continuation = True - # pypy_config.objspace.usemodules.pyexpat = False + pypy_config.objspace.usemodules.pyexpat = False + + # Copy over some options that should be the same in both configs + pypy_config.translation.make_jobs = system.translationconfig.make_jobs + if system.translationconfig.output is not None: + pypy_config.translation.output = system.translationconfig.output + + # merge_configs(config, pypy_config, "RSqueak", "PyPy") + + # PyPy needs threads + pypy_config.translation.thread = True # Python objectspace ctor is not Rpython so create it here and # encapsulate it inside the entry point with a closure. from pypy.objspace.std import StdObjSpace as PyStdObjSpace - return PyStdObjSpace(pypy_config) -python_space = _new_pypy_objspace() + + py_space = PyStdObjSpace(pypy_config) + + # equivalent to the hack in app_main.py of PyPy, albiet interp-level. + w_sys = py_space.sys + w_modnames = w_sys.get("builtin_module_names") + w_in = py_space.contains(w_modnames, py_space.wrap("__pypy__")) + if not py_space.is_true(w_in): + rl = py_space.sys.get("setrecursionlimit") + py_space.call(rl, py_space.newlist([py_space.wrap(5000)])) + + # Should always be able to import Python modules in CWD. + w_sys_path = py_space.getattr(w_sys, py_space.wrap("path")) + py_space.call_method(w_sys_path, 'append', py_space.wrap(".")) + + # Set sys.executable in PyPy -- some modules rely upon this existing. + py_space.setattr(w_sys, py_space.wrap("executable"), + py_space.wrap(os.path.abspath(sys.argv[0]))) + return py_space + +py_space = _new_pypy_objspace() +py_globals = py_space.newdict() +py_locals = py_space.newdict() # Patch-out virtualizables from Pypy so that translation works from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver @@ -97,7 +135,7 @@ def startup(space, argv): if w_python_class is None: w_python_class = space.w_nil.getclass(space) PythonPlugin.w_python_object_class.set(w_python_class) - python_space.startup() + py_space.startup() PluginStartupScripts.append(startup) @@ -106,15 +144,15 @@ def wrap(interp, wp_object): # import pdb; pdb.set_trace() space = interp.space if isinstance(wp_object, WP_FloatObject): - return space.wrap_float(python_space.float_w(wp_object)) + return space.wrap_float(py_space.float_w(wp_object)) elif isinstance(wp_object, WP_IntObject): - return space.wrap_int(python_space.int_w(wp_object)) + return space.wrap_int(py_space.int_w(wp_object)) elif isinstance(wp_object, WP_BytesObject): - return space.wrap_string(python_space.str_w(wp_object)) + return space.wrap_string(py_space.str_w(wp_object)) elif isinstance(wp_object, WP_ListObject): return space.wrap_list( [wrap(interp, item) for item in wp_object.getitems()]) - elif isinstance(wp_object, WP_NoneObject): + elif wp_object is None or isinstance(wp_object, WP_NoneObject): return space.w_nil elif wp_object is WP_BoolObject.w_False: return space.w_false @@ -131,12 +169,12 @@ def unwrap(interp, w_object): if isinstance(w_object, W_PythonObject): return w_object.wp_object elif isinstance(w_object, W_Float): - return python_space.newfloat(space.unwrap_float(w_object)) + return py_space.newfloat(space.unwrap_float(w_object)) elif isinstance(w_object, W_SmallInteger): - return python_space.newint(space.unwrap_int(w_object)) + return py_space.newint(space.unwrap_int(w_object)) elif isinstance(w_object, W_BytesObject): # if w_object.getclass(space).is_same_object(space.w_String): - return python_space.newbytes(space.unwrap_string(w_object)) + return py_space.newbytes(space.unwrap_string(w_object)) raise PrimitiveFailedError @@ -150,10 +188,10 @@ def __init__(self, wp_object): self.s_class = None def getclass(self, space): - return W_PythonObject(self.wp_object.getclass(python_space)) + return W_PythonObject(self.wp_object.getclass(py_space)) def class_shadow(self, space): - wp_class = python_space.type(self.wp_object) + wp_class = py_space.type(self.wp_object) return W_PythonObject.pure_class_shadow(space, wp_class) @staticmethod @@ -216,46 +254,56 @@ def make_method(self, w_selector): return w_cm -@PythonPlugin.expose_primitive(unwrap_spec=[object, str]) -def eval(interp, s_frame, w_rcvr, source): +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) +def eval(interp, s_frame, w_rcvr, source, cmd): try: - fake_globals = python_space.newdict() - fake_locals = python_space.newdict() - pycode = main.compilecode(python_space, source, '', 'eval') - retval = pycode.exec_code(python_space, fake_globals, fake_locals) + # import pdb; pdb.set_trace() + wp_source = py_space.wrap(source) + py_code = py_compiling.compile(py_space, wp_source, '', cmd) + retval = py_code.exec_code(py_space, py_globals, py_locals) return wrap(interp, retval) except OperationError as operationerr: - print operationerr.errorstr(python_space) + print operationerr.errorstr(py_space) raise PrimitiveFailedError +@PythonPlugin.expose_primitive(unwrap_spec=[object, str]) +def getGlobal(interp, s_frame, w_rcvr, key): + return wrap(interp, py_globals.getitem(py_space.wrap(key))) + + +@PythonPlugin.expose_primitive(unwrap_spec=[object, str]) +def getLocal(interp, s_frame, w_rcvr, key): + return wrap(interp, py_locals.getitem(py_space.wrap(key))) + + def _call_method(interp, wp_rcvr, methodname, args_w): args_w_len = len(args_w) if args_w_len == 1: arg1 = unwrap(interp, args_w[0]) - return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1)) elif args_w_len == 2: arg1 = unwrap(interp, args_w[0]) arg2 = unwrap(interp, args_w[1]) - return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2)) elif args_w_len == 3: arg1 = unwrap(interp, args_w[0]) arg2 = unwrap(interp, args_w[1]) arg3 = unwrap(interp, args_w[2]) - return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3)) elif args_w_len == 4: arg1 = unwrap(interp, args_w[0]) arg2 = unwrap(interp, args_w[1]) arg3 = unwrap(interp, args_w[2]) arg4 = unwrap(interp, args_w[3]) - return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4)) elif args_w_len == 5: arg1 = unwrap(interp, args_w[0]) arg2 = unwrap(interp, args_w[1]) arg3 = unwrap(interp, args_w[2]) arg4 = unwrap(interp, args_w[3]) arg5 = unwrap(interp, args_w[4]) - return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5)) elif args_w_len == 6: arg1 = unwrap(interp, args_w[0]) arg2 = unwrap(interp, args_w[1]) @@ -263,7 +311,7 @@ def _call_method(interp, wp_rcvr, methodname, args_w): arg4 = unwrap(interp, args_w[3]) arg5 = unwrap(interp, args_w[4]) arg6 = unwrap(interp, args_w[5]) - return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6)) elif args_w_len == 7: arg1 = unwrap(interp, args_w[0]) arg2 = unwrap(interp, args_w[1]) @@ -272,7 +320,7 @@ def _call_method(interp, wp_rcvr, methodname, args_w): arg5 = unwrap(interp, args_w[4]) arg6 = unwrap(interp, args_w[5]) arg7 = unwrap(interp, args_w[6]) - return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) elif args_w_len == 8: arg1 = unwrap(interp, args_w[0]) arg2 = unwrap(interp, args_w[1]) @@ -282,12 +330,13 @@ def _call_method(interp, wp_rcvr, methodname, args_w): arg6 = unwrap(interp, args_w[5]) arg7 = unwrap(interp, args_w[6]) arg8 = unwrap(interp, args_w[7]) - return wrap(interp, python_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) - return wrap(interp, python_space.call_method(wp_rcvr, methodname)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) + return wrap(interp, py_space.call_method(wp_rcvr, methodname)) @PythonPlugin.expose_primitive(compiled_method=True) @jit.unroll_safe def send(interp, s_frame, argcount, w_method): + # import pdb; pdb.set_trace() args_w = s_frame.peek_n(argcount) w_literal2 = w_method.literalat0(interp.space, 2) methodname = "" @@ -306,5 +355,5 @@ def send(interp, s_frame, argcount, w_method): try: return _call_method(interp, wp_rcvr, methodname, args_w) except OperationError as operationerr: - print operationerr.errorstr(python_space) + print operationerr.errorstr(py_space) raise PrimitiveFailedError From c15e32dbe912906edf6f1e89de6daf18133a93ae Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 2 Jan 2017 14:41:38 +0100 Subject: [PATCH 003/193] Updates --- .gitignore | 3 + rsqueakvm/plugins/python_plugin.py | 340 ++++++++++++++++++++++------- 2 files changed, 259 insertions(+), 84 deletions(-) diff --git a/.gitignore b/.gitignore index d7890b9d..618522e6 100644 --- a/.gitignore +++ b/.gitignore @@ -271,3 +271,6 @@ images/ !rsqueakvm* !rsqueakvm/test/images* *.db +.build/appdirs +.build/rply +.build/topaz diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 9cee752c..87cd092e 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -6,9 +6,10 @@ system.translationconfig.set(continuation=True) from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.model.variable import W_BytesObject -from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash +from rsqueakvm.model.pointers import W_PointersObject from rsqueakvm.model.compiled_methods import W_PreSpurCompiledMethod, W_SpurCompiledMethod from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts from rsqueakvm.storage_classes import ClassShadow @@ -16,13 +17,16 @@ from rsqueakvm.primitives.constants import EXTERNAL_CALL from rsqueakvm.util.cells import QuasiConstant -from pypy.interpreter import main from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject from pypy.objspace.std.intobject import W_IntObject as WP_IntObject from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject from pypy.objspace.std.listobject import W_ListObject as WP_ListObject +from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject +from pypy.objspace.std.typeobject import W_TypeObject as WP_TypeObject +from pypy.interpreter.function import BuiltinFunction, Function, Method, StaticMethod, ClassMethod + from pypy.module.__builtin__ import compiling as py_compiling from pypy.interpreter.baseobjspace import W_Root @@ -31,6 +35,7 @@ from rpython.rlib import objectmodel, jit _DO_NOT_RELOAD = True +PRINT_STRING = 'printString' def _new_pypy_objspace(): @@ -120,9 +125,9 @@ class PythonPluginClass(Plugin): def __init__(self): Plugin.__init__(self) self.w_python_object_class = QuasiConstant( - None, type=W_AbstractObjectWithIdentityHash) + None, type=W_PointersObject) self.w_python_plugin_send = QuasiConstant( - None, type=W_AbstractObjectWithIdentityHash) + None, type=W_PointersObject) PythonPlugin = PythonPluginClass() @@ -140,32 +145,33 @@ def startup(space, argv): @objectmodel.specialize.argtype(0) -def wrap(interp, wp_object): +def wrap(space, wp_object): # import pdb; pdb.set_trace() - space = interp.space if isinstance(wp_object, WP_FloatObject): return space.wrap_float(py_space.float_w(wp_object)) - elif isinstance(wp_object, WP_IntObject): - return space.wrap_int(py_space.int_w(wp_object)) elif isinstance(wp_object, WP_BytesObject): return space.wrap_string(py_space.str_w(wp_object)) elif isinstance(wp_object, WP_ListObject): return space.wrap_list( - [wrap(interp, item) for item in wp_object.getitems()]) + [wrap(space, item) for item in wp_object.getitems()]) + elif isinstance(wp_object, WP_TupleObject): + return space.wrap_list( + [wrap(space, item) for item in wp_object.tolist()]) elif wp_object is None or isinstance(wp_object, WP_NoneObject): return space.w_nil - elif wp_object is WP_BoolObject.w_False: - return space.w_false - elif wp_object is WP_BoolObject.w_True: - return space.w_true + elif isinstance(wp_object, WP_IntObject): + # WP_BoolObject inherits from WP_IntObject + if wp_object is WP_BoolObject.w_False: + return space.w_false + elif wp_object is WP_BoolObject.w_True: + return space.w_true + return space.wrap_int(py_space.int_w(wp_object)) else: return W_PythonObject(wp_object) @objectmodel.specialize.argtype(0) -def unwrap(interp, w_object): - # import pdb; pdb.set_trace() - space = interp.space +def unwrap(space, w_object): if isinstance(w_object, W_PythonObject): return w_object.wp_object elif isinstance(w_object, W_Float): @@ -175,44 +181,65 @@ def unwrap(interp, w_object): elif isinstance(w_object, W_BytesObject): # if w_object.getclass(space).is_same_object(space.w_String): return py_space.newbytes(space.unwrap_string(w_object)) + # import pdb; pdb.set_trace() + print 'Cannot unwrap %s' % w_object raise PrimitiveFailedError -class W_PythonObject(W_AbstractObjectWithIdentityHash): +class W_PythonObject(W_PointersObject): _attrs_ = ["wp_object", "s_class"] _immutable_fields_ = ["wp_object", "s_class?"] repr_classname = "W_PythonObject" def __init__(self, wp_object): + W_AbstractObjectWithIdentityHash.__init__(self) self.wp_object = wp_object + # self.w_pyID = None self.s_class = None + def at0(self, space, index0): + # import pdb; pdb.set_trace() + return space.w_nil + + def atput0(self, space, index0, w_value): + # import pdb; pdb.set_trace() + pass + + def fetch(self, space, n0): + # import pdb; pdb.set_trace() + return space.w_nil + + def store(self, space, n0, w_value): + # import pdb; pdb.set_trace() + pass + def getclass(self, space): return W_PythonObject(self.wp_object.getclass(py_space)) def class_shadow(self, space): wp_class = py_space.type(self.wp_object) - return W_PythonObject.pure_class_shadow(space, wp_class) + return PythonClassShadow(space, self.wp_object, wp_class) - @staticmethod - @jit.elidable - def pure_class_shadow(space, wp_class): - return PythonClassShadowCache.setdefault( - wp_class, PythonClassShadow(space, wp_class)) + # @staticmethod + # @jit.elidable + # def pure_class_shadow(space, wp_class): + # return PythonClassShadowCache.setdefault( + # wp_class, PythonClassShadow(space, wp_class)) def is_same_object(self, other): return (isinstance(other, W_PythonObject) and other.wp_object is self.wp_object) -PythonClassShadowCache = {} +# PythonClassShadowCache = {} class PythonClassShadow(ClassShadow): - _attrs_ = ["wp_class"] + _attrs_ = ["wp_object", "wp_class"] _immutable_fields_ = ["wp_class"] - def __init__(self, space, wp_class): + def __init__(self, space, wp_object, wp_class): assert isinstance(wp_class, W_Root) + self.wp_object = wp_object self.wp_class = wp_class self.name = wp_class.name AbstractCachingShadow.__init__( @@ -223,19 +250,46 @@ def changed(self): def lookup(self, w_selector): w_method = self.make_method(w_selector) + # import pdb; pdb.set_trace() if w_method is None: w_po = PythonPlugin.w_python_object_class.get() return w_po.as_class_get_shadow(self.space).lookup(w_selector) return w_method def make_method(self, w_selector): + # import pdb; pdb.set_trace() methodname = self.space.unwrap_string(w_selector) idx = methodname.find(":") if idx > 0: methodname = methodname[0:idx] - python_method = self.wp_class.lookup(methodname) - if python_method is None: + + # import pdb; pdb.set_trace() + + py_attr = None + # py_attr = True if methodname in ['pyID'] else None # 'printString' + try: + if py_attr is None: + # check instance vars and methods + py_attr = py_space.getattr(self.wp_object, py_space.wrap(methodname)) + if py_attr is None: + # check class vars and methods + py_attr = py_space.getattr(self.wp_class, py_space.wrap(methodname)) + except OperationError: + pass + except Exception as e: + print 'Unable to create method %s: %s' % (methodname, e) return None + if py_attr is None: + # check builtins + if self.wp_class is py_space.type(py_space.builtin): + try: + builtin_func = py_space.builtin.get(methodname) + if builtin_func is None: + return None + except OperationError: + return None + else: + return None if self.space.is_spur.is_set(): w_cm = objectmodel.instantiate(W_SpurCompiledMethod) else: @@ -261,99 +315,217 @@ def eval(interp, s_frame, w_rcvr, source, cmd): wp_source = py_space.wrap(source) py_code = py_compiling.compile(py_space, wp_source, '', cmd) retval = py_code.exec_code(py_space, py_globals, py_locals) - return wrap(interp, retval) + return wrap(interp.space, retval) except OperationError as operationerr: print operationerr.errorstr(py_space) raise PrimitiveFailedError +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def asSmalltalk(interp, s_frame, w_rcvr): + # import pdb; pdb.set_trace() + if not isinstance(w_rcvr, W_PythonObject): + raise PrimitiveFailedError + return wrap(interp.space, w_rcvr.wp_object) + + @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) def getGlobal(interp, s_frame, w_rcvr, key): - return wrap(interp, py_globals.getitem(py_space.wrap(key))) + return wrap(interp.space, py_globals.getitem(py_space.wrap(key))) @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) def getLocal(interp, s_frame, w_rcvr, key): - return wrap(interp, py_locals.getitem(py_space.wrap(key))) + return wrap(interp.space, py_locals.getitem(py_space.wrap(key))) -def _call_method(interp, wp_rcvr, methodname, args_w): +def _call_method(space, wp_rcvr, methodname, args_w): + args_w_len = len(args_w) + if args_w_len == 1: + arg1 = unwrap(space, args_w[0]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1)) + elif args_w_len == 2: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2)) + elif args_w_len == 3: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3)) + elif args_w_len == 4: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4)) + elif args_w_len == 5: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + arg5 = unwrap(space, args_w[4]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5)) + elif args_w_len == 6: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + arg5 = unwrap(space, args_w[4]) + arg6 = unwrap(space, args_w[5]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6)) + elif args_w_len == 7: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + arg5 = unwrap(space, args_w[4]) + arg6 = unwrap(space, args_w[5]) + arg7 = unwrap(space, args_w[6]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) + elif args_w_len == 8: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + arg5 = unwrap(space, args_w[4]) + arg6 = unwrap(space, args_w[5]) + arg7 = unwrap(space, args_w[6]) + arg8 = unwrap(space, args_w[7]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) + return wrap(space, py_space.call_method(wp_rcvr, methodname)) + + +def _call_function(space, wp_func, args_w): args_w_len = len(args_w) if args_w_len == 1: - arg1 = unwrap(interp, args_w[0]) - return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1)) + arg1 = unwrap(space, args_w[0]) + return wrap(space, py_space.call_function(wp_func, arg1)) elif args_w_len == 2: - arg1 = unwrap(interp, args_w[0]) - arg2 = unwrap(interp, args_w[1]) - return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2)) + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2)) elif args_w_len == 3: - arg1 = unwrap(interp, args_w[0]) - arg2 = unwrap(interp, args_w[1]) - arg3 = unwrap(interp, args_w[2]) - return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3)) + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3)) elif args_w_len == 4: - arg1 = unwrap(interp, args_w[0]) - arg2 = unwrap(interp, args_w[1]) - arg3 = unwrap(interp, args_w[2]) - arg4 = unwrap(interp, args_w[3]) - return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4)) + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4)) elif args_w_len == 5: - arg1 = unwrap(interp, args_w[0]) - arg2 = unwrap(interp, args_w[1]) - arg3 = unwrap(interp, args_w[2]) - arg4 = unwrap(interp, args_w[3]) - arg5 = unwrap(interp, args_w[4]) - return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5)) + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + arg5 = unwrap(space, args_w[4]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4, arg5)) elif args_w_len == 6: - arg1 = unwrap(interp, args_w[0]) - arg2 = unwrap(interp, args_w[1]) - arg3 = unwrap(interp, args_w[2]) - arg4 = unwrap(interp, args_w[3]) - arg5 = unwrap(interp, args_w[4]) - arg6 = unwrap(interp, args_w[5]) - return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6)) + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + arg5 = unwrap(space, args_w[4]) + arg6 = unwrap(space, args_w[5]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4, arg5, arg6)) elif args_w_len == 7: - arg1 = unwrap(interp, args_w[0]) - arg2 = unwrap(interp, args_w[1]) - arg3 = unwrap(interp, args_w[2]) - arg4 = unwrap(interp, args_w[3]) - arg5 = unwrap(interp, args_w[4]) - arg6 = unwrap(interp, args_w[5]) - arg7 = unwrap(interp, args_w[6]) - return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + arg5 = unwrap(space, args_w[4]) + arg6 = unwrap(space, args_w[5]) + arg7 = unwrap(space, args_w[6]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) elif args_w_len == 8: - arg1 = unwrap(interp, args_w[0]) - arg2 = unwrap(interp, args_w[1]) - arg3 = unwrap(interp, args_w[2]) - arg4 = unwrap(interp, args_w[3]) - arg5 = unwrap(interp, args_w[4]) - arg6 = unwrap(interp, args_w[5]) - arg7 = unwrap(interp, args_w[6]) - arg8 = unwrap(interp, args_w[7]) - return wrap(interp, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) - return wrap(interp, py_space.call_method(wp_rcvr, methodname)) + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + arg5 = unwrap(space, args_w[4]) + arg6 = unwrap(space, args_w[5]) + arg7 = unwrap(space, args_w[6]) + arg8 = unwrap(space, args_w[7]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) + return wrap(space, py_space.call_function(wp_func)) + @PythonPlugin.expose_primitive(compiled_method=True) @jit.unroll_safe def send(interp, s_frame, argcount, w_method): - # import pdb; pdb.set_trace() + space = interp.space args_w = s_frame.peek_n(argcount) - w_literal2 = w_method.literalat0(interp.space, 2) + w_literal1 = w_method.literalat0(interp.space, 1) methodname = "" - if isinstance(w_literal2, W_BytesObject): - wp_rcvr = unwrap(interp, s_frame.peek(argcount)) + if w_literal1 is PythonPlugin.w_python_plugin_send.get(): + w_rcvr = s_frame.peek(argcount) + wp_rcvr = unwrap(space, w_rcvr) + w_literal2 = w_method.literalat0(interp.space, 2) + assert isinstance(w_literal2, W_BytesObject) methodname = interp.space.unwrap_string(w_literal2) elif argcount == 3: methodname = interp.space.unwrap_string(args_w[0]) - wp_rcvr = unwrap(interp, args_w[1]) + w_rcvr = args_w[1] + wp_rcvr = unwrap(space, w_rcvr) args_w = interp.space.unwrap_array(args_w[2]) else: raise PrimitiveFailedError idx = methodname.find(":") if idx > 0: methodname = methodname[0:idx] + # import pdb; pdb.set_trace() + # if methodname == 'printString': + # return space.wrap_string(wp_rcvr.getclass(py_space).getname(py_space)) + # if methodname == 'pyID' and isinstance(w_rcvr, W_PythonObject): + # if len(args_w) == 1: + # w_rcvr.w_pyID = args_w[0] + # return space.w_nil + # else: + # return w_rcvr.w_pyID try: - return _call_method(interp, wp_rcvr, methodname, args_w) + if wp_rcvr is py_space.builtin: + builtin = py_space.builtin.get(methodname) + if isinstance(builtin, BuiltinFunction): + return _call_function(space, builtin, args_w) + if isinstance(builtin, WP_TypeObject): + if methodname == 'tuple': + return wrap(space, py_space.newtuple( + [unwrap(space, x) for x in args_w])) + elif methodname == 'str': + if len(args_w) > 0: + return args_w[0] + return interp.space.wrap_string('') + elif methodname == 'bool': + if len(args_w) > 0: + return args_w[0] + return interp.space.w_false + elif methodname == 'int': + if len(args_w) > 0: + return args_w[0] + return interp.space.wrap_int(0) + elif methodname == 'float': + if len(args_w) > 0: + return args_w[0] + return interp.space.wrap_float(0) + else: + py_attr = py_space.getattr(wp_rcvr, py_space.wrap(methodname)) + # Only allow to call certain types (e.g. don't allow __class__() atm) + if (isinstance(py_attr, Function) or + isinstance(py_attr, Method) or + isinstance(py_attr, StaticMethod) or + isinstance(py_attr, ClassMethod)): + return _call_method(space, wp_rcvr, methodname, args_w) + else: + if len(args_w) == 1: + py_space.setattr(wp_rcvr, py_space.wrap(methodname), unwrap(space, args_w[0])) + return space.w_nil + else: + return wrap(space, py_attr) except OperationError as operationerr: print operationerr.errorstr(py_space) - raise PrimitiveFailedError + except Exception as e: + print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) + raise PrimitiveFailedError From 62b0702e6159d707c0db472c012633bf300e0653 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 11 Jan 2017 23:59:09 +0100 Subject: [PATCH 004/193] Remember last_result --- rsqueakvm/util/shell.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rsqueakvm/util/shell.py b/rsqueakvm/util/shell.py index eef7fa61..4f541755 100644 --- a/rsqueakvm/util/shell.py +++ b/rsqueakvm/util/shell.py @@ -76,6 +76,7 @@ def __init__(self, interp, space): self.space = space self.methods = {} self.w_rcvr = self.space.w_nil + self.last_result = None space.headless.activate() def set_interp(self, interp): @@ -230,6 +231,7 @@ def run(self): print "Error: ", sys.exc_info()[0] import pdb; pdb.set_trace() if w_result: + self.last_result = w_result print w_result.as_repr_string().replace('\r', '\n') def _execute_code(self, code): From 980c16d5133bd109385451100b91cec5af3342bf Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 13 Jan 2017 00:37:36 +0100 Subject: [PATCH 005/193] It compiles --- rsqueakvm/plugins/python_plugin.py | 314 ++++++++++++++++++++++++++++- rsqueakvm/util/cells.py | 11 + 2 files changed, 323 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 87cd092e..d08d16d9 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -5,6 +5,8 @@ system.translationconfig.set(thread=True) system.translationconfig.set(continuation=True) +from multiprocessing import Process, Pipe + from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.numeric import W_Float, W_SmallInteger @@ -15,7 +17,7 @@ from rsqueakvm.storage_classes import ClassShadow from rsqueakvm.storage import AbstractCachingShadow from rsqueakvm.primitives.constants import EXTERNAL_CALL -from rsqueakvm.util.cells import QuasiConstant +from rsqueakvm.util.cells import QuasiConstant, Cell from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject from pypy.objspace.std.intobject import W_IntObject as WP_IntObject @@ -26,6 +28,10 @@ from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject from pypy.objspace.std.typeobject import W_TypeObject as WP_TypeObject from pypy.interpreter.function import BuiltinFunction, Function, Method, StaticMethod, ClassMethod +from pypy.interpreter.pycode import PyCode + +from pypy.objspace.std.dictmultiobject import W_DictMultiObject + from pypy.module.__builtin__ import compiling as py_compiling @@ -38,6 +44,19 @@ PRINT_STRING = 'printString' +class ProcessSwitchException(Exception): + def __init__(self, frame, pycode, next_instr, ec): + self.frame = frame + self.pycode = pycode + self.next_instr = next_instr + self.ec = ec + + +class SimplePyCode(PyCode): + def __init__(self, code): + self.co_code = code + + def _new_pypy_objspace(): import os import sys @@ -108,6 +127,7 @@ def _new_pypy_objspace(): py_space = _new_pypy_objspace() py_globals = py_space.newdict() py_locals = py_space.newdict() +last_ProcessSwitchException = None # Patch-out virtualizables from Pypy so that translation works from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver @@ -118,19 +138,134 @@ def _new_pypy_objspace(): except AttributeError: pass +from rpython.rlib.rstacklet import StackletThread + +class SThread(StackletThread): + + def __init__(self, space, ec): + StackletThread.__init__(self) + self.space = space + self.ec = ec + + +class PythonRunner: + def __init__(self, source, cmd): + self.source = source + self.cmd = cmd + self.sthread = None + # self.h1 = Cell(None) + # self.h2 = Cell(None) + + def start(self): + self.sthread = StackletThread() + self.h1 = self.sthread.new(new_stacklet_callback) + + def resume(self): + self.sthread.switch(self.h1) + + def run_python(self, h): + self.h2 = h + print 'Python start' + wp_source = py_space.wrap(self.source) + py_code = py_compiling.compile(py_space, wp_source, '', self.cmd) + retval = py_code.exec_code(py_space, py_globals, py_locals) + return h + class PythonPluginClass(Plugin): - _attrs_ = ["w_python_object_class", "w_python_plugin_send"] + _attrs_ = [ + "w_python_object_class", + "w_python_plugin_send", + "py_runner", + "python_interrupt_counter", + "current_source", + "current_cmd", + ] def __init__(self): Plugin.__init__(self) + self.py_runner = Cell(None, type=PythonRunner) + self.python_interrupt_counter = Cell(1000) + self.current_source = Cell('') + self.current_cmd = Cell('') self.w_python_object_class = QuasiConstant( None, type=W_PointersObject) self.w_python_plugin_send = QuasiConstant( None, type=W_PointersObject) + + def start_new_python(self, source, cmd): + self.py_runner.set(PythonRunner(source, cmd)) + self.py_runner.get().start() + + def resume_python(self): + py_runner = self.py_runner.get() + if py_runner is None: + raise PrimitiveFailedError + py_runner.resume() + + PythonPlugin = PythonPluginClass() +# patch switch, we don't need kwargs and they don't work in Cells for some reason +# old_switch = greenlet.switch +# def new_switch(self, *args): +# "Switch execution to this greenlet, optionally passing the values " +# "given as argument(s). Returns the value passed when switching back." +# return self.__switch('switch', (args, {})) +# greenlet.switch = new_switch + + +from rpython.rlib.rarithmetic import r_uint +from rpython.rlib.jit import hint +from pypy.module.pypyjit.interp_jit import pypyjitdriver +from pypy.interpreter.pyopcode import ExitFrame, Yield + +old_dispatch = PyFrame.dispatch +def new_dispatch(self, pycode, next_instr, ec): + self = hint(self, access_directly=True) + next_instr = r_uint(next_instr) + is_being_profiled = self.get_is_being_profiled() + try: + while True: + pypyjitdriver.jit_merge_point(ec=ec, + frame=self, next_instr=next_instr, pycode=pycode, + is_being_profiled=is_being_profiled) + + new_pic = PythonPlugin.python_interrupt_counter.get() - 1 + PythonPlugin.python_interrupt_counter.set(new_pic) + if new_pic <= 0: + PythonPlugin.python_interrupt_counter.set(1000) + print 'Python yield' + # import pdb; pdb.set_trace() + + py_runner = PythonPlugin.py_runner.get() + py_runner.sthread.switch(py_runner.h2) + # sthread = PythonPlugin.sthread + # handle = PythonPlugin.rsqueak_sthread_h + # assert sthread is not None + # assert handle is not None + # assert not sthread.is_empty_handle(handle) + # sthread.switch(handle) + print 'Python continue' + # raise ProcessSwitchException(self, pycode, next_instr, ec) + + co_code = pycode.co_code + self.valuestackdepth = hint(self.valuestackdepth, promote=True) + next_instr = self.handle_bytecode(co_code, next_instr, ec) + is_being_profiled = self.get_is_being_profiled() + except Yield: + self.last_exception = None + w_result = self.popvalue() + hint(self, force_virtualizable=True) + return w_result + except ExitFrame: + self.last_exception = None + return self.popvalue() + +PyFrame.dispatch = new_dispatch + + def startup(space, argv): PythonPlugin.w_python_plugin_send.set(space.wrap_list_unroll_safe([ space.wrap_string("PythonPlugin"), @@ -318,8 +453,156 @@ def eval(interp, s_frame, w_rcvr, source, cmd): return wrap(interp.space, retval) except OperationError as operationerr: print operationerr.errorstr(py_space) + # import pdb; pdb.set_trace() + raise PrimitiveFailedError + except Exception as e: + print '[Unknown Exception] %s' % e + # import pdb; pdb.set_trace() raise PrimitiveFailedError +# def make_resume_frame(saved_state): +# ContextPartShadow.build_method_context(""" +# store the saved python saved_state +# set the PC so when we return, we immediately go back into +# a primitive and resume the saved python state +# """) + +# @objectmodel.specialize.arg(0) +# def execute_python(func): +# global last_ProcessSwitchException +# try: +# return func() +# except OperationError as operationerr: +# print operationerr.errorstr(py_space) +# # import pdb; pdb.set_trace() +# raise PrimitiveFailedError +# except ProcessSwitchException as e: +# print 'Python is giving away the CPU' +# last_ProcessSwitchException = e +# # raise ProcessSwitchException(make_resume_frame(saved_state)) +# except Exception as e: +# print '[Unknown Exception] %s' % e +# # import pdb; pdb.set_trace() +# raise PrimitiveFailedError + + +# @PythonPlugin.expose_primitive(unwrap_spec=[object]) +# def resumePythonBak(interp, s_frame, w_rcvr): +# global last_ProcessSwitchException +# if last_ProcessSwitchException is None: +# raise PrimitiveFailedError +# def resume_frame(): +# # import pdb; pdb.set_trace() +# frame = last_ProcessSwitchException.frame +# pycode = last_ProcessSwitchException.pycode +# next_instr = last_ProcessSwitchException.next_instr +# ec = last_ProcessSwitchException.ec +# frame.dispatch(pycode, next_instr, ec) +# execute_python(resume_frame) +# return interp.space.w_nil + + +# @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) +# def syncEvalBak(interp, s_frame, w_rcvr, source, cmd): +# def func(): +# # import pdb; pdb.set_trace() +# wp_source = py_space.wrap(source) +# py_code = py_compiling.compile(py_space, wp_source, '', cmd) +# retval = py_code.exec_code(py_space, py_globals, py_locals) +# return retval +# execute_python(func) # we are not interested in the result atm +# return interp.space.w_nil + + # try: + # func() + # except OperationError as operationerr: + # print operationerr.errorstr(py_space) + # # import pdb; pdb.set_trace() + # raise PrimitiveFailedError + # except ProcessSwitchException as e: + # print 'Python is giving away the CPU' + # saved_state = e.python_stacklet + # raise ProcessSwitchException(make_resume_frame(saved_state)) + # except Exception as e: + # print '[Unknown Exception] %s' % e + # # import pdb; pdb.set_trace() + # raise PrimitiveFailedError + + +def new_stacklet_callback(h, arg): + print 'in switchbackonce_callback:', h, arg + # import pdb; pdb.set_trace() + return PythonPlugin.py_runner.get().run_python(h) + + +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) +def syncEval(interp, s_frame, w_rcvr, source, cmd): + # import pdb; pdb.set_trace() + PythonPlugin.start_new_python(source, cmd) + # import pdb; pdb.set_trace() + # sthread = SThread(py_space, py_space.getexecutioncontext()) + # PythonPlugin.sthread.set(sthread) + # h = sthread.new(run_python) + # PythonPlugin.pypy_sthread_h.set(h) + # import pdb; pdb.set_trace() + return interp.space.w_nil + + +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def resumePython(interp, s_frame, w_rcvr): + # import pdb; pdb.set_trace() + print 'Smalltalk yield' + PythonPlugin.resume_python() + print 'Smalltalk continue' + return interp.space.w_nil + + +# @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) +# def asyncEval(interp, s_frame, w_rcvr, source, cmd): +# def doAsyncCall(conn): +# try: +# # import pdb; pdb.set_trace() +# wp_source = py_space.wrap(source) +# py_code = py_compiling.compile(py_space, wp_source, '', cmd) +# retval = py_code.exec_code(py_space, py_globals, py_locals) +# conn.send(wrap(interp.space, retval)) +# except OperationError as operationerr: +# print operationerr.errorstr(py_space) +# # import pdb; pdb.set_trace() +# conn.send(PrimitiveFailedError) +# except Exception as e: +# print '[Unknown Exception] %s' % e +# # import pdb; pdb.set_trace() +# conn.send(PrimitiveFailedError) +# finally: +# conn.close() +# p = Process(target=doAsyncCall, args=(child_conn,)) +# p.start() +# return interp.space.w_nil + + +# @PythonPlugin.expose_primitive(unwrap_spec=[object]) +# def asyncReceive(interp, s_frame, w_rcvr): +# import pdb; pdb.set_trace() +# if parent_conn is None: +# raise PrimitiveFailedError +# if parent_conn.poll(2): +# return wrap(interp.space, parent_conn.recv()) +# raise PrimitiveFailedError + + +# @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) +# def asyncSend(interp, s_frame, w_rcvr, msg): +# if parent_conn is None: +# raise PrimitiveFailedError +# parent_conn.send(msg) +# data = parent_conn.recv() +# if isinstance(data, list): +# return interp.space.wrap_list(data) +# if isinstance(data, int): +# return interp.space.wrap_int(data) +# return interp.space.wrap_string(data) + @PythonPlugin.expose_primitive(unwrap_spec=[object]) def asSmalltalk(interp, s_frame, w_rcvr): @@ -329,8 +612,35 @@ def asSmalltalk(interp, s_frame, w_rcvr): return wrap(interp.space, w_rcvr.wp_object) +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def getTopFrame(interp, s_frame, w_rcvr): + # import pdb; pdb.set_trace() + topframe = py_space.getexecutioncontext().gettopframe() + # assert? primfail? + return W_PythonObject(topframe) + +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def getGlobalsPerFrame(interp, s_frame, w_rcvr): + cur_frame = py_space.getexecutioncontext().gettopframe() + # assert? primfail? + retval = [] + while cur_frame is not None: + cur_w_globals = cur_frame.get_w_globals() + # import pdb; pdb.set_trace() + if cur_w_globals is None or not isinstance(cur_w_globals, W_DictMultiObject): + continue + w_values = [wrap(interp.space, x) for x in cur_w_globals.values()] + w_values_without_pyobjects = [ + x for x in w_values if not isinstance(x, W_PythonObject)] + retval.append(interp.space.wrap_list(w_values_without_pyobjects)) + cur_frame = cur_frame.f_backref() + # import pdb; pdb.set_trace() + return interp.space.wrap_list(retval) + + @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) def getGlobal(interp, s_frame, w_rcvr, key): + # import pdb; pdb.set_trace() return wrap(interp.space, py_globals.getitem(py_space.wrap(key))) diff --git a/rsqueakvm/util/cells.py b/rsqueakvm/util/cells.py index e8897af8..8a2bdf5a 100644 --- a/rsqueakvm/util/cells.py +++ b/rsqueakvm/util/cells.py @@ -34,3 +34,14 @@ def QuasiConstant(initial_value, type=object): class NewQuasiConst(object): import_from_mixin(QuasiConstantMixin) return NewQuasiConst(initial_value) + + +@specialize.arg(1) +@specialize.argtype(0) +def Cell(initial_value, type=object): + class NewCell(object): + _attrs_ = ["value"] + def __init__(self, value): self.value = value + def set(self, v): self.value = v + def get(self): return self.value + return NewCell(initial_value) From ece0690a9a3ebd39ece6d8a4573cd3d34eef59fb Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 13 Jan 2017 11:15:59 +0100 Subject: [PATCH 006/193] Add some helper primitives and cleanup --- rsqueakvm/plugins/python_plugin.py | 354 +++++++++-------------------- 1 file changed, 113 insertions(+), 241 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index d08d16d9..82a0f668 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -19,6 +19,7 @@ from rsqueakvm.primitives.constants import EXTERNAL_CALL from rsqueakvm.util.cells import QuasiConstant, Cell +from pypy.interpreter.baseobjspace import W_Root as WP_Root from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject from pypy.objspace.std.intobject import W_IntObject as WP_IntObject from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject @@ -43,18 +44,76 @@ _DO_NOT_RELOAD = True PRINT_STRING = 'printString' +from rpython.rlib.rstacklet import StackletThread + -class ProcessSwitchException(Exception): - def __init__(self, frame, pycode, next_instr, ec): - self.frame = frame - self.pycode = pycode - self.next_instr = next_instr +class SThread(StackletThread): + + def __init__(self, space, ec): + StackletThread.__init__(self) + self.space = space self.ec = ec -class SimplePyCode(PyCode): - def __init__(self, code): - self.co_code = code +class PythonRunner: + def __init__(self, source, cmd): + self.source = source + self.cmd = cmd + self.sthread = None + # self.h1 = Cell(None) + # self.h2 = Cell(None) + + def start(self): + self.sthread = StackletThread() + self.h1 = self.sthread.new(new_stacklet_callback) + + def resume(self): + self.sthread.switch(self.h1) + + def run_python(self, h): + self.h2 = h + print 'Python start' + wp_source = py_space.wrap(self.source) + py_code = py_compiling.compile(py_space, wp_source, '', self.cmd) + wp_result = py_code.exec_code(py_space, py_globals, py_locals) + PythonPlugin.wp_result.set(wp_result) + return h + + +class PythonPluginClass(Plugin): + _attrs_ = [ + "w_python_object_class", + "w_python_plugin_send", + "py_runner", + "python_interrupt_counter", + "current_source", + "current_cmd", + ] + + def __init__(self): + Plugin.__init__(self) + self.py_runner = Cell(None, type=PythonRunner) + self.python_interrupt_counter = Cell(1000) + self.current_source = Cell('') + self.current_cmd = Cell('') + self.wp_result = Cell(None, type=WP_Root) + self.w_python_object_class = QuasiConstant( + None, type=W_PointersObject) + self.w_python_plugin_send = QuasiConstant( + None, type=W_PointersObject) + + def start_new_python(self, source, cmd): + self.py_runner.set(PythonRunner(source, cmd)) + self.py_runner.get().start() + + def resume_python(self): + py_runner = self.py_runner.get() + if py_runner is None: + raise PrimitiveFailedError + py_runner.resume() + + +PythonPlugin = PythonPluginClass() def _new_pypy_objspace(): @@ -127,7 +186,6 @@ def _new_pypy_objspace(): py_space = _new_pypy_objspace() py_globals = py_space.newdict() py_locals = py_space.newdict() -last_ProcessSwitchException = None # Patch-out virtualizables from Pypy so that translation works from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver @@ -138,132 +196,35 @@ def _new_pypy_objspace(): except AttributeError: pass -from rpython.rlib.rstacklet import StackletThread +from pypy.interpreter.executioncontext import ExecutionContext, TICK_COUNTER_STEP -class SThread(StackletThread): - def __init__(self, space, ec): - StackletThread.__init__(self) - self.space = space - self.ec = ec +def check_for_interrupts(): + new_pic = PythonPlugin.python_interrupt_counter.get() - 1 + PythonPlugin.python_interrupt_counter.set(new_pic) + if new_pic <= 0: + PythonPlugin.python_interrupt_counter.set(1000) + py_runner = PythonPlugin.py_runner.get() + if py_runner: + print 'Python yield' + py_runner.sthread.switch(py_runner.h2) + print 'Python continue' +old_bytecode_trace = ExecutionContext.bytecode_trace +old_bytecode_only_trace = ExecutionContext.bytecode_only_trace -class PythonRunner: - def __init__(self, source, cmd): - self.source = source - self.cmd = cmd - self.sthread = None - # self.h1 = Cell(None) - # self.h2 = Cell(None) +@objectmodel.always_inline +def new_bytecode_trace(self, frame, decr_by=TICK_COUNTER_STEP): + check_for_interrupts() + old_bytecode_trace(self, frame, decr_by) - def start(self): - self.sthread = StackletThread() - self.h1 = self.sthread.new(new_stacklet_callback) +@objectmodel.always_inline +def new_bytecode_only_trace(self, frame): + check_for_interrupts() + old_bytecode_only_trace(self, frame) - def resume(self): - self.sthread.switch(self.h1) - - def run_python(self, h): - self.h2 = h - print 'Python start' - wp_source = py_space.wrap(self.source) - py_code = py_compiling.compile(py_space, wp_source, '', self.cmd) - retval = py_code.exec_code(py_space, py_globals, py_locals) - return h - - -class PythonPluginClass(Plugin): - _attrs_ = [ - "w_python_object_class", - "w_python_plugin_send", - "py_runner", - "python_interrupt_counter", - "current_source", - "current_cmd", - ] - - def __init__(self): - Plugin.__init__(self) - self.py_runner = Cell(None, type=PythonRunner) - self.python_interrupt_counter = Cell(1000) - self.current_source = Cell('') - self.current_cmd = Cell('') - self.w_python_object_class = QuasiConstant( - None, type=W_PointersObject) - self.w_python_plugin_send = QuasiConstant( - None, type=W_PointersObject) - - def start_new_python(self, source, cmd): - self.py_runner.set(PythonRunner(source, cmd)) - self.py_runner.get().start() - - def resume_python(self): - py_runner = self.py_runner.get() - if py_runner is None: - raise PrimitiveFailedError - py_runner.resume() - - -PythonPlugin = PythonPluginClass() - - -# patch switch, we don't need kwargs and they don't work in Cells for some reason -# old_switch = greenlet.switch -# def new_switch(self, *args): -# "Switch execution to this greenlet, optionally passing the values " -# "given as argument(s). Returns the value passed when switching back." -# return self.__switch('switch', (args, {})) -# greenlet.switch = new_switch - - -from rpython.rlib.rarithmetic import r_uint -from rpython.rlib.jit import hint -from pypy.module.pypyjit.interp_jit import pypyjitdriver -from pypy.interpreter.pyopcode import ExitFrame, Yield - -old_dispatch = PyFrame.dispatch -def new_dispatch(self, pycode, next_instr, ec): - self = hint(self, access_directly=True) - next_instr = r_uint(next_instr) - is_being_profiled = self.get_is_being_profiled() - try: - while True: - pypyjitdriver.jit_merge_point(ec=ec, - frame=self, next_instr=next_instr, pycode=pycode, - is_being_profiled=is_being_profiled) - - new_pic = PythonPlugin.python_interrupt_counter.get() - 1 - PythonPlugin.python_interrupt_counter.set(new_pic) - if new_pic <= 0: - PythonPlugin.python_interrupt_counter.set(1000) - print 'Python yield' - # import pdb; pdb.set_trace() - - py_runner = PythonPlugin.py_runner.get() - py_runner.sthread.switch(py_runner.h2) - # sthread = PythonPlugin.sthread - # handle = PythonPlugin.rsqueak_sthread_h - # assert sthread is not None - # assert handle is not None - # assert not sthread.is_empty_handle(handle) - # sthread.switch(handle) - print 'Python continue' - # raise ProcessSwitchException(self, pycode, next_instr, ec) - - co_code = pycode.co_code - self.valuestackdepth = hint(self.valuestackdepth, promote=True) - next_instr = self.handle_bytecode(co_code, next_instr, ec) - is_being_profiled = self.get_is_being_profiled() - except Yield: - self.last_exception = None - w_result = self.popvalue() - hint(self, force_virtualizable=True) - return w_result - except ExitFrame: - self.last_exception = None - return self.popvalue() - -PyFrame.dispatch = new_dispatch +ExecutionContext.bytecode_trace = new_bytecode_trace +ExecutionContext.bytecode_only_trace = new_bytecode_only_trace def startup(space, argv): @@ -460,73 +421,26 @@ def eval(interp, s_frame, w_rcvr, source, cmd): # import pdb; pdb.set_trace() raise PrimitiveFailedError -# def make_resume_frame(saved_state): -# ContextPartShadow.build_method_context(""" -# store the saved python saved_state -# set the PC so when we return, we immediately go back into -# a primitive and resume the saved python state -# """) - -# @objectmodel.specialize.arg(0) -# def execute_python(func): -# global last_ProcessSwitchException -# try: -# return func() -# except OperationError as operationerr: -# print operationerr.errorstr(py_space) -# # import pdb; pdb.set_trace() -# raise PrimitiveFailedError -# except ProcessSwitchException as e: -# print 'Python is giving away the CPU' -# last_ProcessSwitchException = e -# # raise ProcessSwitchException(make_resume_frame(saved_state)) -# except Exception as e: -# print '[Unknown Exception] %s' % e -# # import pdb; pdb.set_trace() -# raise PrimitiveFailedError - - -# @PythonPlugin.expose_primitive(unwrap_spec=[object]) -# def resumePythonBak(interp, s_frame, w_rcvr): -# global last_ProcessSwitchException -# if last_ProcessSwitchException is None: -# raise PrimitiveFailedError -# def resume_frame(): -# # import pdb; pdb.set_trace() -# frame = last_ProcessSwitchException.frame -# pycode = last_ProcessSwitchException.pycode -# next_instr = last_ProcessSwitchException.next_instr -# ec = last_ProcessSwitchException.ec -# frame.dispatch(pycode, next_instr, ec) -# execute_python(resume_frame) -# return interp.space.w_nil - - -# @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) -# def syncEvalBak(interp, s_frame, w_rcvr, source, cmd): -# def func(): -# # import pdb; pdb.set_trace() -# wp_source = py_space.wrap(source) -# py_code = py_compiling.compile(py_space, wp_source, '', cmd) -# retval = py_code.exec_code(py_space, py_globals, py_locals) -# return retval -# execute_python(func) # we are not interested in the result atm -# return interp.space.w_nil - - # try: - # func() - # except OperationError as operationerr: - # print operationerr.errorstr(py_space) - # # import pdb; pdb.set_trace() - # raise PrimitiveFailedError - # except ProcessSwitchException as e: - # print 'Python is giving away the CPU' - # saved_state = e.python_stacklet - # raise ProcessSwitchException(make_resume_frame(saved_state)) - # except Exception as e: - # print '[Unknown Exception] %s' % e - # # import pdb; pdb.set_trace() - # raise PrimitiveFailedError + +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) +def evalWithTopFrame(interp, s_frame, w_rcvr, source, cmd): + try: + w_glob = py_space.newdict() + cur_frame = py_space.getexecutioncontext().gettopframe() + py_space.setitem(w_glob, py_space.wrap('topframe'), py_space.wrap(cur_frame)) + # import pdb; pdb.set_trace() + wp_source = py_space.wrap(source) + py_code = py_compiling.compile(py_space, wp_source, '', cmd) + retval = py_code.exec_code(py_space, py_globals, py_locals) + return wrap(interp.space, retval) + except OperationError as operationerr: + print operationerr.errorstr(py_space) + # import pdb; pdb.set_trace() + raise PrimitiveFailedError + except Exception as e: + print '[Unknown Exception] %s' % e + # import pdb; pdb.set_trace() + raise PrimitiveFailedError def new_stacklet_callback(h, arg): @@ -557,51 +471,9 @@ def resumePython(interp, s_frame, w_rcvr): return interp.space.w_nil -# @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) -# def asyncEval(interp, s_frame, w_rcvr, source, cmd): -# def doAsyncCall(conn): -# try: -# # import pdb; pdb.set_trace() -# wp_source = py_space.wrap(source) -# py_code = py_compiling.compile(py_space, wp_source, '', cmd) -# retval = py_code.exec_code(py_space, py_globals, py_locals) -# conn.send(wrap(interp.space, retval)) -# except OperationError as operationerr: -# print operationerr.errorstr(py_space) -# # import pdb; pdb.set_trace() -# conn.send(PrimitiveFailedError) -# except Exception as e: -# print '[Unknown Exception] %s' % e -# # import pdb; pdb.set_trace() -# conn.send(PrimitiveFailedError) -# finally: -# conn.close() -# p = Process(target=doAsyncCall, args=(child_conn,)) -# p.start() -# return interp.space.w_nil - - -# @PythonPlugin.expose_primitive(unwrap_spec=[object]) -# def asyncReceive(interp, s_frame, w_rcvr): -# import pdb; pdb.set_trace() -# if parent_conn is None: -# raise PrimitiveFailedError -# if parent_conn.poll(2): -# return wrap(interp.space, parent_conn.recv()) -# raise PrimitiveFailedError - - -# @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) -# def asyncSend(interp, s_frame, w_rcvr, msg): -# if parent_conn is None: -# raise PrimitiveFailedError -# parent_conn.send(msg) -# data = parent_conn.recv() -# if isinstance(data, list): -# return interp.space.wrap_list(data) -# if isinstance(data, int): -# return interp.space.wrap_int(data) -# return interp.space.wrap_string(data) +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def lastResult(interp, s_frame, w_rcvr): + return wrap(interp.space, PythonPlugin.wp_result.get()) @PythonPlugin.expose_primitive(unwrap_spec=[object]) From 717b7e6d4b5cefab61e2d968aab5e0800297a866 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 13 Jan 2017 13:03:59 +0100 Subject: [PATCH 007/193] Cleanups --- rsqueakvm/plugins/python_plugin.py | 88 ++++++++++++------------------ 1 file changed, 34 insertions(+), 54 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 82a0f668..7c7e8b37 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -5,14 +5,13 @@ system.translationconfig.set(thread=True) system.translationconfig.set(continuation=True) -from multiprocessing import Process, Pipe - from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.model.compiled_methods import W_PreSpurCompiledMethod, W_SpurCompiledMethod +from rsqueakvm.model.compiled_methods import (W_PreSpurCompiledMethod, + W_SpurCompiledMethod) from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts from rsqueakvm.storage_classes import ClassShadow from rsqueakvm.storage import AbstractCachingShadow @@ -20,51 +19,35 @@ from rsqueakvm.util.cells import QuasiConstant, Cell from pypy.interpreter.baseobjspace import W_Root as WP_Root +from pypy.interpreter.error import OperationError +from pypy.interpreter.function import (BuiltinFunction, Function, Method, + StaticMethod, ClassMethod) +from pypy.module.__builtin__ import compiling as py_compiling from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject -from pypy.objspace.std.intobject import W_IntObject as WP_IntObject -from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject -from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject +from pypy.objspace.std.dictmultiobject import W_DictMultiObject +from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject +from pypy.objspace.std.intobject import W_IntObject as WP_IntObject from pypy.objspace.std.listobject import W_ListObject as WP_ListObject +from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject from pypy.objspace.std.typeobject import W_TypeObject as WP_TypeObject -from pypy.interpreter.function import BuiltinFunction, Function, Method, StaticMethod, ClassMethod -from pypy.interpreter.pycode import PyCode - -from pypy.objspace.std.dictmultiobject import W_DictMultiObject -from pypy.module.__builtin__ import compiling as py_compiling - -from pypy.interpreter.baseobjspace import W_Root -from pypy.interpreter.error import OperationError - -from rpython.rlib import objectmodel, jit +from rpython.rlib import objectmodel, jit, rstacklet _DO_NOT_RELOAD = True PRINT_STRING = 'printString' -from rpython.rlib.rstacklet import StackletThread - - -class SThread(StackletThread): - - def __init__(self, space, ec): - StackletThread.__init__(self) - self.space = space - self.ec = ec - class PythonRunner: def __init__(self, source, cmd): self.source = source self.cmd = cmd self.sthread = None - # self.h1 = Cell(None) - # self.h2 = Cell(None) def start(self): - self.sthread = StackletThread() + self.sthread = rstacklet.StackletThread() self.h1 = self.sthread.new(new_stacklet_callback) def resume(self): @@ -74,7 +57,8 @@ def run_python(self, h): self.h2 = h print 'Python start' wp_source = py_space.wrap(self.source) - py_code = py_compiling.compile(py_space, wp_source, '', self.cmd) + py_code = py_compiling.compile(py_space, wp_source, '', + self.cmd) wp_result = py_code.exec_code(py_space, py_globals, py_locals) PythonPlugin.wp_result.set(wp_result) return h @@ -196,8 +180,6 @@ def _new_pypy_objspace(): except AttributeError: pass -from pypy.interpreter.executioncontext import ExecutionContext, TICK_COUNTER_STEP - def check_for_interrupts(): new_pic = PythonPlugin.python_interrupt_counter.get() - 1 @@ -210,14 +192,20 @@ def check_for_interrupts(): py_runner.sthread.switch(py_runner.h2) print 'Python continue' + +from pypy.interpreter.executioncontext import (ExecutionContext, + TICK_COUNTER_STEP) + old_bytecode_trace = ExecutionContext.bytecode_trace old_bytecode_only_trace = ExecutionContext.bytecode_only_trace + @objectmodel.always_inline def new_bytecode_trace(self, frame, decr_by=TICK_COUNTER_STEP): check_for_interrupts() old_bytecode_trace(self, frame, decr_by) + @objectmodel.always_inline def new_bytecode_only_trace(self, frame): check_for_interrupts() @@ -334,7 +322,7 @@ class PythonClassShadow(ClassShadow): _immutable_fields_ = ["wp_class"] def __init__(self, space, wp_object, wp_class): - assert isinstance(wp_class, W_Root) + assert isinstance(wp_class, WP_Root) self.wp_object = wp_object self.wp_class = wp_class self.name = wp_class.name @@ -366,10 +354,12 @@ def make_method(self, w_selector): try: if py_attr is None: # check instance vars and methods - py_attr = py_space.getattr(self.wp_object, py_space.wrap(methodname)) + py_attr = py_space.getattr(self.wp_object, + py_space.wrap(methodname)) if py_attr is None: # check class vars and methods - py_attr = py_space.getattr(self.wp_class, py_space.wrap(methodname)) + py_attr = py_space.getattr(self.wp_class, + py_space.wrap(methodname)) except OperationError: pass except Exception as e: @@ -427,11 +417,12 @@ def evalWithTopFrame(interp, s_frame, w_rcvr, source, cmd): try: w_glob = py_space.newdict() cur_frame = py_space.getexecutioncontext().gettopframe() - py_space.setitem(w_glob, py_space.wrap('topframe'), py_space.wrap(cur_frame)) + py_space.setitem(w_glob, py_space.wrap('topframe'), + py_space.wrap(cur_frame)) # import pdb; pdb.set_trace() wp_source = py_space.wrap(source) py_code = py_compiling.compile(py_space, wp_source, '', cmd) - retval = py_code.exec_code(py_space, py_globals, py_locals) + retval = py_code.exec_code(py_space, w_glob, py_locals) return wrap(interp.space, retval) except OperationError as operationerr: print operationerr.errorstr(py_space) @@ -454,11 +445,6 @@ def syncEval(interp, s_frame, w_rcvr, source, cmd): # import pdb; pdb.set_trace() PythonPlugin.start_new_python(source, cmd) # import pdb; pdb.set_trace() - # sthread = SThread(py_space, py_space.getexecutioncontext()) - # PythonPlugin.sthread.set(sthread) - # h = sthread.new(run_python) - # PythonPlugin.pypy_sthread_h.set(h) - # import pdb; pdb.set_trace() return interp.space.w_nil @@ -491,6 +477,7 @@ def getTopFrame(interp, s_frame, w_rcvr): # assert? primfail? return W_PythonObject(topframe) + @PythonPlugin.expose_primitive(unwrap_spec=[object]) def getGlobalsPerFrame(interp, s_frame, w_rcvr): cur_frame = py_space.getexecutioncontext().gettopframe() @@ -499,7 +486,8 @@ def getGlobalsPerFrame(interp, s_frame, w_rcvr): while cur_frame is not None: cur_w_globals = cur_frame.get_w_globals() # import pdb; pdb.set_trace() - if cur_w_globals is None or not isinstance(cur_w_globals, W_DictMultiObject): + if (cur_w_globals is None or + not isinstance(cur_w_globals, W_DictMultiObject)): continue w_values = [wrap(interp.space, x) for x in cur_w_globals.values()] w_values_without_pyobjects = [ @@ -658,15 +646,6 @@ def send(interp, s_frame, argcount, w_method): idx = methodname.find(":") if idx > 0: methodname = methodname[0:idx] - # import pdb; pdb.set_trace() - # if methodname == 'printString': - # return space.wrap_string(wp_rcvr.getclass(py_space).getname(py_space)) - # if methodname == 'pyID' and isinstance(w_rcvr, W_PythonObject): - # if len(args_w) == 1: - # w_rcvr.w_pyID = args_w[0] - # return space.w_nil - # else: - # return w_rcvr.w_pyID try: if wp_rcvr is py_space.builtin: builtin = py_space.builtin.get(methodname) @@ -694,7 +673,7 @@ def send(interp, s_frame, argcount, w_method): return interp.space.wrap_float(0) else: py_attr = py_space.getattr(wp_rcvr, py_space.wrap(methodname)) - # Only allow to call certain types (e.g. don't allow __class__() atm) + # Only allow to call certain types (e.g. don't allow __class__()) if (isinstance(py_attr, Function) or isinstance(py_attr, Method) or isinstance(py_attr, StaticMethod) or @@ -702,7 +681,8 @@ def send(interp, s_frame, argcount, w_method): return _call_method(space, wp_rcvr, methodname, args_w) else: if len(args_w) == 1: - py_space.setattr(wp_rcvr, py_space.wrap(methodname), unwrap(space, args_w[0])) + py_space.setattr(wp_rcvr, py_space.wrap(methodname), + unwrap(space, args_w[0])) return space.w_nil else: return wrap(space, py_attr) From 3665b56b666a388b474dc9b48e22dd08aca42ad1 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 13 Jan 2017 13:19:57 +0100 Subject: [PATCH 008/193] Remove redundant primitives and cleanup --- rsqueakvm/plugins/python_plugin.py | 58 +++++------------------------- 1 file changed, 8 insertions(+), 50 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 7c7e8b37..a8ddbd47 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -48,11 +48,17 @@ def __init__(self, source, cmd): def start(self): self.sthread = rstacklet.StackletThread() - self.h1 = self.sthread.new(new_stacklet_callback) + self.h1 = self.sthread.new(PythonRunner.new_stacklet_callback) def resume(self): self.sthread.switch(self.h1) + @staticmethod + def new_stacklet_callback(h, arg): + print 'new_stacklet_callback:', h, arg + # import pdb; pdb.set_trace() + return PythonPlugin.py_runner.get().run_python(h) + def run_python(self, h): self.h2 = h print 'Python start' @@ -413,35 +419,7 @@ def eval(interp, s_frame, w_rcvr, source, cmd): @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) -def evalWithTopFrame(interp, s_frame, w_rcvr, source, cmd): - try: - w_glob = py_space.newdict() - cur_frame = py_space.getexecutioncontext().gettopframe() - py_space.setitem(w_glob, py_space.wrap('topframe'), - py_space.wrap(cur_frame)) - # import pdb; pdb.set_trace() - wp_source = py_space.wrap(source) - py_code = py_compiling.compile(py_space, wp_source, '', cmd) - retval = py_code.exec_code(py_space, w_glob, py_locals) - return wrap(interp.space, retval) - except OperationError as operationerr: - print operationerr.errorstr(py_space) - # import pdb; pdb.set_trace() - raise PrimitiveFailedError - except Exception as e: - print '[Unknown Exception] %s' % e - # import pdb; pdb.set_trace() - raise PrimitiveFailedError - - -def new_stacklet_callback(h, arg): - print 'in switchbackonce_callback:', h, arg - # import pdb; pdb.set_trace() - return PythonPlugin.py_runner.get().run_python(h) - - -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) -def syncEval(interp, s_frame, w_rcvr, source, cmd): +def evalInThread(interp, s_frame, w_rcvr, source, cmd): # import pdb; pdb.set_trace() PythonPlugin.start_new_python(source, cmd) # import pdb; pdb.set_trace() @@ -478,26 +456,6 @@ def getTopFrame(interp, s_frame, w_rcvr): return W_PythonObject(topframe) -@PythonPlugin.expose_primitive(unwrap_spec=[object]) -def getGlobalsPerFrame(interp, s_frame, w_rcvr): - cur_frame = py_space.getexecutioncontext().gettopframe() - # assert? primfail? - retval = [] - while cur_frame is not None: - cur_w_globals = cur_frame.get_w_globals() - # import pdb; pdb.set_trace() - if (cur_w_globals is None or - not isinstance(cur_w_globals, W_DictMultiObject)): - continue - w_values = [wrap(interp.space, x) for x in cur_w_globals.values()] - w_values_without_pyobjects = [ - x for x in w_values if not isinstance(x, W_PythonObject)] - retval.append(interp.space.wrap_list(w_values_without_pyobjects)) - cur_frame = cur_frame.f_backref() - # import pdb; pdb.set_trace() - return interp.space.wrap_list(retval) - - @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) def getGlobal(interp, s_frame, w_rcvr, key): # import pdb; pdb.set_trace() From aa56bea99bfee482f34e483c3038d9b144a5503c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 13 Jan 2017 19:16:27 +0100 Subject: [PATCH 009/193] Add wrap_symbol --- rsqueakvm/constants.py | 1 + rsqueakvm/objspace.py | 5 +++++ rsqueakvm/squeakimage.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/constants.py b/rsqueakvm/constants.py index ad13a4d9..c204eceb 100644 --- a/rsqueakvm/constants.py +++ b/rsqueakvm/constants.py @@ -161,6 +161,7 @@ "ClassBinding": (SPECIAL_OBJECTS_SIZE + 30, "POINTERS"), "Metaclass": (SPECIAL_OBJECTS_SIZE + 31, "POINTERS"), "Processor": (SPECIAL_OBJECTS_SIZE + 32, "POINTERS"), + "ByteSymbol": (SPECIAL_OBJECTS_SIZE + 33, "POINTERS") } variables_in_special_object_table = { diff --git a/rsqueakvm/objspace.py b/rsqueakvm/objspace.py index 5f1b8e92..584f2907 100644 --- a/rsqueakvm/objspace.py +++ b/rsqueakvm/objspace.py @@ -195,6 +195,11 @@ def wrap_string(self, string): w_inst.setbytes(list(string)) return w_inst + def wrap_symbol(self, string): + w_inst = self.wrap_string(string) + w_inst.change_class(self, self.w_ByteSymbol) + return w_inst + def wrap_char(self, c): # return self.w_charactertable.fetch(self, ord(c)) return W_Character(ord(c)) diff --git a/rsqueakvm/squeakimage.py b/rsqueakvm/squeakimage.py index 17b9aade..7c7f583f 100644 --- a/rsqueakvm/squeakimage.py +++ b/rsqueakvm/squeakimage.py @@ -394,7 +394,7 @@ def make_assign_prebuilt_constants(): " g_object = self.special_g_object(%d)" % so_index, " except IndexError:", ]) - if name in ("LargeNegativeInteger", "ClassBinding", "Metaclass", "Processor"): + if name in ("LargeNegativeInteger", "ClassBinding", "Metaclass", "Processor", "ByteSymbol"): code.extend([ " g_object = self.smalltalk_g_at('%s')" % name, ]) From f549c1202ac965a106fb16a0ab34f076cff8cef4 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 13 Jan 2017 19:17:34 +0100 Subject: [PATCH 010/193] First attempt to use ProcessSwitch (compiles, but segfaults) --- rsqueakvm/plugins/python_plugin.py | 97 ++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 5 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index a8ddbd47..5634b330 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -11,7 +11,8 @@ from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.model.pointers import W_PointersObject from rsqueakvm.model.compiled_methods import (W_PreSpurCompiledMethod, - W_SpurCompiledMethod) + W_SpurCompiledMethod, + W_CompiledMethod) from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts from rsqueakvm.storage_classes import ClassShadow from rsqueakvm.storage import AbstractCachingShadow @@ -74,6 +75,10 @@ class PythonPluginClass(Plugin): _attrs_ = [ "w_python_object_class", "w_python_plugin_send", + "w_python_plugin_resume", + "w_python_resume_method", + "w_python_resume_primitive_method", + "w_python_class", "py_runner", "python_interrupt_counter", "current_source", @@ -91,6 +96,14 @@ def __init__(self): None, type=W_PointersObject) self.w_python_plugin_send = QuasiConstant( None, type=W_PointersObject) + self.w_python_plugin_resume = QuasiConstant( + None, type=W_PointersObject) + self.w_python_resume_method = QuasiConstant( + None, type=W_CompiledMethod) + self.w_python_resume_primitive_method = QuasiConstant( + None, type=W_CompiledMethod) + self.w_python_class = QuasiConstant( + None, type=W_PointersObject) def start_new_python(self, source, cmd): self.py_runner.set(PythonRunner(source, cmd)) @@ -221,15 +234,73 @@ def new_bytecode_only_trace(self, frame): ExecutionContext.bytecode_only_trace = new_bytecode_only_trace +def make_resume_primitive_method(space): + if space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 0 + w_cm._primitive = EXTERNAL_CALL + w_cm.literalsize = 1 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.bytes = [] + w_cm.literals = [PythonPlugin.w_python_plugin_resume.get()] + return w_cm + + +def make_resume_method(space): + if space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 3 + w_cm._primitive = 0 + w_cm.literalsize = 3 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.compiledin_class = PythonPlugin.w_python_class.get().getclass(space) + w_cm.lookup_selector = "fakeResumeFrame" + w_cm.bytes = [chr(b) for b in [ + 0x70, # pushSelf + 0xD0, # send: primResume + 0x87, # pop + 0x78, # returnSelf + ]] + from rsqueakvm.wrapper import AssociationWrapper + w_cm.literals = [ + space.wrap_symbol("primResume"), + space.wrap_symbol(w_cm.lookup_selector), + AssociationWrapper.make_w_assoc( + space, + space.wrap_symbol("Python class"), + w_cm.compiledin_class + ) + ] + # import pdb; pdb.set_trace() + return w_cm + + def startup(space, argv): PythonPlugin.w_python_plugin_send.set(space.wrap_list_unroll_safe([ space.wrap_string("PythonPlugin"), space.wrap_string("send") ])) - w_python_class = space.smalltalk_at("PythonObject") - if w_python_class is None: - w_python_class = space.w_nil.getclass(space) - PythonPlugin.w_python_object_class.set(w_python_class) + PythonPlugin.w_python_plugin_resume.set(space.wrap_list_unroll_safe([ + space.wrap_string("PythonPlugin"), + space.wrap_string("resumePython") + ])) + PythonPlugin.w_python_class.set( + space.smalltalk_at("Python") or space.w_nil.getclass(space) + ) + PythonPlugin.w_python_resume_method.set(make_resume_method(space)) + PythonPlugin.w_python_resume_primitive_method.set(make_resume_primitive_method(space)) + w_python_object_class = space.smalltalk_at("PythonObject") + if w_python_object_class is None: + w_python_object_class = space.w_nil.getclass(space) + PythonPlugin.w_python_object_class.set(w_python_object_class) py_space.startup() PluginStartupScripts.append(startup) @@ -418,10 +489,25 @@ def eval(interp, s_frame, w_rcvr, source, cmd): raise PrimitiveFailedError +def switch_to_smalltalk(interp, s_frame): + from rsqueakvm.interpreter import ProcessSwitch + from rsqueakvm.storage_contexts import ContextPartShadow + # import pdb; pdb.set_trace() + s_resume_frame = ContextPartShadow.build_method_context( + interp.space, + PythonPlugin.w_python_resume_method.get(), + PythonPlugin.w_python_class.get() + ) + s_resume_frame.store_s_sender(s_frame) + raise ProcessSwitch(s_resume_frame) + + @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) def evalInThread(interp, s_frame, w_rcvr, source, cmd): # import pdb; pdb.set_trace() PythonPlugin.start_new_python(source, cmd) + # when we are here, the Python process has yielded + switch_to_smalltalk(interp, s_frame) # import pdb; pdb.set_trace() return interp.space.w_nil @@ -431,6 +517,7 @@ def resumePython(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() print 'Smalltalk yield' PythonPlugin.resume_python() + switch_to_smalltalk(interp, s_frame) print 'Smalltalk continue' return interp.space.w_nil From 66abfe941528497e042d0c48fbc273fa685146cf Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 17 Jan 2017 16:48:21 +0100 Subject: [PATCH 011/193] Print traceback on shell error --- rsqueakvm/util/shell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/util/shell.py b/rsqueakvm/util/shell.py index c6002d91..231a203d 100644 --- a/rsqueakvm/util/shell.py +++ b/rsqueakvm/util/shell.py @@ -226,11 +226,12 @@ def run(self): if n == method: getattr(self, n)(code) else: + import traceback w_result = None try: w_result = self._execute_code(code) except Exception as e: - print "Error: ", sys.exc_info()[0] + print traceback.format_exc() import pdb; pdb.set_trace() if w_result: self.last_result = w_result From b73f4a359563f846477b51d3716ec3e417ba373f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 17 Jan 2017 16:48:54 +0100 Subject: [PATCH 012/193] Fix process (compiling and working, still some bugs) --- rsqueakvm/objspace.py | 6 +- rsqueakvm/plugins/python_plugin.py | 144 +++++++++++++++++++++++------ 2 files changed, 120 insertions(+), 30 deletions(-) diff --git a/rsqueakvm/objspace.py b/rsqueakvm/objspace.py index 584f2907..323d880f 100644 --- a/rsqueakvm/objspace.py +++ b/rsqueakvm/objspace.py @@ -196,9 +196,9 @@ def wrap_string(self, string): return w_inst def wrap_symbol(self, string): - w_inst = self.wrap_string(string) - w_inst.change_class(self, self.w_ByteSymbol) - return w_inst + with ForceHeadless(self): + return self.interp.get().perform(self.wrap_string(string), + "asSymbol") def wrap_char(self, c): # return self.w_charactertable.fetch(self, ord(c)) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 5634b330..d6536af2 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -39,21 +39,47 @@ _DO_NOT_RELOAD = True PRINT_STRING = 'printString' +PYTHON_BYTECODES_THRESHOLD = 10000 class PythonRunner: def __init__(self, source, cmd): self.source = source self.cmd = cmd + + def start(self): + raise NotImplementedError + + def resume(self): + raise NotImplementedError + + def return_to_smalltalk(self): + raise NotImplementedError + + def run_python(self): + print 'Python start' + wp_source = py_space.wrap(self.source) + py_code = py_compiling.compile(py_space, wp_source, '', + self.cmd) + wp_result = py_code.exec_code(py_space, py_globals, py_locals) + PythonPlugin.wp_result.set(wp_result) + + +class PythonRunnerStacklet(PythonRunner): + def __init__(self, source, cmd): + PythonRunner.__init__(self, source, cmd) self.sthread = None def start(self): self.sthread = rstacklet.StackletThread() - self.h1 = self.sthread.new(PythonRunner.new_stacklet_callback) + self.h1 = self.sthread.new(PythonRunnerStacklet.new_stacklet_callback) def resume(self): self.sthread.switch(self.h1) + def return_to_smalltalk(self): + self.sthread.switch(self.h2) + @staticmethod def new_stacklet_callback(h, arg): print 'new_stacklet_callback:', h, arg @@ -62,15 +88,29 @@ def new_stacklet_callback(h, arg): def run_python(self, h): self.h2 = h - print 'Python start' - wp_source = py_space.wrap(self.source) - py_code = py_compiling.compile(py_space, wp_source, '', - self.cmd) - wp_result = py_code.exec_code(py_space, py_globals, py_locals) - PythonPlugin.wp_result.set(wp_result) + PythonRunner.run_python(self) return h +class PythonRunnerGreenlet(PythonRunner): + def start(self): + from greenlet import greenlet + self.greenlet = greenlet(PythonRunnerGreenlet.new_greenlet_callback) + self.resume() # stacklets also start immediately + + def resume(self): + self.greenlet.switch() + + def return_to_smalltalk(self): + self.greenlet.parent.switch() + + @staticmethod + def new_greenlet_callback(): + print 'new_greenlet_callback' + # import pdb; pdb.set_trace() + return PythonPlugin.py_runner.get().run_python() + + class PythonPluginClass(Plugin): _attrs_ = [ "w_python_object_class", @@ -88,7 +128,7 @@ class PythonPluginClass(Plugin): def __init__(self): Plugin.__init__(self) self.py_runner = Cell(None, type=PythonRunner) - self.python_interrupt_counter = Cell(1000) + self.python_interrupt_counter = Cell(PYTHON_BYTECODES_THRESHOLD) self.current_source = Cell('') self.current_cmd = Cell('') self.wp_result = Cell(None, type=WP_Root) @@ -106,7 +146,12 @@ def __init__(self): None, type=W_PointersObject) def start_new_python(self, source, cmd): - self.py_runner.set(PythonRunner(source, cmd)) + # import pdb; pdb.set_trace() + if objectmodel.we_are_translated(): + cls = PythonRunnerStacklet + else: + cls = PythonRunnerGreenlet + self.py_runner.set(cls(source, cmd)) self.py_runner.get().start() def resume_python(self): @@ -204,11 +249,11 @@ def check_for_interrupts(): new_pic = PythonPlugin.python_interrupt_counter.get() - 1 PythonPlugin.python_interrupt_counter.set(new_pic) if new_pic <= 0: - PythonPlugin.python_interrupt_counter.set(1000) + PythonPlugin.python_interrupt_counter.set(PYTHON_BYTECODES_THRESHOLD) py_runner = PythonPlugin.py_runner.get() if py_runner: print 'Python yield' - py_runner.sthread.switch(py_runner.h2) + py_runner.return_to_smalltalk() print 'Python continue' @@ -257,32 +302,36 @@ def make_resume_method(space): w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) w_cm.header = 3 w_cm._primitive = 0 - w_cm.literalsize = 3 + w_cm.literalsize = 5 w_cm.islarge = False w_cm._tempsize = 0 w_cm.argsize = 0 w_cm.compiledin_class = PythonPlugin.w_python_class.get().getclass(space) w_cm.lookup_selector = "fakeResumeFrame" w_cm.bytes = [chr(b) for b in [ + 0x41, # pushLit: Processor + 0xD0, # send: yield + 0x87, # pop 0x70, # pushSelf - 0xD0, # send: primResume + 0xD2, # send: primResume 0x87, # pop 0x78, # returnSelf ]] from rsqueakvm.wrapper import AssociationWrapper w_cm.literals = [ + space.wrap_symbol("yield"), + space.w_schedulerassociationpointer, space.wrap_symbol("primResume"), space.wrap_symbol(w_cm.lookup_selector), AssociationWrapper.make_w_assoc( space, - space.wrap_symbol("Python class"), + space.w_nil, # wrap_symbol("Python class"), w_cm.compiledin_class ) ] # import pdb; pdb.set_trace() return w_cm - def startup(space, argv): PythonPlugin.w_python_plugin_send.set(space.wrap_list_unroll_safe([ space.wrap_string("PythonPlugin"), @@ -489,37 +538,78 @@ def eval(interp, s_frame, w_rcvr, source, cmd): raise PrimitiveFailedError -def switch_to_smalltalk(interp, s_frame): +def switch_to_smalltalk(interp, s_frame, first_call=False): from rsqueakvm.interpreter import ProcessSwitch from rsqueakvm.storage_contexts import ContextPartShadow - # import pdb; pdb.set_trace() + print 'Switch to Smalltalk' + if PythonPlugin.wp_result.get() is not None: + print 'Python has finished and returned a result' + # we want evalInThread and resumePython to retun new frames, + # so we don't build up stack, but we also don't raise to the + # top-level loop all the time. + # For resuming, we obviously need a new frame, because that's + # how the Smalltalk scheduler knows how to continue back to Python. + # Unfortunately, a primitive can only EITHER always return a new + # frame OR a result. So when we get a result, we cannot simply + # return it. Instead, we need to build a frame that simply returns + # the result + if interp.space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 0 + w_cm._primitive = 0 + w_cm.literalsize = 3 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.bytes = [chr(b) for b in [ + 0x20, # push constant + 0x7C, # return stack top + ]] + w_cm.literals = [ + wrap(interp.space, PythonPlugin.wp_result.get()), + interp.space.w_nil, + interp.space.w_nil + ] + return ContextPartShadow.build_method_context( + interp.space, + w_cm, + PythonPlugin.w_python_class.get() + ) + s_resume_frame = ContextPartShadow.build_method_context( interp.space, PythonPlugin.w_python_resume_method.get(), PythonPlugin.w_python_class.get() ) - s_resume_frame.store_s_sender(s_frame) - raise ProcessSwitch(s_resume_frame) + # import pdb; pdb.set_trace() + # we go one up, because the s_frame.w_method() is our fake method + if first_call: + assert s_frame.w_method() is not PythonPlugin.w_python_resume_method.get() + s_resume_frame.store_s_sender(s_frame) + else: + assert s_frame.w_method() is PythonPlugin.w_python_resume_method.get() + s_resume_frame.store_s_sender(s_frame.s_sender()) + interp.quick_check_for_interrupt(s_resume_frame, dec=PYTHON_BYTECODES_THRESHOLD) + # this will raise a ProcessSwitch if there are interrupts or timers ... + return s_resume_frame -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str], result_is_new_frame=True) def evalInThread(interp, s_frame, w_rcvr, source, cmd): # import pdb; pdb.set_trace() PythonPlugin.start_new_python(source, cmd) # when we are here, the Python process has yielded - switch_to_smalltalk(interp, s_frame) - # import pdb; pdb.set_trace() - return interp.space.w_nil + return switch_to_smalltalk(interp, s_frame, first_call=True) -@PythonPlugin.expose_primitive(unwrap_spec=[object]) +@PythonPlugin.expose_primitive(unwrap_spec=[object], result_is_new_frame=True) def resumePython(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() print 'Smalltalk yield' PythonPlugin.resume_python() - switch_to_smalltalk(interp, s_frame) - print 'Smalltalk continue' - return interp.space.w_nil + return switch_to_smalltalk(interp, s_frame) @PythonPlugin.expose_primitive(unwrap_spec=[object]) From f7a6a2ac673c60aee3fb6e1ecef08b0815a7c201 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 18 Jan 2017 16:21:52 +0100 Subject: [PATCH 013/193] Split PythonPlugin into multiple files also fix send primitive --- rsqueakvm/plugins/python/__init__.py | 0 rsqueakvm/plugins/python/constants.py | 1 + rsqueakvm/plugins/python/execution.py | 186 ++++++ rsqueakvm/plugins/python/global_state.py | 82 +++ rsqueakvm/plugins/python/model.py | 136 ++++ rsqueakvm/plugins/python/patching.py | 53 ++ rsqueakvm/plugins/python/py_objspace.py | 69 +++ rsqueakvm/plugins/python/utils.py | 107 ++++ rsqueakvm/plugins/python_plugin.py | 756 ++--------------------- 9 files changed, 693 insertions(+), 697 deletions(-) create mode 100644 rsqueakvm/plugins/python/__init__.py create mode 100644 rsqueakvm/plugins/python/constants.py create mode 100644 rsqueakvm/plugins/python/execution.py create mode 100644 rsqueakvm/plugins/python/global_state.py create mode 100644 rsqueakvm/plugins/python/model.py create mode 100644 rsqueakvm/plugins/python/patching.py create mode 100644 rsqueakvm/plugins/python/py_objspace.py create mode 100644 rsqueakvm/plugins/python/utils.py diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/rsqueakvm/plugins/python/constants.py b/rsqueakvm/plugins/python/constants.py new file mode 100644 index 00000000..4dd5d793 --- /dev/null +++ b/rsqueakvm/plugins/python/constants.py @@ -0,0 +1 @@ +PYTHON_BYTECODES_THRESHOLD = 10000 diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py new file mode 100644 index 00000000..ef86e274 --- /dev/null +++ b/rsqueakvm/plugins/python/execution.py @@ -0,0 +1,186 @@ +from rsqueakvm.model.compiled_methods import ( + W_SpurCompiledMethod, W_PreSpurCompiledMethod) +from rsqueakvm.plugins.python.constants import PYTHON_BYTECODES_THRESHOLD +from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.error import PrimitiveFailedError + +from rpython.rlib.rstacklet import StackletThread +from rpython.rlib import objectmodel + +from pypy.interpreter.error import OperationError +from pypy.module.__builtin__ import compiling as py_compiling + + +def start_new_thread(source, cmd, translated): + # import pdb; pdb.set_trace() + if translated: + cls = StackletLanguageRunner + else: + cls = GreenletLanguageRunner + language = PythonLanguage(source, cmd) + runner = cls(language) + gs.py_runner.set(runner) + runner.start() + + +def resume_thread(): + runner = gs.py_runner.get() + if runner is None: + raise PrimitiveFailedError + runner.resume() + + +class ForeignLanguage: + pass + + +class PythonLanguage(ForeignLanguage): + def __init__(self, source, cmd): + self.source = source + self.cmd = cmd + + def run(self): + print 'Python start' + wp_source = gs.py_space.wrap(self.source) + py_code = py_compiling.compile(gs.py_space, wp_source, '', + self.cmd) + result = py_code.exec_code(gs.py_space, gs.py_globals, gs.py_locals) + self.save_result(result) + + def save_result(self, result): + gs.wp_result.set(result) + + def handle_error(self, error): + gs.wp_error.set(error) + + +class GlobalState: + def clear(self): + self.origin = None +global_execution_state = GlobalState() +global_execution_state.clear() + + +class AbstractLanguageRunner: + def __init__(self, language): + self.language = language + + def start(self): + raise NotImplementedError + + def resume(self): + raise NotImplementedError + + def return_to_smalltalk(self): + raise NotImplementedError + + +class StackletLanguageRunner(AbstractLanguageRunner): + def __init__(self, language): + AbstractLanguageRunner.__init__(self, language) + self.sthread = None + + def start(self): + self.sthread = StackletThread() + global_execution_state.origin = self + self.h1 = self.sthread.new(self.__class__.new_stacklet_callback) + + def resume(self): + self.sthread.switch(self.h1) + + def return_to_smalltalk(self): + self.sthread.switch(self.h2) + + @staticmethod + def new_stacklet_callback(h, arg): + print 'new_stacklet_callback:', h, arg + self = global_execution_state.origin + self.h2 = h + global_execution_state.clear() + try: + self.language.run() + except OperationError as e: + self.language.handle_error(e) + global_execution_state.origin = self + return self.h2 + + +class GreenletLanguageRunner(AbstractLanguageRunner): + def start(self): + from greenlet import greenlet + global_execution_state.origin = self + self.greenlet = greenlet(self.__class__.new_greenlet_callback()) + self.resume() # stacklets also start immediately + + def resume(self): + self.greenlet.switch() + + def return_to_smalltalk(self): + self.greenlet.parent.switch() + + @staticmethod + def new_greenlet_callback(): + print 'new_greenlet_callback' + self = global_execution_state.origin + return self.language.run + + +def switch_to_smalltalk(interp, s_frame, first_call=False): + from rsqueakvm.storage_contexts import ContextPartShadow + from rsqueakvm.plugins.python.utils import wrap + + print 'Switch to Smalltalk' + if gs.wp_result.get() is not None: + print 'Python has finished and returned a result' + # we want evalInThread and resumePython to retun new frames, + # so we don't build up stack, but we also don't raise to the + # top-level loop all the time. + # For resuming, we obviously need a new frame, because that's + # how the Smalltalk scheduler knows how to continue back to Python. + # Unfortunately, a primitive can only EITHER always return a new + # frame OR a result. So when we get a result, we cannot simply + # return it. Instead, we need to build a frame that simply returns + # the result + if interp.space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 0 + w_cm._primitive = 0 + w_cm.literalsize = 3 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.bytes = [chr(b) for b in [ + 0x20, # push constant + 0x7C, # return stack top + ]] + w_cm.literals = [ + wrap(interp.space, gs.wp_result.get()), + interp.space.w_nil, + interp.space.w_nil + ] + return ContextPartShadow.build_method_context( + interp.space, + w_cm, + gs.w_python_class.get() + ) + + resume_method = gs.w_python_resume_method.get() + s_resume_frame = ContextPartShadow.build_method_context( + interp.space, + resume_method, + gs.w_python_class.get() + ) + # import pdb; pdb.set_trace() + # we go one up, because the s_frame.w_method() is our fake method + if first_call: + assert s_frame.w_method() is not resume_method + s_resume_frame.store_s_sender(s_frame) + else: + assert s_frame.w_method() is resume_method + s_resume_frame.store_s_sender(s_frame.s_sender()) + interp.quick_check_for_interrupt(s_resume_frame, + dec=PYTHON_BYTECODES_THRESHOLD) + # this will raise a ProcessSwitch if there are interrupts or timers ... + return s_resume_frame diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py new file mode 100644 index 00000000..978b011f --- /dev/null +++ b/rsqueakvm/plugins/python/global_state.py @@ -0,0 +1,82 @@ +from rsqueakvm.model.compiled_methods import ( + W_CompiledMethod, W_SpurCompiledMethod, W_PreSpurCompiledMethod) +from rsqueakvm.model.pointers import W_PointersObject +# from rsqueakvm.plugins.python import execution +from rsqueakvm.plugins.python.py_objspace import new_pypy_objspace +from rsqueakvm.util.cells import QuasiConstant, Cell + +from pypy.interpreter.baseobjspace import W_Root as WP_Root + +from rpython.rlib import objectmodel + + +py_space = new_pypy_objspace() +py_globals = py_space.newdict() +py_locals = py_space.newdict() + +wp_result = Cell(None, type=WP_Root) +wp_error = Cell(None, type=WP_Root) + +w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) +w_python_class = QuasiConstant(None, type=W_PointersObject) +w_python_object_class = QuasiConstant(None, type=W_PointersObject) +w_python_plugin_send = QuasiConstant(None, type=W_PointersObject) + +py_runner = Cell(None) + +translating = [True] + + +def startup(space): + w_python_plugin_send.set(space.wrap_list_unroll_safe([ + space.wrap_string("PythonPlugin"), + space.wrap_string("send") + ])) + w_python_class.set( + space.smalltalk_at("Python") or space.w_nil.getclass(space) + ) + w_python_resume_method.set(_make_resume_method(space)) + + python_object_class = space.smalltalk_at("PythonObject") + if python_object_class is None: + python_object_class = space.w_nil.getclass(space) + w_python_object_class.set(python_object_class) + translating[0] = objectmodel.we_are_translated() + + +def _make_resume_method(space): + if space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 3 + w_cm._primitive = 0 + w_cm.literalsize = 5 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.compiledin_class = w_python_class.get().getclass(space) + w_cm.lookup_selector = "fakeResumeFrame" + w_cm.bytes = [chr(b) for b in [ + 0x41, # pushLit: Processor + 0xD0, # send: yield + 0x87, # pop + 0x70, # pushSelf + 0xD2, # send: primResume + 0x87, # pop + 0x78, # returnSelf + ]] + from rsqueakvm.wrapper import AssociationWrapper + w_cm.literals = [ + space.wrap_symbol("yield"), + space.w_schedulerassociationpointer, + space.wrap_symbol("primResume"), + space.wrap_symbol(w_cm.lookup_selector), + AssociationWrapper.make_w_assoc( + space, + space.w_nil, # wrap_symbol("Python class"), + w_cm.compiledin_class + ) + ] + # import pdb; pdb.set_trace() + return w_cm diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py new file mode 100644 index 00000000..03f432ee --- /dev/null +++ b/rsqueakvm/plugins/python/model.py @@ -0,0 +1,136 @@ +from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.storage_classes import ClassShadow +from rsqueakvm.storage import AbstractCachingShadow +from rsqueakvm.primitives.constants import EXTERNAL_CALL +from rsqueakvm.model.compiled_methods import ( + W_PreSpurCompiledMethod, W_SpurCompiledMethod) +from rsqueakvm.plugins.python.global_state import ( + py_space, w_python_object_class, w_python_plugin_send, w_python_class) + +from pypy.interpreter.baseobjspace import W_Root as WP_Root +from pypy.interpreter.error import OperationError + +from rpython.rlib import objectmodel + + +class W_PythonObject(W_PointersObject): + _attrs_ = ["wp_object", "s_class"] + _immutable_fields_ = ["wp_object", "s_class?"] + repr_classname = "W_PythonObject" + + def __init__(self, wp_object): + W_AbstractObjectWithIdentityHash.__init__(self) + self.wp_object = wp_object + # self.w_pyID = None + self.s_class = None + + def at0(self, space, index0): + # import pdb; pdb.set_trace() + return space.w_nil + + def atput0(self, space, index0, w_value): + # import pdb; pdb.set_trace() + pass + + def fetch(self, space, n0): + # import pdb; pdb.set_trace() + return space.w_nil + + def store(self, space, n0, w_value): + # import pdb; pdb.set_trace() + pass + + def getclass(self, space): + return W_PythonObject(self.wp_object.getclass(py_space)) + + def class_shadow(self, space): + wp_class = py_space.type(self.wp_object) + return PythonClassShadow(space, self.wp_object, wp_class) + + # @staticmethod + # @jit.elidable + # def pure_class_shadow(space, wp_class): + # return PythonClassShadowCache.setdefault( + # wp_class, PythonClassShadow(space, wp_class)) + + def is_same_object(self, other): + return (isinstance(other, W_PythonObject) and + other.wp_object is self.wp_object) + + +class PythonClassShadow(ClassShadow): + _attrs_ = ["wp_object", "wp_class"] + _immutable_fields_ = ["wp_class"] + + def __init__(self, space, wp_object, wp_class): + assert isinstance(wp_class, WP_Root) + self.wp_object = wp_object + self.wp_class = wp_class + self.name = wp_class.name + AbstractCachingShadow.__init__( + self, space, space.w_nil, 0, space.w_nil) + + def changed(self): + pass # Changes to Python classes are handled in Python land + + def lookup(self, w_selector): + w_method = self.make_method(w_selector) + # import pdb; pdb.set_trace() + if w_method is None: + w_po = w_python_object_class.get() + return w_po.as_class_get_shadow(self.space).lookup(w_selector) + return w_method + + def make_method(self, w_selector): + # import pdb; pdb.set_trace() + methodname = self.space.unwrap_string(w_selector) + idx = methodname.find(":") + if idx > 0: + methodname = methodname[0:idx] + + # import pdb; pdb.set_trace() + + py_attr = None + # py_attr = True if methodname in ['pyID'] else None # 'printString' + try: + if py_attr is None: + # check instance vars and methods + py_attr = py_space.getattr(self.wp_object, + py_space.wrap(methodname)) + if py_attr is None: + # check class vars and methods + py_attr = py_space.getattr(self.wp_class, + py_space.wrap(methodname)) + except OperationError: + pass + except Exception as e: + print 'Unable to create method %s: %s' % (methodname, e) + return None + if py_attr is None: + # check builtins + if self.wp_class is py_space.type(py_space.builtin): + try: + builtin_func = py_space.builtin.get(methodname) + if builtin_func is None: + return None + except OperationError: + return None + else: + return None + if self.space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 0 + w_cm._primitive = EXTERNAL_CALL + w_cm.literalsize = 2 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.bytes = [] + w_cm.literals = [ + w_python_plugin_send.get(), + w_selector + ] + return w_cm diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py new file mode 100644 index 00000000..d2ed4802 --- /dev/null +++ b/rsqueakvm/plugins/python/patching.py @@ -0,0 +1,53 @@ +from rsqueakvm.util.cells import Cell +from rsqueakvm.plugins.python.global_state import py_runner +from rsqueakvm.plugins.python.constants import PYTHON_BYTECODES_THRESHOLD + + +from rpython.rlib import objectmodel + +from pypy.interpreter.executioncontext import ( + ExecutionContext, TICK_COUNTER_STEP) + + +python_interrupt_counter = Cell(PYTHON_BYTECODES_THRESHOLD) + + +def check_for_interrupts(): + new_pic = python_interrupt_counter.get() - 1 + python_interrupt_counter.set(new_pic) + if new_pic <= 0: + python_interrupt_counter.set(PYTHON_BYTECODES_THRESHOLD) + runner = py_runner.get() + if runner: + print 'Python yield' + runner.return_to_smalltalk() + print 'Python continue' + +old_bytecode_trace = ExecutionContext.bytecode_trace +old_bytecode_only_trace = ExecutionContext.bytecode_only_trace + + +@objectmodel.always_inline +def new_bytecode_trace(self, frame, decr_by=TICK_COUNTER_STEP): + check_for_interrupts() + old_bytecode_trace(self, frame, decr_by) + + +@objectmodel.always_inline +def new_bytecode_only_trace(self, frame): + check_for_interrupts() + old_bytecode_only_trace(self, frame) + + +def patch_pypy(): + # Patch-out virtualizables from Pypy so that translation works + from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver + try: + # TODO: what if first delattr fails? + delattr(PyFrame, "_virtualizable_") + delattr(PyPyJitDriver, "virtualizables") + except AttributeError: + pass + + ExecutionContext.bytecode_trace = new_bytecode_trace + ExecutionContext.bytecode_only_trace = new_bytecode_only_trace diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py new file mode 100644 index 00000000..f727077b --- /dev/null +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -0,0 +1,69 @@ +from rsqueakvm.util import system + + +def new_pypy_objspace(): + import os + import sys + + # This module is reloaded, but pypy_getudir has already been deleted + from pypy.module import sys as pypy_sys + reload(pypy_sys) + # if 'pypy_getudir' not in Module.interpleveldefs: + # Module.interpleveldefs['pypy_getudir'] = 'foo' + + from pypy.config.pypyoption import get_pypy_config + translating = sys.argv[0] != '.build/run.py' # make better + pypy_config = get_pypy_config(translating=translating) + + # cpyext causes a lot of "Undefined symbols for architecture x86_64" errors + pypy_config.objspace.usemodules.cpyext = False + + # disabling cffi backend for now, it also causes an undefined symbol error + pypy_config.objspace.usemodules._cffi_backend = False + + from pypy.config.pypyoption import enable_allworkingmodules + from pypy.config.pypyoption import enable_translationmodules + enable_allworkingmodules(pypy_config) + enable_translationmodules(pypy_config) + + # pypy_config.translation.check_str_without_nul = True + + # ensures pypy_hooks has a .space + pypy_config.objspace.usemodules.pypyjit = True + + pypy_config.translation.continuation = True + + pypy_config.objspace.usemodules.pyexpat = False + + # Copy over some options that should be the same in both configs + pypy_config.translation.make_jobs = system.translationconfig.make_jobs + if system.translationconfig.output is not None: + pypy_config.translation.output = system.translationconfig.output + + # merge_configs(config, pypy_config, "RSqueak", "PyPy") + + # PyPy needs threads + pypy_config.translation.thread = True + + # Python objectspace ctor is not Rpython so create it here and + # encapsulate it inside the entry point with a closure. + from pypy.objspace.std import StdObjSpace as PyStdObjSpace + + py_space = PyStdObjSpace(pypy_config) + + # equivalent to the hack in app_main.py of PyPy, albiet interp-level. + w_sys = py_space.sys + w_modnames = w_sys.get("builtin_module_names") + w_in = py_space.contains(w_modnames, py_space.wrap("__pypy__")) + if not py_space.is_true(w_in): + rl = py_space.sys.get("setrecursionlimit") + py_space.call(rl, py_space.newlist([py_space.wrap(5000)])) + + # Should always be able to import Python modules in CWD. + w_sys_path = py_space.getattr(w_sys, py_space.wrap("path")) + py_space.call_method(w_sys_path, 'append', py_space.wrap(".")) + + # Set sys.executable in PyPy -- some modules rely upon this existing. + py_space.setattr(w_sys, py_space.wrap("executable"), + py_space.wrap(os.path.abspath(sys.argv[0]))) + return py_space diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py new file mode 100644 index 00000000..0e3dd5c9 --- /dev/null +++ b/rsqueakvm/plugins/python/utils.py @@ -0,0 +1,107 @@ +from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.model.numeric import W_Float, W_SmallInteger +from rsqueakvm.plugins.python.model import W_PythonObject +from rsqueakvm.plugins.python.global_state import py_space +from rsqueakvm.model.variable import W_BytesObject + +from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject +from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject +from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject +from pypy.objspace.std.intobject import W_IntObject as WP_IntObject +from pypy.objspace.std.listobject import W_ListObject as WP_ListObject +from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject +from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject + +from rpython.rlib import objectmodel + + +@objectmodel.specialize.argtype(0) +def wrap(space, wp_object): + # import pdb; pdb.set_trace() + if isinstance(wp_object, WP_FloatObject): + return space.wrap_float(py_space.float_w(wp_object)) + elif isinstance(wp_object, WP_BytesObject): + return space.wrap_string(py_space.str_w(wp_object)) + elif isinstance(wp_object, WP_ListObject): + return space.wrap_list( + [wrap(space, item) for item in wp_object.getitems()]) + elif isinstance(wp_object, WP_TupleObject): + return space.wrap_list( + [wrap(space, item) for item in wp_object.tolist()]) + elif wp_object is None or isinstance(wp_object, WP_NoneObject): + return space.w_nil + elif isinstance(wp_object, WP_IntObject): + # WP_BoolObject inherits from WP_IntObject + if wp_object is WP_BoolObject.w_False: + return space.w_false + elif wp_object is WP_BoolObject.w_True: + return space.w_true + return space.wrap_int(py_space.int_w(wp_object)) + else: + return W_PythonObject(wp_object) + + +@objectmodel.specialize.argtype(0) +def unwrap(space, w_object): + if isinstance(w_object, W_PythonObject): + return w_object.wp_object + elif isinstance(w_object, W_Float): + return py_space.newfloat(space.unwrap_float(w_object)) + elif isinstance(w_object, W_SmallInteger): + return py_space.newint(space.unwrap_int(w_object)) + elif isinstance(w_object, W_BytesObject): + # if w_object.getclass(space).is_same_object(space.w_String): + return py_space.newbytes(space.unwrap_string(w_object)) + # import pdb; pdb.set_trace() + print 'Cannot unwrap %s' % w_object + raise PrimitiveFailedError + + +def call_method(space, wp_rcvr, methodname, args_w): + args_w_len = len(args_w) + if args_w_len == 1: + arg1 = unwrap(space, args_w[0]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1)) + elif args_w_len == 2: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, + arg1, arg2)) + elif args_w_len == 3: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, + arg1, arg2, arg3)) + elif args_w_len == 4: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + return wrap(space, py_space.call_method(wp_rcvr, methodname, + arg1, arg2, arg3, arg4)) + return wrap(space, py_space.call_method(wp_rcvr, methodname)) + + +def call_function(space, wp_func, args_w): + args_w_len = len(args_w) + if args_w_len == 1: + arg1 = unwrap(space, args_w[0]) + return wrap(space, py_space.call_function(wp_func, arg1)) + elif args_w_len == 2: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2)) + elif args_w_len == 3: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3)) + elif args_w_len == 4: + arg1 = unwrap(space, args_w[0]) + arg2 = unwrap(space, args_w[1]) + arg3 = unwrap(space, args_w[2]) + arg4 = unwrap(space, args_w[3]) + return wrap(space, py_space.call_function(wp_func, + arg1, arg2, arg3, arg4)) + return wrap(space, py_space.call_function(wp_func)) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index d6536af2..4683f537 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -6,520 +6,44 @@ system.translationconfig.set(continuation=True) from rsqueakvm.error import PrimitiveFailedError -from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash -from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.model.variable import W_BytesObject -from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.model.compiled_methods import (W_PreSpurCompiledMethod, - W_SpurCompiledMethod, - W_CompiledMethod) from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts -from rsqueakvm.storage_classes import ClassShadow -from rsqueakvm.storage import AbstractCachingShadow -from rsqueakvm.primitives.constants import EXTERNAL_CALL -from rsqueakvm.util.cells import QuasiConstant, Cell +from rsqueakvm.plugins.python import model, global_state +from rsqueakvm.plugins.python.global_state import ( + py_space, py_globals, py_locals) +from rsqueakvm.plugins.python.patching import patch_pypy +from rsqueakvm.plugins.python.utils import (wrap, unwrap, call_function, + call_method) -from pypy.interpreter.baseobjspace import W_Root as WP_Root from pypy.interpreter.error import OperationError from pypy.interpreter.function import (BuiltinFunction, Function, Method, StaticMethod, ClassMethod) from pypy.module.__builtin__ import compiling as py_compiling -from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject -from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject -from pypy.objspace.std.dictmultiobject import W_DictMultiObject -from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject -from pypy.objspace.std.intobject import W_IntObject as WP_IntObject -from pypy.objspace.std.listobject import W_ListObject as WP_ListObject -from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject -from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject from pypy.objspace.std.typeobject import W_TypeObject as WP_TypeObject -from rpython.rlib import objectmodel, jit, rstacklet +from rpython.rlib import jit, objectmodel -_DO_NOT_RELOAD = True -PRINT_STRING = 'printString' -PYTHON_BYTECODES_THRESHOLD = 10000 - - -class PythonRunner: - def __init__(self, source, cmd): - self.source = source - self.cmd = cmd - - def start(self): - raise NotImplementedError - - def resume(self): - raise NotImplementedError - - def return_to_smalltalk(self): - raise NotImplementedError - - def run_python(self): - print 'Python start' - wp_source = py_space.wrap(self.source) - py_code = py_compiling.compile(py_space, wp_source, '', - self.cmd) - wp_result = py_code.exec_code(py_space, py_globals, py_locals) - PythonPlugin.wp_result.set(wp_result) - - -class PythonRunnerStacklet(PythonRunner): - def __init__(self, source, cmd): - PythonRunner.__init__(self, source, cmd) - self.sthread = None - - def start(self): - self.sthread = rstacklet.StackletThread() - self.h1 = self.sthread.new(PythonRunnerStacklet.new_stacklet_callback) - - def resume(self): - self.sthread.switch(self.h1) - def return_to_smalltalk(self): - self.sthread.switch(self.h2) - - @staticmethod - def new_stacklet_callback(h, arg): - print 'new_stacklet_callback:', h, arg - # import pdb; pdb.set_trace() - return PythonPlugin.py_runner.get().run_python(h) - - def run_python(self, h): - self.h2 = h - PythonRunner.run_python(self) - return h - - -class PythonRunnerGreenlet(PythonRunner): - def start(self): - from greenlet import greenlet - self.greenlet = greenlet(PythonRunnerGreenlet.new_greenlet_callback) - self.resume() # stacklets also start immediately - - def resume(self): - self.greenlet.switch() +_DO_NOT_RELOAD = True - def return_to_smalltalk(self): - self.greenlet.parent.switch() - - @staticmethod - def new_greenlet_callback(): - print 'new_greenlet_callback' - # import pdb; pdb.set_trace() - return PythonPlugin.py_runner.get().run_python() +patch_pypy() class PythonPluginClass(Plugin): - _attrs_ = [ - "w_python_object_class", - "w_python_plugin_send", - "w_python_plugin_resume", - "w_python_resume_method", - "w_python_resume_primitive_method", - "w_python_class", - "py_runner", - "python_interrupt_counter", - "current_source", - "current_cmd", - ] - - def __init__(self): - Plugin.__init__(self) - self.py_runner = Cell(None, type=PythonRunner) - self.python_interrupt_counter = Cell(PYTHON_BYTECODES_THRESHOLD) - self.current_source = Cell('') - self.current_cmd = Cell('') - self.wp_result = Cell(None, type=WP_Root) - self.w_python_object_class = QuasiConstant( - None, type=W_PointersObject) - self.w_python_plugin_send = QuasiConstant( - None, type=W_PointersObject) - self.w_python_plugin_resume = QuasiConstant( - None, type=W_PointersObject) - self.w_python_resume_method = QuasiConstant( - None, type=W_CompiledMethod) - self.w_python_resume_primitive_method = QuasiConstant( - None, type=W_CompiledMethod) - self.w_python_class = QuasiConstant( - None, type=W_PointersObject) - - def start_new_python(self, source, cmd): - # import pdb; pdb.set_trace() - if objectmodel.we_are_translated(): - cls = PythonRunnerStacklet - else: - cls = PythonRunnerGreenlet - self.py_runner.set(cls(source, cmd)) - self.py_runner.get().start() - - def resume_python(self): - py_runner = self.py_runner.get() - if py_runner is None: - raise PrimitiveFailedError - py_runner.resume() + def we_are_translated(self): + return objectmodel.we_are_translated() PythonPlugin = PythonPluginClass() -def _new_pypy_objspace(): - import os - import sys - - # This module is reloaded, but pypy_getudir has already been deleted - from pypy.module import sys as pypy_sys - reload(pypy_sys) - # if 'pypy_getudir' not in Module.interpleveldefs: - # Module.interpleveldefs['pypy_getudir'] = 'foo' - - from pypy.config.pypyoption import get_pypy_config - translating = sys.argv[0] != '.build/run.py' # make better - pypy_config = get_pypy_config(translating=translating) - - # cpyext causes a lot of "Undefined symbols for architecture x86_64" errors - pypy_config.objspace.usemodules.cpyext = False - - # disabling cffi backend for now, it also causes an undefined symbol error - pypy_config.objspace.usemodules._cffi_backend = False - - from pypy.config.pypyoption import enable_allworkingmodules - from pypy.config.pypyoption import enable_translationmodules - enable_allworkingmodules(pypy_config) - enable_translationmodules(pypy_config) - - # pypy_config.translation.check_str_without_nul = True - - # ensures pypy_hooks has a .space - pypy_config.objspace.usemodules.pypyjit = True - - pypy_config.translation.continuation = True - - pypy_config.objspace.usemodules.pyexpat = False - - # Copy over some options that should be the same in both configs - pypy_config.translation.make_jobs = system.translationconfig.make_jobs - if system.translationconfig.output is not None: - pypy_config.translation.output = system.translationconfig.output - - # merge_configs(config, pypy_config, "RSqueak", "PyPy") - - # PyPy needs threads - pypy_config.translation.thread = True - - # Python objectspace ctor is not Rpython so create it here and - # encapsulate it inside the entry point with a closure. - from pypy.objspace.std import StdObjSpace as PyStdObjSpace - - py_space = PyStdObjSpace(pypy_config) - - # equivalent to the hack in app_main.py of PyPy, albiet interp-level. - w_sys = py_space.sys - w_modnames = w_sys.get("builtin_module_names") - w_in = py_space.contains(w_modnames, py_space.wrap("__pypy__")) - if not py_space.is_true(w_in): - rl = py_space.sys.get("setrecursionlimit") - py_space.call(rl, py_space.newlist([py_space.wrap(5000)])) - - # Should always be able to import Python modules in CWD. - w_sys_path = py_space.getattr(w_sys, py_space.wrap("path")) - py_space.call_method(w_sys_path, 'append', py_space.wrap(".")) - - # Set sys.executable in PyPy -- some modules rely upon this existing. - py_space.setattr(w_sys, py_space.wrap("executable"), - py_space.wrap(os.path.abspath(sys.argv[0]))) - return py_space - -py_space = _new_pypy_objspace() -py_globals = py_space.newdict() -py_locals = py_space.newdict() - -# Patch-out virtualizables from Pypy so that translation works -from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver -try: - # TODO: what if first delattr fails? - delattr(PyFrame, "_virtualizable_") - delattr(PyPyJitDriver, "virtualizables") -except AttributeError: - pass - - -def check_for_interrupts(): - new_pic = PythonPlugin.python_interrupt_counter.get() - 1 - PythonPlugin.python_interrupt_counter.set(new_pic) - if new_pic <= 0: - PythonPlugin.python_interrupt_counter.set(PYTHON_BYTECODES_THRESHOLD) - py_runner = PythonPlugin.py_runner.get() - if py_runner: - print 'Python yield' - py_runner.return_to_smalltalk() - print 'Python continue' - - -from pypy.interpreter.executioncontext import (ExecutionContext, - TICK_COUNTER_STEP) - -old_bytecode_trace = ExecutionContext.bytecode_trace -old_bytecode_only_trace = ExecutionContext.bytecode_only_trace - - -@objectmodel.always_inline -def new_bytecode_trace(self, frame, decr_by=TICK_COUNTER_STEP): - check_for_interrupts() - old_bytecode_trace(self, frame, decr_by) - - -@objectmodel.always_inline -def new_bytecode_only_trace(self, frame): - check_for_interrupts() - old_bytecode_only_trace(self, frame) - -ExecutionContext.bytecode_trace = new_bytecode_trace -ExecutionContext.bytecode_only_trace = new_bytecode_only_trace - - -def make_resume_primitive_method(space): - if space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 0 - w_cm._primitive = EXTERNAL_CALL - w_cm.literalsize = 1 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.bytes = [] - w_cm.literals = [PythonPlugin.w_python_plugin_resume.get()] - return w_cm - - -def make_resume_method(space): - if space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 3 - w_cm._primitive = 0 - w_cm.literalsize = 5 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.compiledin_class = PythonPlugin.w_python_class.get().getclass(space) - w_cm.lookup_selector = "fakeResumeFrame" - w_cm.bytes = [chr(b) for b in [ - 0x41, # pushLit: Processor - 0xD0, # send: yield - 0x87, # pop - 0x70, # pushSelf - 0xD2, # send: primResume - 0x87, # pop - 0x78, # returnSelf - ]] - from rsqueakvm.wrapper import AssociationWrapper - w_cm.literals = [ - space.wrap_symbol("yield"), - space.w_schedulerassociationpointer, - space.wrap_symbol("primResume"), - space.wrap_symbol(w_cm.lookup_selector), - AssociationWrapper.make_w_assoc( - space, - space.w_nil, # wrap_symbol("Python class"), - w_cm.compiledin_class - ) - ] - # import pdb; pdb.set_trace() - return w_cm - def startup(space, argv): - PythonPlugin.w_python_plugin_send.set(space.wrap_list_unroll_safe([ - space.wrap_string("PythonPlugin"), - space.wrap_string("send") - ])) - PythonPlugin.w_python_plugin_resume.set(space.wrap_list_unroll_safe([ - space.wrap_string("PythonPlugin"), - space.wrap_string("resumePython") - ])) - PythonPlugin.w_python_class.set( - space.smalltalk_at("Python") or space.w_nil.getclass(space) - ) - PythonPlugin.w_python_resume_method.set(make_resume_method(space)) - PythonPlugin.w_python_resume_primitive_method.set(make_resume_primitive_method(space)) - w_python_object_class = space.smalltalk_at("PythonObject") - if w_python_object_class is None: - w_python_object_class = space.w_nil.getclass(space) - PythonPlugin.w_python_object_class.set(w_python_object_class) + global_state.startup(space) py_space.startup() PluginStartupScripts.append(startup) -@objectmodel.specialize.argtype(0) -def wrap(space, wp_object): - # import pdb; pdb.set_trace() - if isinstance(wp_object, WP_FloatObject): - return space.wrap_float(py_space.float_w(wp_object)) - elif isinstance(wp_object, WP_BytesObject): - return space.wrap_string(py_space.str_w(wp_object)) - elif isinstance(wp_object, WP_ListObject): - return space.wrap_list( - [wrap(space, item) for item in wp_object.getitems()]) - elif isinstance(wp_object, WP_TupleObject): - return space.wrap_list( - [wrap(space, item) for item in wp_object.tolist()]) - elif wp_object is None or isinstance(wp_object, WP_NoneObject): - return space.w_nil - elif isinstance(wp_object, WP_IntObject): - # WP_BoolObject inherits from WP_IntObject - if wp_object is WP_BoolObject.w_False: - return space.w_false - elif wp_object is WP_BoolObject.w_True: - return space.w_true - return space.wrap_int(py_space.int_w(wp_object)) - else: - return W_PythonObject(wp_object) - - -@objectmodel.specialize.argtype(0) -def unwrap(space, w_object): - if isinstance(w_object, W_PythonObject): - return w_object.wp_object - elif isinstance(w_object, W_Float): - return py_space.newfloat(space.unwrap_float(w_object)) - elif isinstance(w_object, W_SmallInteger): - return py_space.newint(space.unwrap_int(w_object)) - elif isinstance(w_object, W_BytesObject): - # if w_object.getclass(space).is_same_object(space.w_String): - return py_space.newbytes(space.unwrap_string(w_object)) - # import pdb; pdb.set_trace() - print 'Cannot unwrap %s' % w_object - raise PrimitiveFailedError - - -class W_PythonObject(W_PointersObject): - _attrs_ = ["wp_object", "s_class"] - _immutable_fields_ = ["wp_object", "s_class?"] - repr_classname = "W_PythonObject" - - def __init__(self, wp_object): - W_AbstractObjectWithIdentityHash.__init__(self) - self.wp_object = wp_object - # self.w_pyID = None - self.s_class = None - - def at0(self, space, index0): - # import pdb; pdb.set_trace() - return space.w_nil - - def atput0(self, space, index0, w_value): - # import pdb; pdb.set_trace() - pass - - def fetch(self, space, n0): - # import pdb; pdb.set_trace() - return space.w_nil - - def store(self, space, n0, w_value): - # import pdb; pdb.set_trace() - pass - - def getclass(self, space): - return W_PythonObject(self.wp_object.getclass(py_space)) - - def class_shadow(self, space): - wp_class = py_space.type(self.wp_object) - return PythonClassShadow(space, self.wp_object, wp_class) - - # @staticmethod - # @jit.elidable - # def pure_class_shadow(space, wp_class): - # return PythonClassShadowCache.setdefault( - # wp_class, PythonClassShadow(space, wp_class)) - - def is_same_object(self, other): - return (isinstance(other, W_PythonObject) and - other.wp_object is self.wp_object) - -# PythonClassShadowCache = {} - - -class PythonClassShadow(ClassShadow): - _attrs_ = ["wp_object", "wp_class"] - _immutable_fields_ = ["wp_class"] - - def __init__(self, space, wp_object, wp_class): - assert isinstance(wp_class, WP_Root) - self.wp_object = wp_object - self.wp_class = wp_class - self.name = wp_class.name - AbstractCachingShadow.__init__( - self, space, space.w_nil, 0, space.w_nil) - - def changed(self): - pass # Changes to Python classes are handled in Python land - - def lookup(self, w_selector): - w_method = self.make_method(w_selector) - # import pdb; pdb.set_trace() - if w_method is None: - w_po = PythonPlugin.w_python_object_class.get() - return w_po.as_class_get_shadow(self.space).lookup(w_selector) - return w_method - - def make_method(self, w_selector): - # import pdb; pdb.set_trace() - methodname = self.space.unwrap_string(w_selector) - idx = methodname.find(":") - if idx > 0: - methodname = methodname[0:idx] - - # import pdb; pdb.set_trace() - - py_attr = None - # py_attr = True if methodname in ['pyID'] else None # 'printString' - try: - if py_attr is None: - # check instance vars and methods - py_attr = py_space.getattr(self.wp_object, - py_space.wrap(methodname)) - if py_attr is None: - # check class vars and methods - py_attr = py_space.getattr(self.wp_class, - py_space.wrap(methodname)) - except OperationError: - pass - except Exception as e: - print 'Unable to create method %s: %s' % (methodname, e) - return None - if py_attr is None: - # check builtins - if self.wp_class is py_space.type(py_space.builtin): - try: - builtin_func = py_space.builtin.get(methodname) - if builtin_func is None: - return None - except OperationError: - return None - else: - return None - if self.space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 0 - w_cm._primitive = EXTERNAL_CALL - w_cm.literalsize = 2 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.bytes = [] - w_cm.literals = [ - PythonPlugin.w_python_plugin_send.get(), - w_selector - ] - return w_cm - - @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) def eval(interp, s_frame, w_rcvr, source, cmd): try: @@ -538,89 +62,44 @@ def eval(interp, s_frame, w_rcvr, source, cmd): raise PrimitiveFailedError -def switch_to_smalltalk(interp, s_frame, first_call=False): - from rsqueakvm.interpreter import ProcessSwitch - from rsqueakvm.storage_contexts import ContextPartShadow - print 'Switch to Smalltalk' - if PythonPlugin.wp_result.get() is not None: - print 'Python has finished and returned a result' - # we want evalInThread and resumePython to retun new frames, - # so we don't build up stack, but we also don't raise to the - # top-level loop all the time. - # For resuming, we obviously need a new frame, because that's - # how the Smalltalk scheduler knows how to continue back to Python. - # Unfortunately, a primitive can only EITHER always return a new - # frame OR a result. So when we get a result, we cannot simply - # return it. Instead, we need to build a frame that simply returns - # the result - if interp.space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 0 - w_cm._primitive = 0 - w_cm.literalsize = 3 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.bytes = [chr(b) for b in [ - 0x20, # push constant - 0x7C, # return stack top - ]] - w_cm.literals = [ - wrap(interp.space, PythonPlugin.wp_result.get()), - interp.space.w_nil, - interp.space.w_nil - ] - return ContextPartShadow.build_method_context( - interp.space, - w_cm, - PythonPlugin.w_python_class.get() - ) - - s_resume_frame = ContextPartShadow.build_method_context( - interp.space, - PythonPlugin.w_python_resume_method.get(), - PythonPlugin.w_python_class.get() - ) - # import pdb; pdb.set_trace() - # we go one up, because the s_frame.w_method() is our fake method - if first_call: - assert s_frame.w_method() is not PythonPlugin.w_python_resume_method.get() - s_resume_frame.store_s_sender(s_frame) - else: - assert s_frame.w_method() is PythonPlugin.w_python_resume_method.get() - s_resume_frame.store_s_sender(s_frame.s_sender()) - interp.quick_check_for_interrupt(s_resume_frame, dec=PYTHON_BYTECODES_THRESHOLD) - # this will raise a ProcessSwitch if there are interrupts or timers ... - return s_resume_frame - - -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str], result_is_new_frame=True) +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str], + result_is_new_frame=True) def evalInThread(interp, s_frame, w_rcvr, source, cmd): + from rsqueakvm.plugins.python import execution + # import pdb; pdb.set_trace() - PythonPlugin.start_new_python(source, cmd) + execution.start_new_thread(source, cmd, + translated=PythonPlugin.we_are_translated()) # when we are here, the Python process has yielded - return switch_to_smalltalk(interp, s_frame, first_call=True) + return execution.switch_to_smalltalk(interp, s_frame, first_call=True) @PythonPlugin.expose_primitive(unwrap_spec=[object], result_is_new_frame=True) def resumePython(interp, s_frame, w_rcvr): + from rsqueakvm.plugins.python import execution # import pdb; pdb.set_trace() print 'Smalltalk yield' - PythonPlugin.resume_python() - return switch_to_smalltalk(interp, s_frame) + execution.resume_thread() + return execution.switch_to_smalltalk(interp, s_frame) @PythonPlugin.expose_primitive(unwrap_spec=[object]) def lastResult(interp, s_frame, w_rcvr): - return wrap(interp.space, PythonPlugin.wp_result.get()) + return wrap(interp.space, global_state.wp_result.get()) + + +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def lastError(interp, s_frame, w_rcvr): + wp_error = global_state.wp_error.get() + if wp_error is None: + raise PrimitiveFailedError + return interp.space.wrap_string(wp_error.errorstr(py_space)) @PythonPlugin.expose_primitive(unwrap_spec=[object]) def asSmalltalk(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() - if not isinstance(w_rcvr, W_PythonObject): + if not isinstance(w_rcvr, model.W_PythonObject): raise PrimitiveFailedError return wrap(interp.space, w_rcvr.wp_object) @@ -630,7 +109,7 @@ def getTopFrame(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() topframe = py_space.getexecutioncontext().gettopframe() # assert? primfail? - return W_PythonObject(topframe) + return model.W_PythonObject(topframe) @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) @@ -644,168 +123,45 @@ def getLocal(interp, s_frame, w_rcvr, key): return wrap(interp.space, py_locals.getitem(py_space.wrap(key))) -def _call_method(space, wp_rcvr, methodname, args_w): - args_w_len = len(args_w) - if args_w_len == 1: - arg1 = unwrap(space, args_w[0]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1)) - elif args_w_len == 2: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2)) - elif args_w_len == 3: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3)) - elif args_w_len == 4: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4)) - elif args_w_len == 5: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - arg5 = unwrap(space, args_w[4]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5)) - elif args_w_len == 6: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - arg5 = unwrap(space, args_w[4]) - arg6 = unwrap(space, args_w[5]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6)) - elif args_w_len == 7: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - arg5 = unwrap(space, args_w[4]) - arg6 = unwrap(space, args_w[5]) - arg7 = unwrap(space, args_w[6]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) - elif args_w_len == 8: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - arg5 = unwrap(space, args_w[4]) - arg6 = unwrap(space, args_w[5]) - arg7 = unwrap(space, args_w[6]) - arg8 = unwrap(space, args_w[7]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) - return wrap(space, py_space.call_method(wp_rcvr, methodname)) - - -def _call_function(space, wp_func, args_w): - args_w_len = len(args_w) - if args_w_len == 1: - arg1 = unwrap(space, args_w[0]) - return wrap(space, py_space.call_function(wp_func, arg1)) - elif args_w_len == 2: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2)) - elif args_w_len == 3: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3)) - elif args_w_len == 4: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4)) - elif args_w_len == 5: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - arg5 = unwrap(space, args_w[4]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4, arg5)) - elif args_w_len == 6: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - arg5 = unwrap(space, args_w[4]) - arg6 = unwrap(space, args_w[5]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4, arg5, arg6)) - elif args_w_len == 7: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - arg5 = unwrap(space, args_w[4]) - arg6 = unwrap(space, args_w[5]) - arg7 = unwrap(space, args_w[6]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4, arg5, arg6, arg7)) - elif args_w_len == 8: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - arg5 = unwrap(space, args_w[4]) - arg6 = unwrap(space, args_w[5]) - arg7 = unwrap(space, args_w[6]) - arg8 = unwrap(space, args_w[7]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)) - return wrap(space, py_space.call_function(wp_func)) - - @PythonPlugin.expose_primitive(compiled_method=True) @jit.unroll_safe def send(interp, s_frame, argcount, w_method): + # import pdb; pdb.set_trace() space = interp.space args_w = s_frame.peek_n(argcount) - w_literal1 = w_method.literalat0(interp.space, 1) - methodname = "" - if w_literal1 is PythonPlugin.w_python_plugin_send.get(): - w_rcvr = s_frame.peek(argcount) - wp_rcvr = unwrap(space, w_rcvr) - w_literal2 = w_method.literalat0(interp.space, 2) - assert isinstance(w_literal2, W_BytesObject) - methodname = interp.space.unwrap_string(w_literal2) - elif argcount == 3: - methodname = interp.space.unwrap_string(args_w[0]) - w_rcvr = args_w[1] - wp_rcvr = unwrap(space, w_rcvr) - args_w = interp.space.unwrap_array(args_w[2]) - else: - raise PrimitiveFailedError + wp_rcvr = unwrap(space, s_frame.peek(argcount)) + w_selector_name = w_method.literalat0(space, 2) + assert isinstance(w_selector_name, W_BytesObject) + methodname = space.unwrap_string(w_selector_name) idx = methodname.find(":") if idx > 0: methodname = methodname[0:idx] + w_result = None try: if wp_rcvr is py_space.builtin: builtin = py_space.builtin.get(methodname) if isinstance(builtin, BuiltinFunction): - return _call_function(space, builtin, args_w) + w_result = call_function(space, builtin, args_w) if isinstance(builtin, WP_TypeObject): if methodname == 'tuple': - return wrap(space, py_space.newtuple( + w_result = wrap(space, py_space.newtuple( [unwrap(space, x) for x in args_w])) elif methodname == 'str': if len(args_w) > 0: - return args_w[0] - return interp.space.wrap_string('') + w_result = args_w[0] + w_result = space.wrap_string('') elif methodname == 'bool': if len(args_w) > 0: - return args_w[0] - return interp.space.w_false + w_result = args_w[0] + w_result = space.w_false elif methodname == 'int': if len(args_w) > 0: - return args_w[0] - return interp.space.wrap_int(0) + w_result = args_w[0] + w_result = space.wrap_int(0) elif methodname == 'float': if len(args_w) > 0: - return args_w[0] - return interp.space.wrap_float(0) + w_result = args_w[0] + w_result = space.wrap_float(0) else: py_attr = py_space.getattr(wp_rcvr, py_space.wrap(methodname)) # Only allow to call certain types (e.g. don't allow __class__()) @@ -813,16 +169,22 @@ def send(interp, s_frame, argcount, w_method): isinstance(py_attr, Method) or isinstance(py_attr, StaticMethod) or isinstance(py_attr, ClassMethod)): - return _call_method(space, wp_rcvr, methodname, args_w) + w_result = call_method(space, wp_rcvr, methodname, args_w) else: if len(args_w) == 1: py_space.setattr(wp_rcvr, py_space.wrap(methodname), unwrap(space, args_w[0])) - return space.w_nil + w_result = space.w_nil else: - return wrap(space, py_attr) + w_result = wrap(space, py_attr) except OperationError as operationerr: print operationerr.errorstr(py_space) + raise PrimitiveFailedError except Exception as e: print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) - raise PrimitiveFailedError + raise PrimitiveFailedError + if w_result is None: + print "Unable to get result in send primitive" + raise PrimitiveFailedError + s_frame.pop_n(argcount + 1) + return w_result From 8cf8217d02454c93eb441957fd59a400656c9f70 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 18 Jan 2017 18:46:10 +0100 Subject: [PATCH 014/193] Fix _make_resume_method --- rsqueakvm/plugins/python/global_state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 978b011f..4e872826 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -49,7 +49,7 @@ def _make_resume_method(space): w_cm = objectmodel.instantiate(W_SpurCompiledMethod) else: w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 3 + w_cm.header = 5 w_cm._primitive = 0 w_cm.literalsize = 5 w_cm.islarge = False From f5e8ffb1ff98125c78ada802c2e9200cd3cccfbf Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 18 Jan 2017 19:22:35 +0100 Subject: [PATCH 015/193] Minor tweaks --- rsqueakvm/plugins/python/global_state.py | 7 +++---- rsqueakvm/plugins/python/model.py | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 4e872826..e4333f88 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -35,12 +35,11 @@ def startup(space): w_python_class.set( space.smalltalk_at("Python") or space.w_nil.getclass(space) ) + w_python_object_class.set( + space.smalltalk_at("PythonObject") or space.w_nil.getclass(space) + ) w_python_resume_method.set(_make_resume_method(space)) - python_object_class = space.smalltalk_at("PythonObject") - if python_object_class is None: - python_object_class = space.w_nil.getclass(space) - w_python_object_class.set(python_object_class) translating[0] = objectmodel.we_are_translated() diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 03f432ee..d0a5e137 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -6,7 +6,7 @@ from rsqueakvm.model.compiled_methods import ( W_PreSpurCompiledMethod, W_SpurCompiledMethod) from rsqueakvm.plugins.python.global_state import ( - py_space, w_python_object_class, w_python_plugin_send, w_python_class) + py_space, w_python_object_class, w_python_plugin_send) from pypy.interpreter.baseobjspace import W_Root as WP_Root from pypy.interpreter.error import OperationError @@ -77,10 +77,10 @@ def changed(self): def lookup(self, w_selector): w_method = self.make_method(w_selector) # import pdb; pdb.set_trace() - if w_method is None: - w_po = w_python_object_class.get() - return w_po.as_class_get_shadow(self.space).lookup(w_selector) - return w_method + if w_method is not None: + return w_method + w_po = w_python_object_class.get() + return w_po.as_class_get_shadow(self.space).lookup(w_selector) def make_method(self, w_selector): # import pdb; pdb.set_trace() From fcf41a64afe298ae8ebdacb158e822c835cf2777 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 18 Jan 2017 20:39:52 +0100 Subject: [PATCH 016/193] Bugfixes --- rsqueakvm/plugins/python/execution.py | 6 ++++-- rsqueakvm/plugins/python/global_state.py | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index ef86e274..e8c43302 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -130,7 +130,8 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): from rsqueakvm.plugins.python.utils import wrap print 'Switch to Smalltalk' - if gs.wp_result.get() is not None: + wp_result = gs.wp_result.get() + if wp_result is not None: print 'Python has finished and returned a result' # we want evalInThread and resumePython to retun new frames, # so we don't build up stack, but we also don't raise to the @@ -156,10 +157,11 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): 0x7C, # return stack top ]] w_cm.literals = [ - wrap(interp.space, gs.wp_result.get()), + wrap(interp.space, wp_result), interp.space.w_nil, interp.space.w_nil ] + gs.wp_result.set(None) return ContextPartShadow.build_method_context( interp.space, w_cm, diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index e4333f88..53cdf499 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -64,6 +64,10 @@ def _make_resume_method(space): 0xD2, # send: primResume 0x87, # pop 0x78, # returnSelf + 119, # method flags and such + 6, + 3, + 255, ]] from rsqueakvm.wrapper import AssociationWrapper w_cm.literals = [ From db778e284454e9771b5375b95fb8fbf2fcf70ce8 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 18 Jan 2017 22:23:21 +0100 Subject: [PATCH 017/193] Use unused variable --- rsqueakvm/wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/wrapper.py b/rsqueakvm/wrapper.py index 7af13c6b..77b8937c 100644 --- a/rsqueakvm/wrapper.py +++ b/rsqueakvm/wrapper.py @@ -111,9 +111,9 @@ def suspend(self, s_current_frame): new_proc.transfer_to_self_from(s_current_frame) else: w_my_list = self.my_list() - if self.my_list().is_nil(self.space): + if w_my_list.is_nil(self.space): raise PrimitiveFailedError - process_list = LinkedListWrapper(self.space, self.my_list()) + process_list = LinkedListWrapper(self.space, w_my_list) process_list.remove(self.wrapped) self.store_my_list(self.space.w_nil) From 4906572fff1af421afa7f3714623344259e6225a Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 18 Jan 2017 23:29:44 +0100 Subject: [PATCH 018/193] Catch exceptions when running Python in thread --- rsqueakvm/plugins/python/execution.py | 26 ++++++++++++++++-------- rsqueakvm/plugins/python/global_state.py | 2 +- rsqueakvm/plugins/python_plugin.py | 5 +---- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index e8c43302..a78a2f7b 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -41,11 +41,22 @@ def __init__(self, source, cmd): def run(self): print 'Python start' - wp_source = gs.py_space.wrap(self.source) - py_code = py_compiling.compile(gs.py_space, wp_source, '', - self.cmd) - result = py_code.exec_code(gs.py_space, gs.py_globals, gs.py_locals) - self.save_result(result) + try: + # ensure py_space has a fresh exectioncontext + gs.py_space.threadlocals.enter_thread(gs.py_space) + + wp_source = gs.py_space.wrap(self.source) + py_code = py_compiling.compile(gs.py_space, wp_source, '', + self.cmd) + result = py_code.exec_code(gs.py_space, gs.py_globals, + gs.py_locals) + self.save_result(result) + except OperationError as operationerr: + print operationerr.errorstr(gs.py_space) + self.handle_error(operationerr) + except Exception as e: + print 'Unknown error in Python thread: %s' % e + self.handle_error(e) def save_result(self, result): gs.wp_result.set(result) @@ -97,10 +108,7 @@ def new_stacklet_callback(h, arg): self = global_execution_state.origin self.h2 = h global_execution_state.clear() - try: - self.language.run() - except OperationError as e: - self.language.handle_error(e) + self.language.run() global_execution_state.origin = self return self.h2 diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 53cdf499..5e0664d9 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -15,7 +15,7 @@ py_locals = py_space.newdict() wp_result = Cell(None, type=WP_Root) -wp_error = Cell(None, type=WP_Root) +wp_error = Cell(None, type=Exception) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 4683f537..be40ec9a 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -90,10 +90,7 @@ def lastResult(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object]) def lastError(interp, s_frame, w_rcvr): - wp_error = global_state.wp_error.get() - if wp_error is None: - raise PrimitiveFailedError - return interp.space.wrap_string(wp_error.errorstr(py_space)) + return wrap(interp.space, global_state.wp_error.get()) @PythonPlugin.expose_primitive(unwrap_spec=[object]) From 31fb626e65bf845b345fe2c7672db1a5f43cfb9b Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 19 Jan 2017 15:50:39 +0100 Subject: [PATCH 019/193] Improve error handling and add resuming check --- rsqueakvm/plugins/python/execution.py | 22 +++++++++++++++------- rsqueakvm/plugins/python/global_state.py | 2 +- rsqueakvm/plugins/python_plugin.py | 8 ++++++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index a78a2f7b..b49a9ddb 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -2,7 +2,6 @@ W_SpurCompiledMethod, W_PreSpurCompiledMethod) from rsqueakvm.plugins.python.constants import PYTHON_BYTECODES_THRESHOLD from rsqueakvm.plugins.python import global_state as gs -from rsqueakvm.error import PrimitiveFailedError from rpython.rlib.rstacklet import StackletThread from rpython.rlib import objectmodel @@ -25,9 +24,10 @@ def start_new_thread(source, cmd, translated): def resume_thread(): runner = gs.py_runner.get() - if runner is None: - raise PrimitiveFailedError + if runner is None or not runner.resumable(): + return False runner.resume() + return True class ForeignLanguage: @@ -52,11 +52,13 @@ def run(self): gs.py_locals) self.save_result(result) except OperationError as operationerr: - print operationerr.errorstr(gs.py_space) - self.handle_error(operationerr) + errorstr = operationerr.errorstr(gs.py_space) + print errorstr + self.handle_error(errorstr) except Exception as e: - print 'Unknown error in Python thread: %s' % e - self.handle_error(e) + errorstr = str(e) + print 'Unknown error in Python thread: %s' % errorstr + self.handle_error(errorstr) def save_result(self, result): gs.wp_result.set(result) @@ -75,6 +77,7 @@ def clear(self): class AbstractLanguageRunner: def __init__(self, language): self.language = language + self._resumable = True def start(self): raise NotImplementedError @@ -82,6 +85,9 @@ def start(self): def resume(self): raise NotImplementedError + def resumable(self): + return self._resumable + def return_to_smalltalk(self): raise NotImplementedError @@ -109,6 +115,7 @@ def new_stacklet_callback(h, arg): self.h2 = h global_execution_state.clear() self.language.run() + self._resumable = False global_execution_state.origin = self return self.h2 @@ -130,6 +137,7 @@ def return_to_smalltalk(self): def new_greenlet_callback(): print 'new_greenlet_callback' self = global_execution_state.origin + self._resumable = False return self.language.run diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 5e0664d9..465eee8e 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -15,7 +15,7 @@ py_locals = py_space.newdict() wp_result = Cell(None, type=WP_Root) -wp_error = Cell(None, type=Exception) +wp_error = Cell(None, type=str) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index be40ec9a..35e9627c 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -79,7 +79,8 @@ def resumePython(interp, s_frame, w_rcvr): from rsqueakvm.plugins.python import execution # import pdb; pdb.set_trace() print 'Smalltalk yield' - execution.resume_thread() + if not execution.resume_thread(): + raise PrimitiveFailedError return execution.switch_to_smalltalk(interp, s_frame) @@ -90,7 +91,10 @@ def lastResult(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object]) def lastError(interp, s_frame, w_rcvr): - return wrap(interp.space, global_state.wp_error.get()) + wp_error = global_state.wp_error.get() + if wp_error is None: + raise PrimitiveFailedError + return interp.space.wrap_string(wp_error) @PythonPlugin.expose_primitive(unwrap_spec=[object]) From 666b1fdfca8f613b884f00d74373ae4f62dc1704 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 19 Jan 2017 15:52:46 +0100 Subject: [PATCH 020/193] Add initial PyPy package --- repository/PyPy.package/.filetree | 4 + .../instance/isPyContext.st | 3 + .../methodProperties.json | 5 + .../MethodContext.extension/properties.json | 2 + .../PyPy.package/Python.class/README.md | 0 .../Python.class/class/builtins.st | 4 + .../PyPy.package/Python.class/class/eval..st | 4 + .../Python.class/class/evaluatorClass.st | 3 + .../PyPy.package/Python.class/class/exec..st | 4 + .../Python.class/class/fakeResumeFrame.st | 5 + .../Python.class/class/from.import..st | 3 + .../Python.class/class/from.load..st | 4 + .../Python.class/class/getGlobalKeys.st | 4 + .../Python.class/class/getLocalKeys.st | 4 + .../Python.class/class/import..st | 3 + .../Python.class/class/isCallable..st | 3 + .../PyPy.package/Python.class/class/load..st | 4 + .../Python.class/class/primAsSmalltalk..st | 4 + .../Python.class/class/primEval.cmd..st | 4 + .../class/primEvalInThread.cmd..st | 5 + .../Python.class/class/primGetGlobal..st | 5 + .../Python.class/class/primGetLocal..st | 5 + .../Python.class/class/primGetTopFrame.st | 5 + .../Python.class/class/primResume.st | 5 + .../Python.class/class/single..st | 3 + .../class/startPythonInProcess.st | 4 + .../PyPy.package/Python.class/class/type.st | 3 + .../Python.class/class/vmSpeaksPython.st | 4 + .../Python.class/methodProperties.json | 27 ++++ .../PyPy.package/Python.class/properties.json | 14 ++ .../PythonCompiler.class/README.md | 0 .../class/extractPySelector..st | 3 + .../PythonCompiler.class/class/parserClass.st | 5 + .../instance/compile.in.notifying.ifFail..st | 4 + ...evaluate.in.to.notifying.ifFail.logged..st | 10 ++ .../instance/pythonCompile.class.ifFail..st | 7 + .../methodProperties.json | 8 ++ .../PythonCompiler.class/properties.json | 14 ++ .../README.md | 0 .../instance/selection.st | 8 ++ .../methodProperties.json | 5 + .../properties.json | 14 ++ .../PythonDebugger.class/README.md | 0 .../class/exploreFrames.st | 18 +++ .../instance/appendPythonContexts..st | 15 +++ .../instance/contextForStack..st | 5 + .../instance/debuggerMap.st | 3 + .../instance/expandStack.st | 7 + .../instance/getPySource..st | 8 ++ .../instance/getPySourceContent..st | 8 ++ .../instance/getPySourceString..st | 11 ++ .../instance/isModeStyleable.st | 4 + .../instance/newContext.st | 7 + .../PythonDebugger.class/instance/pcRange.st | 7 + .../instance/process.controller.context..st | 16 +++ .../instance/pyPCRange.st | 9 ++ .../instance/selectedMessage.st | 7 + .../instance/windowColorToUse.st | 4 + .../methodProperties.json | 18 +++ .../PythonDebugger.class/properties.json | 14 ++ .../PythonFakeCompiledMethod.class/README.md | 0 .../instance/debuggerMap.st | 3 + .../instance/frameSize.st | 3 + .../instance/getSourceFor.in..st | 3 + .../instance/initialPC.st | 3 + .../instance/numTemps.st | 3 + .../methodProperties.json | 9 ++ .../properties.json | 14 ++ .../PythonFakeMethodContext.class/README.md | 0 .../instance/isPyContext.st | 3 + .../instance/printOn..st | 9 ++ .../instance/pyFrame..st | 4 + .../instance/pyFrame.st | 4 + .../instance/sender..st | 4 + .../setSender.receiver.method.arguments..st | 11 ++ .../instance/tempNames.st | 7 + .../methodProperties.json | 11 ++ .../properties.json | 14 ++ .../PythonInspector.class/README.md | 0 .../instance/contentsIsString.st | 5 + .../instance/fieldList.st | 9 ++ .../instance/inspect..st | 23 ++++ .../instance/selection.st | 10 ++ .../methodProperties.json | 8 ++ .../PythonInspector.class/properties.json | 14 ++ .../PyPy.package/PythonObject.class/README.md | 0 ...pyCode.withMethod.inProtocol.notifying..st | 10 ++ .../PythonObject.class/class/allInstances.st | 3 + .../class/codeAt.ifAbsent..st | 3 + .../PythonObject.class/class/codeAt.put..st | 5 + ...assified.withStamp.notifying.logSource..st | 38 ++++++ .../compile.notifying.trailer.ifFail..st | 13 ++ .../class/compiledMethodAt.ifAbsent..st | 7 + .../PythonObject.class/class/compilerClass.st | 5 + .../PythonObject.class/class/initialize.st | 5 + .../PythonObject.class/class/new.st | 5 + .../PythonObject.class/class/nextID.st | 6 + .../PythonObject.class/class/printString2.st | 4 + .../class/pythonInitialize.st | 10 ++ .../class/pythonize.instVars.clsVars..st | 31 +++++ .../PythonObject.class/class/pythonize.st | 4 + .../class/sourceCodeAt.ifAbsent..st | 5 + .../PythonObject.class/class/startUp..st | 4 + ...ariableNames.poolDictionaries.category..st | 4 + .../PythonObject.class/class/withAll..st | 3 + .../PythonObject.class/class/withAll2..st | 8 ++ .../PythonObject.class/class/withAll3..st | 6 + .../instance/allAttributes.st | 7 + .../instance/allInstVarNames.st | 3 + .../PythonObject.class/instance/class.st | 5 + .../instance/environment.st | 3 + .../instance/evaluatorClass.st | 3 + .../instance/explorerContents.st | 8 ++ .../instance/hasAttribute..st | 3 + .../instance/hasContentsInExplorer.st | 4 + .../PythonObject.class/instance/inspect.st | 4 + .../instance/inspectorClass.st | 3 + .../instance/instVarNamesAndOffsetsDo..st | 9 ++ .../PythonObject.class/instance/isClass.st | 3 + .../PythonObject.class/instance/isKindOf..st | 3 + .../PythonObject.class/instance/newParser.st | 4 + .../PythonObject.class/instance/printOn..st | 10 ++ .../PythonObject.class/instance/pyDictKeys.st | 4 + .../instance/pyDictValues.st | 4 + .../instance/pyIdentifier.st | 5 + .../PythonObject.class/instance/pyString.st | 5 + .../instance/respondsTo..st | 6 + .../instance/variablesAndOffsetsDo..st | 10 ++ .../PythonObject.class/methodProperties.json | 45 +++++++ .../PythonObject.class/properties.json | 15 +++ .../PyPy.package/PythonParser.class/README.md | 0 .../instance/parseCue.noPattern.ifFail..st | 15 +++ .../instance/parseSelector..st | 4 + .../PythonParser.class/methodProperties.json | 6 + .../PythonParser.class/properties.json | 14 ++ .../PythonTestObject.class/README.md | 0 .../methodProperties.json | 5 + .../PythonTestObject.class/properties.json | 15 +++ .../PythonTextStyler.class/README.md | 0 .../instance/parseableSourceCodeTemplate.st | 5 + .../PythonTextStyler.class/instance/style..st | 4 + .../instance/styleInBackgroundProcess..st | 4 + .../methodProperties.json | 7 + .../PythonTextStyler.class/properties.json | 14 ++ .../PyPy.package/PythonTheme.class/README.md | 0 .../instance/addSyntaxHighlighting..st | 126 ++++++++++++++++++ .../PythonTheme.class/methodProperties.json | 5 + .../PythonTheme.class/properties.json | 14 ++ .../PythonToolSet.class/README.md | 0 .../debug.context.label.contents.fullView..st | 4 + .../PythonToolSet.class/class/initialize.st | 3 + .../class/inspectorClassOf..st | 3 + .../class/interrupt.label..st | 8 ++ .../PythonToolSet.class/methodProperties.json | 8 ++ .../PythonToolSet.class/properties.json | 14 ++ .../PythonWorkspace.class/README.md | 0 .../PythonWorkspace.class/class/foo.st | 3 + .../PythonWorkspace.class/class/open.st | 3 + .../instance/doItReceiver.st | 3 + .../PythonWorkspace.class/instance/foo.st | 3 + .../methodProperties.json | 7 + .../PythonWorkspace.class/properties.json | 14 ++ .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../PyPy.package/monticello.meta/package | 1 + .../PyPy.package/monticello.meta/version | 1 + repository/PyPy.package/properties.json | 2 + 167 files changed, 1221 insertions(+) create mode 100644 repository/PyPy.package/.filetree create mode 100644 repository/PyPy.package/MethodContext.extension/instance/isPyContext.st create mode 100644 repository/PyPy.package/MethodContext.extension/methodProperties.json create mode 100644 repository/PyPy.package/MethodContext.extension/properties.json create mode 100644 repository/PyPy.package/Python.class/README.md create mode 100644 repository/PyPy.package/Python.class/class/builtins.st create mode 100644 repository/PyPy.package/Python.class/class/eval..st create mode 100644 repository/PyPy.package/Python.class/class/evaluatorClass.st create mode 100644 repository/PyPy.package/Python.class/class/exec..st create mode 100644 repository/PyPy.package/Python.class/class/fakeResumeFrame.st create mode 100644 repository/PyPy.package/Python.class/class/from.import..st create mode 100644 repository/PyPy.package/Python.class/class/from.load..st create mode 100644 repository/PyPy.package/Python.class/class/getGlobalKeys.st create mode 100644 repository/PyPy.package/Python.class/class/getLocalKeys.st create mode 100644 repository/PyPy.package/Python.class/class/import..st create mode 100644 repository/PyPy.package/Python.class/class/isCallable..st create mode 100644 repository/PyPy.package/Python.class/class/load..st create mode 100644 repository/PyPy.package/Python.class/class/primAsSmalltalk..st create mode 100644 repository/PyPy.package/Python.class/class/primEval.cmd..st create mode 100644 repository/PyPy.package/Python.class/class/primEvalInThread.cmd..st create mode 100644 repository/PyPy.package/Python.class/class/primGetGlobal..st create mode 100644 repository/PyPy.package/Python.class/class/primGetLocal..st create mode 100644 repository/PyPy.package/Python.class/class/primGetTopFrame.st create mode 100644 repository/PyPy.package/Python.class/class/primResume.st create mode 100644 repository/PyPy.package/Python.class/class/single..st create mode 100644 repository/PyPy.package/Python.class/class/startPythonInProcess.st create mode 100644 repository/PyPy.package/Python.class/class/type.st create mode 100644 repository/PyPy.package/Python.class/class/vmSpeaksPython.st create mode 100644 repository/PyPy.package/Python.class/methodProperties.json create mode 100644 repository/PyPy.package/Python.class/properties.json create mode 100644 repository/PyPy.package/PythonCompiler.class/README.md create mode 100644 repository/PyPy.package/PythonCompiler.class/class/extractPySelector..st create mode 100644 repository/PyPy.package/PythonCompiler.class/class/parserClass.st create mode 100644 repository/PyPy.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st create mode 100644 repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st create mode 100644 repository/PyPy.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st create mode 100644 repository/PyPy.package/PythonCompiler.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonCompiler.class/properties.json create mode 100644 repository/PyPy.package/PythonContextVariablesInspector.class/README.md create mode 100644 repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st create mode 100644 repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonContextVariablesInspector.class/properties.json create mode 100644 repository/PyPy.package/PythonDebugger.class/README.md create mode 100644 repository/PyPy.package/PythonDebugger.class/class/exploreFrames.st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/appendPythonContexts..st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/debuggerMap.st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/expandStack.st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/getPySource..st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/getPySourceContent..st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/getPySourceString..st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/isModeStyleable.st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/newContext.st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/pcRange.st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/process.controller.context..st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st create mode 100644 repository/PyPy.package/PythonDebugger.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonDebugger.class/properties.json create mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/README.md create mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/debuggerMap.st create mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/frameSize.st create mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/getSourceFor.in..st create mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/initialPC.st create mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/numTemps.st create mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/properties.json create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/README.md create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/isPyContext.st create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame..st create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame.st create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/sender..st create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/setSender.receiver.method.arguments..st create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/properties.json create mode 100644 repository/PyPy.package/PythonInspector.class/README.md create mode 100644 repository/PyPy.package/PythonInspector.class/instance/contentsIsString.st create mode 100644 repository/PyPy.package/PythonInspector.class/instance/fieldList.st create mode 100644 repository/PyPy.package/PythonInspector.class/instance/inspect..st create mode 100644 repository/PyPy.package/PythonInspector.class/instance/selection.st create mode 100644 repository/PyPy.package/PythonInspector.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonInspector.class/properties.json create mode 100644 repository/PyPy.package/PythonObject.class/README.md create mode 100644 repository/PyPy.package/PythonObject.class/class/addAndClassifySelector.pyCode.withMethod.inProtocol.notifying..st create mode 100644 repository/PyPy.package/PythonObject.class/class/allInstances.st create mode 100644 repository/PyPy.package/PythonObject.class/class/codeAt.ifAbsent..st create mode 100644 repository/PyPy.package/PythonObject.class/class/codeAt.put..st create mode 100644 repository/PyPy.package/PythonObject.class/class/compile.classified.withStamp.notifying.logSource..st create mode 100644 repository/PyPy.package/PythonObject.class/class/compile.notifying.trailer.ifFail..st create mode 100644 repository/PyPy.package/PythonObject.class/class/compiledMethodAt.ifAbsent..st create mode 100644 repository/PyPy.package/PythonObject.class/class/compilerClass.st create mode 100644 repository/PyPy.package/PythonObject.class/class/initialize.st create mode 100644 repository/PyPy.package/PythonObject.class/class/new.st create mode 100644 repository/PyPy.package/PythonObject.class/class/nextID.st create mode 100644 repository/PyPy.package/PythonObject.class/class/printString2.st create mode 100644 repository/PyPy.package/PythonObject.class/class/pythonInitialize.st create mode 100644 repository/PyPy.package/PythonObject.class/class/pythonize.instVars.clsVars..st create mode 100644 repository/PyPy.package/PythonObject.class/class/pythonize.st create mode 100644 repository/PyPy.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st create mode 100644 repository/PyPy.package/PythonObject.class/class/startUp..st create mode 100644 repository/PyPy.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st create mode 100644 repository/PyPy.package/PythonObject.class/class/withAll..st create mode 100644 repository/PyPy.package/PythonObject.class/class/withAll2..st create mode 100644 repository/PyPy.package/PythonObject.class/class/withAll3..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/allAttributes.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/allInstVarNames.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/class.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/environment.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/evaluatorClass.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/explorerContents.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/hasAttribute..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/hasContentsInExplorer.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/inspect.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/inspectorClass.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/isClass.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/isKindOf..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/newParser.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/printOn..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/pyDictKeys.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/pyDictValues.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/pyIdentifier.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/pyString.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/respondsTo..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/variablesAndOffsetsDo..st create mode 100644 repository/PyPy.package/PythonObject.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonObject.class/properties.json create mode 100644 repository/PyPy.package/PythonParser.class/README.md create mode 100644 repository/PyPy.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st create mode 100644 repository/PyPy.package/PythonParser.class/instance/parseSelector..st create mode 100644 repository/PyPy.package/PythonParser.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonParser.class/properties.json create mode 100644 repository/PyPy.package/PythonTestObject.class/README.md create mode 100644 repository/PyPy.package/PythonTestObject.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonTestObject.class/properties.json create mode 100644 repository/PyPy.package/PythonTextStyler.class/README.md create mode 100644 repository/PyPy.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st create mode 100644 repository/PyPy.package/PythonTextStyler.class/instance/style..st create mode 100644 repository/PyPy.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st create mode 100644 repository/PyPy.package/PythonTextStyler.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonTextStyler.class/properties.json create mode 100644 repository/PyPy.package/PythonTheme.class/README.md create mode 100644 repository/PyPy.package/PythonTheme.class/instance/addSyntaxHighlighting..st create mode 100644 repository/PyPy.package/PythonTheme.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonTheme.class/properties.json create mode 100644 repository/PyPy.package/PythonToolSet.class/README.md create mode 100644 repository/PyPy.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st create mode 100644 repository/PyPy.package/PythonToolSet.class/class/initialize.st create mode 100644 repository/PyPy.package/PythonToolSet.class/class/inspectorClassOf..st create mode 100644 repository/PyPy.package/PythonToolSet.class/class/interrupt.label..st create mode 100644 repository/PyPy.package/PythonToolSet.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonToolSet.class/properties.json create mode 100644 repository/PyPy.package/PythonWorkspace.class/README.md create mode 100644 repository/PyPy.package/PythonWorkspace.class/class/foo.st create mode 100644 repository/PyPy.package/PythonWorkspace.class/class/open.st create mode 100644 repository/PyPy.package/PythonWorkspace.class/instance/doItReceiver.st create mode 100644 repository/PyPy.package/PythonWorkspace.class/instance/foo.st create mode 100644 repository/PyPy.package/PythonWorkspace.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonWorkspace.class/properties.json create mode 100644 repository/PyPy.package/monticello.meta/categories.st create mode 100644 repository/PyPy.package/monticello.meta/initializers.st create mode 100644 repository/PyPy.package/monticello.meta/package create mode 100644 repository/PyPy.package/monticello.meta/version create mode 100644 repository/PyPy.package/properties.json diff --git a/repository/PyPy.package/.filetree b/repository/PyPy.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/PyPy.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/PyPy.package/MethodContext.extension/instance/isPyContext.st b/repository/PyPy.package/MethodContext.extension/instance/isPyContext.st new file mode 100644 index 00000000..377d444a --- /dev/null +++ b/repository/PyPy.package/MethodContext.extension/instance/isPyContext.st @@ -0,0 +1,3 @@ +*PyPy +isPyContext + ^ false \ No newline at end of file diff --git a/repository/PyPy.package/MethodContext.extension/methodProperties.json b/repository/PyPy.package/MethodContext.extension/methodProperties.json new file mode 100644 index 00000000..a6699e30 --- /dev/null +++ b/repository/PyPy.package/MethodContext.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "isPyContext" : "fn 1/16/2017 19:51" } } diff --git a/repository/PyPy.package/MethodContext.extension/properties.json b/repository/PyPy.package/MethodContext.extension/properties.json new file mode 100644 index 00000000..9759a76f --- /dev/null +++ b/repository/PyPy.package/MethodContext.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "MethodContext" } diff --git a/repository/PyPy.package/Python.class/README.md b/repository/PyPy.package/Python.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/Python.class/class/builtins.st b/repository/PyPy.package/Python.class/class/builtins.st new file mode 100644 index 00000000..950953c0 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/builtins.st @@ -0,0 +1,4 @@ +special objects +builtins + + ^ PythonBuiltins ifNil: [PythonBuiltins := self eval: '__builtins__'] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/eval..st b/repository/PyPy.package/Python.class/class/eval..st new file mode 100644 index 00000000..75610062 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/eval..st @@ -0,0 +1,4 @@ +helpers +eval: aString + [ ^ self primEval: aString cmd: 'eval' ] on: Error + do: [ self error: 'Failed to eval: ''', aString, '''' ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/evaluatorClass.st b/repository/PyPy.package/Python.class/class/evaluatorClass.st new file mode 100644 index 00000000..f04f433e --- /dev/null +++ b/repository/PyPy.package/Python.class/class/evaluatorClass.st @@ -0,0 +1,3 @@ +overrides +evaluatorClass + ^ PythonCompiler \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/exec..st b/repository/PyPy.package/Python.class/class/exec..st new file mode 100644 index 00000000..b6ca590b --- /dev/null +++ b/repository/PyPy.package/Python.class/class/exec..st @@ -0,0 +1,4 @@ +helpers +exec: aString + [ ^ self primEval: aString cmd: 'exec' ] on: Error + do: [ self error: 'Failed to exec: ''', aString, '''' ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/fakeResumeFrame.st b/repository/PyPy.package/Python.class/class/fakeResumeFrame.st new file mode 100644 index 00000000..5f841c3b --- /dev/null +++ b/repository/PyPy.package/Python.class/class/fakeResumeFrame.st @@ -0,0 +1,5 @@ +system primitives +fakeResumeFrame + "Magic method that is called by vm (cached in vm)" + Processor yield. + self primResume. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/from.import..st b/repository/PyPy.package/Python.class/class/from.import..st new file mode 100644 index 00000000..87e87d30 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/from.import..st @@ -0,0 +1,3 @@ +helpers +from: aPackageName import: aModuleName + Python exec: 'from ', aPackageName, ' import ', aModuleName \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/from.load..st b/repository/PyPy.package/Python.class/class/from.load..st new file mode 100644 index 00000000..956c7668 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/from.load..st @@ -0,0 +1,4 @@ +helpers +from: aPackageName load: aModuleName + self from: aPackageName import: aModuleName. + ^ Python eval: aModuleName \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/getGlobalKeys.st b/repository/PyPy.package/Python.class/class/getGlobalKeys.st new file mode 100644 index 00000000..11985bc4 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/getGlobalKeys.st @@ -0,0 +1,4 @@ +helpers +getGlobalKeys + ^ Python eval: 'globals().keys()' + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/getLocalKeys.st b/repository/PyPy.package/Python.class/class/getLocalKeys.st new file mode 100644 index 00000000..ad34b40e --- /dev/null +++ b/repository/PyPy.package/Python.class/class/getLocalKeys.st @@ -0,0 +1,4 @@ +helpers +getLocalKeys + ^ Python eval: 'locals().keys()' + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/import..st b/repository/PyPy.package/Python.class/class/import..st new file mode 100644 index 00000000..2a4bd7b3 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/import..st @@ -0,0 +1,3 @@ +helpers +import: aModuleName + Python exec: 'import ', aModuleName \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/isCallable..st b/repository/PyPy.package/Python.class/class/isCallable..st new file mode 100644 index 00000000..862a37eb --- /dev/null +++ b/repository/PyPy.package/Python.class/class/isCallable..st @@ -0,0 +1,3 @@ +helpers +isCallable: aPyString + ^ self eval: 'callable(', aPyString ,')' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/load..st b/repository/PyPy.package/Python.class/class/load..st new file mode 100644 index 00000000..7e4d6aaf --- /dev/null +++ b/repository/PyPy.package/Python.class/class/load..st @@ -0,0 +1,4 @@ +helpers +load: aModuleName + self import: aModuleName. + ^ Python eval: aModuleName \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primAsSmalltalk..st b/repository/PyPy.package/Python.class/class/primAsSmalltalk..st new file mode 100644 index 00000000..7b88f667 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primAsSmalltalk..st @@ -0,0 +1,4 @@ +system primitives +primAsSmalltalk: anObj + + self primitiveFailed. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primEval.cmd..st b/repository/PyPy.package/Python.class/class/primEval.cmd..st new file mode 100644 index 00000000..2fcfb210 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primEval.cmd..st @@ -0,0 +1,4 @@ +system primitives +primEval: aString cmd: aEvalOrExec + + self primitiveFailed. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primEvalInThread.cmd..st b/repository/PyPy.package/Python.class/class/primEvalInThread.cmd..st new file mode 100644 index 00000000..e89cc283 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primEvalInThread.cmd..st @@ -0,0 +1,5 @@ +experimental +primEvalInThread: source cmd: evalOrExec + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primGetGlobal..st b/repository/PyPy.package/Python.class/class/primGetGlobal..st new file mode 100644 index 00000000..e2fb1277 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primGetGlobal..st @@ -0,0 +1,5 @@ +system primitives +primGetGlobal: aKey + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primGetLocal..st b/repository/PyPy.package/Python.class/class/primGetLocal..st new file mode 100644 index 00000000..4642378b --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primGetLocal..st @@ -0,0 +1,5 @@ +system primitives +primGetLocal: aKey + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primGetTopFrame.st b/repository/PyPy.package/Python.class/class/primGetTopFrame.st new file mode 100644 index 00000000..b4d5b440 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primGetTopFrame.st @@ -0,0 +1,5 @@ +experimental +primGetTopFrame + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primResume.st b/repository/PyPy.package/Python.class/class/primResume.st new file mode 100644 index 00000000..2f544b7a --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primResume.st @@ -0,0 +1,5 @@ +experimental +primResume + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/single..st b/repository/PyPy.package/Python.class/class/single..st new file mode 100644 index 00000000..bbee1e8d --- /dev/null +++ b/repository/PyPy.package/Python.class/class/single..st @@ -0,0 +1,3 @@ +helpers +single: aString + ^ self primEval: aString cmd: 'single' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/startPythonInProcess.st b/repository/PyPy.package/Python.class/class/startPythonInProcess.st new file mode 100644 index 00000000..e0c012d7 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/startPythonInProcess.st @@ -0,0 +1,4 @@ +system primitives +startPythonInProcess + Processor yield. + self primResume. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/type.st b/repository/PyPy.package/Python.class/class/type.st new file mode 100644 index 00000000..d0904c6b --- /dev/null +++ b/repository/PyPy.package/Python.class/class/type.st @@ -0,0 +1,3 @@ +special objects +type + ^ Python eval: 'type' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st new file mode 100644 index 00000000..39216cab --- /dev/null +++ b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st @@ -0,0 +1,4 @@ +helpers +vmSpeaksPython + [ Python primEval: '1' cmd: 'eval' ] on: Error do: [ ^ false ]. + ^ true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/methodProperties.json b/repository/PyPy.package/Python.class/methodProperties.json new file mode 100644 index 00000000..cf723e8a --- /dev/null +++ b/repository/PyPy.package/Python.class/methodProperties.json @@ -0,0 +1,27 @@ +{ + "class" : { + "builtins" : "fn 12/20/2016 13:47", + "eval:" : "fn 12/19/2016 01:34", + "evaluatorClass" : "fn 12/22/2016 02:53", + "exec:" : "fn 12/19/2016 00:54", + "fakeResumeFrame" : "fn 1/18/2017 19:19", + "from:import:" : "fn 1/9/2017 20:54", + "from:load:" : "fn 1/9/2017 20:55", + "getGlobalKeys" : "fn 12/19/2016 12:20", + "getLocalKeys" : "fn 12/19/2016 12:20", + "import:" : "fn 1/9/2017 20:54", + "isCallable:" : "fn 12/19/2016 02:18", + "load:" : "fn 1/9/2017 20:54", + "primAsSmalltalk:" : "fn 12/20/2016 20:05", + "primEval:cmd:" : "fn 12/17/2016 14:08", + "primEvalInThread:cmd:" : "fn 1/13/2017 13:14", + "primGetGlobal:" : "fn 12/17/2016 22:23", + "primGetLocal:" : "fn 12/17/2016 22:22", + "primGetTopFrame" : "fn 1/11/2017 11:19", + "primResume" : "fn 1/10/2017 16:49", + "single:" : "fn 12/17/2016 20:29", + "startPythonInProcess" : "fn 1/16/2017 14:38", + "type" : "fn 12/22/2016 21:52", + "vmSpeaksPython" : "fn 12/21/2016 01:59" }, + "instance" : { + } } diff --git a/repository/PyPy.package/Python.class/properties.json b/repository/PyPy.package/Python.class/properties.json new file mode 100644 index 00000000..b44d472a --- /dev/null +++ b/repository/PyPy.package/Python.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + "PythonBuiltins" ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "Python", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonCompiler.class/README.md b/repository/PyPy.package/PythonCompiler.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonCompiler.class/class/extractPySelector..st b/repository/PyPy.package/PythonCompiler.class/class/extractPySelector..st new file mode 100644 index 00000000..7cf06702 --- /dev/null +++ b/repository/PyPy.package/PythonCompiler.class/class/extractPySelector..st @@ -0,0 +1,3 @@ +as yet unclassified +extractPySelector: pySource + ^ ((pySource copyAfter: Character space) copyUpTo: $() asString \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/class/parserClass.st b/repository/PyPy.package/PythonCompiler.class/class/parserClass.st new file mode 100644 index 00000000..c571b1d0 --- /dev/null +++ b/repository/PyPy.package/PythonCompiler.class/class/parserClass.st @@ -0,0 +1,5 @@ +as yet unclassified +parserClass + Python vmSpeaksPython ifFalse: [ ^ Parser ]. + ^ PythonParser "PythonParser" + \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st b/repository/PyPy.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st new file mode 100644 index 00000000..be949f5a --- /dev/null +++ b/repository/PyPy.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st @@ -0,0 +1,4 @@ +as yet unclassified +compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock + Python vmSpeaksPython ifTrue: [ self pythonCompile: textOrStream class: aClass ifFail: failBlock ]. + ^ super compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st new file mode 100644 index 00000000..c83ebae0 --- /dev/null +++ b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st @@ -0,0 +1,10 @@ +as yet unclassified +evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag + | pyCode | + pyCode := textOrStream contents. + (receiver isKindOf: Python) ifFalse: [ + pyCode := pyCode copyReplaceAll: 'self' with: receiver pyIdentifier ]. + "= or multilines cannot be evaluated, but always need to be executed instead" + (pyCode includesAnyOf: {$=. String cr}) ifTrue: [ + [^ Python eval: pyCode ] on: Error do: []]. + ^ Python exec: pyCode diff --git a/repository/PyPy.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st b/repository/PyPy.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st new file mode 100644 index 00000000..6edafdcc --- /dev/null +++ b/repository/PyPy.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st @@ -0,0 +1,7 @@ +as yet unclassified +pythonCompile: pySource class: aClass ifFail: failBlock + | pySelector | + pySelector := self class extractPySelector: pySource. + [ Python exec: pySource, String cr, + aClass name asString, '.', pySelector, ' = ', pySelector ] + on: Error do: failBlock \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/methodProperties.json b/repository/PyPy.package/PythonCompiler.class/methodProperties.json new file mode 100644 index 00000000..ae94a87b --- /dev/null +++ b/repository/PyPy.package/PythonCompiler.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + "extractPySelector:" : "fn 12/19/2016 02:57", + "parserClass" : "fn 12/25/2016 15:08" }, + "instance" : { + "compile:in:notifying:ifFail:" : "fn 12/19/2016 14:09", + "evaluate:in:to:notifying:ifFail:logged:" : "fn 1/7/2017 15:01", + "pythonCompile:class:ifFail:" : "fn 12/19/2016 02:18" } } diff --git a/repository/PyPy.package/PythonCompiler.class/properties.json b/repository/PyPy.package/PythonCompiler.class/properties.json new file mode 100644 index 00000000..1e33b913 --- /dev/null +++ b/repository/PyPy.package/PythonCompiler.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonCompiler", + "pools" : [ + ], + "super" : "Compiler", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/README.md b/repository/PyPy.package/PythonContextVariablesInspector.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st b/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st new file mode 100644 index 00000000..9d1cc89f --- /dev/null +++ b/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st @@ -0,0 +1,8 @@ +as yet unclassified +selection + + selectionIndex = 0 ifTrue: [^ '']. + selectionIndex = 1 ifTrue: [^ object ]. + selectionIndex = 2 ifTrue: [^ object symbolic]. + selectionIndex = 3 ifTrue: [^ object headerDescription]. + ^ object pyFrame f_globals values at: selectionIndex - 3 \ No newline at end of file diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json new file mode 100644 index 00000000..b58ab680 --- /dev/null +++ b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "selection" : "fn 1/16/2017 21:14" } } diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/properties.json b/repository/PyPy.package/PythonContextVariablesInspector.class/properties.json new file mode 100644 index 00000000..65af4d73 --- /dev/null +++ b/repository/PyPy.package/PythonContextVariablesInspector.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonContextVariablesInspector", + "pools" : [ + ], + "super" : "ContextVariablesInspector", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonDebugger.class/README.md b/repository/PyPy.package/PythonDebugger.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonDebugger.class/class/exploreFrames.st b/repository/PyPy.package/PythonDebugger.class/class/exploreFrames.st new file mode 100644 index 00000000..4e1367da --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/exploreFrames.st @@ -0,0 +1,18 @@ +as yet unclassified +exploreFrames + | currentFrame result frameInfo | + currentFrame := Python primGetTopFrame. + result := OrderedCollection new. + [ currentFrame notNil ] whileTrue: [ + frameInfo := IdentityDictionary new + add: #f_lineno->(currentFrame f_lineno); + add: #co_name->(currentFrame f_code co_name); + add: #co_firstlineno->(currentFrame f_code co_firstlineno); + add: #co_filename->(currentFrame f_code co_filename); + add: #f_locals->(currentFrame f_locals __str__); + add: #f_globals->(currentFrame f_globals __str__); + yourself. + result add: frameInfo. + currentFrame := currentFrame f_back ]. + result explore + \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/appendPythonContexts..st b/repository/PyPy.package/PythonDebugger.class/instance/appendPythonContexts..st new file mode 100644 index 00000000..4051a43a --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/appendPythonContexts..st @@ -0,0 +1,15 @@ +helpers +appendPythonContexts: aContext + | newFrames currentPyFrame | + newFrames := OrderedCollection new. + currentPyFrame := Python primGetTopFrame. + [ currentPyFrame notNil ] + whileTrue: [ | newCtx | + newCtx := self newContext. + newCtx pyFrame: currentPyFrame. + newFrames add: newCtx. + currentPyFrame := currentPyFrame f_back ]. + newFrames overlappingPairsDo: [ :a :b | + a sender: b ]. + newFrames last sender: aContext. + ^ newFrames first \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st b/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st new file mode 100644 index 00000000..1f5b1b70 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st @@ -0,0 +1,5 @@ +overrides +contextForStack: aContext + (aContext method literalAt: 3) = #primResume + ifFalse: [ ^ aContext ]. "Normal MethodContext" + ^ self appendPythonContexts: aContext \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/debuggerMap.st b/repository/PyPy.package/PythonDebugger.class/instance/debuggerMap.st new file mode 100644 index 00000000..7e516904 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/debuggerMap.st @@ -0,0 +1,3 @@ +overrides +debuggerMap + ^ self \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/expandStack.st b/repository/PyPy.package/PythonDebugger.class/instance/expandStack.st new file mode 100644 index 00000000..fab69b10 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/expandStack.st @@ -0,0 +1,7 @@ +overrides +expandStack + "A Notifier is being turned into a full debugger. Show a substantial amount of stack in the context pane." + + super expandStack. + receiverInspector := PythonInspector inspect: nil. + contextVariablesInspector := PythonContextVariablesInspector inspect: nil. \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/getPySource..st b/repository/PyPy.package/PythonDebugger.class/instance/getPySource..st new file mode 100644 index 00000000..c53f8300 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/getPySource..st @@ -0,0 +1,8 @@ +overrides +getPySource: aContext + | filename | + aContext isPyContext ifFalse: [ 1 halt. ^ 'Not a Python context!!!' ]. + filename := aContext pyFrame f_code co_filename. + filename = '' ifTrue: [ ^ self getPySourceString: aContext ]. + ^ self getPySourceContent: filename + \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/getPySourceContent..st b/repository/PyPy.package/PythonDebugger.class/instance/getPySourceContent..st new file mode 100644 index 00000000..ea7e99f4 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/getPySourceContent..st @@ -0,0 +1,8 @@ +overrides +getPySourceContent: aFileName + | stream data | + stream := StandardFileStream oldFileNamed: aFileName. + stream := MultiByteFileStream newFrom: stream. + data := stream contents. + stream close. + ^ data \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/getPySourceString..st b/repository/PyPy.package/PythonDebugger.class/instance/getPySourceString..st new file mode 100644 index 00000000..0bbfdfc3 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/getPySourceString..st @@ -0,0 +1,11 @@ +overrides +getPySourceString: aContext + "Attept to lookup source in sender method" + | sender | + sender := aContext sender. + (sender receiver = Python and: [ sender selector = #fakeResumeFrame]) + ifFalse: [ ^ 'Nothing to show' ]. + sender := sender sender. + ((sender method literalAt: 1) = #primEvalInThread:cmd:) + ifTrue: [ ^ sender method literalAt: 3 "Eval py source" ]. + ^ 'Unable to find Python source' \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/isModeStyleable.st b/repository/PyPy.package/PythonDebugger.class/instance/isModeStyleable.st new file mode 100644 index 00000000..58ea902f --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/isModeStyleable.st @@ -0,0 +1,4 @@ +overrides +isModeStyleable + "determine the current mode can be styled" + ^ super isModeStyleable and: [self selectedContext isPyContext not] \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/newContext.st b/repository/PyPy.package/PythonDebugger.class/instance/newContext.st new file mode 100644 index 00000000..266c8e2d --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/newContext.st @@ -0,0 +1,7 @@ +helpers +newContext + ^ PythonFakeMethodContext + sender: nil + receiver: PythonObject + method: (PythonFakeCompiledMethod newMethod: 2 header: 2) + arguments: #() \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/pcRange.st b/repository/PyPy.package/PythonDebugger.class/instance/pcRange.st new file mode 100644 index 00000000..85d16102 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/pcRange.st @@ -0,0 +1,7 @@ +overrides +pcRange + "Answer the indices in the source code for the method corresponding to + the selected context's program counter value." + self selectedContext isPyContext + ifTrue: [ ^ self pyPCRange ]. + ^ super pcRange \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/process.controller.context..st b/repository/PyPy.package/PythonDebugger.class/instance/process.controller.context..st new file mode 100644 index 00000000..f45fa1b1 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/process.controller.context..st @@ -0,0 +1,16 @@ +overrides +process: aProcess controller: aController context: aContext + | contextForStack | + super initialize. + Smalltalk at: #MessageTally ifPresentAndInMemory: [ :tally | + tally terminateTimerProcess]. + contents := nil. + interruptedProcess := aProcess. + interruptedController := aController. + contextForStack := self contextForStack: aContext. + self newStack: (contextForStack stackOfSize: 1). + contextStackIndex := 1. + externalInterrupt := false. + selectingPC := true. + Smalltalk isMorphic ifTrue: + [errorWasInUIProcess := false] \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st b/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st new file mode 100644 index 00000000..e0cb31ee --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st @@ -0,0 +1,9 @@ +overrides +pyPCRange + | lineno lineCount | + lineno := self selectedContext pyFrame f_lineno. + lineCount := 0. + (self getPySource: self selectedContext) lineIndicesDo: [:start :endWithoutDelimiters :end | + (lineCount := lineCount + 1) = lineno + ifTrue: [ ^ start to: end ]]. + ^1 to: 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st b/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st new file mode 100644 index 00000000..5690621d --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st @@ -0,0 +1,7 @@ +overrides +selectedMessage + "Answer the source code of the currently selected context." + | aContext | + aContext := self selectedContext. + aContext isPyContext ifTrue: [ ^ self getPySource: aContext ]. + ^contents := aContext debuggerMap sourceText asText makeSelectorBoldIn: aContext home receiver class \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st b/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st new file mode 100644 index 00000000..03f91554 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st @@ -0,0 +1,4 @@ +overrides +windowColorToUse + + ^ Color r: 108/255 g: 174/255 b: 224/255 \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/methodProperties.json b/repository/PyPy.package/PythonDebugger.class/methodProperties.json new file mode 100644 index 00000000..46f82231 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/methodProperties.json @@ -0,0 +1,18 @@ +{ + "class" : { + "exploreFrames" : "fn 1/18/2017 17:34" }, + "instance" : { + "appendPythonContexts:" : "fn 1/18/2017 18:59", + "contextForStack:" : "fn 1/16/2017 19:34", + "debuggerMap" : "fn 1/16/2017 20:23", + "expandStack" : "fn 1/16/2017 21:03", + "getPySource:" : "fn 1/18/2017 19:12", + "getPySourceContent:" : "fn 1/16/2017 19:57", + "getPySourceString:" : "fn 1/18/2017 19:33", + "isModeStyleable" : "fn 1/16/2017 20:27", + "newContext" : "fn 1/18/2017 17:43", + "pcRange" : "fn 1/18/2017 20:04", + "process:controller:context:" : "fn 1/16/2017 19:34", + "pyPCRange" : "fn 1/18/2017 20:15", + "selectedMessage" : "fn 1/16/2017 19:52", + "windowColorToUse" : "fn 1/18/2017 19:06" } } diff --git a/repository/PyPy.package/PythonDebugger.class/properties.json b/repository/PyPy.package/PythonDebugger.class/properties.json new file mode 100644 index 00000000..26df14f4 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonDebugger", + "pools" : [ + ], + "super" : "Debugger", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/README.md b/repository/PyPy.package/PythonFakeCompiledMethod.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/debuggerMap.st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/debuggerMap.st new file mode 100644 index 00000000..9e84a44e --- /dev/null +++ b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/debuggerMap.st @@ -0,0 +1,3 @@ +as yet unclassified +debuggerMap + ^ self \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/frameSize.st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/frameSize.st new file mode 100644 index 00000000..50c851d4 --- /dev/null +++ b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/frameSize.st @@ -0,0 +1,3 @@ +as yet unclassified +frameSize + ^ 16 \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/getSourceFor.in..st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/getSourceFor.in..st new file mode 100644 index 00000000..b0f7a531 --- /dev/null +++ b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/getSourceFor.in..st @@ -0,0 +1,3 @@ +as yet unclassified +getSourceFor: selector in: class + ^ 'Pysource for #', selector asString, ' in ', class asString \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/initialPC.st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/initialPC.st new file mode 100644 index 00000000..7aa8c418 --- /dev/null +++ b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/initialPC.st @@ -0,0 +1,3 @@ +as yet unclassified +initialPC + ^ 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/numTemps.st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/numTemps.st new file mode 100644 index 00000000..305247c8 --- /dev/null +++ b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/numTemps.st @@ -0,0 +1,3 @@ +as yet unclassified +numTemps + ^ 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/methodProperties.json b/repository/PyPy.package/PythonFakeCompiledMethod.class/methodProperties.json new file mode 100644 index 00000000..af729df3 --- /dev/null +++ b/repository/PyPy.package/PythonFakeCompiledMethod.class/methodProperties.json @@ -0,0 +1,9 @@ +{ + "class" : { + }, + "instance" : { + "debuggerMap" : "fn 1/16/2017 20:12", + "frameSize" : "fn 1/16/2017 19:39", + "getSourceFor:in:" : "fn 1/16/2017 19:25", + "initialPC" : "fn 1/16/2017 19:39", + "numTemps" : "fn 1/16/2017 19:39" } } diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/properties.json b/repository/PyPy.package/PythonFakeCompiledMethod.class/properties.json new file mode 100644 index 00000000..69cfee18 --- /dev/null +++ b/repository/PyPy.package/PythonFakeCompiledMethod.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonFakeCompiledMethod", + "pools" : [ + ], + "super" : "CompiledMethod", + "type" : "compiledMethod" } diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/README.md b/repository/PyPy.package/PythonFakeMethodContext.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/isPyContext.st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/isPyContext.st new file mode 100644 index 00000000..e36abdb3 --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/isPyContext.st @@ -0,0 +1,3 @@ +accessing +isPyContext + ^ true \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st new file mode 100644 index 00000000..b70d3656 --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st @@ -0,0 +1,9 @@ +as yet unclassified +printOn: aStream + self pyFrame + ifNil: [ aStream nextPutAll: 'Unknown pyFrame' ] + ifNotNil: [ | lineno name | + lineno := pyFrame f_lineno. + name := pyFrame f_code co_filename. + aStream nextPutAll: lineno asString, ' @ ', name ]. + \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame..st new file mode 100644 index 00000000..9cba0a4b --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame..st @@ -0,0 +1,4 @@ +accessing +pyFrame: anObject + + pyFrame := anObject \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame.st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame.st new file mode 100644 index 00000000..abbedaa6 --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame.st @@ -0,0 +1,4 @@ +accessing +pyFrame + + ^ pyFrame \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/sender..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/sender..st new file mode 100644 index 00000000..955558b9 --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/sender..st @@ -0,0 +1,4 @@ +accessing +sender: anObject + + sender := anObject \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/setSender.receiver.method.arguments..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/setSender.receiver.method.arguments..st new file mode 100644 index 00000000..6885cbdf --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/setSender.receiver.method.arguments..st @@ -0,0 +1,11 @@ +accessing +setSender: s receiver: r method: m arguments: args + "Create the receiver's initial state." + + sender := s. + receiver := r. + method := m. + closureOrNil := nil. + pc := method initialPC. + "self stackp: method numTemps. + 1 to: args size do: [:i | self at: i put: (args at: i)]" \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st new file mode 100644 index 00000000..feb478a6 --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st @@ -0,0 +1,7 @@ +accessing +tempNames + "Answer a SequenceableCollection of the names of the receiver's temporary + variables, which are strings." + + self pyFrame ifNil: [^ #()]. + ^ self pyFrame f_globals keys \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json b/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json new file mode 100644 index 00000000..f46867fa --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json @@ -0,0 +1,11 @@ +{ + "class" : { + }, + "instance" : { + "isPyContext" : "fn 1/16/2017 19:51", + "printOn:" : "fn 1/16/2017 23:54", + "pyFrame" : "fn 1/16/2017 19:30", + "pyFrame:" : "fn 1/16/2017 19:30", + "sender:" : "fn 1/16/2017 21:54", + "setSender:receiver:method:arguments:" : "fn 1/18/2017 17:38", + "tempNames" : "fn 1/16/2017 20:42" } } diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/properties.json b/repository/PyPy.package/PythonFakeMethodContext.class/properties.json new file mode 100644 index 00000000..adcd8585 --- /dev/null +++ b/repository/PyPy.package/PythonFakeMethodContext.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "pyFrame" ], + "name" : "PythonFakeMethodContext", + "pools" : [ + ], + "super" : "MethodContext", + "type" : "variable" } diff --git a/repository/PyPy.package/PythonInspector.class/README.md b/repository/PyPy.package/PythonInspector.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonInspector.class/instance/contentsIsString.st b/repository/PyPy.package/PythonInspector.class/instance/contentsIsString.st new file mode 100644 index 00000000..1a1d0522 --- /dev/null +++ b/repository/PyPy.package/PythonInspector.class/instance/contentsIsString.st @@ -0,0 +1,5 @@ +as yet unclassified +contentsIsString + "Hacked so contents empty when deselected and = long printString when item 2" + + ^ selectionIndex = 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/fieldList.st b/repository/PyPy.package/PythonInspector.class/instance/fieldList.st new file mode 100644 index 00000000..c91582c3 --- /dev/null +++ b/repository/PyPy.package/PythonInspector.class/instance/fieldList.st @@ -0,0 +1,9 @@ +as yet unclassified +fieldList + "Answer the base field list plus an abbreviated list of indices." + | keys | + keys := OrderedCollection new. + keys add: 'self'. + keys add: 'class'. + keys addAll: object allAttributes. + ^ keys \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/inspect..st b/repository/PyPy.package/PythonInspector.class/instance/inspect..st new file mode 100644 index 00000000..6ef06d41 --- /dev/null +++ b/repository/PyPy.package/PythonInspector.class/instance/inspect..st @@ -0,0 +1,23 @@ +as yet unclassified +inspect: anObject + "Initialize the receiver so that it is inspecting anObject. There is no current selection. + + Normally the receiver will be of the correct class (as defined by anObject inspectorClass), + because it will have just been created by sedning inspect to anObject. However, the + debugger uses two embedded inspectors, which are re-targetted on the current receiver + each time the stack frame changes. The left-hand inspector in the debugger has its + class changed by the code here. Care should be taken if this method is overridden to + ensure that the overriding code calls 'super inspect: anObject', or otherwise ensures that + the class of these embedded inspectors are changed back." + + | c | + c := anObject inspectorClass. + self class ~= c ifTrue: [ + self class format = c format + ifTrue: [self primitiveChangeClassTo: c basicNew] + ifFalse: [self becomeForward: (c basicNew copyFrom: self)]]. + "Set 'object' before sending the initialize message, because some implementations + of initialize (e.g., in DictionaryInspector) require 'object' to be non-nil." + + object := anObject. + self initialize \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/selection.st b/repository/PyPy.package/PythonInspector.class/instance/selection.st new file mode 100644 index 00000000..4ff295cc --- /dev/null +++ b/repository/PyPy.package/PythonInspector.class/instance/selection.st @@ -0,0 +1,10 @@ +as yet unclassified +selection + "The receiver has a list of variables of its inspected object. + One of these is selected. Answer the value of the selected variable." + | attr | + selectionIndex = 0 ifTrue: [^ '']. + selectionIndex = 1 ifTrue: [^ object]. + selectionIndex = 2 ifTrue: [^ object class]. + attr := object allAttributes at: selectionIndex - 2. + ^ object perform: attr asSymbol \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/methodProperties.json b/repository/PyPy.package/PythonInspector.class/methodProperties.json new file mode 100644 index 00000000..0be99838 --- /dev/null +++ b/repository/PyPy.package/PythonInspector.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + }, + "instance" : { + "contentsIsString" : "fn 12/23/2016 11:11", + "fieldList" : "fn 12/25/2016 15:26", + "inspect:" : "fn 12/22/2016 21:18", + "selection" : "fn 12/25/2016 15:26" } } diff --git a/repository/PyPy.package/PythonInspector.class/properties.json b/repository/PyPy.package/PythonInspector.class/properties.json new file mode 100644 index 00000000..7b46538b --- /dev/null +++ b/repository/PyPy.package/PythonInspector.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonInspector", + "pools" : [ + ], + "super" : "Inspector", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonObject.class/README.md b/repository/PyPy.package/PythonObject.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonObject.class/class/addAndClassifySelector.pyCode.withMethod.inProtocol.notifying..st b/repository/PyPy.package/PythonObject.class/class/addAndClassifySelector.pyCode.withMethod.inProtocol.notifying..st new file mode 100644 index 00000000..84914398 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/addAndClassifySelector.pyCode.withMethod.inProtocol.notifying..st @@ -0,0 +1,10 @@ +as yet unclassified +addAndClassifySelector: selector pyCode: aPyCode withMethod: compiledMethod inProtocol: category notifying: requestor + | priorMethodOrNil | + priorMethodOrNil := self compiledMethodAt: selector ifAbsent: [nil]. + self codeAt: selector put: aPyCode. + SystemChangeNotifier uniqueInstance + doSilently: [self organization classify: selector under: category]. + priorMethodOrNil isNil + ifTrue: [SystemChangeNotifier uniqueInstance methodAdded: compiledMethod selector: selector inProtocol: category class: self requestor: requestor] + ifFalse: [SystemChangeNotifier uniqueInstance methodChangedFrom: priorMethodOrNil to: compiledMethod selector: selector inClass: self requestor: requestor]. \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/allInstances.st b/repository/PyPy.package/PythonObject.class/class/allInstances.st new file mode 100644 index 00000000..28f49cc5 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/allInstances.st @@ -0,0 +1,3 @@ +overrides +allInstances + ^ Python eval: self name, '.instances.values()' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/codeAt.ifAbsent..st b/repository/PyPy.package/PythonObject.class/class/codeAt.ifAbsent..st new file mode 100644 index 00000000..29f77a1f --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/codeAt.ifAbsent..st @@ -0,0 +1,3 @@ +as yet unclassified +codeAt: aSymbol ifAbsent: absentBlock + ^ Code at: aSymbol ifAbsent: absentBlock \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/codeAt.put..st b/repository/PyPy.package/PythonObject.class/class/codeAt.put..st new file mode 100644 index 00000000..c1e1f59a --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/codeAt.put..st @@ -0,0 +1,5 @@ +as yet unclassified +codeAt: aSymbol put: pyCode + "Code := nil" + Code ifNil: [ Code := Dictionary new ]. + ^ Code at: aSymbol put: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/compile.classified.withStamp.notifying.logSource..st b/repository/PyPy.package/PythonObject.class/class/compile.classified.withStamp.notifying.logSource..st new file mode 100644 index 00000000..a7dacce3 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/compile.classified.withStamp.notifying.logSource..st @@ -0,0 +1,38 @@ +overrides +compile: text classified: category withStamp: changeStamp notifying: requestor logSource: logSource + | methodAndNode selector | + methodAndNode := self + compile: text asString + notifying: requestor + trailer: (self defaultMethodTrailerIfLogSource: logSource) + ifFail: [ ^ nil ]. + selector := methodAndNode selector. + (Python vmSpeaksPython not and: [logSource]) ifTrue: + [ self + logMethodSource: text + forMethodWithNode: methodAndNode + inCategory: category + withStamp: changeStamp + notifying: requestor. + RecentMessages default + recordSelector: selector + forClass: methodAndNode method methodClass + inEnvironment: CurrentEnvironment signal ]. + Python vmSpeaksPython + ifTrue: [ + self + addAndClassifySelector: selector + pyCode: text + withMethod: methodAndNode method + inProtocol: category + notifying: requestor ] + ifFalse: [ + self + addAndClassifySelector: selector + withMethod: methodAndNode method + inProtocol: category + notifying: requestor ]. + self instanceSide + noteCompilationOf: selector + meta: self isClassSide. + ^ selector \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/compile.notifying.trailer.ifFail..st b/repository/PyPy.package/PythonObject.class/class/compile.notifying.trailer.ifFail..st new file mode 100644 index 00000000..1b5d5ee8 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/compile.notifying.trailer.ifFail..st @@ -0,0 +1,13 @@ +overrides +compile: code notifying: requestor trailer: bytes ifFail: failBlock + "Compile code without logging the source in the changes file" + | pySelector compiledMeth methodNode | + Python vmSpeaksPython ifFalse: [ ^ super compile: code notifying: requestor trailer: bytes ifFail: failBlock ]. + pySelector := PythonCompiler extractPySelector: code. + compiledMeth := CompiledMethod new methodClass: self; yourself. + methodNode := self newCompiler + compile: code + in: self + notifying: requestor + ifFail: failBlock. + ^ CompiledMethodWithNode new method: compiledMeth; node: methodNode. \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/compiledMethodAt.ifAbsent..st b/repository/PyPy.package/PythonObject.class/class/compiledMethodAt.ifAbsent..st new file mode 100644 index 00000000..37f556ae --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/compiledMethodAt.ifAbsent..st @@ -0,0 +1,7 @@ +overrides +compiledMethodAt: methodSelector ifAbsent: aBlock + Python vmSpeaksPython ifFalse: [ ^ super compiledMethodAt: methodSelector ifAbsent: aBlock ]. + "Return dummy CM to satisfy browser" + ^ CompiledMethod new methodClass: self; selector: methodSelector; yourself + + \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/compilerClass.st b/repository/PyPy.package/PythonObject.class/class/compilerClass.st new file mode 100644 index 00000000..45aeeea3 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/compilerClass.st @@ -0,0 +1,5 @@ +as yet unclassified +compilerClass + Python vmSpeaksPython ifFalse: [ ^ Compiler ]. + ^ PythonCompiler + \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/initialize.st b/repository/PyPy.package/PythonObject.class/class/initialize.st new file mode 100644 index 00000000..9381318d --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/initialize.st @@ -0,0 +1,5 @@ +as yet unclassified +initialize + super initialize. + Smalltalk addToStartUpList: PythonObject + "Smalltalk removeFromStartUpList: PythonObject" \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/new.st b/repository/PyPy.package/PythonObject.class/class/new.st new file mode 100644 index 00000000..3dfc8d49 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/new.st @@ -0,0 +1,5 @@ +overrides +new + Python vmSpeaksPython ifFalse: [ ^ super new ]. + ^ self withAll: #() + \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/nextID.st b/repository/PyPy.package/PythonObject.class/class/nextID.st new file mode 100644 index 00000000..1a290885 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/nextID.st @@ -0,0 +1,6 @@ +overrides +nextID + "NextID = nil" + NextID ifNil: [ NextID := 0 ]. + NextID := NextID + 1. + ^ NextID \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/printString2.st b/repository/PyPy.package/PythonObject.class/class/printString2.st new file mode 100644 index 00000000..94ad020b --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/printString2.st @@ -0,0 +1,4 @@ +as yet unclassified +printString2 + Python vmSpeaksPython ifFalse: [ ^ super printString ]. + ^ Python eval: self name asString, '.__class__.__name__' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st new file mode 100644 index 00000000..988fd80b --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st @@ -0,0 +1,10 @@ +as yet unclassified +pythonInitialize + NextID := 0. + Python exec: ' +import sys +sys.path.append(''', Smalltalk image imagePath ,''')'. + "Pythonize all Python classes" + self withAllSubclasses do: [ :ea | ea pythonize ]. + "Install PythonBuiltins (failing atm)" + "Smalltalk at: #PythonBuiltins put: Python builtins" \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/pythonize.instVars.clsVars..st b/repository/PyPy.package/PythonObject.class/class/pythonize.instVars.clsVars..st new file mode 100644 index 00000000..cb0a603b --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/pythonize.instVars.clsVars..st @@ -0,0 +1,31 @@ +as yet unclassified +pythonize: t instVars: f clsVars: d + | code instVars clsVars pySuperclass initSignature | + instVars := Scanner new scanFieldNames: f. + clsVars := Scanner new scanFieldNames: d. + initSignature := 'self'. + instVars do: [ :ea | initSignature := initSignature, ', ', ea, '=None']. + + pySuperclass := (self superclass = Object + ifTrue: [ 'object' ] + ifFalse: [ self superclass name asString ]). + code := 'class ', t asString, '(', pySuperclass, '):', String cr. + + code := code, String tab, 'next_id = 0', String cr. + code := code, String tab, 'instances = {}', String cr. + + "clsVars are currently class attributes" + clsVars do: [ :ea | code := code, String tab, ea, ' = None', String cr]. + + code := code, String tab, 'def __init__(', initSignature ,'):', String cr. + code := code, String tab, String tab, 'self.__class__.next_id += 1', String cr. + code := code, String tab, String tab, 'self.inst_id = self.__class__.next_id', String cr. + code := code, String tab, String tab, 'self.__class__.instances[self.inst_id] = self', String cr. + instVars do: [ :ea | + code := code, String tab, String tab, 'self.', ea, ' = ', ea, String cr ]. + instVars ifEmpty: [ code := code, String tab, String tab, 'pass', String cr ]. + + "instVars do: [ :ea | + code := code, String tab, 'def ', ea, '(self, val): self.', ea, '_val = val' , String cr ]." + + Python exec: code \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/pythonize.st b/repository/PyPy.package/PythonObject.class/class/pythonize.st new file mode 100644 index 00000000..ad197856 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/pythonize.st @@ -0,0 +1,4 @@ +as yet unclassified +pythonize + "Transcript showln: 'Pythonizing ', self name, '...'." + self pythonize: self name instVars: self instVarNames clsVars: self classVarNames \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st b/repository/PyPy.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st new file mode 100644 index 00000000..96d68752 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st @@ -0,0 +1,5 @@ +as yet unclassified +sourceCodeAt: selector ifAbsent: aBlock + Python vmSpeaksPython ifFalse: [ ^ super sourceCodeAt: selector ifAbsent: aBlock ]. + ^ self codeAt: selector ifAbsent: aBlock + \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/startUp..st b/repository/PyPy.package/PythonObject.class/class/startUp..st new file mode 100644 index 00000000..49637618 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/startUp..st @@ -0,0 +1,4 @@ +as yet unclassified +startUp: resuming + (resuming and: [ Python vmSpeaksPython ]) + ifTrue: [ self pythonInitialize ] \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st b/repository/PyPy.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st new file mode 100644 index 00000000..37fe112a --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st @@ -0,0 +1,4 @@ +as yet unclassified +subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat + Python vmSpeaksPython ifTrue: [ self pythonize: t instVars: f clsVars: d ]. + ^ super subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/withAll..st b/repository/PyPy.package/PythonObject.class/class/withAll..st new file mode 100644 index 00000000..355b8115 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/withAll..st @@ -0,0 +1,3 @@ +as yet unclassified +withAll: anArray + ^ Python eval: self name asString, '(', (anArray joinSeparatedBy: ',') , ')' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/withAll2..st b/repository/PyPy.package/PythonObject.class/class/withAll2..st new file mode 100644 index 00000000..26e83602 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/withAll2..st @@ -0,0 +1,8 @@ +as yet unclassified +withAll2: anArray + | id obj | + id := 'inst', PythonObject nextID asString. + Python exec: id, ' = ', self name asString, '(', (anArray joinSeparatedBy: ',') , ')'. + obj := Python eval: id. + obj pyID: id. + ^ obj \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/withAll3..st b/repository/PyPy.package/PythonObject.class/class/withAll3..st new file mode 100644 index 00000000..fd6417ea --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/class/withAll3..st @@ -0,0 +1,6 @@ +as yet unclassified +withAll3: anArray + | id | + id := 'inst', PythonObject nextID asString. + Python exec: id, ' = ', self name asString, '(', (anArray joinSeparatedBy: ',') , ')'. + ^ self basicNew initialize pyID: id; yourself \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/allAttributes.st b/repository/PyPy.package/PythonObject.class/instance/allAttributes.st new file mode 100644 index 00000000..4a5e154e --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/allAttributes.st @@ -0,0 +1,7 @@ +helpers +allAttributes + | attributes | + attributes := OrderedCollection new. + (self hasAttribute: '__dict__') ifTrue: [ attributes add: '__dict__']. + attributes addAll: self pyDictKeys. + ^ attributes \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/allInstVarNames.st b/repository/PyPy.package/PythonObject.class/instance/allInstVarNames.st new file mode 100644 index 00000000..c8f110e7 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/allInstVarNames.st @@ -0,0 +1,3 @@ +overrides +allInstVarNames + ^ self allAttributes \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/class.st b/repository/PyPy.package/PythonObject.class/instance/class.st new file mode 100644 index 00000000..66c21a5a --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/class.st @@ -0,0 +1,5 @@ +overrides +class + self isClass + ifTrue: [ ^ self ] + ifFalse: [ ^ self __class__ ] \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/environment.st b/repository/PyPy.package/PythonObject.class/instance/environment.st new file mode 100644 index 00000000..d6270da0 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/environment.st @@ -0,0 +1,3 @@ +overrides +environment + ^ nil \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/evaluatorClass.st b/repository/PyPy.package/PythonObject.class/instance/evaluatorClass.st new file mode 100644 index 00000000..f04f433e --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/evaluatorClass.st @@ -0,0 +1,3 @@ +overrides +evaluatorClass + ^ PythonCompiler \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/explorerContents.st b/repository/PyPy.package/PythonObject.class/instance/explorerContents.st new file mode 100644 index 00000000..4d723907 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/explorerContents.st @@ -0,0 +1,8 @@ +explorer +explorerContents + ^ self allAttributes asOrderedCollection collect: [:each | | value | + value := self perform: each. + ObjectExplorerWrapper + with: value + name: each + model: self] \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st b/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st new file mode 100644 index 00000000..d53f819c --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st @@ -0,0 +1,3 @@ +helpers +hasAttribute: anAttribute + ^ Python builtins hasattr: self attr: anAttribute \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/hasContentsInExplorer.st b/repository/PyPy.package/PythonObject.class/instance/hasContentsInExplorer.st new file mode 100644 index 00000000..ea5a3ba7 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/hasContentsInExplorer.st @@ -0,0 +1,4 @@ +inspector +hasContentsInExplorer + + ^ self allAttributes notEmpty diff --git a/repository/PyPy.package/PythonObject.class/instance/inspect.st b/repository/PyPy.package/PythonObject.class/instance/inspect.st new file mode 100644 index 00000000..9576f5bb --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/inspect.st @@ -0,0 +1,4 @@ +inspector +inspect + "Create and schedule an Inspector in which the user can examine the receiver's variables." + ^ PythonToolSet inspect: self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/inspectorClass.st b/repository/PyPy.package/PythonObject.class/instance/inspectorClass.st new file mode 100644 index 00000000..54a02214 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/inspectorClass.st @@ -0,0 +1,3 @@ +inspector +inspectorClass + ^ PythonInspector \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st b/repository/PyPy.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st new file mode 100644 index 00000000..d0fe74a1 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st @@ -0,0 +1,9 @@ +overrides +instVarNamesAndOffsetsDo: aBinaryBlock + "This is part of the interface between the compiler and a class's instance or field names. + The class should enumerate aBinaryBlock with the instance variable name strings and + their integer offsets. The order is important. Names evaluated later will override the + same names occurring earlier." + + "Nothing to do here; ClassDescription introduces named instance variables" + ^self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/isClass.st b/repository/PyPy.package/PythonObject.class/instance/isClass.st new file mode 100644 index 00000000..9a5cbed8 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/isClass.st @@ -0,0 +1,3 @@ +helpers +isClass + ^ Python builtins isinstance: self and: Python type \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/isKindOf..st b/repository/PyPy.package/PythonObject.class/instance/isKindOf..st new file mode 100644 index 00000000..b036cc1c --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/isKindOf..st @@ -0,0 +1,3 @@ +overrides +isKindOf: aClass + ^ PythonObject inheritsFrom: aClass \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/newParser.st b/repository/PyPy.package/PythonObject.class/instance/newParser.st new file mode 100644 index 00000000..ccda3fc1 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/newParser.st @@ -0,0 +1,4 @@ +overrides +newParser + "Answer a Parser suitable for parsing source code in this Behavior" + ^ PythonParser new \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/printOn..st b/repository/PyPy.package/PythonObject.class/instance/printOn..st new file mode 100644 index 00000000..7485e62f --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/printOn..st @@ -0,0 +1,10 @@ +overrides +printOn: aStream + "Append to the argument, aStream, a sequence of characters that + identifies the receiver." + + | title | + title := self pyString. + aStream + nextPutAll: (title first isVowel ifTrue: ['an '] ifFalse: ['a ']); + nextPutAll: title \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/pyDictKeys.st b/repository/PyPy.package/PythonObject.class/instance/pyDictKeys.st new file mode 100644 index 00000000..7dc8c256 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/pyDictKeys.st @@ -0,0 +1,4 @@ +helpers +pyDictKeys + (self hasAttribute: '__dict__') ifTrue: [ ^ self __dict__ keys ]. + ^ #() \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/pyDictValues.st b/repository/PyPy.package/PythonObject.class/instance/pyDictValues.st new file mode 100644 index 00000000..b452c547 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/pyDictValues.st @@ -0,0 +1,4 @@ +helpers +pyDictValues + (self hasAttribute: '__dict__') ifTrue: [ ^ self __dict__ values ]. + ^ #() \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/pyIdentifier.st b/repository/PyPy.package/PythonObject.class/instance/pyIdentifier.st new file mode 100644 index 00000000..72d2f4ec --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/pyIdentifier.st @@ -0,0 +1,5 @@ +helpers +pyIdentifier + | instID | + instID := self inst_id. + ^ self class __name__, '.instances[', instID, ']'. \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/pyString.st b/repository/PyPy.package/PythonObject.class/instance/pyString.st new file mode 100644 index 00000000..29759e1b --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/pyString.st @@ -0,0 +1,5 @@ +helpers +pyString + (self hasAttribute: '__name__') ifTrue: [ ^ self __name__ ]. + self isClass ifFalse: [ ^ self __str__ ]. + ^ 'unknown PyObject' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/respondsTo..st b/repository/PyPy.package/PythonObject.class/instance/respondsTo..st new file mode 100644 index 00000000..6d3339c3 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/respondsTo..st @@ -0,0 +1,6 @@ +overrides +respondsTo: aSymbol + "Answer whether the method dictionary of the receiver's class contains + aSymbol as a message selector." + + ^PythonObject canUnderstand: aSymbol \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/variablesAndOffsetsDo..st b/repository/PyPy.package/PythonObject.class/instance/variablesAndOffsetsDo..st new file mode 100644 index 00000000..6caeecb0 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/variablesAndOffsetsDo..st @@ -0,0 +1,10 @@ +overrides +variablesAndOffsetsDo: aBinaryBlock + "This is the interface between the compiler and a class's instance or field names. The + class should enumerate aBinaryBlock with the field definitions (with nil offsets) followed + by the instance variable name strings and their integer offsets (1-relative). The order is + important; names evaluated later will override the same names occurring earlier." + + "Only need to do instance variables here. CProtoObject introduces field definitions." + "Nothing to do here; ClassDescription introduces named instance variables" + ^ self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/methodProperties.json b/repository/PyPy.package/PythonObject.class/methodProperties.json new file mode 100644 index 00000000..72a464a3 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/methodProperties.json @@ -0,0 +1,45 @@ +{ + "class" : { + "addAndClassifySelector:pyCode:withMethod:inProtocol:notifying:" : "fn 12/19/2016 14:16", + "allInstances" : "fn 12/23/2016 11:17", + "codeAt:ifAbsent:" : "fn 12/19/2016 13:03", + "codeAt:put:" : "fn 12/19/2016 13:02", + "compile:classified:withStamp:notifying:logSource:" : "fn 12/19/2016 14:17", + "compile:notifying:trailer:ifFail:" : "fn 12/19/2016 14:05", + "compiledMethodAt:ifAbsent:" : "fn 12/19/2016 14:06", + "compilerClass" : "fn 12/19/2016 14:06", + "initialize" : "fn 1/18/2017 20:18", + "new" : "fn 12/19/2016 14:14", + "nextID" : "fn 12/18/2016 23:45", + "printString2" : "fn 12/20/2016 19:24", + "pythonInitialize" : "fn 1/18/2017 20:22", + "pythonize" : "fn 12/21/2016 00:15", + "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", + "sourceCodeAt:ifAbsent:" : "fn 12/19/2016 14:07", + "startUp:" : "fn 12/21/2016 15:13", + "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 12/19/2016 14:05", + "withAll2:" : "fn 12/22/2016 15:19", + "withAll3:" : "fn 12/21/2016 14:50", + "withAll:" : "fn 12/22/2016 15:19" }, + "instance" : { + "allAttributes" : "fn 12/25/2016 15:30", + "allInstVarNames" : "fn 12/22/2016 23:20", + "class" : "fn 12/22/2016 22:23", + "environment" : "fn 12/22/2016 22:00", + "evaluatorClass" : "fn 12/23/2016 00:01", + "explorerContents" : "fn 12/22/2016 23:49", + "hasAttribute:" : "fn 12/22/2016 21:46", + "hasContentsInExplorer" : "fn 12/22/2016 23:11", + "inspect" : "fn 12/22/2016 21:09", + "inspectorClass" : "fn 12/22/2016 21:16", + "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", + "isClass" : "fn 12/22/2016 21:52", + "isKindOf:" : "fn 12/25/2016 14:47", + "newParser" : "fn 12/22/2016 22:19", + "printOn:" : "fn 12/25/2016 14:50", + "pyDictKeys" : "fn 12/25/2016 15:25", + "pyDictValues" : "fn 12/25/2016 15:25", + "pyIdentifier" : "fn 1/18/2017 17:20", + "pyString" : "fn 12/25/2016 14:50", + "respondsTo:" : "fn 12/22/2016 23:36", + "variablesAndOffsetsDo:" : "fn 12/22/2016 23:59" } } diff --git a/repository/PyPy.package/PythonObject.class/properties.json b/repository/PyPy.package/PythonObject.class/properties.json new file mode 100644 index 00000000..747c8eb3 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + "NextID", + "Code" ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "pyID" ], + "name" : "PythonObject", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonParser.class/README.md b/repository/PyPy.package/PythonParser.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st b/repository/PyPy.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st new file mode 100644 index 00000000..81a9759f --- /dev/null +++ b/repository/PyPy.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st @@ -0,0 +1,15 @@ +as yet unclassified +parseCue: aCue noPattern: noPattern ifFail: aBlock + | methodNode pySource | + pySource := aCue sourceStream upToEnd. + methodNode := self newMethodNode comment: 'Python comment'. + methodNode + selector: (PythonCompiler extractPySelector: pySource) asSymbol + arguments: nil + precedence: nil + temporaries: nil + block: nil + encoder: nil + primitive: nil. + methodNode sourceText: pySource. + ^ methodNode \ No newline at end of file diff --git a/repository/PyPy.package/PythonParser.class/instance/parseSelector..st b/repository/PyPy.package/PythonParser.class/instance/parseSelector..st new file mode 100644 index 00000000..d038bafa --- /dev/null +++ b/repository/PyPy.package/PythonParser.class/instance/parseSelector..st @@ -0,0 +1,4 @@ +as yet unclassified +parseSelector: pyCode + prevEnd := pyCode indexOf: $:. "highlight method signature" + ^ (PythonCompiler extractPySelector: pyCode) asSymbol \ No newline at end of file diff --git a/repository/PyPy.package/PythonParser.class/methodProperties.json b/repository/PyPy.package/PythonParser.class/methodProperties.json new file mode 100644 index 00000000..108ad532 --- /dev/null +++ b/repository/PyPy.package/PythonParser.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "parseCue:noPattern:ifFail:" : "fn 12/19/2016 02:18", + "parseSelector:" : "fn 12/19/2016 15:00" } } diff --git a/repository/PyPy.package/PythonParser.class/properties.json b/repository/PyPy.package/PythonParser.class/properties.json new file mode 100644 index 00000000..1c52cef6 --- /dev/null +++ b/repository/PyPy.package/PythonParser.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonParser", + "pools" : [ + ], + "super" : "Parser", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonTestObject.class/README.md b/repository/PyPy.package/PythonTestObject.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonTestObject.class/methodProperties.json b/repository/PyPy.package/PythonTestObject.class/methodProperties.json new file mode 100644 index 00000000..0e4a6622 --- /dev/null +++ b/repository/PyPy.package/PythonTestObject.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + } } diff --git a/repository/PyPy.package/PythonTestObject.class/properties.json b/repository/PyPy.package/PythonTestObject.class/properties.json new file mode 100644 index 00000000..3b99e330 --- /dev/null +++ b/repository/PyPy.package/PythonTestObject.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "bar", + "foo" ], + "name" : "PythonTestObject", + "pools" : [ + ], + "super" : "PythonObject", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonTextStyler.class/README.md b/repository/PyPy.package/PythonTextStyler.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st b/repository/PyPy.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st new file mode 100644 index 00000000..e5fb30a3 --- /dev/null +++ b/repository/PyPy.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st @@ -0,0 +1,5 @@ +as yet unclassified +parseableSourceCodeTemplate + + ^'def method(self, x): + return 2 * x' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTextStyler.class/instance/style..st b/repository/PyPy.package/PythonTextStyler.class/instance/style..st new file mode 100644 index 00000000..da11a0e6 --- /dev/null +++ b/repository/PyPy.package/PythonTextStyler.class/instance/style..st @@ -0,0 +1,4 @@ +as yet unclassified +style: aText + Python vmSpeaksPython ifTrue: [^ aText]. + ^ super style: aText \ No newline at end of file diff --git a/repository/PyPy.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st b/repository/PyPy.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st new file mode 100644 index 00000000..144c0a14 --- /dev/null +++ b/repository/PyPy.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st @@ -0,0 +1,4 @@ +as yet unclassified +styleInBackgroundProcess: aText + Python vmSpeaksPython ifTrue: [^ aText]. + ^ super styleInBackgroundProcess: aText \ No newline at end of file diff --git a/repository/PyPy.package/PythonTextStyler.class/methodProperties.json b/repository/PyPy.package/PythonTextStyler.class/methodProperties.json new file mode 100644 index 00000000..66e48644 --- /dev/null +++ b/repository/PyPy.package/PythonTextStyler.class/methodProperties.json @@ -0,0 +1,7 @@ +{ + "class" : { + }, + "instance" : { + "parseableSourceCodeTemplate" : "fn 12/22/2016 15:20", + "style:" : "fn 12/19/2016 14:57", + "styleInBackgroundProcess:" : "fn 12/19/2016 14:57" } } diff --git a/repository/PyPy.package/PythonTextStyler.class/properties.json b/repository/PyPy.package/PythonTextStyler.class/properties.json new file mode 100644 index 00000000..0531d039 --- /dev/null +++ b/repository/PyPy.package/PythonTextStyler.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonTextStyler", + "pools" : [ + ], + "super" : "SHTextStylerST80", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonTheme.class/README.md b/repository/PyPy.package/PythonTheme.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonTheme.class/instance/addSyntaxHighlighting..st b/repository/PyPy.package/PythonTheme.class/instance/addSyntaxHighlighting..st new file mode 100644 index 00000000..36539ada --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/instance/addSyntaxHighlighting..st @@ -0,0 +1,126 @@ +as yet unclassified +addSyntaxHighlighting: theme + "This was the former sub-dued highlighting. + self create apply. + " + + theme + set: #color for: #TextAction to: Color aqua; + + set: #default for: #PythonTextStyler to: {Color black}; + set: #invalid for: #PythonTextStyler to: {Color black}; + set: #excessCode for: #PythonTextStyler to: {Color black}; + set: #comment for: #PythonTextStyler to: {Color cyan muchDarker}; + set: #unfinishedComment for: #PythonTextStyler to: {Color black muchDarker. TextEmphasis italic}; + set: #'$' for: #PythonTextStyler to: {Color black muchDarker}; + set: #character for: #PythonTextStyler to: {Color black muchDarker}; + set: #integer for: #PythonTextStyler to: {Color black muchDarker}; + set: #number for: #PythonTextStyler to: {Color black muchDarker}; + set: #- for: #PythonTextStyler to: {Color black muchDarker}; + set: #symbol for: #PythonTextStyler to: {Color blue muchDarker}; + set: #stringSymbol for: #PythonTextStyler to: {Color blue muchDarker}; + set: #literalArray for: #PythonTextStyler to: {Color blue muchDarker}; + set: #string for: #PythonTextStyler to: {Color magenta muchDarker. TextEmphasis normal}; + set: #unfinishedString for: #PythonTextStyler to: {Color black. TextEmphasis normal}; + set: #assignment for: #PythonTextStyler to: {nil. TextEmphasis bold}; + set: #ansiAssignment for: #PythonTextStyler to: {nil. TextEmphasis bold}; + set: #literal for: #PythonTextStyler to: {nil. TextEmphasis italic}; + set: #keyword for: #PythonTextStyler to: {Color blue muchDarker}; + set: #binary for: #PythonTextStyler to: {Color blue muchDarker}; + set: #unary for: #PythonTextStyler to: {Color blue muchDarker}; + set: #incompleteKeyword for: #PythonTextStyler to: {Color gray muchDarker. TextEmphasis underlined}; + set: #incompleteBinary for: #PythonTextStyler to: {Color gray muchDarker. TextEmphasis underlined}; + set: #incompleteUnary for: #PythonTextStyler to: {Color gray muchDarker. TextEmphasis underlined}; + set: #undefinedKeyword for: #PythonTextStyler to: {Color black}; + set: #undefinedBinary for: #PythonTextStyler to: {Color black}; + set: #undefinedUnary for: #PythonTextStyler to: {Color black}; + set: #patternKeyword for: #PythonTextStyler to: {nil. TextEmphasis bold}; + set: #patternBinary for: #PythonTextStyler to: {nil. TextEmphasis bold}; + set: #patternUnary for: #PythonTextStyler to: {nil. TextEmphasis bold}; + set: #self for: #PythonTextStyler to: {Color black muchDarker}; + set: #super for: #PythonTextStyler to: {Color black muchDarker}; + set: #true for: #PythonTextStyler to: {Color black muchDarker}; + set: #false for: #PythonTextStyler to: {Color black muchDarker}; + set: #nil for: #PythonTextStyler to: {Color black muchDarker}; + set: #thisContext for: #PythonTextStyler to: {Color black muchDarker}; + set: #return for: #PythonTextStyler to: {Color black muchDarker}; + set: #patternArg for: #PythonTextStyler to: {Color blue muchDarker}; + set: #methodArg for: #PythonTextStyler to: {Color blue muchDarker}; + set: #blockPatternArg for: #PythonTextStyler to: {Color blue muchDarker}; + set: #blockArg for: #PythonTextStyler to: {Color blue muchDarker}; + set: #argument for: #PythonTextStyler to: {Color blue muchDarker}; + set: #blockArgColon for: #PythonTextStyler to: {Color black}; + set: #leftParenthesis for: #PythonTextStyler to: {Color black}; + set: #rightParenthesis for: #PythonTextStyler to: {Color black}; + set: #leftParenthesis1 for: #PythonTextStyler to: {Color green muchDarker}; + set: #rightParenthesis1 for: #PythonTextStyler to: {Color green muchDarker}; + set: #leftParenthesis2 for: #PythonTextStyler to: {Color magenta muchDarker}; + set: #rightParenthesis2 for: #PythonTextStyler to: {Color magenta muchDarker}; + set: #leftParenthesis3 for: #PythonTextStyler to: {Color black muchDarker}; + set: #rightParenthesis3 for: #PythonTextStyler to: {Color black muchDarker}; + set: #leftParenthesis4 for: #PythonTextStyler to: {Color green darker}; + set: #rightParenthesis4 for: #PythonTextStyler to: {Color green darker}; + set: #leftParenthesis5 for: #PythonTextStyler to: {Color orange darker}; + set: #rightParenthesis5 for: #PythonTextStyler to: {Color orange darker}; + set: #leftParenthesis6 for: #PythonTextStyler to: {Color magenta darker}; + set: #rightParenthesis6 for: #PythonTextStyler to: {Color magenta darker}; + set: #leftParenthesis7 for: #PythonTextStyler to: {Color blue}; + set: #rightParenthesis7 for: #PythonTextStyler to: {Color blue}; + set: #blockStart for: #PythonTextStyler to: {Color black}; + set: #blockEnd for: #PythonTextStyler to: {Color black}; + set: #blockStart1 for: #PythonTextStyler to: {Color green muchDarker}; + set: #blockEnd1 for: #PythonTextStyler to: {Color green muchDarker}; + set: #blockStart2 for: #PythonTextStyler to: {Color magenta muchDarker}; + set: #blockEnd2 for: #PythonTextStyler to: {Color magenta muchDarker}; + set: #blockStart3 for: #PythonTextStyler to: {Color black muchDarker}; + set: #blockEnd3 for: #PythonTextStyler to: {Color black muchDarker}; + set: #blockStart4 for: #PythonTextStyler to: {Color green darker}; + set: #blockEnd4 for: #PythonTextStyler to: {Color green darker}; + set: #blockStart5 for: #PythonTextStyler to: {Color orange darker}; + set: #blockEnd5 for: #PythonTextStyler to: {Color orange darker}; + set: #blockStart6 for: #PythonTextStyler to: {Color magenta darker}; + set: #blockEnd6 for: #PythonTextStyler to: {Color magenta darker}; + set: #blockStart7 for: #PythonTextStyler to: {Color blue}; + set: #blockEnd7 for: #PythonTextStyler to: {Color blue}; + set: #arrayStart for: #PythonTextStyler to: {Color black}; + set: #arrayEnd for: #PythonTextStyler to: {Color black}; + set: #arrayStart1 for: #PythonTextStyler to: {Color black}; + set: #arrayEnd1 for: #PythonTextStyler to: {Color black}; + set: #byteArrayStart for: #PythonTextStyler to: {Color black}; + set: #byteArrayEnd for: #PythonTextStyler to: {Color black}; + set: #byteArrayStart1 for: #PythonTextStyler to: {Color black}; + set: #byteArrayEnd1 for: #PythonTextStyler to: {Color black}; + set: #leftBrace for: #PythonTextStyler to: {Color black}; + set: #rightBrace for: #PythonTextStyler to: {Color black}; + set: #cascadeSeparator for: #PythonTextStyler to: {Color black}; + set: #statementSeparator for: #PythonTextStyler to: {Color black}; + set: #externalCallType for: #PythonTextStyler to: {Color black}; + set: #externalCallTypePointerIndicator for: #PythonTextStyler to: {Color black}; + set: #primitiveOrExternalCallStart for: #PythonTextStyler to: {Color black}; + set: #primitiveOrExternalCallEnd for: #PythonTextStyler to: {Color black}; + set: #methodTempBar for: #PythonTextStyler to: {Color gray}; + set: #blockTempBar for: #PythonTextStyler to: {Color gray}; + set: #blockArgsBar for: #PythonTextStyler to: {Color gray}; + set: #primitive for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; + set: #pragmaKeyword for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; + set: #pragmaUnary for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; + set: #pragmaBinary for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; + set: #externalFunctionCallingConvention for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; + set: #module for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; + set: #blockTempVar for: #PythonTextStyler to: {Color gray}; + set: #blockPatternTempVar for: #PythonTextStyler to: {Color gray}; + set: #instVar for: #PythonTextStyler to: {Color black}; + set: #workspaceVar for: #PythonTextStyler to: {Color black}; + set: #undefinedIdentifier for: #PythonTextStyler to: {Color black}; + set: #incompleteIdentifier for: #PythonTextStyler to: {Color gray darker. {TextEmphasis italic. TextEmphasis underlined}}; + set: #tempVar for: #PythonTextStyler to: {Color gray darker}; + set: #patternTempVar for: #PythonTextStyler to: {Color gray darker}; + set: #poolConstant for: #PythonTextStyler to: {Color gray muchDarker}; + set: #classVar for: #PythonTextStyler to: {Color gray muchDarker}; + set: #globalVar for: #PythonTextStyler to: {Color black}. + + "And the text differ" + theme + set: #insertTextAttributes for: #TextDiffBuilder to: { TextColor black }; + set: #removeTextAttributes for: #TextDiffBuilder to: { TextEmphasis struckOut. TextColor blue }; + set: #normalTextAttributes for: #TextDiffBuilder to: { TextEmphasis normal }. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/methodProperties.json b/repository/PyPy.package/PythonTheme.class/methodProperties.json new file mode 100644 index 00000000..18dfd321 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "addSyntaxHighlighting:" : "fn 12/19/2016 13:37" } } diff --git a/repository/PyPy.package/PythonTheme.class/properties.json b/repository/PyPy.package/PythonTheme.class/properties.json new file mode 100644 index 00000000..9922bec0 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonTheme", + "pools" : [ + ], + "super" : "SqueakTheme", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonToolSet.class/README.md b/repository/PyPy.package/PythonToolSet.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st b/repository/PyPy.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st new file mode 100644 index 00000000..28b99062 --- /dev/null +++ b/repository/PyPy.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st @@ -0,0 +1,4 @@ +as yet unclassified +debug: aProcess context: aContext label: aString contents: contents fullView: aBool + "Open a debugger on the given process and context." + ^PythonDebugger openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/class/initialize.st b/repository/PyPy.package/PythonToolSet.class/class/initialize.st new file mode 100644 index 00000000..8e7d4079 --- /dev/null +++ b/repository/PyPy.package/PythonToolSet.class/class/initialize.st @@ -0,0 +1,3 @@ +as yet unclassified +initialize + ToolSet register: self. \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/class/inspectorClassOf..st b/repository/PyPy.package/PythonToolSet.class/class/inspectorClassOf..st new file mode 100644 index 00000000..7db45e24 --- /dev/null +++ b/repository/PyPy.package/PythonToolSet.class/class/inspectorClassOf..st @@ -0,0 +1,3 @@ +as yet unclassified +inspectorClassOf: anObject + ^ PythonInspector \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/class/interrupt.label..st b/repository/PyPy.package/PythonToolSet.class/class/interrupt.label..st new file mode 100644 index 00000000..87ff8543 --- /dev/null +++ b/repository/PyPy.package/PythonToolSet.class/class/interrupt.label..st @@ -0,0 +1,8 @@ +as yet unclassified +interrupt: aProcess label: aString + "Open a PythonDebugger if none exists" + ActiveWorld submorphs detect: [ :ea | ea isSystemWindow and: [ ea model class == PythonDebugger ]] + ifFound: [ super interrupt: aProcess label: aString ] + ifNone: [ PythonDebugger + openInterrupt: aString + onProcess: aProcess ] \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/methodProperties.json b/repository/PyPy.package/PythonToolSet.class/methodProperties.json new file mode 100644 index 00000000..3fe98b39 --- /dev/null +++ b/repository/PyPy.package/PythonToolSet.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + "debug:context:label:contents:fullView:" : "fn 1/19/2017 11:56", + "initialize" : "fn 1/16/2017 18:52", + "inspectorClassOf:" : "fn 12/22/2016 21:11", + "interrupt:label:" : "fn 1/18/2017 15:08" }, + "instance" : { + } } diff --git a/repository/PyPy.package/PythonToolSet.class/properties.json b/repository/PyPy.package/PythonToolSet.class/properties.json new file mode 100644 index 00000000..ba3a5ee1 --- /dev/null +++ b/repository/PyPy.package/PythonToolSet.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonToolSet", + "pools" : [ + ], + "super" : "StandardToolSet", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonWorkspace.class/README.md b/repository/PyPy.package/PythonWorkspace.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonWorkspace.class/class/foo.st b/repository/PyPy.package/PythonWorkspace.class/class/foo.st new file mode 100644 index 00000000..ad14d1a1 --- /dev/null +++ b/repository/PyPy.package/PythonWorkspace.class/class/foo.st @@ -0,0 +1,3 @@ +as yet unclassified +foo + Python primResume \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/class/open.st b/repository/PyPy.package/PythonWorkspace.class/class/open.st new file mode 100644 index 00000000..19ea69f8 --- /dev/null +++ b/repository/PyPy.package/PythonWorkspace.class/class/open.st @@ -0,0 +1,3 @@ +as yet unclassified +open + ^ (Smalltalk at: #PythonWorkspace ifAbsent:[self]) new openLabel: 'Python Workspace' diff --git a/repository/PyPy.package/PythonWorkspace.class/instance/doItReceiver.st b/repository/PyPy.package/PythonWorkspace.class/instance/doItReceiver.st new file mode 100644 index 00000000..72a43f7f --- /dev/null +++ b/repository/PyPy.package/PythonWorkspace.class/instance/doItReceiver.st @@ -0,0 +1,3 @@ +as yet unclassified +doItReceiver + ^ Python new \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/instance/foo.st b/repository/PyPy.package/PythonWorkspace.class/instance/foo.st new file mode 100644 index 00000000..ad14d1a1 --- /dev/null +++ b/repository/PyPy.package/PythonWorkspace.class/instance/foo.st @@ -0,0 +1,3 @@ +as yet unclassified +foo + Python primResume \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json new file mode 100644 index 00000000..72b145f2 --- /dev/null +++ b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json @@ -0,0 +1,7 @@ +{ + "class" : { + "foo" : "fn 1/13/2017 18:57", + "open" : "fn 12/22/2016 02:51" }, + "instance" : { + "doItReceiver" : "fn 12/22/2016 02:52", + "foo" : "fn 1/13/2017 18:58" } } diff --git a/repository/PyPy.package/PythonWorkspace.class/properties.json b/repository/PyPy.package/PythonWorkspace.class/properties.json new file mode 100644 index 00000000..7659caf8 --- /dev/null +++ b/repository/PyPy.package/PythonWorkspace.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonWorkspace", + "pools" : [ + ], + "super" : "Workspace", + "type" : "normal" } diff --git a/repository/PyPy.package/monticello.meta/categories.st b/repository/PyPy.package/monticello.meta/categories.st new file mode 100644 index 00000000..c80ac6ac --- /dev/null +++ b/repository/PyPy.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #PyPy! diff --git a/repository/PyPy.package/monticello.meta/initializers.st b/repository/PyPy.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/monticello.meta/package b/repository/PyPy.package/monticello.meta/package new file mode 100644 index 00000000..f4b92461 --- /dev/null +++ b/repository/PyPy.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'PyPy') \ No newline at end of file diff --git a/repository/PyPy.package/monticello.meta/version b/repository/PyPy.package/monticello.meta/version new file mode 100644 index 00000000..e5a353c2 --- /dev/null +++ b/repository/PyPy.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/PyPy.package/properties.json b/repository/PyPy.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/PyPy.package/properties.json @@ -0,0 +1,2 @@ +{ + } From 05b94a8c050d637dedf23dc62565994755a4b92a Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 19 Jan 2017 18:07:24 +0100 Subject: [PATCH 021/193] Add builds for PythonPlugin and temporarily disable all others --- .travis.yml | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4a27bae5..5a45d83b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,31 +21,35 @@ env: - LIBRARY_PATH=$LIBRARY_PATH:$HOME/SDL2/lib - C_INCLUDE_PATH=$C_INCLUDE_PATH:$HOME/SDL2/include matrix: - - BUILD_ARCH=32bit TEST_TYPE=default - - BUILD_ARCH=32bit - - BUILD_ARCH=32bit TEST_TYPE=coverage - # - BUILD_ARCH=lldebug - - BUILD_ARCH=64bit TEST_TYPE=default - - BUILD_ARCH=64bit - - BUILD_ARCH=armv6 - - BUILD_ARCH=armv7-a - - BUILD_ARCH=armv8-a - - BUILD_ARCH=64bit PLUGINS=DatabasePlugin - - BUILD_ARCH=64bit PLUGINS=RubyPlugin + # - BUILD_ARCH=32bit TEST_TYPE=default + # - BUILD_ARCH=32bit + # - BUILD_ARCH=32bit TEST_TYPE=coverage + # # - BUILD_ARCH=lldebug + # - BUILD_ARCH=64bit TEST_TYPE=default + # - BUILD_ARCH=64bit + # - BUILD_ARCH=armv6 + # - BUILD_ARCH=armv7-a + # - BUILD_ARCH=armv8-a + # - BUILD_ARCH=64bit PLUGINS=DatabasePlugin + # - BUILD_ARCH=64bit PLUGINS=RubyPlugin + - BUILD_ARCH=64bit PLUGINS=PythonPlugin matrix: include: + # - os: osx + # osx_image: xcode7.3 + # env: BUILD_ARCH=64bit TEST_TYPE=default + # - os: osx + # osx_image: xcode7.3 + # env: BUILD_ARCH=64bit + # - os: osx + # osx_image: xcode7.3 + # env: BUILD_ARCH=64bit PLUGINS=RubyPlugin - os: osx osx_image: xcode7.3 - env: BUILD_ARCH=64bit TEST_TYPE=default - - os: osx - osx_image: xcode7.3 - env: BUILD_ARCH=64bit - - os: osx - osx_image: xcode7.3 - env: BUILD_ARCH=64bit PLUGINS=RubyPlugin - allow_failures: - - env: BUILD_ARCH=64bit PLUGINS=DatabasePlugin - - env: BUILD_ARCH=64bit PLUGINS=RubyPlugin + env: BUILD_ARCH=64bit PLUGINS=PythonPlugin + # allow_failures: + # - env: BUILD_ARCH=64bit PLUGINS=DatabasePlugin + # - env: BUILD_ARCH=64bit PLUGINS=RubyPlugin fast_finish: true install: .travis/install_requirements.sh script: .travis/build.sh From 86737ae235038fe4668180820e93914a9fbcc133 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 19 Jan 2017 20:30:28 +0100 Subject: [PATCH 022/193] Improve changes to target introduced by PythonPlugin --- targetrsqueak.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/targetrsqueak.py b/targetrsqueak.py index dba2882e..3fc308c4 100755 --- a/targetrsqueak.py +++ b/targetrsqueak.py @@ -9,11 +9,9 @@ from rpython.jit.codewriter.policy import JitPolicy from rpython.rlib import objectmodel -from pypy.tool.ann_override import PyPyAnnotatorPolicy sys.setrecursionlimit(15000) - def target(driver, args): driver.exe_name = "rsqueak" config = driver.config @@ -33,17 +31,22 @@ def target(driver, args): system.expose_options(driver.config) # We must not import this before the config was exposed from rsqueakvm.main import safe_entry_point - return safe_entry_point, None, PyPyAnnotatorPolicy() + ann_policy = None + if "PythonPlugin" in system.optional_plugins: + from pypy.tool.ann_override import PyPyAnnotatorPolicy + ann_policy = PyPyAnnotatorPolicy() + return safe_entry_point, None, ann_policy def jitpolicy(self): - from pypy.module.pypyjit.policy import PyPyJitPolicy - from pypy.module.pypyjit.hooks import pypy_hooks - return PyPyJitPolicy(pypy_hooks) - # if "JitHooks" in system.optional_plugins: - # from rsqueakvm.plugins.vmdebugging.hooks import jitiface - # return JitPolicy(jitiface) - # else: - # return JitPolicy() + if "PythonPlugin" in system.optional_plugins: + from pypy.module.pypyjit.policy import PyPyJitPolicy + from pypy.module.pypyjit.hooks import pypy_hooks + return PyPyJitPolicy(pypy_hooks) + elif "JitHooks" in system.optional_plugins: + from rsqueakvm.plugins.vmdebugging.hooks import jitiface + return JitPolicy(jitiface) + else: + return JitPolicy() def parser(config): return to_optparse(config, useoptions=["rsqueak.*"]) From 5b96c19a748aa02ee6a853ad63f72cfdacd19129 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 19 Jan 2017 20:31:18 +0100 Subject: [PATCH 023/193] Patch SDL.h to fix PythonPlugin compilation --- .travis/install_requirements.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index caee7e3d..d4efc602 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -19,6 +19,14 @@ setup_osx() { ;; esac + if [[ "${PLUGINS}" = "PythonPlugin" ]]; then + # Comment out SDL_messagebox.h in SDL.h + # A wrong macro is applied to "const SDL_MessageBoxButtonData *buttons;" + # which breaks compilation at the end. + echo "Patching SDL.h for PythonPlugin" + sed -i.bak "/SDL_messagebox\.h/s/^/\/\/ /" "/usr/local/include/SDL2/SDL.h" + fi + # todo: Squeak for jittests # Don't install coveralls on OS X, because it's too slow (see #116) From d91402c829e4f320520ef5a93f1779edcaeea984 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 19 Jan 2017 22:22:28 +0100 Subject: [PATCH 024/193] Disable PythonPlugin build on Linux --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a45d83b..12fe1c63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ env: - PATH=$PATH:$HOME/SDL2/bin - LIBRARY_PATH=$LIBRARY_PATH:$HOME/SDL2/lib - C_INCLUDE_PATH=$C_INCLUDE_PATH:$HOME/SDL2/include - matrix: + # matrix: # - BUILD_ARCH=32bit TEST_TYPE=default # - BUILD_ARCH=32bit # - BUILD_ARCH=32bit TEST_TYPE=coverage @@ -32,7 +32,7 @@ env: # - BUILD_ARCH=armv8-a # - BUILD_ARCH=64bit PLUGINS=DatabasePlugin # - BUILD_ARCH=64bit PLUGINS=RubyPlugin - - BUILD_ARCH=64bit PLUGINS=PythonPlugin + # - BUILD_ARCH=64bit PLUGINS=PythonPlugin matrix: include: # - os: osx From 0ac489cb7abe935fb99a27a124dd5adee330dc04 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 20 Jan 2017 00:26:22 +0100 Subject: [PATCH 025/193] Use tweaked travis_wait Builds are not producing enough output --- .travis/build-osx.sh | 45 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/.travis/build-osx.sh b/.travis/build-osx.sh index a2b0f7c8..351982b2 100755 --- a/.travis/build-osx.sh +++ b/.travis/build-osx.sh @@ -13,6 +13,49 @@ if [[ -n "$PLUGINS" ]]; then plugins_suffix="-${PLUGINS}" fi +travis_wait() { + local timeout=20 + + local cmd="$@" + + $cmd & + local cmd_pid=$! + + travis_jigger $! $timeout $cmd & + local jigger_pid=$! + local result + + { + wait $cmd_pid 2>/dev/null + result=$? + ps -p$jigger_pid &>/dev/null && kill $jigger_pid + } + + echo -e "\nThe command $cmd exited with $result." + return $result +} + +travis_jigger() { + # helper method for travis_wait() + local cmd_pid=$1 + shift + local timeout=$1 # in minutes + shift + local count=0 + + # clear the line + echo -e "\n" + + while [ $count -lt $timeout ]; do + count=$(($count + 1)) + echo -ne "." + sleep 60 + done + + echo -e "\nTimeout (${timeout} minutes) reached. Terminating \"$@\"\n" + kill -9 $cmd_pid +} + case "$BUILD_ARCH" in 32bit) python .build/build.py $plugins @@ -22,7 +65,7 @@ case "$BUILD_ARCH" in # $EX rm -rf .build/pypy/rpython/_cache ;; 64bit) - pypy .build/build.py -- $plugins + travis_wait pypy .build/build.py -- $plugins exitcode=$? cp rsqueak rsqueak-x86_64-${UNAME}$plugins_suffix-jit-$TRAVIS_COMMIT || true # python .build/jittests.py From 125a0609f5217dc5bbd33cd0ecf2e038ae7818de Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 20 Jan 2017 10:43:17 +0100 Subject: [PATCH 026/193] Move travis_wait to build.sh and increase timeout --- .travis/build-osx.sh | 45 +------------------------------------------- .travis/build.sh | 45 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.travis/build-osx.sh b/.travis/build-osx.sh index 351982b2..a2b0f7c8 100755 --- a/.travis/build-osx.sh +++ b/.travis/build-osx.sh @@ -13,49 +13,6 @@ if [[ -n "$PLUGINS" ]]; then plugins_suffix="-${PLUGINS}" fi -travis_wait() { - local timeout=20 - - local cmd="$@" - - $cmd & - local cmd_pid=$! - - travis_jigger $! $timeout $cmd & - local jigger_pid=$! - local result - - { - wait $cmd_pid 2>/dev/null - result=$? - ps -p$jigger_pid &>/dev/null && kill $jigger_pid - } - - echo -e "\nThe command $cmd exited with $result." - return $result -} - -travis_jigger() { - # helper method for travis_wait() - local cmd_pid=$1 - shift - local timeout=$1 # in minutes - shift - local count=0 - - # clear the line - echo -e "\n" - - while [ $count -lt $timeout ]; do - count=$(($count + 1)) - echo -ne "." - sleep 60 - done - - echo -e "\nTimeout (${timeout} minutes) reached. Terminating \"$@\"\n" - kill -9 $cmd_pid -} - case "$BUILD_ARCH" in 32bit) python .build/build.py $plugins @@ -65,7 +22,7 @@ case "$BUILD_ARCH" in # $EX rm -rf .build/pypy/rpython/_cache ;; 64bit) - travis_wait pypy .build/build.py -- $plugins + pypy .build/build.py -- $plugins exitcode=$? cp rsqueak rsqueak-x86_64-${UNAME}$plugins_suffix-jit-$TRAVIS_COMMIT || true # python .build/jittests.py diff --git a/.travis/build.sh b/.travis/build.sh index 4f54e5c4..4825b4b6 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -8,6 +8,49 @@ if [[ "${TRAVIS_BRANCH}" != "master" ]] && [[ "${BUILD_ARCH}" = arm* ]]; then exit 0 fi +travis_wait() { + local timeout=100 + + local cmd="$@" + + $cmd & + local cmd_pid=$! + + travis_jigger $! $timeout $cmd & + local jigger_pid=$! + local result + + { + wait $cmd_pid 2>/dev/null + result=$? + ps -p$jigger_pid &>/dev/null && kill $jigger_pid + } + + echo -e "\nThe command $cmd exited with $result." + return $result +} + +travis_jigger() { + # helper method for travis_wait() + local cmd_pid=$1 + shift + local timeout=$1 # in minutes + shift + local count=0 + + # clear the line + echo -e "\n" + + while [ $count -lt $timeout ]; do + count=$(($count + 1)) + echo -ne "." + sleep 60 + done + + echo -e "\nTimeout (${timeout} minutes) reached. Terminating \"$@\"\n" + kill -9 $cmd_pid +} + case "$TRAVIS_OS_NAME" in linux) export SDL_VIDEODRIVER=dummy; @@ -29,7 +72,7 @@ if [[ -n "${TEST_TYPE}" ]]; then SCRIPT_NAME="test.sh" fi -"${BASE}/${SCRIPT_NAME}" +travis_wait "${BASE}/${SCRIPT_NAME}" if [[ "${PLUGINS}" = *"database_plugin"* ]]; then "${BASE}/test_database_integration.sh" From b621b37eb36e50f62f929a4035fda81fb32b2d0c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 23 Jan 2017 17:22:53 +0100 Subject: [PATCH 027/193] Use Python> class>resumeFrame from image --- rsqueakvm/plugins/python/global_state.py | 54 ++++-------------------- 1 file changed, 9 insertions(+), 45 deletions(-) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 465eee8e..eb5a42f1 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -1,7 +1,6 @@ from rsqueakvm.model.compiled_methods import ( W_CompiledMethod, W_SpurCompiledMethod, W_PreSpurCompiledMethod) from rsqueakvm.model.pointers import W_PointersObject -# from rsqueakvm.plugins.python import execution from rsqueakvm.plugins.python.py_objspace import new_pypy_objspace from rsqueakvm.util.cells import QuasiConstant, Cell @@ -32,54 +31,19 @@ def startup(space): space.wrap_string("PythonPlugin"), space.wrap_string("send") ])) + python_class = space.smalltalk_at("Python") w_python_class.set( - space.smalltalk_at("Python") or space.w_nil.getclass(space) + python_class or space.w_nil.getclass(space) ) w_python_object_class.set( space.smalltalk_at("PythonObject") or space.w_nil.getclass(space) ) - w_python_resume_method.set(_make_resume_method(space)) + resume_method_symbol = space.wrap_symbol('resumeFrame') + python_cls_cls_s = python_class.getclass(space).as_class_get_shadow(space) + resume_method = python_cls_cls_s.lookup(resume_method_symbol) + if resume_method is None: + # disable plugin? + print 'Python class>>resumeFrame method not found' + w_python_resume_method.set(resume_method) translating[0] = objectmodel.we_are_translated() - - -def _make_resume_method(space): - if space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 5 - w_cm._primitive = 0 - w_cm.literalsize = 5 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.compiledin_class = w_python_class.get().getclass(space) - w_cm.lookup_selector = "fakeResumeFrame" - w_cm.bytes = [chr(b) for b in [ - 0x41, # pushLit: Processor - 0xD0, # send: yield - 0x87, # pop - 0x70, # pushSelf - 0xD2, # send: primResume - 0x87, # pop - 0x78, # returnSelf - 119, # method flags and such - 6, - 3, - 255, - ]] - from rsqueakvm.wrapper import AssociationWrapper - w_cm.literals = [ - space.wrap_symbol("yield"), - space.w_schedulerassociationpointer, - space.wrap_symbol("primResume"), - space.wrap_symbol(w_cm.lookup_selector), - AssociationWrapper.make_w_assoc( - space, - space.w_nil, # wrap_symbol("Python class"), - w_cm.compiledin_class - ) - ] - # import pdb; pdb.set_trace() - return w_cm From 405fb8e3e8d2e8bbcd057925cfdbfdc2e6d0c896 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 23 Jan 2017 20:39:46 +0100 Subject: [PATCH 028/193] Bump timeout to 110 minutes --- .travis/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis/build.sh b/.travis/build.sh index 4825b4b6..51c2e904 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -9,7 +9,7 @@ if [[ "${TRAVIS_BRANCH}" != "master" ]] && [[ "${BUILD_ARCH}" = arm* ]]; then fi travis_wait() { - local timeout=100 + local timeout=110 local cmd="$@" @@ -76,4 +76,4 @@ travis_wait "${BASE}/${SCRIPT_NAME}" if [[ "${PLUGINS}" = *"database_plugin"* ]]; then "${BASE}/test_database_integration.sh" -fi \ No newline at end of file +fi From a909f7124de249c78ae9114aacf67838b713c656 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 28 Jan 2017 00:15:21 +0100 Subject: [PATCH 029/193] Attempt to improve exception handling --- rsqueakvm/plugins/python/execution.py | 13 +++++----- rsqueakvm/plugins/python/global_state.py | 2 +- rsqueakvm/plugins/python/patching.py | 32 ++++++++++++++++-------- rsqueakvm/plugins/python_plugin.py | 2 +- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index b49a9ddb..afa53954 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -51,19 +51,18 @@ def run(self): result = py_code.exec_code(gs.py_space, gs.py_globals, gs.py_locals) self.save_result(result) - except OperationError as operationerr: - errorstr = operationerr.errorstr(gs.py_space) - print errorstr - self.handle_error(errorstr) + except OperationError as e: + print e.errorstr(gs.py_space) + self.handle_error(e.get_w_value(gs.py_space)) except Exception as e: - errorstr = str(e) - print 'Unknown error in Python thread: %s' % errorstr - self.handle_error(errorstr) + print 'Unknown error in Python thread: %s' % e def save_result(self, result): + gs.wp_error.set(None) # unset last error gs.wp_result.set(result) def handle_error(self, error): + gs.wp_result.set(None) # unset last result gs.wp_error.set(error) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index eb5a42f1..0c4956e8 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -14,7 +14,7 @@ py_locals = py_space.newdict() wp_result = Cell(None, type=WP_Root) -wp_error = Cell(None, type=str) +wp_error = Cell(None, type=WP_Root) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index d2ed4802..5ad7815a 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,30 +1,35 @@ from rsqueakvm.util.cells import Cell -from rsqueakvm.plugins.python.global_state import py_runner +from rsqueakvm.plugins.python.global_state import py_runner, wp_error, py_space from rsqueakvm.plugins.python.constants import PYTHON_BYTECODES_THRESHOLD - -from rpython.rlib import objectmodel - from pypy.interpreter.executioncontext import ( ExecutionContext, TICK_COUNTER_STEP) +from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver + +from rpython.rlib import objectmodel python_interrupt_counter = Cell(PYTHON_BYTECODES_THRESHOLD) +def _return_to_smalltalk(): + runner = py_runner.get() + if runner: + print 'Python yield' + runner.return_to_smalltalk() + print 'Python continue' + + def check_for_interrupts(): new_pic = python_interrupt_counter.get() - 1 python_interrupt_counter.set(new_pic) if new_pic <= 0: python_interrupt_counter.set(PYTHON_BYTECODES_THRESHOLD) - runner = py_runner.get() - if runner: - print 'Python yield' - runner.return_to_smalltalk() - print 'Python continue' + _return_to_smalltalk() old_bytecode_trace = ExecutionContext.bytecode_trace old_bytecode_only_trace = ExecutionContext.bytecode_only_trace +old_handle_operation_error = PyFrame.handle_operation_error @objectmodel.always_inline @@ -39,9 +44,14 @@ def new_bytecode_only_trace(self, frame): old_bytecode_only_trace(self, frame) +def new_handle_operation_error(self, ec, operr, attach_tb=True): + wp_error.set(operr.get_w_value(py_space)) + _return_to_smalltalk() + return old_handle_operation_error(self, ec, operr, attach_tb) + + def patch_pypy(): # Patch-out virtualizables from Pypy so that translation works - from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver try: # TODO: what if first delattr fails? delattr(PyFrame, "_virtualizable_") @@ -51,3 +61,5 @@ def patch_pypy(): ExecutionContext.bytecode_trace = new_bytecode_trace ExecutionContext.bytecode_only_trace = new_bytecode_only_trace + + PyFrame.handle_operation_error = new_handle_operation_error diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 35e9627c..8a4c267e 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -94,7 +94,7 @@ def lastError(interp, s_frame, w_rcvr): wp_error = global_state.wp_error.get() if wp_error is None: raise PrimitiveFailedError - return interp.space.wrap_string(wp_error) + return model.W_PythonObject(wp_error) @PythonPlugin.expose_primitive(unwrap_spec=[object]) From 8ce6bb0c26e8e902032f77e788a013a8a25c6842 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 28 Jan 2017 18:04:05 +0100 Subject: [PATCH 030/193] Add ability to restart a frame Also, patch dispatch_bytecode directly --- rsqueakvm/plugins/python/execution.py | 8 +- rsqueakvm/plugins/python/global_state.py | 1 + .../python/patched_dispatch_bytecode.py | 317 ++++++++++++++++++ rsqueakvm/plugins/python/patching.py | 47 +-- rsqueakvm/plugins/python_plugin.py | 13 +- 5 files changed, 361 insertions(+), 25 deletions(-) create mode 100644 rsqueakvm/plugins/python/patched_dispatch_bytecode.py diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index afa53954..1018c0d6 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -38,6 +38,7 @@ class PythonLanguage(ForeignLanguage): def __init__(self, source, cmd): self.source = source self.cmd = cmd + self._resumable = True def run(self): print 'Python start' @@ -57,6 +58,8 @@ def run(self): except Exception as e: print 'Unknown error in Python thread: %s' % e + self._resumable = False + def save_result(self, result): gs.wp_error.set(None) # unset last error gs.wp_result.set(result) @@ -76,7 +79,6 @@ def clear(self): class AbstractLanguageRunner: def __init__(self, language): self.language = language - self._resumable = True def start(self): raise NotImplementedError @@ -85,7 +87,7 @@ def resume(self): raise NotImplementedError def resumable(self): - return self._resumable + return self.language._resumable def return_to_smalltalk(self): raise NotImplementedError @@ -114,7 +116,6 @@ def new_stacklet_callback(h, arg): self.h2 = h global_execution_state.clear() self.language.run() - self._resumable = False global_execution_state.origin = self return self.h2 @@ -136,7 +137,6 @@ def return_to_smalltalk(self): def new_greenlet_callback(): print 'new_greenlet_callback' self = global_execution_state.origin - self._resumable = False return self.language.run diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 0c4956e8..55e7d0f0 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -15,6 +15,7 @@ wp_result = Cell(None, type=WP_Root) wp_error = Cell(None, type=WP_Root) +restart_frame = Cell(False, type=bool) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python/patched_dispatch_bytecode.py b/rsqueakvm/plugins/python/patched_dispatch_bytecode.py new file mode 100644 index 00000000..523ac422 --- /dev/null +++ b/rsqueakvm/plugins/python/patched_dispatch_bytecode.py @@ -0,0 +1,317 @@ +from rpython.rlib import jit +from rpython.rlib.rarithmetic import r_uint, intmask + +from pypy.interpreter.pycode import BytecodeCorruption +from pypy.interpreter.pyopcode import SReturnValue, Return, SuspendedUnroller +from pypy.tool.stdlib_opcode import bytecode_spec + +opcodedesc = bytecode_spec.opcodedesc +HAVE_ARGUMENT = bytecode_spec.HAVE_ARGUMENT + + +@jit.unroll_safe +def dispatch_bytecode(self, co_code, next_instr, ec): + while True: + # PythonPlugin patch start + val = self.smalltalk_check() + if val >= 0: + return val + # PythonPlugin patch end + + self.last_instr = intmask(next_instr) + if jit.we_are_jitted(): + ec.bytecode_only_trace(self) + else: + ec.bytecode_trace(self) + next_instr = r_uint(self.last_instr) + opcode = ord(co_code[next_instr]) + next_instr += 1 + + if opcode >= HAVE_ARGUMENT: + lo = ord(co_code[next_instr]) + hi = ord(co_code[next_instr+1]) + next_instr += 2 + oparg = (hi * 256) | lo + else: + oparg = 0 + + # note: the structure of the code here is such that it makes + # (after translation) a big "if/elif" chain, which is then + # turned into a switch(). + + while opcode == opcodedesc.EXTENDED_ARG.index: + opcode = ord(co_code[next_instr]) + if opcode < HAVE_ARGUMENT: + raise BytecodeCorruption + lo = ord(co_code[next_instr+1]) + hi = ord(co_code[next_instr+2]) + next_instr += 3 + oparg = (oparg * 65536) | (hi * 256) | lo + + if opcode == opcodedesc.RETURN_VALUE.index: + w_returnvalue = self.popvalue() + block = self.unrollstack(SReturnValue.kind) + if block is None: + self.pushvalue(w_returnvalue) # XXX ping pong + raise Return + else: + unroller = SReturnValue(w_returnvalue) + next_instr = block.handle(self, unroller) + return next_instr # now inside a 'finally' block + elif opcode == opcodedesc.END_FINALLY.index: + unroller = self.end_finally() + if isinstance(unroller, SuspendedUnroller): + # go on unrolling the stack + block = self.unrollstack(unroller.kind) + if block is None: + w_result = unroller.nomoreblocks() + self.pushvalue(w_result) + raise Return + else: + next_instr = block.handle(self, unroller) + return next_instr + elif opcode == opcodedesc.JUMP_ABSOLUTE.index: + return self.jump_absolute(oparg, ec) + elif opcode == opcodedesc.BREAK_LOOP.index: + next_instr = self.BREAK_LOOP(oparg, next_instr) + elif opcode == opcodedesc.CONTINUE_LOOP.index: + return self.CONTINUE_LOOP(oparg, next_instr) + elif opcode == opcodedesc.FOR_ITER.index: + next_instr = self.FOR_ITER(oparg, next_instr) + elif opcode == opcodedesc.JUMP_FORWARD.index: + next_instr = self.JUMP_FORWARD(oparg, next_instr) + elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index: + next_instr = self.JUMP_IF_FALSE_OR_POP(oparg, next_instr) + elif opcode == opcodedesc.JUMP_IF_NOT_DEBUG.index: + next_instr = self.JUMP_IF_NOT_DEBUG(oparg, next_instr) + elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index: + next_instr = self.JUMP_IF_TRUE_OR_POP(oparg, next_instr) + elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index: + next_instr = self.POP_JUMP_IF_FALSE(oparg, next_instr) + elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index: + next_instr = self.POP_JUMP_IF_TRUE(oparg, next_instr) + elif opcode == opcodedesc.BINARY_ADD.index: + self.BINARY_ADD(oparg, next_instr) + elif opcode == opcodedesc.BINARY_AND.index: + self.BINARY_AND(oparg, next_instr) + elif opcode == opcodedesc.BINARY_DIVIDE.index: + self.BINARY_DIVIDE(oparg, next_instr) + elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index: + self.BINARY_FLOOR_DIVIDE(oparg, next_instr) + elif opcode == opcodedesc.BINARY_LSHIFT.index: + self.BINARY_LSHIFT(oparg, next_instr) + elif opcode == opcodedesc.BINARY_MODULO.index: + self.BINARY_MODULO(oparg, next_instr) + elif opcode == opcodedesc.BINARY_MULTIPLY.index: + self.BINARY_MULTIPLY(oparg, next_instr) + elif opcode == opcodedesc.BINARY_OR.index: + self.BINARY_OR(oparg, next_instr) + elif opcode == opcodedesc.BINARY_POWER.index: + self.BINARY_POWER(oparg, next_instr) + elif opcode == opcodedesc.BINARY_RSHIFT.index: + self.BINARY_RSHIFT(oparg, next_instr) + elif opcode == opcodedesc.BINARY_SUBSCR.index: + self.BINARY_SUBSCR(oparg, next_instr) + elif opcode == opcodedesc.BINARY_SUBTRACT.index: + self.BINARY_SUBTRACT(oparg, next_instr) + elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index: + self.BINARY_TRUE_DIVIDE(oparg, next_instr) + elif opcode == opcodedesc.BINARY_XOR.index: + self.BINARY_XOR(oparg, next_instr) + elif opcode == opcodedesc.BUILD_CLASS.index: + self.BUILD_CLASS(oparg, next_instr) + elif opcode == opcodedesc.BUILD_LIST.index: + self.BUILD_LIST(oparg, next_instr) + elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index: + self.BUILD_LIST_FROM_ARG(oparg, next_instr) + elif opcode == opcodedesc.BUILD_MAP.index: + self.BUILD_MAP(oparg, next_instr) + elif opcode == opcodedesc.BUILD_SET.index: + self.BUILD_SET(oparg, next_instr) + elif opcode == opcodedesc.BUILD_SLICE.index: + self.BUILD_SLICE(oparg, next_instr) + elif opcode == opcodedesc.BUILD_TUPLE.index: + self.BUILD_TUPLE(oparg, next_instr) + elif opcode == opcodedesc.CALL_FUNCTION.index: + self.CALL_FUNCTION(oparg, next_instr) + elif opcode == opcodedesc.CALL_FUNCTION_KW.index: + self.CALL_FUNCTION_KW(oparg, next_instr) + elif opcode == opcodedesc.CALL_FUNCTION_VAR.index: + self.CALL_FUNCTION_VAR(oparg, next_instr) + elif opcode == opcodedesc.CALL_FUNCTION_VAR_KW.index: + self.CALL_FUNCTION_VAR_KW(oparg, next_instr) + elif opcode == opcodedesc.CALL_METHOD.index: + self.CALL_METHOD(oparg, next_instr) + elif opcode == opcodedesc.COMPARE_OP.index: + self.COMPARE_OP(oparg, next_instr) + elif opcode == opcodedesc.DELETE_ATTR.index: + self.DELETE_ATTR(oparg, next_instr) + elif opcode == opcodedesc.DELETE_FAST.index: + self.DELETE_FAST(oparg, next_instr) + elif opcode == opcodedesc.DELETE_GLOBAL.index: + self.DELETE_GLOBAL(oparg, next_instr) + elif opcode == opcodedesc.DELETE_NAME.index: + self.DELETE_NAME(oparg, next_instr) + elif opcode == opcodedesc.DELETE_SLICE_0.index: + self.DELETE_SLICE_0(oparg, next_instr) + elif opcode == opcodedesc.DELETE_SLICE_1.index: + self.DELETE_SLICE_1(oparg, next_instr) + elif opcode == opcodedesc.DELETE_SLICE_2.index: + self.DELETE_SLICE_2(oparg, next_instr) + elif opcode == opcodedesc.DELETE_SLICE_3.index: + self.DELETE_SLICE_3(oparg, next_instr) + elif opcode == opcodedesc.DELETE_SUBSCR.index: + self.DELETE_SUBSCR(oparg, next_instr) + elif opcode == opcodedesc.DUP_TOP.index: + self.DUP_TOP(oparg, next_instr) + elif opcode == opcodedesc.DUP_TOPX.index: + self.DUP_TOPX(oparg, next_instr) + elif opcode == opcodedesc.EXEC_STMT.index: + self.EXEC_STMT(oparg, next_instr) + elif opcode == opcodedesc.GET_ITER.index: + self.GET_ITER(oparg, next_instr) + elif opcode == opcodedesc.IMPORT_FROM.index: + self.IMPORT_FROM(oparg, next_instr) + elif opcode == opcodedesc.IMPORT_NAME.index: + self.IMPORT_NAME(oparg, next_instr) + elif opcode == opcodedesc.IMPORT_STAR.index: + self.IMPORT_STAR(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_ADD.index: + self.INPLACE_ADD(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_AND.index: + self.INPLACE_AND(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_DIVIDE.index: + self.INPLACE_DIVIDE(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_FLOOR_DIVIDE.index: + self.INPLACE_FLOOR_DIVIDE(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_LSHIFT.index: + self.INPLACE_LSHIFT(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_MODULO.index: + self.INPLACE_MODULO(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_MULTIPLY.index: + self.INPLACE_MULTIPLY(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_OR.index: + self.INPLACE_OR(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_POWER.index: + self.INPLACE_POWER(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_RSHIFT.index: + self.INPLACE_RSHIFT(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_SUBTRACT.index: + self.INPLACE_SUBTRACT(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_TRUE_DIVIDE.index: + self.INPLACE_TRUE_DIVIDE(oparg, next_instr) + elif opcode == opcodedesc.INPLACE_XOR.index: + self.INPLACE_XOR(oparg, next_instr) + elif opcode == opcodedesc.LIST_APPEND.index: + self.LIST_APPEND(oparg, next_instr) + elif opcode == opcodedesc.LOAD_ATTR.index: + self.LOAD_ATTR(oparg, next_instr) + elif opcode == opcodedesc.LOAD_CLOSURE.index: + self.LOAD_CLOSURE(oparg, next_instr) + elif opcode == opcodedesc.LOAD_CONST.index: + self.LOAD_CONST(oparg, next_instr) + elif opcode == opcodedesc.LOAD_DEREF.index: + self.LOAD_DEREF(oparg, next_instr) + elif opcode == opcodedesc.LOAD_FAST.index: + self.LOAD_FAST(oparg, next_instr) + elif opcode == opcodedesc.LOAD_GLOBAL.index: + self.LOAD_GLOBAL(oparg, next_instr) + elif opcode == opcodedesc.LOAD_LOCALS.index: + self.LOAD_LOCALS(oparg, next_instr) + elif opcode == opcodedesc.LOAD_NAME.index: + self.LOAD_NAME(oparg, next_instr) + elif opcode == opcodedesc.LOOKUP_METHOD.index: + self.LOOKUP_METHOD(oparg, next_instr) + elif opcode == opcodedesc.MAKE_CLOSURE.index: + self.MAKE_CLOSURE(oparg, next_instr) + elif opcode == opcodedesc.MAKE_FUNCTION.index: + self.MAKE_FUNCTION(oparg, next_instr) + elif opcode == opcodedesc.MAP_ADD.index: + self.MAP_ADD(oparg, next_instr) + elif opcode == opcodedesc.NOP.index: + self.NOP(oparg, next_instr) + elif opcode == opcodedesc.POP_BLOCK.index: + self.POP_BLOCK(oparg, next_instr) + elif opcode == opcodedesc.POP_TOP.index: + self.POP_TOP(oparg, next_instr) + elif opcode == opcodedesc.PRINT_EXPR.index: + self.PRINT_EXPR(oparg, next_instr) + elif opcode == opcodedesc.PRINT_ITEM.index: + self.PRINT_ITEM(oparg, next_instr) + elif opcode == opcodedesc.PRINT_ITEM_TO.index: + self.PRINT_ITEM_TO(oparg, next_instr) + elif opcode == opcodedesc.PRINT_NEWLINE.index: + self.PRINT_NEWLINE(oparg, next_instr) + elif opcode == opcodedesc.PRINT_NEWLINE_TO.index: + self.PRINT_NEWLINE_TO(oparg, next_instr) + elif opcode == opcodedesc.RAISE_VARARGS.index: + self.RAISE_VARARGS(oparg, next_instr) + elif opcode == opcodedesc.ROT_FOUR.index: + self.ROT_FOUR(oparg, next_instr) + elif opcode == opcodedesc.ROT_THREE.index: + self.ROT_THREE(oparg, next_instr) + elif opcode == opcodedesc.ROT_TWO.index: + self.ROT_TWO(oparg, next_instr) + elif opcode == opcodedesc.SETUP_EXCEPT.index: + self.SETUP_EXCEPT(oparg, next_instr) + elif opcode == opcodedesc.SETUP_FINALLY.index: + self.SETUP_FINALLY(oparg, next_instr) + elif opcode == opcodedesc.SETUP_LOOP.index: + self.SETUP_LOOP(oparg, next_instr) + elif opcode == opcodedesc.SETUP_WITH.index: + self.SETUP_WITH(oparg, next_instr) + elif opcode == opcodedesc.SET_ADD.index: + self.SET_ADD(oparg, next_instr) + elif opcode == opcodedesc.SLICE_0.index: + self.SLICE_0(oparg, next_instr) + elif opcode == opcodedesc.SLICE_1.index: + self.SLICE_1(oparg, next_instr) + elif opcode == opcodedesc.SLICE_2.index: + self.SLICE_2(oparg, next_instr) + elif opcode == opcodedesc.SLICE_3.index: + self.SLICE_3(oparg, next_instr) + elif opcode == opcodedesc.STOP_CODE.index: + self.STOP_CODE(oparg, next_instr) + elif opcode == opcodedesc.STORE_ATTR.index: + self.STORE_ATTR(oparg, next_instr) + elif opcode == opcodedesc.STORE_DEREF.index: + self.STORE_DEREF(oparg, next_instr) + elif opcode == opcodedesc.STORE_FAST.index: + self.STORE_FAST(oparg, next_instr) + elif opcode == opcodedesc.STORE_GLOBAL.index: + self.STORE_GLOBAL(oparg, next_instr) + elif opcode == opcodedesc.STORE_MAP.index: + self.STORE_MAP(oparg, next_instr) + elif opcode == opcodedesc.STORE_NAME.index: + self.STORE_NAME(oparg, next_instr) + elif opcode == opcodedesc.STORE_SLICE_0.index: + self.STORE_SLICE_0(oparg, next_instr) + elif opcode == opcodedesc.STORE_SLICE_1.index: + self.STORE_SLICE_1(oparg, next_instr) + elif opcode == opcodedesc.STORE_SLICE_2.index: + self.STORE_SLICE_2(oparg, next_instr) + elif opcode == opcodedesc.STORE_SLICE_3.index: + self.STORE_SLICE_3(oparg, next_instr) + elif opcode == opcodedesc.STORE_SUBSCR.index: + self.STORE_SUBSCR(oparg, next_instr) + elif opcode == opcodedesc.UNARY_CONVERT.index: + self.UNARY_CONVERT(oparg, next_instr) + elif opcode == opcodedesc.UNARY_INVERT.index: + self.UNARY_INVERT(oparg, next_instr) + elif opcode == opcodedesc.UNARY_NEGATIVE.index: + self.UNARY_NEGATIVE(oparg, next_instr) + elif opcode == opcodedesc.UNARY_NOT.index: + self.UNARY_NOT(oparg, next_instr) + elif opcode == opcodedesc.UNARY_POSITIVE.index: + self.UNARY_POSITIVE(oparg, next_instr) + elif opcode == opcodedesc.UNPACK_SEQUENCE.index: + self.UNPACK_SEQUENCE(oparg, next_instr) + elif opcode == opcodedesc.WITH_CLEANUP.index: + self.WITH_CLEANUP(oparg, next_instr) + elif opcode == opcodedesc.YIELD_VALUE.index: + self.YIELD_VALUE(oparg, next_instr) + else: + self.MISSING_OPCODE(oparg, next_instr) + + if jit.we_are_jitted(): + return next_instr diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 5ad7815a..acfd386a 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,19 +1,18 @@ from rsqueakvm.util.cells import Cell -from rsqueakvm.plugins.python.global_state import py_runner, wp_error, py_space +from rsqueakvm.plugins.python import global_state as gs from rsqueakvm.plugins.python.constants import PYTHON_BYTECODES_THRESHOLD -from pypy.interpreter.executioncontext import ( - ExecutionContext, TICK_COUNTER_STEP) from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver -from rpython.rlib import objectmodel +from rsqueakvm.plugins.python.patched_dispatch_bytecode import ( + dispatch_bytecode) python_interrupt_counter = Cell(PYTHON_BYTECODES_THRESHOLD) def _return_to_smalltalk(): - runner = py_runner.get() + runner = gs.py_runner.get() if runner: print 'Python yield' runner.return_to_smalltalk() @@ -27,29 +26,38 @@ def check_for_interrupts(): python_interrupt_counter.set(PYTHON_BYTECODES_THRESHOLD) _return_to_smalltalk() -old_bytecode_trace = ExecutionContext.bytecode_trace -old_bytecode_only_trace = ExecutionContext.bytecode_only_trace -old_handle_operation_error = PyFrame.handle_operation_error - -@objectmodel.always_inline -def new_bytecode_trace(self, frame, decr_by=TICK_COUNTER_STEP): +def smalltalk_check(self): check_for_interrupts() - old_bytecode_trace(self, frame, decr_by) + if gs.restart_frame.get(): + gs.restart_frame.set(False) + self.reset() + return 0 # Restart by setting next_instr to 0 + return -1 # Let bytecode loop continue as normal -@objectmodel.always_inline -def new_bytecode_only_trace(self, frame): - check_for_interrupts() - old_bytecode_only_trace(self, frame) +old_handle_operation_error = PyFrame.handle_operation_error def new_handle_operation_error(self, ec, operr, attach_tb=True): - wp_error.set(operr.get_w_value(py_space)) + gs.wp_error.set(operr.get_w_value(gs.py_space)) + print "Python error caught" _return_to_smalltalk() + # import pdb; pdb.set_trace() + + if gs.restart_frame.get(): + gs.restart_frame.set(False) + self.reset() + return 0 # Restart by setting next_instr to 0 + return old_handle_operation_error(self, ec, operr, attach_tb) +def reset_frame(self): + ncellvars = len(self.pycode.co_cellvars) + self.dropvaluesuntil(ncellvars) # Drop all new values + + def patch_pypy(): # Patch-out virtualizables from Pypy so that translation works try: @@ -59,7 +67,8 @@ def patch_pypy(): except AttributeError: pass - ExecutionContext.bytecode_trace = new_bytecode_trace - ExecutionContext.bytecode_only_trace = new_bytecode_only_trace + PyFrame.smalltalk_check = smalltalk_check + PyFrame.dispatch_bytecode = dispatch_bytecode PyFrame.handle_operation_error = new_handle_operation_error + PyFrame.reset = reset_frame diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 8a4c267e..988ef303 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -77,11 +77,13 @@ def evalInThread(interp, s_frame, w_rcvr, source, cmd): @PythonPlugin.expose_primitive(unwrap_spec=[object], result_is_new_frame=True) def resumePython(interp, s_frame, w_rcvr): from rsqueakvm.plugins.python import execution - # import pdb; pdb.set_trace() print 'Smalltalk yield' + # import pdb; pdb.set_trace() + first_call = global_state.restart_frame.get() if not execution.resume_thread(): raise PrimitiveFailedError - return execution.switch_to_smalltalk(interp, s_frame) + return execution.switch_to_smalltalk(interp, s_frame, + first_call=first_call) @PythonPlugin.expose_primitive(unwrap_spec=[object]) @@ -113,6 +115,13 @@ def getTopFrame(interp, s_frame, w_rcvr): return model.W_PythonObject(topframe) +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def setRestartFrame(interp, s_frame, w_rcvr): + # import pdb; pdb.set_trace() + global_state.restart_frame.set(True) + return interp.space.w_true + + @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) def getGlobal(interp, s_frame, w_rcvr, key): # import pdb; pdb.set_trace() From 81896da4d11bb7dc097bcd4f05b23b1891d46bc5 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 28 Jan 2017 20:40:15 +0100 Subject: [PATCH 031/193] Remove assertion Might be invaldidated now that it is possible to restart a Python frame --- rsqueakvm/plugins/python/execution.py | 74 +++++++++++++-------------- rsqueakvm/plugins/python_plugin.py | 4 +- 2 files changed, 37 insertions(+), 41 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 1018c0d6..df9e3042 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -142,46 +142,11 @@ def new_greenlet_callback(): def switch_to_smalltalk(interp, s_frame, first_call=False): from rsqueakvm.storage_contexts import ContextPartShadow - from rsqueakvm.plugins.python.utils import wrap print 'Switch to Smalltalk' wp_result = gs.wp_result.get() if wp_result is not None: - print 'Python has finished and returned a result' - # we want evalInThread and resumePython to retun new frames, - # so we don't build up stack, but we also don't raise to the - # top-level loop all the time. - # For resuming, we obviously need a new frame, because that's - # how the Smalltalk scheduler knows how to continue back to Python. - # Unfortunately, a primitive can only EITHER always return a new - # frame OR a result. So when we get a result, we cannot simply - # return it. Instead, we need to build a frame that simply returns - # the result - if interp.space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 0 - w_cm._primitive = 0 - w_cm.literalsize = 3 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.bytes = [chr(b) for b in [ - 0x20, # push constant - 0x7C, # return stack top - ]] - w_cm.literals = [ - wrap(interp.space, wp_result), - interp.space.w_nil, - interp.space.w_nil - ] - gs.wp_result.set(None) - return ContextPartShadow.build_method_context( - interp.space, - w_cm, - gs.w_python_class.get() - ) + return _handle_result(interp.space, wp_result) resume_method = gs.w_python_resume_method.get() s_resume_frame = ContextPartShadow.build_method_context( @@ -191,8 +156,8 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): ) # import pdb; pdb.set_trace() # we go one up, because the s_frame.w_method() is our fake method - if first_call: - assert s_frame.w_method() is not resume_method + if first_call or s_frame.w_method() is not resume_method: + # assert s_frame.w_method() is not resume_method s_resume_frame.store_s_sender(s_frame) else: assert s_frame.w_method() is resume_method @@ -201,3 +166,36 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): dec=PYTHON_BYTECODES_THRESHOLD) # this will raise a ProcessSwitch if there are interrupts or timers ... return s_resume_frame + + +def _handle_result(space, wp_result): + from rsqueakvm.storage_contexts import ContextPartShadow + from rsqueakvm.plugins.python.utils import wrap + print 'Python has finished and returned a result' + # we want evalInThread and resumePython to retun new frames, + # so we don't build up stack, but we also don't raise to the + # top-level loop all the time. + # For resuming, we obviously need a new frame, because that's + # how the Smalltalk scheduler knows how to continue back to Python. + # Unfortunately, a primitive can only EITHER always return a new + # frame OR a result. So when we get a result, we cannot simply + # return it. Instead, we need to build a frame that simply returns + # the result + if space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 0 + w_cm._primitive = 0 + w_cm.literalsize = 3 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.bytes = [chr(b) for b in [ + 0x20, # push constant + 0x7C, # return stack top + ]] + w_cm.literals = [wrap(space, wp_result), space.w_nil, space.w_nil] + gs.wp_result.set(None) + return ContextPartShadow.build_method_context( + space, w_cm, gs.w_python_class.get()) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 988ef303..95f9b46f 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -79,11 +79,9 @@ def resumePython(interp, s_frame, w_rcvr): from rsqueakvm.plugins.python import execution print 'Smalltalk yield' # import pdb; pdb.set_trace() - first_call = global_state.restart_frame.get() if not execution.resume_thread(): raise PrimitiveFailedError - return execution.switch_to_smalltalk(interp, s_frame, - first_call=first_call) + return execution.switch_to_smalltalk(interp, s_frame) @PythonPlugin.expose_primitive(unwrap_spec=[object]) From 806cac3cfcbffd3311fd7993664de6b41c72e2be Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 28 Jan 2017 21:07:27 +0100 Subject: [PATCH 032/193] Add support to restart frame with new code --- rsqueakvm/plugins/python/global_state.py | 2 ++ rsqueakvm/plugins/python/patching.py | 34 +++++++++++++++++------- rsqueakvm/plugins/python_plugin.py | 13 +++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 55e7d0f0..3ff0c733 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -15,7 +15,9 @@ wp_result = Cell(None, type=WP_Root) wp_error = Cell(None, type=WP_Root) + restart_frame = Cell(False, type=bool) +restart_frame_code = Cell(None, type=WP_Root) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index acfd386a..3201e6a8 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -27,13 +27,19 @@ def check_for_interrupts(): _return_to_smalltalk() +def handle_restart_frame(py_frame): + gs.restart_frame.set(False) + py_code = gs.restart_frame_code.get() + if py_code: + gs.restart_frame_code.set(None) + py_frame.reset(py_code) + return 0 # Restart by setting next_instr to 0 + + def smalltalk_check(self): check_for_interrupts() - if gs.restart_frame.get(): - gs.restart_frame.set(False) - self.reset() - return 0 # Restart by setting next_instr to 0 + return handle_restart_frame(self) return -1 # Let bytecode loop continue as normal old_handle_operation_error = PyFrame.handle_operation_error @@ -46,16 +52,23 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): # import pdb; pdb.set_trace() if gs.restart_frame.get(): - gs.restart_frame.set(False) - self.reset() - return 0 # Restart by setting next_instr to 0 + return handle_restart_frame(self) return old_handle_operation_error(self, ec, operr, attach_tb) +old_init_frame = PyFrame.__init__ + + +def __init__frame(self, space, code, w_globals, outer_func): + self.w_globals = w_globals + self.outer_func = outer_func + old_init_frame(self, space, code, w_globals, outer_func) + -def reset_frame(self): - ncellvars = len(self.pycode.co_cellvars) - self.dropvaluesuntil(ncellvars) # Drop all new values +def reset_frame(self, new_py_code=None): + if new_py_code is None: + new_py_code = self.pycode + self.__init__(self.space, new_py_code, self.w_globals, self.outer_func) def patch_pypy(): @@ -70,5 +83,6 @@ def patch_pypy(): PyFrame.smalltalk_check = smalltalk_check PyFrame.dispatch_bytecode = dispatch_bytecode + PyFrame.__init__ = __init__frame PyFrame.handle_operation_error = new_handle_operation_error PyFrame.reset = reset_frame diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 95f9b46f..0de7a91f 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -120,6 +120,19 @@ def setRestartFrame(interp, s_frame, w_rcvr): return interp.space.w_true +@PythonPlugin.expose_primitive(unwrap_spec=[object, str]) +def restartFrameWith(interp, s_frame, w_rcvr, source): + wp_source = py_space.wrap(source) + try: + py_code = py_compiling.compile(py_space, wp_source, '', 'exec') + except: + print 'Failed to compile new frame' + raise PrimitiveFailedError + global_state.restart_frame.set(True) + global_state.restart_frame_code.set(py_code) + return interp.space.w_true + + @PythonPlugin.expose_primitive(unwrap_spec=[object, str]) def getGlobal(interp, s_frame, w_rcvr, key): # import pdb; pdb.set_trace() From 24dc0e12a9a148fc939da3a6b71ea8836a1386e7 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 29 Jan 2017 01:27:55 +0100 Subject: [PATCH 033/193] Improve ability to restart frame with new code --- rsqueakvm/plugins/python/global_state.py | 3 +- rsqueakvm/plugins/python/patching.py | 47 +++++++++++++++++------- rsqueakvm/plugins/python_plugin.py | 13 ++++++- 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 3ff0c733..c232c42c 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -1,5 +1,4 @@ -from rsqueakvm.model.compiled_methods import ( - W_CompiledMethod, W_SpurCompiledMethod, W_PreSpurCompiledMethod) +from rsqueakvm.model.compiled_methods import W_CompiledMethod from rsqueakvm.model.pointers import W_PointersObject from rsqueakvm.plugins.python.py_objspace import new_pypy_objspace from rsqueakvm.util.cells import QuasiConstant, Cell diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 3201e6a8..082ad7b4 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -11,6 +11,11 @@ python_interrupt_counter = Cell(PYTHON_BYTECODES_THRESHOLD) +class RestartException(Exception): + def __init__(self, code): + self.pycode = code + + def _return_to_smalltalk(): runner = gs.py_runner.get() if runner: @@ -30,10 +35,10 @@ def check_for_interrupts(): def handle_restart_frame(py_frame): gs.restart_frame.set(False) py_code = gs.restart_frame_code.get() + # import pdb; pdb.set_trace() if py_code: gs.restart_frame_code.set(None) - py_frame.reset(py_code) - return 0 # Restart by setting next_instr to 0 + raise RestartException(py_code) def smalltalk_check(self): @@ -42,19 +47,16 @@ def smalltalk_check(self): return handle_restart_frame(self) return -1 # Let bytecode loop continue as normal -old_handle_operation_error = PyFrame.handle_operation_error +old_execute_frame = PyFrame.execute_frame -def new_handle_operation_error(self, ec, operr, attach_tb=True): - gs.wp_error.set(operr.get_w_value(gs.py_space)) - print "Python error caught" - _return_to_smalltalk() - # import pdb; pdb.set_trace() - - if gs.restart_frame.get(): - return handle_restart_frame(self) - - return old_handle_operation_error(self, ec, operr, attach_tb) +def new_execute_frame(self, w_inputvalue=None, operr=None): + while True: + try: + return old_execute_frame(self, w_inputvalue, operr) + except RestartException as e: + # import pdb; pdb.set_trace() + self.reset(e.pycode) old_init_frame = PyFrame.__init__ @@ -66,9 +68,25 @@ def __init__frame(self, space, code, w_globals, outer_func): def reset_frame(self, new_py_code=None): + # w_inputvalue missing, see execute_frame if new_py_code is None: new_py_code = self.pycode self.__init__(self.space, new_py_code, self.w_globals, self.outer_func) + self.last_instr = -1 + +old_handle_operation_error = PyFrame.handle_operation_error + + +def new_handle_operation_error(self, ec, operr, attach_tb=True): + gs.wp_error.set(operr.get_w_value(gs.py_space)) + print "Python error caught" + _return_to_smalltalk() + # import pdb; pdb.set_trace() + + if gs.restart_frame.get(): + return handle_restart_frame(self) + + return old_handle_operation_error(self, ec, operr, attach_tb) def patch_pypy(): @@ -84,5 +102,6 @@ def patch_pypy(): PyFrame.dispatch_bytecode = dispatch_bytecode PyFrame.__init__ = __init__frame - PyFrame.handle_operation_error = new_handle_operation_error + PyFrame.execute_frame = new_execute_frame PyFrame.reset = reset_frame + PyFrame.handle_operation_error = new_handle_operation_error diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 0de7a91f..9ac64d4c 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -84,6 +84,17 @@ def resumePython(interp, s_frame, w_rcvr): return execution.switch_to_smalltalk(interp, s_frame) +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def simpleResume(interp, s_frame, w_rcvr): + # For shell development/debugging + from rsqueakvm.plugins.python import execution + print 'Smalltalk simple yield' + # import pdb; pdb.set_trace() + if not execution.resume_thread(): + return interp.space.w_false + return interp.space.w_true + + @PythonPlugin.expose_primitive(unwrap_spec=[object]) def lastResult(interp, s_frame, w_rcvr): return wrap(interp.space, global_state.wp_result.get()) @@ -114,7 +125,7 @@ def getTopFrame(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object]) -def setRestartFrame(interp, s_frame, w_rcvr): +def restartFrame(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() global_state.restart_frame.set(True) return interp.space.w_true From bdbaa09c2f9f81ce627eaf4790c960d775e8c34e Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 29 Jan 2017 10:48:15 +0100 Subject: [PATCH 034/193] RestartException now inherits from OperationError --- rsqueakvm/plugins/python/patching.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 082ad7b4..4745b093 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -2,6 +2,7 @@ from rsqueakvm.plugins.python import global_state as gs from rsqueakvm.plugins.python.constants import PYTHON_BYTECODES_THRESHOLD +from pypy.interpreter.error import OperationError from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver from rsqueakvm.plugins.python.patched_dispatch_bytecode import ( @@ -11,7 +12,7 @@ python_interrupt_counter = Cell(PYTHON_BYTECODES_THRESHOLD) -class RestartException(Exception): +class RestartException(OperationError): def __init__(self, code): self.pycode = code From 553f8ff3f11a1bd72b5d677f23179cf12a85fee5 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 29 Jan 2017 13:22:57 +0100 Subject: [PATCH 035/193] Improve frame restarting; add restartSpecificFrame --- rsqueakvm/plugins/python/global_state.py | 10 +++++--- rsqueakvm/plugins/python/patching.py | 30 +++++++++++------------- rsqueakvm/plugins/python_plugin.py | 29 ++++++++++++++++++----- 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index c232c42c..de1dd11a 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -8,16 +8,20 @@ from rpython.rlib import objectmodel +class PyFrameRestartInfo(): + def __init__(self, frame=None, code=None): + self.frame = frame + self.pycode = code + + py_space = new_pypy_objspace() py_globals = py_space.newdict() py_locals = py_space.newdict() +py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) wp_result = Cell(None, type=WP_Root) wp_error = Cell(None, type=WP_Root) -restart_frame = Cell(False, type=bool) -restart_frame_code = Cell(None, type=WP_Root) - w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) w_python_object_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 4745b093..d5553ca6 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -13,8 +13,8 @@ class RestartException(OperationError): - def __init__(self, code): - self.pycode = code + def __init__(self, py_frame_restart_info): + self.py_frame_restart_info = py_frame_restart_info def _return_to_smalltalk(): @@ -33,19 +33,17 @@ def check_for_interrupts(): _return_to_smalltalk() -def handle_restart_frame(py_frame): - gs.restart_frame.set(False) - py_code = gs.restart_frame_code.get() - # import pdb; pdb.set_trace() - if py_code: - gs.restart_frame_code.set(None) - raise RestartException(py_code) +def check_frame_restart_info(py_frame): + py_frame_restart_info = gs.py_frame_restart_info.get() + if py_frame_restart_info: + gs.py_frame_restart_info.set(None) + # import pdb; pdb.set_trace() + raise RestartException(py_frame_restart_info) def smalltalk_check(self): check_for_interrupts() - if gs.restart_frame.get(): - return handle_restart_frame(self) + check_frame_restart_info(self) return -1 # Let bytecode loop continue as normal old_execute_frame = PyFrame.execute_frame @@ -57,7 +55,10 @@ def new_execute_frame(self, w_inputvalue=None, operr=None): return old_execute_frame(self, w_inputvalue, operr) except RestartException as e: # import pdb; pdb.set_trace() - self.reset(e.pycode) + frame = e.py_frame_restart_info.frame + if frame is not None and frame is not self: + raise RestartException(e.py_frame_restart_info) + self.reset(e.py_frame_restart_info.pycode) old_init_frame = PyFrame.__init__ @@ -83,10 +84,7 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): print "Python error caught" _return_to_smalltalk() # import pdb; pdb.set_trace() - - if gs.restart_frame.get(): - return handle_restart_frame(self) - + check_frame_restart_info(self) return old_handle_operation_error(self, ec, operr, attach_tb) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 9ac64d4c..7e4ba2bd 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -127,20 +127,37 @@ def getTopFrame(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object]) def restartFrame(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() - global_state.restart_frame.set(True) + global_state.py_frame_restart_info.set( + global_state.PyFrameRestartInfo()) return interp.space.w_true -@PythonPlugin.expose_primitive(unwrap_spec=[object, str]) -def restartFrameWith(interp, s_frame, w_rcvr, source): +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) +def restartFrameWith(interp, s_frame, w_rcvr, source, cmd): wp_source = py_space.wrap(source) try: - py_code = py_compiling.compile(py_space, wp_source, '', 'exec') + py_code = py_compiling.compile(py_space, wp_source, '', cmd) except: print 'Failed to compile new frame' raise PrimitiveFailedError - global_state.restart_frame.set(True) - global_state.restart_frame_code.set(py_code) + global_state.py_frame_restart_info.set( + global_state.PyFrameRestartInfo(code=py_code)) + return interp.space.w_true + + +@PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str]) +def restartSpecificFrame(interp, s_frame, w_rcvr, frame, source, cmd): + py_code = None + if source: + wp_source = py_space.wrap(source) + try: + py_code = py_compiling.compile(py_space, wp_source, '', + cmd) + except: + print 'Failed to compile new frame' + raise PrimitiveFailedError + global_state.py_frame_restart_info.set( + global_state.PyFrameRestartInfo(frame=frame, code=py_code)) return interp.space.w_true From e0ddaa74dd62232473590e8182977b8460d1ff2f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 29 Jan 2017 19:01:14 +0100 Subject: [PATCH 036/193] Let resume primitive fail on error --- rsqueakvm/plugins/python/execution.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index df9e3042..7db46660 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -25,9 +25,10 @@ def start_new_thread(source, cmd, translated): def resume_thread(): runner = gs.py_runner.get() if runner is None or not runner.resumable(): + print "No runner to resume with" return False runner.resume() - return True + return gs.wp_error.get() is None class ForeignLanguage: From 2a422e86e3407f0572b8d955518b7317a1b08b67 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 29 Jan 2017 19:02:36 +0100 Subject: [PATCH 037/193] Unwrap Python frame correctly --- rsqueakvm/plugins/python_plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 7e4ba2bd..f4cb3942 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -146,7 +146,7 @@ def restartFrameWith(interp, s_frame, w_rcvr, source, cmd): @PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str]) -def restartSpecificFrame(interp, s_frame, w_rcvr, frame, source, cmd): +def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, cmd): py_code = None if source: wp_source = py_space.wrap(source) @@ -156,6 +156,9 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, frame, source, cmd): except: print 'Failed to compile new frame' raise PrimitiveFailedError + frame = None + if isinstance(w_frame, model.W_PythonObject): + frame = w_frame.wp_object global_state.py_frame_restart_info.set( global_state.PyFrameRestartInfo(frame=frame, code=py_code)) return interp.space.w_true From 91de0b5c99d80f962f465f6a325f220134f6c683 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 29 Jan 2017 22:04:03 +0100 Subject: [PATCH 038/193] Persist Python code We should not rely on Python decompilers --- rsqueakvm/plugins/python/execution.py | 11 ++++++----- rsqueakvm/plugins/python/utils.py | 15 ++++++++++++++- rsqueakvm/plugins/python_plugin.py | 17 ++++++++++------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 7db46660..358ae662 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -10,13 +10,13 @@ from pypy.module.__builtin__ import compiling as py_compiling -def start_new_thread(source, cmd, translated): +def start_new_thread(source, filename, cmd, translated): # import pdb; pdb.set_trace() if translated: cls = StackletLanguageRunner else: cls = GreenletLanguageRunner - language = PythonLanguage(source, cmd) + language = PythonLanguage(source, filename, cmd) runner = cls(language) gs.py_runner.set(runner) runner.start() @@ -36,8 +36,9 @@ class ForeignLanguage: class PythonLanguage(ForeignLanguage): - def __init__(self, source, cmd): + def __init__(self, source, filename, cmd): self.source = source + self.filename = filename self.cmd = cmd self._resumable = True @@ -48,8 +49,8 @@ def run(self): gs.py_space.threadlocals.enter_thread(gs.py_space) wp_source = gs.py_space.wrap(self.source) - py_code = py_compiling.compile(gs.py_space, wp_source, '', - self.cmd) + py_code = py_compiling.compile(gs.py_space, wp_source, + self.filename, self.cmd) result = py_code.exec_code(gs.py_space, gs.py_globals, gs.py_locals) self.save_result(result) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 0e3dd5c9..01573ff2 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,3 +1,6 @@ +import time +from os.path import dirname + from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.plugins.python.model import W_PythonObject @@ -12,7 +15,7 @@ from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject -from rpython.rlib import objectmodel +from rpython.rlib import objectmodel, rpath, streamio @objectmodel.specialize.argtype(0) @@ -105,3 +108,13 @@ def call_function(space, wp_func, args_w): return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4)) return wrap(space, py_space.call_function(wp_func)) + + +def persist_pysource(space, source): + basedir = dirname(space.get_image_name()) + filename = 'source_%s.spy' % time.time() + filepath = rpath.rjoin(basedir, filename) + f = streamio.open_file_as_stream(filepath, mode="w") + f.write(source) + f.close() + return filepath diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index f4cb3942..3ffdd2e1 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -13,7 +13,7 @@ py_space, py_globals, py_locals) from rsqueakvm.plugins.python.patching import patch_pypy from rsqueakvm.plugins.python.utils import (wrap, unwrap, call_function, - call_method) + call_method, persist_pysource) from pypy.interpreter.error import OperationError from pypy.interpreter.function import (BuiltinFunction, Function, Method, @@ -48,8 +48,9 @@ def startup(space, argv): def eval(interp, s_frame, w_rcvr, source, cmd): try: # import pdb; pdb.set_trace() + filename = persist_pysource(interp.space, source) wp_source = py_space.wrap(source) - py_code = py_compiling.compile(py_space, wp_source, '', cmd) + py_code = py_compiling.compile(py_space, wp_source, filename, cmd) retval = py_code.exec_code(py_space, py_globals, py_locals) return wrap(interp.space, retval) except OperationError as operationerr: @@ -68,8 +69,9 @@ def evalInThread(interp, s_frame, w_rcvr, source, cmd): from rsqueakvm.plugins.python import execution # import pdb; pdb.set_trace() - execution.start_new_thread(source, cmd, - translated=PythonPlugin.we_are_translated()) + execution.start_new_thread( + source, persist_pysource(interp.space, source), cmd, + translated=PythonPlugin.we_are_translated()) # when we are here, the Python process has yielded return execution.switch_to_smalltalk(interp, s_frame, first_call=True) @@ -134,9 +136,10 @@ def restartFrame(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) def restartFrameWith(interp, s_frame, w_rcvr, source, cmd): + filename = persist_pysource(interp.space, source) wp_source = py_space.wrap(source) try: - py_code = py_compiling.compile(py_space, wp_source, '', cmd) + py_code = py_compiling.compile(py_space, wp_source, filename, cmd) except: print 'Failed to compile new frame' raise PrimitiveFailedError @@ -147,12 +150,12 @@ def restartFrameWith(interp, s_frame, w_rcvr, source, cmd): @PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str]) def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, cmd): + filename = persist_pysource(interp.space, source) py_code = None if source: wp_source = py_space.wrap(source) try: - py_code = py_compiling.compile(py_space, wp_source, '', - cmd) + py_code = py_compiling.compile(py_space, wp_source, filename, cmd) except: print 'Failed to compile new frame' raise PrimitiveFailedError From c4af19016ebb92a461dbbbc20562ab44ebf4d2a4 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 29 Jan 2017 23:03:35 +0100 Subject: [PATCH 039/193] Fix compilation (os.path.dirname does not compile) --- rsqueakvm/plugins/python/utils.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 01573ff2..14aebef9 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,5 +1,5 @@ import time -from os.path import dirname +import os from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger @@ -110,8 +110,18 @@ def call_function(space, wp_func, args_w): return wrap(space, py_space.call_function(wp_func)) +def rdirname(path): + splitpaths = path.split(os.sep) + splitlen = len(splitpaths) + if splitlen >= 2: + splitlen = splitlen - 1 + assert splitlen >= 0 + return os.sep.join(splitpaths[0:splitlen]) + return path + + def persist_pysource(space, source): - basedir = dirname(space.get_image_name()) + basedir = rdirname(space.get_image_name()) filename = 'source_%s.spy' % time.time() filepath = rpath.rjoin(basedir, filename) f = streamio.open_file_as_stream(filepath, mode="w") From 68e9054525b8f1b363fa57342bb0878bb9aca0b9 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 30 Jan 2017 10:51:38 +0100 Subject: [PATCH 040/193] Reset result and error on evalInThread Also let getTopFrame fail if topframe is None --- rsqueakvm/plugins/python_plugin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 3ffdd2e1..b3f93325 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -21,7 +21,6 @@ from pypy.module.__builtin__ import compiling as py_compiling from pypy.objspace.std.typeobject import W_TypeObject as WP_TypeObject - from rpython.rlib import jit, objectmodel @@ -67,7 +66,9 @@ def eval(interp, s_frame, w_rcvr, source, cmd): result_is_new_frame=True) def evalInThread(interp, s_frame, w_rcvr, source, cmd): from rsqueakvm.plugins.python import execution - + # Reset error and state + global_state.wp_result.set(None) + global_state.wp_error.set(None) # import pdb; pdb.set_trace() execution.start_new_thread( source, persist_pysource(interp.space, source), cmd, @@ -122,7 +123,8 @@ def asSmalltalk(interp, s_frame, w_rcvr): def getTopFrame(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() topframe = py_space.getexecutioncontext().gettopframe() - # assert? primfail? + if topframe is None: + raise PrimitiveFailedError return model.W_PythonObject(topframe) From aac62b9328cd617e4f16d0ad7e286330db82bb4d Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 30 Jan 2017 11:26:09 +0100 Subject: [PATCH 041/193] Always use wrap helper; minor change --- rsqueakvm/plugins/python_plugin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index b3f93325..511a235d 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -108,7 +108,7 @@ def lastError(interp, s_frame, w_rcvr): wp_error = global_state.wp_error.get() if wp_error is None: raise PrimitiveFailedError - return model.W_PythonObject(wp_error) + return wrap(interp.space, wp_error) @PythonPlugin.expose_primitive(unwrap_spec=[object]) @@ -125,7 +125,7 @@ def getTopFrame(interp, s_frame, w_rcvr): topframe = py_space.getexecutioncontext().gettopframe() if topframe is None: raise PrimitiveFailedError - return model.W_PythonObject(topframe) + return wrap(interp.space, topframe) @PythonPlugin.expose_primitive(unwrap_spec=[object]) @@ -241,7 +241,8 @@ def send(interp, s_frame, argcount, w_method): print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) raise PrimitiveFailedError if w_result is None: - print "Unable to get result in send primitive" + print "Result failure in send primitive (type: %s, methodname: %s)" % ( + py_space.type(wp_rcvr), methodname) raise PrimitiveFailedError s_frame.pop_n(argcount + 1) return w_result From 442e674715f3dc8c11d09386a888771c0fc4005e Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 30 Jan 2017 13:27:10 +0100 Subject: [PATCH 042/193] Do not catch RestartExceptions and print more debug info --- rsqueakvm/plugins/python/patching.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index d5553ca6..a0806982 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -16,6 +16,10 @@ class RestartException(OperationError): def __init__(self, py_frame_restart_info): self.py_frame_restart_info = py_frame_restart_info + def _compute_value(self, space): + print '_compute_value called in RestartException' + return None + def _return_to_smalltalk(): runner = gs.py_runner.get() @@ -80,8 +84,11 @@ def reset_frame(self, new_py_code=None): def new_handle_operation_error(self, ec, operr, attach_tb=True): - gs.wp_error.set(operr.get_w_value(gs.py_space)) - print "Python error caught" + if not isinstance(operr, RestartException): + gs.wp_error.set(operr.get_w_value(gs.py_space)) + print "Python error caught" + else: + print "RestartException skipped" _return_to_smalltalk() # import pdb; pdb.set_trace() check_frame_restart_info(self) From e47e47620d1f9f8db5ff53ee06db322fa1b8283b Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 30 Jan 2017 13:46:58 +0100 Subject: [PATCH 043/193] Re-raise RestartException This should allow to restart frames other then the top frame --- rsqueakvm/plugins/python/patching.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index a0806982..f73570ba 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -84,11 +84,11 @@ def reset_frame(self, new_py_code=None): def new_handle_operation_error(self, ec, operr, attach_tb=True): - if not isinstance(operr, RestartException): - gs.wp_error.set(operr.get_w_value(gs.py_space)) - print "Python error caught" - else: - print "RestartException skipped" + if isinstance(operr, RestartException): + print "Re-raising RestartException" + raise operr + gs.wp_error.set(operr.get_w_value(gs.py_space)) + print "Python error caught" _return_to_smalltalk() # import pdb; pdb.set_trace() check_frame_restart_info(self) From 469f6d4ea980964cb785e7f0670fcb3924e94f03 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 1 Feb 2017 10:54:47 +0100 Subject: [PATCH 044/193] Move file management into image This gives more flexibilty to work with compile() --- rsqueakvm/plugins/python/utils.py | 13 +------------ rsqueakvm/plugins/python_plugin.py | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 14aebef9..41694332 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,4 +1,3 @@ -import time import os from rsqueakvm.error import PrimitiveFailedError @@ -15,7 +14,7 @@ from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject -from rpython.rlib import objectmodel, rpath, streamio +from rpython.rlib import objectmodel @objectmodel.specialize.argtype(0) @@ -118,13 +117,3 @@ def rdirname(path): assert splitlen >= 0 return os.sep.join(splitpaths[0:splitlen]) return path - - -def persist_pysource(space, source): - basedir = rdirname(space.get_image_name()) - filename = 'source_%s.spy' % time.time() - filepath = rpath.rjoin(basedir, filename) - f = streamio.open_file_as_stream(filepath, mode="w") - f.write(source) - f.close() - return filepath diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 511a235d..123323ed 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -13,7 +13,7 @@ py_space, py_globals, py_locals) from rsqueakvm.plugins.python.patching import patch_pypy from rsqueakvm.plugins.python.utils import (wrap, unwrap, call_function, - call_method, persist_pysource) + call_method) from pypy.interpreter.error import OperationError from pypy.interpreter.function import (BuiltinFunction, Function, Method, @@ -43,11 +43,10 @@ def startup(space, argv): PluginStartupScripts.append(startup) -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) -def eval(interp, s_frame, w_rcvr, source, cmd): +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str]) +def eval(interp, s_frame, w_rcvr, source, filename, cmd): try: # import pdb; pdb.set_trace() - filename = persist_pysource(interp.space, source) wp_source = py_space.wrap(source) py_code = py_compiling.compile(py_space, wp_source, filename, cmd) retval = py_code.exec_code(py_space, py_globals, py_locals) @@ -62,17 +61,16 @@ def eval(interp, s_frame, w_rcvr, source, cmd): raise PrimitiveFailedError -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str], +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str], result_is_new_frame=True) -def evalInThread(interp, s_frame, w_rcvr, source, cmd): +def evalInThread(interp, s_frame, w_rcvr, source, filename, cmd): from rsqueakvm.plugins.python import execution # Reset error and state global_state.wp_result.set(None) global_state.wp_error.set(None) # import pdb; pdb.set_trace() execution.start_new_thread( - source, persist_pysource(interp.space, source), cmd, - translated=PythonPlugin.we_are_translated()) + source, filename, cmd, translated=PythonPlugin.we_are_translated()) # when we are here, the Python process has yielded return execution.switch_to_smalltalk(interp, s_frame, first_call=True) @@ -136,9 +134,8 @@ def restartFrame(interp, s_frame, w_rcvr): return interp.space.w_true -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str]) -def restartFrameWith(interp, s_frame, w_rcvr, source, cmd): - filename = persist_pysource(interp.space, source) +@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str]) +def restartFrameWith(interp, s_frame, w_rcvr, source, filename, cmd): wp_source = py_space.wrap(source) try: py_code = py_compiling.compile(py_space, wp_source, filename, cmd) @@ -150,9 +147,9 @@ def restartFrameWith(interp, s_frame, w_rcvr, source, cmd): return interp.space.w_true -@PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str]) -def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, cmd): - filename = persist_pysource(interp.space, source) +@PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str, str]) +def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, + cmd): py_code = None if source: wp_source = py_space.wrap(source) From 20f8e1f416afc2dffb07ea074d11dc3cce01aecb Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 1 Feb 2017 13:00:43 +0100 Subject: [PATCH 045/193] Print exceptions --- rsqueakvm/plugins/python_plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 123323ed..5c83a0bd 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -139,8 +139,8 @@ def restartFrameWith(interp, s_frame, w_rcvr, source, filename, cmd): wp_source = py_space.wrap(source) try: py_code = py_compiling.compile(py_space, wp_source, filename, cmd) - except: - print 'Failed to compile new frame' + except Exception as e: + print 'Failed to compile new frame: %s' % e raise PrimitiveFailedError global_state.py_frame_restart_info.set( global_state.PyFrameRestartInfo(code=py_code)) @@ -155,8 +155,8 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, wp_source = py_space.wrap(source) try: py_code = py_compiling.compile(py_space, wp_source, filename, cmd) - except: - print 'Failed to compile new frame' + except Exception as e: + print 'Failed to compile new frame: %s' % e raise PrimitiveFailedError frame = None if isinstance(w_frame, model.W_PythonObject): From 205ecc09dae078e76095d6f13e88cd3b1cc40efb Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 1 Feb 2017 13:05:41 +0100 Subject: [PATCH 046/193] Fix strip in raw_input --- rsqueakvm/util/shell.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/rsqueakvm/util/shell.py b/rsqueakvm/util/shell.py index cb54b1cf..343043dc 100644 --- a/rsqueakvm/util/shell.py +++ b/rsqueakvm/util/shell.py @@ -157,7 +157,7 @@ def load(self, code): source = f.readall() finally: f.close() - self.current_code = [line.strip() for line in source.split("\n")] + self.current_code = source.split("\n") @untranslated_cmd def reload(self, code): @@ -222,11 +222,13 @@ def reload(self, code): def raw_input(self, delim): if len(self.current_code) > 0: - return self.current_code.pop(0) + new_line = self.current_code.pop(0) + print new_line + return new_line self.set_readline() try: if not objectmodel.we_are_translated(): - return raw_input(delim).strip() + return raw_input(delim) os.write(1, delim) line = [] @@ -234,7 +236,7 @@ def raw_input(self, delim): while c != "\n": line.append(c) c = os.read(0, 1) - return "".join(line).strip() + return "".join(line) finally: self.reset_readline() @@ -248,11 +250,6 @@ def method(self, code): srcline = "" while srcline != "!!": srcline = self.raw_input("%s| " % parts[1]) - if srcline and not objectmodel.we_are_translated(): - # don't record method source as history - readline.remove_history_item( - readline.get_current_history_length() - 1 - ) methodsrc.append(srcline) from rsqueakvm.main import compile_code methodsrc.pop() # remove trailing !! @@ -265,7 +262,7 @@ def method(self, code): def run(self): print "You're in a Smalltalk REPL. Type `!exit' to quit, !help for help." while True: - code = self.raw_input("$ ") + code = self.raw_input("$ ").strip() if code.startswith("!"): method = code[1:].split(" ")[0] for n in UNROLLING_COMMANDS: From 06c9c00c80ac47e9465eb23dc81415dc696cb2cd Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 1 Feb 2017 19:21:23 +0100 Subject: [PATCH 047/193] Turn pyCode compiling into utility function --- rsqueakvm/plugins/python/utils.py | 21 +++++++++++++++++++++ rsqueakvm/plugins/python_plugin.py | 24 +++++++++--------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 41694332..ccc1c7c7 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -6,6 +6,9 @@ from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.model.variable import W_BytesObject +from pypy.interpreter.error import OperationError +from pypy.interpreter.pycode import PyCode +from pypy.module.__builtin__ import compiling as py_compiling from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject @@ -59,6 +62,24 @@ def unwrap(space, w_object): raise PrimitiveFailedError +def getPyCode(source, filename, cmd): + # source = 'def __dummy__():\n%s\n' % '\n'.join( + # [' %s' % line for line in source.split('\n')]) + print 'Trying to patch:\n%s' % source + try: + py_code = py_compiling.compile(py_space, py_space.wrap(source), + filename, cmd) + assert isinstance(py_code, PyCode) + if len(py_code.co_consts_w) == 1: + return py_code.co_consts_w[0] + else: + print "More than 1 const produced: %s" % len(py_code.co_consts_w) + except OperationError as e: + # import pdb; pdb.set_trace() + print 'Failed to compile new frame: %s' % e.errorstr(py_space) + return None + + def call_method(space, wp_rcvr, methodname, args_w): args_w_len = len(args_w) if args_w_len == 1: diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 5c83a0bd..31570e9d 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -13,7 +13,7 @@ py_space, py_globals, py_locals) from rsqueakvm.plugins.python.patching import patch_pypy from rsqueakvm.plugins.python.utils import (wrap, unwrap, call_function, - call_method) + call_method, getPyCode) from pypy.interpreter.error import OperationError from pypy.interpreter.function import (BuiltinFunction, Function, Method, @@ -136,12 +136,9 @@ def restartFrame(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str]) def restartFrameWith(interp, s_frame, w_rcvr, source, filename, cmd): - wp_source = py_space.wrap(source) - try: - py_code = py_compiling.compile(py_space, wp_source, filename, cmd) - except Exception as e: - print 'Failed to compile new frame: %s' % e - raise PrimitiveFailedError + py_code = getPyCode(source, filename, cmd) + if py_code is None: + return interp.space.w_false # Raising prim error causes crashes global_state.py_frame_restart_info.set( global_state.PyFrameRestartInfo(code=py_code)) return interp.space.w_true @@ -150,17 +147,14 @@ def restartFrameWith(interp, s_frame, w_rcvr, source, filename, cmd): @PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str, str]) def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, cmd): - py_code = None - if source: - wp_source = py_space.wrap(source) - try: - py_code = py_compiling.compile(py_space, wp_source, filename, cmd) - except Exception as e: - print 'Failed to compile new frame: %s' % e - raise PrimitiveFailedError frame = None if isinstance(w_frame, model.W_PythonObject): frame = w_frame.wp_object + py_code = None + if source: + py_code = getPyCode(source, filename, cmd) + if py_code is None: + return interp.space.w_false # Raising prim error causes crashes global_state.py_frame_restart_info.set( global_state.PyFrameRestartInfo(frame=frame, code=py_code)) return interp.space.w_true From f94d9ebc7aed4b0913385b9cc32a1b2589b694a1 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 1 Feb 2017 22:29:24 +0100 Subject: [PATCH 048/193] Allow code to have more than one consts --- rsqueakvm/plugins/python/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index ccc1c7c7..b88d976f 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -70,10 +70,11 @@ def getPyCode(source, filename, cmd): py_code = py_compiling.compile(py_space, py_space.wrap(source), filename, cmd) assert isinstance(py_code, PyCode) - if len(py_code.co_consts_w) == 1: + co_consts_w_len = len(py_code.co_consts_w) + if co_consts_w_len >= 1: + if co_consts_w_len > 1: + print "More than 1 const produced: %s" % co_consts_w_len return py_code.co_consts_w[0] - else: - print "More than 1 const produced: %s" % len(py_code.co_consts_w) except OperationError as e: # import pdb; pdb.set_trace() print 'Failed to compile new frame: %s' % e.errorstr(py_space) From 646f23bbd61bd9dcec95099e8b219c490b6cf360 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 2 Feb 2017 00:48:11 +0100 Subject: [PATCH 049/193] Return nil instead of raising prim error Prim errors seem to crash vm sometimes --- rsqueakvm/plugins/python_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 31570e9d..dd6cfa98 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -230,10 +230,10 @@ def send(interp, s_frame, argcount, w_method): raise PrimitiveFailedError except Exception as e: print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) - raise PrimitiveFailedError + return space.w_nil if w_result is None: print "Result failure in send primitive (type: %s, methodname: %s)" % ( py_space.type(wp_rcvr), methodname) - raise PrimitiveFailedError + return space.w_nil s_frame.pop_n(argcount + 1) return w_result From 3025196f703f0e891591238f40d572d6ac58d9b1 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 2 Feb 2017 17:18:30 +0100 Subject: [PATCH 050/193] Improve debugging [ci skip] --- .../PyPy.package/Python.class/class/eval..st | 4 ++- .../Python.class/class/evalInThread.cmd..st | 5 ++++ .../PyPy.package/Python.class/class/exec..st | 4 ++- .../Python.class/class/fakeResumeFrame.st | 5 ---- .../Python.class/class/getSource..st | 3 ++ .../class/openDebuggerWithPythonFrames..st | 8 +++++ .../Python.class/class/persistPyCode..st | 9 ++++++ .../class/primEval.filename.cmd..st | 4 +++ .../class/primEvalInThread.filename.cmd..st | 5 ++++ .../Python.class/class/primLastError.st | 4 +++ .../Python.class/class/primLastResult.st | 4 +++ .../Python.class/class/primRestartFrame.st | 5 ++++ .../primRestartFrameWith.filename.cmd..st | 5 ++++ ...startSpecificFrame.source.filename.cmd..st | 5 ++++ .../Python.class/class/primSimpleResume.st | 5 ++++ .../Python.class/class/pyInspect.st | 3 ++ .../Python.class/class/restartFrame.st | 4 +++ .../Python.class/class/restartFrame.with..st | 7 +++++ .../class/restartFrameWith.cmd..st | 4 +++ .../Python.class/class/resumeFrame.st | 6 ++++ .../Python.class/class/single..st | 2 +- .../Python.class/class/vmSpeaksPython.st | 2 +- .../Python.class/methodProperties.json | 30 ++++++++++++++----- .../instance/selection.st | 2 +- .../methodProperties.json | 2 +- .../appendPythonContexts..st | 2 +- .../class/filterPySource.lineno..st | 10 +++++++ .../getContentsOf..st} | 4 +-- .../class/getPySource..st | 7 +++++ .../class/getSignature..st | 5 ++++ .../PythonDebugger.class/class/indent.by..st | 5 ++++ .../PythonDebugger.class/class/indentSize..st | 3 ++ .../{instance => class}/newContext.st | 2 +- .../replaceInPySource.content.lineno..st | 10 +++++++ .../class/scopeEndIn.startingAt..st | 8 +++++ .../class/setPySourceContent.content..st | 13 ++++++++ .../instance/contents.notifying..st | 9 ++++++ .../instance/contextForStack..st | 4 +-- .../instance/getPySource..st | 8 ----- .../instance/getPySourceString..st | 11 ------- .../instance/pyPCRange.st | 9 +++--- .../instance/selectedMessage.st | 2 +- .../methodProperties.json | 25 ++++++++++------ .../PythonDebuggerTest.class/README.md | 0 .../instance/testScopeEndInStartingAt.st | 20 +++++++++++++ .../methodProperties.json | 5 ++++ .../PythonDebuggerTest.class/properties.json | 14 +++++++++ .../instance/printOn..st | 10 +++++-- .../instance/tempNames.st | 2 +- .../methodProperties.json | 4 +-- .../class/pythonInitialize.st | 9 +++++- .../PythonObject.class/methodProperties.json | 4 +-- .../monticello.meta/categories.st | 1 + .../PyPy.package/monticello.meta/version | 2 +- 54 files changed, 278 insertions(+), 67 deletions(-) create mode 100644 repository/PyPy.package/Python.class/class/evalInThread.cmd..st delete mode 100644 repository/PyPy.package/Python.class/class/fakeResumeFrame.st create mode 100644 repository/PyPy.package/Python.class/class/getSource..st create mode 100644 repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st create mode 100644 repository/PyPy.package/Python.class/class/persistPyCode..st create mode 100644 repository/PyPy.package/Python.class/class/primEval.filename.cmd..st create mode 100644 repository/PyPy.package/Python.class/class/primEvalInThread.filename.cmd..st create mode 100644 repository/PyPy.package/Python.class/class/primLastError.st create mode 100644 repository/PyPy.package/Python.class/class/primLastResult.st create mode 100644 repository/PyPy.package/Python.class/class/primRestartFrame.st create mode 100644 repository/PyPy.package/Python.class/class/primRestartFrameWith.filename.cmd..st create mode 100644 repository/PyPy.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st create mode 100644 repository/PyPy.package/Python.class/class/primSimpleResume.st create mode 100644 repository/PyPy.package/Python.class/class/pyInspect.st create mode 100644 repository/PyPy.package/Python.class/class/restartFrame.st create mode 100644 repository/PyPy.package/Python.class/class/restartFrame.with..st create mode 100644 repository/PyPy.package/Python.class/class/restartFrameWith.cmd..st create mode 100644 repository/PyPy.package/Python.class/class/resumeFrame.st rename repository/PyPy.package/PythonDebugger.class/{instance => class}/appendPythonContexts..st (95%) create mode 100644 repository/PyPy.package/PythonDebugger.class/class/filterPySource.lineno..st rename repository/PyPy.package/PythonDebugger.class/{instance/getPySourceContent..st => class/getContentsOf..st} (80%) create mode 100644 repository/PyPy.package/PythonDebugger.class/class/getPySource..st create mode 100644 repository/PyPy.package/PythonDebugger.class/class/getSignature..st create mode 100644 repository/PyPy.package/PythonDebugger.class/class/indent.by..st create mode 100644 repository/PyPy.package/PythonDebugger.class/class/indentSize..st rename repository/PyPy.package/PythonDebugger.class/{instance => class}/newContext.st (88%) create mode 100644 repository/PyPy.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st create mode 100644 repository/PyPy.package/PythonDebugger.class/class/scopeEndIn.startingAt..st create mode 100644 repository/PyPy.package/PythonDebugger.class/class/setPySourceContent.content..st create mode 100644 repository/PyPy.package/PythonDebugger.class/instance/contents.notifying..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/getPySource..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/getPySourceString..st create mode 100644 repository/PyPy.package/PythonDebuggerTest.class/README.md create mode 100644 repository/PyPy.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st create mode 100644 repository/PyPy.package/PythonDebuggerTest.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonDebuggerTest.class/properties.json diff --git a/repository/PyPy.package/Python.class/class/eval..st b/repository/PyPy.package/Python.class/class/eval..st index 75610062..a3efb3f9 100644 --- a/repository/PyPy.package/Python.class/class/eval..st +++ b/repository/PyPy.package/Python.class/class/eval..st @@ -1,4 +1,6 @@ helpers eval: aString - [ ^ self primEval: aString cmd: 'eval' ] on: Error + | filename | + filename := self persistPyCode: aString. + [ ^ self primEval: aString filename: filename cmd: 'eval' ] on: Error do: [ self error: 'Failed to eval: ''', aString, '''' ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/evalInThread.cmd..st b/repository/PyPy.package/Python.class/class/evalInThread.cmd..st new file mode 100644 index 00000000..397b9827 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/evalInThread.cmd..st @@ -0,0 +1,5 @@ +experimental +evalInThread: source cmd: evalOrExec + | filename | + filename := self persistPyCode: source. + ^ self primEvalInThread: source filename: filename cmd: evalOrExec \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/exec..st b/repository/PyPy.package/Python.class/class/exec..st index b6ca590b..af8d9727 100644 --- a/repository/PyPy.package/Python.class/class/exec..st +++ b/repository/PyPy.package/Python.class/class/exec..st @@ -1,4 +1,6 @@ helpers exec: aString - [ ^ self primEval: aString cmd: 'exec' ] on: Error + | filename | + filename := self persistPyCode: aString. + [ ^ self primEval: aString filename: filename cmd: 'exec' ] on: Error do: [ self error: 'Failed to exec: ''', aString, '''' ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/fakeResumeFrame.st b/repository/PyPy.package/Python.class/class/fakeResumeFrame.st deleted file mode 100644 index 5f841c3b..00000000 --- a/repository/PyPy.package/Python.class/class/fakeResumeFrame.st +++ /dev/null @@ -1,5 +0,0 @@ -system primitives -fakeResumeFrame - "Magic method that is called by vm (cached in vm)" - Processor yield. - self primResume. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/getSource..st b/repository/PyPy.package/Python.class/class/getSource..st new file mode 100644 index 00000000..37d80f0a --- /dev/null +++ b/repository/PyPy.package/Python.class/class/getSource..st @@ -0,0 +1,3 @@ +helpers +getSource: pyCode + self pyInspect getsource: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st b/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st new file mode 100644 index 00000000..82fa196e --- /dev/null +++ b/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st @@ -0,0 +1,8 @@ +system primitives +openDebuggerWithPythonFrames: pyError + PythonDebugger + openOn: Processor activeProcess + context: (PythonDebugger appendPythonContexts: thisContext) + label: pyError class asString, ': ', pyError asString + contents: nil + fullView: true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/persistPyCode..st b/repository/PyPy.package/Python.class/class/persistPyCode..st new file mode 100644 index 00000000..18192812 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/persistPyCode..st @@ -0,0 +1,9 @@ +experimental +persistPyCode: pySource + | filename stream | + filename := 'py_files', FileDirectory pathNameDelimiter ,'source_', Time millisecondClockValue, '.py'. + stream := StandardFileStream forceNewFileNamed: filename. + stream := MultiByteFileStream newFrom: stream. + stream write: pySource. + stream close. + ^ filename \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primEval.filename.cmd..st b/repository/PyPy.package/Python.class/class/primEval.filename.cmd..st new file mode 100644 index 00000000..19e70782 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primEval.filename.cmd..st @@ -0,0 +1,4 @@ +system primitives +primEval: aString filename: aFilename cmd: aEvalOrExec + + self primitiveFailed. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primEvalInThread.filename.cmd..st b/repository/PyPy.package/Python.class/class/primEvalInThread.filename.cmd..st new file mode 100644 index 00000000..1aa98e7f --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primEvalInThread.filename.cmd..st @@ -0,0 +1,5 @@ +experimental +primEvalInThread: source filename: aFilename cmd: evalOrExec + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primLastError.st b/repository/PyPy.package/Python.class/class/primLastError.st new file mode 100644 index 00000000..5f036a85 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primLastError.st @@ -0,0 +1,4 @@ +system primitives +primLastError + + ^ nil \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primLastResult.st b/repository/PyPy.package/Python.class/class/primLastResult.st new file mode 100644 index 00000000..6d8aa1dc --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primLastResult.st @@ -0,0 +1,4 @@ +system primitives +primLastResult + + ^ nil \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primRestartFrame.st b/repository/PyPy.package/Python.class/class/primRestartFrame.st new file mode 100644 index 00000000..ae2f82d6 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primRestartFrame.st @@ -0,0 +1,5 @@ +experimental +primRestartFrame + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primRestartFrameWith.filename.cmd..st b/repository/PyPy.package/Python.class/class/primRestartFrameWith.filename.cmd..st new file mode 100644 index 00000000..5dbd31b0 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primRestartFrameWith.filename.cmd..st @@ -0,0 +1,5 @@ +experimental +primRestartFrameWith: pySource filename: aFilename cmd: evalOrExec + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st b/repository/PyPy.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st new file mode 100644 index 00000000..243c13f1 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st @@ -0,0 +1,5 @@ +experimental +primRestartSpecificFrame: pyFrame source: pySource filename: aFilename cmd: evalOrExec + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primSimpleResume.st b/repository/PyPy.package/Python.class/class/primSimpleResume.st new file mode 100644 index 00000000..e575878a --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primSimpleResume.st @@ -0,0 +1,5 @@ +experimental +primSimpleResume + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/pyInspect.st b/repository/PyPy.package/Python.class/class/pyInspect.st new file mode 100644 index 00000000..24d47cf3 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/pyInspect.st @@ -0,0 +1,3 @@ +helpers +pyInspect + self eval: 'inspect' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/restartFrame.st b/repository/PyPy.package/Python.class/class/restartFrame.st new file mode 100644 index 00000000..080b3337 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/restartFrame.st @@ -0,0 +1,4 @@ +experimental +restartFrame + self primRestartSpecificFrame: nil source: '' filename: '' cmd: '' + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/restartFrame.with..st b/repository/PyPy.package/Python.class/class/restartFrame.with..st new file mode 100644 index 00000000..41443dc6 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/restartFrame.with..st @@ -0,0 +1,7 @@ +experimental +restartFrame: pyFrame with: aSource + self + primRestartSpecificFrame: pyFrame + source: aSource + filename: pyFrame f_code co_filename + cmd: 'exec' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/restartFrameWith.cmd..st b/repository/PyPy.package/Python.class/class/restartFrameWith.cmd..st new file mode 100644 index 00000000..186e3f50 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/restartFrameWith.cmd..st @@ -0,0 +1,4 @@ +experimental +restartFrameWith: pySource cmd: evalOrExec + self primRestartSpecificFrame: nil source: pySource filename: '' cmd: evalOrExec + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/resumeFrame.st b/repository/PyPy.package/Python.class/class/resumeFrame.st new file mode 100644 index 00000000..d6d962bf --- /dev/null +++ b/repository/PyPy.package/Python.class/class/resumeFrame.st @@ -0,0 +1,6 @@ +system primitives +resumeFrame + "Magic method that is called by vm (cached in vm)" + Processor yield. + self primLastError ifNotNil: [ :e | self openDebuggerWithPythonFrames: e ]. + self primResume \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/single..st b/repository/PyPy.package/Python.class/class/single..st index bbee1e8d..7cde647f 100644 --- a/repository/PyPy.package/Python.class/class/single..st +++ b/repository/PyPy.package/Python.class/class/single..st @@ -1,3 +1,3 @@ helpers single: aString - ^ self primEval: aString cmd: 'single' \ No newline at end of file + ^ self primEval: aString filename: '' cmd: 'single' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st index 39216cab..7e8e51d1 100644 --- a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st +++ b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st @@ -1,4 +1,4 @@ helpers vmSpeaksPython - [ Python primEval: '1' cmd: 'eval' ] on: Error do: [ ^ false ]. + [ Python primEval: '1' filename: '' cmd: 'eval' ] on: Error do: [ ^ false ]. ^ true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/methodProperties.json b/repository/PyPy.package/Python.class/methodProperties.json index cf723e8a..40de1f6a 100644 --- a/repository/PyPy.package/Python.class/methodProperties.json +++ b/repository/PyPy.package/Python.class/methodProperties.json @@ -1,27 +1,43 @@ { "class" : { "builtins" : "fn 12/20/2016 13:47", - "eval:" : "fn 12/19/2016 01:34", + "eval:" : "fn 2/1/2017 11:04", + "evalInThread:cmd:" : "fn 2/1/2017 17:52", "evaluatorClass" : "fn 12/22/2016 02:53", - "exec:" : "fn 12/19/2016 00:54", - "fakeResumeFrame" : "fn 1/18/2017 19:19", + "exec:" : "fn 2/1/2017 11:05", "from:import:" : "fn 1/9/2017 20:54", "from:load:" : "fn 1/9/2017 20:55", "getGlobalKeys" : "fn 12/19/2016 12:20", "getLocalKeys" : "fn 12/19/2016 12:20", + "getSource:" : "fn 1/29/2017 22:15", "import:" : "fn 1/9/2017 20:54", "isCallable:" : "fn 12/19/2016 02:18", "load:" : "fn 1/9/2017 20:54", + "openDebuggerWithPythonFrames:" : "fn 2/2/2017 16:54", + "persistPyCode:" : "fn 2/1/2017 12:46", "primAsSmalltalk:" : "fn 12/20/2016 20:05", - "primEval:cmd:" : "fn 12/17/2016 14:08", - "primEvalInThread:cmd:" : "fn 1/13/2017 13:14", + "primEval:cmd:" : "fn 2/2/2017 17:12", + "primEval:filename:cmd:" : "fn 2/1/2017 10:55", + "primEvalInThread:cmd:" : "fn 2/2/2017 17:09", + "primEvalInThread:filename:cmd:" : "fn 2/1/2017 10:56", "primGetGlobal:" : "fn 12/17/2016 22:23", "primGetLocal:" : "fn 12/17/2016 22:22", "primGetTopFrame" : "fn 1/11/2017 11:19", + "primLastError" : "fn 1/28/2017 13:37", + "primLastResult" : "fn 1/30/2017 15:34", + "primRestartFrame" : "fn 1/29/2017 01:28", + "primRestartFrameWith:filename:cmd:" : "fn 2/1/2017 10:57", + "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", "primResume" : "fn 1/10/2017 16:49", - "single:" : "fn 12/17/2016 20:29", + "primSimpleResume" : "fn 1/29/2017 00:32", + "pyInspect" : "fn 1/29/2017 22:15", + "restartFrame" : "fn 2/1/2017 10:57", + "restartFrame:with:" : "fn 2/2/2017 00:00", + "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", + "resumeFrame" : "fn 2/1/2017 10:35", + "single:" : "fn 2/1/2017 10:55", "startPythonInProcess" : "fn 1/16/2017 14:38", "type" : "fn 12/22/2016 21:52", - "vmSpeaksPython" : "fn 12/21/2016 01:59" }, + "vmSpeaksPython" : "fn 2/1/2017 10:55" }, "instance" : { } } diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st b/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st index 9d1cc89f..6971db75 100644 --- a/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st +++ b/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st @@ -5,4 +5,4 @@ selection selectionIndex = 1 ifTrue: [^ object ]. selectionIndex = 2 ifTrue: [^ object symbolic]. selectionIndex = 3 ifTrue: [^ object headerDescription]. - ^ object pyFrame f_globals values at: selectionIndex - 3 \ No newline at end of file + ^ object pyFrame f_locals values at: selectionIndex - 3 \ No newline at end of file diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json index b58ab680..c7829cf8 100644 --- a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json +++ b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "selection" : "fn 1/16/2017 21:14" } } + "selection" : "fn 1/30/2017 14:10" } } diff --git a/repository/PyPy.package/PythonDebugger.class/instance/appendPythonContexts..st b/repository/PyPy.package/PythonDebugger.class/class/appendPythonContexts..st similarity index 95% rename from repository/PyPy.package/PythonDebugger.class/instance/appendPythonContexts..st rename to repository/PyPy.package/PythonDebugger.class/class/appendPythonContexts..st index 4051a43a..7c1d82bc 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/appendPythonContexts..st +++ b/repository/PyPy.package/PythonDebugger.class/class/appendPythonContexts..st @@ -1,4 +1,4 @@ -helpers +as yet unclassified appendPythonContexts: aContext | newFrames currentPyFrame | newFrames := OrderedCollection new. diff --git a/repository/PyPy.package/PythonDebugger.class/class/filterPySource.lineno..st b/repository/PyPy.package/PythonDebugger.class/class/filterPySource.lineno..st new file mode 100644 index 00000000..5a45bc50 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/filterPySource.lineno..st @@ -0,0 +1,10 @@ +pysource +filterPySource: aString lineno: scopeStart + | lines indentSize end | + lines := aString lines. + lines size = 1 ifTrue: [ ^ aString ]. + end := self scopeEndIn: aString startingAt: scopeStart. + lines := lines copyFrom: scopeStart to: end. + indentSize := self indentSize: lines first. + lines := lines collect: [ :ea | ea copyFrom: indentSize + 1 to: ea size ]. + ^ lines joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/getPySourceContent..st b/repository/PyPy.package/PythonDebugger.class/class/getContentsOf..st similarity index 80% rename from repository/PyPy.package/PythonDebugger.class/instance/getPySourceContent..st rename to repository/PyPy.package/PythonDebugger.class/class/getContentsOf..st index ea7e99f4..cea9b9d8 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/getPySourceContent..st +++ b/repository/PyPy.package/PythonDebugger.class/class/getContentsOf..st @@ -1,5 +1,5 @@ -overrides -getPySourceContent: aFileName +pysource +getContentsOf: aFileName | stream data | stream := StandardFileStream oldFileNamed: aFileName. stream := MultiByteFileStream newFrom: stream. diff --git a/repository/PyPy.package/PythonDebugger.class/class/getPySource..st b/repository/PyPy.package/PythonDebugger.class/class/getPySource..st new file mode 100644 index 00000000..7025c23a --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/getPySource..st @@ -0,0 +1,7 @@ +pysource +getPySource: aContext + | pyCode contents | + pyCode := aContext pyFrame f_code. + contents := self getContentsOf: pyCode co_filename. + ^ self filterPySource: contents lineno: pyCode co_firstlineno + \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/getSignature..st b/repository/PyPy.package/PythonDebugger.class/class/getSignature..st new file mode 100644 index 00000000..83e7a2a1 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/getSignature..st @@ -0,0 +1,5 @@ +pysource +getSignature: pyCode + | content | + content := self getContentsOf: pyCode co_filename. + ^ content lines at: pyCode co_firstlineno \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/indent.by..st b/repository/PyPy.package/PythonDebugger.class/class/indent.by..st new file mode 100644 index 00000000..9db8b9b0 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/indent.by..st @@ -0,0 +1,5 @@ +pysource +indent: aString by: aNumber + | indent | + indent := String new: aNumber withAll: Character space. + ^ (aString lines collect: [:ea | indent, ea]) joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/indentSize..st b/repository/PyPy.package/PythonDebugger.class/class/indentSize..st new file mode 100644 index 00000000..70463b5f --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/indentSize..st @@ -0,0 +1,3 @@ +pysource +indentSize: aLine + ^ ((aLine findFirst: [:ea | ea isSeparator not]) - 1) max: 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/newContext.st b/repository/PyPy.package/PythonDebugger.class/class/newContext.st similarity index 88% rename from repository/PyPy.package/PythonDebugger.class/instance/newContext.st rename to repository/PyPy.package/PythonDebugger.class/class/newContext.st index 266c8e2d..872d83bc 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/newContext.st +++ b/repository/PyPy.package/PythonDebugger.class/class/newContext.st @@ -1,4 +1,4 @@ -helpers +as yet unclassified newContext ^ PythonFakeMethodContext sender: nil diff --git a/repository/PyPy.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st b/repository/PyPy.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st new file mode 100644 index 00000000..e2e9cb52 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st @@ -0,0 +1,10 @@ +pysource +replaceInPySource: oldContent content: aString lineno: aLineno + | lines end indentSize newLines | + lines := oldContent lines. + lines size <= 1 ifTrue: [ ^ aString ]. + end := self scopeEndIn: oldContent startingAt: aLineno. + indentSize := self indentSize: (lines at: aLineno). + newLines := (self indent: aString by: indentSize) lines. + lines := lines copyReplaceFrom: aLineno to: end with: newLines. + ^ lines joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/scopeEndIn.startingAt..st b/repository/PyPy.package/PythonDebugger.class/class/scopeEndIn.startingAt..st new file mode 100644 index 00000000..f9c4d93c --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/scopeEndIn.startingAt..st @@ -0,0 +1,8 @@ +pysource +scopeEndIn: aString startingAt: aLineno + | lines currentIndentSize end | + lines := aString lines allButFirst: aLineno. + currentIndentSize := self indentSize: lines first. + end := lines allButFirst findFirst: [ :line | (self indentSize: line) < currentIndentSize ]. + end = 0 ifTrue: [ end := lines size ]. + ^ aLineno + end \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/setPySourceContent.content..st b/repository/PyPy.package/PythonDebugger.class/class/setPySourceContent.content..st new file mode 100644 index 00000000..a8a2cb97 --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/class/setPySourceContent.content..st @@ -0,0 +1,13 @@ +pysource +setPySourceContent: pyCode content: aString + | filename oldContents newContents stream | + filename := pyCode co_filename. + stream := StandardFileStream readOnlyFileNamed: filename. + oldContents := stream contents. + stream close. + newContents := self replaceInPySource: oldContents content: aString lineno: pyCode co_firstlineno. + stream := StandardFileStream forceNewFileNamed: filename. + stream := MultiByteFileStream newFrom: stream. + stream write: newContents. + stream close + \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/contents.notifying..st b/repository/PyPy.package/PythonDebugger.class/instance/contents.notifying..st new file mode 100644 index 00000000..5261b70c --- /dev/null +++ b/repository/PyPy.package/PythonDebugger.class/instance/contents.notifying..st @@ -0,0 +1,9 @@ +overrides +contents: aText notifying: aController + | ctx | + ctx := self selectedContext. + ctx isPyContext ifFalse: [^ super contents: aText notifying: aController]. + self class setPySourceContent: ctx pyFrame f_code content: aText asString. + Python restartFrame: ctx pyFrame with: aText asString withUnixLineEndings. + contents := aText. + ^ true \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st b/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st index 1f5b1b70..60cbec86 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st +++ b/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st @@ -1,5 +1,5 @@ overrides contextForStack: aContext - (aContext method literalAt: 3) = #primResume + aContext method selector = #resumeFrame ifFalse: [ ^ aContext ]. "Normal MethodContext" - ^ self appendPythonContexts: aContext \ No newline at end of file + ^ self class appendPythonContexts: aContext \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/getPySource..st b/repository/PyPy.package/PythonDebugger.class/instance/getPySource..st deleted file mode 100644 index c53f8300..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/getPySource..st +++ /dev/null @@ -1,8 +0,0 @@ -overrides -getPySource: aContext - | filename | - aContext isPyContext ifFalse: [ 1 halt. ^ 'Not a Python context!!!' ]. - filename := aContext pyFrame f_code co_filename. - filename = '' ifTrue: [ ^ self getPySourceString: aContext ]. - ^ self getPySourceContent: filename - \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/getPySourceString..st b/repository/PyPy.package/PythonDebugger.class/instance/getPySourceString..st deleted file mode 100644 index 0bbfdfc3..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/getPySourceString..st +++ /dev/null @@ -1,11 +0,0 @@ -overrides -getPySourceString: aContext - "Attept to lookup source in sender method" - | sender | - sender := aContext sender. - (sender receiver = Python and: [ sender selector = #fakeResumeFrame]) - ifFalse: [ ^ 'Nothing to show' ]. - sender := sender sender. - ((sender method literalAt: 1) = #primEvalInThread:cmd:) - ifTrue: [ ^ sender method literalAt: 3 "Eval py source" ]. - ^ 'Unable to find Python source' \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st b/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st index e0cb31ee..4c82624b 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st +++ b/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st @@ -1,9 +1,10 @@ overrides pyPCRange - | lineno lineCount | - lineno := self selectedContext pyFrame f_lineno. + | pyFrame relativeLine lineCount | + pyFrame := self selectedContext pyFrame. + relativeLine := pyFrame f_lineno - pyFrame f_code co_firstlineno. lineCount := 0. - (self getPySource: self selectedContext) lineIndicesDo: [:start :endWithoutDelimiters :end | - (lineCount := lineCount + 1) = lineno + (self class getPySource: self selectedContext) lineIndicesDo: [:start :endWithoutDelimiters :end | + (lineCount := lineCount + 1) = (relativeLine + 1) ifTrue: [ ^ start to: end ]]. ^1 to: 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st b/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st index 5690621d..9c616023 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st +++ b/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st @@ -3,5 +3,5 @@ selectedMessage "Answer the source code of the currently selected context." | aContext | aContext := self selectedContext. - aContext isPyContext ifTrue: [ ^ self getPySource: aContext ]. + aContext isPyContext ifTrue: [ ^ self class getPySource: aContext ]. ^contents := aContext debuggerMap sourceText asText makeSelectorBoldIn: aContext home receiver class \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/methodProperties.json b/repository/PyPy.package/PythonDebugger.class/methodProperties.json index 46f82231..ee7d00f3 100644 --- a/repository/PyPy.package/PythonDebugger.class/methodProperties.json +++ b/repository/PyPy.package/PythonDebugger.class/methodProperties.json @@ -1,18 +1,25 @@ { "class" : { - "exploreFrames" : "fn 1/18/2017 17:34" }, + "appendPythonContexts:" : "fn 1/30/2017 12:21", + "exploreFrames" : "fn 1/18/2017 17:34", + "filterPySource:lineno:" : "fn 2/2/2017 00:01", + "getContentsOf:" : "fn 2/1/2017 22:37", + "getPySource:" : "fn 2/1/2017 22:36", + "getSignature:" : "fn 2/2/2017 00:04", + "indent:by:" : "fn 2/1/2017 22:41", + "indentSize:" : "fn 2/1/2017 22:36", + "newContext" : "fn 1/30/2017 09:54", + "replaceInPySource:content:lineno:" : "fn 2/2/2017 00:05", + "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", + "setPySourceContent:content:" : "fn 2/1/2017 22:50" }, "instance" : { - "appendPythonContexts:" : "fn 1/18/2017 18:59", - "contextForStack:" : "fn 1/16/2017 19:34", + "contents:notifying:" : "fn 2/2/2017 00:04", + "contextForStack:" : "fn 1/30/2017 12:10", "debuggerMap" : "fn 1/16/2017 20:23", "expandStack" : "fn 1/16/2017 21:03", - "getPySource:" : "fn 1/18/2017 19:12", - "getPySourceContent:" : "fn 1/16/2017 19:57", - "getPySourceString:" : "fn 1/18/2017 19:33", "isModeStyleable" : "fn 1/16/2017 20:27", - "newContext" : "fn 1/18/2017 17:43", "pcRange" : "fn 1/18/2017 20:04", "process:controller:context:" : "fn 1/16/2017 19:34", - "pyPCRange" : "fn 1/18/2017 20:15", - "selectedMessage" : "fn 1/16/2017 19:52", + "pyPCRange" : "fn 2/2/2017 17:00", + "selectedMessage" : "fn 2/1/2017 22:37", "windowColorToUse" : "fn 1/18/2017 19:06" } } diff --git a/repository/PyPy.package/PythonDebuggerTest.class/README.md b/repository/PyPy.package/PythonDebuggerTest.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st b/repository/PyPy.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st new file mode 100644 index 00000000..bb82dd07 --- /dev/null +++ b/repository/PyPy.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st @@ -0,0 +1,20 @@ +as yet unclassified +testScopeEndInStartingAt + | d input | + d := PythonDebugger. + input := ' +a = 2 +def foo(): + x = 24 + def bar(): + return "bar" + return "%s, %s" % (x, bar()) +b = 4 +x = b * a'. + self assert: 9 equals: (d scopeEndIn: input startingAt: 1). + self assert: 9 equals: (d scopeEndIn: input startingAt: 2). + self assert: 7 equals: (d scopeEndIn: input startingAt: 3). + self assert: 7 equals: (d scopeEndIn: input startingAt: 4). + self assert: 6 equals: (d scopeEndIn: input startingAt: 5). + self assert: 7 equals: (d scopeEndIn: input startingAt: 6). + self assert: 9 equals: (d scopeEndIn: input startingAt: 8). \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebuggerTest.class/methodProperties.json b/repository/PyPy.package/PythonDebuggerTest.class/methodProperties.json new file mode 100644 index 00000000..31f107b7 --- /dev/null +++ b/repository/PyPy.package/PythonDebuggerTest.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "testScopeEndInStartingAt" : "fn 2/1/2017 22:43" } } diff --git a/repository/PyPy.package/PythonDebuggerTest.class/properties.json b/repository/PyPy.package/PythonDebuggerTest.class/properties.json new file mode 100644 index 00000000..9243415f --- /dev/null +++ b/repository/PyPy.package/PythonDebuggerTest.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy-Tests", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonDebuggerTest", + "pools" : [ + ], + "super" : "TestCase", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st index b70d3656..b5ac7d53 100644 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st @@ -2,8 +2,12 @@ as yet unclassified printOn: aStream self pyFrame ifNil: [ aStream nextPutAll: 'Unknown pyFrame' ] - ifNotNil: [ | lineno name | + ifNotNil: [ | line lineno filename currentPath | + line := PythonDebugger getSignature: pyFrame f_code. lineno := pyFrame f_lineno. - name := pyFrame f_code co_filename. - aStream nextPutAll: lineno asString, ' @ ', name ]. + filename := pyFrame f_code co_filename. + currentPath := FileDirectory default pathName. + (filename startsWith: currentPath) ifTrue: [ + filename := filename allButFirst: currentPath size + 1]. + aStream nextPutAll: line, ' (line ' , lineno asString, ' in ', filename, ')' ]. \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st index feb478a6..e8cc4ae3 100644 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st @@ -4,4 +4,4 @@ tempNames variables, which are strings." self pyFrame ifNil: [^ #()]. - ^ self pyFrame f_globals keys \ No newline at end of file + ^ self pyFrame f_locals keys \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json b/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json index f46867fa..3397d7c2 100644 --- a/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json +++ b/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json @@ -3,9 +3,9 @@ }, "instance" : { "isPyContext" : "fn 1/16/2017 19:51", - "printOn:" : "fn 1/16/2017 23:54", + "printOn:" : "fn 2/2/2017 00:46", "pyFrame" : "fn 1/16/2017 19:30", "pyFrame:" : "fn 1/16/2017 19:30", "sender:" : "fn 1/16/2017 21:54", "setSender:receiver:method:arguments:" : "fn 1/18/2017 17:38", - "tempNames" : "fn 1/16/2017 20:42" } } + "tempNames" : "fn 1/30/2017 14:10" } } diff --git a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st index 988fd80b..fed36c6d 100644 --- a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st +++ b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st @@ -3,7 +3,14 @@ pythonInitialize NextID := 0. Python exec: ' import sys -sys.path.append(''', Smalltalk image imagePath ,''')'. +sys.path = [''', Smalltalk image imagePath ,''', + "/Users/fniephaus/code/RSqueak/.build/pypy/lib_pypy", + "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7", + "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7/lib-tk", + "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7/plat-darwin", + "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7/plat-mac", + "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7/plat-mac/lib-scriptpackages", + "." ]'. "Pythonize all Python classes" self withAllSubclasses do: [ :ea | ea pythonize ]. "Install PythonBuiltins (failing atm)" diff --git a/repository/PyPy.package/PythonObject.class/methodProperties.json b/repository/PyPy.package/PythonObject.class/methodProperties.json index 72a464a3..a8c907fe 100644 --- a/repository/PyPy.package/PythonObject.class/methodProperties.json +++ b/repository/PyPy.package/PythonObject.class/methodProperties.json @@ -12,7 +12,7 @@ "new" : "fn 12/19/2016 14:14", "nextID" : "fn 12/18/2016 23:45", "printString2" : "fn 12/20/2016 19:24", - "pythonInitialize" : "fn 1/18/2017 20:22", + "pythonInitialize" : "fn 1/30/2017 10:57", "pythonize" : "fn 12/21/2016 00:15", "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", "sourceCodeAt:ifAbsent:" : "fn 12/19/2016 14:07", @@ -36,7 +36,7 @@ "isClass" : "fn 12/22/2016 21:52", "isKindOf:" : "fn 12/25/2016 14:47", "newParser" : "fn 12/22/2016 22:19", - "printOn:" : "fn 12/25/2016 14:50", + "printOn:" : "fn 2/2/2017 17:06", "pyDictKeys" : "fn 12/25/2016 15:25", "pyDictValues" : "fn 12/25/2016 15:25", "pyIdentifier" : "fn 1/18/2017 17:20", diff --git a/repository/PyPy.package/monticello.meta/categories.st b/repository/PyPy.package/monticello.meta/categories.st index c80ac6ac..b5b0f236 100644 --- a/repository/PyPy.package/monticello.meta/categories.st +++ b/repository/PyPy.package/monticello.meta/categories.st @@ -1 +1,2 @@ SystemOrganization addCategory: #PyPy! +SystemOrganization addCategory: #'PyPy-Tests'! diff --git a/repository/PyPy.package/monticello.meta/version b/repository/PyPy.package/monticello.meta/version index e5a353c2..5737cac5 100644 --- a/repository/PyPy.package/monticello.meta/version +++ b/repository/PyPy.package/monticello.meta/version @@ -1 +1 @@ -(name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 19e5319c78da693c0beefa3b6f781d0c91bc8edc Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 4 Feb 2017 23:12:30 +0100 Subject: [PATCH 051/193] Use a PeriodicAsyncAction to interrupt PyPy loop --- rsqueakvm/plugins/python/constants.py | 1 - rsqueakvm/plugins/python/execution.py | 5 +- rsqueakvm/plugins/python/global_state.py | 30 ++ .../python/patched_dispatch_bytecode.py | 317 ------------------ rsqueakvm/plugins/python/patching.py | 90 +---- rsqueakvm/plugins/python_plugin.py | 2 +- 6 files changed, 51 insertions(+), 394 deletions(-) delete mode 100644 rsqueakvm/plugins/python/constants.py delete mode 100644 rsqueakvm/plugins/python/patched_dispatch_bytecode.py diff --git a/rsqueakvm/plugins/python/constants.py b/rsqueakvm/plugins/python/constants.py deleted file mode 100644 index 4dd5d793..00000000 --- a/rsqueakvm/plugins/python/constants.py +++ /dev/null @@ -1 +0,0 @@ -PYTHON_BYTECODES_THRESHOLD = 10000 diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 358ae662..bf906c29 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -1,6 +1,5 @@ from rsqueakvm.model.compiled_methods import ( W_SpurCompiledMethod, W_PreSpurCompiledMethod) -from rsqueakvm.plugins.python.constants import PYTHON_BYTECODES_THRESHOLD from rsqueakvm.plugins.python import global_state as gs from rpython.rlib.rstacklet import StackletThread @@ -145,7 +144,7 @@ def new_greenlet_callback(): def switch_to_smalltalk(interp, s_frame, first_call=False): from rsqueakvm.storage_contexts import ContextPartShadow - print 'Switch to Smalltalk' + # print 'Switch to Smalltalk' wp_result = gs.wp_result.get() if wp_result is not None: return _handle_result(interp.space, wp_result) @@ -165,7 +164,7 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): assert s_frame.w_method() is resume_method s_resume_frame.store_s_sender(s_frame.s_sender()) interp.quick_check_for_interrupt(s_resume_frame, - dec=PYTHON_BYTECODES_THRESHOLD) + dec=interp.interrupt_counter_size) # this will raise a ProcessSwitch if there are interrupts or timers ... return s_resume_frame diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index de1dd11a..5f439f93 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -4,17 +4,47 @@ from rsqueakvm.util.cells import QuasiConstant, Cell from pypy.interpreter.baseobjspace import W_Root as WP_Root +from pypy.interpreter.error import OperationError +from pypy.interpreter.executioncontext import PeriodicAsyncAction from rpython.rlib import objectmodel +class RestartException(OperationError): + def __init__(self, py_frame_restart_info): + self.py_frame_restart_info = py_frame_restart_info + + def _compute_value(self, space): + print '_compute_value called in RestartException' + return None + + class PyFrameRestartInfo(): def __init__(self, frame=None, code=None): self.frame = frame self.pycode = code +class SwitchToSmalltalkAction(PeriodicAsyncAction): + def perform(self, ec=None, frame=None): + # import pdb; pdb.set_trace() + runner = py_runner.get() + if runner: + # print 'Python yield' + runner.return_to_smalltalk() + # print 'Python continue' + # Handle py_frame_restart_info if set + restart_info = py_frame_restart_info.get() + if restart_info: + py_frame_restart_info.set(None) + # import pdb; pdb.set_trace() + raise RestartException(restart_info) + + py_space = new_pypy_objspace() +switch_action = SwitchToSmalltalkAction(py_space) +py_space.actionflag.register_periodic_action(switch_action, + use_bytecode_counter=True) py_globals = py_space.newdict() py_locals = py_space.newdict() py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) diff --git a/rsqueakvm/plugins/python/patched_dispatch_bytecode.py b/rsqueakvm/plugins/python/patched_dispatch_bytecode.py deleted file mode 100644 index 523ac422..00000000 --- a/rsqueakvm/plugins/python/patched_dispatch_bytecode.py +++ /dev/null @@ -1,317 +0,0 @@ -from rpython.rlib import jit -from rpython.rlib.rarithmetic import r_uint, intmask - -from pypy.interpreter.pycode import BytecodeCorruption -from pypy.interpreter.pyopcode import SReturnValue, Return, SuspendedUnroller -from pypy.tool.stdlib_opcode import bytecode_spec - -opcodedesc = bytecode_spec.opcodedesc -HAVE_ARGUMENT = bytecode_spec.HAVE_ARGUMENT - - -@jit.unroll_safe -def dispatch_bytecode(self, co_code, next_instr, ec): - while True: - # PythonPlugin patch start - val = self.smalltalk_check() - if val >= 0: - return val - # PythonPlugin patch end - - self.last_instr = intmask(next_instr) - if jit.we_are_jitted(): - ec.bytecode_only_trace(self) - else: - ec.bytecode_trace(self) - next_instr = r_uint(self.last_instr) - opcode = ord(co_code[next_instr]) - next_instr += 1 - - if opcode >= HAVE_ARGUMENT: - lo = ord(co_code[next_instr]) - hi = ord(co_code[next_instr+1]) - next_instr += 2 - oparg = (hi * 256) | lo - else: - oparg = 0 - - # note: the structure of the code here is such that it makes - # (after translation) a big "if/elif" chain, which is then - # turned into a switch(). - - while opcode == opcodedesc.EXTENDED_ARG.index: - opcode = ord(co_code[next_instr]) - if opcode < HAVE_ARGUMENT: - raise BytecodeCorruption - lo = ord(co_code[next_instr+1]) - hi = ord(co_code[next_instr+2]) - next_instr += 3 - oparg = (oparg * 65536) | (hi * 256) | lo - - if opcode == opcodedesc.RETURN_VALUE.index: - w_returnvalue = self.popvalue() - block = self.unrollstack(SReturnValue.kind) - if block is None: - self.pushvalue(w_returnvalue) # XXX ping pong - raise Return - else: - unroller = SReturnValue(w_returnvalue) - next_instr = block.handle(self, unroller) - return next_instr # now inside a 'finally' block - elif opcode == opcodedesc.END_FINALLY.index: - unroller = self.end_finally() - if isinstance(unroller, SuspendedUnroller): - # go on unrolling the stack - block = self.unrollstack(unroller.kind) - if block is None: - w_result = unroller.nomoreblocks() - self.pushvalue(w_result) - raise Return - else: - next_instr = block.handle(self, unroller) - return next_instr - elif opcode == opcodedesc.JUMP_ABSOLUTE.index: - return self.jump_absolute(oparg, ec) - elif opcode == opcodedesc.BREAK_LOOP.index: - next_instr = self.BREAK_LOOP(oparg, next_instr) - elif opcode == opcodedesc.CONTINUE_LOOP.index: - return self.CONTINUE_LOOP(oparg, next_instr) - elif opcode == opcodedesc.FOR_ITER.index: - next_instr = self.FOR_ITER(oparg, next_instr) - elif opcode == opcodedesc.JUMP_FORWARD.index: - next_instr = self.JUMP_FORWARD(oparg, next_instr) - elif opcode == opcodedesc.JUMP_IF_FALSE_OR_POP.index: - next_instr = self.JUMP_IF_FALSE_OR_POP(oparg, next_instr) - elif opcode == opcodedesc.JUMP_IF_NOT_DEBUG.index: - next_instr = self.JUMP_IF_NOT_DEBUG(oparg, next_instr) - elif opcode == opcodedesc.JUMP_IF_TRUE_OR_POP.index: - next_instr = self.JUMP_IF_TRUE_OR_POP(oparg, next_instr) - elif opcode == opcodedesc.POP_JUMP_IF_FALSE.index: - next_instr = self.POP_JUMP_IF_FALSE(oparg, next_instr) - elif opcode == opcodedesc.POP_JUMP_IF_TRUE.index: - next_instr = self.POP_JUMP_IF_TRUE(oparg, next_instr) - elif opcode == opcodedesc.BINARY_ADD.index: - self.BINARY_ADD(oparg, next_instr) - elif opcode == opcodedesc.BINARY_AND.index: - self.BINARY_AND(oparg, next_instr) - elif opcode == opcodedesc.BINARY_DIVIDE.index: - self.BINARY_DIVIDE(oparg, next_instr) - elif opcode == opcodedesc.BINARY_FLOOR_DIVIDE.index: - self.BINARY_FLOOR_DIVIDE(oparg, next_instr) - elif opcode == opcodedesc.BINARY_LSHIFT.index: - self.BINARY_LSHIFT(oparg, next_instr) - elif opcode == opcodedesc.BINARY_MODULO.index: - self.BINARY_MODULO(oparg, next_instr) - elif opcode == opcodedesc.BINARY_MULTIPLY.index: - self.BINARY_MULTIPLY(oparg, next_instr) - elif opcode == opcodedesc.BINARY_OR.index: - self.BINARY_OR(oparg, next_instr) - elif opcode == opcodedesc.BINARY_POWER.index: - self.BINARY_POWER(oparg, next_instr) - elif opcode == opcodedesc.BINARY_RSHIFT.index: - self.BINARY_RSHIFT(oparg, next_instr) - elif opcode == opcodedesc.BINARY_SUBSCR.index: - self.BINARY_SUBSCR(oparg, next_instr) - elif opcode == opcodedesc.BINARY_SUBTRACT.index: - self.BINARY_SUBTRACT(oparg, next_instr) - elif opcode == opcodedesc.BINARY_TRUE_DIVIDE.index: - self.BINARY_TRUE_DIVIDE(oparg, next_instr) - elif opcode == opcodedesc.BINARY_XOR.index: - self.BINARY_XOR(oparg, next_instr) - elif opcode == opcodedesc.BUILD_CLASS.index: - self.BUILD_CLASS(oparg, next_instr) - elif opcode == opcodedesc.BUILD_LIST.index: - self.BUILD_LIST(oparg, next_instr) - elif opcode == opcodedesc.BUILD_LIST_FROM_ARG.index: - self.BUILD_LIST_FROM_ARG(oparg, next_instr) - elif opcode == opcodedesc.BUILD_MAP.index: - self.BUILD_MAP(oparg, next_instr) - elif opcode == opcodedesc.BUILD_SET.index: - self.BUILD_SET(oparg, next_instr) - elif opcode == opcodedesc.BUILD_SLICE.index: - self.BUILD_SLICE(oparg, next_instr) - elif opcode == opcodedesc.BUILD_TUPLE.index: - self.BUILD_TUPLE(oparg, next_instr) - elif opcode == opcodedesc.CALL_FUNCTION.index: - self.CALL_FUNCTION(oparg, next_instr) - elif opcode == opcodedesc.CALL_FUNCTION_KW.index: - self.CALL_FUNCTION_KW(oparg, next_instr) - elif opcode == opcodedesc.CALL_FUNCTION_VAR.index: - self.CALL_FUNCTION_VAR(oparg, next_instr) - elif opcode == opcodedesc.CALL_FUNCTION_VAR_KW.index: - self.CALL_FUNCTION_VAR_KW(oparg, next_instr) - elif opcode == opcodedesc.CALL_METHOD.index: - self.CALL_METHOD(oparg, next_instr) - elif opcode == opcodedesc.COMPARE_OP.index: - self.COMPARE_OP(oparg, next_instr) - elif opcode == opcodedesc.DELETE_ATTR.index: - self.DELETE_ATTR(oparg, next_instr) - elif opcode == opcodedesc.DELETE_FAST.index: - self.DELETE_FAST(oparg, next_instr) - elif opcode == opcodedesc.DELETE_GLOBAL.index: - self.DELETE_GLOBAL(oparg, next_instr) - elif opcode == opcodedesc.DELETE_NAME.index: - self.DELETE_NAME(oparg, next_instr) - elif opcode == opcodedesc.DELETE_SLICE_0.index: - self.DELETE_SLICE_0(oparg, next_instr) - elif opcode == opcodedesc.DELETE_SLICE_1.index: - self.DELETE_SLICE_1(oparg, next_instr) - elif opcode == opcodedesc.DELETE_SLICE_2.index: - self.DELETE_SLICE_2(oparg, next_instr) - elif opcode == opcodedesc.DELETE_SLICE_3.index: - self.DELETE_SLICE_3(oparg, next_instr) - elif opcode == opcodedesc.DELETE_SUBSCR.index: - self.DELETE_SUBSCR(oparg, next_instr) - elif opcode == opcodedesc.DUP_TOP.index: - self.DUP_TOP(oparg, next_instr) - elif opcode == opcodedesc.DUP_TOPX.index: - self.DUP_TOPX(oparg, next_instr) - elif opcode == opcodedesc.EXEC_STMT.index: - self.EXEC_STMT(oparg, next_instr) - elif opcode == opcodedesc.GET_ITER.index: - self.GET_ITER(oparg, next_instr) - elif opcode == opcodedesc.IMPORT_FROM.index: - self.IMPORT_FROM(oparg, next_instr) - elif opcode == opcodedesc.IMPORT_NAME.index: - self.IMPORT_NAME(oparg, next_instr) - elif opcode == opcodedesc.IMPORT_STAR.index: - self.IMPORT_STAR(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_ADD.index: - self.INPLACE_ADD(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_AND.index: - self.INPLACE_AND(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_DIVIDE.index: - self.INPLACE_DIVIDE(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_FLOOR_DIVIDE.index: - self.INPLACE_FLOOR_DIVIDE(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_LSHIFT.index: - self.INPLACE_LSHIFT(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_MODULO.index: - self.INPLACE_MODULO(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_MULTIPLY.index: - self.INPLACE_MULTIPLY(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_OR.index: - self.INPLACE_OR(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_POWER.index: - self.INPLACE_POWER(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_RSHIFT.index: - self.INPLACE_RSHIFT(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_SUBTRACT.index: - self.INPLACE_SUBTRACT(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_TRUE_DIVIDE.index: - self.INPLACE_TRUE_DIVIDE(oparg, next_instr) - elif opcode == opcodedesc.INPLACE_XOR.index: - self.INPLACE_XOR(oparg, next_instr) - elif opcode == opcodedesc.LIST_APPEND.index: - self.LIST_APPEND(oparg, next_instr) - elif opcode == opcodedesc.LOAD_ATTR.index: - self.LOAD_ATTR(oparg, next_instr) - elif opcode == opcodedesc.LOAD_CLOSURE.index: - self.LOAD_CLOSURE(oparg, next_instr) - elif opcode == opcodedesc.LOAD_CONST.index: - self.LOAD_CONST(oparg, next_instr) - elif opcode == opcodedesc.LOAD_DEREF.index: - self.LOAD_DEREF(oparg, next_instr) - elif opcode == opcodedesc.LOAD_FAST.index: - self.LOAD_FAST(oparg, next_instr) - elif opcode == opcodedesc.LOAD_GLOBAL.index: - self.LOAD_GLOBAL(oparg, next_instr) - elif opcode == opcodedesc.LOAD_LOCALS.index: - self.LOAD_LOCALS(oparg, next_instr) - elif opcode == opcodedesc.LOAD_NAME.index: - self.LOAD_NAME(oparg, next_instr) - elif opcode == opcodedesc.LOOKUP_METHOD.index: - self.LOOKUP_METHOD(oparg, next_instr) - elif opcode == opcodedesc.MAKE_CLOSURE.index: - self.MAKE_CLOSURE(oparg, next_instr) - elif opcode == opcodedesc.MAKE_FUNCTION.index: - self.MAKE_FUNCTION(oparg, next_instr) - elif opcode == opcodedesc.MAP_ADD.index: - self.MAP_ADD(oparg, next_instr) - elif opcode == opcodedesc.NOP.index: - self.NOP(oparg, next_instr) - elif opcode == opcodedesc.POP_BLOCK.index: - self.POP_BLOCK(oparg, next_instr) - elif opcode == opcodedesc.POP_TOP.index: - self.POP_TOP(oparg, next_instr) - elif opcode == opcodedesc.PRINT_EXPR.index: - self.PRINT_EXPR(oparg, next_instr) - elif opcode == opcodedesc.PRINT_ITEM.index: - self.PRINT_ITEM(oparg, next_instr) - elif opcode == opcodedesc.PRINT_ITEM_TO.index: - self.PRINT_ITEM_TO(oparg, next_instr) - elif opcode == opcodedesc.PRINT_NEWLINE.index: - self.PRINT_NEWLINE(oparg, next_instr) - elif opcode == opcodedesc.PRINT_NEWLINE_TO.index: - self.PRINT_NEWLINE_TO(oparg, next_instr) - elif opcode == opcodedesc.RAISE_VARARGS.index: - self.RAISE_VARARGS(oparg, next_instr) - elif opcode == opcodedesc.ROT_FOUR.index: - self.ROT_FOUR(oparg, next_instr) - elif opcode == opcodedesc.ROT_THREE.index: - self.ROT_THREE(oparg, next_instr) - elif opcode == opcodedesc.ROT_TWO.index: - self.ROT_TWO(oparg, next_instr) - elif opcode == opcodedesc.SETUP_EXCEPT.index: - self.SETUP_EXCEPT(oparg, next_instr) - elif opcode == opcodedesc.SETUP_FINALLY.index: - self.SETUP_FINALLY(oparg, next_instr) - elif opcode == opcodedesc.SETUP_LOOP.index: - self.SETUP_LOOP(oparg, next_instr) - elif opcode == opcodedesc.SETUP_WITH.index: - self.SETUP_WITH(oparg, next_instr) - elif opcode == opcodedesc.SET_ADD.index: - self.SET_ADD(oparg, next_instr) - elif opcode == opcodedesc.SLICE_0.index: - self.SLICE_0(oparg, next_instr) - elif opcode == opcodedesc.SLICE_1.index: - self.SLICE_1(oparg, next_instr) - elif opcode == opcodedesc.SLICE_2.index: - self.SLICE_2(oparg, next_instr) - elif opcode == opcodedesc.SLICE_3.index: - self.SLICE_3(oparg, next_instr) - elif opcode == opcodedesc.STOP_CODE.index: - self.STOP_CODE(oparg, next_instr) - elif opcode == opcodedesc.STORE_ATTR.index: - self.STORE_ATTR(oparg, next_instr) - elif opcode == opcodedesc.STORE_DEREF.index: - self.STORE_DEREF(oparg, next_instr) - elif opcode == opcodedesc.STORE_FAST.index: - self.STORE_FAST(oparg, next_instr) - elif opcode == opcodedesc.STORE_GLOBAL.index: - self.STORE_GLOBAL(oparg, next_instr) - elif opcode == opcodedesc.STORE_MAP.index: - self.STORE_MAP(oparg, next_instr) - elif opcode == opcodedesc.STORE_NAME.index: - self.STORE_NAME(oparg, next_instr) - elif opcode == opcodedesc.STORE_SLICE_0.index: - self.STORE_SLICE_0(oparg, next_instr) - elif opcode == opcodedesc.STORE_SLICE_1.index: - self.STORE_SLICE_1(oparg, next_instr) - elif opcode == opcodedesc.STORE_SLICE_2.index: - self.STORE_SLICE_2(oparg, next_instr) - elif opcode == opcodedesc.STORE_SLICE_3.index: - self.STORE_SLICE_3(oparg, next_instr) - elif opcode == opcodedesc.STORE_SUBSCR.index: - self.STORE_SUBSCR(oparg, next_instr) - elif opcode == opcodedesc.UNARY_CONVERT.index: - self.UNARY_CONVERT(oparg, next_instr) - elif opcode == opcodedesc.UNARY_INVERT.index: - self.UNARY_INVERT(oparg, next_instr) - elif opcode == opcodedesc.UNARY_NEGATIVE.index: - self.UNARY_NEGATIVE(oparg, next_instr) - elif opcode == opcodedesc.UNARY_NOT.index: - self.UNARY_NOT(oparg, next_instr) - elif opcode == opcodedesc.UNARY_POSITIVE.index: - self.UNARY_POSITIVE(oparg, next_instr) - elif opcode == opcodedesc.UNPACK_SEQUENCE.index: - self.UNPACK_SEQUENCE(oparg, next_instr) - elif opcode == opcodedesc.WITH_CLEANUP.index: - self.WITH_CLEANUP(oparg, next_instr) - elif opcode == opcodedesc.YIELD_VALUE.index: - self.YIELD_VALUE(oparg, next_instr) - else: - self.MISSING_OPCODE(oparg, next_instr) - - if jit.we_are_jitted(): - return next_instr diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index f73570ba..4f7158f6 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,76 +1,39 @@ -from rsqueakvm.util.cells import Cell from rsqueakvm.plugins.python import global_state as gs -from rsqueakvm.plugins.python.constants import PYTHON_BYTECODES_THRESHOLD -from pypy.interpreter.error import OperationError from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver -from rsqueakvm.plugins.python.patched_dispatch_bytecode import ( - dispatch_bytecode) - - -python_interrupt_counter = Cell(PYTHON_BYTECODES_THRESHOLD) - - -class RestartException(OperationError): - def __init__(self, py_frame_restart_info): - self.py_frame_restart_info = py_frame_restart_info - - def _compute_value(self, space): - print '_compute_value called in RestartException' - return None - - -def _return_to_smalltalk(): - runner = gs.py_runner.get() - if runner: - print 'Python yield' - runner.return_to_smalltalk() - print 'Python continue' - - -def check_for_interrupts(): - new_pic = python_interrupt_counter.get() - 1 - python_interrupt_counter.set(new_pic) - if new_pic <= 0: - python_interrupt_counter.set(PYTHON_BYTECODES_THRESHOLD) - _return_to_smalltalk() - - -def check_frame_restart_info(py_frame): - py_frame_restart_info = gs.py_frame_restart_info.get() - if py_frame_restart_info: - gs.py_frame_restart_info.set(None) - # import pdb; pdb.set_trace() - raise RestartException(py_frame_restart_info) - +old_init_frame = PyFrame.__init__ +old_execute_frame = PyFrame.execute_frame +old_handle_operation_error = PyFrame.handle_operation_error -def smalltalk_check(self): - check_for_interrupts() - check_frame_restart_info(self) - return -1 # Let bytecode loop continue as normal -old_execute_frame = PyFrame.execute_frame +def __init__frame(self, space, code, w_globals, outer_func): + self.w_globals = w_globals + self.outer_func = outer_func + old_init_frame(self, space, code, w_globals, outer_func) def new_execute_frame(self, w_inputvalue=None, operr=None): while True: try: return old_execute_frame(self, w_inputvalue, operr) - except RestartException as e: + except gs.RestartException as e: # import pdb; pdb.set_trace() frame = e.py_frame_restart_info.frame if frame is not None and frame is not self: - raise RestartException(e.py_frame_restart_info) + raise gs.RestartException(e.py_frame_restart_info) self.reset(e.py_frame_restart_info.pycode) -old_init_frame = PyFrame.__init__ - -def __init__frame(self, space, code, w_globals, outer_func): - self.w_globals = w_globals - self.outer_func = outer_func - old_init_frame(self, space, code, w_globals, outer_func) +def new_handle_operation_error(self, ec, operr, attach_tb=True): + if isinstance(operr, gs.RestartException): + print "Re-raising RestartException" + raise operr + gs.wp_error.set(operr.get_w_value(gs.py_space)) + print "Python error caught" + # import pdb; pdb.set_trace() + gs.switch_action.perform() + return old_handle_operation_error(self, ec, operr, attach_tb) def reset_frame(self, new_py_code=None): @@ -80,20 +43,6 @@ def reset_frame(self, new_py_code=None): self.__init__(self.space, new_py_code, self.w_globals, self.outer_func) self.last_instr = -1 -old_handle_operation_error = PyFrame.handle_operation_error - - -def new_handle_operation_error(self, ec, operr, attach_tb=True): - if isinstance(operr, RestartException): - print "Re-raising RestartException" - raise operr - gs.wp_error.set(operr.get_w_value(gs.py_space)) - print "Python error caught" - _return_to_smalltalk() - # import pdb; pdb.set_trace() - check_frame_restart_info(self) - return old_handle_operation_error(self, ec, operr, attach_tb) - def patch_pypy(): # Patch-out virtualizables from Pypy so that translation works @@ -104,9 +53,6 @@ def patch_pypy(): except AttributeError: pass - PyFrame.smalltalk_check = smalltalk_check - PyFrame.dispatch_bytecode = dispatch_bytecode - PyFrame.__init__ = __init__frame PyFrame.execute_frame = new_execute_frame PyFrame.reset = reset_frame diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index dd6cfa98..d4173669 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -78,7 +78,7 @@ def evalInThread(interp, s_frame, w_rcvr, source, filename, cmd): @PythonPlugin.expose_primitive(unwrap_spec=[object], result_is_new_frame=True) def resumePython(interp, s_frame, w_rcvr): from rsqueakvm.plugins.python import execution - print 'Smalltalk yield' + # print 'Smalltalk yield' # import pdb; pdb.set_trace() if not execution.resume_thread(): raise PrimitiveFailedError From 84844648b18b169726a9cb8f9483de0c79df5b77 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 6 Feb 2017 16:07:04 +0100 Subject: [PATCH 052/193] Remove whileTrue loop which highly increases perf --- rsqueakvm/plugins/python/patching.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 4f7158f6..417af460 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -14,15 +14,15 @@ def __init__frame(self, space, code, w_globals, outer_func): def new_execute_frame(self, w_inputvalue=None, operr=None): - while True: - try: - return old_execute_frame(self, w_inputvalue, operr) - except gs.RestartException as e: - # import pdb; pdb.set_trace() - frame = e.py_frame_restart_info.frame - if frame is not None and frame is not self: - raise gs.RestartException(e.py_frame_restart_info) - self.reset(e.py_frame_restart_info.pycode) + try: + return old_execute_frame(self, w_inputvalue, operr) + except gs.RestartException as e: + # import pdb; pdb.set_trace() + frame = e.py_frame_restart_info.frame + if frame is not None and frame is not self: + raise gs.RestartException(e.py_frame_restart_info) + self.reset(e.py_frame_restart_info.pycode) + return new_execute_frame(self, w_inputvalue, operr) def new_handle_operation_error(self, ec, operr, attach_tb=True): From 9149a6673d5e9c533578b89b31aa4b5c654241fd Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 7 Feb 2017 20:40:58 +0100 Subject: [PATCH 053/193] Add support for unwrapping nil, true, and false --- rsqueakvm/plugins/python/utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index b88d976f..8b233c72 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -33,13 +33,13 @@ def wrap(space, wp_object): elif isinstance(wp_object, WP_TupleObject): return space.wrap_list( [wrap(space, item) for item in wp_object.tolist()]) - elif wp_object is None or isinstance(wp_object, WP_NoneObject): + elif wp_object is None or wp_object is py_space.w_None: return space.w_nil elif isinstance(wp_object, WP_IntObject): # WP_BoolObject inherits from WP_IntObject - if wp_object is WP_BoolObject.w_False: + if wp_object is py_space.w_False: return space.w_false - elif wp_object is WP_BoolObject.w_True: + elif wp_object is py_space.w_True: return space.w_true return space.wrap_int(py_space.int_w(wp_object)) else: @@ -50,6 +50,12 @@ def wrap(space, wp_object): def unwrap(space, w_object): if isinstance(w_object, W_PythonObject): return w_object.wp_object + elif w_object is None or w_object is space.w_nil: + return py_space.w_None + elif w_object is space.w_true: + return py_space.w_True + elif w_object is space.w_false: + return py_space.w_False elif isinstance(w_object, W_Float): return py_space.newfloat(space.unwrap_float(w_object)) elif isinstance(w_object, W_SmallInteger): From ffae88d26713ba234f2f1469cd44e850924ef213 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 7 Feb 2017 20:41:55 +0100 Subject: [PATCH 054/193] Remove deprecated primitives --- rsqueakvm/plugins/python_plugin.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index d4173669..b7c1080c 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -160,17 +160,6 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, return interp.space.w_true -@PythonPlugin.expose_primitive(unwrap_spec=[object, str]) -def getGlobal(interp, s_frame, w_rcvr, key): - # import pdb; pdb.set_trace() - return wrap(interp.space, py_globals.getitem(py_space.wrap(key))) - - -@PythonPlugin.expose_primitive(unwrap_spec=[object, str]) -def getLocal(interp, s_frame, w_rcvr, key): - return wrap(interp.space, py_locals.getitem(py_space.wrap(key))) - - @PythonPlugin.expose_primitive(compiled_method=True) @jit.unroll_safe def send(interp, s_frame, argcount, w_method): From a0e2f6b8fcb83e9b9609dff45f7744518be87389 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 7 Feb 2017 21:30:47 +0100 Subject: [PATCH 055/193] Enable optimized module dicts via withcelldict --- rsqueakvm/plugins/python/execution.py | 10 ++----- rsqueakvm/plugins/python/global_state.py | 2 -- rsqueakvm/plugins/python/py_objspace.py | 4 +++ rsqueakvm/plugins/python/utils.py | 38 +++++++++++++++--------- rsqueakvm/plugins/python_plugin.py | 12 +++----- 5 files changed, 35 insertions(+), 31 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index bf906c29..d55626a3 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -1,12 +1,12 @@ from rsqueakvm.model.compiled_methods import ( W_SpurCompiledMethod, W_PreSpurCompiledMethod) from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.python.utils import _run_eval_string from rpython.rlib.rstacklet import StackletThread from rpython.rlib import objectmodel from pypy.interpreter.error import OperationError -from pypy.module.__builtin__ import compiling as py_compiling def start_new_thread(source, filename, cmd, translated): @@ -47,12 +47,8 @@ def run(self): # ensure py_space has a fresh exectioncontext gs.py_space.threadlocals.enter_thread(gs.py_space) - wp_source = gs.py_space.wrap(self.source) - py_code = py_compiling.compile(gs.py_space, wp_source, - self.filename, self.cmd) - result = py_code.exec_code(gs.py_space, gs.py_globals, - gs.py_locals) - self.save_result(result) + retval = _run_eval_string(self.source, self.filename, self.cmd) + self.save_result(retval) except OperationError as e: print e.errorstr(gs.py_space) self.handle_error(e.get_w_value(gs.py_space)) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 5f439f93..4101d7b0 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -45,8 +45,6 @@ def perform(self, ec=None, frame=None): switch_action = SwitchToSmalltalkAction(py_space) py_space.actionflag.register_periodic_action(switch_action, use_bytecode_counter=True) -py_globals = py_space.newdict() -py_locals = py_space.newdict() py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) wp_result = Cell(None, type=WP_Root) diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index f727077b..ee0f6419 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -35,6 +35,9 @@ def new_pypy_objspace(): pypy_config.objspace.usemodules.pyexpat = False + # Enable immutable (and fast) module.Module + pypy_config.objspace.std.suggest(withcelldict=True) + # Copy over some options that should be the same in both configs pypy_config.translation.make_jobs = system.translationconfig.make_jobs if system.translationconfig.output is not None: @@ -66,4 +69,5 @@ def new_pypy_objspace(): # Set sys.executable in PyPy -- some modules rely upon this existing. py_space.setattr(w_sys, py_space.wrap("executable"), py_space.wrap(os.path.abspath(sys.argv[0]))) + return py_space diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 8b233c72..52f4ec0f 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,5 +1,3 @@ -import os - from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.plugins.python.model import W_PythonObject @@ -7,19 +5,41 @@ from rsqueakvm.model.variable import W_BytesObject from pypy.interpreter.error import OperationError +from pypy.interpreter.main import compilecode, ensure__main__ +from pypy.interpreter.module import Module from pypy.interpreter.pycode import PyCode from pypy.module.__builtin__ import compiling as py_compiling -from pypy.objspace.std.boolobject import W_BoolObject as WP_BoolObject from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject from pypy.objspace.std.intobject import W_IntObject as WP_IntObject from pypy.objspace.std.listobject import W_ListObject as WP_ListObject -from pypy.objspace.std.noneobject import W_NoneObject as WP_NoneObject from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject from rpython.rlib import objectmodel +def _run_eval_string(source, filename, cmd): + # Adopted from PyPy's main.py + try: + w = py_space.wrap + + pycode = compilecode(py_space, w(source), filename or '', cmd) + + mainmodule = ensure__main__(py_space) + assert isinstance(mainmodule, Module) + w_globals = mainmodule.w_dict + + py_space.setitem(w_globals, w('__builtins__'), py_space.builtin) + if filename is not None: + py_space.setitem(w_globals, w('__file__'), w(filename)) + + return pycode.exec_code(py_space, w_globals, w_globals) + + except OperationError as operationerr: + operationerr.record_interpreter_traceback() + raise + + @objectmodel.specialize.argtype(0) def wrap(space, wp_object): # import pdb; pdb.set_trace() @@ -135,13 +155,3 @@ def call_function(space, wp_func, args_w): return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4)) return wrap(space, py_space.call_function(wp_func)) - - -def rdirname(path): - splitpaths = path.split(os.sep) - splitlen = len(splitpaths) - if splitlen >= 2: - splitlen = splitlen - 1 - assert splitlen >= 0 - return os.sep.join(splitpaths[0:splitlen]) - return path diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index b7c1080c..5c04bfd5 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -9,16 +9,14 @@ from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts from rsqueakvm.plugins.python import model, global_state -from rsqueakvm.plugins.python.global_state import ( - py_space, py_globals, py_locals) +from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.plugins.python.patching import patch_pypy -from rsqueakvm.plugins.python.utils import (wrap, unwrap, call_function, - call_method, getPyCode) +from rsqueakvm.plugins.python.utils import ( + wrap, unwrap, call_function, call_method, getPyCode, _run_eval_string) from pypy.interpreter.error import OperationError from pypy.interpreter.function import (BuiltinFunction, Function, Method, StaticMethod, ClassMethod) -from pypy.module.__builtin__ import compiling as py_compiling from pypy.objspace.std.typeobject import W_TypeObject as WP_TypeObject from rpython.rlib import jit, objectmodel @@ -47,9 +45,7 @@ def startup(space, argv): def eval(interp, s_frame, w_rcvr, source, filename, cmd): try: # import pdb; pdb.set_trace() - wp_source = py_space.wrap(source) - py_code = py_compiling.compile(py_space, wp_source, filename, cmd) - retval = py_code.exec_code(py_space, py_globals, py_locals) + retval = _run_eval_string(source, filename, cmd) return wrap(interp.space, retval) except OperationError as operationerr: print operationerr.errorstr(py_space) From bc393e9905d998988f1aa17c729048f631bf434f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 7 Feb 2017 22:44:31 +0100 Subject: [PATCH 056/193] Disable micronumpy and cppyy --- rsqueakvm/plugins/python/py_objspace.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index ee0f6419..675619e9 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -15,25 +15,29 @@ def new_pypy_objspace(): translating = sys.argv[0] != '.build/run.py' # make better pypy_config = get_pypy_config(translating=translating) + from pypy.config.pypyoption import enable_allworkingmodules + enable_allworkingmodules(pypy_config) + from pypy.config.pypyoption import enable_translationmodules + enable_translationmodules(pypy_config) + + # disable dispensable modules (to save compile time) + pypy_config.objspace.usemodules.micronumpy = False + pypy_config.objspace.usemodules.cppyy = False + # cpyext causes a lot of "Undefined symbols for architecture x86_64" errors pypy_config.objspace.usemodules.cpyext = False # disabling cffi backend for now, it also causes an undefined symbol error pypy_config.objspace.usemodules._cffi_backend = False - from pypy.config.pypyoption import enable_allworkingmodules - from pypy.config.pypyoption import enable_translationmodules - enable_allworkingmodules(pypy_config) - enable_translationmodules(pypy_config) - # pypy_config.translation.check_str_without_nul = True # ensures pypy_hooks has a .space pypy_config.objspace.usemodules.pypyjit = True + # rstacklets are required pypy_config.translation.continuation = True - - pypy_config.objspace.usemodules.pyexpat = False + pypy_config.objspace.usemodules._continuation = True # Enable immutable (and fast) module.Module pypy_config.objspace.std.suggest(withcelldict=True) From ec61149ac0a70f7dbf5215a662bb8b83ef5731d6 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 7 Feb 2017 23:01:04 +0100 Subject: [PATCH 057/193] Fix compilation --- rsqueakvm/plugins/python/py_objspace.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index 675619e9..3ea0891d 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -15,11 +15,6 @@ def new_pypy_objspace(): translating = sys.argv[0] != '.build/run.py' # make better pypy_config = get_pypy_config(translating=translating) - from pypy.config.pypyoption import enable_allworkingmodules - enable_allworkingmodules(pypy_config) - from pypy.config.pypyoption import enable_translationmodules - enable_translationmodules(pypy_config) - # disable dispensable modules (to save compile time) pypy_config.objspace.usemodules.micronumpy = False pypy_config.objspace.usemodules.cppyy = False @@ -30,6 +25,11 @@ def new_pypy_objspace(): # disabling cffi backend for now, it also causes an undefined symbol error pypy_config.objspace.usemodules._cffi_backend = False + from pypy.config.pypyoption import enable_allworkingmodules + enable_allworkingmodules(pypy_config) + from pypy.config.pypyoption import enable_translationmodules + enable_translationmodules(pypy_config) + # pypy_config.translation.check_str_without_nul = True # ensures pypy_hooks has a .space From 050820928ef63c6ccbd5a999b4bd469c5b0a0395 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 7 Feb 2017 23:14:17 +0100 Subject: [PATCH 058/193] Enable more optimizations for PyPy's jit --- rsqueakvm/plugins/python/py_objspace.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index 3ea0891d..dd5bd455 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -11,7 +11,7 @@ def new_pypy_objspace(): # if 'pypy_getudir' not in Module.interpleveldefs: # Module.interpleveldefs['pypy_getudir'] = 'foo' - from pypy.config.pypyoption import get_pypy_config + from pypy.config.pypyoption import get_pypy_config, set_pypy_opt_level translating = sys.argv[0] != '.build/run.py' # make better pypy_config = get_pypy_config(translating=translating) @@ -42,6 +42,9 @@ def new_pypy_objspace(): # Enable immutable (and fast) module.Module pypy_config.objspace.std.suggest(withcelldict=True) + # Enable more optimizations for PyPy's jit + set_pypy_opt_level(pypy_config, 'jit') + # Copy over some options that should be the same in both configs pypy_config.translation.make_jobs = system.translationconfig.make_jobs if system.translationconfig.output is not None: From 27f9181c6da96f3371559103ac4a78cd95d0a1a1 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Feb 2017 00:48:35 +0100 Subject: [PATCH 059/193] Enable linux job again --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 12fe1c63..5a45d83b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ env: - PATH=$PATH:$HOME/SDL2/bin - LIBRARY_PATH=$LIBRARY_PATH:$HOME/SDL2/lib - C_INCLUDE_PATH=$C_INCLUDE_PATH:$HOME/SDL2/include - # matrix: + matrix: # - BUILD_ARCH=32bit TEST_TYPE=default # - BUILD_ARCH=32bit # - BUILD_ARCH=32bit TEST_TYPE=coverage @@ -32,7 +32,7 @@ env: # - BUILD_ARCH=armv8-a # - BUILD_ARCH=64bit PLUGINS=DatabasePlugin # - BUILD_ARCH=64bit PLUGINS=RubyPlugin - # - BUILD_ARCH=64bit PLUGINS=PythonPlugin + - BUILD_ARCH=64bit PLUGINS=PythonPlugin matrix: include: # - os: osx From 941d708b1f7ecd5a39371491ad9ad43fc3cca383 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Feb 2017 01:37:29 +0100 Subject: [PATCH 060/193] Restart with a new frame --- rsqueakvm/plugins/python/patching.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 417af460..b697259b 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -21,8 +21,11 @@ def new_execute_frame(self, w_inputvalue=None, operr=None): frame = e.py_frame_restart_info.frame if frame is not None and frame is not self: raise gs.RestartException(e.py_frame_restart_info) - self.reset(e.py_frame_restart_info.pycode) - return new_execute_frame(self, w_inputvalue, operr) + # Generate and execute new frame + new_frame = PyFrame(self.space, + e.py_frame_restart_info.pycode or self.pycode, + self.w_globals, self.outer_func) + return new_execute_frame(new_frame, w_inputvalue, operr) def new_handle_operation_error(self, ec, operr, attach_tb=True): @@ -36,14 +39,6 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): return old_handle_operation_error(self, ec, operr, attach_tb) -def reset_frame(self, new_py_code=None): - # w_inputvalue missing, see execute_frame - if new_py_code is None: - new_py_code = self.pycode - self.__init__(self.space, new_py_code, self.w_globals, self.outer_func) - self.last_instr = -1 - - def patch_pypy(): # Patch-out virtualizables from Pypy so that translation works try: @@ -55,5 +50,4 @@ def patch_pypy(): PyFrame.__init__ = __init__frame PyFrame.execute_frame = new_execute_frame - PyFrame.reset = reset_frame PyFrame.handle_operation_error = new_handle_operation_error From 8297dd19340d75bcddcfc09966bc96d2fd2ddf29 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Feb 2017 09:28:23 +0100 Subject: [PATCH 061/193] Patch SDL2 on Linux as well --- .travis/install_requirements.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index d4efc602..1881eebd 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -112,6 +112,14 @@ presetup_linux() { libffi-dev \ zlib1g-dev \ $PACKAGES + + if [[ "${PLUGINS}" = "PythonPlugin" ]]; then + # Comment out SDL_messagebox.h in SDL.h + # A wrong macro is applied to "const SDL_MessageBoxButtonData *buttons;" + # which breaks compilation at the end. + echo "Patching SDL.h for PythonPlugin" + sudo sed -i.bak "/SDL_messagebox\.h/s/^/\/\/ /" "/usr/include/SDL2/SDL.h" + fi } setup_linux() { @@ -129,7 +137,7 @@ setup_linux() { arm*) "${BASE}/setup_arm.sh" ;; - esac + esac } # Only build arm on master From fe811d5184e38e5a6c19383d6d6dcf71130765b9 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Feb 2017 15:19:12 +0100 Subject: [PATCH 062/193] Use py_space.FrameClass Plus improve to getPySource, still WIP --- rsqueakvm/plugins/python/patching.py | 7 +++---- rsqueakvm/plugins/python/utils.py | 6 +++++- rsqueakvm/plugins/python_plugin.py | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index b697259b..513f3e5d 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -17,14 +17,13 @@ def new_execute_frame(self, w_inputvalue=None, operr=None): try: return old_execute_frame(self, w_inputvalue, operr) except gs.RestartException as e: - # import pdb; pdb.set_trace() frame = e.py_frame_restart_info.frame if frame is not None and frame is not self: raise gs.RestartException(e.py_frame_restart_info) # Generate and execute new frame - new_frame = PyFrame(self.space, - e.py_frame_restart_info.pycode or self.pycode, - self.w_globals, self.outer_func) + new_frame = gs.py_space.FrameClass( + self.space, e.py_frame_restart_info.pycode or self.pycode, + self.w_globals, self.outer_func) return new_execute_frame(new_frame, w_inputvalue, operr) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 52f4ec0f..66809cfb 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -99,7 +99,11 @@ def getPyCode(source, filename, cmd): co_consts_w_len = len(py_code.co_consts_w) if co_consts_w_len >= 1: if co_consts_w_len > 1: - print "More than 1 const produced: %s" % co_consts_w_len + print 'More than 1 const produced: %s' % co_consts_w_len + first_consts_w = py_code.co_consts_w[0] + if not isinstance(first_consts_w, PyCode): + print 'First const is not a PyCode' + return py_code return py_code.co_consts_w[0] except OperationError as e: # import pdb; pdb.set_trace() diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 5c04bfd5..b3e98132 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -132,6 +132,7 @@ def restartFrame(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str]) def restartFrameWith(interp, s_frame, w_rcvr, source, filename, cmd): + # import pdb; pdb.set_trace() py_code = getPyCode(source, filename, cmd) if py_code is None: return interp.space.w_false # Raising prim error causes crashes From 690ab3f3579bf634fdff9bdd0cfdd406016f5220 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Feb 2017 17:02:30 +0100 Subject: [PATCH 063/193] Convert double into single quotes [ci skip] --- rsqueakvm/plugins/python/execution.py | 2 +- rsqueakvm/plugins/python/global_state.py | 8 ++++---- rsqueakvm/plugins/python/model.py | 12 ++++++------ rsqueakvm/plugins/python/patching.py | 8 ++++---- rsqueakvm/plugins/python/py_objspace.py | 16 ++++++++-------- rsqueakvm/plugins/python_plugin.py | 6 +++--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index d55626a3..9854b575 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -24,7 +24,7 @@ def start_new_thread(source, filename, cmd, translated): def resume_thread(): runner = gs.py_runner.get() if runner is None or not runner.resumable(): - print "No runner to resume with" + print 'No runner to resume with' return False runner.resume() return gs.wp_error.get() is None diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 4101d7b0..91280e5b 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -62,15 +62,15 @@ def perform(self, ec=None, frame=None): def startup(space): w_python_plugin_send.set(space.wrap_list_unroll_safe([ - space.wrap_string("PythonPlugin"), - space.wrap_string("send") + space.wrap_string('PythonPlugin'), + space.wrap_string('send') ])) - python_class = space.smalltalk_at("Python") + python_class = space.smalltalk_at('Python') w_python_class.set( python_class or space.w_nil.getclass(space) ) w_python_object_class.set( - space.smalltalk_at("PythonObject") or space.w_nil.getclass(space) + space.smalltalk_at('PythonObject') or space.w_nil.getclass(space) ) resume_method_symbol = space.wrap_symbol('resumeFrame') python_cls_cls_s = python_class.getclass(space).as_class_get_shadow(space) diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index d0a5e137..9e05b892 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -15,9 +15,9 @@ class W_PythonObject(W_PointersObject): - _attrs_ = ["wp_object", "s_class"] - _immutable_fields_ = ["wp_object", "s_class?"] - repr_classname = "W_PythonObject" + _attrs_ = ['wp_object', 's_class'] + _immutable_fields_ = ['wp_object', 's_class?'] + repr_classname = 'W_PythonObject' def __init__(self, wp_object): W_AbstractObjectWithIdentityHash.__init__(self) @@ -60,8 +60,8 @@ def is_same_object(self, other): class PythonClassShadow(ClassShadow): - _attrs_ = ["wp_object", "wp_class"] - _immutable_fields_ = ["wp_class"] + _attrs_ = ['wp_object', 'wp_class'] + _immutable_fields_ = ['wp_class'] def __init__(self, space, wp_object, wp_class): assert isinstance(wp_class, WP_Root) @@ -85,7 +85,7 @@ def lookup(self, w_selector): def make_method(self, w_selector): # import pdb; pdb.set_trace() methodname = self.space.unwrap_string(w_selector) - idx = methodname.find(":") + idx = methodname.find(':') if idx > 0: methodname = methodname[0:idx] diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 513f3e5d..82b468c7 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -29,10 +29,10 @@ def new_execute_frame(self, w_inputvalue=None, operr=None): def new_handle_operation_error(self, ec, operr, attach_tb=True): if isinstance(operr, gs.RestartException): - print "Re-raising RestartException" + print 'Re-raising RestartException' raise operr gs.wp_error.set(operr.get_w_value(gs.py_space)) - print "Python error caught" + print 'Python error caught' # import pdb; pdb.set_trace() gs.switch_action.perform() return old_handle_operation_error(self, ec, operr, attach_tb) @@ -42,8 +42,8 @@ def patch_pypy(): # Patch-out virtualizables from Pypy so that translation works try: # TODO: what if first delattr fails? - delattr(PyFrame, "_virtualizable_") - delattr(PyPyJitDriver, "virtualizables") + delattr(PyFrame, '_virtualizable_') + delattr(PyPyJitDriver, 'virtualizables') except AttributeError: pass diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index dd5bd455..71742c2a 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -19,7 +19,7 @@ def new_pypy_objspace(): pypy_config.objspace.usemodules.micronumpy = False pypy_config.objspace.usemodules.cppyy = False - # cpyext causes a lot of "Undefined symbols for architecture x86_64" errors + # cpyext causes a lot of 'Undefined symbols for architecture x86_64' errors pypy_config.objspace.usemodules.cpyext = False # disabling cffi backend for now, it also causes an undefined symbol error @@ -50,7 +50,7 @@ def new_pypy_objspace(): if system.translationconfig.output is not None: pypy_config.translation.output = system.translationconfig.output - # merge_configs(config, pypy_config, "RSqueak", "PyPy") + # merge_configs(config, pypy_config, 'RSqueak', 'PyPy') # PyPy needs threads pypy_config.translation.thread = True @@ -63,18 +63,18 @@ def new_pypy_objspace(): # equivalent to the hack in app_main.py of PyPy, albiet interp-level. w_sys = py_space.sys - w_modnames = w_sys.get("builtin_module_names") - w_in = py_space.contains(w_modnames, py_space.wrap("__pypy__")) + w_modnames = w_sys.get('builtin_module_names') + w_in = py_space.contains(w_modnames, py_space.wrap('__pypy__')) if not py_space.is_true(w_in): - rl = py_space.sys.get("setrecursionlimit") + rl = py_space.sys.get('setrecursionlimit') py_space.call(rl, py_space.newlist([py_space.wrap(5000)])) # Should always be able to import Python modules in CWD. - w_sys_path = py_space.getattr(w_sys, py_space.wrap("path")) - py_space.call_method(w_sys_path, 'append', py_space.wrap(".")) + w_sys_path = py_space.getattr(w_sys, py_space.wrap('path')) + py_space.call_method(w_sys_path, 'append', py_space.wrap('.')) # Set sys.executable in PyPy -- some modules rely upon this existing. - py_space.setattr(w_sys, py_space.wrap("executable"), + py_space.setattr(w_sys, py_space.wrap('executable'), py_space.wrap(os.path.abspath(sys.argv[0]))) return py_space diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index b3e98132..4cf0d817 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -1,5 +1,5 @@ from rsqueakvm.util import system -if "PythonPlugin" not in system.optional_plugins: +if 'PythonPlugin' not in system.optional_plugins: raise LookupError else: system.translationconfig.set(thread=True) @@ -167,7 +167,7 @@ def send(interp, s_frame, argcount, w_method): w_selector_name = w_method.literalat0(space, 2) assert isinstance(w_selector_name, W_BytesObject) methodname = space.unwrap_string(w_selector_name) - idx = methodname.find(":") + idx = methodname.find(':') if idx > 0: methodname = methodname[0:idx] w_result = None @@ -218,7 +218,7 @@ def send(interp, s_frame, argcount, w_method): print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) return space.w_nil if w_result is None: - print "Result failure in send primitive (type: %s, methodname: %s)" % ( + print 'Result failure in send primitive (type: %s, methodname: %s)' % ( py_space.type(wp_rcvr), methodname) return space.w_nil s_frame.pop_n(argcount + 1) From d720c526f6e4c6903906443b340e70435d8eb040 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Feb 2017 23:30:45 +0100 Subject: [PATCH 064/193] Disable allworkingmodules to save compile time --- rsqueakvm/plugins/python/py_objspace.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index 71742c2a..84b75817 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -25,8 +25,10 @@ def new_pypy_objspace(): # disabling cffi backend for now, it also causes an undefined symbol error pypy_config.objspace.usemodules._cffi_backend = False - from pypy.config.pypyoption import enable_allworkingmodules - enable_allworkingmodules(pypy_config) + # disabled to save compile time + # from pypy.config.pypyoption import enable_allworkingmodules + # enable_allworkingmodules(pypy_config) + from pypy.config.pypyoption import enable_translationmodules enable_translationmodules(pypy_config) From af9a232baff792c53d5f184b8cfaa2ba815afbb0 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Feb 2017 23:50:48 +0100 Subject: [PATCH 065/193] thread module is required --- rsqueakvm/plugins/python/py_objspace.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index 84b75817..2cb19e54 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -40,6 +40,7 @@ def new_pypy_objspace(): # rstacklets are required pypy_config.translation.continuation = True pypy_config.objspace.usemodules._continuation = True + pypy_config.objspace.usemodules.thread = True # Enable immutable (and fast) module.Module pypy_config.objspace.std.suggest(withcelldict=True) From 6f56f847ec4e475efcc65d329bf73151002b1578 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 9 Feb 2017 22:51:26 +0100 Subject: [PATCH 066/193] Improve exception handling Only catch exceptions that cannot be catched by any blocks in any frames. --- rsqueakvm/plugins/python/patching.py | 46 +++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 82b468c7..5a9ec4a7 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,6 +1,11 @@ from rsqueakvm.plugins.python import global_state as gs from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver +from pypy.interpreter.pyopcode import SApplicationException + +from pypy.tool.stdlib_opcode import bytecode_spec + +opcodedesc = bytecode_spec.opcodedesc old_init_frame = PyFrame.__init__ old_execute_frame = PyFrame.execute_frame @@ -27,14 +32,45 @@ def new_execute_frame(self, w_inputvalue=None, operr=None): return new_execute_frame(new_frame, w_inputvalue, operr) +def get_exception(self, handlerposition): + "Retrieve exception to catch" + next_opcode = ord(self.pycode.co_code[handlerposition + 1]) + if next_opcode == opcodedesc.LOAD_GLOBAL.index: + global_index = ord(self.pycode.co_code[handlerposition + 2]) + return self._load_global(self.getname_u(global_index)) + elif next_opcode == opcodedesc.LOAD_NAME.index: + if self.getorcreatedebug().w_locals is self.get_w_globals(): + global_index = ord(self.pycode.co_code[handlerposition + 2]) + return self._load_global(self.getname_u(global_index)) + return None + + +def has_exception_handler(self, operr): + "Returns True if this frame or one of his parents are able to handle operr" + frame = self + while frame is not None: + block = frame.lastblock + while block is not None: + if (block.handling_mask & SApplicationException.kind) != 0: + block_exc = get_exception(frame, block.handlerposition) + if block_exc is not None: + if gs.py_space.exception_match(operr.w_type, block_exc): + return True + block = block.previous + frame = frame.f_backref() + return False + + def new_handle_operation_error(self, ec, operr, attach_tb=True): if isinstance(operr, gs.RestartException): print 'Re-raising RestartException' raise operr - gs.wp_error.set(operr.get_w_value(gs.py_space)) - print 'Python error caught' - # import pdb; pdb.set_trace() - gs.switch_action.perform() + + if not self.has_exception_handler(operr): + # import pdb; pdb.set_trace() + gs.wp_error.set(operr.get_w_value(gs.py_space)) + print 'Python error caught' + gs.switch_action.perform() return old_handle_operation_error(self, ec, operr, attach_tb) @@ -49,4 +85,6 @@ def patch_pypy(): PyFrame.__init__ = __init__frame PyFrame.execute_frame = new_execute_frame + PyFrame.get_exception = get_exception + PyFrame.has_exception_handler = has_exception_handler PyFrame.handle_operation_error = new_handle_operation_error From f75ee0dc8e6fa1284d13279436e3892570979b64 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 10 Feb 2017 14:26:44 +0100 Subject: [PATCH 067/193] Add PythonTheme; bugfixes and improvements [ci skip] --- .../Object.extension/instance/isPython.st | 3 + .../Object.extension/methodProperties.json | 5 + .../Object.extension/properties.json | 2 + .../Python.class/class/primGetGlobal..st | 5 - .../Python.class/class/primGetLocal..st | 5 - .../class/startPythonInProcess.st | 4 - .../Python.class/class/vmSpeaksPython.st | 2 +- .../Python.class/methodProperties.json | 5 +- .../instance/selection.st | 2 +- .../methodProperties.json | 2 +- .../instance/windowColorToUse.st | 2 +- .../methodProperties.json | 2 +- .../class/pythonInitialize.st | 14 +- .../PythonObject.class/instance/isPython.st | 3 + .../PythonObject.class/methodProperties.json | 3 +- .../methodProperties.json | 4 +- .../PythonTheme.class/class/addButtons..st | 26 ++++ .../PythonTheme.class/class/addDialogs..st | 66 +++++++++ .../PythonTheme.class/class/addFonts..st | 14 ++ .../class/addMenusAndDockingBars..st | 44 ++++++ .../class/addScrollables..st | 71 ++++++++++ .../class/addSyntaxHighlighting..st | 123 +++++++++++++++++ .../PythonTheme.class/class/addToolColors..st | 21 +++ .../class/addWindowColors..st | 42 ++++++ .../PythonTheme.class/class/argumentColor.st | 4 + .../class/backgroundColor.st | 3 + .../PythonTheme.class/class/backgroundForm.st | 4 + .../PythonTheme.class/class/blue.st | 4 + .../class/builtinConstColor.st | 3 + .../PythonTheme.class/class/commentColor.st | 4 + .../PythonTheme.class/class/create.st | 27 ++++ .../class/focusedLabelColor.st | 3 + .../class/foregroundColor.st | 4 + .../PythonTheme.class/class/globalColor.st | 5 + .../PythonTheme.class/class/green.st | 3 + .../PythonTheme.class/class/highlightColor.st | 3 + .../PythonTheme.class/class/keywordColor.st | 5 + .../PythonTheme.class/class/magenta.st | 4 + .../PythonTheme.class/class/numberColor.st | 6 + .../PythonTheme.class/class/orange.st | 4 + .../PythonTheme.class/class/red.st | 3 + .../PythonTheme.class/class/stringColor.st | 3 + .../PythonTheme.class/class/textColor.st | 3 + .../class/textSelectionColor.st | 3 + .../class/unfocusedLabelColor.st | 3 + .../PythonTheme.class/class/variableColor.st | 3 + .../PythonTheme.class/class/windowColor.st | 3 + .../PythonTheme.class/class/yellow.st | 3 + .../instance/addSyntaxHighlighting..st | 126 ------------------ .../PythonTheme.class/methodProperties.json | 35 ++++- .../PythonTheme.class/properties.json | 2 +- .../PythonWorkspace.class/class/foo.st | 3 - .../PythonWorkspace.class/instance/foo.st | 3 - .../methodProperties.json | 4 +- .../PyPy.package/monticello.meta/version | 2 +- 55 files changed, 583 insertions(+), 172 deletions(-) create mode 100644 repository/PyPy.package/Object.extension/instance/isPython.st create mode 100644 repository/PyPy.package/Object.extension/methodProperties.json create mode 100644 repository/PyPy.package/Object.extension/properties.json delete mode 100644 repository/PyPy.package/Python.class/class/primGetGlobal..st delete mode 100644 repository/PyPy.package/Python.class/class/primGetLocal..st delete mode 100644 repository/PyPy.package/Python.class/class/startPythonInProcess.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/isPython.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/addButtons..st create mode 100644 repository/PyPy.package/PythonTheme.class/class/addDialogs..st create mode 100644 repository/PyPy.package/PythonTheme.class/class/addFonts..st create mode 100644 repository/PyPy.package/PythonTheme.class/class/addMenusAndDockingBars..st create mode 100644 repository/PyPy.package/PythonTheme.class/class/addScrollables..st create mode 100644 repository/PyPy.package/PythonTheme.class/class/addSyntaxHighlighting..st create mode 100644 repository/PyPy.package/PythonTheme.class/class/addToolColors..st create mode 100644 repository/PyPy.package/PythonTheme.class/class/addWindowColors..st create mode 100644 repository/PyPy.package/PythonTheme.class/class/argumentColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/backgroundColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/backgroundForm.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/blue.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/builtinConstColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/commentColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/create.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/focusedLabelColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/foregroundColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/globalColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/green.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/highlightColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/keywordColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/magenta.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/numberColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/orange.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/red.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/stringColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/textColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/textSelectionColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/unfocusedLabelColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/variableColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/windowColor.st create mode 100644 repository/PyPy.package/PythonTheme.class/class/yellow.st delete mode 100644 repository/PyPy.package/PythonTheme.class/instance/addSyntaxHighlighting..st delete mode 100644 repository/PyPy.package/PythonWorkspace.class/class/foo.st delete mode 100644 repository/PyPy.package/PythonWorkspace.class/instance/foo.st diff --git a/repository/PyPy.package/Object.extension/instance/isPython.st b/repository/PyPy.package/Object.extension/instance/isPython.st new file mode 100644 index 00000000..4c3694ef --- /dev/null +++ b/repository/PyPy.package/Object.extension/instance/isPython.st @@ -0,0 +1,3 @@ +*PyPy +isPython + ^ false \ No newline at end of file diff --git a/repository/PyPy.package/Object.extension/methodProperties.json b/repository/PyPy.package/Object.extension/methodProperties.json new file mode 100644 index 00000000..a632af45 --- /dev/null +++ b/repository/PyPy.package/Object.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "isPython" : "fn 2/10/2017 12:12" } } diff --git a/repository/PyPy.package/Object.extension/properties.json b/repository/PyPy.package/Object.extension/properties.json new file mode 100644 index 00000000..3d3b9ec4 --- /dev/null +++ b/repository/PyPy.package/Object.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "Object" } diff --git a/repository/PyPy.package/Python.class/class/primGetGlobal..st b/repository/PyPy.package/Python.class/class/primGetGlobal..st deleted file mode 100644 index e2fb1277..00000000 --- a/repository/PyPy.package/Python.class/class/primGetGlobal..st +++ /dev/null @@ -1,5 +0,0 @@ -system primitives -primGetGlobal: aKey - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primGetLocal..st b/repository/PyPy.package/Python.class/class/primGetLocal..st deleted file mode 100644 index 4642378b..00000000 --- a/repository/PyPy.package/Python.class/class/primGetLocal..st +++ /dev/null @@ -1,5 +0,0 @@ -system primitives -primGetLocal: aKey - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/startPythonInProcess.st b/repository/PyPy.package/Python.class/class/startPythonInProcess.st deleted file mode 100644 index e0c012d7..00000000 --- a/repository/PyPy.package/Python.class/class/startPythonInProcess.st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -startPythonInProcess - Processor yield. - self primResume. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st index 7e8e51d1..c3240a43 100644 --- a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st +++ b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st @@ -1,4 +1,4 @@ helpers vmSpeaksPython - [ Python primEval: '1' filename: '' cmd: 'eval' ] on: Error do: [ ^ false ]. + [ Python eval: '1' ] on: Error do: [ ^ false ]. ^ true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/methodProperties.json b/repository/PyPy.package/Python.class/methodProperties.json index 40de1f6a..607ca7d1 100644 --- a/repository/PyPy.package/Python.class/methodProperties.json +++ b/repository/PyPy.package/Python.class/methodProperties.json @@ -20,8 +20,6 @@ "primEval:filename:cmd:" : "fn 2/1/2017 10:55", "primEvalInThread:cmd:" : "fn 2/2/2017 17:09", "primEvalInThread:filename:cmd:" : "fn 2/1/2017 10:56", - "primGetGlobal:" : "fn 12/17/2016 22:23", - "primGetLocal:" : "fn 12/17/2016 22:22", "primGetTopFrame" : "fn 1/11/2017 11:19", "primLastError" : "fn 1/28/2017 13:37", "primLastResult" : "fn 1/30/2017 15:34", @@ -36,8 +34,7 @@ "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", "resumeFrame" : "fn 2/1/2017 10:35", "single:" : "fn 2/1/2017 10:55", - "startPythonInProcess" : "fn 1/16/2017 14:38", "type" : "fn 12/22/2016 21:52", - "vmSpeaksPython" : "fn 2/1/2017 10:55" }, + "vmSpeaksPython" : "fn 2/10/2017 12:21" }, "instance" : { } } diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st b/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st index 6971db75..7fc4627e 100644 --- a/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st +++ b/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st @@ -1,6 +1,6 @@ as yet unclassified selection - + self object isPython ifFalse: [ ^ super selection ]. selectionIndex = 0 ifTrue: [^ '']. selectionIndex = 1 ifTrue: [^ object ]. selectionIndex = 2 ifTrue: [^ object symbolic]. diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json index c7829cf8..1913c102 100644 --- a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json +++ b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "selection" : "fn 1/30/2017 14:10" } } + "selection" : "fn 2/10/2017 12:13" } } diff --git a/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st b/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st index 03f91554..e5b2d33f 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st +++ b/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st @@ -1,4 +1,4 @@ overrides windowColorToUse - ^ Color r: 108/255 g: 174/255 b: 224/255 \ No newline at end of file + ^ PythonTheme highlightColor darker \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/methodProperties.json b/repository/PyPy.package/PythonDebugger.class/methodProperties.json index ee7d00f3..45f6db0c 100644 --- a/repository/PyPy.package/PythonDebugger.class/methodProperties.json +++ b/repository/PyPy.package/PythonDebugger.class/methodProperties.json @@ -22,4 +22,4 @@ "process:controller:context:" : "fn 1/16/2017 19:34", "pyPCRange" : "fn 2/2/2017 17:00", "selectedMessage" : "fn 2/1/2017 22:37", - "windowColorToUse" : "fn 1/18/2017 19:06" } } + "windowColorToUse" : "fn 2/10/2017 12:08" } } diff --git a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st index fed36c6d..16328b6e 100644 --- a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st +++ b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st @@ -3,13 +3,13 @@ pythonInitialize NextID := 0. Python exec: ' import sys -sys.path = [''', Smalltalk image imagePath ,''', - "/Users/fniephaus/code/RSqueak/.build/pypy/lib_pypy", - "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7", - "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7/lib-tk", - "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7/plat-darwin", - "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7/plat-mac", - "/Users/fniephaus/code/RSqueak/.build/pypy/lib-python/2.7/plat-mac/lib-scriptpackages", +sys.path = ["', Smalltalk image imagePath, '", + "', Smalltalk image imagePath, 'pypy/lib_pypy", + "', Smalltalk image imagePath, 'pypy/lib-python/2.7", + "', Smalltalk image imagePath, 'pypy/lib-python/2.7/lib-tk", + "', Smalltalk image imagePath, 'pypy/lib-python/2.7/plat-darwin", + "', Smalltalk image imagePath, 'pypy/lib-python/2.7/plat-mac", + "', Smalltalk image imagePath, 'pypy/lib-python/2.7/plat-mac/lib-scriptpackages", "." ]'. "Pythonize all Python classes" self withAllSubclasses do: [ :ea | ea pythonize ]. diff --git a/repository/PyPy.package/PythonObject.class/instance/isPython.st b/repository/PyPy.package/PythonObject.class/instance/isPython.st new file mode 100644 index 00000000..5f13d9ba --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/isPython.st @@ -0,0 +1,3 @@ +overrides +isPython + ^ true \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/methodProperties.json b/repository/PyPy.package/PythonObject.class/methodProperties.json index a8c907fe..804f1c31 100644 --- a/repository/PyPy.package/PythonObject.class/methodProperties.json +++ b/repository/PyPy.package/PythonObject.class/methodProperties.json @@ -12,7 +12,7 @@ "new" : "fn 12/19/2016 14:14", "nextID" : "fn 12/18/2016 23:45", "printString2" : "fn 12/20/2016 19:24", - "pythonInitialize" : "fn 1/30/2017 10:57", + "pythonInitialize" : "fn 2/10/2017 12:17", "pythonize" : "fn 12/21/2016 00:15", "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", "sourceCodeAt:ifAbsent:" : "fn 12/19/2016 14:07", @@ -35,6 +35,7 @@ "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", "isClass" : "fn 12/22/2016 21:52", "isKindOf:" : "fn 12/25/2016 14:47", + "isPython" : "fn 2/10/2017 12:12", "newParser" : "fn 12/22/2016 22:19", "printOn:" : "fn 2/2/2017 17:06", "pyDictKeys" : "fn 12/25/2016 15:25", diff --git a/repository/PyPy.package/PythonTextStyler.class/methodProperties.json b/repository/PyPy.package/PythonTextStyler.class/methodProperties.json index 66e48644..1f80923a 100644 --- a/repository/PyPy.package/PythonTextStyler.class/methodProperties.json +++ b/repository/PyPy.package/PythonTextStyler.class/methodProperties.json @@ -3,5 +3,5 @@ }, "instance" : { "parseableSourceCodeTemplate" : "fn 12/22/2016 15:20", - "style:" : "fn 12/19/2016 14:57", - "styleInBackgroundProcess:" : "fn 12/19/2016 14:57" } } + "style:" : "fn 2/10/2017 14:13", + "styleInBackgroundProcess:" : "fn 2/10/2017 14:13" } } diff --git a/repository/PyPy.package/PythonTheme.class/class/addButtons..st b/repository/PyPy.package/PythonTheme.class/class/addButtons..st new file mode 100644 index 00000000..1113323a --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/addButtons..st @@ -0,0 +1,26 @@ +instance creation +addButtons: theme + "self create apply" + theme + set: #borderColor for: #PluggableButtonMorph to: Color gray; + set: #borderWidth for: #PluggableButtonMorph to: 0; + set: #borderStyle for: #PluggableButtonMorph to: BorderStyle default; + set: #color for: #PluggableButtonMorph to: self backgroundColor lighter; + + set: #font for: #PluggableButtonMorph to: [Preferences standardButtonFont]; + set: #textColor for: #PluggableButtonMorph to: self textColor; + + set: #selectionModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.1] ]; + set: #hoverModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.1] ]; + set: #feedbackModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.3] ]. + + "And the plus-version." + theme + set: #disabledColor for: #PluggableButtonMorphPlus to: Color transparent; + set: #disabledTextColor for: #PluggableButtonMorphPlus to: (Color gray: 0.6). + + "And the three-phase button." + theme + derive: #color for: #ThreePhaseButtonMorph from: #PluggableButtonMorph at: #textColor; + derive: #font for: #ThreePhaseButtonMorph from: #PluggableButtonMorph; + derive: #textColor for: #ThreePhaseButtonMorph from: #PluggableButtonMorph. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addDialogs..st b/repository/PyPy.package/PythonTheme.class/class/addDialogs..st new file mode 100644 index 00000000..cbe16caa --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/addDialogs..st @@ -0,0 +1,66 @@ +instance creation +addDialogs: theme + "self create apply." + + theme + set: #borderColor for: #DialogWindow to: Color gray; + set: #borderWidth for: #DialogWindow to: 1; + set: #borderStyle for: #DialogWindow to: BorderStyle default; + set: #color for: #DialogWindow to: self backgroundColor; + + set: #titleBorderColor for: #DialogWindow to: Color gray; + set: #titleBorderWidth for: #DialogWindow to: 0; + set: #titleBorderStyle for: #DialogWindow to: BorderStyle default; + set: #titleColor for: #DialogWindow to: self highlightColor; + set: #titleFont for: #DialogWindow to: [Preferences windowTitleFont]; + set: #titleTextColor for: #DialogWindow to: self textColor; + + set: #font for: #DialogWindow to: [Preferences standardSystemFont]; + set: #textColor for: #DialogWindow to: self textColor; + + set: #okColor for: #DialogWindow to: (Color r: 0.49 g: 0.749 b: 0.49); + set: #cancelColor for: #DialogWindow to: (Color r: 1 g: 0.6 b: 0.588); + set: #buttonColor for: #DialogWindow to: (Color r: 0.658 g: 0.678 b: 0.78) twiceLighter; + set: #selectionModifier for: #DialogWindow to: [ [:c | Color orange muchLighter ] ]. + + "The List Chooser is a dialog, too." + theme + derive: #okColor for: #ListChooser from: #DialogWindow; + derive: #cancelColor for: #ListChooser from: #DialogWindow; + set: #addColor for: #ListChooser to: Color blue muchLighter; + set: #disabledColor for: #ListChooser to: Color gray. + + "And the mulitple list chooser." + theme + derive: #okColor for: #ListMultipleChooser from: #DialogWindow; + derive: #cancelColor for: #ListMultipleChooser from: #DialogWindow. + + "And the system progress bar." + theme + derive: #borderColor for: #SystemProgressMorph from: #MenuMorph; + derive: #borderWidth for: #SystemProgressMorph from: #MenuMorph; + derive: #borderStyle for: #SystemProgressMorph from: #MenuMorph; + derive: #color for: #SystemProgressMorph from: #MenuMorph; + derive: #font for: #SystemProgressMorph from: #MenuItemMorph; + derive: #textColor for: #SystemProgressMorph from: #MenuItemMorph; + + set: #borderColor for: #SystemProgressBarMorph to: Color transparent; + set: #borderWidth for: #SystemProgressBarMorph to: 0; + set: #borderStyle for: #SystemProgressBarMorph to: BorderStyle default; + set: #color for: #SystemProgressBarMorph to: (Color r: 0.977 g: 0.977 b: 0.977); + set: #barColor for: #SystemProgressBarMorph to: (Color r: 0.72 g: 0.72 b: 0.9). + + "And the balloon morphs." + theme + set: #borderColor for: #NewBalloonMorph to: self highlightColor; + set: #borderWidth for: #NewBalloonMorph to: 1; + set: #color for: #NewBalloonMorph to: self highlightColor; + set: #font for: #NewBalloonMorph to: [Preferences standardBalloonHelpFont]; + derive: #textColor for: #NewBalloonMorph from: #PluggableButtonMorph. + + theme + derive: #borderColor for: #BalloonMorph from: #NewBalloonMorph; + set: #borderWidth for: #BalloonMorph to: 0; + derive: #color for: #BalloonMorph from: #NewBalloonMorph; + derive: #font for: #BalloonMorph from: #NewBalloonMorph; + derive: #textColor for: #BalloonMorph from: #NewBalloonMorph. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addFonts..st b/repository/PyPy.package/PythonTheme.class/class/addFonts..st new file mode 100644 index 00000000..10b1accd --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/addFonts..st @@ -0,0 +1,14 @@ +instance creation +addFonts: theme + + theme + set: #balloonHelpFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7); + set: #standardButtonFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7); + set: #standardCodeFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardDefaultTextFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardFlapFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7 emphasized: TextEmphasis bold emphasisCode); + set: #haloLabelFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardListFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardMenuFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardSystemFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #windowTitleFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9 emphasized: TextEmphasis bold emphasisCode). diff --git a/repository/PyPy.package/PythonTheme.class/class/addMenusAndDockingBars..st b/repository/PyPy.package/PythonTheme.class/class/addMenusAndDockingBars..st new file mode 100644 index 00000000..7e248501 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/addMenusAndDockingBars..st @@ -0,0 +1,44 @@ +instance creation +addMenusAndDockingBars: theme + "self create apply" + theme + set: #borderColor for: #MenuMorph to: Color gray; + set: #borderWidth for: #MenuMorph to: 1; + set: #borderStyle for: #MenuMorph to: BorderStyle default; + set: #color for: #MenuMorph to: self backgroundColor; + + set: #titleBorderColor for: #MenuMorph to: self backgroundColor darker; + set: #titleBorderWidth for: #MenuMorph to: 0; + set: #titleBorderStyle for: #MenuMorph to: BorderStyle default; + set: #titleColor for: #MenuMorph to: Color transparent; + set: #titleFont for: #MenuMorph to: [Preferences windowTitleFont]; + set: #titleTextColor for: #MenuMorph to: self textColor; + + set: #lineColor for: #MenuMorph to: self backgroundColor darker; + set: #lineStyle for: #MenuMorph to: BorderStyle simple; + set: #lineWidth for: #MenuMorph to: 1. + + theme + set: #font for: #MenuItemMorph to: [Preferences standardMenuFont]; + set: #textColor for: #MenuItemMorph to: self unfocusedLabelColor; + set: #disabledTextColor for: #MenuItemMorph to: Color gray; + set: #selectionColor for: #MenuItemMorph to: self backgroundColor lighter lighter; + set: #selectionTextColor for: #MenuItemMorph to: self textColor. + + "Derive some stuff for the docking bar morph, which looks mostly like a menu morph." + theme + set: #borderWidth for: #DockingBarMorph to: 0; + derive: #borderColor for: #DockingBarMorph from: #MenuMorph; + derive: #borderStyle for: #DockingBarMorph from: #MenuMorph; + derive: #color for: #DockingBarMorph from: #MenuMorph; + + derive: #lineColor for: #DockingBarMorph from: #MenuMorph; + derive: #lineStyle for: #DockingBarMorph from: #MenuMorph; + derive: #lineWidth for: #DockingBarMorph from: #MenuMorph. + + "The world main docking bar." + theme + derive: #font for: #TheWorldMainDockingBar from: #MenuItemMorph; + derive: #textColor for: #TheWorldMainDockingBar from: #MenuItemMorph; + set: #logoColor for: #TheWorldMainDockingBar to: self textColor; + set: #selectionLogoColor for: #TheWorldMainDockingBar to: Color white. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addScrollables..st b/repository/PyPy.package/PythonTheme.class/class/addScrollables..st new file mode 100644 index 00000000..ab98b1e2 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/addScrollables..st @@ -0,0 +1,71 @@ +instance creation +addScrollables: theme + "self create apply" + + "Sliders" + theme + set: #borderColor for: #Slider to: Color gray; + set: #borderWidth for: #Slider to: 0; + set: #color for: #Slider to: Color lightGray; + set: #thumbBorderColor for: #Slider to: [Color gray: 0.6]; + set: #thumbBorderWidth for: #Slider to: 0; + set: #thumbColor for: #Slider to: Color veryVeryLightGray; + set: #thumbShadowModifier for: #Slider to: [ [:c | c alpha: 0.7] ]. + + "Scroll bars" + theme + set: #thumbBorderWidth for: #ScrollBar to: 0; + set: #thumbColorModifier for: #ScrollBar to: [ [:c | c] ]; + set: #pagingAreaColorModifier for: #ScrollBar to: [ [:c | c darker alpha: -0.35] ]; + set: #borderColorModifier for: #ScrollBar to: [ [:c | c adjustBrightness: -0.1] ]. + + "Scroll panes (includes generic stuff for list widgets, tree widgets, and text widgets." + theme + set: #borderColor for: #ScrollPane to: (Color gray: 0.6); + set: #borderWidth for: #ScrollPane to: 0; + set: #borderStyle for: #ScrollPane to: BorderStyle default; + set: #color for: #ScrollPane to: self backgroundColor. + + "List widgets" + theme + set: #font for: #PluggableListMorph to: [Preferences standardListFont]; + set: #textColor for: #PluggableListMorph to: self unfocusedLabelColor; + set: #selectionColor for: #PluggableListMorph to: self backgroundColor lighter lighter; + derive: #multiSelectionColor for: #PluggableListMorph from: #PluggableListMorph at: #selectionColor do: [:c | c lighter]; + set: #selectionTextColor for: #PluggableListMorph to: self textColor; + set: #filterColor for: #PluggableListMorph to: Color transparent; + set: #filterTextColor for: #PluggableListMorph to: self highlightColor; + set: #preSelectionModifier for: #PluggableListMorph to: [ [:c | Color gray: 0.9] ]; + set: #hoverSelectionModifier for: #PluggableListMorph to: [ [:c | c darker alpha: 0.3] ]. + + "Tree widgets" + theme + derive: #font for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #textColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #selectionColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #selectionTextColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #filterColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #filterTextColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #hoverSelectionModifier for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + + set: #higlightTextColor for: #SimpleHierarchicalListMorph to: Color red; + set: #lineColor for: #SimpleHierarchicalListMorph to: Color veryLightGray. + + "Text widgets" + theme + set: #font for: #PluggableTextMorph to: [Preferences standardDefaultTextFont]; + set: #textColor for: #PluggableTextMorph to: self textColor; + set: #caretColor for: #PluggableTextMorph to: Color red; + set: #selectionColor for: #PluggableTextMorph to: self textSelectionColor; + set: #unfocusedSelectionModifier for: #PluggableTextMorph to: [[:c | self textSelectionColor ]]; + set: #adornmentReadOnly for: #PluggableTextMorph to: Color black; + set: #adornmentRefuse for: #PluggableTextMorph to: Color tan; + set: #adornmentConflict for: #PluggableTextMorph to: Color red; + set: #adornmentDiff for: #PluggableTextMorph to: Color green; + set: #adornmentNormalEdit for: #PluggableTextMorph to: Color orange; + set: #adornmentDiffEdit for: #PluggableTextMorph to: Color yellow; + set: #frameAdornmentWidth for: #PluggableTextMorph to: 1. + theme + set: #stylerClass for: #PluggableTextMorphPlus to: PythonTextStyler; + set: #balloonTextColor for: #PluggableTextMorphPlus to: (Color gray: 0.7); + derive: #balloonTextFont for: #PluggableTextMorphPlus from: #PluggableTextMorph at: #font. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addSyntaxHighlighting..st b/repository/PyPy.package/PythonTheme.class/class/addSyntaxHighlighting..st new file mode 100644 index 00000000..fae0387d --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/addSyntaxHighlighting..st @@ -0,0 +1,123 @@ +instance creation +addSyntaxHighlighting: theme + "self create apply." + theme + set: #color for: #TextAction to: self blue; + + set: #default for: #SHTextStylerST80 to: {self foregroundColor}; + set: #invalid for: #SHTextStylerST80 to: {self red}; + set: #excessCode for: #SHTextStylerST80 to: {self red}; + set: #comment for: #SHTextStylerST80 to: {self commentColor}; + set: #unfinishedComment for: #SHTextStylerST80 to: {self red. TextEmphasis italic}; + set: #'$' for: #SHTextStylerST80 to: {self red}; + set: #character for: #SHTextStylerST80 to: {self numberColor}; + set: #integer for: #SHTextStylerST80 to: {self numberColor}; + set: #number for: #SHTextStylerST80 to: {self numberColor}; + set: #- for: #SHTextStylerST80 to: {self red}; + set: #symbol for: #SHTextStylerST80 to: {self blue}; + set: #stringSymbol for: #SHTextStylerST80 to: {self blue}; + set: #literalArray for: #SHTextStylerST80 to: {self blue}; + set: #string for: #SHTextStylerST80 to: {self stringColor. TextEmphasis normal}; + set: #unfinishedString for: #SHTextStylerST80 to: {self red. TextEmphasis normal}; + set: #assignment for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #ansiAssignment for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #literal for: #SHTextStylerST80 to: {nil. TextEmphasis italic}; + set: #keyword for: #SHTextStylerST80 to: {self blue}; + set: #binary for: #SHTextStylerST80 to: {self blue}; + set: #unary for: #SHTextStylerST80 to: {self blue}; + set: #incompleteKeyword for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; + set: #incompleteBinary for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; + set: #incompleteUnary for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; + set: #undefinedKeyword for: #SHTextStylerST80 to: {self red}; + set: #undefinedBinary for: #SHTextStylerST80 to: {self red}; + set: #undefinedUnary for: #SHTextStylerST80 to: {self red}; + set: #patternKeyword for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #patternBinary for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #patternUnary for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #self for: #SHTextStylerST80 to: {self red}; + set: #super for: #SHTextStylerST80 to: {self red}; + set: #true for: #SHTextStylerST80 to: {self red}; + set: #false for: #SHTextStylerST80 to: {self red}; + set: #nil for: #SHTextStylerST80 to: {self red}; + set: #thisContext for: #SHTextStylerST80 to: {self red}; + set: #return for: #SHTextStylerST80 to: {self red}; + set: #patternArg for: #SHTextStylerST80 to: {self blue}; + set: #methodArg for: #SHTextStylerST80 to: {self blue}; + set: #blockPatternArg for: #SHTextStylerST80 to: {self blue}; + set: #blockArg for: #SHTextStylerST80 to: {self blue}; + set: #argument for: #SHTextStylerST80 to: {self blue}; + set: #blockArgColon for: #SHTextStylerST80 to: {self foregroundColor}; + set: #leftParenthesis for: #SHTextStylerST80 to: {self foregroundColor}; + set: #rightParenthesis for: #SHTextStylerST80 to: {self foregroundColor}; + set: #leftParenthesis1 for: #SHTextStylerST80 to: {self green}; + set: #rightParenthesis1 for: #SHTextStylerST80 to: {self green}; + set: #leftParenthesis2 for: #SHTextStylerST80 to: {self magenta}; + set: #rightParenthesis2 for: #SHTextStylerST80 to: {self magenta}; + set: #leftParenthesis3 for: #SHTextStylerST80 to: {self red}; + set: #rightParenthesis3 for: #SHTextStylerST80 to: {self red}; + set: #leftParenthesis4 for: #SHTextStylerST80 to: {self green}; + set: #rightParenthesis4 for: #SHTextStylerST80 to: {self green}; + set: #leftParenthesis5 for: #SHTextStylerST80 to: {self orange}; + set: #rightParenthesis5 for: #SHTextStylerST80 to: {self orange}; + set: #leftParenthesis6 for: #SHTextStylerST80 to: {self magenta}; + set: #rightParenthesis6 for: #SHTextStylerST80 to: {self magenta}; + set: #leftParenthesis7 for: #SHTextStylerST80 to: {self blue}; + set: #rightParenthesis7 for: #SHTextStylerST80 to: {self blue}; + set: #blockStart for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockEnd for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockStart1 for: #SHTextStylerST80 to: {self green}; + set: #blockEnd1 for: #SHTextStylerST80 to: {self green}; + set: #blockStart2 for: #SHTextStylerST80 to: {self magenta}; + set: #blockEnd2 for: #SHTextStylerST80 to: {self magenta}; + set: #blockStart3 for: #SHTextStylerST80 to: {self red}; + set: #blockEnd3 for: #SHTextStylerST80 to: {self red}; + set: #blockStart4 for: #SHTextStylerST80 to: {self green}; + set: #blockEnd4 for: #SHTextStylerST80 to: {self green}; + set: #blockStart5 for: #SHTextStylerST80 to: {self orange}; + set: #blockEnd5 for: #SHTextStylerST80 to: {self orange}; + set: #blockStart6 for: #SHTextStylerST80 to: {self magenta}; + set: #blockEnd6 for: #SHTextStylerST80 to: {self magenta}; + set: #blockStart7 for: #SHTextStylerST80 to: {self blue}; + set: #blockEnd7 for: #SHTextStylerST80 to: {self blue}; + set: #arrayStart for: #SHTextStylerST80 to: {self foregroundColor}; + set: #arrayEnd for: #SHTextStylerST80 to: {self foregroundColor}; + set: #arrayStart1 for: #SHTextStylerST80 to: {self foregroundColor}; + set: #arrayEnd1 for: #SHTextStylerST80 to: {self foregroundColor}; + set: #byteArrayStart for: #SHTextStylerST80 to: {self foregroundColor}; + set: #byteArrayEnd for: #SHTextStylerST80 to: {self foregroundColor}; + set: #byteArrayStart1 for: #SHTextStylerST80 to: {self foregroundColor}; + set: #byteArrayEnd1 for: #SHTextStylerST80 to: {self foregroundColor}; + set: #leftBrace for: #SHTextStylerST80 to: {self foregroundColor}; + set: #rightBrace for: #SHTextStylerST80 to: {self foregroundColor}; + set: #cascadeSeparator for: #SHTextStylerST80 to: {self foregroundColor}; + set: #statementSeparator for: #SHTextStylerST80 to: {self foregroundColor}; + set: #externalCallType for: #SHTextStylerST80 to: {self foregroundColor}; + set: #externalCallTypePointerIndicator for: #SHTextStylerST80 to: {self foregroundColor}; + set: #primitiveOrExternalCallStart for: #SHTextStylerST80 to: {self foregroundColor}; + set: #primitiveOrExternalCallEnd for: #SHTextStylerST80 to: {self foregroundColor}; + set: #methodTempBar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockTempBar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockArgsBar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #primitive for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #pragmaKeyword for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #pragmaUnary for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #pragmaBinary for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #externalFunctionCallingConvention for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #module for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #blockTempVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockPatternTempVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #instVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #workspaceVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #undefinedIdentifier for: #SHTextStylerST80 to: {self red}; + set: #incompleteIdentifier for: #SHTextStylerST80 to: {self foregroundColor. {TextEmphasis italic. TextEmphasis underlined}}; + set: #tempVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #patternTempVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #poolConstant for: #SHTextStylerST80 to: {self foregroundColor}; + set: #classVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #globalVar for: #SHTextStylerST80 to: {self foregroundColor}. + + "And the text differ" + theme + set: #insertTextAttributes for: #TextDiffBuilder to: { TextColor color: self red }; + set: #removeTextAttributes for: #TextDiffBuilder to: { TextEmphasis struckOut. TextColor color: self blue }; + set: #normalTextAttributes for: #TextDiffBuilder to: { TextEmphasis normal }. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addToolColors..st b/repository/PyPy.package/PythonTheme.class/class/addToolColors..st new file mode 100644 index 00000000..4f2a299c --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/addToolColors..st @@ -0,0 +1,21 @@ +instance creation +addToolColors: theme + "Tool-specific colors." + + "SUnit's TestRunner." + theme + set: #failureColor for: #TestRunner to: self yellow; + set: #errorColor for: #TestRunner to: self red; + set: #passColor for: #TestRunner to: self green; + + derive: #failureTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor; + derive: #errorTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor; + derive: #passTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor. + + "Monticello Tools." + theme + set: #revertedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis struckOut}; + set: #ignoredOperationAttributes for: #MCOperationsBrowser to: {TextColor color: Color gray}. + "set: #rejectedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis struckOut}; + set: #acceptedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis underlined}; + set: #conflictingOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis bold}." \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addWindowColors..st b/repository/PyPy.package/PythonTheme.class/class/addWindowColors..st new file mode 100644 index 00000000..a2546d93 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/addWindowColors..st @@ -0,0 +1,42 @@ +instance creation +addWindowColors: theme + "self create apply" + theme + set: #titleFont for: #SystemWindow to: [Preferences windowTitleFont]; + set: #borderColorModifier for: #SystemWindow to: [ [:c | c adjustBrightness: -0.2] ]; + set: #borderWidth for: #SystemWindow to: 0; + + set: #uniformWindowColor for: #Model to: self windowColor; + derive: #uniformWindowColor for: #TranscriptStream from: #Model; + derive: #color for: #SystemWindow from: #Model at: #uniformWindowColor; "Fall back for windows without models." + + set: #unfocusedWindowColorModifier for: #SystemWindow to: [ [:color | color darker] ]; + set: #unfocusedLabelColor for: #SystemWindow to: self unfocusedLabelColor; + set: #focusedLabelColor for: #SystemWindow to: self focusedLabelColor; + + set: #customWindowColor for: #Browser to: (Color r: 0.764 g: 0.9 b: 0.63); + set: #customWindowColor for: #ChangeList to: (Color r: 0.719 g: 0.9 b: 0.9); + set: #customWindowColor for: #ChangeSorter to: (Color r: 0.719 g: 0.9 b: 0.9); + set: #customWindowColor for: #ChatNotes to: (Color r: 1.0 g: 0.7 b: 0.8); + set: #customWindowColor for: #ClassCommentVersionsBrowser to: (Color r: 0.753 g: 0.677 b: 0.9); + set: #customWindowColor for: #Debugger to: (Color r: 0.9 g: 0.719 b: 0.719); + set: #customWindowColor for: #DualChangeSorter to: (Color r: 0.719 g: 0.9 b: 0.9); + set: #customWindowColor for: #FileContentsBrowser to: (Color r: 0.7 g: 0.7 b: 0.508); + set: #customWindowColor for: #FileList to: (Color r: 0.65 g: 0.65 b: 0.65); + set: #customWindowColor for: #InstanceBrowser to: (Color r: 0.726 g: 0.9 b: 0.9); + set: #customWindowColor for: #Lexicon to: (Color r: 0.79 g: 0.9 b: 0.79); + set: #customWindowColor for: #MCTool to: (Color r: 0.65 g: 0.691 b: 0.876); + set: #customWindowColor for: #MessageNames to: (Color r: 0.639 g: 0.9 b: 0.497); + set: #customWindowColor for: #MessageSet to: (Color r: 0.719 g: 0.9 b: 0.9); + set: #customWindowColor for: #PackagePaneBrowser to: (Color r: 0.9 g: 0.9 b: 0.63); + set: #customWindowColor for: #PluggableFileList to: Color lightYellow; + set: #customWindowColor for: #PreferenceBrowser to: (Color r: 0.671 g: 0.9 b: 0.9); + set: #customWindowColor for: #SMLoader to: (Color r: 0.801 g: 0.801 b: 0.614); + set: #customWindowColor for: #SMLoaderPlus to: (Color r: 0.801 g: 0.801 b: 0.614); + set: #customWindowColor for: #SMReleaseBrowser to: (Color r: 0.801 g: 0.801 b: 0.614); + set: #customWindowColor for: #ScriptingDomain to: (Color r: 0.91 g: 0.91 b: 0.91); + set: #customWindowColor for: #SelectorBrowser to: (Color r: 0.45 g: 0.9 b: 0.9); + set: #customWindowColor for: #StringHolder to: (Color r: 0.9 g: 0.9 b: 0.719); + set: #customWindowColor for: #TestRunner to: (Color r: 0.9 g: 0.576 b: 0.09); + set: #customWindowColor for: #TranscriptStream to: (Color r: 0.9 g: 0.75 b: 0.45); + set: #customWindowColor for: #VersionsBrowser to: (Color r: 0.782 g: 0.677 b: 0.9). \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/argumentColor.st b/repository/PyPy.package/PythonTheme.class/class/argumentColor.st new file mode 100644 index 00000000..d27e34d2 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/argumentColor.st @@ -0,0 +1,4 @@ +monokai +argumentColor + + ^ Color fromString: '#FD971F' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/backgroundColor.st b/repository/PyPy.package/PythonTheme.class/class/backgroundColor.st new file mode 100644 index 00000000..1816569b --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/backgroundColor.st @@ -0,0 +1,3 @@ +colors +backgroundColor + ^ Color fromString: '#2e2e2e' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/backgroundForm.st b/repository/PyPy.package/PythonTheme.class/class/backgroundForm.st new file mode 100644 index 00000000..c74e0cab --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/backgroundForm.st @@ -0,0 +1,4 @@ +helpers +backgroundForm + + ^ (Form extent: 10@10 depth: 32) collectColors: [:c | self backgroundColor] \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/blue.st b/repository/PyPy.package/PythonTheme.class/class/blue.st new file mode 100644 index 00000000..06beb404 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/blue.st @@ -0,0 +1,4 @@ +monokai +blue + + ^ self globalColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/builtinConstColor.st b/repository/PyPy.package/PythonTheme.class/class/builtinConstColor.st new file mode 100644 index 00000000..b0e68d70 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/builtinConstColor.st @@ -0,0 +1,3 @@ +colors +builtinConstColor + ^ self numberColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/commentColor.st b/repository/PyPy.package/PythonTheme.class/class/commentColor.st new file mode 100644 index 00000000..f9d496e9 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/commentColor.st @@ -0,0 +1,4 @@ +monokai +commentColor + + ^ Color fromString: '#75715E' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/create.st b/repository/PyPy.package/PythonTheme.class/class/create.st new file mode 100644 index 00000000..4fa1a566 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/create.st @@ -0,0 +1,27 @@ +instance creation +create + "self create apply." + + ^ (self named: 'Python') in: [:theme | + "General morph stuff." + theme + set: #keyboardFocusColor for: #Morph to: self highlightColor; + set: #keyboardFocusWidth for: #Morph to: 1; + set: #softShadowColor for: #Morph to: (Color black alpha: 0.01); + set: #softShadowOffset for: #Morph to: (10@8 corner: 10@12); + set: #hardShadowColor for: #Morph to: (Color black alpha: 0.5); + set: #hardShadowOffset for: #Morph to: 1@1. + + theme set: #background for: #MorphicProject to: self backgroundForm. + + self + addFonts: theme; + addWindowColors: theme; + addSyntaxHighlighting: theme; + addMenusAndDockingBars: theme; + addDialogs: theme; + addButtons: theme; + addScrollables: theme; + addToolColors: theme. + + theme] \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/focusedLabelColor.st b/repository/PyPy.package/PythonTheme.class/class/focusedLabelColor.st new file mode 100644 index 00000000..2d805d08 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/focusedLabelColor.st @@ -0,0 +1,3 @@ +colors +focusedLabelColor + ^ self textColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/foregroundColor.st b/repository/PyPy.package/PythonTheme.class/class/foregroundColor.st new file mode 100644 index 00000000..d47441d4 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/foregroundColor.st @@ -0,0 +1,4 @@ +monokai +foregroundColor + + ^ Color fromString: '#F8F8F2' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/globalColor.st b/repository/PyPy.package/PythonTheme.class/class/globalColor.st new file mode 100644 index 00000000..273d0edc --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/globalColor.st @@ -0,0 +1,5 @@ +monokai +globalColor + "library function, library constant, library class type, ..." + + ^ Color fromString: '#66D9EF' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/green.st b/repository/PyPy.package/PythonTheme.class/class/green.st new file mode 100644 index 00000000..0e0f4d71 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/green.st @@ -0,0 +1,3 @@ +colors +green + ^ Color fromString: '#A6E22E' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/highlightColor.st b/repository/PyPy.package/PythonTheme.class/class/highlightColor.st new file mode 100644 index 00000000..1470de49 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/highlightColor.st @@ -0,0 +1,3 @@ +colors +highlightColor + ^ Color fromString: '#6c98bc' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/keywordColor.st b/repository/PyPy.package/PythonTheme.class/class/keywordColor.st new file mode 100644 index 00000000..701ac7db --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/keywordColor.st @@ -0,0 +1,5 @@ +monokai +keywordColor + "tag name, invalid background, ..." + + ^ Color fromString: '#F92672' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/magenta.st b/repository/PyPy.package/PythonTheme.class/class/magenta.st new file mode 100644 index 00000000..acf0463e --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/magenta.st @@ -0,0 +1,4 @@ +monokai +magenta + + ^ self keywordColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/numberColor.st b/repository/PyPy.package/PythonTheme.class/class/numberColor.st new file mode 100644 index 00000000..01455b39 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/numberColor.st @@ -0,0 +1,6 @@ +monokai +numberColor + "Constant, invalid deprecated background, ..." + "purple" + + ^ Color fromString: '#AE81FF' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/orange.st b/repository/PyPy.package/PythonTheme.class/class/orange.st new file mode 100644 index 00000000..fba82a04 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/orange.st @@ -0,0 +1,4 @@ +monokai +orange + + ^ self argumentColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/red.st b/repository/PyPy.package/PythonTheme.class/class/red.st new file mode 100644 index 00000000..5d595521 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/red.st @@ -0,0 +1,3 @@ +colors +red + ^ Color fromString: '#dc322f' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/stringColor.st b/repository/PyPy.package/PythonTheme.class/class/stringColor.st new file mode 100644 index 00000000..5607b46a --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/stringColor.st @@ -0,0 +1,3 @@ +colors +stringColor + ^ Color fromString: '#e5b567' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/textColor.st b/repository/PyPy.package/PythonTheme.class/class/textColor.st new file mode 100644 index 00000000..3b3c57d4 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/textColor.st @@ -0,0 +1,3 @@ +colors +textColor + ^ Color fromString: '#e8e8e8' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/textSelectionColor.st b/repository/PyPy.package/PythonTheme.class/class/textSelectionColor.st new file mode 100644 index 00000000..aad60f29 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/textSelectionColor.st @@ -0,0 +1,3 @@ +colors +textSelectionColor + ^ Color fromString: '#5a637f' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/unfocusedLabelColor.st b/repository/PyPy.package/PythonTheme.class/class/unfocusedLabelColor.st new file mode 100644 index 00000000..3f05d9a6 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/unfocusedLabelColor.st @@ -0,0 +1,3 @@ +colors +unfocusedLabelColor + ^ Color fromString: '#747474' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/variableColor.st b/repository/PyPy.package/PythonTheme.class/class/variableColor.st new file mode 100644 index 00000000..f360681d --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/variableColor.st @@ -0,0 +1,3 @@ +colors +variableColor + ^ Color fromString: '#E87D3E' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/windowColor.st b/repository/PyPy.package/PythonTheme.class/class/windowColor.st new file mode 100644 index 00000000..244d2d1f --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/windowColor.st @@ -0,0 +1,3 @@ +colors +windowColor + ^ Color fromString: '#1e1e1e' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/yellow.st b/repository/PyPy.package/PythonTheme.class/class/yellow.st new file mode 100644 index 00000000..154f2107 --- /dev/null +++ b/repository/PyPy.package/PythonTheme.class/class/yellow.st @@ -0,0 +1,3 @@ +colors +yellow + ^ Color fromString: '#b58900' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/instance/addSyntaxHighlighting..st b/repository/PyPy.package/PythonTheme.class/instance/addSyntaxHighlighting..st deleted file mode 100644 index 36539ada..00000000 --- a/repository/PyPy.package/PythonTheme.class/instance/addSyntaxHighlighting..st +++ /dev/null @@ -1,126 +0,0 @@ -as yet unclassified -addSyntaxHighlighting: theme - "This was the former sub-dued highlighting. - self create apply. - " - - theme - set: #color for: #TextAction to: Color aqua; - - set: #default for: #PythonTextStyler to: {Color black}; - set: #invalid for: #PythonTextStyler to: {Color black}; - set: #excessCode for: #PythonTextStyler to: {Color black}; - set: #comment for: #PythonTextStyler to: {Color cyan muchDarker}; - set: #unfinishedComment for: #PythonTextStyler to: {Color black muchDarker. TextEmphasis italic}; - set: #'$' for: #PythonTextStyler to: {Color black muchDarker}; - set: #character for: #PythonTextStyler to: {Color black muchDarker}; - set: #integer for: #PythonTextStyler to: {Color black muchDarker}; - set: #number for: #PythonTextStyler to: {Color black muchDarker}; - set: #- for: #PythonTextStyler to: {Color black muchDarker}; - set: #symbol for: #PythonTextStyler to: {Color blue muchDarker}; - set: #stringSymbol for: #PythonTextStyler to: {Color blue muchDarker}; - set: #literalArray for: #PythonTextStyler to: {Color blue muchDarker}; - set: #string for: #PythonTextStyler to: {Color magenta muchDarker. TextEmphasis normal}; - set: #unfinishedString for: #PythonTextStyler to: {Color black. TextEmphasis normal}; - set: #assignment for: #PythonTextStyler to: {nil. TextEmphasis bold}; - set: #ansiAssignment for: #PythonTextStyler to: {nil. TextEmphasis bold}; - set: #literal for: #PythonTextStyler to: {nil. TextEmphasis italic}; - set: #keyword for: #PythonTextStyler to: {Color blue muchDarker}; - set: #binary for: #PythonTextStyler to: {Color blue muchDarker}; - set: #unary for: #PythonTextStyler to: {Color blue muchDarker}; - set: #incompleteKeyword for: #PythonTextStyler to: {Color gray muchDarker. TextEmphasis underlined}; - set: #incompleteBinary for: #PythonTextStyler to: {Color gray muchDarker. TextEmphasis underlined}; - set: #incompleteUnary for: #PythonTextStyler to: {Color gray muchDarker. TextEmphasis underlined}; - set: #undefinedKeyword for: #PythonTextStyler to: {Color black}; - set: #undefinedBinary for: #PythonTextStyler to: {Color black}; - set: #undefinedUnary for: #PythonTextStyler to: {Color black}; - set: #patternKeyword for: #PythonTextStyler to: {nil. TextEmphasis bold}; - set: #patternBinary for: #PythonTextStyler to: {nil. TextEmphasis bold}; - set: #patternUnary for: #PythonTextStyler to: {nil. TextEmphasis bold}; - set: #self for: #PythonTextStyler to: {Color black muchDarker}; - set: #super for: #PythonTextStyler to: {Color black muchDarker}; - set: #true for: #PythonTextStyler to: {Color black muchDarker}; - set: #false for: #PythonTextStyler to: {Color black muchDarker}; - set: #nil for: #PythonTextStyler to: {Color black muchDarker}; - set: #thisContext for: #PythonTextStyler to: {Color black muchDarker}; - set: #return for: #PythonTextStyler to: {Color black muchDarker}; - set: #patternArg for: #PythonTextStyler to: {Color blue muchDarker}; - set: #methodArg for: #PythonTextStyler to: {Color blue muchDarker}; - set: #blockPatternArg for: #PythonTextStyler to: {Color blue muchDarker}; - set: #blockArg for: #PythonTextStyler to: {Color blue muchDarker}; - set: #argument for: #PythonTextStyler to: {Color blue muchDarker}; - set: #blockArgColon for: #PythonTextStyler to: {Color black}; - set: #leftParenthesis for: #PythonTextStyler to: {Color black}; - set: #rightParenthesis for: #PythonTextStyler to: {Color black}; - set: #leftParenthesis1 for: #PythonTextStyler to: {Color green muchDarker}; - set: #rightParenthesis1 for: #PythonTextStyler to: {Color green muchDarker}; - set: #leftParenthesis2 for: #PythonTextStyler to: {Color magenta muchDarker}; - set: #rightParenthesis2 for: #PythonTextStyler to: {Color magenta muchDarker}; - set: #leftParenthesis3 for: #PythonTextStyler to: {Color black muchDarker}; - set: #rightParenthesis3 for: #PythonTextStyler to: {Color black muchDarker}; - set: #leftParenthesis4 for: #PythonTextStyler to: {Color green darker}; - set: #rightParenthesis4 for: #PythonTextStyler to: {Color green darker}; - set: #leftParenthesis5 for: #PythonTextStyler to: {Color orange darker}; - set: #rightParenthesis5 for: #PythonTextStyler to: {Color orange darker}; - set: #leftParenthesis6 for: #PythonTextStyler to: {Color magenta darker}; - set: #rightParenthesis6 for: #PythonTextStyler to: {Color magenta darker}; - set: #leftParenthesis7 for: #PythonTextStyler to: {Color blue}; - set: #rightParenthesis7 for: #PythonTextStyler to: {Color blue}; - set: #blockStart for: #PythonTextStyler to: {Color black}; - set: #blockEnd for: #PythonTextStyler to: {Color black}; - set: #blockStart1 for: #PythonTextStyler to: {Color green muchDarker}; - set: #blockEnd1 for: #PythonTextStyler to: {Color green muchDarker}; - set: #blockStart2 for: #PythonTextStyler to: {Color magenta muchDarker}; - set: #blockEnd2 for: #PythonTextStyler to: {Color magenta muchDarker}; - set: #blockStart3 for: #PythonTextStyler to: {Color black muchDarker}; - set: #blockEnd3 for: #PythonTextStyler to: {Color black muchDarker}; - set: #blockStart4 for: #PythonTextStyler to: {Color green darker}; - set: #blockEnd4 for: #PythonTextStyler to: {Color green darker}; - set: #blockStart5 for: #PythonTextStyler to: {Color orange darker}; - set: #blockEnd5 for: #PythonTextStyler to: {Color orange darker}; - set: #blockStart6 for: #PythonTextStyler to: {Color magenta darker}; - set: #blockEnd6 for: #PythonTextStyler to: {Color magenta darker}; - set: #blockStart7 for: #PythonTextStyler to: {Color blue}; - set: #blockEnd7 for: #PythonTextStyler to: {Color blue}; - set: #arrayStart for: #PythonTextStyler to: {Color black}; - set: #arrayEnd for: #PythonTextStyler to: {Color black}; - set: #arrayStart1 for: #PythonTextStyler to: {Color black}; - set: #arrayEnd1 for: #PythonTextStyler to: {Color black}; - set: #byteArrayStart for: #PythonTextStyler to: {Color black}; - set: #byteArrayEnd for: #PythonTextStyler to: {Color black}; - set: #byteArrayStart1 for: #PythonTextStyler to: {Color black}; - set: #byteArrayEnd1 for: #PythonTextStyler to: {Color black}; - set: #leftBrace for: #PythonTextStyler to: {Color black}; - set: #rightBrace for: #PythonTextStyler to: {Color black}; - set: #cascadeSeparator for: #PythonTextStyler to: {Color black}; - set: #statementSeparator for: #PythonTextStyler to: {Color black}; - set: #externalCallType for: #PythonTextStyler to: {Color black}; - set: #externalCallTypePointerIndicator for: #PythonTextStyler to: {Color black}; - set: #primitiveOrExternalCallStart for: #PythonTextStyler to: {Color black}; - set: #primitiveOrExternalCallEnd for: #PythonTextStyler to: {Color black}; - set: #methodTempBar for: #PythonTextStyler to: {Color gray}; - set: #blockTempBar for: #PythonTextStyler to: {Color gray}; - set: #blockArgsBar for: #PythonTextStyler to: {Color gray}; - set: #primitive for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; - set: #pragmaKeyword for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; - set: #pragmaUnary for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; - set: #pragmaBinary for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; - set: #externalFunctionCallingConvention for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; - set: #module for: #PythonTextStyler to: {Color green muchDarker. TextEmphasis bold}; - set: #blockTempVar for: #PythonTextStyler to: {Color gray}; - set: #blockPatternTempVar for: #PythonTextStyler to: {Color gray}; - set: #instVar for: #PythonTextStyler to: {Color black}; - set: #workspaceVar for: #PythonTextStyler to: {Color black}; - set: #undefinedIdentifier for: #PythonTextStyler to: {Color black}; - set: #incompleteIdentifier for: #PythonTextStyler to: {Color gray darker. {TextEmphasis italic. TextEmphasis underlined}}; - set: #tempVar for: #PythonTextStyler to: {Color gray darker}; - set: #patternTempVar for: #PythonTextStyler to: {Color gray darker}; - set: #poolConstant for: #PythonTextStyler to: {Color gray muchDarker}; - set: #classVar for: #PythonTextStyler to: {Color gray muchDarker}; - set: #globalVar for: #PythonTextStyler to: {Color black}. - - "And the text differ" - theme - set: #insertTextAttributes for: #TextDiffBuilder to: { TextColor black }; - set: #removeTextAttributes for: #TextDiffBuilder to: { TextEmphasis struckOut. TextColor blue }; - set: #normalTextAttributes for: #TextDiffBuilder to: { TextEmphasis normal }. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/methodProperties.json b/repository/PyPy.package/PythonTheme.class/methodProperties.json index 18dfd321..0d9214a2 100644 --- a/repository/PyPy.package/PythonTheme.class/methodProperties.json +++ b/repository/PyPy.package/PythonTheme.class/methodProperties.json @@ -1,5 +1,36 @@ { "class" : { - }, + "addButtons:" : "fn 2/10/2017 12:02", + "addDialogs:" : "fn 2/10/2017 11:49", + "addFonts:" : "fn 2/10/2017 10:26", + "addMenusAndDockingBars:" : "fn 2/10/2017 14:23", + "addScrollables:" : "fn 2/10/2017 12:28", + "addSyntaxHighlighting:" : "fn 2/10/2017 14:03", + "addToolColors:" : "fn 2/10/2017 11:58", + "addWindowColors:" : "fn 2/10/2017 11:59", + "argumentColor" : "fn 2/10/2017 14:04", + "backgroundColor" : "fn 2/10/2017 11:00", + "backgroundForm" : "fn 2/10/2017 11:02", + "blue" : "fn 2/10/2017 14:03", + "builtinConstColor" : "fn 2/10/2017 10:59", + "commentColor" : "fn 2/10/2017 14:02", + "create" : "fn 2/10/2017 11:51", + "focusedLabelColor" : "fn 2/10/2017 11:18", + "foregroundColor" : "fn 2/10/2017 14:02", + "globalColor" : "fn 2/10/2017 14:02", + "green" : "fn 2/10/2017 11:57", + "highlightColor" : "fn 2/10/2017 11:32", + "keywordColor" : "fn 2/10/2017 14:03", + "magenta" : "fn 2/10/2017 14:03", + "numberColor" : "fn 2/10/2017 14:02", + "orange" : "fn 2/10/2017 14:04", + "red" : "fn 2/10/2017 11:58", + "stringColor" : "fn 2/10/2017 10:58", + "textColor" : "fn 2/10/2017 11:18", + "textSelectionColor" : "fn 2/10/2017 11:35", + "unfocusedLabelColor" : "fn 2/10/2017 11:10", + "variableColor" : "fn 2/10/2017 10:59", + "windowColor" : "fn 2/10/2017 11:02", + "yellow" : "fn 2/10/2017 11:58" }, "instance" : { - "addSyntaxHighlighting:" : "fn 12/19/2016 13:37" } } + } } diff --git a/repository/PyPy.package/PythonTheme.class/properties.json b/repository/PyPy.package/PythonTheme.class/properties.json index 9922bec0..2241b13d 100644 --- a/repository/PyPy.package/PythonTheme.class/properties.json +++ b/repository/PyPy.package/PythonTheme.class/properties.json @@ -10,5 +10,5 @@ "name" : "PythonTheme", "pools" : [ ], - "super" : "SqueakTheme", + "super" : "UserInterfaceTheme", "type" : "normal" } diff --git a/repository/PyPy.package/PythonWorkspace.class/class/foo.st b/repository/PyPy.package/PythonWorkspace.class/class/foo.st deleted file mode 100644 index ad14d1a1..00000000 --- a/repository/PyPy.package/PythonWorkspace.class/class/foo.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -foo - Python primResume \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/instance/foo.st b/repository/PyPy.package/PythonWorkspace.class/instance/foo.st deleted file mode 100644 index ad14d1a1..00000000 --- a/repository/PyPy.package/PythonWorkspace.class/instance/foo.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -foo - Python primResume \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json index 72b145f2..53f02898 100644 --- a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json +++ b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json @@ -1,7 +1,5 @@ { "class" : { - "foo" : "fn 1/13/2017 18:57", "open" : "fn 12/22/2016 02:51" }, "instance" : { - "doItReceiver" : "fn 12/22/2016 02:52", - "foo" : "fn 1/13/2017 18:58" } } + "doItReceiver" : "fn 12/22/2016 02:52" } } diff --git a/repository/PyPy.package/monticello.meta/version b/repository/PyPy.package/monticello.meta/version index 5737cac5..4ce87363 100644 --- a/repository/PyPy.package/monticello.meta/version +++ b/repository/PyPy.package/monticello.meta/version @@ -1 +1 @@ -(name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 042192e6d570539ffc2dcc798f83b87166624d3a Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 10 Feb 2017 21:12:52 +0100 Subject: [PATCH 068/193] Further improve exception detection --- rsqueakvm/plugins/python/patching.py | 68 ++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 5a9ec4a7..4a259247 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,8 +1,7 @@ from rsqueakvm.plugins.python import global_state as gs -from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver from pypy.interpreter.pyopcode import SApplicationException - +from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver from pypy.tool.stdlib_opcode import bytecode_spec opcodedesc = bytecode_spec.opcodedesc @@ -32,17 +31,50 @@ def new_execute_frame(self, w_inputvalue=None, operr=None): return new_execute_frame(new_frame, w_inputvalue, operr) -def get_exception(self, handlerposition): - "Retrieve exception to catch" - next_opcode = ord(self.pycode.co_code[handlerposition + 1]) +def block_handles_exception(self, block, operr_type): + "Returns True if block is able to handle operr_type" + current_opcode = ord(self.pycode.co_code[block.handlerposition]) + if current_opcode == opcodedesc.POP_TOP.index: + # Check for catch all `except` statement + jump_pos = block.handlerposition - 3 + if jump_pos < 0: # This cannot succeed + return False + prev_opcode = ord(self.pycode.co_code[jump_pos]) + if prev_opcode == opcodedesc.JUMP_FORWARD.index: + return True + elif current_opcode != opcodedesc.DUP_TOP.index: + print "Unknown case; expected DUP_TOP" + return True # unknown, so assume it handles exception + next_opcode_idx = block.handlerposition + 1 + next_opcode = ord(self.pycode.co_code[next_opcode_idx]) if next_opcode == opcodedesc.LOAD_GLOBAL.index: - global_index = ord(self.pycode.co_code[handlerposition + 2]) - return self._load_global(self.getname_u(global_index)) + # check for multiple LOAD_GLOBALs + while next_opcode == opcodedesc.LOAD_GLOBAL.index: + global_index = ord(self.pycode.co_code[next_opcode_idx + 1]) + exception = self._load_global(self.getname_u(global_index)) + if gs.py_space.exception_match(operr_type, + w_check_class=exception): + return True + next_opcode_idx = next_opcode_idx + 3 + next_opcode = ord(self.pycode.co_code[next_opcode_idx]) + return False elif next_opcode == opcodedesc.LOAD_NAME.index: - if self.getorcreatedebug().w_locals is self.get_w_globals(): - global_index = ord(self.pycode.co_code[handlerposition + 2]) - return self._load_global(self.getname_u(global_index)) - return None + # check for multiple LOAD_NAMEs + while next_opcode == opcodedesc.LOAD_NAME.index: + nameindex = ord(self.pycode.co_code[next_opcode_idx + 1]) + if self.getorcreatedebug().w_locals is not self.get_w_globals(): + varname = self.getname_u(nameindex) + exception = self.space.finditem_str( + self.getorcreatedebug().w_locals, varname) + else: # fall-back + exception = self._load_global(self.getname_u(nameindex)) + if gs.py_space.exception_match(operr_type, + w_check_class=exception): + return True + next_opcode_idx = next_opcode_idx + 3 + next_opcode = ord(self.pycode.co_code[next_opcode_idx]) + return False + return False def has_exception_handler(self, operr): @@ -51,11 +83,10 @@ def has_exception_handler(self, operr): while frame is not None: block = frame.lastblock while block is not None: - if (block.handling_mask & SApplicationException.kind) != 0: - block_exc = get_exception(frame, block.handlerposition) - if block_exc is not None: - if gs.py_space.exception_match(operr.w_type, block_exc): - return True + # block needs to be an ExceptBlock and able to handle operr + if ((block.handling_mask & SApplicationException.kind) != 0 and + frame.block_handles_exception(block, operr.w_type)): + return True block = block.previous frame = frame.f_backref() return False @@ -65,7 +96,6 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): if isinstance(operr, gs.RestartException): print 'Re-raising RestartException' raise operr - if not self.has_exception_handler(operr): # import pdb; pdb.set_trace() gs.wp_error.set(operr.get_w_value(gs.py_space)) @@ -75,7 +105,7 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): def patch_pypy(): - # Patch-out virtualizables from Pypy so that translation works + # Patch-out virtualizables from PyPy so that translation works try: # TODO: what if first delattr fails? delattr(PyFrame, '_virtualizable_') @@ -85,6 +115,6 @@ def patch_pypy(): PyFrame.__init__ = __init__frame PyFrame.execute_frame = new_execute_frame - PyFrame.get_exception = get_exception + PyFrame.block_handles_exception = block_handles_exception PyFrame.has_exception_handler = has_exception_handler PyFrame.handle_operation_error = new_handle_operation_error From a42eea725bcfc2b76ebf036e08ee73dc492325f5 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 10 Feb 2017 21:15:51 +0100 Subject: [PATCH 069/193] Add & run tests for exception detection in PyFrame --- .build/plugintests.py | 23 +++++++ .travis.yml | 1 + .travis/test.sh | 16 +++-- rsqueakvm/plugins/python/patching.py | 6 +- .../plugins/python/test_pyframe_exceptions.py | 66 +++++++++++++++++++ 5 files changed, 105 insertions(+), 7 deletions(-) create mode 100755 .build/plugintests.py create mode 100644 rsqueakvm/test/plugins/python/test_pyframe_exceptions.py diff --git a/.build/plugintests.py b/.build/plugintests.py new file mode 100755 index 00000000..f5d70f4a --- /dev/null +++ b/.build/plugintests.py @@ -0,0 +1,23 @@ +#! /usr/bin/env python + +import sys +from os import path +from environment import cp, config # import with side effects + +if __name__ == "__main__": + try: + plugin_name = next(arg for arg in sys.argv + if arg.startswith("--plugin=")) + sys.argv.remove(plugin_name) + except StopIteration: + print "No plugin directory provided via --plugin=" + sys.exit(1) + plugin_name = plugin_name.split("=")[1] + sys.argv.append("-s") + sys.argv.append("-vv") + sys.argv.append(path.join( + path.dirname(__file__), "..", + "rsqueakvm", "test", "plugins", plugin_name)) + + import pytest + exit(pytest.main(args=sys.argv[1:])) diff --git a/.travis.yml b/.travis.yml index 5a45d83b..1ef25149 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ env: # - BUILD_ARCH=armv8-a # - BUILD_ARCH=64bit PLUGINS=DatabasePlugin # - BUILD_ARCH=64bit PLUGINS=RubyPlugin + - BUILD_ARCH=64bit TEST_TYPE=plugin TEST_PLUGIN=python - BUILD_ARCH=64bit PLUGINS=PythonPlugin matrix: include: diff --git a/.travis/test.sh b/.travis/test.sh index ebafe625..5a390125 100755 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -1,11 +1,17 @@ #!/bin/sh set -ex +testscript="unittests.py" + case "${TEST_TYPE}" in - default) testflag="-S" ;; - quick) testflag="-Q" ;; - slow) testflag="-S" ;; - coverage) testflag="-v -S --cov=rsqueakvm --cov-append " ;; + default) testflag="-s -S" ;; + quick) testflag="-s -Q" ;; + slow) testflag="-s -S" ;; + coverage) testflag="-s -v -S --cov=rsqueakvm --cov-append " ;; + plugin) + testscript="plugintests.py" + testflag="--plugin=${TEST_PLUGIN}" + ;; *) echo "Wrong TEST_TYPE value (${TEST_TYPE}), not executing tests" exit 0 @@ -22,4 +28,4 @@ if [[ "${TRAVIS_OS_NAME}" == "osx" ]] && [[ "${BUILD_ARCH}" == "64bit" ]]; then ex="pypy" fi -${ex} .build/unittests.py -s ${testflag} +${ex} ".build/${testscript}" ${testflag} diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 4a259247..d05758a0 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -4,6 +4,8 @@ from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver from pypy.tool.stdlib_opcode import bytecode_spec +from rpython.rlib.rarithmetic import intmask + opcodedesc = bytecode_spec.opcodedesc old_init_frame = PyFrame.__init__ @@ -36,9 +38,9 @@ def block_handles_exception(self, block, operr_type): current_opcode = ord(self.pycode.co_code[block.handlerposition]) if current_opcode == opcodedesc.POP_TOP.index: # Check for catch all `except` statement - jump_pos = block.handlerposition - 3 - if jump_pos < 0: # This cannot succeed + if block.handlerposition < 3: # This cannot succeed, see next line return False + jump_pos = intmask(block.handlerposition) - 3 prev_opcode = ord(self.pycode.co_code[jump_pos]) if prev_opcode == opcodedesc.JUMP_FORWARD.index: return True diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py new file mode 100644 index 00000000..b6f873db --- /dev/null +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -0,0 +1,66 @@ +from rsqueakvm.plugins.python.global_state import py_space +from rsqueakvm.plugins.python.patching import patch_pypy + +from pypy.interpreter.error import OperationError +from pypy.interpreter.main import compilecode + +patch_pypy() + + +def check_for_exception_handler(code): + pycode = compilecode(py_space, py_space.wrap(code), '', 'exec') + py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) + try: + py_frame.dispatch_bytecode(pycode.co_code, 0, + py_space.getexecutioncontext()) + except OperationError as operr: + return py_frame.has_exception_handler(operr) + + +def test_simple_exception(): + assert check_for_exception_handler(""" +try: + 1/0 +except ZeroDivisionError: + pass +""") + + +def test_simple_fail_exception(): + assert not check_for_exception_handler("""1/0""") + + +def test_raised_exception(): + assert check_for_exception_handler(""" +try: + raise Exception +except Exception: + pass +""") + + +def test_multiple_exceptions(): + assert check_for_exception_handler(""" +try: + list()[1] +except (ValueError, IndexError): + pass +""") + + +def test_multiple_exceptions_fail(): + assert not check_for_exception_handler(""" +try: + list()[1] +except (ValueError, ZeroDivisionError): + pass +""") + + +def test_catch_all_exception(): + assert check_for_exception_handler(""" +try: + 1/0 +except: + pass +""") From af2fb704e904d5311548bf6b235f353a5bf6dacb Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 20 Feb 2017 12:48:36 +0100 Subject: [PATCH 070/193] Expose Python only entry point --- rsqueakvm/plugins/python/utils.py | 14 ++++++++++++++ targetrsqueak.py | 9 +++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 66809cfb..57f57f2c 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,3 +1,5 @@ +import os + from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.plugins.python.model import W_PythonObject @@ -159,3 +161,15 @@ def call_function(space, wp_func, args_w): return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3, arg4)) return wrap(space, py_space.call_function(wp_func)) + + +def entry_point(argv): + filename = argv[-1] + if not os.path.isfile(filename): + print 'File "%s" does not exist.' % filename + return 1 + with open(filename, 'r') as f: + runstring = f.read() + # import pdb; pdb.set_trace() + _run_eval_string(runstring, '', 'exec') + return 0 diff --git a/targetrsqueak.py b/targetrsqueak.py index 3fc308c4..96c5ddd7 100755 --- a/targetrsqueak.py +++ b/targetrsqueak.py @@ -31,11 +31,16 @@ def target(driver, args): system.expose_options(driver.config) # We must not import this before the config was exposed from rsqueakvm.main import safe_entry_point - ann_policy = None if "PythonPlugin" in system.optional_plugins: from pypy.tool.ann_override import PyPyAnnotatorPolicy ann_policy = PyPyAnnotatorPolicy() - return safe_entry_point, None, ann_policy + # Disable vmprof, because it causes compiling errors + system.disabled_plugins += ',ProfilerPlugin' + if '--python' in sys.argv: + from rsqueakvm.plugins.python.utils import entry_point + return entry_point, None, ann_policy + return safe_entry_point, None, ann_policy + return safe_entry_point, None, None def jitpolicy(self): if "PythonPlugin" in system.optional_plugins: From 4a1bca4a73c5fe37ad8fb42b6952cbcd0cb25ed7 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 20 Feb 2017 13:27:53 +0100 Subject: [PATCH 071/193] Fix method name --- rsqueakvm/plugins/python/utils.py | 2 +- rsqueakvm/plugins/python_plugin.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 57f57f2c..762d2a57 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -90,7 +90,7 @@ def unwrap(space, w_object): raise PrimitiveFailedError -def getPyCode(source, filename, cmd): +def get_pycode(source, filename, cmd): # source = 'def __dummy__():\n%s\n' % '\n'.join( # [' %s' % line for line in source.split('\n')]) print 'Trying to patch:\n%s' % source diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 4cf0d817..1bb026b0 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -12,7 +12,7 @@ from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.plugins.python.patching import patch_pypy from rsqueakvm.plugins.python.utils import ( - wrap, unwrap, call_function, call_method, getPyCode, _run_eval_string) + wrap, unwrap, call_function, call_method, get_pycode, _run_eval_string) from pypy.interpreter.error import OperationError from pypy.interpreter.function import (BuiltinFunction, Function, Method, @@ -133,7 +133,7 @@ def restartFrame(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str]) def restartFrameWith(interp, s_frame, w_rcvr, source, filename, cmd): # import pdb; pdb.set_trace() - py_code = getPyCode(source, filename, cmd) + py_code = get_pycode(source, filename, cmd) if py_code is None: return interp.space.w_false # Raising prim error causes crashes global_state.py_frame_restart_info.set( @@ -149,7 +149,7 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, frame = w_frame.wp_object py_code = None if source: - py_code = getPyCode(source, filename, cmd) + py_code = get_pycode(source, filename, cmd) if py_code is None: return interp.space.w_false # Raising prim error causes crashes global_state.py_frame_restart_info.set( From 2083bbbb94ab26a2fec6f84ca3251f4429d66f53 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 20 Feb 2017 14:00:18 +0100 Subject: [PATCH 072/193] Add more tests for exception detection --- .../plugins/python/test_pyframe_exceptions.py | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index b6f873db..7e6601d1 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -57,10 +57,68 @@ def test_multiple_exceptions_fail(): """) -def test_catch_all_exception(): +def test_catch_all_exceptions(): assert check_for_exception_handler(""" try: 1/0 except: pass """) + + +def test_catch_variable_exception(): + assert check_for_exception_handler(""" +ex = IndexError +if True: + ex = ZeroDivisionError +try: + 1/0 +except ex: + pass +""") + + +def test_catch_variable_exception_fail(): + assert not check_for_exception_handler(""" +ex = ZeroDivisionError +if True: + ex = IndexError +try: + 1/0 +except ex: + pass +""") + + +def test_catch_multiple_variable_exceptions(): + assert check_for_exception_handler(""" +ex = (ValueError, ZeroDivisionError) +try: + 1/0 +except ex: + pass +""") + + +def test_catch_nested_exceptions(): + assert check_for_exception_handler(""" +try: + try: + 1/0 + except ValueError: + pass +except ZeroDivisionError: + pass +""") + + +def test_catch_nested_exceptions_fail(): + assert not check_for_exception_handler(""" +try: + try: + 1/0 + except ValueError: + pass +except IndexError: + pass +""") From 31b0c59515ca3d2048c830e96c31a66c29a3be2f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 20 Feb 2017 17:16:08 +0100 Subject: [PATCH 073/193] Wrap RSqueak entry point --- rsqueakvm/plugins/python/utils.py | 21 ++++++++++++--------- targetrsqueak.py | 6 ++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 762d2a57..fdfc7cca 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,6 +1,7 @@ import os from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.main import safe_entry_point from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.global_state import py_space @@ -164,12 +165,14 @@ def call_function(space, wp_func, args_w): def entry_point(argv): - filename = argv[-1] - if not os.path.isfile(filename): - print 'File "%s" does not exist.' % filename - return 1 - with open(filename, 'r') as f: - runstring = f.read() - # import pdb; pdb.set_trace() - _run_eval_string(runstring, '', 'exec') - return 0 + if '--python' in argv: + filename = argv[-1] + if not os.path.isfile(filename): + print 'File "%s" does not exist.' % filename + return 1 + with open(filename, 'r') as f: + runstring = f.read() + # import pdb; pdb.set_trace() + _run_eval_string(runstring, '', 'exec') + return 0 + return safe_entry_point(argv) diff --git a/targetrsqueak.py b/targetrsqueak.py index 96c5ddd7..f6f0fdbc 100755 --- a/targetrsqueak.py +++ b/targetrsqueak.py @@ -32,14 +32,12 @@ def target(driver, args): # We must not import this before the config was exposed from rsqueakvm.main import safe_entry_point if "PythonPlugin" in system.optional_plugins: + from rsqueakvm.plugins.python.utils import entry_point from pypy.tool.ann_override import PyPyAnnotatorPolicy ann_policy = PyPyAnnotatorPolicy() # Disable vmprof, because it causes compiling errors system.disabled_plugins += ',ProfilerPlugin' - if '--python' in sys.argv: - from rsqueakvm.plugins.python.utils import entry_point - return entry_point, None, ann_policy - return safe_entry_point, None, ann_policy + return entry_point, None, ann_policy return safe_entry_point, None, None def jitpolicy(self): From 91ebe448d8354cec8945f8b19677a42f498790c1 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 20 Feb 2017 17:25:43 +0100 Subject: [PATCH 074/193] Fix compilation --- rsqueakvm/plugins/python/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index fdfc7cca..f4940d97 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,7 +1,6 @@ import os from rsqueakvm.error import PrimitiveFailedError -from rsqueakvm.main import safe_entry_point from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.global_state import py_space @@ -165,6 +164,7 @@ def call_function(space, wp_func, args_w): def entry_point(argv): + from rsqueakvm.main import safe_entry_point if '--python' in argv: filename = argv[-1] if not os.path.isfile(filename): From 7ac09cd1b13bd3a319685b1d8a96832787f5b31a Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 20 Feb 2017 17:36:43 +0100 Subject: [PATCH 075/193] Use newbytes instead of wrap which is not RPython --- rsqueakvm/plugins/python/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index f4940d97..6d5f1bf0 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -23,17 +23,17 @@ def _run_eval_string(source, filename, cmd): # Adopted from PyPy's main.py try: - w = py_space.wrap + ws = py_space.newbytes - pycode = compilecode(py_space, w(source), filename or '', cmd) + pycode = compilecode(py_space, ws(source), filename or '', cmd) mainmodule = ensure__main__(py_space) assert isinstance(mainmodule, Module) w_globals = mainmodule.w_dict - py_space.setitem(w_globals, w('__builtins__'), py_space.builtin) + py_space.setitem(w_globals, ws('__builtins__'), py_space.builtin) if filename is not None: - py_space.setitem(w_globals, w('__file__'), w(filename)) + py_space.setitem(w_globals, ws('__file__'), ws(filename)) return pycode.exec_code(py_space, w_globals, w_globals) From 45198c96d44ac55639ea5e665e9266cba82003b2 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 21 Feb 2017 08:17:22 +0100 Subject: [PATCH 076/193] Adopt ensure__main__ and compilecode --- rsqueakvm/plugins/python/utils.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 6d5f1bf0..a9db67ed 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -6,8 +6,8 @@ from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.model.variable import W_BytesObject +from pypy.interpreter import eval, module from pypy.interpreter.error import OperationError -from pypy.interpreter.main import compilecode, ensure__main__ from pypy.interpreter.module import Module from pypy.interpreter.pycode import PyCode from pypy.module.__builtin__ import compiling as py_compiling @@ -20,6 +20,30 @@ from rpython.rlib import objectmodel +def ensure__main__(space): + # Adopted from PyPy's main.py + w_main = space.newbytes('__main__') + w_modules = space.sys.get('modules') + try: + return space.getitem(w_modules, w_main) + except OperationError as e: + if not e.match(space, space.w_KeyError): + raise + mainmodule = module.Module(space, w_main) + space.setitem(w_modules, w_main, mainmodule) + return mainmodule + + +def compilecode(space, source, filename, cmd='exec'): + # Adopted from PyPy's main.py + ws = space.newbytes + w_code = space.builtin.call( + 'compile', ws(source), ws(filename), ws(cmd), + space.newint(0), space.newint(0)) + pycode = space.interp_w(eval.Code, w_code) + return pycode + + def _run_eval_string(source, filename, cmd): # Adopted from PyPy's main.py try: @@ -173,6 +197,6 @@ def entry_point(argv): with open(filename, 'r') as f: runstring = f.read() # import pdb; pdb.set_trace() - _run_eval_string(runstring, '', 'exec') + _run_eval_string(runstring, filename, 'exec') return 0 return safe_entry_point(argv) From d67bf4ccb2c06386691e17a64a956bfa3f2f076f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 21 Feb 2017 08:21:38 +0100 Subject: [PATCH 077/193] Avoid to use py_space.wrap (NOT_RPYTHON) --- rsqueakvm/plugins/python/model.py | 4 ++-- rsqueakvm/plugins/python/py_objspace.py | 12 ++++++------ rsqueakvm/plugins/python/utils.py | 4 ++-- rsqueakvm/plugins/python_plugin.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 9e05b892..3592e645 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -97,11 +97,11 @@ def make_method(self, w_selector): if py_attr is None: # check instance vars and methods py_attr = py_space.getattr(self.wp_object, - py_space.wrap(methodname)) + py_space.newbytes(methodname)) if py_attr is None: # check class vars and methods py_attr = py_space.getattr(self.wp_class, - py_space.wrap(methodname)) + py_space.newbytes(methodname)) except OperationError: pass except Exception as e: diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index 2cb19e54..361ecdca 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -67,17 +67,17 @@ def new_pypy_objspace(): # equivalent to the hack in app_main.py of PyPy, albiet interp-level. w_sys = py_space.sys w_modnames = w_sys.get('builtin_module_names') - w_in = py_space.contains(w_modnames, py_space.wrap('__pypy__')) + w_in = py_space.contains(w_modnames, py_space.newbytes('__pypy__')) if not py_space.is_true(w_in): rl = py_space.sys.get('setrecursionlimit') - py_space.call(rl, py_space.newlist([py_space.wrap(5000)])) + py_space.call(rl, py_space.newlist([py_space.newint(5000)])) # Should always be able to import Python modules in CWD. - w_sys_path = py_space.getattr(w_sys, py_space.wrap('path')) - py_space.call_method(w_sys_path, 'append', py_space.wrap('.')) + w_sys_path = py_space.getattr(w_sys, py_space.newbytes('path')) + py_space.call_method(w_sys_path, 'append', py_space.newbytes('.')) # Set sys.executable in PyPy -- some modules rely upon this existing. - py_space.setattr(w_sys, py_space.wrap('executable'), - py_space.wrap(os.path.abspath(sys.argv[0]))) + py_space.setattr(w_sys, py_space.newbytes('executable'), + py_space.newbytes(os.path.abspath(sys.argv[0]))) return py_space diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index a9db67ed..da0ff9c7 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -49,7 +49,7 @@ def _run_eval_string(source, filename, cmd): try: ws = py_space.newbytes - pycode = compilecode(py_space, ws(source), filename or '', cmd) + pycode = compilecode(py_space, source, filename or '', cmd) mainmodule = ensure__main__(py_space) assert isinstance(mainmodule, Module) @@ -119,7 +119,7 @@ def get_pycode(source, filename, cmd): # [' %s' % line for line in source.split('\n')]) print 'Trying to patch:\n%s' % source try: - py_code = py_compiling.compile(py_space, py_space.wrap(source), + py_code = py_compiling.compile(py_space, py_space.newbytes(source), filename, cmd) assert isinstance(py_code, PyCode) co_consts_w_len = len(py_code.co_consts_w) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 1bb026b0..aba5539b 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -197,7 +197,7 @@ def send(interp, s_frame, argcount, w_method): w_result = args_w[0] w_result = space.wrap_float(0) else: - py_attr = py_space.getattr(wp_rcvr, py_space.wrap(methodname)) + py_attr = py_space.getattr(wp_rcvr, py_space.newbytes(methodname)) # Only allow to call certain types (e.g. don't allow __class__()) if (isinstance(py_attr, Function) or isinstance(py_attr, Method) or @@ -206,7 +206,7 @@ def send(interp, s_frame, argcount, w_method): w_result = call_method(space, wp_rcvr, methodname, args_w) else: if len(args_w) == 1: - py_space.setattr(wp_rcvr, py_space.wrap(methodname), + py_space.setattr(wp_rcvr, py_space.newbytes(methodname), unwrap(space, args_w[0])) w_result = space.w_nil else: From 06b84b178f316fee7f6877c8182ed3d46c692bff Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 21 Feb 2017 15:31:01 +0100 Subject: [PATCH 078/193] Improve error handling; misc changes --- rsqueakvm/plugins/python/execution.py | 18 +++++++++--------- rsqueakvm/plugins/python/patching.py | 2 +- rsqueakvm/plugins/python_plugin.py | 11 ++++++----- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 9854b575..28195ee4 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -47,24 +47,24 @@ def run(self): # ensure py_space has a fresh exectioncontext gs.py_space.threadlocals.enter_thread(gs.py_space) + # switch back to Squeak before executing Python code + gs.switch_action.perform() + retval = _run_eval_string(self.source, self.filename, self.cmd) self.save_result(retval) - except OperationError as e: - print e.errorstr(gs.py_space) - self.handle_error(e.get_w_value(gs.py_space)) + except OperationError as operr: + # operr was not handled by users, because they pressed proceed. + # save Python error as result instead. + self.save_result(operr.get_w_value(gs.py_space)) except Exception as e: print 'Unknown error in Python thread: %s' % e - - self._resumable = False + finally: + self._resumable = False def save_result(self, result): gs.wp_error.set(None) # unset last error gs.wp_result.set(result) - def handle_error(self, error): - gs.wp_result.set(None) # unset last result - gs.wp_error.set(error) - class GlobalState: def clear(self): diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index d05758a0..490ccc0e 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -14,9 +14,9 @@ def __init__frame(self, space, code, w_globals, outer_func): + old_init_frame(self, space, code, w_globals, outer_func) self.w_globals = w_globals self.outer_func = outer_func - old_init_frame(self, space, code, w_globals, outer_func) def new_execute_frame(self, w_inputvalue=None, operr=None): diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index aba5539b..ccd4fffe 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -47,10 +47,10 @@ def eval(interp, s_frame, w_rcvr, source, filename, cmd): # import pdb; pdb.set_trace() retval = _run_eval_string(source, filename, cmd) return wrap(interp.space, retval) - except OperationError as operationerr: - print operationerr.errorstr(py_space) + except OperationError as operr: + print operr.errorstr(py_space) # import pdb; pdb.set_trace() - raise PrimitiveFailedError + return wrap(interp.space, operr.get_w_value(py_space)) except Exception as e: print '[Unknown Exception] %s' % e # import pdb; pdb.set_trace() @@ -218,8 +218,9 @@ def send(interp, s_frame, argcount, w_method): print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) return space.w_nil if w_result is None: - print 'Result failure in send primitive (type: %s, methodname: %s)' % ( - py_space.type(wp_rcvr), methodname) + # import pdb; pdb.set_trace() + print ('Result failure in send primitive (wp_rcvr: %s, methodname: %s)' + % (wp_rcvr, methodname)) return space.w_nil s_frame.pop_n(argcount + 1) return w_result From da6251be02bb96ae99122bd277a5cae89e2e3ba4 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 21 Feb 2017 22:13:52 +0100 Subject: [PATCH 079/193] Clean up primitives and improve error handling --- rsqueakvm/plugins/python/execution.py | 22 ++++---- rsqueakvm/plugins/python/global_state.py | 2 +- rsqueakvm/plugins/python/patching.py | 2 +- rsqueakvm/plugins/python/utils.py | 8 +++ rsqueakvm/plugins/python_plugin.py | 65 ++++-------------------- 5 files changed, 34 insertions(+), 65 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 28195ee4..f8e5d2a6 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -1,7 +1,7 @@ from rsqueakvm.model.compiled_methods import ( W_SpurCompiledMethod, W_PreSpurCompiledMethod) from rsqueakvm.plugins.python import global_state as gs -from rsqueakvm.plugins.python.utils import _run_eval_string +from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist from rpython.rlib.rstacklet import StackletThread from rpython.rlib import objectmodel @@ -27,7 +27,7 @@ def resume_thread(): print 'No runner to resume with' return False runner.resume() - return gs.wp_error.get() is None + return gs.wp_operror.get() is None class ForeignLanguage: @@ -55,15 +55,15 @@ def run(self): except OperationError as operr: # operr was not handled by users, because they pressed proceed. # save Python error as result instead. - self.save_result(operr.get_w_value(gs.py_space)) + self.save_result(operr_to_pylist(operr)) except Exception as e: print 'Unknown error in Python thread: %s' % e finally: self._resumable = False def save_result(self, result): - gs.wp_error.set(None) # unset last error gs.wp_result.set(result) + gs.wp_operror.set(None) # unset last error class GlobalState: @@ -143,7 +143,7 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): # print 'Switch to Smalltalk' wp_result = gs.wp_result.get() if wp_result is not None: - return _handle_result(interp.space, wp_result) + return _create_return_frame(interp.space, wp_result) resume_method = gs.w_python_resume_method.get() s_resume_frame = ContextPartShadow.build_method_context( @@ -165,11 +165,11 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): return s_resume_frame -def _handle_result(space, wp_result): +def _create_return_frame(space, wp_result): from rsqueakvm.storage_contexts import ContextPartShadow from rsqueakvm.plugins.python.utils import wrap print 'Python has finished and returned a result' - # we want evalInThread and resumePython to retun new frames, + # we want evalInThread and resumePython to return new frames, # so we don't build up stack, but we also don't raise to the # top-level loop all the time. # For resuming, we obviously need a new frame, because that's @@ -182,17 +182,21 @@ def _handle_result(space, wp_result): w_cm = objectmodel.instantiate(W_SpurCompiledMethod) else: w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_python_class = gs.w_python_class.get() w_cm.header = 0 w_cm._primitive = 0 w_cm.literalsize = 3 w_cm.islarge = False w_cm._tempsize = 0 w_cm.argsize = 0 + w_cm.compiledin_class = w_python_class.getclass(space) + w_cm.lookup_selector = 'fakeReturnResult' w_cm.bytes = [chr(b) for b in [ 0x20, # push constant 0x7C, # return stack top ]] - w_cm.literals = [wrap(space, wp_result), space.w_nil, space.w_nil] + w_cm.literals = [wrap(space, wp_result), space.w_nil, + w_cm.compiledin_class] gs.wp_result.set(None) return ContextPartShadow.build_method_context( - space, w_cm, gs.w_python_class.get()) + space, w_cm, w_python_class) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 91280e5b..5ab14e45 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -48,7 +48,7 @@ def perform(self, ec=None, frame=None): py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) wp_result = Cell(None, type=WP_Root) -wp_error = Cell(None, type=WP_Root) +wp_operror = Cell(None, type=WP_Root) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 490ccc0e..8abd7ef5 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -100,7 +100,7 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): raise operr if not self.has_exception_handler(operr): # import pdb; pdb.set_trace() - gs.wp_error.set(operr.get_w_value(gs.py_space)) + gs.wp_operror.set(operr) print 'Python error caught' gs.switch_action.perform() return old_handle_operation_error(self, ec, operr, attach_tb) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index da0ff9c7..f72a5df8 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -187,6 +187,14 @@ def call_function(space, wp_func, args_w): return wrap(space, py_space.call_function(wp_func)) +def operr_to_pylist(operr): + assert isinstance(operr, OperationError) + wp_exception = py_space.wrap(operr.w_type.getname(py_space)) + wp_value = operr.get_w_value(py_space) + wp_traceback = py_space.wrap(operr.get_traceback()) + return py_space.newlist([wp_exception, wp_value, wp_traceback]) + + def entry_point(argv): from rsqueakvm.main import safe_entry_point if '--python' in argv: diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index ccd4fffe..b67aee14 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -8,11 +8,10 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts -from rsqueakvm.plugins.python import model, global_state +from rsqueakvm.plugins.python import model, global_state, utils from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.plugins.python.patching import patch_pypy -from rsqueakvm.plugins.python.utils import ( - wrap, unwrap, call_function, call_method, get_pycode, _run_eval_string) +from rsqueakvm.plugins.python.utils import wrap, unwrap from pypy.interpreter.error import OperationError from pypy.interpreter.function import (BuiltinFunction, Function, Method, @@ -41,29 +40,13 @@ def startup(space, argv): PluginStartupScripts.append(startup) -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str]) -def eval(interp, s_frame, w_rcvr, source, filename, cmd): - try: - # import pdb; pdb.set_trace() - retval = _run_eval_string(source, filename, cmd) - return wrap(interp.space, retval) - except OperationError as operr: - print operr.errorstr(py_space) - # import pdb; pdb.set_trace() - return wrap(interp.space, operr.get_w_value(py_space)) - except Exception as e: - print '[Unknown Exception] %s' % e - # import pdb; pdb.set_trace() - raise PrimitiveFailedError - - @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str], result_is_new_frame=True) -def evalInThread(interp, s_frame, w_rcvr, source, filename, cmd): +def eval(interp, s_frame, w_rcvr, source, filename, cmd): from rsqueakvm.plugins.python import execution # Reset error and state global_state.wp_result.set(None) - global_state.wp_error.set(None) + global_state.wp_operror.set(None) # import pdb; pdb.set_trace() execution.start_new_thread( source, filename, cmd, translated=PythonPlugin.we_are_translated()) @@ -99,18 +82,10 @@ def lastResult(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object]) def lastError(interp, s_frame, w_rcvr): - wp_error = global_state.wp_error.get() - if wp_error is None: - raise PrimitiveFailedError - return wrap(interp.space, wp_error) - - -@PythonPlugin.expose_primitive(unwrap_spec=[object]) -def asSmalltalk(interp, s_frame, w_rcvr): - # import pdb; pdb.set_trace() - if not isinstance(w_rcvr, model.W_PythonObject): + operr = global_state.wp_operror.get() + if operr is None: raise PrimitiveFailedError - return wrap(interp.space, w_rcvr.wp_object) + return wrap(interp.space, utils.operr_to_pylist(operr)) @PythonPlugin.expose_primitive(unwrap_spec=[object]) @@ -122,25 +97,6 @@ def getTopFrame(interp, s_frame, w_rcvr): return wrap(interp.space, topframe) -@PythonPlugin.expose_primitive(unwrap_spec=[object]) -def restartFrame(interp, s_frame, w_rcvr): - # import pdb; pdb.set_trace() - global_state.py_frame_restart_info.set( - global_state.PyFrameRestartInfo()) - return interp.space.w_true - - -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str]) -def restartFrameWith(interp, s_frame, w_rcvr, source, filename, cmd): - # import pdb; pdb.set_trace() - py_code = get_pycode(source, filename, cmd) - if py_code is None: - return interp.space.w_false # Raising prim error causes crashes - global_state.py_frame_restart_info.set( - global_state.PyFrameRestartInfo(code=py_code)) - return interp.space.w_true - - @PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str, str]) def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, cmd): @@ -149,7 +105,7 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, frame = w_frame.wp_object py_code = None if source: - py_code = get_pycode(source, filename, cmd) + py_code = utils.get_pycode(source, filename, cmd) if py_code is None: return interp.space.w_false # Raising prim error causes crashes global_state.py_frame_restart_info.set( @@ -175,7 +131,7 @@ def send(interp, s_frame, argcount, w_method): if wp_rcvr is py_space.builtin: builtin = py_space.builtin.get(methodname) if isinstance(builtin, BuiltinFunction): - w_result = call_function(space, builtin, args_w) + w_result = utils.call_function(space, builtin, args_w) if isinstance(builtin, WP_TypeObject): if methodname == 'tuple': w_result = wrap(space, py_space.newtuple( @@ -203,7 +159,8 @@ def send(interp, s_frame, argcount, w_method): isinstance(py_attr, Method) or isinstance(py_attr, StaticMethod) or isinstance(py_attr, ClassMethod)): - w_result = call_method(space, wp_rcvr, methodname, args_w) + w_result = utils.call_method( + space, wp_rcvr, methodname, args_w) else: if len(args_w) == 1: py_space.setattr(wp_rcvr, py_space.newbytes(methodname), From 98b4611fdac45ab474aae9c005ab4bed6d5905ec Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 21 Feb 2017 22:15:01 +0100 Subject: [PATCH 080/193] Fix Python class>>resumeFrame Also remove deprecated methods and improve theme [ci skip] --- .../Python.class/class/evalInThread.cmd..st | 5 ----- .../class/openDebuggerWithPythonFrames..st | 11 +++++++++-- .../class/openDebuggerWithPythonFrames.st | 6 ++++++ .../Python.class/class/primAsSmalltalk..st | 4 ---- .../Python.class/class/primEvalInThread.cmd..st | 5 ----- .../class/primEvalInThread.filename.cmd..st | 5 ----- .../Python.class/class/primRestartFrame.st | 5 ----- .../class/primRestartFrameWith.filename.cmd..st | 5 ----- .../PyPy.package/Python.class/class/resumeFrame.st | 7 ++++--- .../PyPy.package/Python.class/methodProperties.json | 11 +++-------- .../class/{newContext.st => newPyContext.st} | 2 +- ...ndPythonContexts..st => prependPythonContexts..st} | 9 +++++---- .../PythonDebugger.class/instance/contextForStack..st | 2 +- .../PythonDebugger.class/instance/selectedMessage.st | 4 ++-- .../PythonDebugger.class/methodProperties.json | 8 ++++---- .../PythonTheme.class/class/addButtons..st | 6 +++--- .../PythonTheme.class/class/addDialogs..st | 8 ++++---- .../PythonTheme.class/methodProperties.json | 4 ++-- repository/PyPy.package/monticello.meta/version | 2 +- 19 files changed, 45 insertions(+), 64 deletions(-) delete mode 100644 repository/PyPy.package/Python.class/class/evalInThread.cmd..st create mode 100644 repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames.st delete mode 100644 repository/PyPy.package/Python.class/class/primAsSmalltalk..st delete mode 100644 repository/PyPy.package/Python.class/class/primEvalInThread.cmd..st delete mode 100644 repository/PyPy.package/Python.class/class/primEvalInThread.filename.cmd..st delete mode 100644 repository/PyPy.package/Python.class/class/primRestartFrame.st delete mode 100644 repository/PyPy.package/Python.class/class/primRestartFrameWith.filename.cmd..st rename repository/PyPy.package/PythonDebugger.class/class/{newContext.st => newPyContext.st} (92%) rename repository/PyPy.package/PythonDebugger.class/class/{appendPythonContexts..st => prependPythonContexts..st} (73%) diff --git a/repository/PyPy.package/Python.class/class/evalInThread.cmd..st b/repository/PyPy.package/Python.class/class/evalInThread.cmd..st deleted file mode 100644 index 397b9827..00000000 --- a/repository/PyPy.package/Python.class/class/evalInThread.cmd..st +++ /dev/null @@ -1,5 +0,0 @@ -experimental -evalInThread: source cmd: evalOrExec - | filename | - filename := self persistPyCode: source. - ^ self primEvalInThread: source filename: filename cmd: evalOrExec \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st b/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st index 82fa196e..08930815 100644 --- a/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st +++ b/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st @@ -1,8 +1,15 @@ system primitives openDebuggerWithPythonFrames: pyError + | resumeCtx | + resumeCtx := thisContext sender. + [ resumeCtx method selector = #resumeFrame + and: [ resumeCtx closure isNil ] ] + whileFalse: [ + resumeCtx := resumeCtx sender. + resumeCtx ifNil: [ ^ self error: 'resumeCtx not found' ] ]. PythonDebugger openOn: Processor activeProcess - context: (PythonDebugger appendPythonContexts: thisContext) - label: pyError class asString, ': ', pyError asString + context: (PythonDebugger prependPythonContexts: resumeCtx) + label: pyError first, ': ', pyError second contents: nil fullView: true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames.st b/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames.st new file mode 100644 index 00000000..1bb37408 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames.st @@ -0,0 +1,6 @@ +system primitives +openDebuggerWithPythonFrames + self primLastError + ifNil: [ self error: 'No Python error detected' ] + ifNotNil: [ :e | self openDebuggerWithPythonFrames: e ] + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primAsSmalltalk..st b/repository/PyPy.package/Python.class/class/primAsSmalltalk..st deleted file mode 100644 index 7b88f667..00000000 --- a/repository/PyPy.package/Python.class/class/primAsSmalltalk..st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primAsSmalltalk: anObj - - self primitiveFailed. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primEvalInThread.cmd..st b/repository/PyPy.package/Python.class/class/primEvalInThread.cmd..st deleted file mode 100644 index e89cc283..00000000 --- a/repository/PyPy.package/Python.class/class/primEvalInThread.cmd..st +++ /dev/null @@ -1,5 +0,0 @@ -experimental -primEvalInThread: source cmd: evalOrExec - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primEvalInThread.filename.cmd..st b/repository/PyPy.package/Python.class/class/primEvalInThread.filename.cmd..st deleted file mode 100644 index 1aa98e7f..00000000 --- a/repository/PyPy.package/Python.class/class/primEvalInThread.filename.cmd..st +++ /dev/null @@ -1,5 +0,0 @@ -experimental -primEvalInThread: source filename: aFilename cmd: evalOrExec - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primRestartFrame.st b/repository/PyPy.package/Python.class/class/primRestartFrame.st deleted file mode 100644 index ae2f82d6..00000000 --- a/repository/PyPy.package/Python.class/class/primRestartFrame.st +++ /dev/null @@ -1,5 +0,0 @@ -experimental -primRestartFrame - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primRestartFrameWith.filename.cmd..st b/repository/PyPy.package/Python.class/class/primRestartFrameWith.filename.cmd..st deleted file mode 100644 index 5dbd31b0..00000000 --- a/repository/PyPy.package/Python.class/class/primRestartFrameWith.filename.cmd..st +++ /dev/null @@ -1,5 +0,0 @@ -experimental -primRestartFrameWith: pySource filename: aFilename cmd: evalOrExec - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/resumeFrame.st b/repository/PyPy.package/Python.class/class/resumeFrame.st index d6d962bf..a13fce40 100644 --- a/repository/PyPy.package/Python.class/class/resumeFrame.st +++ b/repository/PyPy.package/Python.class/class/resumeFrame.st @@ -1,6 +1,7 @@ -system primitives +special methods resumeFrame "Magic method that is called by vm (cached in vm)" Processor yield. - self primLastError ifNotNil: [ :e | self openDebuggerWithPythonFrames: e ]. - self primResume \ No newline at end of file + [ ^ self primResume ] on: Error do: [ + self openDebuggerWithPythonFrames. + ^ self resumeFrame ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/methodProperties.json b/repository/PyPy.package/Python.class/methodProperties.json index 607ca7d1..b82fe997 100644 --- a/repository/PyPy.package/Python.class/methodProperties.json +++ b/repository/PyPy.package/Python.class/methodProperties.json @@ -2,7 +2,6 @@ "class" : { "builtins" : "fn 12/20/2016 13:47", "eval:" : "fn 2/1/2017 11:04", - "evalInThread:cmd:" : "fn 2/1/2017 17:52", "evaluatorClass" : "fn 12/22/2016 02:53", "exec:" : "fn 2/1/2017 11:05", "from:import:" : "fn 1/9/2017 20:54", @@ -13,18 +12,14 @@ "import:" : "fn 1/9/2017 20:54", "isCallable:" : "fn 12/19/2016 02:18", "load:" : "fn 1/9/2017 20:54", - "openDebuggerWithPythonFrames:" : "fn 2/2/2017 16:54", + "openDebuggerWithPythonFrames" : "fn 2/21/2017 12:41", + "openDebuggerWithPythonFrames:" : "fn 2/21/2017 22:08", "persistPyCode:" : "fn 2/1/2017 12:46", - "primAsSmalltalk:" : "fn 12/20/2016 20:05", "primEval:cmd:" : "fn 2/2/2017 17:12", "primEval:filename:cmd:" : "fn 2/1/2017 10:55", - "primEvalInThread:cmd:" : "fn 2/2/2017 17:09", - "primEvalInThread:filename:cmd:" : "fn 2/1/2017 10:56", "primGetTopFrame" : "fn 1/11/2017 11:19", "primLastError" : "fn 1/28/2017 13:37", "primLastResult" : "fn 1/30/2017 15:34", - "primRestartFrame" : "fn 1/29/2017 01:28", - "primRestartFrameWith:filename:cmd:" : "fn 2/1/2017 10:57", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", "primResume" : "fn 1/10/2017 16:49", "primSimpleResume" : "fn 1/29/2017 00:32", @@ -32,7 +27,7 @@ "restartFrame" : "fn 2/1/2017 10:57", "restartFrame:with:" : "fn 2/2/2017 00:00", "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", - "resumeFrame" : "fn 2/1/2017 10:35", + "resumeFrame" : "fn 2/21/2017 22:05", "single:" : "fn 2/1/2017 10:55", "type" : "fn 12/22/2016 21:52", "vmSpeaksPython" : "fn 2/10/2017 12:21" }, diff --git a/repository/PyPy.package/PythonDebugger.class/class/newContext.st b/repository/PyPy.package/PythonDebugger.class/class/newPyContext.st similarity index 92% rename from repository/PyPy.package/PythonDebugger.class/class/newContext.st rename to repository/PyPy.package/PythonDebugger.class/class/newPyContext.st index 872d83bc..b97aba76 100644 --- a/repository/PyPy.package/PythonDebugger.class/class/newContext.st +++ b/repository/PyPy.package/PythonDebugger.class/class/newPyContext.st @@ -1,5 +1,5 @@ as yet unclassified -newContext +newPyContext ^ PythonFakeMethodContext sender: nil receiver: PythonObject diff --git a/repository/PyPy.package/PythonDebugger.class/class/appendPythonContexts..st b/repository/PyPy.package/PythonDebugger.class/class/prependPythonContexts..st similarity index 73% rename from repository/PyPy.package/PythonDebugger.class/class/appendPythonContexts..st rename to repository/PyPy.package/PythonDebugger.class/class/prependPythonContexts..st index 7c1d82bc..35dbc99f 100644 --- a/repository/PyPy.package/PythonDebugger.class/class/appendPythonContexts..st +++ b/repository/PyPy.package/PythonDebugger.class/class/prependPythonContexts..st @@ -1,11 +1,12 @@ as yet unclassified -appendPythonContexts: aContext - | newFrames currentPyFrame | - newFrames := OrderedCollection new. +prependPythonContexts: aContext + | currentPyFrame newFrames | currentPyFrame := Python primGetTopFrame. + currentPyFrame ifNil: [ ^ aContext ]. + newFrames := OrderedCollection new. [ currentPyFrame notNil ] whileTrue: [ | newCtx | - newCtx := self newContext. + newCtx := self newPyContext. newCtx pyFrame: currentPyFrame. newFrames add: newCtx. currentPyFrame := currentPyFrame f_back ]. diff --git a/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st b/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st index 60cbec86..8fa17106 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st +++ b/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st @@ -2,4 +2,4 @@ overrides contextForStack: aContext aContext method selector = #resumeFrame ifFalse: [ ^ aContext ]. "Normal MethodContext" - ^ self class appendPythonContexts: aContext \ No newline at end of file + ^ self class prependPythonContexts: aContext \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st b/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st index 9c616023..8399455a 100644 --- a/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st +++ b/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st @@ -3,5 +3,5 @@ selectedMessage "Answer the source code of the currently selected context." | aContext | aContext := self selectedContext. - aContext isPyContext ifTrue: [ ^ self class getPySource: aContext ]. - ^contents := aContext debuggerMap sourceText asText makeSelectorBoldIn: aContext home receiver class \ No newline at end of file + aContext isPyContext ifFalse: [ ^ super selectedMessage ]. + ^ self class getPySource: aContext \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/methodProperties.json b/repository/PyPy.package/PythonDebugger.class/methodProperties.json index 45f6db0c..43e5754b 100644 --- a/repository/PyPy.package/PythonDebugger.class/methodProperties.json +++ b/repository/PyPy.package/PythonDebugger.class/methodProperties.json @@ -1,6 +1,5 @@ { "class" : { - "appendPythonContexts:" : "fn 1/30/2017 12:21", "exploreFrames" : "fn 1/18/2017 17:34", "filterPySource:lineno:" : "fn 2/2/2017 00:01", "getContentsOf:" : "fn 2/1/2017 22:37", @@ -8,18 +7,19 @@ "getSignature:" : "fn 2/2/2017 00:04", "indent:by:" : "fn 2/1/2017 22:41", "indentSize:" : "fn 2/1/2017 22:36", - "newContext" : "fn 1/30/2017 09:54", + "newPyContext" : "fn 2/21/2017 18:55", + "prependPythonContexts:" : "fn 2/21/2017 18:55", "replaceInPySource:content:lineno:" : "fn 2/2/2017 00:05", "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", "setPySourceContent:content:" : "fn 2/1/2017 22:50" }, "instance" : { "contents:notifying:" : "fn 2/2/2017 00:04", - "contextForStack:" : "fn 1/30/2017 12:10", + "contextForStack:" : "fn 2/21/2017 12:48", "debuggerMap" : "fn 1/16/2017 20:23", "expandStack" : "fn 1/16/2017 21:03", "isModeStyleable" : "fn 1/16/2017 20:27", "pcRange" : "fn 1/18/2017 20:04", "process:controller:context:" : "fn 1/16/2017 19:34", "pyPCRange" : "fn 2/2/2017 17:00", - "selectedMessage" : "fn 2/1/2017 22:37", + "selectedMessage" : "fn 2/21/2017 18:52", "windowColorToUse" : "fn 2/10/2017 12:08" } } diff --git a/repository/PyPy.package/PythonTheme.class/class/addButtons..st b/repository/PyPy.package/PythonTheme.class/class/addButtons..st index 1113323a..b8a07702 100644 --- a/repository/PyPy.package/PythonTheme.class/class/addButtons..st +++ b/repository/PyPy.package/PythonTheme.class/class/addButtons..st @@ -10,9 +10,9 @@ addButtons: theme set: #font for: #PluggableButtonMorph to: [Preferences standardButtonFont]; set: #textColor for: #PluggableButtonMorph to: self textColor; - set: #selectionModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.1] ]; - set: #hoverModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.1] ]; - set: #feedbackModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.3] ]. + set: #selectionModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.2] ]; + set: #hoverModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.4] ]; + set: #feedbackModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.6] ]. "And the plus-version." theme diff --git a/repository/PyPy.package/PythonTheme.class/class/addDialogs..st b/repository/PyPy.package/PythonTheme.class/class/addDialogs..st index cbe16caa..9f20eda6 100644 --- a/repository/PyPy.package/PythonTheme.class/class/addDialogs..st +++ b/repository/PyPy.package/PythonTheme.class/class/addDialogs..st @@ -18,10 +18,10 @@ addDialogs: theme set: #font for: #DialogWindow to: [Preferences standardSystemFont]; set: #textColor for: #DialogWindow to: self textColor; - set: #okColor for: #DialogWindow to: (Color r: 0.49 g: 0.749 b: 0.49); - set: #cancelColor for: #DialogWindow to: (Color r: 1 g: 0.6 b: 0.588); - set: #buttonColor for: #DialogWindow to: (Color r: 0.658 g: 0.678 b: 0.78) twiceLighter; - set: #selectionModifier for: #DialogWindow to: [ [:c | Color orange muchLighter ] ]. + set: #okColor for: #DialogWindow to: self green; + set: #cancelColor for: #DialogWindow to: self red; + set: #buttonColor for: #DialogWindow to: (self backgroundColor adjustBrightness: 0.2); + set: #selectionModifier for: #DialogWindow to: [ [:c | c adjustBrightness: 0.1 ] ]. "The List Chooser is a dialog, too." theme diff --git a/repository/PyPy.package/PythonTheme.class/methodProperties.json b/repository/PyPy.package/PythonTheme.class/methodProperties.json index 0d9214a2..149ff0cb 100644 --- a/repository/PyPy.package/PythonTheme.class/methodProperties.json +++ b/repository/PyPy.package/PythonTheme.class/methodProperties.json @@ -1,7 +1,7 @@ { "class" : { - "addButtons:" : "fn 2/10/2017 12:02", - "addDialogs:" : "fn 2/10/2017 11:49", + "addButtons:" : "fn 2/21/2017 18:30", + "addDialogs:" : "fn 2/21/2017 18:33", "addFonts:" : "fn 2/10/2017 10:26", "addMenusAndDockingBars:" : "fn 2/10/2017 14:23", "addScrollables:" : "fn 2/10/2017 12:28", diff --git a/repository/PyPy.package/monticello.meta/version b/repository/PyPy.package/monticello.meta/version index 4ce87363..405cd226 100644 --- a/repository/PyPy.package/monticello.meta/version +++ b/repository/PyPy.package/monticello.meta/version @@ -1 +1 @@ -(name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'PyPy-fn.9' message 'Fix Python class>>resumeFrame; remove deprecated methods; improve theme' id '41b4e13b-2de2-40f5-afa9-b086f1f21be4' date '21 February 2017' time '10:14:39.643391 pm' author 'fn' ancestors ((name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From f10a2102f0df8e46859a40be8688d913f7dbffbc Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 21 Feb 2017 23:33:51 +0100 Subject: [PATCH 081/193] Improve get_restart_pycode() and add first tests --- rsqueakvm/plugins/python/utils.py | 8 +-- rsqueakvm/plugins/python_plugin.py | 2 +- .../plugins/python/test_restart_pycode.py | 64 +++++++++++++++++++ 3 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 rsqueakvm/test/plugins/python/test_restart_pycode.py diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index f72a5df8..67cfa854 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -114,14 +114,14 @@ def unwrap(space, w_object): raise PrimitiveFailedError -def get_pycode(source, filename, cmd): - # source = 'def __dummy__():\n%s\n' % '\n'.join( - # [' %s' % line for line in source.split('\n')]) +def get_restart_pycode(source, filename='', cmd='exec'): print 'Trying to patch:\n%s' % source try: py_code = py_compiling.compile(py_space, py_space.newbytes(source), filename, cmd) assert isinstance(py_code, PyCode) + if cmd == 'eval': + return py_code co_consts_w_len = len(py_code.co_consts_w) if co_consts_w_len >= 1: if co_consts_w_len > 1: @@ -130,7 +130,7 @@ def get_pycode(source, filename, cmd): if not isinstance(first_consts_w, PyCode): print 'First const is not a PyCode' return py_code - return py_code.co_consts_w[0] + return first_consts_w except OperationError as e: # import pdb; pdb.set_trace() print 'Failed to compile new frame: %s' % e.errorstr(py_space) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index b67aee14..198b8ebd 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -105,7 +105,7 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, frame = w_frame.wp_object py_code = None if source: - py_code = utils.get_pycode(source, filename, cmd) + py_code = utils.get_restart_pycode(source, filename, cmd) if py_code is None: return interp.space.w_false # Raising prim error causes crashes global_state.py_frame_restart_info.set( diff --git a/rsqueakvm/test/plugins/python/test_restart_pycode.py b/rsqueakvm/test/plugins/python/test_restart_pycode.py new file mode 100644 index 00000000..e3647719 --- /dev/null +++ b/rsqueakvm/test/plugins/python/test_restart_pycode.py @@ -0,0 +1,64 @@ +import sys +import dis +import StringIO + +from rsqueakvm.plugins.python.patching import patch_pypy +from rsqueakvm.plugins.python.utils import get_restart_pycode + + +patch_pypy() + + +def disassembly_test(result, expected): + s = StringIO.StringIO() + save_stdout = sys.stdout + sys.stdout = s + dis.dis(result._to_code()) + sys.stdout = save_stdout + got = s.getvalue() + lines = got.split('\n') + expected = expected.split('\n') + lines = [line.rstrip() for line in lines] + # import pdb; pdb.set_trace() + import difflib + if expected != lines: + assert False, 'events did not match expectation:\n' + \ + '\n'.join(difflib.ndiff(expected, lines)) + + +def test_simple_eval(): + result = get_restart_pycode('1', cmd='eval') + disassembly_test(result, """\ + 1 0 LOAD_CONST 0 (1) + 3 RETURN_VALUE +""") + + +def test_simple_exec(): + result = get_restart_pycode('import sys', cmd='exec') + disassembly_test(result, """\ + 1 0 LOAD_CONST 0 (-1) + 3 LOAD_CONST 1 (None) + 6 IMPORT_NAME 0 (sys) + 9 STORE_NAME 0 (sys) + 12 LOAD_CONST 1 (None) + 15 RETURN_VALUE +""") + + +def test_nested_exec(): + result = get_restart_pycode('def func():\n return 42', cmd='exec') + disassembly_test(result, """\ + 2 0 LOAD_CONST 1 (42) + 3 RETURN_VALUE +""") + + +def test_invalid_eval(): + result = get_restart_pycode('import os', cmd='eval') + assert result is None + + +def test_invalid_exec(): + result = get_restart_pycode('in valid syntax') + assert result is None From aa83f06d63472ea778a004ca132c24b2d926d04e Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Feb 2017 00:36:15 +0100 Subject: [PATCH 082/193] py_space.wrap now marked NOT_RPYTHON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, don’t return traceback, since it is currently not needed --- rsqueakvm/plugins/python/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 67cfa854..7211b60d 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -189,10 +189,10 @@ def call_function(space, wp_func, args_w): def operr_to_pylist(operr): assert isinstance(operr, OperationError) - wp_exception = py_space.wrap(operr.w_type.getname(py_space)) + wp_exception = py_space.newbytes(operr.w_type.getname(py_space)) wp_value = operr.get_w_value(py_space) - wp_traceback = py_space.wrap(operr.get_traceback()) - return py_space.newlist([wp_exception, wp_value, wp_traceback]) + # wp_traceback = operr.get_traceback() or py_space.w_None + return py_space.newlist([wp_exception, wp_value]) # wp_traceback]) def entry_point(argv): From 5ece009118a0ff25ebe404ae72b3714fca2e0b37 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Feb 2017 08:17:39 +0100 Subject: [PATCH 083/193] newbytes -> newtext; PyPy updates --- rsqueakvm/plugins/python/model.py | 4 +-- rsqueakvm/plugins/python/py_objspace.py | 10 ++++---- rsqueakvm/plugins/python/utils.py | 34 ++++--------------------- rsqueakvm/plugins/python_plugin.py | 4 +-- 4 files changed, 14 insertions(+), 38 deletions(-) diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 3592e645..763397d4 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -97,11 +97,11 @@ def make_method(self, w_selector): if py_attr is None: # check instance vars and methods py_attr = py_space.getattr(self.wp_object, - py_space.newbytes(methodname)) + py_space.newtext(methodname)) if py_attr is None: # check class vars and methods py_attr = py_space.getattr(self.wp_class, - py_space.newbytes(methodname)) + py_space.newtext(methodname)) except OperationError: pass except Exception as e: diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index 361ecdca..04190b58 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -67,17 +67,17 @@ def new_pypy_objspace(): # equivalent to the hack in app_main.py of PyPy, albiet interp-level. w_sys = py_space.sys w_modnames = w_sys.get('builtin_module_names') - w_in = py_space.contains(w_modnames, py_space.newbytes('__pypy__')) + w_in = py_space.contains(w_modnames, py_space.newtext('__pypy__')) if not py_space.is_true(w_in): rl = py_space.sys.get('setrecursionlimit') py_space.call(rl, py_space.newlist([py_space.newint(5000)])) # Should always be able to import Python modules in CWD. - w_sys_path = py_space.getattr(w_sys, py_space.newbytes('path')) - py_space.call_method(w_sys_path, 'append', py_space.newbytes('.')) + w_sys_path = py_space.getattr(w_sys, py_space.newtext('path')) + py_space.call_method(w_sys_path, 'append', py_space.newtext('.')) # Set sys.executable in PyPy -- some modules rely upon this existing. - py_space.setattr(w_sys, py_space.newbytes('executable'), - py_space.newbytes(os.path.abspath(sys.argv[0]))) + py_space.setattr(w_sys, py_space.newtext('executable'), + py_space.newtext(os.path.abspath(sys.argv[0]))) return py_space diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 7211b60d..d6a20f87 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -6,8 +6,8 @@ from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.model.variable import W_BytesObject -from pypy.interpreter import eval, module from pypy.interpreter.error import OperationError +from pypy.interpreter.main import ensure__main__, compilecode from pypy.interpreter.module import Module from pypy.interpreter.pycode import PyCode from pypy.module.__builtin__ import compiling as py_compiling @@ -20,34 +20,10 @@ from rpython.rlib import objectmodel -def ensure__main__(space): - # Adopted from PyPy's main.py - w_main = space.newbytes('__main__') - w_modules = space.sys.get('modules') - try: - return space.getitem(w_modules, w_main) - except OperationError as e: - if not e.match(space, space.w_KeyError): - raise - mainmodule = module.Module(space, w_main) - space.setitem(w_modules, w_main, mainmodule) - return mainmodule - - -def compilecode(space, source, filename, cmd='exec'): - # Adopted from PyPy's main.py - ws = space.newbytes - w_code = space.builtin.call( - 'compile', ws(source), ws(filename), ws(cmd), - space.newint(0), space.newint(0)) - pycode = space.interp_w(eval.Code, w_code) - return pycode - - def _run_eval_string(source, filename, cmd): # Adopted from PyPy's main.py try: - ws = py_space.newbytes + ws = py_space.newtext pycode = compilecode(py_space, source, filename or '', cmd) @@ -108,7 +84,7 @@ def unwrap(space, w_object): return py_space.newint(space.unwrap_int(w_object)) elif isinstance(w_object, W_BytesObject): # if w_object.getclass(space).is_same_object(space.w_String): - return py_space.newbytes(space.unwrap_string(w_object)) + return py_space.newtext(space.unwrap_string(w_object)) # import pdb; pdb.set_trace() print 'Cannot unwrap %s' % w_object raise PrimitiveFailedError @@ -117,7 +93,7 @@ def unwrap(space, w_object): def get_restart_pycode(source, filename='', cmd='exec'): print 'Trying to patch:\n%s' % source try: - py_code = py_compiling.compile(py_space, py_space.newbytes(source), + py_code = py_compiling.compile(py_space, py_space.newtext(source), filename, cmd) assert isinstance(py_code, PyCode) if cmd == 'eval': @@ -189,7 +165,7 @@ def call_function(space, wp_func, args_w): def operr_to_pylist(operr): assert isinstance(operr, OperationError) - wp_exception = py_space.newbytes(operr.w_type.getname(py_space)) + wp_exception = py_space.newtext(operr.w_type.getname(py_space)) wp_value = operr.get_w_value(py_space) # wp_traceback = operr.get_traceback() or py_space.w_None return py_space.newlist([wp_exception, wp_value]) # wp_traceback]) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 198b8ebd..f4cc5169 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -153,7 +153,7 @@ def send(interp, s_frame, argcount, w_method): w_result = args_w[0] w_result = space.wrap_float(0) else: - py_attr = py_space.getattr(wp_rcvr, py_space.newbytes(methodname)) + py_attr = py_space.getattr(wp_rcvr, py_space.newtext(methodname)) # Only allow to call certain types (e.g. don't allow __class__()) if (isinstance(py_attr, Function) or isinstance(py_attr, Method) or @@ -163,7 +163,7 @@ def send(interp, s_frame, argcount, w_method): space, wp_rcvr, methodname, args_w) else: if len(args_w) == 1: - py_space.setattr(wp_rcvr, py_space.newbytes(methodname), + py_space.setattr(wp_rcvr, py_space.newtext(methodname), unwrap(space, args_w[0])) w_result = space.w_nil else: From 41b56fe5858f54f21b66e4371d474b0a181fb22e Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Feb 2017 10:45:33 +0100 Subject: [PATCH 084/193] Remove redundant simpleResume primitive --- rsqueakvm/plugins/python_plugin.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index f4cc5169..97b93c5e 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -64,17 +64,6 @@ def resumePython(interp, s_frame, w_rcvr): return execution.switch_to_smalltalk(interp, s_frame) -@PythonPlugin.expose_primitive(unwrap_spec=[object]) -def simpleResume(interp, s_frame, w_rcvr): - # For shell development/debugging - from rsqueakvm.plugins.python import execution - print 'Smalltalk simple yield' - # import pdb; pdb.set_trace() - if not execution.resume_thread(): - return interp.space.w_false - return interp.space.w_true - - @PythonPlugin.expose_primitive(unwrap_spec=[object]) def lastResult(interp, s_frame, w_rcvr): return wrap(interp.space, global_state.wp_result.get()) From 4608bab454ed0652bc734637e9f79a7de59f494a Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Feb 2017 12:56:46 +0100 Subject: [PATCH 085/193] PyPy compatibility updates --- rsqueakvm/plugins/python/utils.py | 2 +- rsqueakvm/test/plugins/python/test_pyframe_exceptions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index d6a20f87..7f76bca2 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -48,7 +48,7 @@ def wrap(space, wp_object): if isinstance(wp_object, WP_FloatObject): return space.wrap_float(py_space.float_w(wp_object)) elif isinstance(wp_object, WP_BytesObject): - return space.wrap_string(py_space.str_w(wp_object)) + return space.wrap_string(py_space.text_w(wp_object)) elif isinstance(wp_object, WP_ListObject): return space.wrap_list( [wrap(space, item) for item in wp_object.getitems()]) diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 7e6601d1..93c390a3 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -8,7 +8,7 @@ def check_for_exception_handler(code): - pycode = compilecode(py_space, py_space.wrap(code), '', 'exec') + pycode = compilecode(py_space, code, '', 'exec') py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) try: py_frame.dispatch_bytecode(pycode.co_code, 0, From 80a829a8be9b727c2f8bd9d4a78fc5f3d0550390 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Feb 2017 16:54:58 +0100 Subject: [PATCH 086/193] Add unsupported case [ci skip] --- .../plugins/python/test_pyframe_exceptions.py | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 93c390a3..9605fe6c 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -1,4 +1,4 @@ -from rsqueakvm.plugins.python.global_state import py_space +from rsqueakvm.plugins.python.global_state import py_space, wp_operror from rsqueakvm.plugins.python.patching import patch_pypy from pypy.interpreter.error import OperationError @@ -7,7 +7,7 @@ patch_pypy() -def check_for_exception_handler(code): +def has_exception_handler(code): pycode = compilecode(py_space, code, '', 'exec') py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) try: @@ -18,7 +18,7 @@ def check_for_exception_handler(code): def test_simple_exception(): - assert check_for_exception_handler(""" + assert has_exception_handler(""" try: 1/0 except ZeroDivisionError: @@ -27,11 +27,11 @@ def test_simple_exception(): def test_simple_fail_exception(): - assert not check_for_exception_handler("""1/0""") + assert not has_exception_handler("""1/0""") def test_raised_exception(): - assert check_for_exception_handler(""" + assert has_exception_handler(""" try: raise Exception except Exception: @@ -40,7 +40,7 @@ def test_raised_exception(): def test_multiple_exceptions(): - assert check_for_exception_handler(""" + assert has_exception_handler(""" try: list()[1] except (ValueError, IndexError): @@ -49,7 +49,7 @@ def test_multiple_exceptions(): def test_multiple_exceptions_fail(): - assert not check_for_exception_handler(""" + assert not has_exception_handler(""" try: list()[1] except (ValueError, ZeroDivisionError): @@ -58,7 +58,7 @@ def test_multiple_exceptions_fail(): def test_catch_all_exceptions(): - assert check_for_exception_handler(""" + assert has_exception_handler(""" try: 1/0 except: @@ -67,7 +67,7 @@ def test_catch_all_exceptions(): def test_catch_variable_exception(): - assert check_for_exception_handler(""" + assert has_exception_handler(""" ex = IndexError if True: ex = ZeroDivisionError @@ -79,7 +79,7 @@ def test_catch_variable_exception(): def test_catch_variable_exception_fail(): - assert not check_for_exception_handler(""" + assert not has_exception_handler(""" ex = ZeroDivisionError if True: ex = IndexError @@ -91,7 +91,7 @@ def test_catch_variable_exception_fail(): def test_catch_multiple_variable_exceptions(): - assert check_for_exception_handler(""" + assert has_exception_handler(""" ex = (ValueError, ZeroDivisionError) try: 1/0 @@ -101,7 +101,7 @@ def test_catch_multiple_variable_exceptions(): def test_catch_nested_exceptions(): - assert check_for_exception_handler(""" + assert has_exception_handler(""" try: try: 1/0 @@ -113,7 +113,7 @@ def test_catch_nested_exceptions(): def test_catch_nested_exceptions_fail(): - assert not check_for_exception_handler(""" + assert not has_exception_handler(""" try: try: 1/0 @@ -122,3 +122,18 @@ def test_catch_nested_exceptions_fail(): except IndexError: pass """) + + +# def test_getattr_exception(): +# pycode = compilecode(py_space, """ +# class A(object): +# def __getattr__(self, name): +# if name == 'x': +# raise AttributeError + +# a = A() +# getattr(a, 'x', 5) +# """, '', 'exec') +# py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) +# py_frame.run() +# assert wp_operror.get() is None From caf04fcdee72cb4575f3b25b729be7600db70ca7 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Feb 2017 23:58:54 +0100 Subject: [PATCH 087/193] Add breakOnException primitive --- rsqueakvm/plugins/python/global_state.py | 1 + rsqueakvm/plugins/python/patching.py | 2 +- rsqueakvm/plugins/python_plugin.py | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 5ab14e45..7afe67bd 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -49,6 +49,7 @@ def perform(self, ec=None, frame=None): wp_result = Cell(None, type=WP_Root) wp_operror = Cell(None, type=WP_Root) +break_on_exception = Cell(True) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 8abd7ef5..010bca20 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -98,7 +98,7 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): if isinstance(operr, gs.RestartException): print 'Re-raising RestartException' raise operr - if not self.has_exception_handler(operr): + if gs.break_on_exception.get() and not self.has_exception_handler(operr): # import pdb; pdb.set_trace() gs.wp_operror.set(operr) print 'Python error caught' diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 97b93c5e..64e263ee 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -77,6 +77,17 @@ def lastError(interp, s_frame, w_rcvr): return wrap(interp.space, utils.operr_to_pylist(operr)) +@PythonPlugin.expose_primitive(clean_stack=False) +def breakOnException(interp, s_frame, argcount): + if argcount == 0: + return interp.space.wrap_bool(global_state.break_on_exception.get()) + if argcount != 1: + raise PrimitiveFailedError + state = s_frame.pop() is interp.space.w_true + global_state.break_on_exception.set(state) + return interp.space.wrap_bool(state) + + @PythonPlugin.expose_primitive(unwrap_spec=[object]) def getTopFrame(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() From a1c461fcd3c200064ae5a1429af1300e19209207 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Feb 2017 13:30:29 +0100 Subject: [PATCH 088/193] Consider getattr() and next() in ex detection --- rsqueakvm/plugins/python/patching.py | 28 ++++++++++++ .../plugins/python/test_pyframe_exceptions.py | 43 +++++++++++++------ 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 010bca20..a7ae25c8 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,5 +1,6 @@ from rsqueakvm.plugins.python import global_state as gs +from pypy.interpreter.pycode import PyCode, default_magic from pypy.interpreter.pyopcode import SApplicationException from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver from pypy.tool.stdlib_opcode import bytecode_spec @@ -11,6 +12,10 @@ old_init_frame = PyFrame.__init__ old_execute_frame = PyFrame.execute_frame old_handle_operation_error = PyFrame.handle_operation_error +old_init_pycode = PyCode.__init__ + +ATTRIBUTE_ERROR_FORBIDDEN_NAMES = ['getattr'] +STOP_ITERATION_FORBIDDEN_NAMES = ['next'] def __init__frame(self, space, code, w_globals, outer_func): @@ -82,7 +87,16 @@ def block_handles_exception(self, block, operr_type): def has_exception_handler(self, operr): "Returns True if this frame or one of his parents are able to handle operr" frame = self + error_type = operr.w_type.getname(gs.py_space) + forbidden_names = [] + if error_type == 'AttributeError': + forbidden_names = ATTRIBUTE_ERROR_FORBIDDEN_NAMES + elif error_type == 'StopIteration': + forbidden_names = STOP_ITERATION_FORBIDDEN_NAMES while frame is not None: + for name in forbidden_names: + if name in frame.pycode._co_names: + return True block = frame.lastblock while block is not None: # block needs to be an ExceptBlock and able to handle operr @@ -106,6 +120,17 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): return old_handle_operation_error(self, ec, operr, attach_tb) +def __init__pycode(self, space, argcount, nlocals, stacksize, flags, + code, consts, names, varnames, filename, + name, firstlineno, lnotab, freevars, cellvars, + hidden_applevel=False, magic=default_magic): + self._co_names = names + old_init_pycode(self, space, argcount, nlocals, stacksize, flags, + code, consts, names, varnames, filename, + name, firstlineno, lnotab, freevars, cellvars, + hidden_applevel, magic) + + def patch_pypy(): # Patch-out virtualizables from PyPy so that translation works try: @@ -120,3 +145,6 @@ def patch_pypy(): PyFrame.block_handles_exception = block_handles_exception PyFrame.has_exception_handler = has_exception_handler PyFrame.handle_operation_error = new_handle_operation_error + + PyCode.__init__ = __init__pycode + PyCode._immutable_fields_.append('_co_names[*]') diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 9605fe6c..48dc8a2f 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -17,6 +17,13 @@ def has_exception_handler(code): return py_frame.has_exception_handler(operr) +def no_error_caught(code, cmd): + pycode = compilecode(py_space, code, '', cmd) + py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) + py_frame.run() + return wp_operror.get() is None + + def test_simple_exception(): assert has_exception_handler(""" try: @@ -26,6 +33,15 @@ def test_simple_exception(): """) +def test_simple_exception_with_as(): + assert has_exception_handler(""" +try: + 1/0 +except ZeroDivisionError as e: + pass +""") + + def test_simple_fail_exception(): assert not has_exception_handler("""1/0""") @@ -43,7 +59,7 @@ def test_multiple_exceptions(): assert has_exception_handler(""" try: list()[1] -except (ValueError, IndexError): +except (ValueError, IndexError) as e: pass """) @@ -124,16 +140,17 @@ def test_catch_nested_exceptions_fail(): """) -# def test_getattr_exception(): -# pycode = compilecode(py_space, """ -# class A(object): -# def __getattr__(self, name): -# if name == 'x': -# raise AttributeError +def test_getattr_exception(): + assert no_error_caught(""" +class A(object): + def __getattr__(self, name): + if name == 'x': + raise AttributeError + +a = A() +getattr(a, 'x', 5) +""", 'exec') + -# a = A() -# getattr(a, 'x', 5) -# """, '', 'exec') -# py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) -# py_frame.run() -# assert wp_operror.get() is None +def test_next_exception(): + assert no_error_caught('next(iter([]), 42)', 'eval') From 6d2bd1cb090418ca845de05ad7ef9a2ec29efe8e Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Feb 2017 13:30:44 +0100 Subject: [PATCH 089/193] Update in-image code [ci skip] --- .../PyPy.package/Python.class/class/cmdFor..st | 5 +++++ .../PyPy.package/Python.class/class/evaluable..st | 5 +++++ .../Python.class/class/primBreakOnException..st | 4 ++++ .../Python.class/class/primBreakOnException.st | 4 ++++ .../PyPy.package/Python.class/class/primResume.st | 3 +-- .../Python.class/class/primSimpleResume.st | 5 ----- .../Python.class/class/restartFrame.st | 3 +-- .../Python.class/class/restartFrame.with..st | 2 +- .../Python.class/methodProperties.json | 11 +++++++---- .../evaluate.in.to.notifying.ifFail.logged..st | 7 +++---- .../PythonCompiler.class/methodProperties.json | 2 +- .../PythonObject.class/class/pythonInitialize.st | 12 ++++++------ .../PythonObject.class/methodProperties.json | 2 +- repository/PyPy.package/PythonTest.class/README.md | 0 .../PythonTest.class/instance/testEvaluable.st | 9 +++++++++ .../PythonTest.class/methodProperties.json | 5 +++++ .../PyPy.package/PythonTest.class/properties.json | 14 ++++++++++++++ repository/PyPy.package/monticello.meta/version | 2 +- 18 files changed, 68 insertions(+), 27 deletions(-) create mode 100644 repository/PyPy.package/Python.class/class/cmdFor..st create mode 100644 repository/PyPy.package/Python.class/class/evaluable..st create mode 100644 repository/PyPy.package/Python.class/class/primBreakOnException..st create mode 100644 repository/PyPy.package/Python.class/class/primBreakOnException.st delete mode 100644 repository/PyPy.package/Python.class/class/primSimpleResume.st create mode 100644 repository/PyPy.package/PythonTest.class/README.md create mode 100644 repository/PyPy.package/PythonTest.class/instance/testEvaluable.st create mode 100644 repository/PyPy.package/PythonTest.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonTest.class/properties.json diff --git a/repository/PyPy.package/Python.class/class/cmdFor..st b/repository/PyPy.package/Python.class/class/cmdFor..st new file mode 100644 index 00000000..75c26e14 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/cmdFor..st @@ -0,0 +1,5 @@ +helpers +cmdFor: aPySource + (self evaluable: aPySource) + ifTrue: [ ^ 'eval' ] + ifFalse: [ ^ 'exec' ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/evaluable..st b/repository/PyPy.package/Python.class/class/evaluable..st new file mode 100644 index 00000000..0e4e8af3 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/evaluable..st @@ -0,0 +1,5 @@ +helpers +evaluable: aPySource + (('*=*' match: aPySource) and: [ ('*==*' match: aPySource) not ]) ifTrue: [ ^ false ]. + (aPySource includesAnyOf: {$:. Character cr. Character lf}) ifTrue: [ ^ false ]. + ^ true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primBreakOnException..st b/repository/PyPy.package/Python.class/class/primBreakOnException..st new file mode 100644 index 00000000..5178cfcd --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primBreakOnException..st @@ -0,0 +1,4 @@ +experimental +primBreakOnException: aBool + + self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primBreakOnException.st b/repository/PyPy.package/Python.class/class/primBreakOnException.st new file mode 100644 index 00000000..eadd07cc --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primBreakOnException.st @@ -0,0 +1,4 @@ +experimental +primBreakOnException + + self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primResume.st b/repository/PyPy.package/Python.class/class/primResume.st index 2f544b7a..8bd99e0e 100644 --- a/repository/PyPy.package/Python.class/class/primResume.st +++ b/repository/PyPy.package/Python.class/class/primResume.st @@ -1,5 +1,4 @@ experimental primResume - self primitiveFailed. - \ No newline at end of file + self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primSimpleResume.st b/repository/PyPy.package/Python.class/class/primSimpleResume.st deleted file mode 100644 index e575878a..00000000 --- a/repository/PyPy.package/Python.class/class/primSimpleResume.st +++ /dev/null @@ -1,5 +0,0 @@ -experimental -primSimpleResume - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/restartFrame.st b/repository/PyPy.package/Python.class/class/restartFrame.st index 080b3337..6cdd679f 100644 --- a/repository/PyPy.package/Python.class/class/restartFrame.st +++ b/repository/PyPy.package/Python.class/class/restartFrame.st @@ -1,4 +1,3 @@ experimental restartFrame - self primRestartSpecificFrame: nil source: '' filename: '' cmd: '' - \ No newline at end of file + self primRestartSpecificFrame: nil source: '' filename: '' cmd: '' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/restartFrame.with..st b/repository/PyPy.package/Python.class/class/restartFrame.with..st index 41443dc6..b0c31b90 100644 --- a/repository/PyPy.package/Python.class/class/restartFrame.with..st +++ b/repository/PyPy.package/Python.class/class/restartFrame.with..st @@ -4,4 +4,4 @@ restartFrame: pyFrame with: aSource primRestartSpecificFrame: pyFrame source: aSource filename: pyFrame f_code co_filename - cmd: 'exec' \ No newline at end of file + cmd: (self cmdFor: aSource) \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/methodProperties.json b/repository/PyPy.package/Python.class/methodProperties.json index b82fe997..9a30969d 100644 --- a/repository/PyPy.package/Python.class/methodProperties.json +++ b/repository/PyPy.package/Python.class/methodProperties.json @@ -1,7 +1,9 @@ { "class" : { "builtins" : "fn 12/20/2016 13:47", + "cmdFor:" : "fn 2/22/2017 14:13", "eval:" : "fn 2/1/2017 11:04", + "evaluable:" : "fn 2/22/2017 14:12", "evaluatorClass" : "fn 12/22/2016 02:53", "exec:" : "fn 2/1/2017 11:05", "from:import:" : "fn 1/9/2017 20:54", @@ -15,17 +17,18 @@ "openDebuggerWithPythonFrames" : "fn 2/21/2017 12:41", "openDebuggerWithPythonFrames:" : "fn 2/21/2017 22:08", "persistPyCode:" : "fn 2/1/2017 12:46", + "primBreakOnException" : "fn 2/23/2017 13:22", + "primBreakOnException:" : "fn 2/23/2017 13:22", "primEval:cmd:" : "fn 2/2/2017 17:12", "primEval:filename:cmd:" : "fn 2/1/2017 10:55", "primGetTopFrame" : "fn 1/11/2017 11:19", "primLastError" : "fn 1/28/2017 13:37", "primLastResult" : "fn 1/30/2017 15:34", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", - "primResume" : "fn 1/10/2017 16:49", - "primSimpleResume" : "fn 1/29/2017 00:32", + "primResume" : "fn 2/22/2017 10:47", "pyInspect" : "fn 1/29/2017 22:15", - "restartFrame" : "fn 2/1/2017 10:57", - "restartFrame:with:" : "fn 2/2/2017 00:00", + "restartFrame" : "fn 2/22/2017 10:21", + "restartFrame:with:" : "fn 2/22/2017 14:14", "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", "resumeFrame" : "fn 2/21/2017 22:05", "single:" : "fn 2/1/2017 10:55", diff --git a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st index c83ebae0..eb4fc6ef 100644 --- a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st +++ b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st @@ -4,7 +4,6 @@ evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: f pyCode := textOrStream contents. (receiver isKindOf: Python) ifFalse: [ pyCode := pyCode copyReplaceAll: 'self' with: receiver pyIdentifier ]. - "= or multilines cannot be evaluated, but always need to be executed instead" - (pyCode includesAnyOf: {$=. String cr}) ifTrue: [ - [^ Python eval: pyCode ] on: Error do: []]. - ^ Python exec: pyCode + (Python evaluable: pyCode) + ifTrue: [ [^ Python eval: pyCode ] on: Error do: [] ]. + ^ Python exec: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/methodProperties.json b/repository/PyPy.package/PythonCompiler.class/methodProperties.json index ae94a87b..fb6c42ca 100644 --- a/repository/PyPy.package/PythonCompiler.class/methodProperties.json +++ b/repository/PyPy.package/PythonCompiler.class/methodProperties.json @@ -4,5 +4,5 @@ "parserClass" : "fn 12/25/2016 15:08" }, "instance" : { "compile:in:notifying:ifFail:" : "fn 12/19/2016 14:09", - "evaluate:in:to:notifying:ifFail:logged:" : "fn 1/7/2017 15:01", + "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/22/2017 14:15", "pythonCompile:class:ifFail:" : "fn 12/19/2016 02:18" } } diff --git a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st index 16328b6e..841dcece 100644 --- a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st +++ b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st @@ -4,12 +4,12 @@ pythonInitialize Python exec: ' import sys sys.path = ["', Smalltalk image imagePath, '", - "', Smalltalk image imagePath, 'pypy/lib_pypy", - "', Smalltalk image imagePath, 'pypy/lib-python/2.7", - "', Smalltalk image imagePath, 'pypy/lib-python/2.7/lib-tk", - "', Smalltalk image imagePath, 'pypy/lib-python/2.7/plat-darwin", - "', Smalltalk image imagePath, 'pypy/lib-python/2.7/plat-mac", - "', Smalltalk image imagePath, 'pypy/lib-python/2.7/plat-mac/lib-scriptpackages", + "', Smalltalk image imagePath, '/pypy/lib_pypy", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7/lib-tk", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-darwin", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac/lib-scriptpackages", "." ]'. "Pythonize all Python classes" self withAllSubclasses do: [ :ea | ea pythonize ]. diff --git a/repository/PyPy.package/PythonObject.class/methodProperties.json b/repository/PyPy.package/PythonObject.class/methodProperties.json index 804f1c31..9b5a9e1f 100644 --- a/repository/PyPy.package/PythonObject.class/methodProperties.json +++ b/repository/PyPy.package/PythonObject.class/methodProperties.json @@ -12,7 +12,7 @@ "new" : "fn 12/19/2016 14:14", "nextID" : "fn 12/18/2016 23:45", "printString2" : "fn 12/20/2016 19:24", - "pythonInitialize" : "fn 2/10/2017 12:17", + "pythonInitialize" : "fn 2/23/2017 13:21", "pythonize" : "fn 12/21/2016 00:15", "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", "sourceCodeAt:ifAbsent:" : "fn 12/19/2016 14:07", diff --git a/repository/PyPy.package/PythonTest.class/README.md b/repository/PyPy.package/PythonTest.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonTest.class/instance/testEvaluable.st b/repository/PyPy.package/PythonTest.class/instance/testEvaluable.st new file mode 100644 index 00000000..3ef04278 --- /dev/null +++ b/repository/PyPy.package/PythonTest.class/instance/testEvaluable.st @@ -0,0 +1,9 @@ +testing +testEvaluable + self assert: (Python evaluable: '1'). + self assert: (Python evaluable: 'foo()'). + self deny: (Python evaluable: 'x = 1'). + self assert: (Python evaluable: '1 == 1'). + self deny: (Python evaluable: 'def foo(): + return 42'). + self deny: (Python evaluable: 'def foo(): pass') \ No newline at end of file diff --git a/repository/PyPy.package/PythonTest.class/methodProperties.json b/repository/PyPy.package/PythonTest.class/methodProperties.json new file mode 100644 index 00000000..af5f8e0f --- /dev/null +++ b/repository/PyPy.package/PythonTest.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "testEvaluable" : "fn 2/22/2017 14:12" } } diff --git a/repository/PyPy.package/PythonTest.class/properties.json b/repository/PyPy.package/PythonTest.class/properties.json new file mode 100644 index 00000000..d27961de --- /dev/null +++ b/repository/PyPy.package/PythonTest.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy-Tests", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonTest", + "pools" : [ + ], + "super" : "TestCase", + "type" : "normal" } diff --git a/repository/PyPy.package/monticello.meta/version b/repository/PyPy.package/monticello.meta/version index 405cd226..0c4d9b92 100644 --- a/repository/PyPy.package/monticello.meta/version +++ b/repository/PyPy.package/monticello.meta/version @@ -1 +1 @@ -(name 'PyPy-fn.9' message 'Fix Python class>>resumeFrame; remove deprecated methods; improve theme' id '41b4e13b-2de2-40f5-afa9-b086f1f21be4' date '21 February 2017' time '10:14:39.643391 pm' author 'fn' ancestors ((name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'PyPy-fn.10' message 'Updates' id '756686b6-8c03-4a9c-a74f-cc14c1175d12' date '23 February 2017' time '1:23:47.638052 pm' author 'fn' ancestors ((name 'PyPy-fn.9' message 'Fix Python class>>resumeFrame; remove deprecated methods; improve theme' id '41b4e13b-2de2-40f5-afa9-b086f1f21be4' date '21 February 2017' time '10:14:39.643391 pm' author 'fn' ancestors ((name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From d26beedd71645a73854a898debe82092de310df2 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Feb 2017 18:09:43 +0100 Subject: [PATCH 090/193] Add PythonExamples; minor bugfixes [ci skip] --- repository/PyPy.package/Python.class/class/run..st | 5 +++++ .../Python.class/methodProperties.json | 1 + .../evaluate.in.to.notifying.ifFail.logged..st | 4 +--- .../PythonCompiler.class/methodProperties.json | 2 +- .../PyPy.package/PythonExamples.class/README.md | 0 .../PythonExamples.class/class/fibonacci..st | 9 +++++++++ .../PythonExamples.class/class/fibonacci9.st | 10 ++++++++++ .../PythonExamples.class/class/miniexample.st | 13 +++++++++++++ .../PythonExamples.class/class/server.st | 5 +++++ .../PythonExamples.class/methodProperties.json | 8 ++++++++ .../PythonExamples.class/properties.json | 14 ++++++++++++++ .../instance/evaluateExpression..st | 3 +++ .../PythonWorkspace.class/methodProperties.json | 3 ++- repository/PyPy.package/monticello.meta/version | 2 +- 14 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 repository/PyPy.package/Python.class/class/run..st create mode 100644 repository/PyPy.package/PythonExamples.class/README.md create mode 100644 repository/PyPy.package/PythonExamples.class/class/fibonacci..st create mode 100644 repository/PyPy.package/PythonExamples.class/class/fibonacci9.st create mode 100644 repository/PyPy.package/PythonExamples.class/class/miniexample.st create mode 100644 repository/PyPy.package/PythonExamples.class/class/server.st create mode 100644 repository/PyPy.package/PythonExamples.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonExamples.class/properties.json create mode 100644 repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st diff --git a/repository/PyPy.package/Python.class/class/run..st b/repository/PyPy.package/Python.class/class/run..st new file mode 100644 index 00000000..308fc181 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/run..st @@ -0,0 +1,5 @@ +helpers +run: pyCode + (self evaluable: pyCode) + ifTrue: [ [^ self eval: pyCode ] on: Error do: [] ]. + ^ self exec: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/methodProperties.json b/repository/PyPy.package/Python.class/methodProperties.json index 9a30969d..540093a2 100644 --- a/repository/PyPy.package/Python.class/methodProperties.json +++ b/repository/PyPy.package/Python.class/methodProperties.json @@ -31,6 +31,7 @@ "restartFrame:with:" : "fn 2/22/2017 14:14", "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", "resumeFrame" : "fn 2/21/2017 22:05", + "run:" : "fn 2/23/2017 17:46", "single:" : "fn 2/1/2017 10:55", "type" : "fn 12/22/2016 21:52", "vmSpeaksPython" : "fn 2/10/2017 12:21" }, diff --git a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st index eb4fc6ef..9af5f2ca 100644 --- a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st +++ b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st @@ -4,6 +4,4 @@ evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: f pyCode := textOrStream contents. (receiver isKindOf: Python) ifFalse: [ pyCode := pyCode copyReplaceAll: 'self' with: receiver pyIdentifier ]. - (Python evaluable: pyCode) - ifTrue: [ [^ Python eval: pyCode ] on: Error do: [] ]. - ^ Python exec: pyCode \ No newline at end of file + ^ Python run: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/methodProperties.json b/repository/PyPy.package/PythonCompiler.class/methodProperties.json index fb6c42ca..a4e7330b 100644 --- a/repository/PyPy.package/PythonCompiler.class/methodProperties.json +++ b/repository/PyPy.package/PythonCompiler.class/methodProperties.json @@ -4,5 +4,5 @@ "parserClass" : "fn 12/25/2016 15:08" }, "instance" : { "compile:in:notifying:ifFail:" : "fn 12/19/2016 14:09", - "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/22/2017 14:15", + "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/23/2017 17:46", "pythonCompile:class:ifFail:" : "fn 12/19/2016 02:18" } } diff --git a/repository/PyPy.package/PythonExamples.class/README.md b/repository/PyPy.package/PythonExamples.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonExamples.class/class/fibonacci..st b/repository/PyPy.package/PythonExamples.class/class/fibonacci..st new file mode 100644 index 00000000..e76666ac --- /dev/null +++ b/repository/PyPy.package/PythonExamples.class/class/fibonacci..st @@ -0,0 +1,9 @@ +debugging +fibonacci: x + Python exec: ' +def fibonacci(number): + lookup_table = [0] + for i in range(2, number + 1): + lookup_table.append(lookup_table[i - 1] + lookup_table[i - 2]) + return lookup_table[number]'. + ^ Python eval: 'fibonacci(', x, ')' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st b/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st new file mode 100644 index 00000000..72efe856 --- /dev/null +++ b/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st @@ -0,0 +1,10 @@ +debugging +fibonacci9 + Python exec: ' +def fibonacci9(): + number = 9 + lookup_table = [0] + for i in range(2, number + 1): + lookup_table.append(lookup_table[i - 1] + lookup_table[i - 2]) + return lookup_table[number]'. + ^ Python eval: 'fibonacci9()' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/miniexample.st b/repository/PyPy.package/PythonExamples.class/class/miniexample.st new file mode 100644 index 00000000..7b413a62 --- /dev/null +++ b/repository/PyPy.package/PythonExamples.class/class/miniexample.st @@ -0,0 +1,13 @@ +debugging +miniexample + "Use user interrupt to interrupt while loop" + ^ Python exec: ' +x = 0 + +def start(): + global x + while True: + x += 1 + if x % 1000 == 0: + print x +start()' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/server.st b/repository/PyPy.package/PythonExamples.class/class/server.st new file mode 100644 index 00000000..e7ff2425 --- /dev/null +++ b/repository/PyPy.package/PythonExamples.class/class/server.st @@ -0,0 +1,5 @@ +debugging +server + "Use user interrupt to interrupt server loop" + Python exec: 'from helloworld import live_value, app'. + ^ Python eval: 'app.run()' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/methodProperties.json b/repository/PyPy.package/PythonExamples.class/methodProperties.json new file mode 100644 index 00000000..c83721f5 --- /dev/null +++ b/repository/PyPy.package/PythonExamples.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + "fibonacci9" : "fn 2/23/2017 17:59", + "fibonacci:" : "fn 2/23/2017 17:59", + "miniexample" : "fn 2/23/2017 17:59", + "server" : "fn 2/23/2017 17:59" }, + "instance" : { + } } diff --git a/repository/PyPy.package/PythonExamples.class/properties.json b/repository/PyPy.package/PythonExamples.class/properties.json new file mode 100644 index 00000000..92ebd651 --- /dev/null +++ b/repository/PyPy.package/PythonExamples.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonExamples", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st b/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st new file mode 100644 index 00000000..6fc3b844 --- /dev/null +++ b/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st @@ -0,0 +1,3 @@ +as yet unclassified +evaluateExpression: selection + ^ Python run: selection \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json index 53f02898..f0c0bb43 100644 --- a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json +++ b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json @@ -2,4 +2,5 @@ "class" : { "open" : "fn 12/22/2016 02:51" }, "instance" : { - "doItReceiver" : "fn 12/22/2016 02:52" } } + "doItReceiver" : "fn 12/22/2016 02:52", + "evaluateExpression:" : "fn 2/23/2017 17:46" } } diff --git a/repository/PyPy.package/monticello.meta/version b/repository/PyPy.package/monticello.meta/version index 0c4d9b92..a9a719e3 100644 --- a/repository/PyPy.package/monticello.meta/version +++ b/repository/PyPy.package/monticello.meta/version @@ -1 +1 @@ -(name 'PyPy-fn.10' message 'Updates' id '756686b6-8c03-4a9c-a74f-cc14c1175d12' date '23 February 2017' time '1:23:47.638052 pm' author 'fn' ancestors ((name 'PyPy-fn.9' message 'Fix Python class>>resumeFrame; remove deprecated methods; improve theme' id '41b4e13b-2de2-40f5-afa9-b086f1f21be4' date '21 February 2017' time '10:14:39.643391 pm' author 'fn' ancestors ((name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'PyPy-fn.11' message 'Add examples; minor bugfixes' id 'a852e871-13f5-497e-ae53-ae98c9316e6b' date '23 February 2017' time '6:08:59.626935 pm' author 'fn' ancestors ((name 'PyPy-fn.10' message 'Updates' id '756686b6-8c03-4a9c-a74f-cc14c1175d12' date '23 February 2017' time '1:23:47.638052 pm' author 'fn' ancestors ((name 'PyPy-fn.9' message 'Fix Python class>>resumeFrame; remove deprecated methods; improve theme' id '41b4e13b-2de2-40f5-afa9-b086f1f21be4' date '21 February 2017' time '10:14:39.643391 pm' author 'fn' ancestors ((name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From c04b171a82d59d5119807628a20e0423cb4225b6 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Feb 2017 18:10:04 +0100 Subject: [PATCH 091/193] Clear operror to allow resuming --- rsqueakvm/plugins/python/global_state.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 7afe67bd..3a111ddd 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -33,7 +33,11 @@ def perform(self, ec=None, frame=None): # print 'Python yield' runner.return_to_smalltalk() # print 'Python continue' - # Handle py_frame_restart_info if set + + # operror has been in Smalltalk land, clear it now to allow resuming + wp_operror.set(None) + + # handle py_frame_restart_info if set restart_info = py_frame_restart_info.get() if restart_info: py_frame_restart_info.set(None) From 0a58128800fb5fb4f6642e172bedc2f47a893de6 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Feb 2017 18:35:44 +0100 Subject: [PATCH 092/193] Override W_PointersObject.safe_getclass() --- rsqueakvm/plugins/python/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 763397d4..b8332340 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -41,9 +41,12 @@ def store(self, space, n0, w_value): # import pdb; pdb.set_trace() pass - def getclass(self, space): + def safe_getclass(self, space): return W_PythonObject(self.wp_object.getclass(py_space)) + def getclass(self, space): + self.safe_getclass(space) + def class_shadow(self, space): wp_class = py_space.type(self.wp_object) return PythonClassShadow(space, self.wp_object, wp_class) From 9e03aa8cc591668ea0b6bbcb193ef1286b8bd80f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Feb 2017 19:41:16 +0100 Subject: [PATCH 093/193] Fix builtin support --- rsqueakvm/plugins/python_plugin.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 64e263ee..3d59c4ad 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -130,28 +130,7 @@ def send(interp, s_frame, argcount, w_method): try: if wp_rcvr is py_space.builtin: builtin = py_space.builtin.get(methodname) - if isinstance(builtin, BuiltinFunction): - w_result = utils.call_function(space, builtin, args_w) - if isinstance(builtin, WP_TypeObject): - if methodname == 'tuple': - w_result = wrap(space, py_space.newtuple( - [unwrap(space, x) for x in args_w])) - elif methodname == 'str': - if len(args_w) > 0: - w_result = args_w[0] - w_result = space.wrap_string('') - elif methodname == 'bool': - if len(args_w) > 0: - w_result = args_w[0] - w_result = space.w_false - elif methodname == 'int': - if len(args_w) > 0: - w_result = args_w[0] - w_result = space.wrap_int(0) - elif methodname == 'float': - if len(args_w) > 0: - w_result = args_w[0] - w_result = space.wrap_float(0) + w_result = utils.call_function(space, builtin, args_w) else: py_attr = py_space.getattr(wp_rcvr, py_space.newtext(methodname)) # Only allow to call certain types (e.g. don't allow __class__()) From 58d5dc20132f4e539bf3d4bfabeb7cbb7a7ba6a3 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Feb 2017 22:17:11 +0100 Subject: [PATCH 094/193] W_PythonObject.getclass() needs to return cls --- rsqueakvm/plugins/python/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index b8332340..88d21ba8 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -45,7 +45,7 @@ def safe_getclass(self, space): return W_PythonObject(self.wp_object.getclass(py_space)) def getclass(self, space): - self.safe_getclass(space) + return self.safe_getclass(space) def class_shadow(self, space): wp_class = py_space.type(self.wp_object) From 6cdee25b04d54458755b8780cfad674d1814bf4f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 25 Feb 2017 17:58:23 +0100 Subject: [PATCH 095/193] Enable PythonPlugin during plugin testing --- .build/plugintests.py | 23 +++++++++++++++++------ .travis.yml | 2 +- .travis/test.sh | 2 +- rsqueakvm/plugins/python/py_objspace.py | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.build/plugintests.py b/.build/plugintests.py index f5d70f4a..e13c31e7 100755 --- a/.build/plugintests.py +++ b/.build/plugintests.py @@ -4,20 +4,31 @@ from os import path from environment import cp, config # import with side effects +from rsqueakvm.util import system + if __name__ == "__main__": try: - plugin_name = next(arg for arg in sys.argv - if arg.startswith("--plugin=")) - sys.argv.remove(plugin_name) + plugins = next(arg for arg in sys.argv + if arg.startswith("--plugins=")) + sys.argv.remove(plugins) + except StopIteration: + pass + try: + plugin_dir = next(arg for arg in sys.argv + if arg.startswith("--plugin-dir=")) + sys.argv.remove(plugin_dir) except StopIteration: - print "No plugin directory provided via --plugin=" + print "No plugin directory provided via --plugin-dir=" sys.exit(1) - plugin_name = plugin_name.split("=")[1] + if plugins: + plugins = plugins.split("=")[1] + system.optional_plugins = plugins + plugin_dir = plugin_dir.split("=")[1] sys.argv.append("-s") sys.argv.append("-vv") sys.argv.append(path.join( path.dirname(__file__), "..", - "rsqueakvm", "test", "plugins", plugin_name)) + "rsqueakvm", "test", "plugins", plugin_dir)) import pytest exit(pytest.main(args=sys.argv[1:])) diff --git a/.travis.yml b/.travis.yml index 1ef25149..eefe0c57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ env: # - BUILD_ARCH=armv8-a # - BUILD_ARCH=64bit PLUGINS=DatabasePlugin # - BUILD_ARCH=64bit PLUGINS=RubyPlugin - - BUILD_ARCH=64bit TEST_TYPE=plugin TEST_PLUGIN=python + - BUILD_ARCH=64bit TEST_TYPE=plugin PLUGINS=PythonPlugin PLUGIN_DIR=python - BUILD_ARCH=64bit PLUGINS=PythonPlugin matrix: include: diff --git a/.travis/test.sh b/.travis/test.sh index 5a390125..c13ba42c 100755 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -10,7 +10,7 @@ case "${TEST_TYPE}" in coverage) testflag="-s -v -S --cov=rsqueakvm --cov-append " ;; plugin) testscript="plugintests.py" - testflag="--plugin=${TEST_PLUGIN}" + testflag="--plugins=${PLUGINS} --plugin-dir=${PLUGIN_DIR}" ;; *) echo "Wrong TEST_TYPE value (${TEST_TYPE}), not executing tests" diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index 04190b58..a9b1c48a 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -12,7 +12,7 @@ def new_pypy_objspace(): # Module.interpleveldefs['pypy_getudir'] = 'foo' from pypy.config.pypyoption import get_pypy_config, set_pypy_opt_level - translating = sys.argv[0] != '.build/run.py' # make better + translating = sys.argv[0] == '.build/build.py' # make better pypy_config = get_pypy_config(translating=translating) # disable dispensable modules (to save compile time) From 2a1a875ded5d3ae73429e55779ef5c8a6857f52d Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 25 Feb 2017 17:59:06 +0100 Subject: [PATCH 096/193] Minor improvements --- rsqueakvm/plugins/python/model.py | 11 ++++++----- rsqueakvm/plugins/python/utils.py | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 88d21ba8..3687abf0 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -5,8 +5,8 @@ from rsqueakvm.primitives.constants import EXTERNAL_CALL from rsqueakvm.model.compiled_methods import ( W_PreSpurCompiledMethod, W_SpurCompiledMethod) -from rsqueakvm.plugins.python.global_state import ( - py_space, w_python_object_class, w_python_plugin_send) +from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.python.global_state import py_space from pypy.interpreter.baseobjspace import W_Root as WP_Root from pypy.interpreter.error import OperationError @@ -82,7 +82,7 @@ def lookup(self, w_selector): # import pdb; pdb.set_trace() if w_method is not None: return w_method - w_po = w_python_object_class.get() + w_po = gs.w_python_object_class.get() return w_po.as_class_get_shadow(self.space).lookup(w_selector) def make_method(self, w_selector): @@ -125,15 +125,16 @@ def make_method(self, w_selector): w_cm = objectmodel.instantiate(W_SpurCompiledMethod) else: w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 0 w_cm._primitive = EXTERNAL_CALL w_cm.literalsize = 2 w_cm.islarge = False w_cm._tempsize = 0 w_cm.argsize = 0 + w_cm.compiledin_class = gs.w_python_class.get() + w_cm.lookup_selector = 'fakePythonSend' w_cm.bytes = [] w_cm.literals = [ - w_python_plugin_send.get(), + gs.w_python_plugin_send.get(), w_selector ] return w_cm diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 7f76bca2..04f0e798 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -35,7 +35,11 @@ def _run_eval_string(source, filename, cmd): if filename is not None: py_space.setitem(w_globals, ws('__file__'), ws(filename)) - return pycode.exec_code(py_space, w_globals, w_globals) + retval = pycode.exec_code(py_space, w_globals, w_globals) + if eval: + return retval + else: + return except OperationError as operationerr: operationerr.record_interpreter_traceback() From 31d5080c2ecf8d0b67cc5decb148f3ad10315db6 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 26 Feb 2017 22:09:42 +0100 Subject: [PATCH 097/193] Expose W_PythonObjects by default; add asSmalltalk --- rsqueakvm/plugins/python/execution.py | 4 +- rsqueakvm/plugins/python/utils.py | 79 +++++++++++++-------------- rsqueakvm/plugins/python_plugin.py | 44 +++++++++------ 3 files changed, 66 insertions(+), 61 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index f8e5d2a6..9dcd3e18 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -1,6 +1,7 @@ from rsqueakvm.model.compiled_methods import ( W_SpurCompiledMethod, W_PreSpurCompiledMethod) from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist from rpython.rlib.rstacklet import StackletThread @@ -167,7 +168,6 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): def _create_return_frame(space, wp_result): from rsqueakvm.storage_contexts import ContextPartShadow - from rsqueakvm.plugins.python.utils import wrap print 'Python has finished and returned a result' # we want evalInThread and resumePython to return new frames, # so we don't build up stack, but we also don't raise to the @@ -195,7 +195,7 @@ def _create_return_frame(space, wp_result): 0x20, # push constant 0x7C, # return stack top ]] - w_cm.literals = [wrap(space, wp_result), space.w_nil, + w_cm.literals = [W_PythonObject(wp_result), space.w_nil, w_cm.compiledin_class] gs.wp_result.set(None) return ContextPartShadow.build_method_context( diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 04f0e798..fd5d72e7 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -47,7 +47,7 @@ def _run_eval_string(source, filename, cmd): @objectmodel.specialize.argtype(0) -def wrap(space, wp_object): +def python_to_smalltalk(space, wp_object): # import pdb; pdb.set_trace() if isinstance(wp_object, WP_FloatObject): return space.wrap_float(py_space.float_w(wp_object)) @@ -55,10 +55,10 @@ def wrap(space, wp_object): return space.wrap_string(py_space.text_w(wp_object)) elif isinstance(wp_object, WP_ListObject): return space.wrap_list( - [wrap(space, item) for item in wp_object.getitems()]) + [python_to_smalltalk(space, x) for x in wp_object.getitems()]) elif isinstance(wp_object, WP_TupleObject): return space.wrap_list( - [wrap(space, item) for item in wp_object.tolist()]) + [python_to_smalltalk(space, x) for x in wp_object.tolist()]) elif wp_object is None or wp_object is py_space.w_None: return space.w_nil elif isinstance(wp_object, WP_IntObject): @@ -68,12 +68,12 @@ def wrap(space, wp_object): elif wp_object is py_space.w_True: return space.w_true return space.wrap_int(py_space.int_w(wp_object)) - else: - return W_PythonObject(wp_object) + print 'Cannot convert %s to Smalltalk' % wp_object + raise PrimitiveFailedError @objectmodel.specialize.argtype(0) -def unwrap(space, w_object): +def smalltalk_to_python(space, w_object): if isinstance(w_object, W_PythonObject): return w_object.wp_object elif w_object is None or w_object is space.w_nil: @@ -90,7 +90,7 @@ def unwrap(space, w_object): # if w_object.getclass(space).is_same_object(space.w_String): return py_space.newtext(space.unwrap_string(w_object)) # import pdb; pdb.set_trace() - print 'Cannot unwrap %s' % w_object + print 'Cannot convert %s to Python' % w_object raise PrimitiveFailedError @@ -120,51 +120,48 @@ def get_restart_pycode(source, filename='', cmd='exec'): def call_method(space, wp_rcvr, methodname, args_w): args_w_len = len(args_w) if args_w_len == 1: - arg1 = unwrap(space, args_w[0]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, arg1)) + arg1 = smalltalk_to_python(space, args_w[0]) + return py_space.call_method(wp_rcvr, methodname, arg1) elif args_w_len == 2: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, - arg1, arg2)) + arg1 = smalltalk_to_python(space, args_w[0]) + arg2 = smalltalk_to_python(space, args_w[1]) + return py_space.call_method(wp_rcvr, methodname, arg1, arg2) elif args_w_len == 3: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, - arg1, arg2, arg3)) + arg1 = smalltalk_to_python(space, args_w[0]) + arg2 = smalltalk_to_python(space, args_w[1]) + arg3 = smalltalk_to_python(space, args_w[2]) + return py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3) elif args_w_len == 4: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - return wrap(space, py_space.call_method(wp_rcvr, methodname, - arg1, arg2, arg3, arg4)) - return wrap(space, py_space.call_method(wp_rcvr, methodname)) + arg1 = smalltalk_to_python(space, args_w[0]) + arg2 = smalltalk_to_python(space, args_w[1]) + arg3 = smalltalk_to_python(space, args_w[2]) + arg4 = smalltalk_to_python(space, args_w[3]) + return py_space.call_method(wp_rcvr, methodname, + arg1, arg2, arg3, arg4) + return py_space.call_method(wp_rcvr, methodname) def call_function(space, wp_func, args_w): args_w_len = len(args_w) if args_w_len == 1: - arg1 = unwrap(space, args_w[0]) - return wrap(space, py_space.call_function(wp_func, arg1)) + arg1 = smalltalk_to_python(space, args_w[0]) + return py_space.call_function(wp_func, arg1) elif args_w_len == 2: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2)) + arg1 = smalltalk_to_python(space, args_w[0]) + arg2 = smalltalk_to_python(space, args_w[1]) + return py_space.call_function(wp_func, arg1, arg2) elif args_w_len == 3: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - return wrap(space, py_space.call_function(wp_func, arg1, arg2, arg3)) + arg1 = smalltalk_to_python(space, args_w[0]) + arg2 = smalltalk_to_python(space, args_w[1]) + arg3 = smalltalk_to_python(space, args_w[2]) + return py_space.call_function(wp_func, arg1, arg2, arg3) elif args_w_len == 4: - arg1 = unwrap(space, args_w[0]) - arg2 = unwrap(space, args_w[1]) - arg3 = unwrap(space, args_w[2]) - arg4 = unwrap(space, args_w[3]) - return wrap(space, py_space.call_function(wp_func, - arg1, arg2, arg3, arg4)) - return wrap(space, py_space.call_function(wp_func)) + arg1 = smalltalk_to_python(space, args_w[0]) + arg2 = smalltalk_to_python(space, args_w[1]) + arg3 = smalltalk_to_python(space, args_w[2]) + arg4 = smalltalk_to_python(space, args_w[3]) + return py_space.call_function(wp_func, arg1, arg2, arg3, arg4) + return py_space.call_function(wp_func) def operr_to_pylist(operr): diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 3d59c4ad..3dfb7175 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -10,13 +10,12 @@ from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts from rsqueakvm.plugins.python import model, global_state, utils from rsqueakvm.plugins.python.global_state import py_space +from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.patching import patch_pypy -from rsqueakvm.plugins.python.utils import wrap, unwrap from pypy.interpreter.error import OperationError -from pypy.interpreter.function import (BuiltinFunction, Function, Method, - StaticMethod, ClassMethod) -from pypy.objspace.std.typeobject import W_TypeObject as WP_TypeObject +from pypy.interpreter.function import (Function, Method, StaticMethod, + ClassMethod) from rpython.rlib import jit, objectmodel @@ -66,7 +65,7 @@ def resumePython(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(unwrap_spec=[object]) def lastResult(interp, s_frame, w_rcvr): - return wrap(interp.space, global_state.wp_result.get()) + return W_PythonObject(global_state.wp_result.get()) @PythonPlugin.expose_primitive(unwrap_spec=[object]) @@ -74,7 +73,7 @@ def lastError(interp, s_frame, w_rcvr): operr = global_state.wp_operror.get() if operr is None: raise PrimitiveFailedError - return wrap(interp.space, utils.operr_to_pylist(operr)) + return W_PythonObject(utils.operr_to_pylist(operr)) @PythonPlugin.expose_primitive(clean_stack=False) @@ -94,7 +93,7 @@ def getTopFrame(interp, s_frame, w_rcvr): topframe = py_space.getexecutioncontext().gettopframe() if topframe is None: raise PrimitiveFailedError - return wrap(interp.space, topframe) + return W_PythonObject(topframe) @PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str, str]) @@ -113,24 +112,32 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, return interp.space.w_true +@PythonPlugin.expose_primitive(unwrap_spec=[object]) +def asSmalltalk(interp, s_frame, w_rcvr): + if not isinstance(w_rcvr, model.W_PythonObject): + raise PrimitiveFailedError + w_result = utils.python_to_smalltalk(interp.space, w_rcvr.wp_object) + return w_result + + @PythonPlugin.expose_primitive(compiled_method=True) @jit.unroll_safe def send(interp, s_frame, argcount, w_method): # import pdb; pdb.set_trace() space = interp.space args_w = s_frame.peek_n(argcount) - wp_rcvr = unwrap(space, s_frame.peek(argcount)) + wp_rcvr = utils.smalltalk_to_python(space, s_frame.peek(argcount)) w_selector_name = w_method.literalat0(space, 2) assert isinstance(w_selector_name, W_BytesObject) methodname = space.unwrap_string(w_selector_name) idx = methodname.find(':') if idx > 0: methodname = methodname[0:idx] - w_result = None + wp_result = None try: if wp_rcvr is py_space.builtin: builtin = py_space.builtin.get(methodname) - w_result = utils.call_function(space, builtin, args_w) + wp_result = utils.call_function(space, builtin, args_w) else: py_attr = py_space.getattr(wp_rcvr, py_space.newtext(methodname)) # Only allow to call certain types (e.g. don't allow __class__()) @@ -138,25 +145,26 @@ def send(interp, s_frame, argcount, w_method): isinstance(py_attr, Method) or isinstance(py_attr, StaticMethod) or isinstance(py_attr, ClassMethod)): - w_result = utils.call_method( + wp_result = utils.call_method( space, wp_rcvr, methodname, args_w) else: if len(args_w) == 1: + wp_value = utils.smalltalk_to_python(space, args_w[0]) py_space.setattr(wp_rcvr, py_space.newtext(methodname), - unwrap(space, args_w[0])) - w_result = space.w_nil + wp_value) + wp_result = py_space.w_None else: - w_result = wrap(space, py_attr) + wp_result = py_attr except OperationError as operationerr: print operationerr.errorstr(py_space) raise PrimitiveFailedError except Exception as e: print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) - return space.w_nil - if w_result is None: + raise PrimitiveFailedError + if wp_result is None: # import pdb; pdb.set_trace() print ('Result failure in send primitive (wp_rcvr: %s, methodname: %s)' % (wp_rcvr, methodname)) - return space.w_nil + raise PrimitiveFailedError s_frame.pop_n(argcount + 1) - return w_result + return W_PythonObject(wp_result) From 18144bbbaa26719d2fb5bc2c855e16532c7c4a6f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 26 Feb 2017 22:09:58 +0100 Subject: [PATCH 098/193] Update in-image code [ci skip] --- .../Python.class/class/basicVmSpeaksPython.st | 4 +++ .../Python.class/class/builtins.st | 3 +- .../Python.class/class/cmdFor..st | 2 +- .../PyPy.package/Python.class/class/eval..st | 7 ++--- .../Python.class/class/evaluable..st | 5 ---- .../PyPy.package/Python.class/class/exec..st | 7 ++--- .../Python.class/class/fromObjectCache..st | 4 +++ .../Python.class/class/getGlobalKeys.st | 4 --- .../Python.class/class/getLocalKeys.st | 4 --- .../Python.class/class/globals.st | 4 +++ .../Python.class/class/isCallable..st | 2 +- .../Python.class/class/isExpression..st | 4 +++ .../PyPy.package/Python.class/class/locals.st | 4 +++ .../PyPy.package/Python.class/class/peval..st | 3 ++ .../PyPy.package/Python.class/class/pexec..st | 3 ++ .../Python.class/class/primPythonAt..st | 4 +++ .../PyPy.package/Python.class/class/prun..st | 5 ++++ .../PyPy.package/Python.class/class/reset.st | 4 +++ .../PyPy.package/Python.class/class/run..st | 4 +-- .../PyPy.package/Python.class/class/type.st | 2 +- .../Python.class/class/vmSpeaksPython.st | 3 +- .../Python.class/methodProperties.json | 29 ++++++++++++------- .../PyPy.package/Python.class/properties.json | 3 +- ...evaluate.in.to.notifying.ifFail.logged..st | 25 ++++++++++++++-- .../methodProperties.json | 2 +- .../methodProperties.json | 2 +- .../class/getPySource..st | 4 ++- .../class/getSignature..st | 4 ++- .../methodProperties.json | 4 +-- .../PythonExamples.class/class/average..st | 6 ++++ .../PythonExamples.class/class/average.st | 6 ++++ .../PythonExamples.class/class/fibonacci..st | 2 +- .../PythonExamples.class/class/fibonacci9.st | 2 +- .../PythonExamples.class/class/miniexample.st | 2 +- .../methodProperties.json | 8 +++-- .../instance/printOn..st | 21 +++++++------- .../methodProperties.json | 2 +- .../instance/aboutToStyle..st | 3 ++ .../instance/fieldList.st | 1 - .../instance/inspect..st | 23 --------------- .../instance/selection.st | 7 ++--- .../methodProperties.json | 6 ++-- .../class/pythonInitialize.st | 8 ++++- .../PythonObject.class/class/startUp..st | 1 + .../instance/allAttributes.st | 6 +--- .../instance/asSmalltalk.st | 4 +++ .../PythonObject.class/instance/at..st | 3 ++ .../PythonObject.class/instance/at.put..st | 3 ++ .../PythonObject.class/instance/class.st | 4 +-- .../PythonObject.class/instance/className.st | 4 +++ .../instance/defaultLabelForInspector.st | 5 ++++ .../PythonObject.class/instance/explore.st | 3 ++ .../instance/explorerContents.st | 8 ++--- .../instance/hasAttribute..st | 2 +- .../PythonObject.class/instance/hasClass.st | 3 ++ .../PythonObject.class/instance/isClass.st | 2 +- .../PythonObject.class/instance/printOn..st | 9 +----- .../PythonObject.class/instance/pyString.st | 5 ---- .../instance/shoutParserClass.st | 4 +++ .../PythonObject.class/methodProperties.json | 29 ++++++++++++------- .../PythonObjectExplorer.class/README.md | 0 .../methodProperties.json | 5 ++++ .../properties.json | 14 +++++++++ .../instance/testEvaluable.st | 9 ------ .../instance/testIsExpression.st | 10 +++++++ .../PythonTest.class/methodProperties.json | 2 +- .../PythonToolSet.class/class/explore..st | 4 +++ .../PythonToolSet.class/methodProperties.json | 1 + .../instance/doItReceiver.st | 3 -- .../instance/evaluateExpression..st | 2 +- .../methodProperties.json | 3 +- .../PyPy.package/monticello.meta/version | 2 +- 72 files changed, 245 insertions(+), 157 deletions(-) create mode 100644 repository/PyPy.package/Python.class/class/basicVmSpeaksPython.st delete mode 100644 repository/PyPy.package/Python.class/class/evaluable..st create mode 100644 repository/PyPy.package/Python.class/class/fromObjectCache..st delete mode 100644 repository/PyPy.package/Python.class/class/getGlobalKeys.st delete mode 100644 repository/PyPy.package/Python.class/class/getLocalKeys.st create mode 100644 repository/PyPy.package/Python.class/class/globals.st create mode 100644 repository/PyPy.package/Python.class/class/isExpression..st create mode 100644 repository/PyPy.package/Python.class/class/locals.st create mode 100644 repository/PyPy.package/Python.class/class/peval..st create mode 100644 repository/PyPy.package/Python.class/class/pexec..st create mode 100644 repository/PyPy.package/Python.class/class/primPythonAt..st create mode 100644 repository/PyPy.package/Python.class/class/prun..st create mode 100644 repository/PyPy.package/Python.class/class/reset.st create mode 100644 repository/PyPy.package/PythonExamples.class/class/average..st create mode 100644 repository/PyPy.package/PythonExamples.class/class/average.st create mode 100644 repository/PyPy.package/PythonInspector.class/instance/aboutToStyle..st delete mode 100644 repository/PyPy.package/PythonInspector.class/instance/inspect..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/asSmalltalk.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/at..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/at.put..st create mode 100644 repository/PyPy.package/PythonObject.class/instance/className.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/defaultLabelForInspector.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/explore.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/hasClass.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/pyString.st create mode 100644 repository/PyPy.package/PythonObject.class/instance/shoutParserClass.st create mode 100644 repository/PyPy.package/PythonObjectExplorer.class/README.md create mode 100644 repository/PyPy.package/PythonObjectExplorer.class/methodProperties.json create mode 100644 repository/PyPy.package/PythonObjectExplorer.class/properties.json delete mode 100644 repository/PyPy.package/PythonTest.class/instance/testEvaluable.st create mode 100644 repository/PyPy.package/PythonTest.class/instance/testIsExpression.st create mode 100644 repository/PyPy.package/PythonToolSet.class/class/explore..st delete mode 100644 repository/PyPy.package/PythonWorkspace.class/instance/doItReceiver.st diff --git a/repository/PyPy.package/Python.class/class/basicVmSpeaksPython.st b/repository/PyPy.package/Python.class/class/basicVmSpeaksPython.st new file mode 100644 index 00000000..c4b6c442 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/basicVmSpeaksPython.st @@ -0,0 +1,4 @@ +helpers +basicVmSpeaksPython + [ Python eval: '1' ] on: Error do: [ ^ false ]. + ^ true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/builtins.st b/repository/PyPy.package/Python.class/class/builtins.st index 950953c0..c66d31e3 100644 --- a/repository/PyPy.package/Python.class/class/builtins.st +++ b/repository/PyPy.package/Python.class/class/builtins.st @@ -1,4 +1,3 @@ special objects builtins - - ^ PythonBuiltins ifNil: [PythonBuiltins := self eval: '__builtins__'] \ No newline at end of file + ^ self fromObjectCache: '__builtins__' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/cmdFor..st b/repository/PyPy.package/Python.class/class/cmdFor..st index 75c26e14..2280e30d 100644 --- a/repository/PyPy.package/Python.class/class/cmdFor..st +++ b/repository/PyPy.package/Python.class/class/cmdFor..st @@ -1,5 +1,5 @@ helpers cmdFor: aPySource - (self evaluable: aPySource) + (self isExpression: aPySource) ifTrue: [ ^ 'eval' ] ifFalse: [ ^ 'exec' ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/eval..st b/repository/PyPy.package/Python.class/class/eval..st index a3efb3f9..7da4cb30 100644 --- a/repository/PyPy.package/Python.class/class/eval..st +++ b/repository/PyPy.package/Python.class/class/eval..st @@ -1,6 +1,3 @@ -helpers +execution eval: aString - | filename | - filename := self persistPyCode: aString. - [ ^ self primEval: aString filename: filename cmd: 'eval' ] on: Error - do: [ self error: 'Failed to eval: ''', aString, '''' ] \ No newline at end of file + ^ self primEval: aString filename: '' cmd: 'eval' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/evaluable..st b/repository/PyPy.package/Python.class/class/evaluable..st deleted file mode 100644 index 0e4e8af3..00000000 --- a/repository/PyPy.package/Python.class/class/evaluable..st +++ /dev/null @@ -1,5 +0,0 @@ -helpers -evaluable: aPySource - (('*=*' match: aPySource) and: [ ('*==*' match: aPySource) not ]) ifTrue: [ ^ false ]. - (aPySource includesAnyOf: {$:. Character cr. Character lf}) ifTrue: [ ^ false ]. - ^ true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/exec..st b/repository/PyPy.package/Python.class/class/exec..st index af8d9727..8002b84f 100644 --- a/repository/PyPy.package/Python.class/class/exec..st +++ b/repository/PyPy.package/Python.class/class/exec..st @@ -1,6 +1,3 @@ -helpers +execution exec: aString - | filename | - filename := self persistPyCode: aString. - [ ^ self primEval: aString filename: filename cmd: 'exec' ] on: Error - do: [ self error: 'Failed to exec: ''', aString, '''' ] \ No newline at end of file + ^ self primEval: aString filename: '' cmd: 'exec' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/fromObjectCache..st b/repository/PyPy.package/Python.class/class/fromObjectCache..st new file mode 100644 index 00000000..1150b52a --- /dev/null +++ b/repository/PyPy.package/Python.class/class/fromObjectCache..st @@ -0,0 +1,4 @@ +helpers +fromObjectCache: aName + ObjectCache ifNil: [ ObjectCache := Dictionary new ]. + ^ ObjectCache at: aName ifAbsentPut: [ self eval: aName ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/getGlobalKeys.st b/repository/PyPy.package/Python.class/class/getGlobalKeys.st deleted file mode 100644 index 11985bc4..00000000 --- a/repository/PyPy.package/Python.class/class/getGlobalKeys.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -getGlobalKeys - ^ Python eval: 'globals().keys()' - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/getLocalKeys.st b/repository/PyPy.package/Python.class/class/getLocalKeys.st deleted file mode 100644 index ad34b40e..00000000 --- a/repository/PyPy.package/Python.class/class/getLocalKeys.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -getLocalKeys - ^ Python eval: 'locals().keys()' - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/globals.st b/repository/PyPy.package/Python.class/class/globals.st new file mode 100644 index 00000000..a85fbedb --- /dev/null +++ b/repository/PyPy.package/Python.class/class/globals.st @@ -0,0 +1,4 @@ +special objects +globals + ^ Python eval: 'globals()' + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/isCallable..st b/repository/PyPy.package/Python.class/class/isCallable..st index 862a37eb..51dceaab 100644 --- a/repository/PyPy.package/Python.class/class/isCallable..st +++ b/repository/PyPy.package/Python.class/class/isCallable..st @@ -1,3 +1,3 @@ helpers isCallable: aPyString - ^ self eval: 'callable(', aPyString ,')' \ No newline at end of file + ^ (self eval: 'callable(', aPyString ,')') asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/isExpression..st b/repository/PyPy.package/Python.class/class/isExpression..st new file mode 100644 index 00000000..093da59d --- /dev/null +++ b/repository/PyPy.package/Python.class/class/isExpression..st @@ -0,0 +1,4 @@ +helpers +isExpression: aPySource + ^ (self eval: '_isExpression("""', +aPySource, '""")') asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/locals.st b/repository/PyPy.package/Python.class/class/locals.st new file mode 100644 index 00000000..92400462 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/locals.st @@ -0,0 +1,4 @@ +special objects +locals + ^ Python eval: 'locals()' + \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/peval..st b/repository/PyPy.package/Python.class/class/peval..st new file mode 100644 index 00000000..7d75798a --- /dev/null +++ b/repository/PyPy.package/Python.class/class/peval..st @@ -0,0 +1,3 @@ +execution +peval: aString + ^ self primEval: aString filename: (self persistPyCode: aString) cmd: 'eval' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/pexec..st b/repository/PyPy.package/Python.class/class/pexec..st new file mode 100644 index 00000000..fe3fb2df --- /dev/null +++ b/repository/PyPy.package/Python.class/class/pexec..st @@ -0,0 +1,3 @@ +execution +pexec: aString + ^ self primEval: aString filename: (self persistPyCode: aString) cmd: 'exec' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primPythonAt..st b/repository/PyPy.package/Python.class/class/primPythonAt..st new file mode 100644 index 00000000..dedd6673 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/primPythonAt..st @@ -0,0 +1,4 @@ +experimental +primPythonAt: aKeyOrIndex + + self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/prun..st b/repository/PyPy.package/Python.class/class/prun..st new file mode 100644 index 00000000..9593ed09 --- /dev/null +++ b/repository/PyPy.package/Python.class/class/prun..st @@ -0,0 +1,5 @@ +execution +prun: pyCode + (self isExpression: pyCode) + ifTrue: [ [^ self peval: pyCode ] on: Error do: [] ]. + ^ self pexec: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/reset.st b/repository/PyPy.package/Python.class/class/reset.st new file mode 100644 index 00000000..d5e86b2f --- /dev/null +++ b/repository/PyPy.package/Python.class/class/reset.st @@ -0,0 +1,4 @@ +helpers +reset + ObjectCache := nil. + VMSpeaksPython := nil. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/run..st b/repository/PyPy.package/Python.class/class/run..st index 308fc181..9e39e246 100644 --- a/repository/PyPy.package/Python.class/class/run..st +++ b/repository/PyPy.package/Python.class/class/run..st @@ -1,5 +1,5 @@ -helpers +execution run: pyCode - (self evaluable: pyCode) + (self isExpression: pyCode) ifTrue: [ [^ self eval: pyCode ] on: Error do: [] ]. ^ self exec: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/type.st b/repository/PyPy.package/Python.class/class/type.st index d0904c6b..60a577da 100644 --- a/repository/PyPy.package/Python.class/class/type.st +++ b/repository/PyPy.package/Python.class/class/type.st @@ -1,3 +1,3 @@ special objects type - ^ Python eval: 'type' \ No newline at end of file + ^ self fromObjectCache: 'type' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st index c3240a43..61bd766b 100644 --- a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st +++ b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st @@ -1,4 +1,3 @@ helpers vmSpeaksPython - [ Python eval: '1' ] on: Error do: [ ^ false ]. - ^ true \ No newline at end of file + ^ VMSpeaksPython ifNil: [ VMSpeaksPython := self basicVmSpeaksPython ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/methodProperties.json b/repository/PyPy.package/Python.class/methodProperties.json index 540093a2..ccb31860 100644 --- a/repository/PyPy.package/Python.class/methodProperties.json +++ b/repository/PyPy.package/Python.class/methodProperties.json @@ -1,22 +1,26 @@ { "class" : { - "builtins" : "fn 12/20/2016 13:47", - "cmdFor:" : "fn 2/22/2017 14:13", - "eval:" : "fn 2/1/2017 11:04", - "evaluable:" : "fn 2/22/2017 14:12", + "basicVmSpeaksPython" : "fn 2/23/2017 20:59", + "builtins" : "fn 2/23/2017 18:34", + "cmdFor:" : "fn 2/23/2017 21:36", + "eval:" : "fn 2/23/2017 21:10", "evaluatorClass" : "fn 12/22/2016 02:53", - "exec:" : "fn 2/1/2017 11:05", + "exec:" : "fn 2/23/2017 21:11", "from:import:" : "fn 1/9/2017 20:54", "from:load:" : "fn 1/9/2017 20:55", - "getGlobalKeys" : "fn 12/19/2016 12:20", - "getLocalKeys" : "fn 12/19/2016 12:20", + "fromObjectCache:" : "fn 2/23/2017 18:40", "getSource:" : "fn 1/29/2017 22:15", + "globals" : "fn 2/26/2017 21:46", "import:" : "fn 1/9/2017 20:54", - "isCallable:" : "fn 12/19/2016 02:18", + "isCallable:" : "fn 2/26/2017 21:45", + "isExpression:" : "fn 2/26/2017 21:45", "load:" : "fn 1/9/2017 20:54", + "locals" : "fn 2/26/2017 21:46", "openDebuggerWithPythonFrames" : "fn 2/21/2017 12:41", "openDebuggerWithPythonFrames:" : "fn 2/21/2017 22:08", "persistPyCode:" : "fn 2/1/2017 12:46", + "peval:" : "fn 2/23/2017 21:12", + "pexec:" : "fn 2/23/2017 21:12", "primBreakOnException" : "fn 2/23/2017 13:22", "primBreakOnException:" : "fn 2/23/2017 13:22", "primEval:cmd:" : "fn 2/2/2017 17:12", @@ -24,16 +28,19 @@ "primGetTopFrame" : "fn 1/11/2017 11:19", "primLastError" : "fn 1/28/2017 13:37", "primLastResult" : "fn 1/30/2017 15:34", + "primPythonAt:" : "fn 2/25/2017 17:03", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", "primResume" : "fn 2/22/2017 10:47", + "prun:" : "fn 2/23/2017 21:36", "pyInspect" : "fn 1/29/2017 22:15", + "reset" : "fn 2/23/2017 21:13", "restartFrame" : "fn 2/22/2017 10:21", "restartFrame:with:" : "fn 2/22/2017 14:14", "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", "resumeFrame" : "fn 2/21/2017 22:05", - "run:" : "fn 2/23/2017 17:46", + "run:" : "fn 2/23/2017 21:37", "single:" : "fn 2/1/2017 10:55", - "type" : "fn 12/22/2016 21:52", - "vmSpeaksPython" : "fn 2/10/2017 12:21" }, + "type" : "fn 2/23/2017 18:34", + "vmSpeaksPython" : "fn 2/23/2017 21:00" }, "instance" : { } } diff --git a/repository/PyPy.package/Python.class/properties.json b/repository/PyPy.package/Python.class/properties.json index b44d472a..12e554ad 100644 --- a/repository/PyPy.package/Python.class/properties.json +++ b/repository/PyPy.package/Python.class/properties.json @@ -3,7 +3,8 @@ "classinstvars" : [ ], "classvars" : [ - "PythonBuiltins" ], + "ObjectCache", + "VMSpeaksPython" ], "commentStamp" : "", "instvars" : [ ], diff --git a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st index 9af5f2ca..51046664 100644 --- a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st +++ b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st @@ -2,6 +2,25 @@ as yet unclassified evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag | pyCode | pyCode := textOrStream contents. - (receiver isKindOf: Python) ifFalse: [ - pyCode := pyCode copyReplaceAll: 'self' with: receiver pyIdentifier ]. - ^ Python run: pyCode \ No newline at end of file + + Python exec: 'rcvr_locals = dict()'. + (Python eval: 'rcvr_locals') setdefault: 'self' to: receiver. + + (Python isExpression: pyCode) + ifTrue: [ + ^ Python builtins + eval: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] + ifFalse: [ + ^ Python builtins + exec: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] + + "pyCode := pyCode copyReplaceAll: 'self.' with: ''. + method := (pyCode copyUpTo: $() asSymbol. + args := ((((pyCode copyAfter: $() copyUpTo: $)) + findTokens: {$,}) + collect: [ :ea | ea withBlanksTrimmed ]) asArray. + ^ receiver perform: method withArguments: args" \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/methodProperties.json b/repository/PyPy.package/PythonCompiler.class/methodProperties.json index a4e7330b..80b15478 100644 --- a/repository/PyPy.package/PythonCompiler.class/methodProperties.json +++ b/repository/PyPy.package/PythonCompiler.class/methodProperties.json @@ -4,5 +4,5 @@ "parserClass" : "fn 12/25/2016 15:08" }, "instance" : { "compile:in:notifying:ifFail:" : "fn 12/19/2016 14:09", - "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/23/2017 17:46", + "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/24/2017 11:58", "pythonCompile:class:ifFail:" : "fn 12/19/2016 02:18" } } diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json index 1913c102..b893d906 100644 --- a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json +++ b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "selection" : "fn 2/10/2017 12:13" } } + "selection" : "fn 2/26/2017 21:44" } } diff --git a/repository/PyPy.package/PythonDebugger.class/class/getPySource..st b/repository/PyPy.package/PythonDebugger.class/class/getPySource..st index 7025c23a..e2c67e9f 100644 --- a/repository/PyPy.package/PythonDebugger.class/class/getPySource..st +++ b/repository/PyPy.package/PythonDebugger.class/class/getPySource..st @@ -1,7 +1,9 @@ pysource getPySource: aContext - | pyCode contents | + | pyCode filename contents | pyCode := aContext pyFrame f_code. + filename := pyCode co_filename. + filename = '' ifTrue: [ ^ 'Unable to get source.' ]. contents := self getContentsOf: pyCode co_filename. ^ self filterPySource: contents lineno: pyCode co_firstlineno \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/getSignature..st b/repository/PyPy.package/PythonDebugger.class/class/getSignature..st index 83e7a2a1..01c496f7 100644 --- a/repository/PyPy.package/PythonDebugger.class/class/getSignature..st +++ b/repository/PyPy.package/PythonDebugger.class/class/getSignature..st @@ -1,5 +1,7 @@ pysource getSignature: pyCode - | content | + | filename content | + filename := pyCode co_filename. + filename = '' ifTrue: [ ^ 'unknown' ]. content := self getContentsOf: pyCode co_filename. ^ content lines at: pyCode co_firstlineno \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/methodProperties.json b/repository/PyPy.package/PythonDebugger.class/methodProperties.json index 43e5754b..f4fc29e7 100644 --- a/repository/PyPy.package/PythonDebugger.class/methodProperties.json +++ b/repository/PyPy.package/PythonDebugger.class/methodProperties.json @@ -3,8 +3,8 @@ "exploreFrames" : "fn 1/18/2017 17:34", "filterPySource:lineno:" : "fn 2/2/2017 00:01", "getContentsOf:" : "fn 2/1/2017 22:37", - "getPySource:" : "fn 2/1/2017 22:36", - "getSignature:" : "fn 2/2/2017 00:04", + "getPySource:" : "fn 2/23/2017 21:19", + "getSignature:" : "fn 2/23/2017 21:19", "indent:by:" : "fn 2/1/2017 22:41", "indentSize:" : "fn 2/1/2017 22:36", "newPyContext" : "fn 2/21/2017 18:55", diff --git a/repository/PyPy.package/PythonExamples.class/class/average..st b/repository/PyPy.package/PythonExamples.class/class/average..st new file mode 100644 index 00000000..e7948e92 --- /dev/null +++ b/repository/PyPy.package/PythonExamples.class/class/average..st @@ -0,0 +1,6 @@ +debugging +average: anIterableDef + Python pexec: ' +def average(iterable): + return sum(iterable) / len(iterable)'. + ^ Python eval: 'average(', anIterableDef, ')' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/average.st b/repository/PyPy.package/PythonExamples.class/class/average.st new file mode 100644 index 00000000..19968836 --- /dev/null +++ b/repository/PyPy.package/PythonExamples.class/class/average.st @@ -0,0 +1,6 @@ +debugging +average + Python pexec: ' +def average(iterable): + return sum(iterable) / len(iterable)'. + ^ Python eval: 'average([])' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/fibonacci..st b/repository/PyPy.package/PythonExamples.class/class/fibonacci..st index e76666ac..dd7be796 100644 --- a/repository/PyPy.package/PythonExamples.class/class/fibonacci..st +++ b/repository/PyPy.package/PythonExamples.class/class/fibonacci..st @@ -1,6 +1,6 @@ debugging fibonacci: x - Python exec: ' + Python pexec: ' def fibonacci(number): lookup_table = [0] for i in range(2, number + 1): diff --git a/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st b/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st index 72efe856..91034740 100644 --- a/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st +++ b/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st @@ -1,6 +1,6 @@ debugging fibonacci9 - Python exec: ' + Python pexec: ' def fibonacci9(): number = 9 lookup_table = [0] diff --git a/repository/PyPy.package/PythonExamples.class/class/miniexample.st b/repository/PyPy.package/PythonExamples.class/class/miniexample.st index 7b413a62..88bc5a68 100644 --- a/repository/PyPy.package/PythonExamples.class/class/miniexample.st +++ b/repository/PyPy.package/PythonExamples.class/class/miniexample.st @@ -1,7 +1,7 @@ debugging miniexample "Use user interrupt to interrupt while loop" - ^ Python exec: ' + ^ Python pexec: ' x = 0 def start(): diff --git a/repository/PyPy.package/PythonExamples.class/methodProperties.json b/repository/PyPy.package/PythonExamples.class/methodProperties.json index c83721f5..5c4d0636 100644 --- a/repository/PyPy.package/PythonExamples.class/methodProperties.json +++ b/repository/PyPy.package/PythonExamples.class/methodProperties.json @@ -1,8 +1,10 @@ { "class" : { - "fibonacci9" : "fn 2/23/2017 17:59", - "fibonacci:" : "fn 2/23/2017 17:59", - "miniexample" : "fn 2/23/2017 17:59", + "average" : "fn 2/23/2017 21:12", + "average:" : "fn 2/23/2017 21:12", + "fibonacci9" : "fn 2/23/2017 21:13", + "fibonacci:" : "fn 2/23/2017 21:13", + "miniexample" : "fn 2/23/2017 21:13", "server" : "fn 2/23/2017 17:59" }, "instance" : { } } diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st index b5ac7d53..dcead268 100644 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st +++ b/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st @@ -1,13 +1,14 @@ as yet unclassified printOn: aStream - self pyFrame - ifNil: [ aStream nextPutAll: 'Unknown pyFrame' ] - ifNotNil: [ | line lineno filename currentPath | - line := PythonDebugger getSignature: pyFrame f_code. - lineno := pyFrame f_lineno. - filename := pyFrame f_code co_filename. - currentPath := FileDirectory default pathName. - (filename startsWith: currentPath) ifTrue: [ - filename := filename allButFirst: currentPath size + 1]. - aStream nextPutAll: line, ' (line ' , lineno asString, ' in ', filename, ')' ]. + | line lineno filename currentPath | + self pyFrame ifNil: [ + aStream nextPutAll: 'Unknown pyFrame'. + ^ self ]. + line := PythonDebugger getSignature: pyFrame f_code. + lineno := pyFrame f_lineno. + filename := pyFrame f_code co_filename. + currentPath := FileDirectory default pathName. + (filename startsWith: currentPath) ifTrue: [ + filename := filename allButFirst: currentPath size + 1]. + aStream nextPutAll: line, ' (line ' , lineno asString, ' in ', filename, ')' \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json b/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json index 3397d7c2..3e02c866 100644 --- a/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json +++ b/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json @@ -3,7 +3,7 @@ }, "instance" : { "isPyContext" : "fn 1/16/2017 19:51", - "printOn:" : "fn 2/2/2017 00:46", + "printOn:" : "fn 2/23/2017 21:16", "pyFrame" : "fn 1/16/2017 19:30", "pyFrame:" : "fn 1/16/2017 19:30", "sender:" : "fn 1/16/2017 21:54", diff --git a/repository/PyPy.package/PythonInspector.class/instance/aboutToStyle..st b/repository/PyPy.package/PythonInspector.class/instance/aboutToStyle..st new file mode 100644 index 00000000..7ba4db7b --- /dev/null +++ b/repository/PyPy.package/PythonInspector.class/instance/aboutToStyle..st @@ -0,0 +1,3 @@ +as yet unclassified +aboutToStyle: aStyler + ^ false \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/fieldList.st b/repository/PyPy.package/PythonInspector.class/instance/fieldList.st index c91582c3..55604587 100644 --- a/repository/PyPy.package/PythonInspector.class/instance/fieldList.st +++ b/repository/PyPy.package/PythonInspector.class/instance/fieldList.st @@ -4,6 +4,5 @@ fieldList | keys | keys := OrderedCollection new. keys add: 'self'. - keys add: 'class'. keys addAll: object allAttributes. ^ keys \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/inspect..st b/repository/PyPy.package/PythonInspector.class/instance/inspect..st deleted file mode 100644 index 6ef06d41..00000000 --- a/repository/PyPy.package/PythonInspector.class/instance/inspect..st +++ /dev/null @@ -1,23 +0,0 @@ -as yet unclassified -inspect: anObject - "Initialize the receiver so that it is inspecting anObject. There is no current selection. - - Normally the receiver will be of the correct class (as defined by anObject inspectorClass), - because it will have just been created by sedning inspect to anObject. However, the - debugger uses two embedded inspectors, which are re-targetted on the current receiver - each time the stack frame changes. The left-hand inspector in the debugger has its - class changed by the code here. Care should be taken if this method is overridden to - ensure that the overriding code calls 'super inspect: anObject', or otherwise ensures that - the class of these embedded inspectors are changed back." - - | c | - c := anObject inspectorClass. - self class ~= c ifTrue: [ - self class format = c format - ifTrue: [self primitiveChangeClassTo: c basicNew] - ifFalse: [self becomeForward: (c basicNew copyFrom: self)]]. - "Set 'object' before sending the initialize message, because some implementations - of initialize (e.g., in DictionaryInspector) require 'object' to be non-nil." - - object := anObject. - self initialize \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/selection.st b/repository/PyPy.package/PythonInspector.class/instance/selection.st index 4ff295cc..59a158e7 100644 --- a/repository/PyPy.package/PythonInspector.class/instance/selection.st +++ b/repository/PyPy.package/PythonInspector.class/instance/selection.st @@ -2,9 +2,8 @@ as yet unclassified selection "The receiver has a list of variables of its inspected object. One of these is selected. Answer the value of the selected variable." - | attr | + | attrName | selectionIndex = 0 ifTrue: [^ '']. selectionIndex = 1 ifTrue: [^ object]. - selectionIndex = 2 ifTrue: [^ object class]. - attr := object allAttributes at: selectionIndex - 2. - ^ object perform: attr asSymbol \ No newline at end of file + attrName := object allAttributes at: selectionIndex - 1. + ^ Python builtins getattr: object attrName: attrName. \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/methodProperties.json b/repository/PyPy.package/PythonInspector.class/methodProperties.json index 0be99838..6c9aa882 100644 --- a/repository/PyPy.package/PythonInspector.class/methodProperties.json +++ b/repository/PyPy.package/PythonInspector.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { + "aboutToStyle:" : "fn 2/24/2017 00:41", "contentsIsString" : "fn 12/23/2016 11:11", - "fieldList" : "fn 12/25/2016 15:26", - "inspect:" : "fn 12/22/2016 21:18", - "selection" : "fn 12/25/2016 15:26" } } + "fieldList" : "fn 2/23/2017 23:10", + "selection" : "fn 2/23/2017 23:10" } } diff --git a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st index 841dcece..a2f21da2 100644 --- a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st +++ b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st @@ -10,7 +10,13 @@ sys.path = ["', Smalltalk image imagePath, '", "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-darwin", "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac", "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac/lib-scriptpackages", - "." ]'. + "." ] +def _isExpression(x): + try: + compile(x, "", "eval") + return True + except SyntaxError: + return False'. "Pythonize all Python classes" self withAllSubclasses do: [ :ea | ea pythonize ]. "Install PythonBuiltins (failing atm)" diff --git a/repository/PyPy.package/PythonObject.class/class/startUp..st b/repository/PyPy.package/PythonObject.class/class/startUp..st index 49637618..9ee1788e 100644 --- a/repository/PyPy.package/PythonObject.class/class/startUp..st +++ b/repository/PyPy.package/PythonObject.class/class/startUp..st @@ -1,4 +1,5 @@ as yet unclassified startUp: resuming + Python reset. (resuming and: [ Python vmSpeaksPython ]) ifTrue: [ self pythonInitialize ] \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/allAttributes.st b/repository/PyPy.package/PythonObject.class/instance/allAttributes.st index 4a5e154e..28742c5f 100644 --- a/repository/PyPy.package/PythonObject.class/instance/allAttributes.st +++ b/repository/PyPy.package/PythonObject.class/instance/allAttributes.st @@ -1,7 +1,3 @@ helpers allAttributes - | attributes | - attributes := OrderedCollection new. - (self hasAttribute: '__dict__') ifTrue: [ attributes add: '__dict__']. - attributes addAll: self pyDictKeys. - ^ attributes \ No newline at end of file + ^ (Python builtins dir: self) asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/asSmalltalk.st b/repository/PyPy.package/PythonObject.class/instance/asSmalltalk.st new file mode 100644 index 00000000..33ef364d --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/asSmalltalk.st @@ -0,0 +1,4 @@ +helpers +asSmalltalk + + self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/at..st b/repository/PyPy.package/PythonObject.class/instance/at..st new file mode 100644 index 00000000..7282371f --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/at..st @@ -0,0 +1,3 @@ +overrides +at: aKeyOrIndex + ^ self __getitem__: aKeyOrIndex \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/at.put..st b/repository/PyPy.package/PythonObject.class/instance/at.put..st new file mode 100644 index 00000000..70812ae6 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/at.put..st @@ -0,0 +1,3 @@ +overrides +at: aKeyOrIndex put: aValue + ^ self __setitem__: aKeyOrIndex to: aValue \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/class.st b/repository/PyPy.package/PythonObject.class/instance/class.st index 66c21a5a..8e78e221 100644 --- a/repository/PyPy.package/PythonObject.class/instance/class.st +++ b/repository/PyPy.package/PythonObject.class/instance/class.st @@ -1,5 +1,3 @@ overrides class - self isClass - ifTrue: [ ^ self ] - ifFalse: [ ^ self __class__ ] \ No newline at end of file + ^ Python builtins type: self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/className.st b/repository/PyPy.package/PythonObject.class/instance/className.st new file mode 100644 index 00000000..ba8f8900 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/className.st @@ -0,0 +1,4 @@ +helpers +className + self hasClass ifFalse: [ self error: 'No class found' ]. + ^ self __class__ __name__ asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/defaultLabelForInspector.st b/repository/PyPy.package/PythonObject.class/instance/defaultLabelForInspector.st new file mode 100644 index 00000000..d63a8ce0 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/defaultLabelForInspector.st @@ -0,0 +1,5 @@ +overrides +defaultLabelForInspector + "Answer the default label to be used for an Inspector window on the receiver." + self hasClass ifTrue: [ ^ self className, ': ', self asString ]. + ^ self asString \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/explore.st b/repository/PyPy.package/PythonObject.class/instance/explore.st new file mode 100644 index 00000000..6aacfcbf --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/explore.st @@ -0,0 +1,3 @@ +inspector +explore + ^PythonToolSet explore: self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/explorerContents.st b/repository/PyPy.package/PythonObject.class/instance/explorerContents.st index 4d723907..3a67d6e8 100644 --- a/repository/PyPy.package/PythonObject.class/instance/explorerContents.st +++ b/repository/PyPy.package/PythonObject.class/instance/explorerContents.st @@ -1,8 +1,8 @@ explorer explorerContents - ^ self allAttributes asOrderedCollection collect: [:each | | value | - value := self perform: each. + ^ self allAttributes asOrderedCollection collect: [ :attrName | | value | + value := Python builtins getattr: self attrName: attrName. ObjectExplorerWrapper with: value - name: each - model: self] \ No newline at end of file + name: attrName + model: self ] \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st b/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st index d53f819c..0864bd07 100644 --- a/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st +++ b/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st @@ -1,3 +1,3 @@ helpers hasAttribute: anAttribute - ^ Python builtins hasattr: self attr: anAttribute \ No newline at end of file + ^ (Python builtins hasattr: self attr: anAttribute) asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/hasClass.st b/repository/PyPy.package/PythonObject.class/instance/hasClass.st new file mode 100644 index 00000000..2df639b8 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/hasClass.st @@ -0,0 +1,3 @@ +helpers +hasClass + ^ self hasAttribute: '__class__' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/isClass.st b/repository/PyPy.package/PythonObject.class/instance/isClass.st index 9a5cbed8..af8b5c1a 100644 --- a/repository/PyPy.package/PythonObject.class/instance/isClass.st +++ b/repository/PyPy.package/PythonObject.class/instance/isClass.st @@ -1,3 +1,3 @@ helpers isClass - ^ Python builtins isinstance: self and: Python type \ No newline at end of file + ^ (Python builtins isinstance: self and: Python type) asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/printOn..st b/repository/PyPy.package/PythonObject.class/instance/printOn..st index 7485e62f..90a363f8 100644 --- a/repository/PyPy.package/PythonObject.class/instance/printOn..st +++ b/repository/PyPy.package/PythonObject.class/instance/printOn..st @@ -1,10 +1,3 @@ overrides printOn: aStream - "Append to the argument, aStream, a sequence of characters that - identifies the receiver." - - | title | - title := self pyString. - aStream - nextPutAll: (title first isVowel ifTrue: ['an '] ifFalse: ['a ']); - nextPutAll: title \ No newline at end of file + aStream nextPutAll: (Python builtins str: self) asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/pyString.st b/repository/PyPy.package/PythonObject.class/instance/pyString.st deleted file mode 100644 index 29759e1b..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/pyString.st +++ /dev/null @@ -1,5 +0,0 @@ -helpers -pyString - (self hasAttribute: '__name__') ifTrue: [ ^ self __name__ ]. - self isClass ifFalse: [ ^ self __str__ ]. - ^ 'unknown PyObject' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/shoutParserClass.st b/repository/PyPy.package/PythonObject.class/instance/shoutParserClass.st new file mode 100644 index 00000000..eaf63606 --- /dev/null +++ b/repository/PyPy.package/PythonObject.class/instance/shoutParserClass.st @@ -0,0 +1,4 @@ +overrides +shoutParserClass + "Answer the parser class" + ^SHParserST80 \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/methodProperties.json b/repository/PyPy.package/PythonObject.class/methodProperties.json index 9b5a9e1f..b270ca89 100644 --- a/repository/PyPy.package/PythonObject.class/methodProperties.json +++ b/repository/PyPy.package/PythonObject.class/methodProperties.json @@ -12,35 +12,42 @@ "new" : "fn 12/19/2016 14:14", "nextID" : "fn 12/18/2016 23:45", "printString2" : "fn 12/20/2016 19:24", - "pythonInitialize" : "fn 2/23/2017 13:21", + "pythonInitialize" : "fn 2/23/2017 21:35", "pythonize" : "fn 12/21/2016 00:15", "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", "sourceCodeAt:ifAbsent:" : "fn 12/19/2016 14:07", - "startUp:" : "fn 12/21/2016 15:13", + "startUp:" : "fn 2/23/2017 21:01", "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 12/19/2016 14:05", "withAll2:" : "fn 12/22/2016 15:19", "withAll3:" : "fn 12/21/2016 14:50", "withAll:" : "fn 12/22/2016 15:19" }, "instance" : { - "allAttributes" : "fn 12/25/2016 15:30", + "allAttributes" : "fn 2/26/2017 21:35", "allInstVarNames" : "fn 12/22/2016 23:20", - "class" : "fn 12/22/2016 22:23", + "asSmalltalk" : "fn 2/26/2017 21:04", + "at:" : "fn 2/26/2017 20:40", + "at:put:" : "fn 2/26/2017 20:41", + "class" : "fn 2/26/2017 21:41", + "className" : "fn 2/26/2017 22:01", + "defaultLabelForInspector" : "fn 2/26/2017 21:54", "environment" : "fn 12/22/2016 22:00", "evaluatorClass" : "fn 12/23/2016 00:01", - "explorerContents" : "fn 12/22/2016 23:49", - "hasAttribute:" : "fn 12/22/2016 21:46", + "explore" : "fn 2/24/2017 14:51", + "explorerContents" : "fn 2/24/2017 14:55", + "hasAttribute:" : "fn 2/26/2017 21:41", + "hasClass" : "fn 2/26/2017 21:52", "hasContentsInExplorer" : "fn 12/22/2016 23:11", "inspect" : "fn 12/22/2016 21:09", "inspectorClass" : "fn 12/22/2016 21:16", "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", - "isClass" : "fn 12/22/2016 21:52", + "isClass" : "fn 2/26/2017 21:42", "isKindOf:" : "fn 12/25/2016 14:47", "isPython" : "fn 2/10/2017 12:12", "newParser" : "fn 12/22/2016 22:19", - "printOn:" : "fn 2/2/2017 17:06", - "pyDictKeys" : "fn 12/25/2016 15:25", - "pyDictValues" : "fn 12/25/2016 15:25", + "printOn:" : "fn 2/26/2017 21:33", + "pyDictKeys" : "fn 2/26/2017 21:42", + "pyDictValues" : "fn 2/26/2017 21:42", "pyIdentifier" : "fn 1/18/2017 17:20", - "pyString" : "fn 12/25/2016 14:50", "respondsTo:" : "fn 12/22/2016 23:36", + "shoutParserClass" : "fn 2/23/2017 22:55", "variablesAndOffsetsDo:" : "fn 12/22/2016 23:59" } } diff --git a/repository/PyPy.package/PythonObjectExplorer.class/README.md b/repository/PyPy.package/PythonObjectExplorer.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/PyPy.package/PythonObjectExplorer.class/methodProperties.json b/repository/PyPy.package/PythonObjectExplorer.class/methodProperties.json new file mode 100644 index 00000000..0e4a6622 --- /dev/null +++ b/repository/PyPy.package/PythonObjectExplorer.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + } } diff --git a/repository/PyPy.package/PythonObjectExplorer.class/properties.json b/repository/PyPy.package/PythonObjectExplorer.class/properties.json new file mode 100644 index 00000000..874488b6 --- /dev/null +++ b/repository/PyPy.package/PythonObjectExplorer.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PyPy", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonObjectExplorer", + "pools" : [ + ], + "super" : "ObjectExplorer", + "type" : "normal" } diff --git a/repository/PyPy.package/PythonTest.class/instance/testEvaluable.st b/repository/PyPy.package/PythonTest.class/instance/testEvaluable.st deleted file mode 100644 index 3ef04278..00000000 --- a/repository/PyPy.package/PythonTest.class/instance/testEvaluable.st +++ /dev/null @@ -1,9 +0,0 @@ -testing -testEvaluable - self assert: (Python evaluable: '1'). - self assert: (Python evaluable: 'foo()'). - self deny: (Python evaluable: 'x = 1'). - self assert: (Python evaluable: '1 == 1'). - self deny: (Python evaluable: 'def foo(): - return 42'). - self deny: (Python evaluable: 'def foo(): pass') \ No newline at end of file diff --git a/repository/PyPy.package/PythonTest.class/instance/testIsExpression.st b/repository/PyPy.package/PythonTest.class/instance/testIsExpression.st new file mode 100644 index 00000000..031b5f8d --- /dev/null +++ b/repository/PyPy.package/PythonTest.class/instance/testIsExpression.st @@ -0,0 +1,10 @@ +testing +testIsExpression + self assert: (Python isExpression: '1'). + self assert: (Python isExpression: 'foo()'). + self deny: (Python isExpression: 'x = 1'). + self assert: (Python isExpression: '1 == 1'). + self deny: (Python isExpression: 'def foo(): + return 42'). + self deny: (Python isExpression: 'def foo(): pass'). + self deny: (Python isExpression: 'import os') \ No newline at end of file diff --git a/repository/PyPy.package/PythonTest.class/methodProperties.json b/repository/PyPy.package/PythonTest.class/methodProperties.json index af5f8e0f..05272ef9 100644 --- a/repository/PyPy.package/PythonTest.class/methodProperties.json +++ b/repository/PyPy.package/PythonTest.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "testEvaluable" : "fn 2/22/2017 14:12" } } + "testIsExpression" : "fn 2/23/2017 21:37" } } diff --git a/repository/PyPy.package/PythonToolSet.class/class/explore..st b/repository/PyPy.package/PythonToolSet.class/class/explore..st new file mode 100644 index 00000000..1cf1e9f3 --- /dev/null +++ b/repository/PyPy.package/PythonToolSet.class/class/explore..st @@ -0,0 +1,4 @@ +as yet unclassified +explore: anObject + + ^ PythonObjectExplorer openOn: anObject \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/methodProperties.json b/repository/PyPy.package/PythonToolSet.class/methodProperties.json index 3fe98b39..db6c7057 100644 --- a/repository/PyPy.package/PythonToolSet.class/methodProperties.json +++ b/repository/PyPy.package/PythonToolSet.class/methodProperties.json @@ -1,6 +1,7 @@ { "class" : { "debug:context:label:contents:fullView:" : "fn 1/19/2017 11:56", + "explore:" : "fn 2/24/2017 14:51", "initialize" : "fn 1/16/2017 18:52", "inspectorClassOf:" : "fn 12/22/2016 21:11", "interrupt:label:" : "fn 1/18/2017 15:08" }, diff --git a/repository/PyPy.package/PythonWorkspace.class/instance/doItReceiver.st b/repository/PyPy.package/PythonWorkspace.class/instance/doItReceiver.st deleted file mode 100644 index 72a43f7f..00000000 --- a/repository/PyPy.package/PythonWorkspace.class/instance/doItReceiver.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -doItReceiver - ^ Python new \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st b/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st index 6fc3b844..2e821c0a 100644 --- a/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st +++ b/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st @@ -1,3 +1,3 @@ as yet unclassified evaluateExpression: selection - ^ Python run: selection \ No newline at end of file + ^ Python prun: selection asString \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json index f0c0bb43..78860339 100644 --- a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json +++ b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json @@ -2,5 +2,4 @@ "class" : { "open" : "fn 12/22/2016 02:51" }, "instance" : { - "doItReceiver" : "fn 12/22/2016 02:52", - "evaluateExpression:" : "fn 2/23/2017 17:46" } } + "evaluateExpression:" : "fn 2/23/2017 21:21" } } diff --git a/repository/PyPy.package/monticello.meta/version b/repository/PyPy.package/monticello.meta/version index a9a719e3..e1629a44 100644 --- a/repository/PyPy.package/monticello.meta/version +++ b/repository/PyPy.package/monticello.meta/version @@ -1 +1 @@ -(name 'PyPy-fn.11' message 'Add examples; minor bugfixes' id 'a852e871-13f5-497e-ae53-ae98c9316e6b' date '23 February 2017' time '6:08:59.626935 pm' author 'fn' ancestors ((name 'PyPy-fn.10' message 'Updates' id '756686b6-8c03-4a9c-a74f-cc14c1175d12' date '23 February 2017' time '1:23:47.638052 pm' author 'fn' ancestors ((name 'PyPy-fn.9' message 'Fix Python class>>resumeFrame; remove deprecated methods; improve theme' id '41b4e13b-2de2-40f5-afa9-b086f1f21be4' date '21 February 2017' time '10:14:39.643391 pm' author 'fn' ancestors ((name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'PyPy-fn.12' message 'Updates' id 'f3b97d42-56d6-4f59-9da3-2493cbe1fdaf' date '26 February 2017' time '10:09:08.470218 pm' author 'fn' ancestors ((name 'PyPy-fn.11' message 'Add examples; minor bugfixes' id 'a852e871-13f5-497e-ae53-ae98c9316e6b' date '23 February 2017' time '6:08:59.626935 pm' author 'fn' ancestors ((name 'PyPy-fn.10' message 'Updates' id '756686b6-8c03-4a9c-a74f-cc14c1175d12' date '23 February 2017' time '1:23:47.638052 pm' author 'fn' ancestors ((name 'PyPy-fn.9' message 'Fix Python class>>resumeFrame; remove deprecated methods; improve theme' id '41b4e13b-2de2-40f5-afa9-b086f1f21be4' date '21 February 2017' time '10:14:39.643391 pm' author 'fn' ancestors ((name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From e55df89852712d20e5d0b6743c8387b4df05d2a3 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 27 Feb 2017 14:02:24 +0100 Subject: [PATCH 099/193] Add end to end tests and download pypy.image --- .gitignore | 2 + .travis/install_requirements.sh | 19 ++++ .../test/plugins/python/test_end_to_end.py | 86 +++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 rsqueakvm/test/plugins/python/test_end_to_end.py diff --git a/.gitignore b/.gitignore index 8d8ccdfe..edfa91f7 100644 --- a/.gitignore +++ b/.gitignore @@ -275,3 +275,5 @@ images/ .build/rply .build/topaz docs/_build + +rsqueakvm/test/images/pypy.image diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index 5490575c..ac2a25e8 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -2,6 +2,8 @@ set -ex readonly BASE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly TEST_IMAGES_BASE="${TRAVIS_BUILD_DIR}/rsqueakvm/test/images/" +readonly TEST_IMAGES_BASE_URL="https://www.hpi.uni-potsdam.de/hirschfeld/artefacts/rsqueak/testing/images/" presetup_osx() { echo "macOS Pre-setup" @@ -140,6 +142,21 @@ setup_linux() { esac } +load_test_images() { + local target + local url + + if [[ -z "${TEST_TYPE}" ]]; then + return + fi + + if [[ "${PLUGINS}" = "PythonPlugin" ]]; then + target="${TEST_IMAGES_BASE}/pypy.image" + url="${TEST_IMAGES_BASE_URL}/pypy.image" + curl -f -s -L --retry 3 -o "${target}" "${url}" + fi +} + # Only build arm on master if [[ "${TRAVIS_BRANCH}" != "master" ]] && [[ "${BUILD_ARCH}" = arm* ]]; then exit 0 @@ -149,6 +166,8 @@ presetup_$TRAVIS_OS_NAME python .build/download_dependencies.py || true setup_$TRAVIS_OS_NAME +load_test_images + if [[ -d ".build/sqpyte" ]]; then # Make sqlite/sqpyte for DatabasePlugin pushd ".build/sqpyte" > /dev/null diff --git a/rsqueakvm/test/plugins/python/test_end_to_end.py b/rsqueakvm/test/plugins/python/test_end_to_end.py new file mode 100644 index 00000000..b656a59a --- /dev/null +++ b/rsqueakvm/test/plugins/python/test_end_to_end.py @@ -0,0 +1,86 @@ +from rsqueakvm.model.base import W_Object +from rsqueakvm.model.numeric import W_SmallInteger +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.python.model import W_PythonObject +from rsqueakvm.plugins.python.patching import patch_pypy +from rsqueakvm.test.util import create_space, cleanup_module, read_image + + +def test_space(): + return create_space(bootstrap=True) + +patch_pypy() +space = interp = perform = w = None +NAME_TEMPLATE = 'getPy%s' +CALL_COUNTER = 0 + + +def get_next_name(): + global CALL_COUNTER + CALL_COUNTER += 1 + return NAME_TEMPLATE % CALL_COUNTER + + +def perform(receiver, selector, *args): + w_selector = None if isinstance(selector, str) else selector + return interp.perform(receiver, selector, w_selector, list(args)) + + +def setup_module(): + global space, interp, perform, w + space, interp, image, reader = read_image('pypy.image') + w = space.w + space.runtime_setup(interp, '', [], '', 0) + space.headless.activate() + gs.startup(space) + + +def teardown_module(): + cleanup_module(__name__) + + +def add_method_and_call(sourcecode, name): + perform(w(0).getclass(space), 'compile:classified:notifying:', + w(sourcecode), w('pypy'), w(None)) + return perform(w(0), name) + + +def get_python_result(code, cmd='eval'): + name = get_next_name() + sourcecode = """%s + ^ Python %s: '%s'""" % (name, cmd, code) + w_res = add_method_and_call(sourcecode, name) + assert isinstance(w_res, W_PythonObject) + return gs.py_space.unwrap(w_res.wp_object) + + +def get_smalltalk_result(code, cmd='eval'): + name = get_next_name() + sourcecode = """%s + ^ (Python %s: '%s') asSmalltalk""" % (name, cmd, code) + w_res = add_method_and_call(sourcecode, name) + assert isinstance(w_res, W_Object) + return w_res + + +def test_simple(): + assert get_python_result('None') is None + assert get_python_result('1 + 1') == 2 + assert get_python_result('dict(a=2, b=True)') == {'a': 2, 'b': True} + + +def test_assignment(): + assert get_python_result('foo = 42', 'exec') is None + assert get_python_result('foo', 'eval') == 42 + + +def test_smalltalk(): + res = get_smalltalk_result('21 * 2') + assert isinstance(res, W_SmallInteger) + assert res.value == 42 + + res = get_smalltalk_result('[1, 2, 3, 4]') + assert isinstance(res, W_PointersObject) + assert res.getclass(space) is space.w_Array + assert res.size() == 4 From de1f3efe3d660e532da6e8c68686a80ee2d683ab Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 27 Feb 2017 15:05:42 +0100 Subject: [PATCH 100/193] Use pypy-5.3.1 provided by Travis --- .travis.yml | 4 +++- .travis/build-linux.sh | 10 +++++----- .travis/build-macos.sh | 8 ++++---- .travis/install_requirements.sh | 3 --- .travis/test.sh | 7 +------ 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index eefe0c57..ef708468 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ -language: cpp +language: python +python: + - pypy-5.3.1 sudo: required dist: trusty group: edge diff --git a/.travis/build-linux.sh b/.travis/build-linux.sh index 99e94aac..2043cbb9 100755 --- a/.travis/build-linux.sh +++ b/.travis/build-linux.sh @@ -21,21 +21,21 @@ fi case "$BUILD_ARCH" in 32bit) - python .build/build.py --batch --32bit -- $plugins + pypy .build/build.py --batch --32bit -- $plugins exitcode=$? cp rsqueak rsqueak-x86-${UNAME}$plugins_suffix-jit-$TRAVIS_COMMIT || true - python .build/jittests.py --32bit || $JITTESTS_FAIL + pypy .build/jittests.py --32bit || $JITTESTS_FAIL $EX rm -rf .build/pypy/rpython/_cache ;; 64bit) - python .build/build.py --batch --64bit -- $plugins + pypy .build/build.py --batch --64bit -- $plugins exitcode=$? cp rsqueak rsqueak-x86_64-${UNAME}$plugins_suffix-jit-$TRAVIS_COMMIT || true - python .build/jittests.py --64bit || $JITTESTS_FAIL + pypy .build/jittests.py --64bit || $JITTESTS_FAIL $EX rm -rf .build/pypy/rpython/_cache ;; lldebug) - python .build/build.py --lldebug -Ojit + pypy .build/build.py --lldebug -Ojit exitcode=$? cp rsqueak rsqueak-x86-${UNAME}-dbg-$TRAVIS_COMMIT || true $EX rm -rf .build/pypy/rpython/_cache diff --git a/.travis/build-macos.sh b/.travis/build-macos.sh index a2b0f7c8..5171ceeb 100755 --- a/.travis/build-macos.sh +++ b/.travis/build-macos.sh @@ -15,21 +15,21 @@ fi case "$BUILD_ARCH" in 32bit) - python .build/build.py $plugins + pypy .build/build.py $plugins exitcode=$? cp rsqueak rsqueak-x86-${UNAME}$plugins_suffix-jit-$TRAVIS_COMMIT || true - # python .build/jittests.py + # pypy .build/jittests.py # $EX rm -rf .build/pypy/rpython/_cache ;; 64bit) pypy .build/build.py -- $plugins exitcode=$? cp rsqueak rsqueak-x86_64-${UNAME}$plugins_suffix-jit-$TRAVIS_COMMIT || true - # python .build/jittests.py + # pypy .build/jittests.py # $EX rm -rf .build/pypy/rpython/_cache ;; lldebug) - python .build/build.py --lldebug -Ojit + pypy .build/build.py --lldebug -Ojit exitcode=$? cp rsqueak rsqueak-x86-${UNAME}-dbg-$TRAVIS_COMMIT || true # $EX rm -rf .build/pypy/rpython/_cache diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index ac2a25e8..1dfb5969 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -14,9 +14,6 @@ setup_osx() { 64bit) # brew update - # Use Pypy2 v5.4.0 - brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/c5a201f49c9da47d4771ebc544d10b3f9c579021/Formula/pypy.rb - brew install sdl2 ;; esac diff --git a/.travis/test.sh b/.travis/test.sh index c13ba42c..175a26f3 100755 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -23,9 +23,4 @@ case "${BUILD_ARCH}" in *) ;; esac -ex="python" -if [[ "${TRAVIS_OS_NAME}" == "osx" ]] && [[ "${BUILD_ARCH}" == "64bit" ]]; then - ex="pypy" -fi - -${ex} ".build/${testscript}" ${testflag} +pypy ".build/${testscript}" ${testflag} From 2cb26aa33af2ba2afb37a5b93d839eaf6a578d07 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 27 Feb 2017 15:15:38 +0100 Subject: [PATCH 101/193] Disable notifications --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef708468..3b120e42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,13 @@ python: sudo: required dist: trusty group: edge -notifications: - irc: - channels: - - chat.freenode.net/#rsqueak - use_notice: true - skip_join: true - slack: mp2016h:7AUemvDdkxof6Shbu514mDyX +# notifications: +# irc: +# channels: +# - chat.freenode.net/#rsqueak +# use_notice: true +# skip_join: true +# slack: mp2016h:7AUemvDdkxof6Shbu514mDyX branches: except: - /^v[0-9]/ # Ignore version tags From 4d98fa56543b085a2ffff6064e5794ad1c56c441 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 27 Feb 2017 15:37:31 +0100 Subject: [PATCH 102/193] Install PyPy via brew on macOS --- .travis.yml | 4 ++-- .travis/install_requirements.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3b120e42..a3efb873 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python -python: - - pypy-5.3.1 +python: pypy-5.3.1 sudo: required dist: trusty group: edge @@ -49,6 +48,7 @@ matrix: # env: BUILD_ARCH=64bit PLUGINS=RubyPlugin - os: osx osx_image: xcode7.3 + language: cpp env: BUILD_ARCH=64bit PLUGINS=PythonPlugin # allow_failures: # - env: BUILD_ARCH=64bit PLUGINS=DatabasePlugin diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index 1dfb5969..a31af0d8 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -14,6 +14,9 @@ setup_osx() { 64bit) # brew update + # Use PyPy2 v5.4.0 + brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/c5a201f49c9da47d4771ebc544d10b3f9c579021/Formula/pypy.rb + brew install sdl2 ;; esac From 62fac74a9073f731443749d835ee41112600602c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 6 Mar 2017 07:45:27 +0100 Subject: [PATCH 103/193] Remove asserts and print errors instead --- rsqueakvm/plugins/python/execution.py | 5 +++-- rsqueakvm/plugins/python/model.py | 7 +++---- rsqueakvm/plugins/python/utils.py | 13 +++++++++---- rsqueakvm/plugins/python_plugin.py | 4 +++- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 9dcd3e18..8f770126 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -158,7 +158,8 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): # assert s_frame.w_method() is not resume_method s_resume_frame.store_s_sender(s_frame) else: - assert s_frame.w_method() is resume_method + if s_frame.w_method() is not resume_method: + print 'Unexpected s_frame found.' s_resume_frame.store_s_sender(s_frame.s_sender()) interp.quick_check_for_interrupt(s_resume_frame, dec=interp.interrupt_counter_size) @@ -168,7 +169,7 @@ def switch_to_smalltalk(interp, s_frame, first_call=False): def _create_return_frame(space, wp_result): from rsqueakvm.storage_contexts import ContextPartShadow - print 'Python has finished and returned a result' + print 'Python has finished and returned a result.' # we want evalInThread and resumePython to return new frames, # so we don't build up stack, but we also don't raise to the # top-level loop all the time. diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 3687abf0..3783ff1e 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -48,8 +48,7 @@ def getclass(self, space): return self.safe_getclass(space) def class_shadow(self, space): - wp_class = py_space.type(self.wp_object) - return PythonClassShadow(space, self.wp_object, wp_class) + return PythonClassShadow(space, self.wp_object) # @staticmethod # @jit.elidable @@ -66,9 +65,9 @@ class PythonClassShadow(ClassShadow): _attrs_ = ['wp_object', 'wp_class'] _immutable_fields_ = ['wp_class'] - def __init__(self, space, wp_object, wp_class): - assert isinstance(wp_class, WP_Root) + def __init__(self, space, wp_object): self.wp_object = wp_object + wp_class = py_space.type(self.wp_object) self.wp_class = wp_class self.name = wp_class.name AbstractCachingShadow.__init__( diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index fd5d72e7..5c2aec24 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -28,7 +28,9 @@ def _run_eval_string(source, filename, cmd): pycode = compilecode(py_space, source, filename or '', cmd) mainmodule = ensure__main__(py_space) - assert isinstance(mainmodule, Module) + if not isinstance(mainmodule, Module): + print 'mainmodule not an instance of Module.' + return w_globals = mainmodule.w_dict py_space.setitem(w_globals, ws('__builtins__'), py_space.builtin) @@ -99,7 +101,9 @@ def get_restart_pycode(source, filename='', cmd='exec'): try: py_code = py_compiling.compile(py_space, py_space.newtext(source), filename, cmd) - assert isinstance(py_code, PyCode) + if not isinstance(py_code, PyCode): + print 'py_code not an instance of PyCode' + return if cmd == 'eval': return py_code co_consts_w_len = len(py_code.co_consts_w) @@ -114,7 +118,7 @@ def get_restart_pycode(source, filename='', cmd='exec'): except OperationError as e: # import pdb; pdb.set_trace() print 'Failed to compile new frame: %s' % e.errorstr(py_space) - return None + return def call_method(space, wp_rcvr, methodname, args_w): @@ -165,7 +169,8 @@ def call_function(space, wp_func, args_w): def operr_to_pylist(operr): - assert isinstance(operr, OperationError) + if not isinstance(operr, OperationError): + return wp_exception = py_space.newtext(operr.w_type.getname(py_space)) wp_value = operr.get_w_value(py_space) # wp_traceback = operr.get_traceback() or py_space.w_None diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 3dfb7175..44481b15 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -128,7 +128,9 @@ def send(interp, s_frame, argcount, w_method): args_w = s_frame.peek_n(argcount) wp_rcvr = utils.smalltalk_to_python(space, s_frame.peek(argcount)) w_selector_name = w_method.literalat0(space, 2) - assert isinstance(w_selector_name, W_BytesObject) + if not isinstance(w_selector_name, W_BytesObject): + print 'w_selector_name not an instance of W_BytesObject' + raise PrimitiveFailedError methodname = space.unwrap_string(w_selector_name) idx = methodname.find(':') if idx > 0: From e19b610f2920c497491a86ad1be40af66ae4c799 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 6 Mar 2017 07:46:08 +0100 Subject: [PATCH 104/193] Simplify send primitive and rename breakOnExceptions primitive --- rsqueakvm/plugins/python_plugin.py | 35 +++++++++++++----------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 44481b15..74aca5e5 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -77,7 +77,7 @@ def lastError(interp, s_frame, w_rcvr): @PythonPlugin.expose_primitive(clean_stack=False) -def breakOnException(interp, s_frame, argcount): +def breakOnExceptions(interp, s_frame, argcount): if argcount == 0: return interp.space.wrap_bool(global_state.break_on_exception.get()) if argcount != 1: @@ -137,28 +137,23 @@ def send(interp, s_frame, argcount, w_method): methodname = methodname[0:idx] wp_result = None try: - if wp_rcvr is py_space.builtin: - builtin = py_space.builtin.get(methodname) - wp_result = utils.call_function(space, builtin, args_w) + py_attr = py_space.getattr(wp_rcvr, py_space.newtext(methodname)) + if (isinstance(py_attr, Function) or + isinstance(py_attr, Method) or + isinstance(py_attr, StaticMethod) or + isinstance(py_attr, ClassMethod)): + wp_result = utils.call_method( + space, wp_rcvr, methodname, args_w) else: - py_attr = py_space.getattr(wp_rcvr, py_space.newtext(methodname)) - # Only allow to call certain types (e.g. don't allow __class__()) - if (isinstance(py_attr, Function) or - isinstance(py_attr, Method) or - isinstance(py_attr, StaticMethod) or - isinstance(py_attr, ClassMethod)): - wp_result = utils.call_method( - space, wp_rcvr, methodname, args_w) + if len(args_w) == 1: + wp_value = utils.smalltalk_to_python(space, args_w[0]) + py_space.setattr(wp_rcvr, py_space.newtext(methodname), + wp_value) + wp_result = py_space.w_None else: - if len(args_w) == 1: - wp_value = utils.smalltalk_to_python(space, args_w[0]) - py_space.setattr(wp_rcvr, py_space.newtext(methodname), - wp_value) - wp_result = py_space.w_None - else: - wp_result = py_attr + wp_result = py_attr except OperationError as operationerr: - print operationerr.errorstr(py_space) + print 'Operror in send (%s)' % operationerr.errorstr(py_space) raise PrimitiveFailedError except Exception as e: print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) From 64769142c2cc734b6cfc8636abb94d46c9d99f61 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 6 Mar 2017 21:12:55 +0100 Subject: [PATCH 105/193] Improve thread switching and handle unicodes --- rsqueakvm/plugins/python/execution.py | 8 ++------ rsqueakvm/plugins/python/global_state.py | 10 ++++++---- rsqueakvm/plugins/python/utils.py | 4 +++- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 8f770126..742acdf8 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -24,7 +24,7 @@ def start_new_thread(source, filename, cmd, translated): def resume_thread(): runner = gs.py_runner.get() - if runner is None or not runner.resumable(): + if runner is None: print 'No runner to resume with' return False runner.resume() @@ -40,7 +40,6 @@ def __init__(self, source, filename, cmd): self.source = source self.filename = filename self.cmd = cmd - self._resumable = True def run(self): print 'Python start' @@ -60,7 +59,7 @@ def run(self): except Exception as e: print 'Unknown error in Python thread: %s' % e finally: - self._resumable = False + gs.py_runner.set(None) def save_result(self, result): gs.wp_result.set(result) @@ -84,9 +83,6 @@ def start(self): def resume(self): raise NotImplementedError - def resumable(self): - return self.language._resumable - def return_to_smalltalk(self): raise NotImplementedError diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 3a111ddd..f25dea56 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -29,10 +29,12 @@ class SwitchToSmalltalkAction(PeriodicAsyncAction): def perform(self, ec=None, frame=None): # import pdb; pdb.set_trace() runner = py_runner.get() - if runner: - # print 'Python yield' - runner.return_to_smalltalk() - # print 'Python continue' + if not runner: + return + + # print 'Python yield' + runner.return_to_smalltalk() + # print 'Python continue' # operror has been in Smalltalk land, clear it now to allow resuming wp_operror.set(None) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 5c2aec24..940f7ba6 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -16,6 +16,7 @@ from pypy.objspace.std.intobject import W_IntObject as WP_IntObject from pypy.objspace.std.listobject import W_ListObject as WP_ListObject from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject +from pypy.objspace.std.unicodeobject import W_UnicodeObject as WP_UnicodeObject from rpython.rlib import objectmodel @@ -53,7 +54,8 @@ def python_to_smalltalk(space, wp_object): # import pdb; pdb.set_trace() if isinstance(wp_object, WP_FloatObject): return space.wrap_float(py_space.float_w(wp_object)) - elif isinstance(wp_object, WP_BytesObject): + elif (isinstance(wp_object, WP_BytesObject) or + isinstance(wp_object, WP_UnicodeObject)): return space.wrap_string(py_space.text_w(wp_object)) elif isinstance(wp_object, WP_ListObject): return space.wrap_list( From 41f8731619ae5e4b3cd204faa71d835270e05803 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 7 Mar 2017 18:18:45 +0100 Subject: [PATCH 106/193] Improve and reorganize in-image Python integration [ci skip] --- repository/Python-Core.package/.filetree | 4 + .../Object.extension/instance/isPython.st | 3 + .../Object.extension/methodProperties.json | 5 + .../Object.extension/properties.json | 2 + .../Python.class/README.md | 0 .../Python.class/class/False.st | 3 + .../Python.class/class/None.st | 3 + .../Python.class/class/True.st | 3 + .../Python.class/class/basicVmSpeaksPython.st | 4 + .../Python.class/class/builtins.st | 3 + .../Python.class/class/cmdFor..st | 5 + .../Python.class/class/eval..st | 3 + .../Python.class/class/evaluatorClass.st | 3 + .../Python.class/class/exec..st | 3 + .../Python.class/class/from.import..st | 3 + .../Python.class/class/from.load..st | 4 + .../Python.class/class/fromObjectCache..st | 4 + .../Python.class/class/getSource..st | 3 + .../Python.class/class/globals.st | 4 + .../Python.class/class/import..st | 3 + .../Python.class/class/initialize.st | 5 + .../Python.class/class/isCallable..st | 3 + .../Python.class/class/isExpression..st | 4 + .../Python.class/class/load..st | 4 + .../Python.class/class/locals.st | 4 + .../class/openDebuggerWithPythonFrames..st | 16 +++ .../Python.class/class/persistPyCode..st | 9 ++ .../Python.class/class/peval..st | 3 + .../Python.class/class/pexec..st | 3 + .../class/primBreakOnExceptions..st | 4 + .../class/primBreakOnExceptions.st | 4 + .../Python.class/class/primEval.cmd..st | 4 + .../class/primEval.filename.cmd..st | 4 + .../Python.class/class/primGetTopFrame.st | 5 + .../Python.class/class/primLastError.st | 4 + .../Python.class/class/primLastResult.st | 4 + .../Python.class/class/primPythonAt..st | 4 + ...startSpecificFrame.source.filename.cmd..st | 5 + .../Python.class/class/primResume.st | 4 + .../Python.class/class/prun..st | 5 + .../Python.class/class/pyFormatter.st | 3 + .../Python.class/class/pyInspect.st | 3 + .../Python.class/class/pyLexerPython.st | 3 + .../Python.class/class/pyLexerSmalltalk.st | 3 + .../Python.class/class/pygments.st | 3 + .../Python.class/class/reset.st | 4 + .../Python.class/class/restartFrame.st | 3 + .../Python.class/class/restartFrame.with..st | 7 + .../class/restartFrameWith.cmd..st | 4 + .../Python.class/class/resumeFrame.st | 7 + .../Python.class/class/run..st | 5 + .../Python.class/class/setUpPygments.st | 16 +++ .../class/setUpPythonEnvironment.st | 20 +++ .../Python.class/class/single..st | 3 + .../Python.class/class/startUp..st | 7 + .../Python.class/class/type.st | 3 + .../Python.class/class/vmSpeaksPython.st | 3 + .../Python.class/methodProperties.json | 56 ++++++++ .../Python.class/properties.json | 15 +++ .../PythonCompiler.class/README.md | 0 .../class/extractPySelector..st | 3 + .../PythonCompiler.class/class/parserClass.st | 5 + .../instance/compile.in.notifying.ifFail..st | 4 + ...evaluate.in.to.notifying.ifFail.logged..st | 26 ++++ .../instance/pythonCompile.class.ifFail..st | 7 + .../methodProperties.json | 8 ++ .../PythonCompiler.class/properties.json | 14 ++ .../PythonExamples.class/README.md | 0 .../PythonExamples.class/class/average..st | 6 + .../PythonExamples.class/class/average.st | 6 + .../PythonExamples.class/class/fibonacci..st | 9 ++ .../PythonExamples.class/class/fibonacci9.st | 10 ++ .../PythonExamples.class/class/miniexample.st | 13 ++ .../PythonExamples.class/class/server.st | 5 + .../methodProperties.json | 10 ++ .../PythonExamples.class/properties.json | 14 ++ .../PythonObject.class/README.md | 0 .../PythonObject.class/class/allInstances.st | 3 + .../PythonObject.class/class/isPython.st | 3 + .../PythonObject.class/class/new.st | 5 + .../PythonObject.class/class/nextID.st | 6 + .../class/pyCompile.classified.notifying..st | 12 ++ .../PythonObject.class/class/pyMethodDict.st | 3 + .../class/pythonize.instVars.clsVars..st | 31 +++++ .../PythonObject.class/class/pythonize.st | 4 + .../PythonObject.class/class/pythonizeAll.st | 5 + .../class/sourceCodeAt.ifAbsent..st | 4 + ...ariableNames.poolDictionaries.category..st | 4 + .../class/toolIconSelector..st | 5 + .../PythonObject.class/class/withAll..st | 3 + .../PythonObject.class/class/withAll2..st | 8 ++ .../PythonObject.class/class/withAll3..st | 6 + .../instance/allAttributes.st | 3 + .../instance/allInstVarNames.st | 3 + .../instance/asSmalltalk.st | 4 + .../PythonObject.class/instance/at..st | 3 + .../PythonObject.class/instance/at.put..st | 3 + .../PythonObject.class/instance/class.st | 3 + .../PythonObject.class/instance/className.st | 4 + .../instance/defaultLabelForInspector.st | 5 + .../instance/environment.st | 3 + .../PythonObject.class/instance/explore.st | 3 + .../instance/explorerContents.st | 8 ++ .../instance/hasAttribute..st | 3 + .../PythonObject.class/instance/hasClass.st | 3 + .../instance/hasContentsInExplorer.st | 4 + .../PythonObject.class/instance/inspect.st | 4 + .../instance/inspectorClass.st | 3 + .../instance/instVarNamesAndOffsetsDo..st | 9 ++ .../PythonObject.class/instance/isClass.st | 3 + .../PythonObject.class/instance/isKindOf..st | 3 + .../PythonObject.class/instance/isPython.st | 3 + .../PythonObject.class/instance/notNil.st | 3 + .../PythonObject.class/instance/printOn..st | 3 + .../PythonObject.class/instance/pyDictKeys.st | 4 + .../instance/pyDictValues.st | 4 + .../instance/pyIdentifier.st | 5 + .../instance/respondsTo..st | 6 + .../instance/variablesAndOffsetsDo..st | 10 ++ .../PythonObject.class/methodProperties.json | 45 +++++++ .../PythonObject.class/properties.json | 15 +++ .../PythonParser.class/README.md | 0 .../instance/parseCue.noPattern.ifFail..st | 15 +++ .../instance/parseSelector..st | 4 + .../PythonParser.class/methodProperties.json | 6 + .../PythonParser.class/properties.json | 14 ++ .../PythonTestObject.class/README.md | 0 .../methodProperties.json | 5 + .../PythonTestObject.class/properties.json | 15 +++ .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../monticello.meta/package | 1 + .../monticello.meta/version | 1 + .../Python-Core.package/properties.json | 2 + repository/Python-Support.package/.filetree | 4 + .../instance/pySource..st | 3 + .../instance/pySource.st | 3 + .../methodProperties.json | 6 + .../CompiledMethod.extension/properties.json | 2 + .../PythonEditor.class/README.md | 0 .../PythonEditor.class/class/initialize.st | 3 + .../instance/evaluateSelectionAndDo..st | 30 +++++ .../PythonEditor.class/methodProperties.json | 5 + .../PythonEditor.class/properties.json | 14 ++ .../PythonMethodContext.class/README.md | 0 .../instance/isPython.st | 3 + .../instance/printOn..st | 13 ++ .../instance/pyFrame..st | 4 + .../instance/pyFrame.st | 4 + .../instance/sender..st | 4 + .../setSender.receiver.method.arguments..st | 11 ++ .../instance/tempNames.st | 7 + .../methodProperties.json | 11 ++ .../PythonMethodContext.class/properties.json | 14 ++ .../README.md | 0 .../instance/stylerClass.st | 3 + .../methodProperties.json | 5 + .../properties.json | 14 ++ .../README.md | 0 .../instance/setText..st | 8 ++ .../instance/stylePyCode.st | 3 + .../instance/textMorphClass.st | 5 + .../instance/updateStyle.st | 6 + .../methodProperties.json | 8 ++ .../properties.json | 14 ++ .../PythonPluggableTextSpec.class/README.md | 0 .../instance/stylerClass.st | 3 + .../instance/textPaneClass.st | 3 + .../methodProperties.json | 6 + .../properties.json | 14 ++ .../README.md | 0 .../instance/editorClass.st | 4 + .../methodProperties.json | 5 + .../properties.json | 14 ++ .../PythonTextStyler.class/README.md | 0 .../class/highlight..st | 6 + .../class/highlightSmalltalk..st | 6 + .../instance/parseableSourceCodeTemplate.st | 5 + .../instance/privateStyle..st | 3 + .../instance/stylePython..st | 9 ++ .../stylePythonInBackgroundProcess..st | 3 + .../methodProperties.json | 9 ++ .../PythonTextStyler.class/properties.json | 14 ++ .../PythonTheme.class/README.md | 0 .../PythonTheme.class/class/addButtons..st | 26 ++++ .../PythonTheme.class/class/addDialogs..st | 66 ++++++++++ .../PythonTheme.class/class/addFonts..st | 14 ++ .../class/addMenusAndDockingBars..st | 44 +++++++ .../class/addScrollables..st | 71 ++++++++++ .../class/addSyntaxHighlighting..st | 123 ++++++++++++++++++ .../PythonTheme.class/class/addToolColors..st | 21 +++ .../class/addWindowColors..st | 42 ++++++ .../PythonTheme.class/class/argumentColor.st | 4 + .../class/backgroundColor.st | 3 + .../PythonTheme.class/class/backgroundForm.st | 4 + .../PythonTheme.class/class/blue.st | 4 + .../class/builtinConstColor.st | 3 + .../PythonTheme.class/class/commentColor.st | 4 + .../PythonTheme.class/class/create.st | 27 ++++ .../class/focusedLabelColor.st | 3 + .../class/foregroundColor.st | 4 + .../PythonTheme.class/class/globalColor.st | 5 + .../PythonTheme.class/class/green.st | 3 + .../PythonTheme.class/class/highlightColor.st | 3 + .../PythonTheme.class/class/initialize.st | 4 + .../PythonTheme.class/class/keywordColor.st | 5 + .../PythonTheme.class/class/magenta.st | 4 + .../PythonTheme.class/class/numberColor.st | 6 + .../PythonTheme.class/class/orange.st | 4 + .../PythonTheme.class/class/red.st | 3 + .../PythonTheme.class/class/stringColor.st | 3 + .../PythonTheme.class/class/textColor.st | 3 + .../class/textSelectionColor.st | 3 + .../class/unfocusedLabelColor.st | 3 + .../PythonTheme.class/class/variableColor.st | 3 + .../PythonTheme.class/class/windowColor.st | 3 + .../PythonTheme.class/class/yellow.st | 3 + .../PythonTheme.class/instance/stylerClass.st | 3 + .../PythonTheme.class/methodProperties.json | 37 ++++++ .../PythonTheme.class/properties.json | 14 ++ .../PythonToolBuilder.class/README.md | 0 .../class/initialize.st | 4 + .../instance/codePaneClass.st | 3 + .../instance/pluggableCodePaneSpec.st | 3 + .../instance/pluggableTextSpec.st | 3 + .../instance/textPaneClass.st | 3 + .../methodProperties.json | 8 ++ .../PythonToolBuilder.class/properties.json | 14 ++ .../ToolIcons.extension/class/python.st | 8 ++ .../ToolIcons.extension/methodProperties.json | 5 + .../ToolIcons.extension/properties.json | 2 + .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../monticello.meta/package | 1 + .../monticello.meta/version | 1 + .../Python-Support.package/properties.json | 2 + repository/Python-Tests.package/.filetree | 4 + .../PythonDebuggerTest.class/README.md | 0 .../instance/testScopeEndInStartingAt.st | 20 +++ .../methodProperties.json | 5 + .../PythonDebuggerTest.class/properties.json | 14 ++ .../PythonTest.class/README.md | 0 .../instance/testIsExpression.st | 10 ++ .../PythonTest.class/methodProperties.json | 5 + .../PythonTest.class/properties.json | 14 ++ .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../monticello.meta/package | 1 + .../monticello.meta/version | 1 + .../Python-Tests.package/properties.json | 2 + repository/Python-Tools.package/.filetree | 4 + .../instance/hasPyCodeSelected.st | 3 + .../Model.extension/methodProperties.json | 5 + .../Model.extension/properties.json | 2 + .../PythonBrowser.class/README.md | 0 .../instance/aboutToStyle..st | 13 ++ .../instance/buildCodePaneWith..st | 27 ++++ .../instance/defaultBrowserTitle.st | 3 + .../instance/defineMessageFrom.notifying..st | 38 ++++++ .../instance/hasPyCodeSelected.st | 7 + .../PythonBrowser.class/instance/isPython.st | 3 + .../instance/selectedMessage.st | 11 ++ .../instance/systemCategoryList.st | 5 + ...idateMessageSource.forSelector.inClass..st | 6 + .../PythonBrowser.class/methodProperties.json | 13 ++ .../PythonBrowser.class/properties.json | 14 ++ .../README.md | 0 .../instance/selection.st | 8 ++ .../methodProperties.json | 5 + .../properties.json | 14 ++ .../PythonDebugger.class/README.md | 0 .../class/exploreFrames.st | 18 +++ .../class/filterPySource.lineno..st | 10 ++ .../class/getContentsOf..st | 8 ++ .../class/getPySource..st | 9 ++ .../class/getSignature..st | 7 + .../PythonDebugger.class/class/indent.by..st | 5 + .../PythonDebugger.class/class/indentSize..st | 3 + .../class/newPyContext.st | 7 + .../class/prependPythonContexts..st | 16 +++ .../replaceInPySource.content.lineno..st | 10 ++ .../class/scopeEndIn.startingAt..st | 8 ++ .../class/setPySourceContent.content..st | 13 ++ .../instance/aboutToStyle..st | 10 ++ .../instance/buildCodePaneWith..st | 32 +++++ .../instance/contents.notifying..st | 9 ++ .../instance/contextForStack..st | 5 + .../instance/expandStack.st | 7 + .../instance/guessTypeForName..st | 4 + .../instance/hasPyCodeSelected.st | 3 + .../instance/hasPyContextSelected.st | 3 + .../PythonDebugger.class/instance/isPython.st | 3 + .../instance/messageIconAt..st | 9 ++ .../PythonDebugger.class/instance/pcRange.st | 6 + .../instance/process.controller.context..st | 16 +++ .../instance/pyPCRange.st | 10 ++ .../instance/selectedMessage.st | 7 + .../methodProperties.json | 29 +++++ .../PythonDebugger.class/properties.json | 14 ++ .../PythonInspector.class/README.md | 0 .../instance/buildCodePaneWith..st | 13 ++ .../instance/contentsIsString.st | 5 + .../instance/fieldList.st | 8 ++ .../instance/isPython.st | 3 + .../instance/selection.st | 9 ++ .../methodProperties.json | 9 ++ .../PythonInspector.class/properties.json | 14 ++ .../PythonObjectExplorer.class/README.md | 0 .../methodProperties.json | 5 + .../properties.json | 14 ++ .../PythonToolSet.class/README.md | 0 .../class/browse.selector..st | 3 + .../debug.context.label.contents.fullView..st | 4 + .../class/debugContext.label.contents..st | 4 + .../PythonToolSet.class/class/explore..st | 4 + .../PythonToolSet.class/class/initialize.st | 3 + .../class/inspectorClassOf..st | 4 + .../class/interrupt.label..st | 8 ++ .../PythonToolSet.class/class/menuItems.st | 18 +++ .../class/openPythonClassBrowser.st | 3 + .../class/openPythonWorkspace.st | 3 + .../PythonToolSet.class/methodProperties.json | 14 ++ .../PythonToolSet.class/properties.json | 14 ++ .../PythonWorkspace.class/README.md | 0 .../PythonWorkspace.class/class/open.st | 3 + .../instance/evaluateExpression..st | 3 + .../instance/hasPyCodeSelected.st | 3 + .../instance/isPython.st | 3 + .../methodProperties.json | 7 + .../PythonWorkspace.class/properties.json | 14 ++ .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../monticello.meta/package | 1 + .../monticello.meta/version | 1 + .../Python-Tools.package/properties.json | 2 + 335 files changed, 2492 insertions(+) create mode 100644 repository/Python-Core.package/.filetree create mode 100644 repository/Python-Core.package/Object.extension/instance/isPython.st create mode 100644 repository/Python-Core.package/Object.extension/methodProperties.json create mode 100644 repository/Python-Core.package/Object.extension/properties.json create mode 100644 repository/Python-Core.package/Python.class/README.md create mode 100644 repository/Python-Core.package/Python.class/class/False.st create mode 100644 repository/Python-Core.package/Python.class/class/None.st create mode 100644 repository/Python-Core.package/Python.class/class/True.st create mode 100644 repository/Python-Core.package/Python.class/class/basicVmSpeaksPython.st create mode 100644 repository/Python-Core.package/Python.class/class/builtins.st create mode 100644 repository/Python-Core.package/Python.class/class/cmdFor..st create mode 100644 repository/Python-Core.package/Python.class/class/eval..st create mode 100644 repository/Python-Core.package/Python.class/class/evaluatorClass.st create mode 100644 repository/Python-Core.package/Python.class/class/exec..st create mode 100644 repository/Python-Core.package/Python.class/class/from.import..st create mode 100644 repository/Python-Core.package/Python.class/class/from.load..st create mode 100644 repository/Python-Core.package/Python.class/class/fromObjectCache..st create mode 100644 repository/Python-Core.package/Python.class/class/getSource..st create mode 100644 repository/Python-Core.package/Python.class/class/globals.st create mode 100644 repository/Python-Core.package/Python.class/class/import..st create mode 100644 repository/Python-Core.package/Python.class/class/initialize.st create mode 100644 repository/Python-Core.package/Python.class/class/isCallable..st create mode 100644 repository/Python-Core.package/Python.class/class/isExpression..st create mode 100644 repository/Python-Core.package/Python.class/class/load..st create mode 100644 repository/Python-Core.package/Python.class/class/locals.st create mode 100644 repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st create mode 100644 repository/Python-Core.package/Python.class/class/persistPyCode..st create mode 100644 repository/Python-Core.package/Python.class/class/peval..st create mode 100644 repository/Python-Core.package/Python.class/class/pexec..st create mode 100644 repository/Python-Core.package/Python.class/class/primBreakOnExceptions..st create mode 100644 repository/Python-Core.package/Python.class/class/primBreakOnExceptions.st create mode 100644 repository/Python-Core.package/Python.class/class/primEval.cmd..st create mode 100644 repository/Python-Core.package/Python.class/class/primEval.filename.cmd..st create mode 100644 repository/Python-Core.package/Python.class/class/primGetTopFrame.st create mode 100644 repository/Python-Core.package/Python.class/class/primLastError.st create mode 100644 repository/Python-Core.package/Python.class/class/primLastResult.st create mode 100644 repository/Python-Core.package/Python.class/class/primPythonAt..st create mode 100644 repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st create mode 100644 repository/Python-Core.package/Python.class/class/primResume.st create mode 100644 repository/Python-Core.package/Python.class/class/prun..st create mode 100644 repository/Python-Core.package/Python.class/class/pyFormatter.st create mode 100644 repository/Python-Core.package/Python.class/class/pyInspect.st create mode 100644 repository/Python-Core.package/Python.class/class/pyLexerPython.st create mode 100644 repository/Python-Core.package/Python.class/class/pyLexerSmalltalk.st create mode 100644 repository/Python-Core.package/Python.class/class/pygments.st create mode 100644 repository/Python-Core.package/Python.class/class/reset.st create mode 100644 repository/Python-Core.package/Python.class/class/restartFrame.st create mode 100644 repository/Python-Core.package/Python.class/class/restartFrame.with..st create mode 100644 repository/Python-Core.package/Python.class/class/restartFrameWith.cmd..st create mode 100644 repository/Python-Core.package/Python.class/class/resumeFrame.st create mode 100644 repository/Python-Core.package/Python.class/class/run..st create mode 100644 repository/Python-Core.package/Python.class/class/setUpPygments.st create mode 100644 repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st create mode 100644 repository/Python-Core.package/Python.class/class/single..st create mode 100644 repository/Python-Core.package/Python.class/class/startUp..st create mode 100644 repository/Python-Core.package/Python.class/class/type.st create mode 100644 repository/Python-Core.package/Python.class/class/vmSpeaksPython.st create mode 100644 repository/Python-Core.package/Python.class/methodProperties.json create mode 100644 repository/Python-Core.package/Python.class/properties.json create mode 100644 repository/Python-Core.package/PythonCompiler.class/README.md create mode 100644 repository/Python-Core.package/PythonCompiler.class/class/extractPySelector..st create mode 100644 repository/Python-Core.package/PythonCompiler.class/class/parserClass.st create mode 100644 repository/Python-Core.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st create mode 100644 repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st create mode 100644 repository/Python-Core.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st create mode 100644 repository/Python-Core.package/PythonCompiler.class/methodProperties.json create mode 100644 repository/Python-Core.package/PythonCompiler.class/properties.json create mode 100644 repository/Python-Core.package/PythonExamples.class/README.md create mode 100644 repository/Python-Core.package/PythonExamples.class/class/average..st create mode 100644 repository/Python-Core.package/PythonExamples.class/class/average.st create mode 100644 repository/Python-Core.package/PythonExamples.class/class/fibonacci..st create mode 100644 repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st create mode 100644 repository/Python-Core.package/PythonExamples.class/class/miniexample.st create mode 100644 repository/Python-Core.package/PythonExamples.class/class/server.st create mode 100644 repository/Python-Core.package/PythonExamples.class/methodProperties.json create mode 100644 repository/Python-Core.package/PythonExamples.class/properties.json create mode 100644 repository/Python-Core.package/PythonObject.class/README.md create mode 100644 repository/Python-Core.package/PythonObject.class/class/allInstances.st create mode 100644 repository/Python-Core.package/PythonObject.class/class/isPython.st create mode 100644 repository/Python-Core.package/PythonObject.class/class/new.st create mode 100644 repository/Python-Core.package/PythonObject.class/class/nextID.st create mode 100644 repository/Python-Core.package/PythonObject.class/class/pyCompile.classified.notifying..st create mode 100644 repository/Python-Core.package/PythonObject.class/class/pyMethodDict.st create mode 100644 repository/Python-Core.package/PythonObject.class/class/pythonize.instVars.clsVars..st create mode 100644 repository/Python-Core.package/PythonObject.class/class/pythonize.st create mode 100644 repository/Python-Core.package/PythonObject.class/class/pythonizeAll.st create mode 100644 repository/Python-Core.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st create mode 100644 repository/Python-Core.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st create mode 100644 repository/Python-Core.package/PythonObject.class/class/toolIconSelector..st create mode 100644 repository/Python-Core.package/PythonObject.class/class/withAll..st create mode 100644 repository/Python-Core.package/PythonObject.class/class/withAll2..st create mode 100644 repository/Python-Core.package/PythonObject.class/class/withAll3..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/allAttributes.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/asSmalltalk.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/at..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/at.put..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/class.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/className.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/environment.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/explore.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/explorerContents.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/hasClass.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/inspect.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/inspectorClass.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/isClass.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/isKindOf..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/isPython.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/notNil.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/printOn..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/pyDictKeys.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/pyDictValues.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/pyIdentifier.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/respondsTo..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st create mode 100644 repository/Python-Core.package/PythonObject.class/methodProperties.json create mode 100644 repository/Python-Core.package/PythonObject.class/properties.json create mode 100644 repository/Python-Core.package/PythonParser.class/README.md create mode 100644 repository/Python-Core.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st create mode 100644 repository/Python-Core.package/PythonParser.class/instance/parseSelector..st create mode 100644 repository/Python-Core.package/PythonParser.class/methodProperties.json create mode 100644 repository/Python-Core.package/PythonParser.class/properties.json create mode 100644 repository/Python-Core.package/PythonTestObject.class/README.md create mode 100644 repository/Python-Core.package/PythonTestObject.class/methodProperties.json create mode 100644 repository/Python-Core.package/PythonTestObject.class/properties.json create mode 100644 repository/Python-Core.package/monticello.meta/categories.st create mode 100644 repository/Python-Core.package/monticello.meta/initializers.st create mode 100644 repository/Python-Core.package/monticello.meta/package create mode 100644 repository/Python-Core.package/monticello.meta/version create mode 100644 repository/Python-Core.package/properties.json create mode 100644 repository/Python-Support.package/.filetree create mode 100644 repository/Python-Support.package/CompiledMethod.extension/instance/pySource..st create mode 100644 repository/Python-Support.package/CompiledMethod.extension/instance/pySource.st create mode 100644 repository/Python-Support.package/CompiledMethod.extension/methodProperties.json create mode 100644 repository/Python-Support.package/CompiledMethod.extension/properties.json create mode 100644 repository/Python-Support.package/PythonEditor.class/README.md create mode 100644 repository/Python-Support.package/PythonEditor.class/class/initialize.st create mode 100644 repository/Python-Support.package/PythonEditor.class/instance/evaluateSelectionAndDo..st create mode 100644 repository/Python-Support.package/PythonEditor.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonEditor.class/properties.json create mode 100644 repository/Python-Support.package/PythonMethodContext.class/README.md create mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/isPython.st create mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/printOn..st create mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame..st create mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame.st create mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/sender..st create mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/setSender.receiver.method.arguments..st create mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/tempNames.st create mode 100644 repository/Python-Support.package/PythonMethodContext.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonMethodContext.class/properties.json create mode 100644 repository/Python-Support.package/PythonPluggableCodePaneSpec.class/README.md create mode 100644 repository/Python-Support.package/PythonPluggableCodePaneSpec.class/instance/stylerClass.st create mode 100644 repository/Python-Support.package/PythonPluggableCodePaneSpec.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonPluggableCodePaneSpec.class/properties.json create mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/README.md create mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/setText..st create mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/stylePyCode.st create mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/textMorphClass.st create mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/updateStyle.st create mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/properties.json create mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/README.md create mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/instance/stylerClass.st create mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/instance/textPaneClass.st create mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/properties.json create mode 100644 repository/Python-Support.package/PythonTextMorphForEditView.class/README.md create mode 100644 repository/Python-Support.package/PythonTextMorphForEditView.class/instance/editorClass.st create mode 100644 repository/Python-Support.package/PythonTextMorphForEditView.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonTextMorphForEditView.class/properties.json create mode 100644 repository/Python-Support.package/PythonTextStyler.class/README.md create mode 100644 repository/Python-Support.package/PythonTextStyler.class/class/highlight..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/class/highlightSmalltalk..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/privateStyle..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/stylePython..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/stylePythonInBackgroundProcess..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonTextStyler.class/properties.json create mode 100644 repository/Python-Support.package/PythonTheme.class/README.md create mode 100644 repository/Python-Support.package/PythonTheme.class/class/addButtons..st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/addDialogs..st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/addFonts..st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/addMenusAndDockingBars..st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/addScrollables..st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/addSyntaxHighlighting..st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/addToolColors..st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/addWindowColors..st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/argumentColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/backgroundColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/backgroundForm.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/blue.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/builtinConstColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/commentColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/create.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/focusedLabelColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/foregroundColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/globalColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/green.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/highlightColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/initialize.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/keywordColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/magenta.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/numberColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/orange.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/red.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/stringColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/textColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/textSelectionColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/unfocusedLabelColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/variableColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/windowColor.st create mode 100644 repository/Python-Support.package/PythonTheme.class/class/yellow.st create mode 100644 repository/Python-Support.package/PythonTheme.class/instance/stylerClass.st create mode 100644 repository/Python-Support.package/PythonTheme.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonTheme.class/properties.json create mode 100644 repository/Python-Support.package/PythonToolBuilder.class/README.md create mode 100644 repository/Python-Support.package/PythonToolBuilder.class/class/initialize.st create mode 100644 repository/Python-Support.package/PythonToolBuilder.class/instance/codePaneClass.st create mode 100644 repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableCodePaneSpec.st create mode 100644 repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableTextSpec.st create mode 100644 repository/Python-Support.package/PythonToolBuilder.class/instance/textPaneClass.st create mode 100644 repository/Python-Support.package/PythonToolBuilder.class/methodProperties.json create mode 100644 repository/Python-Support.package/PythonToolBuilder.class/properties.json create mode 100644 repository/Python-Support.package/ToolIcons.extension/class/python.st create mode 100644 repository/Python-Support.package/ToolIcons.extension/methodProperties.json create mode 100644 repository/Python-Support.package/ToolIcons.extension/properties.json create mode 100644 repository/Python-Support.package/monticello.meta/categories.st create mode 100644 repository/Python-Support.package/monticello.meta/initializers.st create mode 100644 repository/Python-Support.package/monticello.meta/package create mode 100644 repository/Python-Support.package/monticello.meta/version create mode 100644 repository/Python-Support.package/properties.json create mode 100644 repository/Python-Tests.package/.filetree create mode 100644 repository/Python-Tests.package/PythonDebuggerTest.class/README.md create mode 100644 repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st create mode 100644 repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json create mode 100644 repository/Python-Tests.package/PythonDebuggerTest.class/properties.json create mode 100644 repository/Python-Tests.package/PythonTest.class/README.md create mode 100644 repository/Python-Tests.package/PythonTest.class/instance/testIsExpression.st create mode 100644 repository/Python-Tests.package/PythonTest.class/methodProperties.json create mode 100644 repository/Python-Tests.package/PythonTest.class/properties.json create mode 100644 repository/Python-Tests.package/monticello.meta/categories.st create mode 100644 repository/Python-Tests.package/monticello.meta/initializers.st create mode 100644 repository/Python-Tests.package/monticello.meta/package create mode 100644 repository/Python-Tests.package/monticello.meta/version create mode 100644 repository/Python-Tests.package/properties.json create mode 100644 repository/Python-Tools.package/.filetree create mode 100644 repository/Python-Tools.package/Model.extension/instance/hasPyCodeSelected.st create mode 100644 repository/Python-Tools.package/Model.extension/methodProperties.json create mode 100644 repository/Python-Tools.package/Model.extension/properties.json create mode 100644 repository/Python-Tools.package/PythonBrowser.class/README.md create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/defaultBrowserTitle.st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/defineMessageFrom.notifying..st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/isPython.st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/selectedMessage.st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/systemCategoryList.st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/validateMessageSource.forSelector.inClass..st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/methodProperties.json create mode 100644 repository/Python-Tools.package/PythonBrowser.class/properties.json create mode 100644 repository/Python-Tools.package/PythonContextVariablesInspector.class/README.md create mode 100644 repository/Python-Tools.package/PythonContextVariablesInspector.class/instance/selection.st create mode 100644 repository/Python-Tools.package/PythonContextVariablesInspector.class/methodProperties.json create mode 100644 repository/Python-Tools.package/PythonContextVariablesInspector.class/properties.json create mode 100644 repository/Python-Tools.package/PythonDebugger.class/README.md create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/contents.notifying..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/contextForStack..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/expandStack.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/guessTypeForName..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/hasPyCodeSelected.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/hasPyContextSelected.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/isPython.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/messageIconAt..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/pcRange.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/process.controller.context..st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/pyPCRange.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/selectedMessage.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/methodProperties.json create mode 100644 repository/Python-Tools.package/PythonDebugger.class/properties.json create mode 100644 repository/Python-Tools.package/PythonInspector.class/README.md create mode 100644 repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st create mode 100644 repository/Python-Tools.package/PythonInspector.class/instance/contentsIsString.st create mode 100644 repository/Python-Tools.package/PythonInspector.class/instance/fieldList.st create mode 100644 repository/Python-Tools.package/PythonInspector.class/instance/isPython.st create mode 100644 repository/Python-Tools.package/PythonInspector.class/instance/selection.st create mode 100644 repository/Python-Tools.package/PythonInspector.class/methodProperties.json create mode 100644 repository/Python-Tools.package/PythonInspector.class/properties.json create mode 100644 repository/Python-Tools.package/PythonObjectExplorer.class/README.md create mode 100644 repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json create mode 100644 repository/Python-Tools.package/PythonObjectExplorer.class/properties.json create mode 100644 repository/Python-Tools.package/PythonToolSet.class/README.md create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/browse.selector..st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/debugContext.label.contents..st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/explore..st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/initialize.st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/inspectorClassOf..st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/interrupt.label..st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/menuItems.st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/openPythonClassBrowser.st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/openPythonWorkspace.st create mode 100644 repository/Python-Tools.package/PythonToolSet.class/methodProperties.json create mode 100644 repository/Python-Tools.package/PythonToolSet.class/properties.json create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/README.md create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/class/open.st create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/instance/hasPyCodeSelected.st create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/properties.json create mode 100644 repository/Python-Tools.package/monticello.meta/categories.st create mode 100644 repository/Python-Tools.package/monticello.meta/initializers.st create mode 100644 repository/Python-Tools.package/monticello.meta/package create mode 100644 repository/Python-Tools.package/monticello.meta/version create mode 100644 repository/Python-Tools.package/properties.json diff --git a/repository/Python-Core.package/.filetree b/repository/Python-Core.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/Python-Core.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/Python-Core.package/Object.extension/instance/isPython.st b/repository/Python-Core.package/Object.extension/instance/isPython.st new file mode 100644 index 00000000..ab3effcd --- /dev/null +++ b/repository/Python-Core.package/Object.extension/instance/isPython.st @@ -0,0 +1,3 @@ +*Python-Core +isPython + ^ false \ No newline at end of file diff --git a/repository/Python-Core.package/Object.extension/methodProperties.json b/repository/Python-Core.package/Object.extension/methodProperties.json new file mode 100644 index 00000000..85e3b799 --- /dev/null +++ b/repository/Python-Core.package/Object.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "isPython" : "fn 3/6/2017 22:45" } } diff --git a/repository/Python-Core.package/Object.extension/properties.json b/repository/Python-Core.package/Object.extension/properties.json new file mode 100644 index 00000000..3d3b9ec4 --- /dev/null +++ b/repository/Python-Core.package/Object.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "Object" } diff --git a/repository/Python-Core.package/Python.class/README.md b/repository/Python-Core.package/Python.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/Python.class/class/False.st b/repository/Python-Core.package/Python.class/class/False.st new file mode 100644 index 00000000..23689c79 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/False.st @@ -0,0 +1,3 @@ +special objects +False + ^ self fromObjectCache: 'False' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/None.st b/repository/Python-Core.package/Python.class/class/None.st new file mode 100644 index 00000000..f6bb9a5c --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/None.st @@ -0,0 +1,3 @@ +special objects +None + ^ self fromObjectCache: 'None' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/True.st b/repository/Python-Core.package/Python.class/class/True.st new file mode 100644 index 00000000..96a01949 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/True.st @@ -0,0 +1,3 @@ +special objects +True + ^ self fromObjectCache: 'True' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/basicVmSpeaksPython.st b/repository/Python-Core.package/Python.class/class/basicVmSpeaksPython.st new file mode 100644 index 00000000..c4b6c442 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/basicVmSpeaksPython.st @@ -0,0 +1,4 @@ +helpers +basicVmSpeaksPython + [ Python eval: '1' ] on: Error do: [ ^ false ]. + ^ true \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/builtins.st b/repository/Python-Core.package/Python.class/class/builtins.st new file mode 100644 index 00000000..c66d31e3 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/builtins.st @@ -0,0 +1,3 @@ +special objects +builtins + ^ self fromObjectCache: '__builtins__' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/cmdFor..st b/repository/Python-Core.package/Python.class/class/cmdFor..st new file mode 100644 index 00000000..2280e30d --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/cmdFor..st @@ -0,0 +1,5 @@ +helpers +cmdFor: aPySource + (self isExpression: aPySource) + ifTrue: [ ^ 'eval' ] + ifFalse: [ ^ 'exec' ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/eval..st b/repository/Python-Core.package/Python.class/class/eval..st new file mode 100644 index 00000000..7da4cb30 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/eval..st @@ -0,0 +1,3 @@ +execution +eval: aString + ^ self primEval: aString filename: '' cmd: 'eval' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/evaluatorClass.st b/repository/Python-Core.package/Python.class/class/evaluatorClass.st new file mode 100644 index 00000000..f04f433e --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/evaluatorClass.st @@ -0,0 +1,3 @@ +overrides +evaluatorClass + ^ PythonCompiler \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/exec..st b/repository/Python-Core.package/Python.class/class/exec..st new file mode 100644 index 00000000..8002b84f --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/exec..st @@ -0,0 +1,3 @@ +execution +exec: aString + ^ self primEval: aString filename: '' cmd: 'exec' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/from.import..st b/repository/Python-Core.package/Python.class/class/from.import..st new file mode 100644 index 00000000..87e87d30 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/from.import..st @@ -0,0 +1,3 @@ +helpers +from: aPackageName import: aModuleName + Python exec: 'from ', aPackageName, ' import ', aModuleName \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/from.load..st b/repository/Python-Core.package/Python.class/class/from.load..st new file mode 100644 index 00000000..956c7668 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/from.load..st @@ -0,0 +1,4 @@ +helpers +from: aPackageName load: aModuleName + self from: aPackageName import: aModuleName. + ^ Python eval: aModuleName \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/fromObjectCache..st b/repository/Python-Core.package/Python.class/class/fromObjectCache..st new file mode 100644 index 00000000..1150b52a --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/fromObjectCache..st @@ -0,0 +1,4 @@ +helpers +fromObjectCache: aName + ObjectCache ifNil: [ ObjectCache := Dictionary new ]. + ^ ObjectCache at: aName ifAbsentPut: [ self eval: aName ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/getSource..st b/repository/Python-Core.package/Python.class/class/getSource..st new file mode 100644 index 00000000..37d80f0a --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/getSource..st @@ -0,0 +1,3 @@ +helpers +getSource: pyCode + self pyInspect getsource: pyCode \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/globals.st b/repository/Python-Core.package/Python.class/class/globals.st new file mode 100644 index 00000000..a85fbedb --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/globals.st @@ -0,0 +1,4 @@ +special objects +globals + ^ Python eval: 'globals()' + \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/import..st b/repository/Python-Core.package/Python.class/class/import..st new file mode 100644 index 00000000..2a4bd7b3 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/import..st @@ -0,0 +1,3 @@ +helpers +import: aModuleName + Python exec: 'import ', aModuleName \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/initialize.st b/repository/Python-Core.package/Python.class/class/initialize.st new file mode 100644 index 00000000..ebdf2ac2 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/initialize.st @@ -0,0 +1,5 @@ +helpers +initialize + super initialize. + Smalltalk addToStartUpList: Python + "Smalltalk removeFromStartUpList: Python" \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/isCallable..st b/repository/Python-Core.package/Python.class/class/isCallable..st new file mode 100644 index 00000000..51dceaab --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/isCallable..st @@ -0,0 +1,3 @@ +helpers +isCallable: aPyString + ^ (self eval: 'callable(', aPyString ,')') asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/isExpression..st b/repository/Python-Core.package/Python.class/class/isExpression..st new file mode 100644 index 00000000..093da59d --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/isExpression..st @@ -0,0 +1,4 @@ +helpers +isExpression: aPySource + ^ (self eval: '_isExpression("""', +aPySource, '""")') asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/load..st b/repository/Python-Core.package/Python.class/class/load..st new file mode 100644 index 00000000..7e4d6aaf --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/load..st @@ -0,0 +1,4 @@ +helpers +load: aModuleName + self import: aModuleName. + ^ Python eval: aModuleName \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/locals.st b/repository/Python-Core.package/Python.class/class/locals.st new file mode 100644 index 00000000..92400462 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/locals.st @@ -0,0 +1,4 @@ +special objects +locals + ^ Python eval: 'locals()' + \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st b/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st new file mode 100644 index 00000000..3cd669ad --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st @@ -0,0 +1,16 @@ +system primitives +openDebuggerWithPythonFrames: pyError + | resumeCtx error | + resumeCtx := thisContext sender. + [ resumeCtx method selector = #resumeFrame + and: [ resumeCtx closure isNil ] ] + whileFalse: [ + resumeCtx := resumeCtx sender. + resumeCtx ifNil: [ ^ self error: 'resumeCtx not found' ] ]. + error := pyError asSmalltalk. + PythonDebugger + openOn: Processor activeProcess + context: (PythonDebugger prependPythonContexts: resumeCtx) + label: error first, ': ', error second + contents: nil + fullView: true \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/persistPyCode..st b/repository/Python-Core.package/Python.class/class/persistPyCode..st new file mode 100644 index 00000000..18192812 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/persistPyCode..st @@ -0,0 +1,9 @@ +experimental +persistPyCode: pySource + | filename stream | + filename := 'py_files', FileDirectory pathNameDelimiter ,'source_', Time millisecondClockValue, '.py'. + stream := StandardFileStream forceNewFileNamed: filename. + stream := MultiByteFileStream newFrom: stream. + stream write: pySource. + stream close. + ^ filename \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/peval..st b/repository/Python-Core.package/Python.class/class/peval..st new file mode 100644 index 00000000..7d75798a --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/peval..st @@ -0,0 +1,3 @@ +execution +peval: aString + ^ self primEval: aString filename: (self persistPyCode: aString) cmd: 'eval' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pexec..st b/repository/Python-Core.package/Python.class/class/pexec..st new file mode 100644 index 00000000..fe3fb2df --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pexec..st @@ -0,0 +1,3 @@ +execution +pexec: aString + ^ self primEval: aString filename: (self persistPyCode: aString) cmd: 'exec' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primBreakOnExceptions..st b/repository/Python-Core.package/Python.class/class/primBreakOnExceptions..st new file mode 100644 index 00000000..cc295c68 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primBreakOnExceptions..st @@ -0,0 +1,4 @@ +experimental +primBreakOnExceptions: aBool + + self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primBreakOnExceptions.st b/repository/Python-Core.package/Python.class/class/primBreakOnExceptions.st new file mode 100644 index 00000000..f15a4e16 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primBreakOnExceptions.st @@ -0,0 +1,4 @@ +experimental +primBreakOnExceptions + + self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primEval.cmd..st b/repository/Python-Core.package/Python.class/class/primEval.cmd..st new file mode 100644 index 00000000..2fcfb210 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primEval.cmd..st @@ -0,0 +1,4 @@ +system primitives +primEval: aString cmd: aEvalOrExec + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primEval.filename.cmd..st b/repository/Python-Core.package/Python.class/class/primEval.filename.cmd..st new file mode 100644 index 00000000..19e70782 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primEval.filename.cmd..st @@ -0,0 +1,4 @@ +system primitives +primEval: aString filename: aFilename cmd: aEvalOrExec + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primGetTopFrame.st b/repository/Python-Core.package/Python.class/class/primGetTopFrame.st new file mode 100644 index 00000000..b4d5b440 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primGetTopFrame.st @@ -0,0 +1,5 @@ +experimental +primGetTopFrame + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primLastError.st b/repository/Python-Core.package/Python.class/class/primLastError.st new file mode 100644 index 00000000..5f036a85 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primLastError.st @@ -0,0 +1,4 @@ +system primitives +primLastError + + ^ nil \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primLastResult.st b/repository/Python-Core.package/Python.class/class/primLastResult.st new file mode 100644 index 00000000..6d8aa1dc --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primLastResult.st @@ -0,0 +1,4 @@ +system primitives +primLastResult + + ^ nil \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primPythonAt..st b/repository/Python-Core.package/Python.class/class/primPythonAt..st new file mode 100644 index 00000000..dedd6673 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primPythonAt..st @@ -0,0 +1,4 @@ +experimental +primPythonAt: aKeyOrIndex + + self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st b/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st new file mode 100644 index 00000000..243c13f1 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st @@ -0,0 +1,5 @@ +experimental +primRestartSpecificFrame: pyFrame source: pySource filename: aFilename cmd: evalOrExec + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primResume.st b/repository/Python-Core.package/Python.class/class/primResume.st new file mode 100644 index 00000000..8bd99e0e --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primResume.st @@ -0,0 +1,4 @@ +experimental +primResume + + self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/prun..st b/repository/Python-Core.package/Python.class/class/prun..st new file mode 100644 index 00000000..9593ed09 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/prun..st @@ -0,0 +1,5 @@ +execution +prun: pyCode + (self isExpression: pyCode) + ifTrue: [ [^ self peval: pyCode ] on: Error do: [] ]. + ^ self pexec: pyCode \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pyFormatter.st b/repository/Python-Core.package/Python.class/class/pyFormatter.st new file mode 100644 index 00000000..250e7f44 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pyFormatter.st @@ -0,0 +1,3 @@ +special objects +pyFormatter + ^ self fromObjectCache: '_pygments_formatter' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pyInspect.st b/repository/Python-Core.package/Python.class/class/pyInspect.st new file mode 100644 index 00000000..24d47cf3 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pyInspect.st @@ -0,0 +1,3 @@ +helpers +pyInspect + self eval: 'inspect' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pyLexerPython.st b/repository/Python-Core.package/Python.class/class/pyLexerPython.st new file mode 100644 index 00000000..f98842fd --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pyLexerPython.st @@ -0,0 +1,3 @@ +special objects +pyLexerPython + ^ self fromObjectCache: '_pygments_lexer_python' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pyLexerSmalltalk.st b/repository/Python-Core.package/Python.class/class/pyLexerSmalltalk.st new file mode 100644 index 00000000..f19ffa22 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pyLexerSmalltalk.st @@ -0,0 +1,3 @@ +special objects +pyLexerSmalltalk + ^ self fromObjectCache: '_pygments_lexer_smalltalk' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pygments.st b/repository/Python-Core.package/Python.class/class/pygments.st new file mode 100644 index 00000000..c95191ec --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pygments.st @@ -0,0 +1,3 @@ +special objects +pygments + ^ self eval: 'pygments' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/reset.st b/repository/Python-Core.package/Python.class/class/reset.st new file mode 100644 index 00000000..d5e86b2f --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/reset.st @@ -0,0 +1,4 @@ +helpers +reset + ObjectCache := nil. + VMSpeaksPython := nil. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/restartFrame.st b/repository/Python-Core.package/Python.class/class/restartFrame.st new file mode 100644 index 00000000..6cdd679f --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/restartFrame.st @@ -0,0 +1,3 @@ +experimental +restartFrame + self primRestartSpecificFrame: nil source: '' filename: '' cmd: '' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/restartFrame.with..st b/repository/Python-Core.package/Python.class/class/restartFrame.with..st new file mode 100644 index 00000000..b0c31b90 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/restartFrame.with..st @@ -0,0 +1,7 @@ +experimental +restartFrame: pyFrame with: aSource + self + primRestartSpecificFrame: pyFrame + source: aSource + filename: pyFrame f_code co_filename + cmd: (self cmdFor: aSource) \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/restartFrameWith.cmd..st b/repository/Python-Core.package/Python.class/class/restartFrameWith.cmd..st new file mode 100644 index 00000000..186e3f50 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/restartFrameWith.cmd..st @@ -0,0 +1,4 @@ +experimental +restartFrameWith: pySource cmd: evalOrExec + self primRestartSpecificFrame: nil source: pySource filename: '' cmd: evalOrExec + \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/resumeFrame.st b/repository/Python-Core.package/Python.class/class/resumeFrame.st new file mode 100644 index 00000000..34877bda --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/resumeFrame.st @@ -0,0 +1,7 @@ +special methods +resumeFrame + "Magic method that is called by vm (cached in vm)" + Processor yield. + [ ^ self primResume ] on: Error do: [ + self primLastError ifNotNil: [ :e | self openDebuggerWithPythonFrames: e ]. + ^ self resumeFrame ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/run..st b/repository/Python-Core.package/Python.class/class/run..st new file mode 100644 index 00000000..9e39e246 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/run..st @@ -0,0 +1,5 @@ +execution +run: pyCode + (self isExpression: pyCode) + ifTrue: [ [^ self eval: pyCode ] on: Error do: [] ]. + ^ self exec: pyCode \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPygments.st b/repository/Python-Core.package/Python.class/class/setUpPygments.st new file mode 100644 index 00000000..a3782474 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/setUpPygments.st @@ -0,0 +1,16 @@ +overrides +setUpPygments + | breakOnExceptions | + breakOnExceptions := self primBreakOnExceptions. + self primBreakOnExceptions: false. + self exec: ' +import pygments +import pygments.lexers +import pygments.formatters +_pygments_lexer_python = pygments.lexers.get_lexer_by_name( + "python", encoding="utf-8", stripnl=False, ensurenl=False) +_pygments_lexer_smalltalk = pygments.lexers.get_lexer_by_name( + "smalltalk", encoding="utf-8", stripnl=False, ensurenl=False) +_pygments_formatter = pygments.formatters.get_formatter_by_name( + "html", encoding="utf-8", style="colorful", nowrap=True, noclasses=True, lineseparator="
")'. + self primBreakOnExceptions: breakOnExceptions. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st b/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st new file mode 100644 index 00000000..3bebb421 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st @@ -0,0 +1,20 @@ +overrides +setUpPythonEnvironment + self exec: ' +import sys +sys.path = ["', Smalltalk image imagePath, '", + "', Smalltalk image imagePath, '/pypy/lib_pypy", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7/lib-tk", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-darwin", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac", + "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac/lib-scriptpackages", + "', Smalltalk image imagePath, '/site-packages", + "." ] +def _isExpression(x): + try: + compile(x, "", "eval") + return True + except SyntaxError: + return False'. + self setUpPygments \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/single..st b/repository/Python-Core.package/Python.class/class/single..st new file mode 100644 index 00000000..7cde647f --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/single..st @@ -0,0 +1,3 @@ +helpers +single: aString + ^ self primEval: aString filename: '' cmd: 'single' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/startUp..st b/repository/Python-Core.package/Python.class/class/startUp..st new file mode 100644 index 00000000..5059cb51 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/startUp..st @@ -0,0 +1,7 @@ +overrides +startUp: resuming + self reset. + (resuming and: [ self vmSpeaksPython ]) + ifTrue: [ + self setUpPythonEnvironment. + PythonObject pythonizeAll ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/type.st b/repository/Python-Core.package/Python.class/class/type.st new file mode 100644 index 00000000..60a577da --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/type.st @@ -0,0 +1,3 @@ +special objects +type + ^ self fromObjectCache: 'type' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/vmSpeaksPython.st b/repository/Python-Core.package/Python.class/class/vmSpeaksPython.st new file mode 100644 index 00000000..61bd766b --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/vmSpeaksPython.st @@ -0,0 +1,3 @@ +helpers +vmSpeaksPython + ^ VMSpeaksPython ifNil: [ VMSpeaksPython := self basicVmSpeaksPython ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json new file mode 100644 index 00000000..f941dfc4 --- /dev/null +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -0,0 +1,56 @@ +{ + "class" : { + "False" : "fn 3/6/2017 10:54", + "None" : "fn 3/6/2017 10:13", + "True" : "fn 3/6/2017 10:54", + "basicVmSpeaksPython" : "fn 2/23/2017 20:59", + "builtins" : "fn 2/23/2017 18:34", + "cmdFor:" : "fn 2/23/2017 21:36", + "eval:" : "fn 2/23/2017 21:10", + "evaluatorClass" : "fn 12/22/2016 02:53", + "exec:" : "fn 2/23/2017 21:11", + "from:import:" : "fn 1/9/2017 20:54", + "from:load:" : "fn 1/9/2017 20:55", + "fromObjectCache:" : "fn 2/23/2017 18:40", + "getSource:" : "fn 1/29/2017 22:15", + "globals" : "fn 2/26/2017 21:46", + "import:" : "fn 1/9/2017 20:54", + "initialize" : "fn 3/6/2017 22:13", + "isCallable:" : "fn 2/26/2017 21:45", + "isExpression:" : "fn 2/26/2017 21:45", + "load:" : "fn 1/9/2017 20:54", + "locals" : "fn 2/26/2017 21:46", + "openDebuggerWithPythonFrames:" : "fn 3/6/2017 10:23", + "persistPyCode:" : "fn 2/1/2017 12:46", + "peval:" : "fn 2/23/2017 21:12", + "pexec:" : "fn 2/23/2017 21:12", + "primBreakOnExceptions" : "fn 3/6/2017 07:43", + "primBreakOnExceptions:" : "fn 3/6/2017 07:43", + "primEval:cmd:" : "fn 2/2/2017 17:12", + "primEval:filename:cmd:" : "fn 2/1/2017 10:55", + "primGetTopFrame" : "fn 1/11/2017 11:19", + "primLastError" : "fn 1/28/2017 13:37", + "primLastResult" : "fn 1/30/2017 15:34", + "primPythonAt:" : "fn 2/25/2017 17:03", + "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", + "primResume" : "fn 2/22/2017 10:47", + "prun:" : "fn 2/23/2017 21:36", + "pyFormatter" : "fn 3/6/2017 07:20", + "pyInspect" : "fn 1/29/2017 22:15", + "pyLexerPython" : "fn 3/6/2017 19:05", + "pyLexerSmalltalk" : "fn 3/6/2017 19:05", + "pygments" : "fn 3/6/2017 13:15", + "reset" : "fn 2/23/2017 21:13", + "restartFrame" : "fn 2/22/2017 10:21", + "restartFrame:with:" : "fn 2/22/2017 14:14", + "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", + "resumeFrame" : "fn 3/6/2017 12:58", + "run:" : "fn 2/23/2017 21:37", + "setUpPygments" : "fn 3/6/2017 22:44", + "setUpPythonEnvironment" : "fn 3/6/2017 07:11", + "single:" : "fn 2/1/2017 10:55", + "startUp:" : "fn 3/6/2017 09:47", + "type" : "fn 2/23/2017 18:34", + "vmSpeaksPython" : "fn 2/23/2017 21:00" }, + "instance" : { + } } diff --git a/repository/Python-Core.package/Python.class/properties.json b/repository/Python-Core.package/Python.class/properties.json new file mode 100644 index 00000000..0e364404 --- /dev/null +++ b/repository/Python-Core.package/Python.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + "ObjectCache", + "VMSpeaksPython" ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "Python", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/Python-Core.package/PythonCompiler.class/README.md b/repository/Python-Core.package/PythonCompiler.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/PythonCompiler.class/class/extractPySelector..st b/repository/Python-Core.package/PythonCompiler.class/class/extractPySelector..st new file mode 100644 index 00000000..7cf06702 --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/class/extractPySelector..st @@ -0,0 +1,3 @@ +as yet unclassified +extractPySelector: pySource + ^ ((pySource copyAfter: Character space) copyUpTo: $() asString \ No newline at end of file diff --git a/repository/Python-Core.package/PythonCompiler.class/class/parserClass.st b/repository/Python-Core.package/PythonCompiler.class/class/parserClass.st new file mode 100644 index 00000000..c571b1d0 --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/class/parserClass.st @@ -0,0 +1,5 @@ +as yet unclassified +parserClass + Python vmSpeaksPython ifFalse: [ ^ Parser ]. + ^ PythonParser "PythonParser" + \ No newline at end of file diff --git a/repository/Python-Core.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st b/repository/Python-Core.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st new file mode 100644 index 00000000..be949f5a --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st @@ -0,0 +1,4 @@ +as yet unclassified +compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock + Python vmSpeaksPython ifTrue: [ self pythonCompile: textOrStream class: aClass ifFail: failBlock ]. + ^ super compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock \ No newline at end of file diff --git a/repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st b/repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st new file mode 100644 index 00000000..51046664 --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st @@ -0,0 +1,26 @@ +as yet unclassified +evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag + | pyCode | + pyCode := textOrStream contents. + + Python exec: 'rcvr_locals = dict()'. + (Python eval: 'rcvr_locals') setdefault: 'self' to: receiver. + + (Python isExpression: pyCode) + ifTrue: [ + ^ Python builtins + eval: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] + ifFalse: [ + ^ Python builtins + exec: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] + + "pyCode := pyCode copyReplaceAll: 'self.' with: ''. + method := (pyCode copyUpTo: $() asSymbol. + args := ((((pyCode copyAfter: $() copyUpTo: $)) + findTokens: {$,}) + collect: [ :ea | ea withBlanksTrimmed ]) asArray. + ^ receiver perform: method withArguments: args" \ No newline at end of file diff --git a/repository/Python-Core.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st b/repository/Python-Core.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st new file mode 100644 index 00000000..6edafdcc --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st @@ -0,0 +1,7 @@ +as yet unclassified +pythonCompile: pySource class: aClass ifFail: failBlock + | pySelector | + pySelector := self class extractPySelector: pySource. + [ Python exec: pySource, String cr, + aClass name asString, '.', pySelector, ' = ', pySelector ] + on: Error do: failBlock \ No newline at end of file diff --git a/repository/Python-Core.package/PythonCompiler.class/methodProperties.json b/repository/Python-Core.package/PythonCompiler.class/methodProperties.json new file mode 100644 index 00000000..c6e2a48e --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + "extractPySelector:" : "fn 12/19/2016 02:57", + "parserClass" : "fn 12/25/2016 15:08" }, + "instance" : { + "compile:in:notifying:ifFail:" : "fn 3/7/2017 10:02", + "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/24/2017 11:58", + "pythonCompile:class:ifFail:" : "fn 12/19/2016 02:18" } } diff --git a/repository/Python-Core.package/PythonCompiler.class/properties.json b/repository/Python-Core.package/PythonCompiler.class/properties.json new file mode 100644 index 00000000..99b796a7 --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonCompiler", + "pools" : [ + ], + "super" : "Compiler", + "type" : "normal" } diff --git a/repository/Python-Core.package/PythonExamples.class/README.md b/repository/Python-Core.package/PythonExamples.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/PythonExamples.class/class/average..st b/repository/Python-Core.package/PythonExamples.class/class/average..st new file mode 100644 index 00000000..e7948e92 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/class/average..st @@ -0,0 +1,6 @@ +debugging +average: anIterableDef + Python pexec: ' +def average(iterable): + return sum(iterable) / len(iterable)'. + ^ Python eval: 'average(', anIterableDef, ')' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonExamples.class/class/average.st b/repository/Python-Core.package/PythonExamples.class/class/average.st new file mode 100644 index 00000000..19968836 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/class/average.st @@ -0,0 +1,6 @@ +debugging +average + Python pexec: ' +def average(iterable): + return sum(iterable) / len(iterable)'. + ^ Python eval: 'average([])' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonExamples.class/class/fibonacci..st b/repository/Python-Core.package/PythonExamples.class/class/fibonacci..st new file mode 100644 index 00000000..dd7be796 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/class/fibonacci..st @@ -0,0 +1,9 @@ +debugging +fibonacci: x + Python pexec: ' +def fibonacci(number): + lookup_table = [0] + for i in range(2, number + 1): + lookup_table.append(lookup_table[i - 1] + lookup_table[i - 2]) + return lookup_table[number]'. + ^ Python eval: 'fibonacci(', x, ')' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st b/repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st new file mode 100644 index 00000000..91034740 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st @@ -0,0 +1,10 @@ +debugging +fibonacci9 + Python pexec: ' +def fibonacci9(): + number = 9 + lookup_table = [0] + for i in range(2, number + 1): + lookup_table.append(lookup_table[i - 1] + lookup_table[i - 2]) + return lookup_table[number]'. + ^ Python eval: 'fibonacci9()' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonExamples.class/class/miniexample.st b/repository/Python-Core.package/PythonExamples.class/class/miniexample.st new file mode 100644 index 00000000..88bc5a68 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/class/miniexample.st @@ -0,0 +1,13 @@ +debugging +miniexample + "Use user interrupt to interrupt while loop" + ^ Python pexec: ' +x = 0 + +def start(): + global x + while True: + x += 1 + if x % 1000 == 0: + print x +start()' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonExamples.class/class/server.st b/repository/Python-Core.package/PythonExamples.class/class/server.st new file mode 100644 index 00000000..e7ff2425 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/class/server.st @@ -0,0 +1,5 @@ +debugging +server + "Use user interrupt to interrupt server loop" + Python exec: 'from helloworld import live_value, app'. + ^ Python eval: 'app.run()' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonExamples.class/methodProperties.json b/repository/Python-Core.package/PythonExamples.class/methodProperties.json new file mode 100644 index 00000000..5c4d0636 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/methodProperties.json @@ -0,0 +1,10 @@ +{ + "class" : { + "average" : "fn 2/23/2017 21:12", + "average:" : "fn 2/23/2017 21:12", + "fibonacci9" : "fn 2/23/2017 21:13", + "fibonacci:" : "fn 2/23/2017 21:13", + "miniexample" : "fn 2/23/2017 21:13", + "server" : "fn 2/23/2017 17:59" }, + "instance" : { + } } diff --git a/repository/Python-Core.package/PythonExamples.class/properties.json b/repository/Python-Core.package/PythonExamples.class/properties.json new file mode 100644 index 00000000..32a2863b --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonExamples", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/Python-Core.package/PythonObject.class/README.md b/repository/Python-Core.package/PythonObject.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/PythonObject.class/class/allInstances.st b/repository/Python-Core.package/PythonObject.class/class/allInstances.st new file mode 100644 index 00000000..28f49cc5 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/allInstances.st @@ -0,0 +1,3 @@ +overrides +allInstances + ^ Python eval: self name, '.instances.values()' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/isPython.st b/repository/Python-Core.package/PythonObject.class/class/isPython.st new file mode 100644 index 00000000..5f13d9ba --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/isPython.st @@ -0,0 +1,3 @@ +overrides +isPython + ^ true \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/new.st b/repository/Python-Core.package/PythonObject.class/class/new.st new file mode 100644 index 00000000..3dfc8d49 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/new.st @@ -0,0 +1,5 @@ +overrides +new + Python vmSpeaksPython ifFalse: [ ^ super new ]. + ^ self withAll: #() + \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/nextID.st b/repository/Python-Core.package/PythonObject.class/class/nextID.st new file mode 100644 index 00000000..1a290885 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/nextID.st @@ -0,0 +1,6 @@ +overrides +nextID + "NextID = nil" + NextID ifNil: [ NextID := 0 ]. + NextID := NextID + 1. + ^ NextID \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/pyCompile.classified.notifying..st b/repository/Python-Core.package/PythonObject.class/class/pyCompile.classified.notifying..st new file mode 100644 index 00000000..e4bc1c4a --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/pyCompile.classified.notifying..st @@ -0,0 +1,12 @@ +overrides +pyCompile: text classified: category notifying: requestor + | pySelector selector pySource isNewMethod | + pySource := text asString. + pySelector := PythonCompiler extractPySelector: pySource. + selector := pySelector asSymbol. + isNewMethod := self pyMethodDict includesKey: pySelector. + Python exec: pySource, String cr, + self name asString, '.', pySelector, ' = ', pySelector. + self pyMethodDict at: selector put: pySource. + self organization classify: selector under: category suppressIfDefault: false. + ^ pySelector \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/pyMethodDict.st b/repository/Python-Core.package/PythonObject.class/class/pyMethodDict.st new file mode 100644 index 00000000..c39d40ea --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/pyMethodDict.st @@ -0,0 +1,3 @@ +overrides +pyMethodDict + ^ PyMethodDict ifNil: [ PyMethodDict := IdentityDictionary new ] \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/pythonize.instVars.clsVars..st b/repository/Python-Core.package/PythonObject.class/class/pythonize.instVars.clsVars..st new file mode 100644 index 00000000..cb0a603b --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/pythonize.instVars.clsVars..st @@ -0,0 +1,31 @@ +as yet unclassified +pythonize: t instVars: f clsVars: d + | code instVars clsVars pySuperclass initSignature | + instVars := Scanner new scanFieldNames: f. + clsVars := Scanner new scanFieldNames: d. + initSignature := 'self'. + instVars do: [ :ea | initSignature := initSignature, ', ', ea, '=None']. + + pySuperclass := (self superclass = Object + ifTrue: [ 'object' ] + ifFalse: [ self superclass name asString ]). + code := 'class ', t asString, '(', pySuperclass, '):', String cr. + + code := code, String tab, 'next_id = 0', String cr. + code := code, String tab, 'instances = {}', String cr. + + "clsVars are currently class attributes" + clsVars do: [ :ea | code := code, String tab, ea, ' = None', String cr]. + + code := code, String tab, 'def __init__(', initSignature ,'):', String cr. + code := code, String tab, String tab, 'self.__class__.next_id += 1', String cr. + code := code, String tab, String tab, 'self.inst_id = self.__class__.next_id', String cr. + code := code, String tab, String tab, 'self.__class__.instances[self.inst_id] = self', String cr. + instVars do: [ :ea | + code := code, String tab, String tab, 'self.', ea, ' = ', ea, String cr ]. + instVars ifEmpty: [ code := code, String tab, String tab, 'pass', String cr ]. + + "instVars do: [ :ea | + code := code, String tab, 'def ', ea, '(self, val): self.', ea, '_val = val' , String cr ]." + + Python exec: code \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/pythonize.st b/repository/Python-Core.package/PythonObject.class/class/pythonize.st new file mode 100644 index 00000000..ad197856 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/pythonize.st @@ -0,0 +1,4 @@ +as yet unclassified +pythonize + "Transcript showln: 'Pythonizing ', self name, '...'." + self pythonize: self name instVars: self instVarNames clsVars: self classVarNames \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/pythonizeAll.st b/repository/Python-Core.package/PythonObject.class/class/pythonizeAll.st new file mode 100644 index 00000000..acb320f5 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/pythonizeAll.st @@ -0,0 +1,5 @@ +as yet unclassified +pythonizeAll + NextID := 0. + "Pythonize all Python classes" + self withAllSubclasses do: [ :ea | ea pythonize ]. \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st b/repository/Python-Core.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st new file mode 100644 index 00000000..4929b127 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st @@ -0,0 +1,4 @@ +as yet unclassified +sourceCodeAt: selector ifAbsent: aBlock + ^ self pyMethodDict at: selector ifAbsent: [ + ^ super sourceCodeAt: selector ifAbsent: aBlock ] \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st b/repository/Python-Core.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st new file mode 100644 index 00000000..37fe112a --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st @@ -0,0 +1,4 @@ +as yet unclassified +subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat + Python vmSpeaksPython ifTrue: [ self pythonize: t instVars: f clsVars: d ]. + ^ super subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/toolIconSelector..st b/repository/Python-Core.package/PythonObject.class/class/toolIconSelector..st new file mode 100644 index 00000000..1644aa1c --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/toolIconSelector..st @@ -0,0 +1,5 @@ +overrides +toolIconSelector: aSelector + (self isMeta or: [(self pyMethodDict includesKey: aSelector) not]) + ifTrue: [^ super toolIconSelector: aSelector]. + ^#python \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/withAll..st b/repository/Python-Core.package/PythonObject.class/class/withAll..st new file mode 100644 index 00000000..355b8115 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/withAll..st @@ -0,0 +1,3 @@ +as yet unclassified +withAll: anArray + ^ Python eval: self name asString, '(', (anArray joinSeparatedBy: ',') , ')' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/withAll2..st b/repository/Python-Core.package/PythonObject.class/class/withAll2..st new file mode 100644 index 00000000..26e83602 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/withAll2..st @@ -0,0 +1,8 @@ +as yet unclassified +withAll2: anArray + | id obj | + id := 'inst', PythonObject nextID asString. + Python exec: id, ' = ', self name asString, '(', (anArray joinSeparatedBy: ',') , ')'. + obj := Python eval: id. + obj pyID: id. + ^ obj \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/withAll3..st b/repository/Python-Core.package/PythonObject.class/class/withAll3..st new file mode 100644 index 00000000..fd6417ea --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/withAll3..st @@ -0,0 +1,6 @@ +as yet unclassified +withAll3: anArray + | id | + id := 'inst', PythonObject nextID asString. + Python exec: id, ' = ', self name asString, '(', (anArray joinSeparatedBy: ',') , ')'. + ^ self basicNew initialize pyID: id; yourself \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st b/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st new file mode 100644 index 00000000..28742c5f --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st @@ -0,0 +1,3 @@ +helpers +allAttributes + ^ (Python builtins dir: self) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st b/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st new file mode 100644 index 00000000..c8f110e7 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st @@ -0,0 +1,3 @@ +overrides +allInstVarNames + ^ self allAttributes \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/asSmalltalk.st b/repository/Python-Core.package/PythonObject.class/instance/asSmalltalk.st new file mode 100644 index 00000000..33ef364d --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/asSmalltalk.st @@ -0,0 +1,4 @@ +helpers +asSmalltalk + + self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/at..st b/repository/Python-Core.package/PythonObject.class/instance/at..st new file mode 100644 index 00000000..7282371f --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/at..st @@ -0,0 +1,3 @@ +overrides +at: aKeyOrIndex + ^ self __getitem__: aKeyOrIndex \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/at.put..st b/repository/Python-Core.package/PythonObject.class/instance/at.put..st new file mode 100644 index 00000000..70812ae6 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/at.put..st @@ -0,0 +1,3 @@ +overrides +at: aKeyOrIndex put: aValue + ^ self __setitem__: aKeyOrIndex to: aValue \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/class.st b/repository/Python-Core.package/PythonObject.class/instance/class.st new file mode 100644 index 00000000..8e78e221 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/class.st @@ -0,0 +1,3 @@ +overrides +class + ^ Python builtins type: self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/className.st b/repository/Python-Core.package/PythonObject.class/instance/className.st new file mode 100644 index 00000000..ba8f8900 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/className.st @@ -0,0 +1,4 @@ +helpers +className + self hasClass ifFalse: [ self error: 'No class found' ]. + ^ self __class__ __name__ asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st b/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st new file mode 100644 index 00000000..d63a8ce0 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st @@ -0,0 +1,5 @@ +overrides +defaultLabelForInspector + "Answer the default label to be used for an Inspector window on the receiver." + self hasClass ifTrue: [ ^ self className, ': ', self asString ]. + ^ self asString \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/environment.st b/repository/Python-Core.package/PythonObject.class/instance/environment.st new file mode 100644 index 00000000..d6270da0 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/environment.st @@ -0,0 +1,3 @@ +overrides +environment + ^ nil \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/explore.st b/repository/Python-Core.package/PythonObject.class/instance/explore.st new file mode 100644 index 00000000..6aacfcbf --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/explore.st @@ -0,0 +1,3 @@ +inspector +explore + ^PythonToolSet explore: self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st b/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st new file mode 100644 index 00000000..3a67d6e8 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st @@ -0,0 +1,8 @@ +explorer +explorerContents + ^ self allAttributes asOrderedCollection collect: [ :attrName | | value | + value := Python builtins getattr: self attrName: attrName. + ObjectExplorerWrapper + with: value + name: attrName + model: self ] \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st b/repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st new file mode 100644 index 00000000..0864bd07 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st @@ -0,0 +1,3 @@ +helpers +hasAttribute: anAttribute + ^ (Python builtins hasattr: self attr: anAttribute) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/hasClass.st b/repository/Python-Core.package/PythonObject.class/instance/hasClass.st new file mode 100644 index 00000000..2df639b8 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/hasClass.st @@ -0,0 +1,3 @@ +helpers +hasClass + ^ self hasAttribute: '__class__' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st b/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st new file mode 100644 index 00000000..ea5a3ba7 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st @@ -0,0 +1,4 @@ +inspector +hasContentsInExplorer + + ^ self allAttributes notEmpty diff --git a/repository/Python-Core.package/PythonObject.class/instance/inspect.st b/repository/Python-Core.package/PythonObject.class/instance/inspect.st new file mode 100644 index 00000000..9576f5bb --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/inspect.st @@ -0,0 +1,4 @@ +inspector +inspect + "Create and schedule an Inspector in which the user can examine the receiver's variables." + ^ PythonToolSet inspect: self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/inspectorClass.st b/repository/Python-Core.package/PythonObject.class/instance/inspectorClass.st new file mode 100644 index 00000000..54a02214 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/inspectorClass.st @@ -0,0 +1,3 @@ +inspector +inspectorClass + ^ PythonInspector \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st b/repository/Python-Core.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st new file mode 100644 index 00000000..d0fe74a1 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st @@ -0,0 +1,9 @@ +overrides +instVarNamesAndOffsetsDo: aBinaryBlock + "This is part of the interface between the compiler and a class's instance or field names. + The class should enumerate aBinaryBlock with the instance variable name strings and + their integer offsets. The order is important. Names evaluated later will override the + same names occurring earlier." + + "Nothing to do here; ClassDescription introduces named instance variables" + ^self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/isClass.st b/repository/Python-Core.package/PythonObject.class/instance/isClass.st new file mode 100644 index 00000000..af8b5c1a --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/isClass.st @@ -0,0 +1,3 @@ +helpers +isClass + ^ (Python builtins isinstance: self and: Python type) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st b/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st new file mode 100644 index 00000000..b036cc1c --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st @@ -0,0 +1,3 @@ +overrides +isKindOf: aClass + ^ PythonObject inheritsFrom: aClass \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/isPython.st b/repository/Python-Core.package/PythonObject.class/instance/isPython.st new file mode 100644 index 00000000..5f13d9ba --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/isPython.st @@ -0,0 +1,3 @@ +overrides +isPython + ^ true \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/notNil.st b/repository/Python-Core.package/PythonObject.class/instance/notNil.st new file mode 100644 index 00000000..fe0f455d --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/notNil.st @@ -0,0 +1,3 @@ +overrides +notNil + ^ self ~~ Python None \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/printOn..st b/repository/Python-Core.package/PythonObject.class/instance/printOn..st new file mode 100644 index 00000000..05da728b --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/printOn..st @@ -0,0 +1,3 @@ +overrides +printOn: aStream + aStream nextPutAll: (Python builtins str __call__: self) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/pyDictKeys.st b/repository/Python-Core.package/PythonObject.class/instance/pyDictKeys.st new file mode 100644 index 00000000..7dc8c256 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/pyDictKeys.st @@ -0,0 +1,4 @@ +helpers +pyDictKeys + (self hasAttribute: '__dict__') ifTrue: [ ^ self __dict__ keys ]. + ^ #() \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/pyDictValues.st b/repository/Python-Core.package/PythonObject.class/instance/pyDictValues.st new file mode 100644 index 00000000..b452c547 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/pyDictValues.st @@ -0,0 +1,4 @@ +helpers +pyDictValues + (self hasAttribute: '__dict__') ifTrue: [ ^ self __dict__ values ]. + ^ #() \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/pyIdentifier.st b/repository/Python-Core.package/PythonObject.class/instance/pyIdentifier.st new file mode 100644 index 00000000..72d2f4ec --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/pyIdentifier.st @@ -0,0 +1,5 @@ +helpers +pyIdentifier + | instID | + instID := self inst_id. + ^ self class __name__, '.instances[', instID, ']'. \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/respondsTo..st b/repository/Python-Core.package/PythonObject.class/instance/respondsTo..st new file mode 100644 index 00000000..6d3339c3 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/respondsTo..st @@ -0,0 +1,6 @@ +overrides +respondsTo: aSymbol + "Answer whether the method dictionary of the receiver's class contains + aSymbol as a message selector." + + ^PythonObject canUnderstand: aSymbol \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st b/repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st new file mode 100644 index 00000000..6caeecb0 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st @@ -0,0 +1,10 @@ +overrides +variablesAndOffsetsDo: aBinaryBlock + "This is the interface between the compiler and a class's instance or field names. The + class should enumerate aBinaryBlock with the field definitions (with nil offsets) followed + by the instance variable name strings and their integer offsets (1-relative). The order is + important; names evaluated later will override the same names occurring earlier." + + "Only need to do instance variables here. CProtoObject introduces field definitions." + "Nothing to do here; ClassDescription introduces named instance variables" + ^ self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/methodProperties.json b/repository/Python-Core.package/PythonObject.class/methodProperties.json new file mode 100644 index 00000000..5acec3fc --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/methodProperties.json @@ -0,0 +1,45 @@ +{ + "class" : { + "allInstances" : "fn 12/23/2016 11:17", + "isPython" : "fn 3/7/2017 11:56", + "new" : "fn 12/19/2016 14:14", + "nextID" : "fn 12/18/2016 23:45", + "pyCompile:classified:notifying:" : "fn 3/7/2017 11:44", + "pyMethodDict" : "fn 3/7/2017 10:24", + "pythonize" : "fn 12/21/2016 00:15", + "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", + "pythonizeAll" : "fn 3/6/2017 06:58", + "sourceCodeAt:ifAbsent:" : "fn 3/7/2017 12:44", + "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 12/19/2016 14:05", + "toolIconSelector:" : "fn 3/7/2017 12:43", + "withAll2:" : "fn 12/22/2016 15:19", + "withAll3:" : "fn 12/21/2016 14:50", + "withAll:" : "fn 12/22/2016 15:19" }, + "instance" : { + "allAttributes" : "fn 2/26/2017 21:35", + "allInstVarNames" : "fn 12/22/2016 23:20", + "asSmalltalk" : "fn 2/26/2017 21:04", + "at:" : "fn 2/26/2017 20:40", + "at:put:" : "fn 2/26/2017 20:41", + "class" : "fn 2/26/2017 21:41", + "className" : "fn 2/26/2017 22:01", + "defaultLabelForInspector" : "fn 2/26/2017 21:54", + "environment" : "fn 12/22/2016 22:00", + "explore" : "fn 2/24/2017 14:51", + "explorerContents" : "fn 2/24/2017 14:55", + "hasAttribute:" : "fn 2/26/2017 21:41", + "hasClass" : "fn 2/26/2017 21:52", + "hasContentsInExplorer" : "fn 12/22/2016 23:11", + "inspect" : "fn 12/22/2016 21:09", + "inspectorClass" : "fn 12/22/2016 21:16", + "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", + "isClass" : "fn 2/26/2017 21:42", + "isKindOf:" : "fn 12/25/2016 14:47", + "isPython" : "fn 2/10/2017 12:12", + "notNil" : "fn 3/6/2017 10:21", + "printOn:" : "fn 3/6/2017 10:07", + "pyDictKeys" : "fn 2/26/2017 21:42", + "pyDictValues" : "fn 2/26/2017 21:42", + "pyIdentifier" : "fn 1/18/2017 17:20", + "respondsTo:" : "fn 12/22/2016 23:36", + "variablesAndOffsetsDo:" : "fn 12/22/2016 23:59" } } diff --git a/repository/Python-Core.package/PythonObject.class/properties.json b/repository/Python-Core.package/PythonObject.class/properties.json new file mode 100644 index 00000000..a23b5e11 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + "NextID", + "PyMethodDict" ], + "commentStamp" : "", + "instvars" : [ + "pyID" ], + "name" : "PythonObject", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/Python-Core.package/PythonParser.class/README.md b/repository/Python-Core.package/PythonParser.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st b/repository/Python-Core.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st new file mode 100644 index 00000000..81a9759f --- /dev/null +++ b/repository/Python-Core.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st @@ -0,0 +1,15 @@ +as yet unclassified +parseCue: aCue noPattern: noPattern ifFail: aBlock + | methodNode pySource | + pySource := aCue sourceStream upToEnd. + methodNode := self newMethodNode comment: 'Python comment'. + methodNode + selector: (PythonCompiler extractPySelector: pySource) asSymbol + arguments: nil + precedence: nil + temporaries: nil + block: nil + encoder: nil + primitive: nil. + methodNode sourceText: pySource. + ^ methodNode \ No newline at end of file diff --git a/repository/Python-Core.package/PythonParser.class/instance/parseSelector..st b/repository/Python-Core.package/PythonParser.class/instance/parseSelector..st new file mode 100644 index 00000000..d038bafa --- /dev/null +++ b/repository/Python-Core.package/PythonParser.class/instance/parseSelector..st @@ -0,0 +1,4 @@ +as yet unclassified +parseSelector: pyCode + prevEnd := pyCode indexOf: $:. "highlight method signature" + ^ (PythonCompiler extractPySelector: pyCode) asSymbol \ No newline at end of file diff --git a/repository/Python-Core.package/PythonParser.class/methodProperties.json b/repository/Python-Core.package/PythonParser.class/methodProperties.json new file mode 100644 index 00000000..108ad532 --- /dev/null +++ b/repository/Python-Core.package/PythonParser.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "parseCue:noPattern:ifFail:" : "fn 12/19/2016 02:18", + "parseSelector:" : "fn 12/19/2016 15:00" } } diff --git a/repository/Python-Core.package/PythonParser.class/properties.json b/repository/Python-Core.package/PythonParser.class/properties.json new file mode 100644 index 00000000..c6cd279e --- /dev/null +++ b/repository/Python-Core.package/PythonParser.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonParser", + "pools" : [ + ], + "super" : "Parser", + "type" : "normal" } diff --git a/repository/Python-Core.package/PythonTestObject.class/README.md b/repository/Python-Core.package/PythonTestObject.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/PythonTestObject.class/methodProperties.json b/repository/Python-Core.package/PythonTestObject.class/methodProperties.json new file mode 100644 index 00000000..0e4a6622 --- /dev/null +++ b/repository/Python-Core.package/PythonTestObject.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + } } diff --git a/repository/Python-Core.package/PythonTestObject.class/properties.json b/repository/Python-Core.package/PythonTestObject.class/properties.json new file mode 100644 index 00000000..f412e75f --- /dev/null +++ b/repository/Python-Core.package/PythonTestObject.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "bar", + "foo" ], + "name" : "PythonTestObject", + "pools" : [ + ], + "super" : "PythonObject", + "type" : "normal" } diff --git a/repository/Python-Core.package/monticello.meta/categories.st b/repository/Python-Core.package/monticello.meta/categories.st new file mode 100644 index 00000000..e61580ed --- /dev/null +++ b/repository/Python-Core.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'Python-Core'! diff --git a/repository/Python-Core.package/monticello.meta/initializers.st b/repository/Python-Core.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/monticello.meta/package b/repository/Python-Core.package/monticello.meta/package new file mode 100644 index 00000000..d397e357 --- /dev/null +++ b/repository/Python-Core.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'Python-Core') \ No newline at end of file diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version new file mode 100644 index 00000000..1091aab0 --- /dev/null +++ b/repository/Python-Core.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Core.package/properties.json b/repository/Python-Core.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/Python-Core.package/properties.json @@ -0,0 +1,2 @@ +{ + } diff --git a/repository/Python-Support.package/.filetree b/repository/Python-Support.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/Python-Support.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/Python-Support.package/CompiledMethod.extension/instance/pySource..st b/repository/Python-Support.package/CompiledMethod.extension/instance/pySource..st new file mode 100644 index 00000000..841a74f9 --- /dev/null +++ b/repository/Python-Support.package/CompiledMethod.extension/instance/pySource..st @@ -0,0 +1,3 @@ +*Python-Support +pySource: aPySource + self literalAt: 1 put: aPySource \ No newline at end of file diff --git a/repository/Python-Support.package/CompiledMethod.extension/instance/pySource.st b/repository/Python-Support.package/CompiledMethod.extension/instance/pySource.st new file mode 100644 index 00000000..c555cd83 --- /dev/null +++ b/repository/Python-Support.package/CompiledMethod.extension/instance/pySource.st @@ -0,0 +1,3 @@ +*Python-Support +pySource + ^ self literalAt: 1 \ No newline at end of file diff --git a/repository/Python-Support.package/CompiledMethod.extension/methodProperties.json b/repository/Python-Support.package/CompiledMethod.extension/methodProperties.json new file mode 100644 index 00000000..4d5e9083 --- /dev/null +++ b/repository/Python-Support.package/CompiledMethod.extension/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "pySource" : "fn 3/6/2017 22:51", + "pySource:" : "fn 3/6/2017 22:51" } } diff --git a/repository/Python-Support.package/CompiledMethod.extension/properties.json b/repository/Python-Support.package/CompiledMethod.extension/properties.json new file mode 100644 index 00000000..c19cf97e --- /dev/null +++ b/repository/Python-Support.package/CompiledMethod.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "CompiledMethod" } diff --git a/repository/Python-Support.package/PythonEditor.class/README.md b/repository/Python-Support.package/PythonEditor.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonEditor.class/class/initialize.st b/repository/Python-Support.package/PythonEditor.class/class/initialize.st new file mode 100644 index 00000000..9e62c35b --- /dev/null +++ b/repository/Python-Support.package/PythonEditor.class/class/initialize.st @@ -0,0 +1,3 @@ +as yet unclassified +initialize + super initialize \ No newline at end of file diff --git a/repository/Python-Support.package/PythonEditor.class/instance/evaluateSelectionAndDo..st b/repository/Python-Support.package/PythonEditor.class/instance/evaluateSelectionAndDo..st new file mode 100644 index 00000000..8bde686a --- /dev/null +++ b/repository/Python-Support.package/PythonEditor.class/instance/evaluateSelectionAndDo..st @@ -0,0 +1,30 @@ +as yet unclassified +evaluateSelectionAndDo: aBlock + "Treat the current selection as an expression; evaluate it and invoke aBlock with the result." + | result rcvr ctxt | + self lineSelectAndEmptyCheck: [^ nil]. + + (model respondsTo: #evaluateExpression:) ifTrue: [ + ^ aBlock value: (model perform: #evaluateExpression: with: self selection)]. + + (model respondsTo: #doItReceiver) + ifTrue: [ rcvr := model doItReceiver. + ctxt := model doItContext] + ifFalse: [rcvr := ctxt := nil]. + result := [ + PythonCompiler new + evaluate: self selectionAsStream + in: ctxt + to: rcvr + environment: (model environment ifNil: [Smalltalk globals]) + notifying: self + ifFail: [morph flash. ^ nil] + logged: true. + ] + on: OutOfScopeNotification + do: [ :ex | ex resume: true]. + + (model respondsTo: #expressionEvaluated:result:) ifTrue: [ + model perform: #expressionEvaluated:result: with: self selection with: result]. + + ^aBlock value: result \ No newline at end of file diff --git a/repository/Python-Support.package/PythonEditor.class/methodProperties.json b/repository/Python-Support.package/PythonEditor.class/methodProperties.json new file mode 100644 index 00000000..5c766d3a --- /dev/null +++ b/repository/Python-Support.package/PythonEditor.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + "initialize" : "fn 3/7/2017 18:13" }, + "instance" : { + "evaluateSelectionAndDo:" : "fn 3/7/2017 18:05" } } diff --git a/repository/Python-Support.package/PythonEditor.class/properties.json b/repository/Python-Support.package/PythonEditor.class/properties.json new file mode 100644 index 00000000..a60db215 --- /dev/null +++ b/repository/Python-Support.package/PythonEditor.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonEditor", + "pools" : [ + ], + "super" : "SmalltalkEditor", + "type" : "normal" } diff --git a/repository/Python-Support.package/PythonMethodContext.class/README.md b/repository/Python-Support.package/PythonMethodContext.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/isPython.st b/repository/Python-Support.package/PythonMethodContext.class/instance/isPython.st new file mode 100644 index 00000000..7f96a000 --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/instance/isPython.st @@ -0,0 +1,3 @@ +accessing +isPython + ^ true \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/printOn..st b/repository/Python-Support.package/PythonMethodContext.class/instance/printOn..st new file mode 100644 index 00000000..7d2fa8e1 --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/instance/printOn..st @@ -0,0 +1,13 @@ +as yet unclassified +printOn: aStream + | line lineno filename currentPath | + self pyFrame ifNil: [ + aStream nextPutAll: 'Unknown pyFrame'. + ^ self ]. + line := PythonDebugger getSignature: pyFrame f_code. + lineno := pyFrame f_lineno asSmalltalk. + filename := pyFrame f_code co_filename asSmalltalk. + currentPath := FileDirectory default pathName. + (filename startsWith: currentPath) ifTrue: [ + filename := filename allButFirst: currentPath size + 1]. + aStream nextPutAll: line, ' (line ' , lineno asString, ' in ', filename, ')' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame..st b/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame..st new file mode 100644 index 00000000..9cba0a4b --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame..st @@ -0,0 +1,4 @@ +accessing +pyFrame: anObject + + pyFrame := anObject \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame.st b/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame.st new file mode 100644 index 00000000..abbedaa6 --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame.st @@ -0,0 +1,4 @@ +accessing +pyFrame + + ^ pyFrame \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/sender..st b/repository/Python-Support.package/PythonMethodContext.class/instance/sender..st new file mode 100644 index 00000000..955558b9 --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/instance/sender..st @@ -0,0 +1,4 @@ +accessing +sender: anObject + + sender := anObject \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/setSender.receiver.method.arguments..st b/repository/Python-Support.package/PythonMethodContext.class/instance/setSender.receiver.method.arguments..st new file mode 100644 index 00000000..6885cbdf --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/instance/setSender.receiver.method.arguments..st @@ -0,0 +1,11 @@ +accessing +setSender: s receiver: r method: m arguments: args + "Create the receiver's initial state." + + sender := s. + receiver := r. + method := m. + closureOrNil := nil. + pc := method initialPC. + "self stackp: method numTemps. + 1 to: args size do: [:i | self at: i put: (args at: i)]" \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/tempNames.st b/repository/Python-Support.package/PythonMethodContext.class/instance/tempNames.st new file mode 100644 index 00000000..68b8afa4 --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/instance/tempNames.st @@ -0,0 +1,7 @@ +accessing +tempNames + "Answer a SequenceableCollection of the names of the receiver's temporary + variables, which are strings." + + self pyFrame ifNil: [^ #()]. + ^ self pyFrame f_locals keys asSmalltalk \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/methodProperties.json b/repository/Python-Support.package/PythonMethodContext.class/methodProperties.json new file mode 100644 index 00000000..74467303 --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/methodProperties.json @@ -0,0 +1,11 @@ +{ + "class" : { + }, + "instance" : { + "isPython" : "fn 3/6/2017 19:17", + "printOn:" : "fn 3/6/2017 10:28", + "pyFrame" : "fn 1/16/2017 19:30", + "pyFrame:" : "fn 1/16/2017 19:30", + "sender:" : "fn 1/16/2017 21:54", + "setSender:receiver:method:arguments:" : "fn 1/18/2017 17:38", + "tempNames" : "fn 3/6/2017 10:29" } } diff --git a/repository/Python-Support.package/PythonMethodContext.class/properties.json b/repository/Python-Support.package/PythonMethodContext.class/properties.json new file mode 100644 index 00000000..29d02c0b --- /dev/null +++ b/repository/Python-Support.package/PythonMethodContext.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "pyFrame" ], + "name" : "PythonMethodContext", + "pools" : [ + ], + "super" : "MethodContext", + "type" : "variable" } diff --git a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/README.md b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/instance/stylerClass.st b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/instance/stylerClass.st new file mode 100644 index 00000000..15df1ae0 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/instance/stylerClass.st @@ -0,0 +1,3 @@ +as yet unclassified +stylerClass + ^ PythonTextStyler \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/methodProperties.json b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/methodProperties.json new file mode 100644 index 00000000..3c94aab4 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "stylerClass" : "fn 3/6/2017 11:23" } } diff --git a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/properties.json b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/properties.json new file mode 100644 index 00000000..922f1bb4 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonPluggableCodePaneSpec", + "pools" : [ + ], + "super" : "PluggableCodePaneSpec", + "type" : "normal" } diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/README.md b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/setText..st b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/setText..st new file mode 100644 index 00000000..33cefb2e --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/setText..st @@ -0,0 +1,8 @@ +as yet unclassified +setText: aText + + self okToStyle ifFalse:[^super setText: aText]. + super setText: (styler format: aText asText). + self stylePyCode + ifTrue: [ styler stylePython: textMorph contents ] + ifFalse: [ styler style: textMorph contents ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/stylePyCode.st b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/stylePyCode.st new file mode 100644 index 00000000..9b98c025 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/stylePyCode.st @@ -0,0 +1,3 @@ +as yet unclassified +stylePyCode + ^ self model isPython and: [ self model hasPyCodeSelected ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/textMorphClass.st b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/textMorphClass.st new file mode 100644 index 00000000..c267d9b0 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/textMorphClass.st @@ -0,0 +1,5 @@ +as yet unclassified +textMorphClass + "Answer the class used to create the receiver's textMorph" + + ^ PythonTextMorphForEditView \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/updateStyle.st b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/updateStyle.st new file mode 100644 index 00000000..54df736b --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/updateStyle.st @@ -0,0 +1,6 @@ +as yet unclassified +updateStyle + self okToStyle ifTrue: [ + self stylePyCode + ifTrue: [ styler stylePythonInBackgroundProcess: textMorph contents ] + ifFalse: [ styler styleInBackgroundProcess: textMorph contents ] ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/methodProperties.json b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/methodProperties.json new file mode 100644 index 00000000..616382b1 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + }, + "instance" : { + "setText:" : "fn 3/7/2017 16:11", + "stylePyCode" : "fn 3/7/2017 16:11", + "textMorphClass" : "fn 3/7/2017 18:03", + "updateStyle" : "fn 3/7/2017 16:26" } } diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/properties.json b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/properties.json new file mode 100644 index 00000000..6de62713 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonPluggableTextMorphPlus", + "pools" : [ + ], + "super" : "PluggableTextMorphPlus", + "type" : "normal" } diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/README.md b/repository/Python-Support.package/PythonPluggableTextSpec.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/stylerClass.st b/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/stylerClass.st new file mode 100644 index 00000000..15df1ae0 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/stylerClass.st @@ -0,0 +1,3 @@ +as yet unclassified +stylerClass + ^ PythonTextStyler \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/textPaneClass.st b/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/textPaneClass.st new file mode 100644 index 00000000..934e70f2 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/textPaneClass.st @@ -0,0 +1,3 @@ +as yet unclassified +textPaneClass + ^ PythonPluggableTextMorphPlus \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/methodProperties.json b/repository/Python-Support.package/PythonPluggableTextSpec.class/methodProperties.json new file mode 100644 index 00000000..341bb33e --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextSpec.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "stylerClass" : "fn 3/6/2017 14:48", + "textPaneClass" : "fn 3/6/2017 16:19" } } diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/properties.json b/repository/Python-Support.package/PythonPluggableTextSpec.class/properties.json new file mode 100644 index 00000000..49543296 --- /dev/null +++ b/repository/Python-Support.package/PythonPluggableTextSpec.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonPluggableTextSpec", + "pools" : [ + ], + "super" : "PluggableTextSpec", + "type" : "normal" } diff --git a/repository/Python-Support.package/PythonTextMorphForEditView.class/README.md b/repository/Python-Support.package/PythonTextMorphForEditView.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonTextMorphForEditView.class/instance/editorClass.st b/repository/Python-Support.package/PythonTextMorphForEditView.class/instance/editorClass.st new file mode 100644 index 00000000..94dd651d --- /dev/null +++ b/repository/Python-Support.package/PythonTextMorphForEditView.class/instance/editorClass.st @@ -0,0 +1,4 @@ +as yet unclassified +editorClass + "Answer the class used to create the receiver's editor" + ^ PythonEditor \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextMorphForEditView.class/methodProperties.json b/repository/Python-Support.package/PythonTextMorphForEditView.class/methodProperties.json new file mode 100644 index 00000000..374cdbb9 --- /dev/null +++ b/repository/Python-Support.package/PythonTextMorphForEditView.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "editorClass" : "fn 3/7/2017 18:05" } } diff --git a/repository/Python-Support.package/PythonTextMorphForEditView.class/properties.json b/repository/Python-Support.package/PythonTextMorphForEditView.class/properties.json new file mode 100644 index 00000000..19059d95 --- /dev/null +++ b/repository/Python-Support.package/PythonTextMorphForEditView.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonTextMorphForEditView", + "pools" : [ + ], + "super" : "TextMorphForEditView", + "type" : "normal" } diff --git a/repository/Python-Support.package/PythonTextStyler.class/README.md b/repository/Python-Support.package/PythonTextStyler.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st b/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st new file mode 100644 index 00000000..75192ead --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st @@ -0,0 +1,6 @@ +as yet unclassified +highlight: aText + ^ (Python pygments + highlight: aText string + lexer: Python pyLexerPython + formatter: Python pyFormatter) asSmalltalk asTextFromHtml \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/class/highlightSmalltalk..st b/repository/Python-Support.package/PythonTextStyler.class/class/highlightSmalltalk..st new file mode 100644 index 00000000..a9a7e297 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/class/highlightSmalltalk..st @@ -0,0 +1,6 @@ +as yet unclassified +highlightSmalltalk: aText + ^ (Python pygments + highlight: aText string + lexer: Python pyLexerSmalltalk + formatter: Python pyFormatter) asSmalltalk asTextFromHtml \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st b/repository/Python-Support.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st new file mode 100644 index 00000000..a71263fd --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st @@ -0,0 +1,5 @@ +overrides +parseableSourceCodeTemplate + + ^'def method(self, x): + return 2 * x' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/privateStyle..st b/repository/Python-Support.package/PythonTextStyler.class/instance/privateStyle..st new file mode 100644 index 00000000..a8d0ddfb --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/privateStyle..st @@ -0,0 +1,3 @@ +overrides +privateStyle: aText + "do nothing" \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/stylePython..st b/repository/Python-Support.package/PythonTextStyler.class/instance/stylePython..st new file mode 100644 index 00000000..bebe77e3 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/stylePython..st @@ -0,0 +1,9 @@ +overrides +stylePython: aText + | styledText | + stylingEnabled ifFalse: [ ^ self ]. + Python vmSpeaksPython ifFalse: [^ super style: aText]. + styledText := (PythonTextStyler highlight: aText) first: aText size. + "Strings must be of same size, otherwise image might crash" + self assert: styledText string size = aText string size. + view ifNotNil:[view stylerStyled: styledText] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/stylePythonInBackgroundProcess..st b/repository/Python-Support.package/PythonTextStyler.class/instance/stylePythonInBackgroundProcess..st new file mode 100644 index 00000000..a7d0f087 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/stylePythonInBackgroundProcess..st @@ -0,0 +1,3 @@ +overrides +stylePythonInBackgroundProcess: aText + Project current addDeferredUIMessage: [ self stylePython: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json b/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json new file mode 100644 index 00000000..1c4b7b08 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json @@ -0,0 +1,9 @@ +{ + "class" : { + "highlight:" : "fn 3/6/2017 19:04", + "highlightSmalltalk:" : "fn 3/6/2017 19:14" }, + "instance" : { + "parseableSourceCodeTemplate" : "fn 12/22/2016 15:20", + "privateStyle:" : "fn 3/7/2017 17:29", + "stylePython:" : "fn 3/7/2017 16:12", + "stylePythonInBackgroundProcess:" : "fn 3/7/2017 16:27" } } diff --git a/repository/Python-Support.package/PythonTextStyler.class/properties.json b/repository/Python-Support.package/PythonTextStyler.class/properties.json new file mode 100644 index 00000000..0df5ff19 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonTextStyler", + "pools" : [ + ], + "super" : "SHTextStylerST80", + "type" : "normal" } diff --git a/repository/Python-Support.package/PythonTheme.class/README.md b/repository/Python-Support.package/PythonTheme.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonTheme.class/class/addButtons..st b/repository/Python-Support.package/PythonTheme.class/class/addButtons..st new file mode 100644 index 00000000..457311a9 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/addButtons..st @@ -0,0 +1,26 @@ +instance creation +addButtons: theme + "self create apply" + theme + set: #borderColor for: #PluggableButtonMorph to: Color gray; + set: #borderWidth for: #PluggableButtonMorph to: 0; + set: #borderStyle for: #PluggableButtonMorph to: BorderStyle default; + set: #color for: #PluggableButtonMorph to: self backgroundColor lighter; + + set: #font for: #PluggableButtonMorph to: [Preferences standardButtonFont]; + set: #textColor for: #PluggableButtonMorph to: self textColor; + + set: #selectionModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.2] ]; + set: #hoverModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.3] ]; + set: #feedbackModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.4] ]. + + "And the plus-version." + theme + set: #disabledColor for: #PluggableButtonMorphPlus to: Color transparent; + set: #disabledTextColor for: #PluggableButtonMorphPlus to: (Color gray: 0.6). + + "And the three-phase button." + theme + derive: #color for: #ThreePhaseButtonMorph from: #PluggableButtonMorph at: #textColor; + derive: #font for: #ThreePhaseButtonMorph from: #PluggableButtonMorph; + derive: #textColor for: #ThreePhaseButtonMorph from: #PluggableButtonMorph. \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/addDialogs..st b/repository/Python-Support.package/PythonTheme.class/class/addDialogs..st new file mode 100644 index 00000000..9f20eda6 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/addDialogs..st @@ -0,0 +1,66 @@ +instance creation +addDialogs: theme + "self create apply." + + theme + set: #borderColor for: #DialogWindow to: Color gray; + set: #borderWidth for: #DialogWindow to: 1; + set: #borderStyle for: #DialogWindow to: BorderStyle default; + set: #color for: #DialogWindow to: self backgroundColor; + + set: #titleBorderColor for: #DialogWindow to: Color gray; + set: #titleBorderWidth for: #DialogWindow to: 0; + set: #titleBorderStyle for: #DialogWindow to: BorderStyle default; + set: #titleColor for: #DialogWindow to: self highlightColor; + set: #titleFont for: #DialogWindow to: [Preferences windowTitleFont]; + set: #titleTextColor for: #DialogWindow to: self textColor; + + set: #font for: #DialogWindow to: [Preferences standardSystemFont]; + set: #textColor for: #DialogWindow to: self textColor; + + set: #okColor for: #DialogWindow to: self green; + set: #cancelColor for: #DialogWindow to: self red; + set: #buttonColor for: #DialogWindow to: (self backgroundColor adjustBrightness: 0.2); + set: #selectionModifier for: #DialogWindow to: [ [:c | c adjustBrightness: 0.1 ] ]. + + "The List Chooser is a dialog, too." + theme + derive: #okColor for: #ListChooser from: #DialogWindow; + derive: #cancelColor for: #ListChooser from: #DialogWindow; + set: #addColor for: #ListChooser to: Color blue muchLighter; + set: #disabledColor for: #ListChooser to: Color gray. + + "And the mulitple list chooser." + theme + derive: #okColor for: #ListMultipleChooser from: #DialogWindow; + derive: #cancelColor for: #ListMultipleChooser from: #DialogWindow. + + "And the system progress bar." + theme + derive: #borderColor for: #SystemProgressMorph from: #MenuMorph; + derive: #borderWidth for: #SystemProgressMorph from: #MenuMorph; + derive: #borderStyle for: #SystemProgressMorph from: #MenuMorph; + derive: #color for: #SystemProgressMorph from: #MenuMorph; + derive: #font for: #SystemProgressMorph from: #MenuItemMorph; + derive: #textColor for: #SystemProgressMorph from: #MenuItemMorph; + + set: #borderColor for: #SystemProgressBarMorph to: Color transparent; + set: #borderWidth for: #SystemProgressBarMorph to: 0; + set: #borderStyle for: #SystemProgressBarMorph to: BorderStyle default; + set: #color for: #SystemProgressBarMorph to: (Color r: 0.977 g: 0.977 b: 0.977); + set: #barColor for: #SystemProgressBarMorph to: (Color r: 0.72 g: 0.72 b: 0.9). + + "And the balloon morphs." + theme + set: #borderColor for: #NewBalloonMorph to: self highlightColor; + set: #borderWidth for: #NewBalloonMorph to: 1; + set: #color for: #NewBalloonMorph to: self highlightColor; + set: #font for: #NewBalloonMorph to: [Preferences standardBalloonHelpFont]; + derive: #textColor for: #NewBalloonMorph from: #PluggableButtonMorph. + + theme + derive: #borderColor for: #BalloonMorph from: #NewBalloonMorph; + set: #borderWidth for: #BalloonMorph to: 0; + derive: #color for: #BalloonMorph from: #NewBalloonMorph; + derive: #font for: #BalloonMorph from: #NewBalloonMorph; + derive: #textColor for: #BalloonMorph from: #NewBalloonMorph. \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/addFonts..st b/repository/Python-Support.package/PythonTheme.class/class/addFonts..st new file mode 100644 index 00000000..10b1accd --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/addFonts..st @@ -0,0 +1,14 @@ +instance creation +addFonts: theme + + theme + set: #balloonHelpFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7); + set: #standardButtonFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7); + set: #standardCodeFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardDefaultTextFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardFlapFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7 emphasized: TextEmphasis bold emphasisCode); + set: #haloLabelFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardListFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardMenuFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #standardSystemFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); + set: #windowTitleFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9 emphasized: TextEmphasis bold emphasisCode). diff --git a/repository/Python-Support.package/PythonTheme.class/class/addMenusAndDockingBars..st b/repository/Python-Support.package/PythonTheme.class/class/addMenusAndDockingBars..st new file mode 100644 index 00000000..7e248501 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/addMenusAndDockingBars..st @@ -0,0 +1,44 @@ +instance creation +addMenusAndDockingBars: theme + "self create apply" + theme + set: #borderColor for: #MenuMorph to: Color gray; + set: #borderWidth for: #MenuMorph to: 1; + set: #borderStyle for: #MenuMorph to: BorderStyle default; + set: #color for: #MenuMorph to: self backgroundColor; + + set: #titleBorderColor for: #MenuMorph to: self backgroundColor darker; + set: #titleBorderWidth for: #MenuMorph to: 0; + set: #titleBorderStyle for: #MenuMorph to: BorderStyle default; + set: #titleColor for: #MenuMorph to: Color transparent; + set: #titleFont for: #MenuMorph to: [Preferences windowTitleFont]; + set: #titleTextColor for: #MenuMorph to: self textColor; + + set: #lineColor for: #MenuMorph to: self backgroundColor darker; + set: #lineStyle for: #MenuMorph to: BorderStyle simple; + set: #lineWidth for: #MenuMorph to: 1. + + theme + set: #font for: #MenuItemMorph to: [Preferences standardMenuFont]; + set: #textColor for: #MenuItemMorph to: self unfocusedLabelColor; + set: #disabledTextColor for: #MenuItemMorph to: Color gray; + set: #selectionColor for: #MenuItemMorph to: self backgroundColor lighter lighter; + set: #selectionTextColor for: #MenuItemMorph to: self textColor. + + "Derive some stuff for the docking bar morph, which looks mostly like a menu morph." + theme + set: #borderWidth for: #DockingBarMorph to: 0; + derive: #borderColor for: #DockingBarMorph from: #MenuMorph; + derive: #borderStyle for: #DockingBarMorph from: #MenuMorph; + derive: #color for: #DockingBarMorph from: #MenuMorph; + + derive: #lineColor for: #DockingBarMorph from: #MenuMorph; + derive: #lineStyle for: #DockingBarMorph from: #MenuMorph; + derive: #lineWidth for: #DockingBarMorph from: #MenuMorph. + + "The world main docking bar." + theme + derive: #font for: #TheWorldMainDockingBar from: #MenuItemMorph; + derive: #textColor for: #TheWorldMainDockingBar from: #MenuItemMorph; + set: #logoColor for: #TheWorldMainDockingBar to: self textColor; + set: #selectionLogoColor for: #TheWorldMainDockingBar to: Color white. \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/addScrollables..st b/repository/Python-Support.package/PythonTheme.class/class/addScrollables..st new file mode 100644 index 00000000..ab98b1e2 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/addScrollables..st @@ -0,0 +1,71 @@ +instance creation +addScrollables: theme + "self create apply" + + "Sliders" + theme + set: #borderColor for: #Slider to: Color gray; + set: #borderWidth for: #Slider to: 0; + set: #color for: #Slider to: Color lightGray; + set: #thumbBorderColor for: #Slider to: [Color gray: 0.6]; + set: #thumbBorderWidth for: #Slider to: 0; + set: #thumbColor for: #Slider to: Color veryVeryLightGray; + set: #thumbShadowModifier for: #Slider to: [ [:c | c alpha: 0.7] ]. + + "Scroll bars" + theme + set: #thumbBorderWidth for: #ScrollBar to: 0; + set: #thumbColorModifier for: #ScrollBar to: [ [:c | c] ]; + set: #pagingAreaColorModifier for: #ScrollBar to: [ [:c | c darker alpha: -0.35] ]; + set: #borderColorModifier for: #ScrollBar to: [ [:c | c adjustBrightness: -0.1] ]. + + "Scroll panes (includes generic stuff for list widgets, tree widgets, and text widgets." + theme + set: #borderColor for: #ScrollPane to: (Color gray: 0.6); + set: #borderWidth for: #ScrollPane to: 0; + set: #borderStyle for: #ScrollPane to: BorderStyle default; + set: #color for: #ScrollPane to: self backgroundColor. + + "List widgets" + theme + set: #font for: #PluggableListMorph to: [Preferences standardListFont]; + set: #textColor for: #PluggableListMorph to: self unfocusedLabelColor; + set: #selectionColor for: #PluggableListMorph to: self backgroundColor lighter lighter; + derive: #multiSelectionColor for: #PluggableListMorph from: #PluggableListMorph at: #selectionColor do: [:c | c lighter]; + set: #selectionTextColor for: #PluggableListMorph to: self textColor; + set: #filterColor for: #PluggableListMorph to: Color transparent; + set: #filterTextColor for: #PluggableListMorph to: self highlightColor; + set: #preSelectionModifier for: #PluggableListMorph to: [ [:c | Color gray: 0.9] ]; + set: #hoverSelectionModifier for: #PluggableListMorph to: [ [:c | c darker alpha: 0.3] ]. + + "Tree widgets" + theme + derive: #font for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #textColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #selectionColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #selectionTextColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #filterColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #filterTextColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + derive: #hoverSelectionModifier for: #SimpleHierarchicalListMorph from: #PluggableListMorph; + + set: #higlightTextColor for: #SimpleHierarchicalListMorph to: Color red; + set: #lineColor for: #SimpleHierarchicalListMorph to: Color veryLightGray. + + "Text widgets" + theme + set: #font for: #PluggableTextMorph to: [Preferences standardDefaultTextFont]; + set: #textColor for: #PluggableTextMorph to: self textColor; + set: #caretColor for: #PluggableTextMorph to: Color red; + set: #selectionColor for: #PluggableTextMorph to: self textSelectionColor; + set: #unfocusedSelectionModifier for: #PluggableTextMorph to: [[:c | self textSelectionColor ]]; + set: #adornmentReadOnly for: #PluggableTextMorph to: Color black; + set: #adornmentRefuse for: #PluggableTextMorph to: Color tan; + set: #adornmentConflict for: #PluggableTextMorph to: Color red; + set: #adornmentDiff for: #PluggableTextMorph to: Color green; + set: #adornmentNormalEdit for: #PluggableTextMorph to: Color orange; + set: #adornmentDiffEdit for: #PluggableTextMorph to: Color yellow; + set: #frameAdornmentWidth for: #PluggableTextMorph to: 1. + theme + set: #stylerClass for: #PluggableTextMorphPlus to: PythonTextStyler; + set: #balloonTextColor for: #PluggableTextMorphPlus to: (Color gray: 0.7); + derive: #balloonTextFont for: #PluggableTextMorphPlus from: #PluggableTextMorph at: #font. \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/addSyntaxHighlighting..st b/repository/Python-Support.package/PythonTheme.class/class/addSyntaxHighlighting..st new file mode 100644 index 00000000..fae0387d --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/addSyntaxHighlighting..st @@ -0,0 +1,123 @@ +instance creation +addSyntaxHighlighting: theme + "self create apply." + theme + set: #color for: #TextAction to: self blue; + + set: #default for: #SHTextStylerST80 to: {self foregroundColor}; + set: #invalid for: #SHTextStylerST80 to: {self red}; + set: #excessCode for: #SHTextStylerST80 to: {self red}; + set: #comment for: #SHTextStylerST80 to: {self commentColor}; + set: #unfinishedComment for: #SHTextStylerST80 to: {self red. TextEmphasis italic}; + set: #'$' for: #SHTextStylerST80 to: {self red}; + set: #character for: #SHTextStylerST80 to: {self numberColor}; + set: #integer for: #SHTextStylerST80 to: {self numberColor}; + set: #number for: #SHTextStylerST80 to: {self numberColor}; + set: #- for: #SHTextStylerST80 to: {self red}; + set: #symbol for: #SHTextStylerST80 to: {self blue}; + set: #stringSymbol for: #SHTextStylerST80 to: {self blue}; + set: #literalArray for: #SHTextStylerST80 to: {self blue}; + set: #string for: #SHTextStylerST80 to: {self stringColor. TextEmphasis normal}; + set: #unfinishedString for: #SHTextStylerST80 to: {self red. TextEmphasis normal}; + set: #assignment for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #ansiAssignment for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #literal for: #SHTextStylerST80 to: {nil. TextEmphasis italic}; + set: #keyword for: #SHTextStylerST80 to: {self blue}; + set: #binary for: #SHTextStylerST80 to: {self blue}; + set: #unary for: #SHTextStylerST80 to: {self blue}; + set: #incompleteKeyword for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; + set: #incompleteBinary for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; + set: #incompleteUnary for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; + set: #undefinedKeyword for: #SHTextStylerST80 to: {self red}; + set: #undefinedBinary for: #SHTextStylerST80 to: {self red}; + set: #undefinedUnary for: #SHTextStylerST80 to: {self red}; + set: #patternKeyword for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #patternBinary for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #patternUnary for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; + set: #self for: #SHTextStylerST80 to: {self red}; + set: #super for: #SHTextStylerST80 to: {self red}; + set: #true for: #SHTextStylerST80 to: {self red}; + set: #false for: #SHTextStylerST80 to: {self red}; + set: #nil for: #SHTextStylerST80 to: {self red}; + set: #thisContext for: #SHTextStylerST80 to: {self red}; + set: #return for: #SHTextStylerST80 to: {self red}; + set: #patternArg for: #SHTextStylerST80 to: {self blue}; + set: #methodArg for: #SHTextStylerST80 to: {self blue}; + set: #blockPatternArg for: #SHTextStylerST80 to: {self blue}; + set: #blockArg for: #SHTextStylerST80 to: {self blue}; + set: #argument for: #SHTextStylerST80 to: {self blue}; + set: #blockArgColon for: #SHTextStylerST80 to: {self foregroundColor}; + set: #leftParenthesis for: #SHTextStylerST80 to: {self foregroundColor}; + set: #rightParenthesis for: #SHTextStylerST80 to: {self foregroundColor}; + set: #leftParenthesis1 for: #SHTextStylerST80 to: {self green}; + set: #rightParenthesis1 for: #SHTextStylerST80 to: {self green}; + set: #leftParenthesis2 for: #SHTextStylerST80 to: {self magenta}; + set: #rightParenthesis2 for: #SHTextStylerST80 to: {self magenta}; + set: #leftParenthesis3 for: #SHTextStylerST80 to: {self red}; + set: #rightParenthesis3 for: #SHTextStylerST80 to: {self red}; + set: #leftParenthesis4 for: #SHTextStylerST80 to: {self green}; + set: #rightParenthesis4 for: #SHTextStylerST80 to: {self green}; + set: #leftParenthesis5 for: #SHTextStylerST80 to: {self orange}; + set: #rightParenthesis5 for: #SHTextStylerST80 to: {self orange}; + set: #leftParenthesis6 for: #SHTextStylerST80 to: {self magenta}; + set: #rightParenthesis6 for: #SHTextStylerST80 to: {self magenta}; + set: #leftParenthesis7 for: #SHTextStylerST80 to: {self blue}; + set: #rightParenthesis7 for: #SHTextStylerST80 to: {self blue}; + set: #blockStart for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockEnd for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockStart1 for: #SHTextStylerST80 to: {self green}; + set: #blockEnd1 for: #SHTextStylerST80 to: {self green}; + set: #blockStart2 for: #SHTextStylerST80 to: {self magenta}; + set: #blockEnd2 for: #SHTextStylerST80 to: {self magenta}; + set: #blockStart3 for: #SHTextStylerST80 to: {self red}; + set: #blockEnd3 for: #SHTextStylerST80 to: {self red}; + set: #blockStart4 for: #SHTextStylerST80 to: {self green}; + set: #blockEnd4 for: #SHTextStylerST80 to: {self green}; + set: #blockStart5 for: #SHTextStylerST80 to: {self orange}; + set: #blockEnd5 for: #SHTextStylerST80 to: {self orange}; + set: #blockStart6 for: #SHTextStylerST80 to: {self magenta}; + set: #blockEnd6 for: #SHTextStylerST80 to: {self magenta}; + set: #blockStart7 for: #SHTextStylerST80 to: {self blue}; + set: #blockEnd7 for: #SHTextStylerST80 to: {self blue}; + set: #arrayStart for: #SHTextStylerST80 to: {self foregroundColor}; + set: #arrayEnd for: #SHTextStylerST80 to: {self foregroundColor}; + set: #arrayStart1 for: #SHTextStylerST80 to: {self foregroundColor}; + set: #arrayEnd1 for: #SHTextStylerST80 to: {self foregroundColor}; + set: #byteArrayStart for: #SHTextStylerST80 to: {self foregroundColor}; + set: #byteArrayEnd for: #SHTextStylerST80 to: {self foregroundColor}; + set: #byteArrayStart1 for: #SHTextStylerST80 to: {self foregroundColor}; + set: #byteArrayEnd1 for: #SHTextStylerST80 to: {self foregroundColor}; + set: #leftBrace for: #SHTextStylerST80 to: {self foregroundColor}; + set: #rightBrace for: #SHTextStylerST80 to: {self foregroundColor}; + set: #cascadeSeparator for: #SHTextStylerST80 to: {self foregroundColor}; + set: #statementSeparator for: #SHTextStylerST80 to: {self foregroundColor}; + set: #externalCallType for: #SHTextStylerST80 to: {self foregroundColor}; + set: #externalCallTypePointerIndicator for: #SHTextStylerST80 to: {self foregroundColor}; + set: #primitiveOrExternalCallStart for: #SHTextStylerST80 to: {self foregroundColor}; + set: #primitiveOrExternalCallEnd for: #SHTextStylerST80 to: {self foregroundColor}; + set: #methodTempBar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockTempBar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockArgsBar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #primitive for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #pragmaKeyword for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #pragmaUnary for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #pragmaBinary for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #externalFunctionCallingConvention for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #module for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; + set: #blockTempVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #blockPatternTempVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #instVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #workspaceVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #undefinedIdentifier for: #SHTextStylerST80 to: {self red}; + set: #incompleteIdentifier for: #SHTextStylerST80 to: {self foregroundColor. {TextEmphasis italic. TextEmphasis underlined}}; + set: #tempVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #patternTempVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #poolConstant for: #SHTextStylerST80 to: {self foregroundColor}; + set: #classVar for: #SHTextStylerST80 to: {self foregroundColor}; + set: #globalVar for: #SHTextStylerST80 to: {self foregroundColor}. + + "And the text differ" + theme + set: #insertTextAttributes for: #TextDiffBuilder to: { TextColor color: self red }; + set: #removeTextAttributes for: #TextDiffBuilder to: { TextEmphasis struckOut. TextColor color: self blue }; + set: #normalTextAttributes for: #TextDiffBuilder to: { TextEmphasis normal }. \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/addToolColors..st b/repository/Python-Support.package/PythonTheme.class/class/addToolColors..st new file mode 100644 index 00000000..4f2a299c --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/addToolColors..st @@ -0,0 +1,21 @@ +instance creation +addToolColors: theme + "Tool-specific colors." + + "SUnit's TestRunner." + theme + set: #failureColor for: #TestRunner to: self yellow; + set: #errorColor for: #TestRunner to: self red; + set: #passColor for: #TestRunner to: self green; + + derive: #failureTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor; + derive: #errorTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor; + derive: #passTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor. + + "Monticello Tools." + theme + set: #revertedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis struckOut}; + set: #ignoredOperationAttributes for: #MCOperationsBrowser to: {TextColor color: Color gray}. + "set: #rejectedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis struckOut}; + set: #acceptedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis underlined}; + set: #conflictingOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis bold}." \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/addWindowColors..st b/repository/Python-Support.package/PythonTheme.class/class/addWindowColors..st new file mode 100644 index 00000000..a2546d93 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/addWindowColors..st @@ -0,0 +1,42 @@ +instance creation +addWindowColors: theme + "self create apply" + theme + set: #titleFont for: #SystemWindow to: [Preferences windowTitleFont]; + set: #borderColorModifier for: #SystemWindow to: [ [:c | c adjustBrightness: -0.2] ]; + set: #borderWidth for: #SystemWindow to: 0; + + set: #uniformWindowColor for: #Model to: self windowColor; + derive: #uniformWindowColor for: #TranscriptStream from: #Model; + derive: #color for: #SystemWindow from: #Model at: #uniformWindowColor; "Fall back for windows without models." + + set: #unfocusedWindowColorModifier for: #SystemWindow to: [ [:color | color darker] ]; + set: #unfocusedLabelColor for: #SystemWindow to: self unfocusedLabelColor; + set: #focusedLabelColor for: #SystemWindow to: self focusedLabelColor; + + set: #customWindowColor for: #Browser to: (Color r: 0.764 g: 0.9 b: 0.63); + set: #customWindowColor for: #ChangeList to: (Color r: 0.719 g: 0.9 b: 0.9); + set: #customWindowColor for: #ChangeSorter to: (Color r: 0.719 g: 0.9 b: 0.9); + set: #customWindowColor for: #ChatNotes to: (Color r: 1.0 g: 0.7 b: 0.8); + set: #customWindowColor for: #ClassCommentVersionsBrowser to: (Color r: 0.753 g: 0.677 b: 0.9); + set: #customWindowColor for: #Debugger to: (Color r: 0.9 g: 0.719 b: 0.719); + set: #customWindowColor for: #DualChangeSorter to: (Color r: 0.719 g: 0.9 b: 0.9); + set: #customWindowColor for: #FileContentsBrowser to: (Color r: 0.7 g: 0.7 b: 0.508); + set: #customWindowColor for: #FileList to: (Color r: 0.65 g: 0.65 b: 0.65); + set: #customWindowColor for: #InstanceBrowser to: (Color r: 0.726 g: 0.9 b: 0.9); + set: #customWindowColor for: #Lexicon to: (Color r: 0.79 g: 0.9 b: 0.79); + set: #customWindowColor for: #MCTool to: (Color r: 0.65 g: 0.691 b: 0.876); + set: #customWindowColor for: #MessageNames to: (Color r: 0.639 g: 0.9 b: 0.497); + set: #customWindowColor for: #MessageSet to: (Color r: 0.719 g: 0.9 b: 0.9); + set: #customWindowColor for: #PackagePaneBrowser to: (Color r: 0.9 g: 0.9 b: 0.63); + set: #customWindowColor for: #PluggableFileList to: Color lightYellow; + set: #customWindowColor for: #PreferenceBrowser to: (Color r: 0.671 g: 0.9 b: 0.9); + set: #customWindowColor for: #SMLoader to: (Color r: 0.801 g: 0.801 b: 0.614); + set: #customWindowColor for: #SMLoaderPlus to: (Color r: 0.801 g: 0.801 b: 0.614); + set: #customWindowColor for: #SMReleaseBrowser to: (Color r: 0.801 g: 0.801 b: 0.614); + set: #customWindowColor for: #ScriptingDomain to: (Color r: 0.91 g: 0.91 b: 0.91); + set: #customWindowColor for: #SelectorBrowser to: (Color r: 0.45 g: 0.9 b: 0.9); + set: #customWindowColor for: #StringHolder to: (Color r: 0.9 g: 0.9 b: 0.719); + set: #customWindowColor for: #TestRunner to: (Color r: 0.9 g: 0.576 b: 0.09); + set: #customWindowColor for: #TranscriptStream to: (Color r: 0.9 g: 0.75 b: 0.45); + set: #customWindowColor for: #VersionsBrowser to: (Color r: 0.782 g: 0.677 b: 0.9). \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/argumentColor.st b/repository/Python-Support.package/PythonTheme.class/class/argumentColor.st new file mode 100644 index 00000000..d27e34d2 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/argumentColor.st @@ -0,0 +1,4 @@ +monokai +argumentColor + + ^ Color fromString: '#FD971F' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/backgroundColor.st b/repository/Python-Support.package/PythonTheme.class/class/backgroundColor.st new file mode 100644 index 00000000..1816569b --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/backgroundColor.st @@ -0,0 +1,3 @@ +colors +backgroundColor + ^ Color fromString: '#2e2e2e' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/backgroundForm.st b/repository/Python-Support.package/PythonTheme.class/class/backgroundForm.st new file mode 100644 index 00000000..c74e0cab --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/backgroundForm.st @@ -0,0 +1,4 @@ +helpers +backgroundForm + + ^ (Form extent: 10@10 depth: 32) collectColors: [:c | self backgroundColor] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/blue.st b/repository/Python-Support.package/PythonTheme.class/class/blue.st new file mode 100644 index 00000000..06beb404 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/blue.st @@ -0,0 +1,4 @@ +monokai +blue + + ^ self globalColor \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/builtinConstColor.st b/repository/Python-Support.package/PythonTheme.class/class/builtinConstColor.st new file mode 100644 index 00000000..b0e68d70 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/builtinConstColor.st @@ -0,0 +1,3 @@ +colors +builtinConstColor + ^ self numberColor \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/commentColor.st b/repository/Python-Support.package/PythonTheme.class/class/commentColor.st new file mode 100644 index 00000000..f9d496e9 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/commentColor.st @@ -0,0 +1,4 @@ +monokai +commentColor + + ^ Color fromString: '#75715E' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/create.st b/repository/Python-Support.package/PythonTheme.class/class/create.st new file mode 100644 index 00000000..4fa1a566 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/create.st @@ -0,0 +1,27 @@ +instance creation +create + "self create apply." + + ^ (self named: 'Python') in: [:theme | + "General morph stuff." + theme + set: #keyboardFocusColor for: #Morph to: self highlightColor; + set: #keyboardFocusWidth for: #Morph to: 1; + set: #softShadowColor for: #Morph to: (Color black alpha: 0.01); + set: #softShadowOffset for: #Morph to: (10@8 corner: 10@12); + set: #hardShadowColor for: #Morph to: (Color black alpha: 0.5); + set: #hardShadowOffset for: #Morph to: 1@1. + + theme set: #background for: #MorphicProject to: self backgroundForm. + + self + addFonts: theme; + addWindowColors: theme; + addSyntaxHighlighting: theme; + addMenusAndDockingBars: theme; + addDialogs: theme; + addButtons: theme; + addScrollables: theme; + addToolColors: theme. + + theme] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/focusedLabelColor.st b/repository/Python-Support.package/PythonTheme.class/class/focusedLabelColor.st new file mode 100644 index 00000000..2d805d08 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/focusedLabelColor.st @@ -0,0 +1,3 @@ +colors +focusedLabelColor + ^ self textColor \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/foregroundColor.st b/repository/Python-Support.package/PythonTheme.class/class/foregroundColor.st new file mode 100644 index 00000000..d47441d4 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/foregroundColor.st @@ -0,0 +1,4 @@ +monokai +foregroundColor + + ^ Color fromString: '#F8F8F2' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/globalColor.st b/repository/Python-Support.package/PythonTheme.class/class/globalColor.st new file mode 100644 index 00000000..273d0edc --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/globalColor.st @@ -0,0 +1,5 @@ +monokai +globalColor + "library function, library constant, library class type, ..." + + ^ Color fromString: '#66D9EF' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/green.st b/repository/Python-Support.package/PythonTheme.class/class/green.st new file mode 100644 index 00000000..0e0f4d71 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/green.st @@ -0,0 +1,3 @@ +colors +green + ^ Color fromString: '#A6E22E' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/highlightColor.st b/repository/Python-Support.package/PythonTheme.class/class/highlightColor.st new file mode 100644 index 00000000..1470de49 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/highlightColor.st @@ -0,0 +1,3 @@ +colors +highlightColor + ^ Color fromString: '#6c98bc' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/initialize.st b/repository/Python-Support.package/PythonTheme.class/class/initialize.st new file mode 100644 index 00000000..7094e078 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/initialize.st @@ -0,0 +1,4 @@ +instance creation +initialize + super initialize. + self create \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/keywordColor.st b/repository/Python-Support.package/PythonTheme.class/class/keywordColor.st new file mode 100644 index 00000000..701ac7db --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/keywordColor.st @@ -0,0 +1,5 @@ +monokai +keywordColor + "tag name, invalid background, ..." + + ^ Color fromString: '#F92672' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/magenta.st b/repository/Python-Support.package/PythonTheme.class/class/magenta.st new file mode 100644 index 00000000..acf0463e --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/magenta.st @@ -0,0 +1,4 @@ +monokai +magenta + + ^ self keywordColor \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/numberColor.st b/repository/Python-Support.package/PythonTheme.class/class/numberColor.st new file mode 100644 index 00000000..01455b39 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/numberColor.st @@ -0,0 +1,6 @@ +monokai +numberColor + "Constant, invalid deprecated background, ..." + "purple" + + ^ Color fromString: '#AE81FF' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/orange.st b/repository/Python-Support.package/PythonTheme.class/class/orange.st new file mode 100644 index 00000000..fba82a04 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/orange.st @@ -0,0 +1,4 @@ +monokai +orange + + ^ self argumentColor \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/red.st b/repository/Python-Support.package/PythonTheme.class/class/red.st new file mode 100644 index 00000000..5d595521 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/red.st @@ -0,0 +1,3 @@ +colors +red + ^ Color fromString: '#dc322f' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/stringColor.st b/repository/Python-Support.package/PythonTheme.class/class/stringColor.st new file mode 100644 index 00000000..5607b46a --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/stringColor.st @@ -0,0 +1,3 @@ +colors +stringColor + ^ Color fromString: '#e5b567' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/textColor.st b/repository/Python-Support.package/PythonTheme.class/class/textColor.st new file mode 100644 index 00000000..3b3c57d4 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/textColor.st @@ -0,0 +1,3 @@ +colors +textColor + ^ Color fromString: '#e8e8e8' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/textSelectionColor.st b/repository/Python-Support.package/PythonTheme.class/class/textSelectionColor.st new file mode 100644 index 00000000..aad60f29 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/textSelectionColor.st @@ -0,0 +1,3 @@ +colors +textSelectionColor + ^ Color fromString: '#5a637f' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/unfocusedLabelColor.st b/repository/Python-Support.package/PythonTheme.class/class/unfocusedLabelColor.st new file mode 100644 index 00000000..3f05d9a6 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/unfocusedLabelColor.st @@ -0,0 +1,3 @@ +colors +unfocusedLabelColor + ^ Color fromString: '#747474' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/variableColor.st b/repository/Python-Support.package/PythonTheme.class/class/variableColor.st new file mode 100644 index 00000000..f360681d --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/variableColor.st @@ -0,0 +1,3 @@ +colors +variableColor + ^ Color fromString: '#E87D3E' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/windowColor.st b/repository/Python-Support.package/PythonTheme.class/class/windowColor.st new file mode 100644 index 00000000..244d2d1f --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/windowColor.st @@ -0,0 +1,3 @@ +colors +windowColor + ^ Color fromString: '#1e1e1e' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/yellow.st b/repository/Python-Support.package/PythonTheme.class/class/yellow.st new file mode 100644 index 00000000..154f2107 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/class/yellow.st @@ -0,0 +1,3 @@ +colors +yellow + ^ Color fromString: '#b58900' \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/instance/stylerClass.st b/repository/Python-Support.package/PythonTheme.class/instance/stylerClass.st new file mode 100644 index 00000000..15df1ae0 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/instance/stylerClass.st @@ -0,0 +1,3 @@ +as yet unclassified +stylerClass + ^ PythonTextStyler \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/methodProperties.json b/repository/Python-Support.package/PythonTheme.class/methodProperties.json new file mode 100644 index 00000000..52128ccb --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/methodProperties.json @@ -0,0 +1,37 @@ +{ + "class" : { + "addButtons:" : "fn 3/6/2017 18:12", + "addDialogs:" : "fn 2/21/2017 18:33", + "addFonts:" : "fn 2/10/2017 10:26", + "addMenusAndDockingBars:" : "fn 2/10/2017 14:23", + "addScrollables:" : "fn 2/10/2017 12:28", + "addSyntaxHighlighting:" : "fn 2/10/2017 14:03", + "addToolColors:" : "fn 2/10/2017 11:58", + "addWindowColors:" : "fn 2/10/2017 11:59", + "argumentColor" : "fn 2/10/2017 14:04", + "backgroundColor" : "fn 2/10/2017 11:00", + "backgroundForm" : "fn 2/10/2017 11:02", + "blue" : "fn 2/10/2017 14:03", + "builtinConstColor" : "fn 2/10/2017 10:59", + "commentColor" : "fn 2/10/2017 14:02", + "create" : "fn 2/10/2017 11:51", + "focusedLabelColor" : "fn 2/10/2017 11:18", + "foregroundColor" : "fn 2/10/2017 14:02", + "globalColor" : "fn 2/10/2017 14:02", + "green" : "fn 2/10/2017 11:57", + "highlightColor" : "fn 2/10/2017 11:32", + "initialize" : "fn 3/6/2017 22:13", + "keywordColor" : "fn 2/10/2017 14:03", + "magenta" : "fn 2/10/2017 14:03", + "numberColor" : "fn 2/10/2017 14:02", + "orange" : "fn 2/10/2017 14:04", + "red" : "fn 2/10/2017 11:58", + "stringColor" : "fn 2/10/2017 10:58", + "textColor" : "fn 2/10/2017 11:18", + "textSelectionColor" : "fn 2/10/2017 11:35", + "unfocusedLabelColor" : "fn 2/10/2017 11:10", + "variableColor" : "fn 2/10/2017 10:59", + "windowColor" : "fn 2/10/2017 11:02", + "yellow" : "fn 2/10/2017 11:58" }, + "instance" : { + "stylerClass" : "fn 3/6/2017 11:02" } } diff --git a/repository/Python-Support.package/PythonTheme.class/properties.json b/repository/Python-Support.package/PythonTheme.class/properties.json new file mode 100644 index 00000000..4f2987b6 --- /dev/null +++ b/repository/Python-Support.package/PythonTheme.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonTheme", + "pools" : [ + ], + "super" : "UserInterfaceTheme", + "type" : "normal" } diff --git a/repository/Python-Support.package/PythonToolBuilder.class/README.md b/repository/Python-Support.package/PythonToolBuilder.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonToolBuilder.class/class/initialize.st b/repository/Python-Support.package/PythonToolBuilder.class/class/initialize.st new file mode 100644 index 00000000..b3604724 --- /dev/null +++ b/repository/Python-Support.package/PythonToolBuilder.class/class/initialize.st @@ -0,0 +1,4 @@ +as yet unclassified +initialize + super initialize. + "UIManager default builderClass: self" \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/instance/codePaneClass.st b/repository/Python-Support.package/PythonToolBuilder.class/instance/codePaneClass.st new file mode 100644 index 00000000..54b91e6c --- /dev/null +++ b/repository/Python-Support.package/PythonToolBuilder.class/instance/codePaneClass.st @@ -0,0 +1,3 @@ +as yet unclassified +codePaneClass + ^ PythonPluggableTextMorphPlus \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableCodePaneSpec.st b/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableCodePaneSpec.st new file mode 100644 index 00000000..755ddb42 --- /dev/null +++ b/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableCodePaneSpec.st @@ -0,0 +1,3 @@ +as yet unclassified +pluggableCodePaneSpec + ^ PythonPluggableCodePaneSpec \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableTextSpec.st b/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableTextSpec.st new file mode 100644 index 00000000..b247f70c --- /dev/null +++ b/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableTextSpec.st @@ -0,0 +1,3 @@ +as yet unclassified +pluggableTextSpec + ^ PythonPluggableTextSpec \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/instance/textPaneClass.st b/repository/Python-Support.package/PythonToolBuilder.class/instance/textPaneClass.st new file mode 100644 index 00000000..934e70f2 --- /dev/null +++ b/repository/Python-Support.package/PythonToolBuilder.class/instance/textPaneClass.st @@ -0,0 +1,3 @@ +as yet unclassified +textPaneClass + ^ PythonPluggableTextMorphPlus \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/methodProperties.json b/repository/Python-Support.package/PythonToolBuilder.class/methodProperties.json new file mode 100644 index 00000000..9744af16 --- /dev/null +++ b/repository/Python-Support.package/PythonToolBuilder.class/methodProperties.json @@ -0,0 +1,8 @@ +{ + "class" : { + "initialize" : "fn 3/7/2017 13:29" }, + "instance" : { + "codePaneClass" : "fn 3/6/2017 17:03", + "pluggableCodePaneSpec" : "fn 3/6/2017 11:23", + "pluggableTextSpec" : "fn 3/6/2017 14:48", + "textPaneClass" : "fn 3/6/2017 17:04" } } diff --git a/repository/Python-Support.package/PythonToolBuilder.class/properties.json b/repository/Python-Support.package/PythonToolBuilder.class/properties.json new file mode 100644 index 00000000..811eae81 --- /dev/null +++ b/repository/Python-Support.package/PythonToolBuilder.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonToolBuilder", + "pools" : [ + ], + "super" : "MorphicToolBuilder", + "type" : "normal" } diff --git a/repository/Python-Support.package/ToolIcons.extension/class/python.st b/repository/Python-Support.package/ToolIcons.extension/class/python.st new file mode 100644 index 00000000..ccba73ec --- /dev/null +++ b/repository/Python-Support.package/ToolIcons.extension/class/python.st @@ -0,0 +1,8 @@ +*Python-Support +python + + ^ Form + extent: 12@12 + depth: 32 + fromArray: #( 16711422 16711422 16777215 552005365 2223813585 2860230601 2893653189 2307632842 468316147 16777215 16711422 16711422 16711422 16777215 16777215 3179457998 4284585663 4280774568 4279657118 4278209419 3311636659 16777215 16777215 16711422 16777215 16777215 16777215 2359213526 3330451912 3379534783 4181489833 4279984022 3779886758 16711679 16711679 16711679 50200061 2409151447 3194592453 3211697859 3160380090 3244791225 4181620646 4279786389 3461250730 2717839523 3003051662 402323952 1756679906 4279330215 4280775083 4280971431 4279787935 4279196056 4279983767 4278208141 3292493491 3841978490 4294959397 2465851810 2894245070 4280577963 4282219691 4230573743 3293611196 3260582326 3276702131 3124458934 2947398308 3925864805 4294958141 3388793206 2877336266 4280117412 4079513007 3013128110 3019831440 3254776464 3237998225 3221221259 4093636449 4294958672 4294956854 3489520742 1890174168 4278208397 4012074928 3103714195 4294966360 4294961761 4294960716 4294959680 4294957887 4294956339 4294952960 2532958346 183957753 2959907004 3059321790 3203720595 4294962009 4294893921 3455836793 3288063596 3355237740 3472677468 3137001573 402323434 16777215 16777215 16777215 3187468170 4294958402 4294892883 3506167148 3355173248 2969165441 16383231 16646143 16711679 16711422 16777215 16777215 2717574803 4294955030 4294955814 4294954776 4294957661 3623476346 16580351 16777215 16711422 16711422 16711422 16711679 268171762 2214127001 3204242276 3271284829 2381962882 486143719 16711679 16711422 16711422) + offset: 0@0 \ No newline at end of file diff --git a/repository/Python-Support.package/ToolIcons.extension/methodProperties.json b/repository/Python-Support.package/ToolIcons.extension/methodProperties.json new file mode 100644 index 00000000..8b674499 --- /dev/null +++ b/repository/Python-Support.package/ToolIcons.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + "python" : "fn 3/7/2017 11:53" }, + "instance" : { + } } diff --git a/repository/Python-Support.package/ToolIcons.extension/properties.json b/repository/Python-Support.package/ToolIcons.extension/properties.json new file mode 100644 index 00000000..09fddafd --- /dev/null +++ b/repository/Python-Support.package/ToolIcons.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "ToolIcons" } diff --git a/repository/Python-Support.package/monticello.meta/categories.st b/repository/Python-Support.package/monticello.meta/categories.st new file mode 100644 index 00000000..79fed287 --- /dev/null +++ b/repository/Python-Support.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'Python-Support'! diff --git a/repository/Python-Support.package/monticello.meta/initializers.st b/repository/Python-Support.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/monticello.meta/package b/repository/Python-Support.package/monticello.meta/package new file mode 100644 index 00000000..1b10b7b6 --- /dev/null +++ b/repository/Python-Support.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'Python-Support') \ No newline at end of file diff --git a/repository/Python-Support.package/monticello.meta/version b/repository/Python-Support.package/monticello.meta/version new file mode 100644 index 00000000..c900a41e --- /dev/null +++ b/repository/Python-Support.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'Python-Support-fn.4' message 'Subclass SmalltalkEditor and TextMorphForEditView in order to be able to override more methods for Python support' id '51fa2773-8f66-4c87-addd-63154eea2da4' date '7 March 2017' time '6:17:46.751045 pm' author 'fn' ancestors ((name 'Python-Support-fn.3' message 'Bugfixes and improvements' id '4be9a02d-4982-447a-903e-e713baea85eb' date '7 March 2017' time '2:35:26.793869 pm' author 'fn' ancestors ((name 'Python-Support-fn.2' message 'Cleanups' id '43742c0b-6a9b-4827-a079-7202613e72c3' date '7 March 2017' time '12:46:02.428302 pm' author 'fn' ancestors ((name 'Python-Support-fn.1' message 'Initial commit' id 'fcd0af1c-1b0a-4cf5-be6c-b6ebab6bcfc6' date '6 March 2017' time '9:43:26.501112 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Support.package/properties.json b/repository/Python-Support.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/Python-Support.package/properties.json @@ -0,0 +1,2 @@ +{ + } diff --git a/repository/Python-Tests.package/.filetree b/repository/Python-Tests.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/Python-Tests.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/Python-Tests.package/PythonDebuggerTest.class/README.md b/repository/Python-Tests.package/PythonDebuggerTest.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st b/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st new file mode 100644 index 00000000..bb82dd07 --- /dev/null +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st @@ -0,0 +1,20 @@ +as yet unclassified +testScopeEndInStartingAt + | d input | + d := PythonDebugger. + input := ' +a = 2 +def foo(): + x = 24 + def bar(): + return "bar" + return "%s, %s" % (x, bar()) +b = 4 +x = b * a'. + self assert: 9 equals: (d scopeEndIn: input startingAt: 1). + self assert: 9 equals: (d scopeEndIn: input startingAt: 2). + self assert: 7 equals: (d scopeEndIn: input startingAt: 3). + self assert: 7 equals: (d scopeEndIn: input startingAt: 4). + self assert: 6 equals: (d scopeEndIn: input startingAt: 5). + self assert: 7 equals: (d scopeEndIn: input startingAt: 6). + self assert: 9 equals: (d scopeEndIn: input startingAt: 8). \ No newline at end of file diff --git a/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json b/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json new file mode 100644 index 00000000..31f107b7 --- /dev/null +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "testScopeEndInStartingAt" : "fn 2/1/2017 22:43" } } diff --git a/repository/Python-Tests.package/PythonDebuggerTest.class/properties.json b/repository/Python-Tests.package/PythonDebuggerTest.class/properties.json new file mode 100644 index 00000000..331dd393 --- /dev/null +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tests", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonDebuggerTest", + "pools" : [ + ], + "super" : "TestCase", + "type" : "normal" } diff --git a/repository/Python-Tests.package/PythonTest.class/README.md b/repository/Python-Tests.package/PythonTest.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tests.package/PythonTest.class/instance/testIsExpression.st b/repository/Python-Tests.package/PythonTest.class/instance/testIsExpression.st new file mode 100644 index 00000000..031b5f8d --- /dev/null +++ b/repository/Python-Tests.package/PythonTest.class/instance/testIsExpression.st @@ -0,0 +1,10 @@ +testing +testIsExpression + self assert: (Python isExpression: '1'). + self assert: (Python isExpression: 'foo()'). + self deny: (Python isExpression: 'x = 1'). + self assert: (Python isExpression: '1 == 1'). + self deny: (Python isExpression: 'def foo(): + return 42'). + self deny: (Python isExpression: 'def foo(): pass'). + self deny: (Python isExpression: 'import os') \ No newline at end of file diff --git a/repository/Python-Tests.package/PythonTest.class/methodProperties.json b/repository/Python-Tests.package/PythonTest.class/methodProperties.json new file mode 100644 index 00000000..05272ef9 --- /dev/null +++ b/repository/Python-Tests.package/PythonTest.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "testIsExpression" : "fn 2/23/2017 21:37" } } diff --git a/repository/Python-Tests.package/PythonTest.class/properties.json b/repository/Python-Tests.package/PythonTest.class/properties.json new file mode 100644 index 00000000..30d5525f --- /dev/null +++ b/repository/Python-Tests.package/PythonTest.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tests", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonTest", + "pools" : [ + ], + "super" : "TestCase", + "type" : "normal" } diff --git a/repository/Python-Tests.package/monticello.meta/categories.st b/repository/Python-Tests.package/monticello.meta/categories.st new file mode 100644 index 00000000..ee09c458 --- /dev/null +++ b/repository/Python-Tests.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'Python-Tests'! diff --git a/repository/Python-Tests.package/monticello.meta/initializers.st b/repository/Python-Tests.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tests.package/monticello.meta/package b/repository/Python-Tests.package/monticello.meta/package new file mode 100644 index 00000000..9d3a0e7f --- /dev/null +++ b/repository/Python-Tests.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'Python-Tests') \ No newline at end of file diff --git a/repository/Python-Tests.package/monticello.meta/version b/repository/Python-Tests.package/monticello.meta/version new file mode 100644 index 00000000..8ec4948a --- /dev/null +++ b/repository/Python-Tests.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'Python-Tests-fn.1' message 'Initial commit' id 'c3c0a7f2-bf15-4217-a468-c5aa7dcac35d' date '6 March 2017' time '9:43:34.293217 pm' author 'fn' ancestors () stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Tests.package/properties.json b/repository/Python-Tests.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/Python-Tests.package/properties.json @@ -0,0 +1,2 @@ +{ + } diff --git a/repository/Python-Tools.package/.filetree b/repository/Python-Tools.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/Python-Tools.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/Python-Tools.package/Model.extension/instance/hasPyCodeSelected.st b/repository/Python-Tools.package/Model.extension/instance/hasPyCodeSelected.st new file mode 100644 index 00000000..f2c5f44a --- /dev/null +++ b/repository/Python-Tools.package/Model.extension/instance/hasPyCodeSelected.st @@ -0,0 +1,3 @@ +*Python-Tools +hasPyCodeSelected + ^ false \ No newline at end of file diff --git a/repository/Python-Tools.package/Model.extension/methodProperties.json b/repository/Python-Tools.package/Model.extension/methodProperties.json new file mode 100644 index 00000000..71d83f96 --- /dev/null +++ b/repository/Python-Tools.package/Model.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "hasPyCodeSelected" : "fn 3/7/2017 14:30" } } diff --git a/repository/Python-Tools.package/Model.extension/properties.json b/repository/Python-Tools.package/Model.extension/properties.json new file mode 100644 index 00000000..b2050178 --- /dev/null +++ b/repository/Python-Tools.package/Model.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "Model" } diff --git a/repository/Python-Tools.package/PythonBrowser.class/README.md b/repository/Python-Tools.package/PythonBrowser.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st b/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st new file mode 100644 index 00000000..f8c5afd0 --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st @@ -0,0 +1,13 @@ +overrides +aboutToStyle: aStyler + "This is a notification that aStyler is about to re-style its text. + Set the classOrMetaClass in aStyler, so that identifiers + will be resolved correctly. + Answer true to allow styling to proceed, or false to veto the styling" + | type | + Python vmSpeaksPython ifFalse: [ ^ super aboutToStyle: aStyler ]. + self isModeStyleable ifFalse: [^false]. + type := self editSelection. + (#(newClass editClass) includes: type) ifTrue: [^false]. + (#(newMessage editMessage) includes: type) ifFalse:[ ^false]. + ^true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st b/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st new file mode 100644 index 00000000..8d5ca7ca --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st @@ -0,0 +1,27 @@ +overrides +buildCodePaneWith: builder + | textSpec top buttonSpec annoSpec | + self wantsOptionalButtons ifTrue: [ + top := builder pluggablePanelSpec new. + top children: OrderedCollection new. + buttonSpec := self buildOptionalButtonsWith: builder. + buttonSpec frame: self optionalButtonsFrame. + top children add: buttonSpec]. + textSpec := PythonPluggableCodePaneSpec new. + textSpec + model: self; + getText: #contents; + setText: #contents:notifying:; + selection: #contentsSelection; + menu: #codePaneMenu:shifted:. + self wantsAnnotationPane ifTrue: [ + top ifNil: [ + top := builder pluggablePanelSpec new. + top children: OrderedCollection new]. + annoSpec := self buildAnnotationPaneWith: builder. + annoSpec frame: self annotationFrame. + top children add: annoSpec]. + top ifNotNil: [ + textSpec frame: self textFrame. + top children add: textSpec]. + ^top ifNil: [textSpec] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/defaultBrowserTitle.st b/repository/Python-Tools.package/PythonBrowser.class/instance/defaultBrowserTitle.st new file mode 100644 index 00000000..2e6899b4 --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/defaultBrowserTitle.st @@ -0,0 +1,3 @@ +overrides +defaultBrowserTitle + ^ 'Python Browser' \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/defineMessageFrom.notifying..st b/repository/Python-Tools.package/PythonBrowser.class/instance/defineMessageFrom.notifying..st new file mode 100644 index 00000000..b4f52b0f --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/defineMessageFrom.notifying..st @@ -0,0 +1,38 @@ +overrides +defineMessageFrom: aString notifying: aController + "Compile the expressions in aString. Notify aController if a syntax error occurs. Install the compiled method in the selected class classified under the currently selected message category name. Answer the selector obtained if compilation succeeds, nil otherwise." + | selectedMessageName selector category oldMessageList selectedClassOrMetaClass | + selectedMessageName := self selectedMessageName. + oldMessageList := self messageList. + selectedClassOrMetaClass := self selectedClassOrMetaClass. + selectedClassOrMetaClass isPython ifFalse: [ ^ super defineMessageFrom: aString notifying: aController ]. + contents := nil. + selector := (selectedClassOrMetaClass newParser parseSelector: aString). + (self metaClassIndicated + and: [(selectedClassOrMetaClass includesSelector: selector) not + and: [Metaclass isScarySelector: selector]]) + ifTrue: ["A frist-time definition overlaps the protocol of Metaclasses" + (self confirm: ((selector , ' is used in the existing class system. +Overriding it could cause serious problems. +Is this really what you want to do?') asText makeBoldFrom: 1 to: selector size)) + ifFalse: [^nil]]. + category := selectedMessageName + ifNil: [ self selectedMessageCategoryName ] + ifNotNil: [ (selectedClassOrMetaClass >> selectedMessageName) methodReference ifNotNil: [ : ref | ref category ]]. + selector := selectedClassOrMetaClass + pyCompile: aString + classified: category + notifying: aController. + selector == nil ifTrue: [^ nil]. + contents := aString copy. + selector ~~ selectedMessageName + ifTrue: + [category = ClassOrganizer nullCategory + ifTrue: [self changed: #classSelectionChanged. + self changed: #classList. + self messageCategoryListIndex: 1]. + self setClassOrganizer. "In case organization not cached" + (oldMessageList includes: selector) + ifFalse: [self changed: #messageList]. + self messageListIndex: (self messageList indexOf: selector)]. + ^ selector \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st b/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st new file mode 100644 index 00000000..645c085a --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st @@ -0,0 +1,7 @@ +helpers +hasPyCodeSelected + | class selector | + class := self selectedClassOrMetaClass. + selector := self selectedMessageName. + class isPython ifFalse: [^ false]. + ^ class pyMethodDict includesKey: selector \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/isPython.st b/repository/Python-Tools.package/PythonBrowser.class/instance/isPython.st new file mode 100644 index 00000000..5f13d9ba --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/isPython.st @@ -0,0 +1,3 @@ +overrides +isPython + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/selectedMessage.st b/repository/Python-Tools.package/PythonBrowser.class/instance/selectedMessage.st new file mode 100644 index 00000000..318c5b2e --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/selectedMessage.st @@ -0,0 +1,11 @@ +overrides +selectedMessage + "Answer a copy of the source code for the selected message." + + | class selector | + contents == nil ifFalse: [^ contents copy]. + + class := self selectedClassOrMetaClass. + selector := self selectedMessageName. + + ^ class sourceCodeAt: selector ifAbsent: [super selectedMessage]. \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/systemCategoryList.st b/repository/Python-Tools.package/PythonBrowser.class/instance/systemCategoryList.st new file mode 100644 index 00000000..412bf4c7 --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/systemCategoryList.st @@ -0,0 +1,5 @@ +overrides +systemCategoryList + "Answer the class categories modelled by the receiver." + + ^ super systemCategoryList select: [:ea | ea beginsWith: 'Python'] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/validateMessageSource.forSelector.inClass..st b/repository/Python-Tools.package/PythonBrowser.class/instance/validateMessageSource.forSelector.inClass..st new file mode 100644 index 00000000..d8d0ad23 --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/validateMessageSource.forSelector.inClass..st @@ -0,0 +1,6 @@ +overrides +validateMessageSource: sourceString forSelector: aSelector inClass: theClass + "Check whether there is evidence that method source is invalid" + self hasPyCodeSelected ifTrue: [^self]. + (theClass newParser parseSelector: sourceString asString) = aSelector + ifFalse: [self informPossiblyCorruptSource]. \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json b/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json new file mode 100644 index 00000000..9693e778 --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json @@ -0,0 +1,13 @@ +{ + "class" : { + }, + "instance" : { + "aboutToStyle:" : "fn 3/6/2017 19:45", + "buildCodePaneWith:" : "fn 3/6/2017 17:59", + "defaultBrowserTitle" : "fn 3/6/2017 18:00", + "defineMessageFrom:notifying:" : "fn 3/7/2017 11:42", + "hasPyCodeSelected" : "fn 3/7/2017 14:28", + "isPython" : "fn 3/7/2017 14:33", + "selectedMessage" : "fn 3/7/2017 11:31", + "systemCategoryList" : "fn 3/7/2017 11:35", + "validateMessageSource:forSelector:inClass:" : "fn 3/7/2017 14:30" } } diff --git a/repository/Python-Tools.package/PythonBrowser.class/properties.json b/repository/Python-Tools.package/PythonBrowser.class/properties.json new file mode 100644 index 00000000..e1df1f9a --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonBrowser", + "pools" : [ + ], + "super" : "Browser", + "type" : "normal" } diff --git a/repository/Python-Tools.package/PythonContextVariablesInspector.class/README.md b/repository/Python-Tools.package/PythonContextVariablesInspector.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tools.package/PythonContextVariablesInspector.class/instance/selection.st b/repository/Python-Tools.package/PythonContextVariablesInspector.class/instance/selection.st new file mode 100644 index 00000000..5473cb89 --- /dev/null +++ b/repository/Python-Tools.package/PythonContextVariablesInspector.class/instance/selection.st @@ -0,0 +1,8 @@ +overrides +selection + self object isPython ifFalse: [ ^ super selection ]. + selectionIndex = 0 ifTrue: [^ '']. + selectionIndex = 1 ifTrue: [^ object ]. + selectionIndex = 2 ifTrue: [^ object symbolic]. + selectionIndex = 3 ifTrue: [^ object headerDescription]. + ^ object pyFrame f_locals values at: selectionIndex - 3 \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonContextVariablesInspector.class/methodProperties.json b/repository/Python-Tools.package/PythonContextVariablesInspector.class/methodProperties.json new file mode 100644 index 00000000..b893d906 --- /dev/null +++ b/repository/Python-Tools.package/PythonContextVariablesInspector.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "selection" : "fn 2/26/2017 21:44" } } diff --git a/repository/Python-Tools.package/PythonContextVariablesInspector.class/properties.json b/repository/Python-Tools.package/PythonContextVariablesInspector.class/properties.json new file mode 100644 index 00000000..b83558bc --- /dev/null +++ b/repository/Python-Tools.package/PythonContextVariablesInspector.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonContextVariablesInspector", + "pools" : [ + ], + "super" : "ContextVariablesInspector", + "type" : "normal" } diff --git a/repository/Python-Tools.package/PythonDebugger.class/README.md b/repository/Python-Tools.package/PythonDebugger.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st b/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st new file mode 100644 index 00000000..4e1367da --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st @@ -0,0 +1,18 @@ +as yet unclassified +exploreFrames + | currentFrame result frameInfo | + currentFrame := Python primGetTopFrame. + result := OrderedCollection new. + [ currentFrame notNil ] whileTrue: [ + frameInfo := IdentityDictionary new + add: #f_lineno->(currentFrame f_lineno); + add: #co_name->(currentFrame f_code co_name); + add: #co_firstlineno->(currentFrame f_code co_firstlineno); + add: #co_filename->(currentFrame f_code co_filename); + add: #f_locals->(currentFrame f_locals __str__); + add: #f_globals->(currentFrame f_globals __str__); + yourself. + result add: frameInfo. + currentFrame := currentFrame f_back ]. + result explore + \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st b/repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st new file mode 100644 index 00000000..5a45bc50 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st @@ -0,0 +1,10 @@ +pysource +filterPySource: aString lineno: scopeStart + | lines indentSize end | + lines := aString lines. + lines size = 1 ifTrue: [ ^ aString ]. + end := self scopeEndIn: aString startingAt: scopeStart. + lines := lines copyFrom: scopeStart to: end. + indentSize := self indentSize: lines first. + lines := lines collect: [ :ea | ea copyFrom: indentSize + 1 to: ea size ]. + ^ lines joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st b/repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st new file mode 100644 index 00000000..cea9b9d8 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st @@ -0,0 +1,8 @@ +pysource +getContentsOf: aFileName + | stream data | + stream := StandardFileStream oldFileNamed: aFileName. + stream := MultiByteFileStream newFrom: stream. + data := stream contents. + stream close. + ^ data \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st b/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st new file mode 100644 index 00000000..6240afac --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st @@ -0,0 +1,9 @@ +pysource +getPySource: aContext + | pyCode filename contents | + pyCode := aContext pyFrame f_code. + filename := pyCode co_filename. + filename = '' ifTrue: [ ^ 'Unable to get source.' ]. + contents := self getContentsOf: pyCode co_filename asSmalltalk. + ^ self filterPySource: contents lineno: pyCode co_firstlineno asSmalltalk + \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st b/repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st new file mode 100644 index 00000000..28de70f5 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st @@ -0,0 +1,7 @@ +pysource +getSignature: pyCode + | filename content | + filename := pyCode co_filename asSmalltalk. + filename = '' ifTrue: [ ^ 'unknown' ]. + content := self getContentsOf: pyCode co_filename asSmalltalk. + ^ content lines at: pyCode co_firstlineno asSmalltalk \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st b/repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st new file mode 100644 index 00000000..9db8b9b0 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st @@ -0,0 +1,5 @@ +pysource +indent: aString by: aNumber + | indent | + indent := String new: aNumber withAll: Character space. + ^ (aString lines collect: [:ea | indent, ea]) joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st b/repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st new file mode 100644 index 00000000..70463b5f --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st @@ -0,0 +1,3 @@ +pysource +indentSize: aLine + ^ ((aLine findFirst: [:ea | ea isSeparator not]) - 1) max: 0 \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st b/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st new file mode 100644 index 00000000..679175d7 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st @@ -0,0 +1,7 @@ +as yet unclassified +newPyContext + ^ PythonMethodContext + sender: nil + receiver: PythonObject + method: (CompiledMethod newMethod: 2 header: 2) + arguments: #() \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st b/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st new file mode 100644 index 00000000..35dbc99f --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st @@ -0,0 +1,16 @@ +as yet unclassified +prependPythonContexts: aContext + | currentPyFrame newFrames | + currentPyFrame := Python primGetTopFrame. + currentPyFrame ifNil: [ ^ aContext ]. + newFrames := OrderedCollection new. + [ currentPyFrame notNil ] + whileTrue: [ | newCtx | + newCtx := self newPyContext. + newCtx pyFrame: currentPyFrame. + newFrames add: newCtx. + currentPyFrame := currentPyFrame f_back ]. + newFrames overlappingPairsDo: [ :a :b | + a sender: b ]. + newFrames last sender: aContext. + ^ newFrames first \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st b/repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st new file mode 100644 index 00000000..e2e9cb52 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st @@ -0,0 +1,10 @@ +pysource +replaceInPySource: oldContent content: aString lineno: aLineno + | lines end indentSize newLines | + lines := oldContent lines. + lines size <= 1 ifTrue: [ ^ aString ]. + end := self scopeEndIn: oldContent startingAt: aLineno. + indentSize := self indentSize: (lines at: aLineno). + newLines := (self indent: aString by: indentSize) lines. + lines := lines copyReplaceFrom: aLineno to: end with: newLines. + ^ lines joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st b/repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st new file mode 100644 index 00000000..f9c4d93c --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st @@ -0,0 +1,8 @@ +pysource +scopeEndIn: aString startingAt: aLineno + | lines currentIndentSize end | + lines := aString lines allButFirst: aLineno. + currentIndentSize := self indentSize: lines first. + end := lines allButFirst findFirst: [ :line | (self indentSize: line) < currentIndentSize ]. + end = 0 ifTrue: [ end := lines size ]. + ^ aLineno + end \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st b/repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st new file mode 100644 index 00000000..0b9cd3a1 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st @@ -0,0 +1,13 @@ +pysource +setPySourceContent: pyCode content: aString + | filename oldContents newContents stream | + filename := pyCode co_filename asSmalltalk. + stream := StandardFileStream readOnlyFileNamed: filename. + oldContents := stream contents. + stream close. + newContents := self replaceInPySource: oldContents content: aString lineno: pyCode co_firstlineno asSmalltalk. + stream := StandardFileStream forceNewFileNamed: filename. + stream := MultiByteFileStream newFrom: stream. + stream write: newContents. + stream close + \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st b/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st new file mode 100644 index 00000000..db87decf --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st @@ -0,0 +1,10 @@ +overrides +aboutToStyle: aStyler + "This is a notification that aStyler is about to re-style its text. + Set the classOrMetaClass in aStyler, so that identifiers + will be resolved correctly. + Answer true to allow styling to proceed, or false to veto the styling" + self hasPyContextSelected ifFalse: [ ^ super aboutToStyle: aStyler ]. + self isModeStyleable ifFalse: [^false]. + aStyler classOrMetaClass: self selectedClassOrMetaClass. + ^true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st b/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st new file mode 100644 index 00000000..7c5bab8a --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st @@ -0,0 +1,32 @@ +overrides +buildCodePaneWith: builder + + | textSpec top controlButtons browseButtons annoSpec | + top := builder pluggablePanelSpec new. + top children: OrderedCollection new. + + controlButtons := self buildControlButtonsWith: builder. + controlButtons frame: self controlButtonsFrame. + top children add: controlButtons. + + self wantsOptionalButtons ifTrue: [ + browseButtons := self buildOptionalButtonsWith: builder. + browseButtons frame: self optionalButtonsFrame. + top children add: browseButtons]. + + textSpec := PythonPluggableCodePaneSpec new. + textSpec + model: self; + getText: #contents; + setText: #contents:notifying:; + selection: #contentsSelection; + menu: #codePaneMenu:shifted:; + frame: self textFrame. + top children add: textSpec. + + self wantsAnnotationPane ifTrue: [ + annoSpec := self buildAnnotationPaneWith: builder. + annoSpec frame: self annotationFrame. + top children add: annoSpec]. + . + ^ top \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/contents.notifying..st b/repository/Python-Tools.package/PythonDebugger.class/instance/contents.notifying..st new file mode 100644 index 00000000..a5466138 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/contents.notifying..st @@ -0,0 +1,9 @@ +overrides +contents: aText notifying: aController + | ctx | + ctx := self selectedContext. + ctx isPython ifFalse: [^ super contents: aText notifying: aController]. + self class setPySourceContent: ctx pyFrame f_code content: aText asString. + Python restartFrame: ctx pyFrame with: aText asString withUnixLineEndings. + contents := aText. + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/contextForStack..st b/repository/Python-Tools.package/PythonDebugger.class/instance/contextForStack..st new file mode 100644 index 00000000..8fa17106 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/contextForStack..st @@ -0,0 +1,5 @@ +overrides +contextForStack: aContext + aContext method selector = #resumeFrame + ifFalse: [ ^ aContext ]. "Normal MethodContext" + ^ self class prependPythonContexts: aContext \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/expandStack.st b/repository/Python-Tools.package/PythonDebugger.class/instance/expandStack.st new file mode 100644 index 00000000..fab69b10 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/expandStack.st @@ -0,0 +1,7 @@ +overrides +expandStack + "A Notifier is being turned into a full debugger. Show a substantial amount of stack in the context pane." + + super expandStack. + receiverInspector := PythonInspector inspect: nil. + contextVariablesInspector := PythonContextVariablesInspector inspect: nil. \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/guessTypeForName..st b/repository/Python-Tools.package/PythonDebugger.class/instance/guessTypeForName..st new file mode 100644 index 00000000..3175749e --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/guessTypeForName..st @@ -0,0 +1,4 @@ +overrides +guessTypeForName: aString + self hasPyContextSelected ifFalse: [ ^ super guessTypeForName: aString ]. + ^ nil \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyCodeSelected.st b/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyCodeSelected.st new file mode 100644 index 00000000..84582888 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyCodeSelected.st @@ -0,0 +1,3 @@ +overrides +hasPyCodeSelected + ^ self hasPyContextSelected \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyContextSelected.st b/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyContextSelected.st new file mode 100644 index 00000000..29b183cf --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyContextSelected.st @@ -0,0 +1,3 @@ +overrides +hasPyContextSelected + ^ self selectedContext isPython \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/isPython.st b/repository/Python-Tools.package/PythonDebugger.class/instance/isPython.st new file mode 100644 index 00000000..5f13d9ba --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/isPython.st @@ -0,0 +1,3 @@ +overrides +isPython + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/messageIconAt..st b/repository/Python-Tools.package/PythonDebugger.class/instance/messageIconAt..st new file mode 100644 index 00000000..cd681744 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/messageIconAt..st @@ -0,0 +1,9 @@ +overrides +messageIconAt: anIndex + | context | + Browser showMessageIcons + ifFalse: [^ nil]. + context := contextStack at: anIndex. + context isPython + ifTrue: [ ^ ToolIcons iconNamed: #python ] + ifFalse: [ ^ super messageIconAt: anIndex ] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/pcRange.st b/repository/Python-Tools.package/PythonDebugger.class/instance/pcRange.st new file mode 100644 index 00000000..d4352cc8 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/pcRange.st @@ -0,0 +1,6 @@ +overrides +pcRange + "Answer the indices in the source code for the method corresponding to + the selected context's program counter value." + self hasPyContextSelected ifFalse: [ ^ super pcRange ]. + ^ self pyPCRange \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/process.controller.context..st b/repository/Python-Tools.package/PythonDebugger.class/instance/process.controller.context..st new file mode 100644 index 00000000..f45fa1b1 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/process.controller.context..st @@ -0,0 +1,16 @@ +overrides +process: aProcess controller: aController context: aContext + | contextForStack | + super initialize. + Smalltalk at: #MessageTally ifPresentAndInMemory: [ :tally | + tally terminateTimerProcess]. + contents := nil. + interruptedProcess := aProcess. + interruptedController := aController. + contextForStack := self contextForStack: aContext. + self newStack: (contextForStack stackOfSize: 1). + contextStackIndex := 1. + externalInterrupt := false. + selectingPC := true. + Smalltalk isMorphic ifTrue: + [errorWasInUIProcess := false] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/pyPCRange.st b/repository/Python-Tools.package/PythonDebugger.class/instance/pyPCRange.st new file mode 100644 index 00000000..fac9b7be --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/pyPCRange.st @@ -0,0 +1,10 @@ +overrides +pyPCRange + | pyFrame relativeLine lineCount | + pyFrame := self selectedContext pyFrame. + relativeLine := pyFrame f_lineno asSmalltalk - pyFrame f_code co_firstlineno asSmalltalk. + lineCount := 0. + (self class getPySource: self selectedContext) lineIndicesDo: [:start :endWithoutDelimiters :end | + (lineCount := lineCount + 1) = (relativeLine + 1) + ifTrue: [ ^ start to: end ]]. + ^1 to: 0 \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/selectedMessage.st b/repository/Python-Tools.package/PythonDebugger.class/instance/selectedMessage.st new file mode 100644 index 00000000..2e7b8478 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/selectedMessage.st @@ -0,0 +1,7 @@ +overrides +selectedMessage + "Answer the source code of the currently selected context." + | aContext | + aContext := self selectedContext. + aContext isPython ifFalse: [ ^ super selectedMessage ]. + ^ self class getPySource: aContext \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json b/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json new file mode 100644 index 00000000..1cc66c4b --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json @@ -0,0 +1,29 @@ +{ + "class" : { + "exploreFrames" : "fn 1/18/2017 17:34", + "filterPySource:lineno:" : "fn 2/2/2017 00:01", + "getContentsOf:" : "fn 2/1/2017 22:37", + "getPySource:" : "fn 3/6/2017 10:25", + "getSignature:" : "fn 3/6/2017 10:25", + "indent:by:" : "fn 2/1/2017 22:41", + "indentSize:" : "fn 2/1/2017 22:36", + "newPyContext" : "fn 3/7/2017 13:48", + "prependPythonContexts:" : "fn 3/6/2017 10:19", + "replaceInPySource:content:lineno:" : "fn 2/2/2017 00:05", + "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", + "setPySourceContent:content:" : "fn 3/6/2017 10:26" }, + "instance" : { + "aboutToStyle:" : "fn 3/7/2017 14:12", + "buildCodePaneWith:" : "fn 3/7/2017 14:17", + "contents:notifying:" : "fn 3/6/2017 19:17", + "contextForStack:" : "fn 2/21/2017 12:48", + "expandStack" : "fn 1/16/2017 21:03", + "guessTypeForName:" : "fn 3/7/2017 14:12", + "hasPyCodeSelected" : "fn 3/7/2017 14:31", + "hasPyContextSelected" : "fn 3/7/2017 14:12", + "isPython" : "fn 3/7/2017 14:32", + "messageIconAt:" : "fn 3/7/2017 16:35", + "pcRange" : "fn 3/7/2017 14:12", + "process:controller:context:" : "fn 1/16/2017 19:34", + "pyPCRange" : "fn 3/6/2017 10:26", + "selectedMessage" : "fn 3/6/2017 19:17" } } diff --git a/repository/Python-Tools.package/PythonDebugger.class/properties.json b/repository/Python-Tools.package/PythonDebugger.class/properties.json new file mode 100644 index 00000000..0f4008b7 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonDebugger", + "pools" : [ + ], + "super" : "Debugger", + "type" : "normal" } diff --git a/repository/Python-Tools.package/PythonInspector.class/README.md b/repository/Python-Tools.package/PythonInspector.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st b/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st new file mode 100644 index 00000000..b4aad9ee --- /dev/null +++ b/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st @@ -0,0 +1,13 @@ +overrides +buildCodePaneWith: builder + | textSpec | + textSpec := PythonPluggableCodePaneSpec new. + textSpec + model: self; + getText: #expression; + editText: #expression:; + help: #helpText; + selection: #contentsSelection; + menu: #codePaneMenu:shifted:; + askBeforeDiscardingEdits: false. + ^textSpec \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/contentsIsString.st b/repository/Python-Tools.package/PythonInspector.class/instance/contentsIsString.st new file mode 100644 index 00000000..12b6460e --- /dev/null +++ b/repository/Python-Tools.package/PythonInspector.class/instance/contentsIsString.st @@ -0,0 +1,5 @@ +overrides +contentsIsString + "Hacked so contents empty when deselected and = long printString when item 2" + + ^ selectionIndex = 0 \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/fieldList.st b/repository/Python-Tools.package/PythonInspector.class/instance/fieldList.st new file mode 100644 index 00000000..51edeae1 --- /dev/null +++ b/repository/Python-Tools.package/PythonInspector.class/instance/fieldList.st @@ -0,0 +1,8 @@ +overrides +fieldList + "Answer the base field list plus an abbreviated list of indices." + | keys | + keys := OrderedCollection new. + keys add: 'self'. + keys addAll: object allAttributes. + ^ keys \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/isPython.st b/repository/Python-Tools.package/PythonInspector.class/instance/isPython.st new file mode 100644 index 00000000..5f13d9ba --- /dev/null +++ b/repository/Python-Tools.package/PythonInspector.class/instance/isPython.st @@ -0,0 +1,3 @@ +overrides +isPython + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/selection.st b/repository/Python-Tools.package/PythonInspector.class/instance/selection.st new file mode 100644 index 00000000..1d9e117d --- /dev/null +++ b/repository/Python-Tools.package/PythonInspector.class/instance/selection.st @@ -0,0 +1,9 @@ +overrides +selection + "The receiver has a list of variables of its inspected object. + One of these is selected. Answer the value of the selected variable." + | attrName | + selectionIndex = 0 ifTrue: [^ '']. + selectionIndex = 1 ifTrue: [^ object]. + attrName := object allAttributes at: selectionIndex - 1. + ^ Python builtins getattr: object attrName: attrName. \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/methodProperties.json b/repository/Python-Tools.package/PythonInspector.class/methodProperties.json new file mode 100644 index 00000000..c2398f38 --- /dev/null +++ b/repository/Python-Tools.package/PythonInspector.class/methodProperties.json @@ -0,0 +1,9 @@ +{ + "class" : { + }, + "instance" : { + "buildCodePaneWith:" : "fn 3/7/2017 17:27", + "contentsIsString" : "fn 12/23/2016 11:11", + "fieldList" : "fn 2/23/2017 23:10", + "isPython" : "fn 3/7/2017 14:33", + "selection" : "fn 2/23/2017 23:10" } } diff --git a/repository/Python-Tools.package/PythonInspector.class/properties.json b/repository/Python-Tools.package/PythonInspector.class/properties.json new file mode 100644 index 00000000..4896a3e7 --- /dev/null +++ b/repository/Python-Tools.package/PythonInspector.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonInspector", + "pools" : [ + ], + "super" : "Inspector", + "type" : "normal" } diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/README.md b/repository/Python-Tools.package/PythonObjectExplorer.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json b/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json new file mode 100644 index 00000000..0e4a6622 --- /dev/null +++ b/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + } } diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/properties.json b/repository/Python-Tools.package/PythonObjectExplorer.class/properties.json new file mode 100644 index 00000000..b9060f5f --- /dev/null +++ b/repository/Python-Tools.package/PythonObjectExplorer.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonObjectExplorer", + "pools" : [ + ], + "super" : "ObjectExplorer", + "type" : "normal" } diff --git a/repository/Python-Tools.package/PythonToolSet.class/README.md b/repository/Python-Tools.package/PythonToolSet.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/browse.selector..st b/repository/Python-Tools.package/PythonToolSet.class/class/browse.selector..st new file mode 100644 index 00000000..2afc9cda --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/browse.selector..st @@ -0,0 +1,3 @@ +as yet unclassified +browse: aClass selector: aSelector + ^ PythonBrowser fullOnClass: aClass selector: aSelector \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st b/repository/Python-Tools.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st new file mode 100644 index 00000000..28b99062 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st @@ -0,0 +1,4 @@ +as yet unclassified +debug: aProcess context: aContext label: aString contents: contents fullView: aBool + "Open a debugger on the given process and context." + ^PythonDebugger openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/debugContext.label.contents..st b/repository/Python-Tools.package/PythonToolSet.class/class/debugContext.label.contents..st new file mode 100644 index 00000000..b4438259 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/debugContext.label.contents..st @@ -0,0 +1,4 @@ +as yet unclassified +debugContext: aContext label: aString contents: contents + "Open a debugger on the given process and context." + ^ PythonDebugger openContext: aContext label: aString contents: contents \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/explore..st b/repository/Python-Tools.package/PythonToolSet.class/class/explore..st new file mode 100644 index 00000000..1cf1e9f3 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/explore..st @@ -0,0 +1,4 @@ +as yet unclassified +explore: anObject + + ^ PythonObjectExplorer openOn: anObject \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/initialize.st b/repository/Python-Tools.package/PythonToolSet.class/class/initialize.st new file mode 100644 index 00000000..8e7d4079 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/initialize.st @@ -0,0 +1,3 @@ +as yet unclassified +initialize + ToolSet register: self. \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/inspectorClassOf..st b/repository/Python-Tools.package/PythonToolSet.class/class/inspectorClassOf..st new file mode 100644 index 00000000..b094a210 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/inspectorClassOf..st @@ -0,0 +1,4 @@ +as yet unclassified +inspectorClassOf: anObject + anObject isPython ifFalse: [ ^ super inspectorClassOf: anObject ]. + ^ PythonInspector \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/interrupt.label..st b/repository/Python-Tools.package/PythonToolSet.class/class/interrupt.label..st new file mode 100644 index 00000000..87ff8543 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/interrupt.label..st @@ -0,0 +1,8 @@ +as yet unclassified +interrupt: aProcess label: aString + "Open a PythonDebugger if none exists" + ActiveWorld submorphs detect: [ :ea | ea isSystemWindow and: [ ea model class == PythonDebugger ]] + ifFound: [ super interrupt: aProcess label: aString ] + ifNone: [ PythonDebugger + openInterrupt: aString + onProcess: aProcess ] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/menuItems.st b/repository/Python-Tools.package/PythonToolSet.class/class/menuItems.st new file mode 100644 index 00000000..7caa0d53 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/menuItems.st @@ -0,0 +1,18 @@ +as yet unclassified +menuItems + "Answer the menu items available for this tool set" + ^#( + ('Python browser' #openPythonClassBrowser) + ('Python workspace' #openPythonWorkspace) + ('Squeak browser' #openClassBrowser) + ('Squeak workspace' #openWorkspace) + ('file list' #openFileList) + ('package pane browser' #openPackagePaneBrowser) + ('process browser' #openProcessBrowser) + - + ('method finder' #openSelectorBrowser) + ('message names' #openMessageNames) + - + ('simple change sorter' #openChangeSorter) + ('dual change sorter' #openDualChangeSorter) + ) diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/openPythonClassBrowser.st b/repository/Python-Tools.package/PythonToolSet.class/class/openPythonClassBrowser.st new file mode 100644 index 00000000..b29417d5 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/openPythonClassBrowser.st @@ -0,0 +1,3 @@ +as yet unclassified +openPythonClassBrowser + PythonBrowser open \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/openPythonWorkspace.st b/repository/Python-Tools.package/PythonToolSet.class/class/openPythonWorkspace.st new file mode 100644 index 00000000..3cc4e4e8 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/class/openPythonWorkspace.st @@ -0,0 +1,3 @@ +as yet unclassified +openPythonWorkspace + PythonWorkspace open \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/methodProperties.json b/repository/Python-Tools.package/PythonToolSet.class/methodProperties.json new file mode 100644 index 00000000..292c15da --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/methodProperties.json @@ -0,0 +1,14 @@ +{ + "class" : { + "browse:selector:" : "fn 3/6/2017 17:54", + "debug:context:label:contents:fullView:" : "fn 1/19/2017 11:56", + "debugContext:label:contents:" : "fn 3/6/2017 17:57", + "explore:" : "fn 3/6/2017 17:57", + "initialize" : "fn 1/16/2017 18:52", + "inspectorClassOf:" : "fn 3/6/2017 17:56", + "interrupt:label:" : "fn 1/18/2017 15:08", + "menuItems" : "fn 3/6/2017 18:07", + "openPythonClassBrowser" : "fn 3/6/2017 18:05", + "openPythonWorkspace" : "fn 3/6/2017 18:08" }, + "instance" : { + } } diff --git a/repository/Python-Tools.package/PythonToolSet.class/properties.json b/repository/Python-Tools.package/PythonToolSet.class/properties.json new file mode 100644 index 00000000..9e45bc50 --- /dev/null +++ b/repository/Python-Tools.package/PythonToolSet.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonToolSet", + "pools" : [ + ], + "super" : "StandardToolSet", + "type" : "normal" } diff --git a/repository/Python-Tools.package/PythonWorkspace.class/README.md b/repository/Python-Tools.package/PythonWorkspace.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tools.package/PythonWorkspace.class/class/open.st b/repository/Python-Tools.package/PythonWorkspace.class/class/open.st new file mode 100644 index 00000000..19ea69f8 --- /dev/null +++ b/repository/Python-Tools.package/PythonWorkspace.class/class/open.st @@ -0,0 +1,3 @@ +as yet unclassified +open + ^ (Smalltalk at: #PythonWorkspace ifAbsent:[self]) new openLabel: 'Python Workspace' diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st b/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st new file mode 100644 index 00000000..2e821c0a --- /dev/null +++ b/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st @@ -0,0 +1,3 @@ +as yet unclassified +evaluateExpression: selection + ^ Python prun: selection asString \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/hasPyCodeSelected.st b/repository/Python-Tools.package/PythonWorkspace.class/instance/hasPyCodeSelected.st new file mode 100644 index 00000000..0eb4e72c --- /dev/null +++ b/repository/Python-Tools.package/PythonWorkspace.class/instance/hasPyCodeSelected.st @@ -0,0 +1,3 @@ +as yet unclassified +hasPyCodeSelected + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st b/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st new file mode 100644 index 00000000..bb7967f8 --- /dev/null +++ b/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st @@ -0,0 +1,3 @@ +as yet unclassified +isPython + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json b/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json new file mode 100644 index 00000000..e7ef10fb --- /dev/null +++ b/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json @@ -0,0 +1,7 @@ +{ + "class" : { + "open" : "fn 12/22/2016 02:51" }, + "instance" : { + "evaluateExpression:" : "fn 2/23/2017 21:21", + "hasPyCodeSelected" : "fn 3/7/2017 14:36", + "isPython" : "fn 3/7/2017 14:33" } } diff --git a/repository/Python-Tools.package/PythonWorkspace.class/properties.json b/repository/Python-Tools.package/PythonWorkspace.class/properties.json new file mode 100644 index 00000000..2eea5a8d --- /dev/null +++ b/repository/Python-Tools.package/PythonWorkspace.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonWorkspace", + "pools" : [ + ], + "super" : "Workspace", + "type" : "normal" } diff --git a/repository/Python-Tools.package/monticello.meta/categories.st b/repository/Python-Tools.package/monticello.meta/categories.st new file mode 100644 index 00000000..838506df --- /dev/null +++ b/repository/Python-Tools.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'Python-Tools'! diff --git a/repository/Python-Tools.package/monticello.meta/initializers.st b/repository/Python-Tools.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Tools.package/monticello.meta/package b/repository/Python-Tools.package/monticello.meta/package new file mode 100644 index 00000000..936a5b0f --- /dev/null +++ b/repository/Python-Tools.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'Python-Tools') \ No newline at end of file diff --git a/repository/Python-Tools.package/monticello.meta/version b/repository/Python-Tools.package/monticello.meta/version new file mode 100644 index 00000000..a6a6e48a --- /dev/null +++ b/repository/Python-Tools.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'Python-Tools-fn.4' message 'Improve tools' id 'ced3b5a9-1f04-4750-83ba-8f6843db82ae' date '7 March 2017' time '6:18:03.279361 pm' author 'fn' ancestors ((name 'Python-Tools-fn.3' message 'Bugfixes and improvements' id '792d3734-4178-4d27-bc88-d784f9183768' date '7 March 2017' time '2:35:35.338398 pm' author 'fn' ancestors ((name 'Python-Tools-fn.2' message 'Improve PythonBrowser' id 'b2daaaa3-4839-413d-83df-802a71cb1aa4' date '7 March 2017' time '12:46:26.065217 pm' author 'fn' ancestors ((name 'Python-Tools-fn.1' message 'Initial commit' id '161df5a6-e3ff-4071-9c06-90faa842786d' date '6 March 2017' time '9:43:40.029266 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Tools.package/properties.json b/repository/Python-Tools.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/Python-Tools.package/properties.json @@ -0,0 +1,2 @@ +{ + } From d2f0ba0a8b353e570f230542dfd04933b2812e27 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 7 Mar 2017 18:19:25 +0100 Subject: [PATCH 107/193] Remove deprecated PyPy.package [ci skip] --- repository/PyPy.package/.filetree | 4 - .../instance/isPyContext.st | 3 - .../methodProperties.json | 5 - .../MethodContext.extension/properties.json | 2 - .../Object.extension/instance/isPython.st | 3 - .../Object.extension/methodProperties.json | 5 - .../Object.extension/properties.json | 2 - .../PyPy.package/Python.class/README.md | 0 .../Python.class/class/basicVmSpeaksPython.st | 4 - .../Python.class/class/builtins.st | 3 - .../Python.class/class/cmdFor..st | 5 - .../PyPy.package/Python.class/class/eval..st | 3 - .../Python.class/class/evaluatorClass.st | 3 - .../PyPy.package/Python.class/class/exec..st | 3 - .../Python.class/class/from.import..st | 3 - .../Python.class/class/from.load..st | 4 - .../Python.class/class/fromObjectCache..st | 4 - .../Python.class/class/getSource..st | 3 - .../Python.class/class/globals.st | 4 - .../Python.class/class/import..st | 3 - .../Python.class/class/isCallable..st | 3 - .../Python.class/class/isExpression..st | 4 - .../PyPy.package/Python.class/class/load..st | 4 - .../PyPy.package/Python.class/class/locals.st | 4 - .../class/openDebuggerWithPythonFrames..st | 15 --- .../class/openDebuggerWithPythonFrames.st | 6 - .../Python.class/class/persistPyCode..st | 9 -- .../PyPy.package/Python.class/class/peval..st | 3 - .../PyPy.package/Python.class/class/pexec..st | 3 - .../class/primBreakOnException..st | 4 - .../class/primBreakOnException.st | 4 - .../Python.class/class/primEval.cmd..st | 4 - .../class/primEval.filename.cmd..st | 4 - .../Python.class/class/primGetTopFrame.st | 5 - .../Python.class/class/primLastError.st | 4 - .../Python.class/class/primLastResult.st | 4 - .../Python.class/class/primPythonAt..st | 4 - ...startSpecificFrame.source.filename.cmd..st | 5 - .../Python.class/class/primResume.st | 4 - .../PyPy.package/Python.class/class/prun..st | 5 - .../Python.class/class/pyInspect.st | 3 - .../PyPy.package/Python.class/class/reset.st | 4 - .../Python.class/class/restartFrame.st | 3 - .../Python.class/class/restartFrame.with..st | 7 - .../class/restartFrameWith.cmd..st | 4 - .../Python.class/class/resumeFrame.st | 7 - .../PyPy.package/Python.class/class/run..st | 5 - .../Python.class/class/single..st | 3 - .../PyPy.package/Python.class/class/type.st | 3 - .../Python.class/class/vmSpeaksPython.st | 3 - .../Python.class/methodProperties.json | 46 ------- .../PyPy.package/Python.class/properties.json | 15 --- .../PythonCompiler.class/README.md | 0 .../class/extractPySelector..st | 3 - .../PythonCompiler.class/class/parserClass.st | 5 - .../instance/compile.in.notifying.ifFail..st | 4 - ...evaluate.in.to.notifying.ifFail.logged..st | 26 ---- .../instance/pythonCompile.class.ifFail..st | 7 - .../methodProperties.json | 8 -- .../PythonCompiler.class/properties.json | 14 -- .../README.md | 0 .../instance/selection.st | 8 -- .../methodProperties.json | 5 - .../properties.json | 14 -- .../PythonDebugger.class/README.md | 0 .../class/exploreFrames.st | 18 --- .../class/filterPySource.lineno..st | 10 -- .../class/getContentsOf..st | 8 -- .../class/getPySource..st | 9 -- .../class/getSignature..st | 7 - .../PythonDebugger.class/class/indent.by..st | 5 - .../PythonDebugger.class/class/indentSize..st | 3 - .../class/newPyContext.st | 7 - .../class/prependPythonContexts..st | 16 --- .../replaceInPySource.content.lineno..st | 10 -- .../class/scopeEndIn.startingAt..st | 8 -- .../class/setPySourceContent.content..st | 13 -- .../instance/contents.notifying..st | 9 -- .../instance/contextForStack..st | 5 - .../instance/debuggerMap.st | 3 - .../instance/expandStack.st | 7 - .../instance/isModeStyleable.st | 4 - .../PythonDebugger.class/instance/pcRange.st | 7 - .../instance/process.controller.context..st | 16 --- .../instance/pyPCRange.st | 10 -- .../instance/selectedMessage.st | 7 - .../instance/windowColorToUse.st | 4 - .../methodProperties.json | 25 ---- .../PythonDebugger.class/properties.json | 14 -- .../PythonDebuggerTest.class/README.md | 0 .../instance/testScopeEndInStartingAt.st | 20 --- .../methodProperties.json | 5 - .../PythonDebuggerTest.class/properties.json | 14 -- .../PythonExamples.class/README.md | 0 .../PythonExamples.class/class/average..st | 6 - .../PythonExamples.class/class/average.st | 6 - .../PythonExamples.class/class/fibonacci..st | 9 -- .../PythonExamples.class/class/fibonacci9.st | 10 -- .../PythonExamples.class/class/miniexample.st | 13 -- .../PythonExamples.class/class/server.st | 5 - .../methodProperties.json | 10 -- .../PythonExamples.class/properties.json | 14 -- .../PythonFakeCompiledMethod.class/README.md | 0 .../instance/debuggerMap.st | 3 - .../instance/frameSize.st | 3 - .../instance/getSourceFor.in..st | 3 - .../instance/initialPC.st | 3 - .../instance/numTemps.st | 3 - .../methodProperties.json | 9 -- .../properties.json | 14 -- .../PythonFakeMethodContext.class/README.md | 0 .../instance/isPyContext.st | 3 - .../instance/printOn..st | 14 -- .../instance/pyFrame..st | 4 - .../instance/pyFrame.st | 4 - .../instance/sender..st | 4 - .../setSender.receiver.method.arguments..st | 11 -- .../instance/tempNames.st | 7 - .../methodProperties.json | 11 -- .../properties.json | 14 -- .../PythonInspector.class/README.md | 0 .../instance/aboutToStyle..st | 3 - .../instance/contentsIsString.st | 5 - .../instance/fieldList.st | 8 -- .../instance/selection.st | 9 -- .../methodProperties.json | 8 -- .../PythonInspector.class/properties.json | 14 -- .../PyPy.package/PythonObject.class/README.md | 0 ...pyCode.withMethod.inProtocol.notifying..st | 10 -- .../PythonObject.class/class/allInstances.st | 3 - .../class/codeAt.ifAbsent..st | 3 - .../PythonObject.class/class/codeAt.put..st | 5 - ...assified.withStamp.notifying.logSource..st | 38 ------ .../compile.notifying.trailer.ifFail..st | 13 -- .../class/compiledMethodAt.ifAbsent..st | 7 - .../PythonObject.class/class/compilerClass.st | 5 - .../PythonObject.class/class/initialize.st | 5 - .../PythonObject.class/class/new.st | 5 - .../PythonObject.class/class/nextID.st | 6 - .../PythonObject.class/class/printString2.st | 4 - .../class/pythonInitialize.st | 23 ---- .../class/pythonize.instVars.clsVars..st | 31 ----- .../PythonObject.class/class/pythonize.st | 4 - .../class/sourceCodeAt.ifAbsent..st | 5 - .../PythonObject.class/class/startUp..st | 5 - ...ariableNames.poolDictionaries.category..st | 4 - .../PythonObject.class/class/withAll..st | 3 - .../PythonObject.class/class/withAll2..st | 8 -- .../PythonObject.class/class/withAll3..st | 6 - .../instance/allAttributes.st | 3 - .../instance/allInstVarNames.st | 3 - .../instance/asSmalltalk.st | 4 - .../PythonObject.class/instance/at..st | 3 - .../PythonObject.class/instance/at.put..st | 3 - .../PythonObject.class/instance/class.st | 3 - .../PythonObject.class/instance/className.st | 4 - .../instance/defaultLabelForInspector.st | 5 - .../instance/environment.st | 3 - .../instance/evaluatorClass.st | 3 - .../PythonObject.class/instance/explore.st | 3 - .../instance/explorerContents.st | 8 -- .../instance/hasAttribute..st | 3 - .../PythonObject.class/instance/hasClass.st | 3 - .../instance/hasContentsInExplorer.st | 4 - .../PythonObject.class/instance/inspect.st | 4 - .../instance/inspectorClass.st | 3 - .../instance/instVarNamesAndOffsetsDo..st | 9 -- .../PythonObject.class/instance/isClass.st | 3 - .../PythonObject.class/instance/isKindOf..st | 3 - .../PythonObject.class/instance/isPython.st | 3 - .../PythonObject.class/instance/newParser.st | 4 - .../PythonObject.class/instance/printOn..st | 3 - .../PythonObject.class/instance/pyDictKeys.st | 4 - .../instance/pyDictValues.st | 4 - .../instance/pyIdentifier.st | 5 - .../instance/respondsTo..st | 6 - .../instance/shoutParserClass.st | 4 - .../instance/variablesAndOffsetsDo..st | 10 -- .../PythonObject.class/methodProperties.json | 53 -------- .../PythonObject.class/properties.json | 15 --- .../PythonObjectExplorer.class/README.md | 0 .../methodProperties.json | 5 - .../properties.json | 14 -- .../PyPy.package/PythonParser.class/README.md | 0 .../instance/parseCue.noPattern.ifFail..st | 15 --- .../instance/parseSelector..st | 4 - .../PythonParser.class/methodProperties.json | 6 - .../PythonParser.class/properties.json | 14 -- .../PyPy.package/PythonTest.class/README.md | 0 .../instance/testIsExpression.st | 10 -- .../PythonTest.class/methodProperties.json | 5 - .../PythonTest.class/properties.json | 14 -- .../PythonTestObject.class/README.md | 0 .../methodProperties.json | 5 - .../PythonTestObject.class/properties.json | 15 --- .../PythonTextStyler.class/README.md | 0 .../instance/parseableSourceCodeTemplate.st | 5 - .../PythonTextStyler.class/instance/style..st | 4 - .../instance/styleInBackgroundProcess..st | 4 - .../methodProperties.json | 7 - .../PythonTextStyler.class/properties.json | 14 -- .../PyPy.package/PythonTheme.class/README.md | 0 .../PythonTheme.class/class/addButtons..st | 26 ---- .../PythonTheme.class/class/addDialogs..st | 66 ---------- .../PythonTheme.class/class/addFonts..st | 14 -- .../class/addMenusAndDockingBars..st | 44 ------- .../class/addScrollables..st | 71 ---------- .../class/addSyntaxHighlighting..st | 123 ------------------ .../PythonTheme.class/class/addToolColors..st | 21 --- .../class/addWindowColors..st | 42 ------ .../PythonTheme.class/class/argumentColor.st | 4 - .../class/backgroundColor.st | 3 - .../PythonTheme.class/class/backgroundForm.st | 4 - .../PythonTheme.class/class/blue.st | 4 - .../class/builtinConstColor.st | 3 - .../PythonTheme.class/class/commentColor.st | 4 - .../PythonTheme.class/class/create.st | 27 ---- .../class/focusedLabelColor.st | 3 - .../class/foregroundColor.st | 4 - .../PythonTheme.class/class/globalColor.st | 5 - .../PythonTheme.class/class/green.st | 3 - .../PythonTheme.class/class/highlightColor.st | 3 - .../PythonTheme.class/class/keywordColor.st | 5 - .../PythonTheme.class/class/magenta.st | 4 - .../PythonTheme.class/class/numberColor.st | 6 - .../PythonTheme.class/class/orange.st | 4 - .../PythonTheme.class/class/red.st | 3 - .../PythonTheme.class/class/stringColor.st | 3 - .../PythonTheme.class/class/textColor.st | 3 - .../class/textSelectionColor.st | 3 - .../class/unfocusedLabelColor.st | 3 - .../PythonTheme.class/class/variableColor.st | 3 - .../PythonTheme.class/class/windowColor.st | 3 - .../PythonTheme.class/class/yellow.st | 3 - .../PythonTheme.class/methodProperties.json | 36 ----- .../PythonTheme.class/properties.json | 14 -- .../PythonToolSet.class/README.md | 0 .../debug.context.label.contents.fullView..st | 4 - .../PythonToolSet.class/class/explore..st | 4 - .../PythonToolSet.class/class/initialize.st | 3 - .../class/inspectorClassOf..st | 3 - .../class/interrupt.label..st | 8 -- .../PythonToolSet.class/methodProperties.json | 9 -- .../PythonToolSet.class/properties.json | 14 -- .../PythonWorkspace.class/README.md | 0 .../PythonWorkspace.class/class/open.st | 3 - .../instance/evaluateExpression..st | 3 - .../methodProperties.json | 5 - .../PythonWorkspace.class/properties.json | 14 -- .../monticello.meta/categories.st | 2 - .../monticello.meta/initializers.st | 0 .../PyPy.package/monticello.meta/package | 1 - .../PyPy.package/monticello.meta/version | 1 - repository/PyPy.package/properties.json | 2 - 254 files changed, 2020 deletions(-) delete mode 100644 repository/PyPy.package/.filetree delete mode 100644 repository/PyPy.package/MethodContext.extension/instance/isPyContext.st delete mode 100644 repository/PyPy.package/MethodContext.extension/methodProperties.json delete mode 100644 repository/PyPy.package/MethodContext.extension/properties.json delete mode 100644 repository/PyPy.package/Object.extension/instance/isPython.st delete mode 100644 repository/PyPy.package/Object.extension/methodProperties.json delete mode 100644 repository/PyPy.package/Object.extension/properties.json delete mode 100644 repository/PyPy.package/Python.class/README.md delete mode 100644 repository/PyPy.package/Python.class/class/basicVmSpeaksPython.st delete mode 100644 repository/PyPy.package/Python.class/class/builtins.st delete mode 100644 repository/PyPy.package/Python.class/class/cmdFor..st delete mode 100644 repository/PyPy.package/Python.class/class/eval..st delete mode 100644 repository/PyPy.package/Python.class/class/evaluatorClass.st delete mode 100644 repository/PyPy.package/Python.class/class/exec..st delete mode 100644 repository/PyPy.package/Python.class/class/from.import..st delete mode 100644 repository/PyPy.package/Python.class/class/from.load..st delete mode 100644 repository/PyPy.package/Python.class/class/fromObjectCache..st delete mode 100644 repository/PyPy.package/Python.class/class/getSource..st delete mode 100644 repository/PyPy.package/Python.class/class/globals.st delete mode 100644 repository/PyPy.package/Python.class/class/import..st delete mode 100644 repository/PyPy.package/Python.class/class/isCallable..st delete mode 100644 repository/PyPy.package/Python.class/class/isExpression..st delete mode 100644 repository/PyPy.package/Python.class/class/load..st delete mode 100644 repository/PyPy.package/Python.class/class/locals.st delete mode 100644 repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st delete mode 100644 repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames.st delete mode 100644 repository/PyPy.package/Python.class/class/persistPyCode..st delete mode 100644 repository/PyPy.package/Python.class/class/peval..st delete mode 100644 repository/PyPy.package/Python.class/class/pexec..st delete mode 100644 repository/PyPy.package/Python.class/class/primBreakOnException..st delete mode 100644 repository/PyPy.package/Python.class/class/primBreakOnException.st delete mode 100644 repository/PyPy.package/Python.class/class/primEval.cmd..st delete mode 100644 repository/PyPy.package/Python.class/class/primEval.filename.cmd..st delete mode 100644 repository/PyPy.package/Python.class/class/primGetTopFrame.st delete mode 100644 repository/PyPy.package/Python.class/class/primLastError.st delete mode 100644 repository/PyPy.package/Python.class/class/primLastResult.st delete mode 100644 repository/PyPy.package/Python.class/class/primPythonAt..st delete mode 100644 repository/PyPy.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st delete mode 100644 repository/PyPy.package/Python.class/class/primResume.st delete mode 100644 repository/PyPy.package/Python.class/class/prun..st delete mode 100644 repository/PyPy.package/Python.class/class/pyInspect.st delete mode 100644 repository/PyPy.package/Python.class/class/reset.st delete mode 100644 repository/PyPy.package/Python.class/class/restartFrame.st delete mode 100644 repository/PyPy.package/Python.class/class/restartFrame.with..st delete mode 100644 repository/PyPy.package/Python.class/class/restartFrameWith.cmd..st delete mode 100644 repository/PyPy.package/Python.class/class/resumeFrame.st delete mode 100644 repository/PyPy.package/Python.class/class/run..st delete mode 100644 repository/PyPy.package/Python.class/class/single..st delete mode 100644 repository/PyPy.package/Python.class/class/type.st delete mode 100644 repository/PyPy.package/Python.class/class/vmSpeaksPython.st delete mode 100644 repository/PyPy.package/Python.class/methodProperties.json delete mode 100644 repository/PyPy.package/Python.class/properties.json delete mode 100644 repository/PyPy.package/PythonCompiler.class/README.md delete mode 100644 repository/PyPy.package/PythonCompiler.class/class/extractPySelector..st delete mode 100644 repository/PyPy.package/PythonCompiler.class/class/parserClass.st delete mode 100644 repository/PyPy.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st delete mode 100644 repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st delete mode 100644 repository/PyPy.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st delete mode 100644 repository/PyPy.package/PythonCompiler.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonCompiler.class/properties.json delete mode 100644 repository/PyPy.package/PythonContextVariablesInspector.class/README.md delete mode 100644 repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st delete mode 100644 repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonContextVariablesInspector.class/properties.json delete mode 100644 repository/PyPy.package/PythonDebugger.class/README.md delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/exploreFrames.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/filterPySource.lineno..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/getContentsOf..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/getPySource..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/getSignature..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/indent.by..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/indentSize..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/newPyContext.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/prependPythonContexts..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/scopeEndIn.startingAt..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/class/setPySourceContent.content..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/contents.notifying..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/debuggerMap.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/expandStack.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/isModeStyleable.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/pcRange.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/process.controller.context..st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st delete mode 100644 repository/PyPy.package/PythonDebugger.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonDebugger.class/properties.json delete mode 100644 repository/PyPy.package/PythonDebuggerTest.class/README.md delete mode 100644 repository/PyPy.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st delete mode 100644 repository/PyPy.package/PythonDebuggerTest.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonDebuggerTest.class/properties.json delete mode 100644 repository/PyPy.package/PythonExamples.class/README.md delete mode 100644 repository/PyPy.package/PythonExamples.class/class/average..st delete mode 100644 repository/PyPy.package/PythonExamples.class/class/average.st delete mode 100644 repository/PyPy.package/PythonExamples.class/class/fibonacci..st delete mode 100644 repository/PyPy.package/PythonExamples.class/class/fibonacci9.st delete mode 100644 repository/PyPy.package/PythonExamples.class/class/miniexample.st delete mode 100644 repository/PyPy.package/PythonExamples.class/class/server.st delete mode 100644 repository/PyPy.package/PythonExamples.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonExamples.class/properties.json delete mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/README.md delete mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/debuggerMap.st delete mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/frameSize.st delete mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/getSourceFor.in..st delete mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/initialPC.st delete mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/instance/numTemps.st delete mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonFakeCompiledMethod.class/properties.json delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/README.md delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/isPyContext.st delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame..st delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame.st delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/sender..st delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/setSender.receiver.method.arguments..st delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonFakeMethodContext.class/properties.json delete mode 100644 repository/PyPy.package/PythonInspector.class/README.md delete mode 100644 repository/PyPy.package/PythonInspector.class/instance/aboutToStyle..st delete mode 100644 repository/PyPy.package/PythonInspector.class/instance/contentsIsString.st delete mode 100644 repository/PyPy.package/PythonInspector.class/instance/fieldList.st delete mode 100644 repository/PyPy.package/PythonInspector.class/instance/selection.st delete mode 100644 repository/PyPy.package/PythonInspector.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonInspector.class/properties.json delete mode 100644 repository/PyPy.package/PythonObject.class/README.md delete mode 100644 repository/PyPy.package/PythonObject.class/class/addAndClassifySelector.pyCode.withMethod.inProtocol.notifying..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/allInstances.st delete mode 100644 repository/PyPy.package/PythonObject.class/class/codeAt.ifAbsent..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/codeAt.put..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/compile.classified.withStamp.notifying.logSource..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/compile.notifying.trailer.ifFail..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/compiledMethodAt.ifAbsent..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/compilerClass.st delete mode 100644 repository/PyPy.package/PythonObject.class/class/initialize.st delete mode 100644 repository/PyPy.package/PythonObject.class/class/new.st delete mode 100644 repository/PyPy.package/PythonObject.class/class/nextID.st delete mode 100644 repository/PyPy.package/PythonObject.class/class/printString2.st delete mode 100644 repository/PyPy.package/PythonObject.class/class/pythonInitialize.st delete mode 100644 repository/PyPy.package/PythonObject.class/class/pythonize.instVars.clsVars..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/pythonize.st delete mode 100644 repository/PyPy.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/startUp..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/withAll..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/withAll2..st delete mode 100644 repository/PyPy.package/PythonObject.class/class/withAll3..st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/allAttributes.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/allInstVarNames.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/asSmalltalk.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/at..st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/at.put..st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/class.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/className.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/defaultLabelForInspector.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/environment.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/evaluatorClass.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/explore.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/explorerContents.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/hasAttribute..st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/hasClass.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/hasContentsInExplorer.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/inspect.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/inspectorClass.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/isClass.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/isKindOf..st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/isPython.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/newParser.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/printOn..st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/pyDictKeys.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/pyDictValues.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/pyIdentifier.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/respondsTo..st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/shoutParserClass.st delete mode 100644 repository/PyPy.package/PythonObject.class/instance/variablesAndOffsetsDo..st delete mode 100644 repository/PyPy.package/PythonObject.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonObject.class/properties.json delete mode 100644 repository/PyPy.package/PythonObjectExplorer.class/README.md delete mode 100644 repository/PyPy.package/PythonObjectExplorer.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonObjectExplorer.class/properties.json delete mode 100644 repository/PyPy.package/PythonParser.class/README.md delete mode 100644 repository/PyPy.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st delete mode 100644 repository/PyPy.package/PythonParser.class/instance/parseSelector..st delete mode 100644 repository/PyPy.package/PythonParser.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonParser.class/properties.json delete mode 100644 repository/PyPy.package/PythonTest.class/README.md delete mode 100644 repository/PyPy.package/PythonTest.class/instance/testIsExpression.st delete mode 100644 repository/PyPy.package/PythonTest.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonTest.class/properties.json delete mode 100644 repository/PyPy.package/PythonTestObject.class/README.md delete mode 100644 repository/PyPy.package/PythonTestObject.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonTestObject.class/properties.json delete mode 100644 repository/PyPy.package/PythonTextStyler.class/README.md delete mode 100644 repository/PyPy.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st delete mode 100644 repository/PyPy.package/PythonTextStyler.class/instance/style..st delete mode 100644 repository/PyPy.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st delete mode 100644 repository/PyPy.package/PythonTextStyler.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonTextStyler.class/properties.json delete mode 100644 repository/PyPy.package/PythonTheme.class/README.md delete mode 100644 repository/PyPy.package/PythonTheme.class/class/addButtons..st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/addDialogs..st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/addFonts..st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/addMenusAndDockingBars..st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/addScrollables..st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/addSyntaxHighlighting..st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/addToolColors..st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/addWindowColors..st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/argumentColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/backgroundColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/backgroundForm.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/blue.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/builtinConstColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/commentColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/create.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/focusedLabelColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/foregroundColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/globalColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/green.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/highlightColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/keywordColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/magenta.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/numberColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/orange.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/red.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/stringColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/textColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/textSelectionColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/unfocusedLabelColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/variableColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/windowColor.st delete mode 100644 repository/PyPy.package/PythonTheme.class/class/yellow.st delete mode 100644 repository/PyPy.package/PythonTheme.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonTheme.class/properties.json delete mode 100644 repository/PyPy.package/PythonToolSet.class/README.md delete mode 100644 repository/PyPy.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st delete mode 100644 repository/PyPy.package/PythonToolSet.class/class/explore..st delete mode 100644 repository/PyPy.package/PythonToolSet.class/class/initialize.st delete mode 100644 repository/PyPy.package/PythonToolSet.class/class/inspectorClassOf..st delete mode 100644 repository/PyPy.package/PythonToolSet.class/class/interrupt.label..st delete mode 100644 repository/PyPy.package/PythonToolSet.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonToolSet.class/properties.json delete mode 100644 repository/PyPy.package/PythonWorkspace.class/README.md delete mode 100644 repository/PyPy.package/PythonWorkspace.class/class/open.st delete mode 100644 repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st delete mode 100644 repository/PyPy.package/PythonWorkspace.class/methodProperties.json delete mode 100644 repository/PyPy.package/PythonWorkspace.class/properties.json delete mode 100644 repository/PyPy.package/monticello.meta/categories.st delete mode 100644 repository/PyPy.package/monticello.meta/initializers.st delete mode 100644 repository/PyPy.package/monticello.meta/package delete mode 100644 repository/PyPy.package/monticello.meta/version delete mode 100644 repository/PyPy.package/properties.json diff --git a/repository/PyPy.package/.filetree b/repository/PyPy.package/.filetree deleted file mode 100644 index 8998102c..00000000 --- a/repository/PyPy.package/.filetree +++ /dev/null @@ -1,4 +0,0 @@ -{ - "noMethodMetaData" : true, - "separateMethodMetaAndSource" : false, - "useCypressPropertiesFile" : true } diff --git a/repository/PyPy.package/MethodContext.extension/instance/isPyContext.st b/repository/PyPy.package/MethodContext.extension/instance/isPyContext.st deleted file mode 100644 index 377d444a..00000000 --- a/repository/PyPy.package/MethodContext.extension/instance/isPyContext.st +++ /dev/null @@ -1,3 +0,0 @@ -*PyPy -isPyContext - ^ false \ No newline at end of file diff --git a/repository/PyPy.package/MethodContext.extension/methodProperties.json b/repository/PyPy.package/MethodContext.extension/methodProperties.json deleted file mode 100644 index a6699e30..00000000 --- a/repository/PyPy.package/MethodContext.extension/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "isPyContext" : "fn 1/16/2017 19:51" } } diff --git a/repository/PyPy.package/MethodContext.extension/properties.json b/repository/PyPy.package/MethodContext.extension/properties.json deleted file mode 100644 index 9759a76f..00000000 --- a/repository/PyPy.package/MethodContext.extension/properties.json +++ /dev/null @@ -1,2 +0,0 @@ -{ - "name" : "MethodContext" } diff --git a/repository/PyPy.package/Object.extension/instance/isPython.st b/repository/PyPy.package/Object.extension/instance/isPython.st deleted file mode 100644 index 4c3694ef..00000000 --- a/repository/PyPy.package/Object.extension/instance/isPython.st +++ /dev/null @@ -1,3 +0,0 @@ -*PyPy -isPython - ^ false \ No newline at end of file diff --git a/repository/PyPy.package/Object.extension/methodProperties.json b/repository/PyPy.package/Object.extension/methodProperties.json deleted file mode 100644 index a632af45..00000000 --- a/repository/PyPy.package/Object.extension/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "isPython" : "fn 2/10/2017 12:12" } } diff --git a/repository/PyPy.package/Object.extension/properties.json b/repository/PyPy.package/Object.extension/properties.json deleted file mode 100644 index 3d3b9ec4..00000000 --- a/repository/PyPy.package/Object.extension/properties.json +++ /dev/null @@ -1,2 +0,0 @@ -{ - "name" : "Object" } diff --git a/repository/PyPy.package/Python.class/README.md b/repository/PyPy.package/Python.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/Python.class/class/basicVmSpeaksPython.st b/repository/PyPy.package/Python.class/class/basicVmSpeaksPython.st deleted file mode 100644 index c4b6c442..00000000 --- a/repository/PyPy.package/Python.class/class/basicVmSpeaksPython.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -basicVmSpeaksPython - [ Python eval: '1' ] on: Error do: [ ^ false ]. - ^ true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/builtins.st b/repository/PyPy.package/Python.class/class/builtins.st deleted file mode 100644 index c66d31e3..00000000 --- a/repository/PyPy.package/Python.class/class/builtins.st +++ /dev/null @@ -1,3 +0,0 @@ -special objects -builtins - ^ self fromObjectCache: '__builtins__' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/cmdFor..st b/repository/PyPy.package/Python.class/class/cmdFor..st deleted file mode 100644 index 2280e30d..00000000 --- a/repository/PyPy.package/Python.class/class/cmdFor..st +++ /dev/null @@ -1,5 +0,0 @@ -helpers -cmdFor: aPySource - (self isExpression: aPySource) - ifTrue: [ ^ 'eval' ] - ifFalse: [ ^ 'exec' ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/eval..st b/repository/PyPy.package/Python.class/class/eval..st deleted file mode 100644 index 7da4cb30..00000000 --- a/repository/PyPy.package/Python.class/class/eval..st +++ /dev/null @@ -1,3 +0,0 @@ -execution -eval: aString - ^ self primEval: aString filename: '' cmd: 'eval' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/evaluatorClass.st b/repository/PyPy.package/Python.class/class/evaluatorClass.st deleted file mode 100644 index f04f433e..00000000 --- a/repository/PyPy.package/Python.class/class/evaluatorClass.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -evaluatorClass - ^ PythonCompiler \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/exec..st b/repository/PyPy.package/Python.class/class/exec..st deleted file mode 100644 index 8002b84f..00000000 --- a/repository/PyPy.package/Python.class/class/exec..st +++ /dev/null @@ -1,3 +0,0 @@ -execution -exec: aString - ^ self primEval: aString filename: '' cmd: 'exec' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/from.import..st b/repository/PyPy.package/Python.class/class/from.import..st deleted file mode 100644 index 87e87d30..00000000 --- a/repository/PyPy.package/Python.class/class/from.import..st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -from: aPackageName import: aModuleName - Python exec: 'from ', aPackageName, ' import ', aModuleName \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/from.load..st b/repository/PyPy.package/Python.class/class/from.load..st deleted file mode 100644 index 956c7668..00000000 --- a/repository/PyPy.package/Python.class/class/from.load..st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -from: aPackageName load: aModuleName - self from: aPackageName import: aModuleName. - ^ Python eval: aModuleName \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/fromObjectCache..st b/repository/PyPy.package/Python.class/class/fromObjectCache..st deleted file mode 100644 index 1150b52a..00000000 --- a/repository/PyPy.package/Python.class/class/fromObjectCache..st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -fromObjectCache: aName - ObjectCache ifNil: [ ObjectCache := Dictionary new ]. - ^ ObjectCache at: aName ifAbsentPut: [ self eval: aName ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/getSource..st b/repository/PyPy.package/Python.class/class/getSource..st deleted file mode 100644 index 37d80f0a..00000000 --- a/repository/PyPy.package/Python.class/class/getSource..st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -getSource: pyCode - self pyInspect getsource: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/globals.st b/repository/PyPy.package/Python.class/class/globals.st deleted file mode 100644 index a85fbedb..00000000 --- a/repository/PyPy.package/Python.class/class/globals.st +++ /dev/null @@ -1,4 +0,0 @@ -special objects -globals - ^ Python eval: 'globals()' - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/import..st b/repository/PyPy.package/Python.class/class/import..st deleted file mode 100644 index 2a4bd7b3..00000000 --- a/repository/PyPy.package/Python.class/class/import..st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -import: aModuleName - Python exec: 'import ', aModuleName \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/isCallable..st b/repository/PyPy.package/Python.class/class/isCallable..st deleted file mode 100644 index 51dceaab..00000000 --- a/repository/PyPy.package/Python.class/class/isCallable..st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -isCallable: aPyString - ^ (self eval: 'callable(', aPyString ,')') asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/isExpression..st b/repository/PyPy.package/Python.class/class/isExpression..st deleted file mode 100644 index 093da59d..00000000 --- a/repository/PyPy.package/Python.class/class/isExpression..st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -isExpression: aPySource - ^ (self eval: '_isExpression("""', -aPySource, '""")') asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/load..st b/repository/PyPy.package/Python.class/class/load..st deleted file mode 100644 index 7e4d6aaf..00000000 --- a/repository/PyPy.package/Python.class/class/load..st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -load: aModuleName - self import: aModuleName. - ^ Python eval: aModuleName \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/locals.st b/repository/PyPy.package/Python.class/class/locals.st deleted file mode 100644 index 92400462..00000000 --- a/repository/PyPy.package/Python.class/class/locals.st +++ /dev/null @@ -1,4 +0,0 @@ -special objects -locals - ^ Python eval: 'locals()' - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st b/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st deleted file mode 100644 index 08930815..00000000 --- a/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames..st +++ /dev/null @@ -1,15 +0,0 @@ -system primitives -openDebuggerWithPythonFrames: pyError - | resumeCtx | - resumeCtx := thisContext sender. - [ resumeCtx method selector = #resumeFrame - and: [ resumeCtx closure isNil ] ] - whileFalse: [ - resumeCtx := resumeCtx sender. - resumeCtx ifNil: [ ^ self error: 'resumeCtx not found' ] ]. - PythonDebugger - openOn: Processor activeProcess - context: (PythonDebugger prependPythonContexts: resumeCtx) - label: pyError first, ': ', pyError second - contents: nil - fullView: true \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames.st b/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames.st deleted file mode 100644 index 1bb37408..00000000 --- a/repository/PyPy.package/Python.class/class/openDebuggerWithPythonFrames.st +++ /dev/null @@ -1,6 +0,0 @@ -system primitives -openDebuggerWithPythonFrames - self primLastError - ifNil: [ self error: 'No Python error detected' ] - ifNotNil: [ :e | self openDebuggerWithPythonFrames: e ] - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/persistPyCode..st b/repository/PyPy.package/Python.class/class/persistPyCode..st deleted file mode 100644 index 18192812..00000000 --- a/repository/PyPy.package/Python.class/class/persistPyCode..st +++ /dev/null @@ -1,9 +0,0 @@ -experimental -persistPyCode: pySource - | filename stream | - filename := 'py_files', FileDirectory pathNameDelimiter ,'source_', Time millisecondClockValue, '.py'. - stream := StandardFileStream forceNewFileNamed: filename. - stream := MultiByteFileStream newFrom: stream. - stream write: pySource. - stream close. - ^ filename \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/peval..st b/repository/PyPy.package/Python.class/class/peval..st deleted file mode 100644 index 7d75798a..00000000 --- a/repository/PyPy.package/Python.class/class/peval..st +++ /dev/null @@ -1,3 +0,0 @@ -execution -peval: aString - ^ self primEval: aString filename: (self persistPyCode: aString) cmd: 'eval' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/pexec..st b/repository/PyPy.package/Python.class/class/pexec..st deleted file mode 100644 index fe3fb2df..00000000 --- a/repository/PyPy.package/Python.class/class/pexec..st +++ /dev/null @@ -1,3 +0,0 @@ -execution -pexec: aString - ^ self primEval: aString filename: (self persistPyCode: aString) cmd: 'exec' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primBreakOnException..st b/repository/PyPy.package/Python.class/class/primBreakOnException..st deleted file mode 100644 index 5178cfcd..00000000 --- a/repository/PyPy.package/Python.class/class/primBreakOnException..st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -primBreakOnException: aBool - - self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primBreakOnException.st b/repository/PyPy.package/Python.class/class/primBreakOnException.st deleted file mode 100644 index eadd07cc..00000000 --- a/repository/PyPy.package/Python.class/class/primBreakOnException.st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -primBreakOnException - - self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primEval.cmd..st b/repository/PyPy.package/Python.class/class/primEval.cmd..st deleted file mode 100644 index 2fcfb210..00000000 --- a/repository/PyPy.package/Python.class/class/primEval.cmd..st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primEval: aString cmd: aEvalOrExec - - self primitiveFailed. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primEval.filename.cmd..st b/repository/PyPy.package/Python.class/class/primEval.filename.cmd..st deleted file mode 100644 index 19e70782..00000000 --- a/repository/PyPy.package/Python.class/class/primEval.filename.cmd..st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primEval: aString filename: aFilename cmd: aEvalOrExec - - self primitiveFailed. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primGetTopFrame.st b/repository/PyPy.package/Python.class/class/primGetTopFrame.st deleted file mode 100644 index b4d5b440..00000000 --- a/repository/PyPy.package/Python.class/class/primGetTopFrame.st +++ /dev/null @@ -1,5 +0,0 @@ -experimental -primGetTopFrame - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primLastError.st b/repository/PyPy.package/Python.class/class/primLastError.st deleted file mode 100644 index 5f036a85..00000000 --- a/repository/PyPy.package/Python.class/class/primLastError.st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primLastError - - ^ nil \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primLastResult.st b/repository/PyPy.package/Python.class/class/primLastResult.st deleted file mode 100644 index 6d8aa1dc..00000000 --- a/repository/PyPy.package/Python.class/class/primLastResult.st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primLastResult - - ^ nil \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primPythonAt..st b/repository/PyPy.package/Python.class/class/primPythonAt..st deleted file mode 100644 index dedd6673..00000000 --- a/repository/PyPy.package/Python.class/class/primPythonAt..st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -primPythonAt: aKeyOrIndex - - self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st b/repository/PyPy.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st deleted file mode 100644 index 243c13f1..00000000 --- a/repository/PyPy.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st +++ /dev/null @@ -1,5 +0,0 @@ -experimental -primRestartSpecificFrame: pyFrame source: pySource filename: aFilename cmd: evalOrExec - - self primitiveFailed. - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/primResume.st b/repository/PyPy.package/Python.class/class/primResume.st deleted file mode 100644 index 8bd99e0e..00000000 --- a/repository/PyPy.package/Python.class/class/primResume.st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -primResume - - self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/prun..st b/repository/PyPy.package/Python.class/class/prun..st deleted file mode 100644 index 9593ed09..00000000 --- a/repository/PyPy.package/Python.class/class/prun..st +++ /dev/null @@ -1,5 +0,0 @@ -execution -prun: pyCode - (self isExpression: pyCode) - ifTrue: [ [^ self peval: pyCode ] on: Error do: [] ]. - ^ self pexec: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/pyInspect.st b/repository/PyPy.package/Python.class/class/pyInspect.st deleted file mode 100644 index 24d47cf3..00000000 --- a/repository/PyPy.package/Python.class/class/pyInspect.st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -pyInspect - self eval: 'inspect' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/reset.st b/repository/PyPy.package/Python.class/class/reset.st deleted file mode 100644 index d5e86b2f..00000000 --- a/repository/PyPy.package/Python.class/class/reset.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -reset - ObjectCache := nil. - VMSpeaksPython := nil. \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/restartFrame.st b/repository/PyPy.package/Python.class/class/restartFrame.st deleted file mode 100644 index 6cdd679f..00000000 --- a/repository/PyPy.package/Python.class/class/restartFrame.st +++ /dev/null @@ -1,3 +0,0 @@ -experimental -restartFrame - self primRestartSpecificFrame: nil source: '' filename: '' cmd: '' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/restartFrame.with..st b/repository/PyPy.package/Python.class/class/restartFrame.with..st deleted file mode 100644 index b0c31b90..00000000 --- a/repository/PyPy.package/Python.class/class/restartFrame.with..st +++ /dev/null @@ -1,7 +0,0 @@ -experimental -restartFrame: pyFrame with: aSource - self - primRestartSpecificFrame: pyFrame - source: aSource - filename: pyFrame f_code co_filename - cmd: (self cmdFor: aSource) \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/restartFrameWith.cmd..st b/repository/PyPy.package/Python.class/class/restartFrameWith.cmd..st deleted file mode 100644 index 186e3f50..00000000 --- a/repository/PyPy.package/Python.class/class/restartFrameWith.cmd..st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -restartFrameWith: pySource cmd: evalOrExec - self primRestartSpecificFrame: nil source: pySource filename: '' cmd: evalOrExec - \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/resumeFrame.st b/repository/PyPy.package/Python.class/class/resumeFrame.st deleted file mode 100644 index a13fce40..00000000 --- a/repository/PyPy.package/Python.class/class/resumeFrame.st +++ /dev/null @@ -1,7 +0,0 @@ -special methods -resumeFrame - "Magic method that is called by vm (cached in vm)" - Processor yield. - [ ^ self primResume ] on: Error do: [ - self openDebuggerWithPythonFrames. - ^ self resumeFrame ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/run..st b/repository/PyPy.package/Python.class/class/run..st deleted file mode 100644 index 9e39e246..00000000 --- a/repository/PyPy.package/Python.class/class/run..st +++ /dev/null @@ -1,5 +0,0 @@ -execution -run: pyCode - (self isExpression: pyCode) - ifTrue: [ [^ self eval: pyCode ] on: Error do: [] ]. - ^ self exec: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/single..st b/repository/PyPy.package/Python.class/class/single..st deleted file mode 100644 index 7cde647f..00000000 --- a/repository/PyPy.package/Python.class/class/single..st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -single: aString - ^ self primEval: aString filename: '' cmd: 'single' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/type.st b/repository/PyPy.package/Python.class/class/type.st deleted file mode 100644 index 60a577da..00000000 --- a/repository/PyPy.package/Python.class/class/type.st +++ /dev/null @@ -1,3 +0,0 @@ -special objects -type - ^ self fromObjectCache: 'type' \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st b/repository/PyPy.package/Python.class/class/vmSpeaksPython.st deleted file mode 100644 index 61bd766b..00000000 --- a/repository/PyPy.package/Python.class/class/vmSpeaksPython.st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -vmSpeaksPython - ^ VMSpeaksPython ifNil: [ VMSpeaksPython := self basicVmSpeaksPython ] \ No newline at end of file diff --git a/repository/PyPy.package/Python.class/methodProperties.json b/repository/PyPy.package/Python.class/methodProperties.json deleted file mode 100644 index ccb31860..00000000 --- a/repository/PyPy.package/Python.class/methodProperties.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "class" : { - "basicVmSpeaksPython" : "fn 2/23/2017 20:59", - "builtins" : "fn 2/23/2017 18:34", - "cmdFor:" : "fn 2/23/2017 21:36", - "eval:" : "fn 2/23/2017 21:10", - "evaluatorClass" : "fn 12/22/2016 02:53", - "exec:" : "fn 2/23/2017 21:11", - "from:import:" : "fn 1/9/2017 20:54", - "from:load:" : "fn 1/9/2017 20:55", - "fromObjectCache:" : "fn 2/23/2017 18:40", - "getSource:" : "fn 1/29/2017 22:15", - "globals" : "fn 2/26/2017 21:46", - "import:" : "fn 1/9/2017 20:54", - "isCallable:" : "fn 2/26/2017 21:45", - "isExpression:" : "fn 2/26/2017 21:45", - "load:" : "fn 1/9/2017 20:54", - "locals" : "fn 2/26/2017 21:46", - "openDebuggerWithPythonFrames" : "fn 2/21/2017 12:41", - "openDebuggerWithPythonFrames:" : "fn 2/21/2017 22:08", - "persistPyCode:" : "fn 2/1/2017 12:46", - "peval:" : "fn 2/23/2017 21:12", - "pexec:" : "fn 2/23/2017 21:12", - "primBreakOnException" : "fn 2/23/2017 13:22", - "primBreakOnException:" : "fn 2/23/2017 13:22", - "primEval:cmd:" : "fn 2/2/2017 17:12", - "primEval:filename:cmd:" : "fn 2/1/2017 10:55", - "primGetTopFrame" : "fn 1/11/2017 11:19", - "primLastError" : "fn 1/28/2017 13:37", - "primLastResult" : "fn 1/30/2017 15:34", - "primPythonAt:" : "fn 2/25/2017 17:03", - "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", - "primResume" : "fn 2/22/2017 10:47", - "prun:" : "fn 2/23/2017 21:36", - "pyInspect" : "fn 1/29/2017 22:15", - "reset" : "fn 2/23/2017 21:13", - "restartFrame" : "fn 2/22/2017 10:21", - "restartFrame:with:" : "fn 2/22/2017 14:14", - "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", - "resumeFrame" : "fn 2/21/2017 22:05", - "run:" : "fn 2/23/2017 21:37", - "single:" : "fn 2/1/2017 10:55", - "type" : "fn 2/23/2017 18:34", - "vmSpeaksPython" : "fn 2/23/2017 21:00" }, - "instance" : { - } } diff --git a/repository/PyPy.package/Python.class/properties.json b/repository/PyPy.package/Python.class/properties.json deleted file mode 100644 index 12e554ad..00000000 --- a/repository/PyPy.package/Python.class/properties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - "ObjectCache", - "VMSpeaksPython" ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "Python", - "pools" : [ - ], - "super" : "Object", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonCompiler.class/README.md b/repository/PyPy.package/PythonCompiler.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonCompiler.class/class/extractPySelector..st b/repository/PyPy.package/PythonCompiler.class/class/extractPySelector..st deleted file mode 100644 index 7cf06702..00000000 --- a/repository/PyPy.package/PythonCompiler.class/class/extractPySelector..st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -extractPySelector: pySource - ^ ((pySource copyAfter: Character space) copyUpTo: $() asString \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/class/parserClass.st b/repository/PyPy.package/PythonCompiler.class/class/parserClass.st deleted file mode 100644 index c571b1d0..00000000 --- a/repository/PyPy.package/PythonCompiler.class/class/parserClass.st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -parserClass - Python vmSpeaksPython ifFalse: [ ^ Parser ]. - ^ PythonParser "PythonParser" - \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st b/repository/PyPy.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st deleted file mode 100644 index be949f5a..00000000 --- a/repository/PyPy.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock - Python vmSpeaksPython ifTrue: [ self pythonCompile: textOrStream class: aClass ifFail: failBlock ]. - ^ super compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st b/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st deleted file mode 100644 index 51046664..00000000 --- a/repository/PyPy.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st +++ /dev/null @@ -1,26 +0,0 @@ -as yet unclassified -evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag - | pyCode | - pyCode := textOrStream contents. - - Python exec: 'rcvr_locals = dict()'. - (Python eval: 'rcvr_locals') setdefault: 'self' to: receiver. - - (Python isExpression: pyCode) - ifTrue: [ - ^ Python builtins - eval: pyCode - globals: (Python eval: 'globals()') - locals: (Python eval: 'rcvr_locals')] - ifFalse: [ - ^ Python builtins - exec: pyCode - globals: (Python eval: 'globals()') - locals: (Python eval: 'rcvr_locals')] - - "pyCode := pyCode copyReplaceAll: 'self.' with: ''. - method := (pyCode copyUpTo: $() asSymbol. - args := ((((pyCode copyAfter: $() copyUpTo: $)) - findTokens: {$,}) - collect: [ :ea | ea withBlanksTrimmed ]) asArray. - ^ receiver perform: method withArguments: args" \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st b/repository/PyPy.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st deleted file mode 100644 index 6edafdcc..00000000 --- a/repository/PyPy.package/PythonCompiler.class/instance/pythonCompile.class.ifFail..st +++ /dev/null @@ -1,7 +0,0 @@ -as yet unclassified -pythonCompile: pySource class: aClass ifFail: failBlock - | pySelector | - pySelector := self class extractPySelector: pySource. - [ Python exec: pySource, String cr, - aClass name asString, '.', pySelector, ' = ', pySelector ] - on: Error do: failBlock \ No newline at end of file diff --git a/repository/PyPy.package/PythonCompiler.class/methodProperties.json b/repository/PyPy.package/PythonCompiler.class/methodProperties.json deleted file mode 100644 index 80b15478..00000000 --- a/repository/PyPy.package/PythonCompiler.class/methodProperties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "class" : { - "extractPySelector:" : "fn 12/19/2016 02:57", - "parserClass" : "fn 12/25/2016 15:08" }, - "instance" : { - "compile:in:notifying:ifFail:" : "fn 12/19/2016 14:09", - "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/24/2017 11:58", - "pythonCompile:class:ifFail:" : "fn 12/19/2016 02:18" } } diff --git a/repository/PyPy.package/PythonCompiler.class/properties.json b/repository/PyPy.package/PythonCompiler.class/properties.json deleted file mode 100644 index 1e33b913..00000000 --- a/repository/PyPy.package/PythonCompiler.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonCompiler", - "pools" : [ - ], - "super" : "Compiler", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/README.md b/repository/PyPy.package/PythonContextVariablesInspector.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st b/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st deleted file mode 100644 index 7fc4627e..00000000 --- a/repository/PyPy.package/PythonContextVariablesInspector.class/instance/selection.st +++ /dev/null @@ -1,8 +0,0 @@ -as yet unclassified -selection - self object isPython ifFalse: [ ^ super selection ]. - selectionIndex = 0 ifTrue: [^ '']. - selectionIndex = 1 ifTrue: [^ object ]. - selectionIndex = 2 ifTrue: [^ object symbolic]. - selectionIndex = 3 ifTrue: [^ object headerDescription]. - ^ object pyFrame f_locals values at: selectionIndex - 3 \ No newline at end of file diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json b/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json deleted file mode 100644 index b893d906..00000000 --- a/repository/PyPy.package/PythonContextVariablesInspector.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "selection" : "fn 2/26/2017 21:44" } } diff --git a/repository/PyPy.package/PythonContextVariablesInspector.class/properties.json b/repository/PyPy.package/PythonContextVariablesInspector.class/properties.json deleted file mode 100644 index 65af4d73..00000000 --- a/repository/PyPy.package/PythonContextVariablesInspector.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonContextVariablesInspector", - "pools" : [ - ], - "super" : "ContextVariablesInspector", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonDebugger.class/README.md b/repository/PyPy.package/PythonDebugger.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonDebugger.class/class/exploreFrames.st b/repository/PyPy.package/PythonDebugger.class/class/exploreFrames.st deleted file mode 100644 index 4e1367da..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/exploreFrames.st +++ /dev/null @@ -1,18 +0,0 @@ -as yet unclassified -exploreFrames - | currentFrame result frameInfo | - currentFrame := Python primGetTopFrame. - result := OrderedCollection new. - [ currentFrame notNil ] whileTrue: [ - frameInfo := IdentityDictionary new - add: #f_lineno->(currentFrame f_lineno); - add: #co_name->(currentFrame f_code co_name); - add: #co_firstlineno->(currentFrame f_code co_firstlineno); - add: #co_filename->(currentFrame f_code co_filename); - add: #f_locals->(currentFrame f_locals __str__); - add: #f_globals->(currentFrame f_globals __str__); - yourself. - result add: frameInfo. - currentFrame := currentFrame f_back ]. - result explore - \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/filterPySource.lineno..st b/repository/PyPy.package/PythonDebugger.class/class/filterPySource.lineno..st deleted file mode 100644 index 5a45bc50..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/filterPySource.lineno..st +++ /dev/null @@ -1,10 +0,0 @@ -pysource -filterPySource: aString lineno: scopeStart - | lines indentSize end | - lines := aString lines. - lines size = 1 ifTrue: [ ^ aString ]. - end := self scopeEndIn: aString startingAt: scopeStart. - lines := lines copyFrom: scopeStart to: end. - indentSize := self indentSize: lines first. - lines := lines collect: [ :ea | ea copyFrom: indentSize + 1 to: ea size ]. - ^ lines joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/getContentsOf..st b/repository/PyPy.package/PythonDebugger.class/class/getContentsOf..st deleted file mode 100644 index cea9b9d8..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/getContentsOf..st +++ /dev/null @@ -1,8 +0,0 @@ -pysource -getContentsOf: aFileName - | stream data | - stream := StandardFileStream oldFileNamed: aFileName. - stream := MultiByteFileStream newFrom: stream. - data := stream contents. - stream close. - ^ data \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/getPySource..st b/repository/PyPy.package/PythonDebugger.class/class/getPySource..st deleted file mode 100644 index e2c67e9f..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/getPySource..st +++ /dev/null @@ -1,9 +0,0 @@ -pysource -getPySource: aContext - | pyCode filename contents | - pyCode := aContext pyFrame f_code. - filename := pyCode co_filename. - filename = '' ifTrue: [ ^ 'Unable to get source.' ]. - contents := self getContentsOf: pyCode co_filename. - ^ self filterPySource: contents lineno: pyCode co_firstlineno - \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/getSignature..st b/repository/PyPy.package/PythonDebugger.class/class/getSignature..st deleted file mode 100644 index 01c496f7..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/getSignature..st +++ /dev/null @@ -1,7 +0,0 @@ -pysource -getSignature: pyCode - | filename content | - filename := pyCode co_filename. - filename = '' ifTrue: [ ^ 'unknown' ]. - content := self getContentsOf: pyCode co_filename. - ^ content lines at: pyCode co_firstlineno \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/indent.by..st b/repository/PyPy.package/PythonDebugger.class/class/indent.by..st deleted file mode 100644 index 9db8b9b0..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/indent.by..st +++ /dev/null @@ -1,5 +0,0 @@ -pysource -indent: aString by: aNumber - | indent | - indent := String new: aNumber withAll: Character space. - ^ (aString lines collect: [:ea | indent, ea]) joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/indentSize..st b/repository/PyPy.package/PythonDebugger.class/class/indentSize..st deleted file mode 100644 index 70463b5f..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/indentSize..st +++ /dev/null @@ -1,3 +0,0 @@ -pysource -indentSize: aLine - ^ ((aLine findFirst: [:ea | ea isSeparator not]) - 1) max: 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/newPyContext.st b/repository/PyPy.package/PythonDebugger.class/class/newPyContext.st deleted file mode 100644 index b97aba76..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/newPyContext.st +++ /dev/null @@ -1,7 +0,0 @@ -as yet unclassified -newPyContext - ^ PythonFakeMethodContext - sender: nil - receiver: PythonObject - method: (PythonFakeCompiledMethod newMethod: 2 header: 2) - arguments: #() \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/prependPythonContexts..st b/repository/PyPy.package/PythonDebugger.class/class/prependPythonContexts..st deleted file mode 100644 index 35dbc99f..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/prependPythonContexts..st +++ /dev/null @@ -1,16 +0,0 @@ -as yet unclassified -prependPythonContexts: aContext - | currentPyFrame newFrames | - currentPyFrame := Python primGetTopFrame. - currentPyFrame ifNil: [ ^ aContext ]. - newFrames := OrderedCollection new. - [ currentPyFrame notNil ] - whileTrue: [ | newCtx | - newCtx := self newPyContext. - newCtx pyFrame: currentPyFrame. - newFrames add: newCtx. - currentPyFrame := currentPyFrame f_back ]. - newFrames overlappingPairsDo: [ :a :b | - a sender: b ]. - newFrames last sender: aContext. - ^ newFrames first \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st b/repository/PyPy.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st deleted file mode 100644 index e2e9cb52..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st +++ /dev/null @@ -1,10 +0,0 @@ -pysource -replaceInPySource: oldContent content: aString lineno: aLineno - | lines end indentSize newLines | - lines := oldContent lines. - lines size <= 1 ifTrue: [ ^ aString ]. - end := self scopeEndIn: oldContent startingAt: aLineno. - indentSize := self indentSize: (lines at: aLineno). - newLines := (self indent: aString by: indentSize) lines. - lines := lines copyReplaceFrom: aLineno to: end with: newLines. - ^ lines joinSeparatedBy: Character cr \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/scopeEndIn.startingAt..st b/repository/PyPy.package/PythonDebugger.class/class/scopeEndIn.startingAt..st deleted file mode 100644 index f9c4d93c..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/scopeEndIn.startingAt..st +++ /dev/null @@ -1,8 +0,0 @@ -pysource -scopeEndIn: aString startingAt: aLineno - | lines currentIndentSize end | - lines := aString lines allButFirst: aLineno. - currentIndentSize := self indentSize: lines first. - end := lines allButFirst findFirst: [ :line | (self indentSize: line) < currentIndentSize ]. - end = 0 ifTrue: [ end := lines size ]. - ^ aLineno + end \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/class/setPySourceContent.content..st b/repository/PyPy.package/PythonDebugger.class/class/setPySourceContent.content..st deleted file mode 100644 index a8a2cb97..00000000 --- a/repository/PyPy.package/PythonDebugger.class/class/setPySourceContent.content..st +++ /dev/null @@ -1,13 +0,0 @@ -pysource -setPySourceContent: pyCode content: aString - | filename oldContents newContents stream | - filename := pyCode co_filename. - stream := StandardFileStream readOnlyFileNamed: filename. - oldContents := stream contents. - stream close. - newContents := self replaceInPySource: oldContents content: aString lineno: pyCode co_firstlineno. - stream := StandardFileStream forceNewFileNamed: filename. - stream := MultiByteFileStream newFrom: stream. - stream write: newContents. - stream close - \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/contents.notifying..st b/repository/PyPy.package/PythonDebugger.class/instance/contents.notifying..st deleted file mode 100644 index 5261b70c..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/contents.notifying..st +++ /dev/null @@ -1,9 +0,0 @@ -overrides -contents: aText notifying: aController - | ctx | - ctx := self selectedContext. - ctx isPyContext ifFalse: [^ super contents: aText notifying: aController]. - self class setPySourceContent: ctx pyFrame f_code content: aText asString. - Python restartFrame: ctx pyFrame with: aText asString withUnixLineEndings. - contents := aText. - ^ true \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st b/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st deleted file mode 100644 index 8fa17106..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/contextForStack..st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -contextForStack: aContext - aContext method selector = #resumeFrame - ifFalse: [ ^ aContext ]. "Normal MethodContext" - ^ self class prependPythonContexts: aContext \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/debuggerMap.st b/repository/PyPy.package/PythonDebugger.class/instance/debuggerMap.st deleted file mode 100644 index 7e516904..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/debuggerMap.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -debuggerMap - ^ self \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/expandStack.st b/repository/PyPy.package/PythonDebugger.class/instance/expandStack.st deleted file mode 100644 index fab69b10..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/expandStack.st +++ /dev/null @@ -1,7 +0,0 @@ -overrides -expandStack - "A Notifier is being turned into a full debugger. Show a substantial amount of stack in the context pane." - - super expandStack. - receiverInspector := PythonInspector inspect: nil. - contextVariablesInspector := PythonContextVariablesInspector inspect: nil. \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/isModeStyleable.st b/repository/PyPy.package/PythonDebugger.class/instance/isModeStyleable.st deleted file mode 100644 index 58ea902f..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/isModeStyleable.st +++ /dev/null @@ -1,4 +0,0 @@ -overrides -isModeStyleable - "determine the current mode can be styled" - ^ super isModeStyleable and: [self selectedContext isPyContext not] \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/pcRange.st b/repository/PyPy.package/PythonDebugger.class/instance/pcRange.st deleted file mode 100644 index 85d16102..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/pcRange.st +++ /dev/null @@ -1,7 +0,0 @@ -overrides -pcRange - "Answer the indices in the source code for the method corresponding to - the selected context's program counter value." - self selectedContext isPyContext - ifTrue: [ ^ self pyPCRange ]. - ^ super pcRange \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/process.controller.context..st b/repository/PyPy.package/PythonDebugger.class/instance/process.controller.context..st deleted file mode 100644 index f45fa1b1..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/process.controller.context..st +++ /dev/null @@ -1,16 +0,0 @@ -overrides -process: aProcess controller: aController context: aContext - | contextForStack | - super initialize. - Smalltalk at: #MessageTally ifPresentAndInMemory: [ :tally | - tally terminateTimerProcess]. - contents := nil. - interruptedProcess := aProcess. - interruptedController := aController. - contextForStack := self contextForStack: aContext. - self newStack: (contextForStack stackOfSize: 1). - contextStackIndex := 1. - externalInterrupt := false. - selectingPC := true. - Smalltalk isMorphic ifTrue: - [errorWasInUIProcess := false] \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st b/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st deleted file mode 100644 index 4c82624b..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/pyPCRange.st +++ /dev/null @@ -1,10 +0,0 @@ -overrides -pyPCRange - | pyFrame relativeLine lineCount | - pyFrame := self selectedContext pyFrame. - relativeLine := pyFrame f_lineno - pyFrame f_code co_firstlineno. - lineCount := 0. - (self class getPySource: self selectedContext) lineIndicesDo: [:start :endWithoutDelimiters :end | - (lineCount := lineCount + 1) = (relativeLine + 1) - ifTrue: [ ^ start to: end ]]. - ^1 to: 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st b/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st deleted file mode 100644 index 8399455a..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/selectedMessage.st +++ /dev/null @@ -1,7 +0,0 @@ -overrides -selectedMessage - "Answer the source code of the currently selected context." - | aContext | - aContext := self selectedContext. - aContext isPyContext ifFalse: [ ^ super selectedMessage ]. - ^ self class getPySource: aContext \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st b/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st deleted file mode 100644 index e5b2d33f..00000000 --- a/repository/PyPy.package/PythonDebugger.class/instance/windowColorToUse.st +++ /dev/null @@ -1,4 +0,0 @@ -overrides -windowColorToUse - - ^ PythonTheme highlightColor darker \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebugger.class/methodProperties.json b/repository/PyPy.package/PythonDebugger.class/methodProperties.json deleted file mode 100644 index f4fc29e7..00000000 --- a/repository/PyPy.package/PythonDebugger.class/methodProperties.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "class" : { - "exploreFrames" : "fn 1/18/2017 17:34", - "filterPySource:lineno:" : "fn 2/2/2017 00:01", - "getContentsOf:" : "fn 2/1/2017 22:37", - "getPySource:" : "fn 2/23/2017 21:19", - "getSignature:" : "fn 2/23/2017 21:19", - "indent:by:" : "fn 2/1/2017 22:41", - "indentSize:" : "fn 2/1/2017 22:36", - "newPyContext" : "fn 2/21/2017 18:55", - "prependPythonContexts:" : "fn 2/21/2017 18:55", - "replaceInPySource:content:lineno:" : "fn 2/2/2017 00:05", - "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", - "setPySourceContent:content:" : "fn 2/1/2017 22:50" }, - "instance" : { - "contents:notifying:" : "fn 2/2/2017 00:04", - "contextForStack:" : "fn 2/21/2017 12:48", - "debuggerMap" : "fn 1/16/2017 20:23", - "expandStack" : "fn 1/16/2017 21:03", - "isModeStyleable" : "fn 1/16/2017 20:27", - "pcRange" : "fn 1/18/2017 20:04", - "process:controller:context:" : "fn 1/16/2017 19:34", - "pyPCRange" : "fn 2/2/2017 17:00", - "selectedMessage" : "fn 2/21/2017 18:52", - "windowColorToUse" : "fn 2/10/2017 12:08" } } diff --git a/repository/PyPy.package/PythonDebugger.class/properties.json b/repository/PyPy.package/PythonDebugger.class/properties.json deleted file mode 100644 index 26df14f4..00000000 --- a/repository/PyPy.package/PythonDebugger.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonDebugger", - "pools" : [ - ], - "super" : "Debugger", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonDebuggerTest.class/README.md b/repository/PyPy.package/PythonDebuggerTest.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st b/repository/PyPy.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st deleted file mode 100644 index bb82dd07..00000000 --- a/repository/PyPy.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st +++ /dev/null @@ -1,20 +0,0 @@ -as yet unclassified -testScopeEndInStartingAt - | d input | - d := PythonDebugger. - input := ' -a = 2 -def foo(): - x = 24 - def bar(): - return "bar" - return "%s, %s" % (x, bar()) -b = 4 -x = b * a'. - self assert: 9 equals: (d scopeEndIn: input startingAt: 1). - self assert: 9 equals: (d scopeEndIn: input startingAt: 2). - self assert: 7 equals: (d scopeEndIn: input startingAt: 3). - self assert: 7 equals: (d scopeEndIn: input startingAt: 4). - self assert: 6 equals: (d scopeEndIn: input startingAt: 5). - self assert: 7 equals: (d scopeEndIn: input startingAt: 6). - self assert: 9 equals: (d scopeEndIn: input startingAt: 8). \ No newline at end of file diff --git a/repository/PyPy.package/PythonDebuggerTest.class/methodProperties.json b/repository/PyPy.package/PythonDebuggerTest.class/methodProperties.json deleted file mode 100644 index 31f107b7..00000000 --- a/repository/PyPy.package/PythonDebuggerTest.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "testScopeEndInStartingAt" : "fn 2/1/2017 22:43" } } diff --git a/repository/PyPy.package/PythonDebuggerTest.class/properties.json b/repository/PyPy.package/PythonDebuggerTest.class/properties.json deleted file mode 100644 index 9243415f..00000000 --- a/repository/PyPy.package/PythonDebuggerTest.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy-Tests", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonDebuggerTest", - "pools" : [ - ], - "super" : "TestCase", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonExamples.class/README.md b/repository/PyPy.package/PythonExamples.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonExamples.class/class/average..st b/repository/PyPy.package/PythonExamples.class/class/average..st deleted file mode 100644 index e7948e92..00000000 --- a/repository/PyPy.package/PythonExamples.class/class/average..st +++ /dev/null @@ -1,6 +0,0 @@ -debugging -average: anIterableDef - Python pexec: ' -def average(iterable): - return sum(iterable) / len(iterable)'. - ^ Python eval: 'average(', anIterableDef, ')' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/average.st b/repository/PyPy.package/PythonExamples.class/class/average.st deleted file mode 100644 index 19968836..00000000 --- a/repository/PyPy.package/PythonExamples.class/class/average.st +++ /dev/null @@ -1,6 +0,0 @@ -debugging -average - Python pexec: ' -def average(iterable): - return sum(iterable) / len(iterable)'. - ^ Python eval: 'average([])' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/fibonacci..st b/repository/PyPy.package/PythonExamples.class/class/fibonacci..st deleted file mode 100644 index dd7be796..00000000 --- a/repository/PyPy.package/PythonExamples.class/class/fibonacci..st +++ /dev/null @@ -1,9 +0,0 @@ -debugging -fibonacci: x - Python pexec: ' -def fibonacci(number): - lookup_table = [0] - for i in range(2, number + 1): - lookup_table.append(lookup_table[i - 1] + lookup_table[i - 2]) - return lookup_table[number]'. - ^ Python eval: 'fibonacci(', x, ')' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st b/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st deleted file mode 100644 index 91034740..00000000 --- a/repository/PyPy.package/PythonExamples.class/class/fibonacci9.st +++ /dev/null @@ -1,10 +0,0 @@ -debugging -fibonacci9 - Python pexec: ' -def fibonacci9(): - number = 9 - lookup_table = [0] - for i in range(2, number + 1): - lookup_table.append(lookup_table[i - 1] + lookup_table[i - 2]) - return lookup_table[number]'. - ^ Python eval: 'fibonacci9()' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/miniexample.st b/repository/PyPy.package/PythonExamples.class/class/miniexample.st deleted file mode 100644 index 88bc5a68..00000000 --- a/repository/PyPy.package/PythonExamples.class/class/miniexample.st +++ /dev/null @@ -1,13 +0,0 @@ -debugging -miniexample - "Use user interrupt to interrupt while loop" - ^ Python pexec: ' -x = 0 - -def start(): - global x - while True: - x += 1 - if x % 1000 == 0: - print x -start()' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/class/server.st b/repository/PyPy.package/PythonExamples.class/class/server.st deleted file mode 100644 index e7ff2425..00000000 --- a/repository/PyPy.package/PythonExamples.class/class/server.st +++ /dev/null @@ -1,5 +0,0 @@ -debugging -server - "Use user interrupt to interrupt server loop" - Python exec: 'from helloworld import live_value, app'. - ^ Python eval: 'app.run()' \ No newline at end of file diff --git a/repository/PyPy.package/PythonExamples.class/methodProperties.json b/repository/PyPy.package/PythonExamples.class/methodProperties.json deleted file mode 100644 index 5c4d0636..00000000 --- a/repository/PyPy.package/PythonExamples.class/methodProperties.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "class" : { - "average" : "fn 2/23/2017 21:12", - "average:" : "fn 2/23/2017 21:12", - "fibonacci9" : "fn 2/23/2017 21:13", - "fibonacci:" : "fn 2/23/2017 21:13", - "miniexample" : "fn 2/23/2017 21:13", - "server" : "fn 2/23/2017 17:59" }, - "instance" : { - } } diff --git a/repository/PyPy.package/PythonExamples.class/properties.json b/repository/PyPy.package/PythonExamples.class/properties.json deleted file mode 100644 index 92ebd651..00000000 --- a/repository/PyPy.package/PythonExamples.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonExamples", - "pools" : [ - ], - "super" : "Object", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/README.md b/repository/PyPy.package/PythonFakeCompiledMethod.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/debuggerMap.st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/debuggerMap.st deleted file mode 100644 index 9e84a44e..00000000 --- a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/debuggerMap.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -debuggerMap - ^ self \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/frameSize.st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/frameSize.st deleted file mode 100644 index 50c851d4..00000000 --- a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/frameSize.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -frameSize - ^ 16 \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/getSourceFor.in..st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/getSourceFor.in..st deleted file mode 100644 index b0f7a531..00000000 --- a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/getSourceFor.in..st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -getSourceFor: selector in: class - ^ 'Pysource for #', selector asString, ' in ', class asString \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/initialPC.st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/initialPC.st deleted file mode 100644 index 7aa8c418..00000000 --- a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/initialPC.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -initialPC - ^ 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/numTemps.st b/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/numTemps.st deleted file mode 100644 index 305247c8..00000000 --- a/repository/PyPy.package/PythonFakeCompiledMethod.class/instance/numTemps.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -numTemps - ^ 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/methodProperties.json b/repository/PyPy.package/PythonFakeCompiledMethod.class/methodProperties.json deleted file mode 100644 index af729df3..00000000 --- a/repository/PyPy.package/PythonFakeCompiledMethod.class/methodProperties.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "debuggerMap" : "fn 1/16/2017 20:12", - "frameSize" : "fn 1/16/2017 19:39", - "getSourceFor:in:" : "fn 1/16/2017 19:25", - "initialPC" : "fn 1/16/2017 19:39", - "numTemps" : "fn 1/16/2017 19:39" } } diff --git a/repository/PyPy.package/PythonFakeCompiledMethod.class/properties.json b/repository/PyPy.package/PythonFakeCompiledMethod.class/properties.json deleted file mode 100644 index 69cfee18..00000000 --- a/repository/PyPy.package/PythonFakeCompiledMethod.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonFakeCompiledMethod", - "pools" : [ - ], - "super" : "CompiledMethod", - "type" : "compiledMethod" } diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/README.md b/repository/PyPy.package/PythonFakeMethodContext.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/isPyContext.st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/isPyContext.st deleted file mode 100644 index e36abdb3..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/isPyContext.st +++ /dev/null @@ -1,3 +0,0 @@ -accessing -isPyContext - ^ true \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st deleted file mode 100644 index dcead268..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/printOn..st +++ /dev/null @@ -1,14 +0,0 @@ -as yet unclassified -printOn: aStream - | line lineno filename currentPath | - self pyFrame ifNil: [ - aStream nextPutAll: 'Unknown pyFrame'. - ^ self ]. - line := PythonDebugger getSignature: pyFrame f_code. - lineno := pyFrame f_lineno. - filename := pyFrame f_code co_filename. - currentPath := FileDirectory default pathName. - (filename startsWith: currentPath) ifTrue: [ - filename := filename allButFirst: currentPath size + 1]. - aStream nextPutAll: line, ' (line ' , lineno asString, ' in ', filename, ')' - \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame..st deleted file mode 100644 index 9cba0a4b..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame..st +++ /dev/null @@ -1,4 +0,0 @@ -accessing -pyFrame: anObject - - pyFrame := anObject \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame.st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame.st deleted file mode 100644 index abbedaa6..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/pyFrame.st +++ /dev/null @@ -1,4 +0,0 @@ -accessing -pyFrame - - ^ pyFrame \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/sender..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/sender..st deleted file mode 100644 index 955558b9..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/sender..st +++ /dev/null @@ -1,4 +0,0 @@ -accessing -sender: anObject - - sender := anObject \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/setSender.receiver.method.arguments..st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/setSender.receiver.method.arguments..st deleted file mode 100644 index 6885cbdf..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/setSender.receiver.method.arguments..st +++ /dev/null @@ -1,11 +0,0 @@ -accessing -setSender: s receiver: r method: m arguments: args - "Create the receiver's initial state." - - sender := s. - receiver := r. - method := m. - closureOrNil := nil. - pc := method initialPC. - "self stackp: method numTemps. - 1 to: args size do: [:i | self at: i put: (args at: i)]" \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st b/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st deleted file mode 100644 index e8cc4ae3..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/instance/tempNames.st +++ /dev/null @@ -1,7 +0,0 @@ -accessing -tempNames - "Answer a SequenceableCollection of the names of the receiver's temporary - variables, which are strings." - - self pyFrame ifNil: [^ #()]. - ^ self pyFrame f_locals keys \ No newline at end of file diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json b/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json deleted file mode 100644 index 3e02c866..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/methodProperties.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "isPyContext" : "fn 1/16/2017 19:51", - "printOn:" : "fn 2/23/2017 21:16", - "pyFrame" : "fn 1/16/2017 19:30", - "pyFrame:" : "fn 1/16/2017 19:30", - "sender:" : "fn 1/16/2017 21:54", - "setSender:receiver:method:arguments:" : "fn 1/18/2017 17:38", - "tempNames" : "fn 1/30/2017 14:10" } } diff --git a/repository/PyPy.package/PythonFakeMethodContext.class/properties.json b/repository/PyPy.package/PythonFakeMethodContext.class/properties.json deleted file mode 100644 index adcd8585..00000000 --- a/repository/PyPy.package/PythonFakeMethodContext.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - "pyFrame" ], - "name" : "PythonFakeMethodContext", - "pools" : [ - ], - "super" : "MethodContext", - "type" : "variable" } diff --git a/repository/PyPy.package/PythonInspector.class/README.md b/repository/PyPy.package/PythonInspector.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonInspector.class/instance/aboutToStyle..st b/repository/PyPy.package/PythonInspector.class/instance/aboutToStyle..st deleted file mode 100644 index 7ba4db7b..00000000 --- a/repository/PyPy.package/PythonInspector.class/instance/aboutToStyle..st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -aboutToStyle: aStyler - ^ false \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/contentsIsString.st b/repository/PyPy.package/PythonInspector.class/instance/contentsIsString.st deleted file mode 100644 index 1a1d0522..00000000 --- a/repository/PyPy.package/PythonInspector.class/instance/contentsIsString.st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -contentsIsString - "Hacked so contents empty when deselected and = long printString when item 2" - - ^ selectionIndex = 0 \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/fieldList.st b/repository/PyPy.package/PythonInspector.class/instance/fieldList.st deleted file mode 100644 index 55604587..00000000 --- a/repository/PyPy.package/PythonInspector.class/instance/fieldList.st +++ /dev/null @@ -1,8 +0,0 @@ -as yet unclassified -fieldList - "Answer the base field list plus an abbreviated list of indices." - | keys | - keys := OrderedCollection new. - keys add: 'self'. - keys addAll: object allAttributes. - ^ keys \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/instance/selection.st b/repository/PyPy.package/PythonInspector.class/instance/selection.st deleted file mode 100644 index 59a158e7..00000000 --- a/repository/PyPy.package/PythonInspector.class/instance/selection.st +++ /dev/null @@ -1,9 +0,0 @@ -as yet unclassified -selection - "The receiver has a list of variables of its inspected object. - One of these is selected. Answer the value of the selected variable." - | attrName | - selectionIndex = 0 ifTrue: [^ '']. - selectionIndex = 1 ifTrue: [^ object]. - attrName := object allAttributes at: selectionIndex - 1. - ^ Python builtins getattr: object attrName: attrName. \ No newline at end of file diff --git a/repository/PyPy.package/PythonInspector.class/methodProperties.json b/repository/PyPy.package/PythonInspector.class/methodProperties.json deleted file mode 100644 index 6c9aa882..00000000 --- a/repository/PyPy.package/PythonInspector.class/methodProperties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "aboutToStyle:" : "fn 2/24/2017 00:41", - "contentsIsString" : "fn 12/23/2016 11:11", - "fieldList" : "fn 2/23/2017 23:10", - "selection" : "fn 2/23/2017 23:10" } } diff --git a/repository/PyPy.package/PythonInspector.class/properties.json b/repository/PyPy.package/PythonInspector.class/properties.json deleted file mode 100644 index 7b46538b..00000000 --- a/repository/PyPy.package/PythonInspector.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonInspector", - "pools" : [ - ], - "super" : "Inspector", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonObject.class/README.md b/repository/PyPy.package/PythonObject.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonObject.class/class/addAndClassifySelector.pyCode.withMethod.inProtocol.notifying..st b/repository/PyPy.package/PythonObject.class/class/addAndClassifySelector.pyCode.withMethod.inProtocol.notifying..st deleted file mode 100644 index 84914398..00000000 --- a/repository/PyPy.package/PythonObject.class/class/addAndClassifySelector.pyCode.withMethod.inProtocol.notifying..st +++ /dev/null @@ -1,10 +0,0 @@ -as yet unclassified -addAndClassifySelector: selector pyCode: aPyCode withMethod: compiledMethod inProtocol: category notifying: requestor - | priorMethodOrNil | - priorMethodOrNil := self compiledMethodAt: selector ifAbsent: [nil]. - self codeAt: selector put: aPyCode. - SystemChangeNotifier uniqueInstance - doSilently: [self organization classify: selector under: category]. - priorMethodOrNil isNil - ifTrue: [SystemChangeNotifier uniqueInstance methodAdded: compiledMethod selector: selector inProtocol: category class: self requestor: requestor] - ifFalse: [SystemChangeNotifier uniqueInstance methodChangedFrom: priorMethodOrNil to: compiledMethod selector: selector inClass: self requestor: requestor]. \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/allInstances.st b/repository/PyPy.package/PythonObject.class/class/allInstances.st deleted file mode 100644 index 28f49cc5..00000000 --- a/repository/PyPy.package/PythonObject.class/class/allInstances.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -allInstances - ^ Python eval: self name, '.instances.values()' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/codeAt.ifAbsent..st b/repository/PyPy.package/PythonObject.class/class/codeAt.ifAbsent..st deleted file mode 100644 index 29f77a1f..00000000 --- a/repository/PyPy.package/PythonObject.class/class/codeAt.ifAbsent..st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -codeAt: aSymbol ifAbsent: absentBlock - ^ Code at: aSymbol ifAbsent: absentBlock \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/codeAt.put..st b/repository/PyPy.package/PythonObject.class/class/codeAt.put..st deleted file mode 100644 index c1e1f59a..00000000 --- a/repository/PyPy.package/PythonObject.class/class/codeAt.put..st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -codeAt: aSymbol put: pyCode - "Code := nil" - Code ifNil: [ Code := Dictionary new ]. - ^ Code at: aSymbol put: pyCode \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/compile.classified.withStamp.notifying.logSource..st b/repository/PyPy.package/PythonObject.class/class/compile.classified.withStamp.notifying.logSource..st deleted file mode 100644 index a7dacce3..00000000 --- a/repository/PyPy.package/PythonObject.class/class/compile.classified.withStamp.notifying.logSource..st +++ /dev/null @@ -1,38 +0,0 @@ -overrides -compile: text classified: category withStamp: changeStamp notifying: requestor logSource: logSource - | methodAndNode selector | - methodAndNode := self - compile: text asString - notifying: requestor - trailer: (self defaultMethodTrailerIfLogSource: logSource) - ifFail: [ ^ nil ]. - selector := methodAndNode selector. - (Python vmSpeaksPython not and: [logSource]) ifTrue: - [ self - logMethodSource: text - forMethodWithNode: methodAndNode - inCategory: category - withStamp: changeStamp - notifying: requestor. - RecentMessages default - recordSelector: selector - forClass: methodAndNode method methodClass - inEnvironment: CurrentEnvironment signal ]. - Python vmSpeaksPython - ifTrue: [ - self - addAndClassifySelector: selector - pyCode: text - withMethod: methodAndNode method - inProtocol: category - notifying: requestor ] - ifFalse: [ - self - addAndClassifySelector: selector - withMethod: methodAndNode method - inProtocol: category - notifying: requestor ]. - self instanceSide - noteCompilationOf: selector - meta: self isClassSide. - ^ selector \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/compile.notifying.trailer.ifFail..st b/repository/PyPy.package/PythonObject.class/class/compile.notifying.trailer.ifFail..st deleted file mode 100644 index 1b5d5ee8..00000000 --- a/repository/PyPy.package/PythonObject.class/class/compile.notifying.trailer.ifFail..st +++ /dev/null @@ -1,13 +0,0 @@ -overrides -compile: code notifying: requestor trailer: bytes ifFail: failBlock - "Compile code without logging the source in the changes file" - | pySelector compiledMeth methodNode | - Python vmSpeaksPython ifFalse: [ ^ super compile: code notifying: requestor trailer: bytes ifFail: failBlock ]. - pySelector := PythonCompiler extractPySelector: code. - compiledMeth := CompiledMethod new methodClass: self; yourself. - methodNode := self newCompiler - compile: code - in: self - notifying: requestor - ifFail: failBlock. - ^ CompiledMethodWithNode new method: compiledMeth; node: methodNode. \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/compiledMethodAt.ifAbsent..st b/repository/PyPy.package/PythonObject.class/class/compiledMethodAt.ifAbsent..st deleted file mode 100644 index 37f556ae..00000000 --- a/repository/PyPy.package/PythonObject.class/class/compiledMethodAt.ifAbsent..st +++ /dev/null @@ -1,7 +0,0 @@ -overrides -compiledMethodAt: methodSelector ifAbsent: aBlock - Python vmSpeaksPython ifFalse: [ ^ super compiledMethodAt: methodSelector ifAbsent: aBlock ]. - "Return dummy CM to satisfy browser" - ^ CompiledMethod new methodClass: self; selector: methodSelector; yourself - - \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/compilerClass.st b/repository/PyPy.package/PythonObject.class/class/compilerClass.st deleted file mode 100644 index 45aeeea3..00000000 --- a/repository/PyPy.package/PythonObject.class/class/compilerClass.st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -compilerClass - Python vmSpeaksPython ifFalse: [ ^ Compiler ]. - ^ PythonCompiler - \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/initialize.st b/repository/PyPy.package/PythonObject.class/class/initialize.st deleted file mode 100644 index 9381318d..00000000 --- a/repository/PyPy.package/PythonObject.class/class/initialize.st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -initialize - super initialize. - Smalltalk addToStartUpList: PythonObject - "Smalltalk removeFromStartUpList: PythonObject" \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/new.st b/repository/PyPy.package/PythonObject.class/class/new.st deleted file mode 100644 index 3dfc8d49..00000000 --- a/repository/PyPy.package/PythonObject.class/class/new.st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -new - Python vmSpeaksPython ifFalse: [ ^ super new ]. - ^ self withAll: #() - \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/nextID.st b/repository/PyPy.package/PythonObject.class/class/nextID.st deleted file mode 100644 index 1a290885..00000000 --- a/repository/PyPy.package/PythonObject.class/class/nextID.st +++ /dev/null @@ -1,6 +0,0 @@ -overrides -nextID - "NextID = nil" - NextID ifNil: [ NextID := 0 ]. - NextID := NextID + 1. - ^ NextID \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/printString2.st b/repository/PyPy.package/PythonObject.class/class/printString2.st deleted file mode 100644 index 94ad020b..00000000 --- a/repository/PyPy.package/PythonObject.class/class/printString2.st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -printString2 - Python vmSpeaksPython ifFalse: [ ^ super printString ]. - ^ Python eval: self name asString, '.__class__.__name__' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st b/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st deleted file mode 100644 index a2f21da2..00000000 --- a/repository/PyPy.package/PythonObject.class/class/pythonInitialize.st +++ /dev/null @@ -1,23 +0,0 @@ -as yet unclassified -pythonInitialize - NextID := 0. - Python exec: ' -import sys -sys.path = ["', Smalltalk image imagePath, '", - "', Smalltalk image imagePath, '/pypy/lib_pypy", - "', Smalltalk image imagePath, '/pypy/lib-python/2.7", - "', Smalltalk image imagePath, '/pypy/lib-python/2.7/lib-tk", - "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-darwin", - "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac", - "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac/lib-scriptpackages", - "." ] -def _isExpression(x): - try: - compile(x, "", "eval") - return True - except SyntaxError: - return False'. - "Pythonize all Python classes" - self withAllSubclasses do: [ :ea | ea pythonize ]. - "Install PythonBuiltins (failing atm)" - "Smalltalk at: #PythonBuiltins put: Python builtins" \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/pythonize.instVars.clsVars..st b/repository/PyPy.package/PythonObject.class/class/pythonize.instVars.clsVars..st deleted file mode 100644 index cb0a603b..00000000 --- a/repository/PyPy.package/PythonObject.class/class/pythonize.instVars.clsVars..st +++ /dev/null @@ -1,31 +0,0 @@ -as yet unclassified -pythonize: t instVars: f clsVars: d - | code instVars clsVars pySuperclass initSignature | - instVars := Scanner new scanFieldNames: f. - clsVars := Scanner new scanFieldNames: d. - initSignature := 'self'. - instVars do: [ :ea | initSignature := initSignature, ', ', ea, '=None']. - - pySuperclass := (self superclass = Object - ifTrue: [ 'object' ] - ifFalse: [ self superclass name asString ]). - code := 'class ', t asString, '(', pySuperclass, '):', String cr. - - code := code, String tab, 'next_id = 0', String cr. - code := code, String tab, 'instances = {}', String cr. - - "clsVars are currently class attributes" - clsVars do: [ :ea | code := code, String tab, ea, ' = None', String cr]. - - code := code, String tab, 'def __init__(', initSignature ,'):', String cr. - code := code, String tab, String tab, 'self.__class__.next_id += 1', String cr. - code := code, String tab, String tab, 'self.inst_id = self.__class__.next_id', String cr. - code := code, String tab, String tab, 'self.__class__.instances[self.inst_id] = self', String cr. - instVars do: [ :ea | - code := code, String tab, String tab, 'self.', ea, ' = ', ea, String cr ]. - instVars ifEmpty: [ code := code, String tab, String tab, 'pass', String cr ]. - - "instVars do: [ :ea | - code := code, String tab, 'def ', ea, '(self, val): self.', ea, '_val = val' , String cr ]." - - Python exec: code \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/pythonize.st b/repository/PyPy.package/PythonObject.class/class/pythonize.st deleted file mode 100644 index ad197856..00000000 --- a/repository/PyPy.package/PythonObject.class/class/pythonize.st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -pythonize - "Transcript showln: 'Pythonizing ', self name, '...'." - self pythonize: self name instVars: self instVarNames clsVars: self classVarNames \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st b/repository/PyPy.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st deleted file mode 100644 index 96d68752..00000000 --- a/repository/PyPy.package/PythonObject.class/class/sourceCodeAt.ifAbsent..st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -sourceCodeAt: selector ifAbsent: aBlock - Python vmSpeaksPython ifFalse: [ ^ super sourceCodeAt: selector ifAbsent: aBlock ]. - ^ self codeAt: selector ifAbsent: aBlock - \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/startUp..st b/repository/PyPy.package/PythonObject.class/class/startUp..st deleted file mode 100644 index 9ee1788e..00000000 --- a/repository/PyPy.package/PythonObject.class/class/startUp..st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -startUp: resuming - Python reset. - (resuming and: [ Python vmSpeaksPython ]) - ifTrue: [ self pythonInitialize ] \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st b/repository/PyPy.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st deleted file mode 100644 index 37fe112a..00000000 --- a/repository/PyPy.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat - Python vmSpeaksPython ifTrue: [ self pythonize: t instVars: f clsVars: d ]. - ^ super subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/withAll..st b/repository/PyPy.package/PythonObject.class/class/withAll..st deleted file mode 100644 index 355b8115..00000000 --- a/repository/PyPy.package/PythonObject.class/class/withAll..st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -withAll: anArray - ^ Python eval: self name asString, '(', (anArray joinSeparatedBy: ',') , ')' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/withAll2..st b/repository/PyPy.package/PythonObject.class/class/withAll2..st deleted file mode 100644 index 26e83602..00000000 --- a/repository/PyPy.package/PythonObject.class/class/withAll2..st +++ /dev/null @@ -1,8 +0,0 @@ -as yet unclassified -withAll2: anArray - | id obj | - id := 'inst', PythonObject nextID asString. - Python exec: id, ' = ', self name asString, '(', (anArray joinSeparatedBy: ',') , ')'. - obj := Python eval: id. - obj pyID: id. - ^ obj \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/class/withAll3..st b/repository/PyPy.package/PythonObject.class/class/withAll3..st deleted file mode 100644 index fd6417ea..00000000 --- a/repository/PyPy.package/PythonObject.class/class/withAll3..st +++ /dev/null @@ -1,6 +0,0 @@ -as yet unclassified -withAll3: anArray - | id | - id := 'inst', PythonObject nextID asString. - Python exec: id, ' = ', self name asString, '(', (anArray joinSeparatedBy: ',') , ')'. - ^ self basicNew initialize pyID: id; yourself \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/allAttributes.st b/repository/PyPy.package/PythonObject.class/instance/allAttributes.st deleted file mode 100644 index 28742c5f..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/allAttributes.st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -allAttributes - ^ (Python builtins dir: self) asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/allInstVarNames.st b/repository/PyPy.package/PythonObject.class/instance/allInstVarNames.st deleted file mode 100644 index c8f110e7..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/allInstVarNames.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -allInstVarNames - ^ self allAttributes \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/asSmalltalk.st b/repository/PyPy.package/PythonObject.class/instance/asSmalltalk.st deleted file mode 100644 index 33ef364d..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/asSmalltalk.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -asSmalltalk - - self primitiveFailed \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/at..st b/repository/PyPy.package/PythonObject.class/instance/at..st deleted file mode 100644 index 7282371f..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/at..st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -at: aKeyOrIndex - ^ self __getitem__: aKeyOrIndex \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/at.put..st b/repository/PyPy.package/PythonObject.class/instance/at.put..st deleted file mode 100644 index 70812ae6..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/at.put..st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -at: aKeyOrIndex put: aValue - ^ self __setitem__: aKeyOrIndex to: aValue \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/class.st b/repository/PyPy.package/PythonObject.class/instance/class.st deleted file mode 100644 index 8e78e221..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/class.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -class - ^ Python builtins type: self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/className.st b/repository/PyPy.package/PythonObject.class/instance/className.st deleted file mode 100644 index ba8f8900..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/className.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -className - self hasClass ifFalse: [ self error: 'No class found' ]. - ^ self __class__ __name__ asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/defaultLabelForInspector.st b/repository/PyPy.package/PythonObject.class/instance/defaultLabelForInspector.st deleted file mode 100644 index d63a8ce0..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/defaultLabelForInspector.st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -defaultLabelForInspector - "Answer the default label to be used for an Inspector window on the receiver." - self hasClass ifTrue: [ ^ self className, ': ', self asString ]. - ^ self asString \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/environment.st b/repository/PyPy.package/PythonObject.class/instance/environment.st deleted file mode 100644 index d6270da0..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/environment.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -environment - ^ nil \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/evaluatorClass.st b/repository/PyPy.package/PythonObject.class/instance/evaluatorClass.st deleted file mode 100644 index f04f433e..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/evaluatorClass.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -evaluatorClass - ^ PythonCompiler \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/explore.st b/repository/PyPy.package/PythonObject.class/instance/explore.st deleted file mode 100644 index 6aacfcbf..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/explore.st +++ /dev/null @@ -1,3 +0,0 @@ -inspector -explore - ^PythonToolSet explore: self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/explorerContents.st b/repository/PyPy.package/PythonObject.class/instance/explorerContents.st deleted file mode 100644 index 3a67d6e8..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/explorerContents.st +++ /dev/null @@ -1,8 +0,0 @@ -explorer -explorerContents - ^ self allAttributes asOrderedCollection collect: [ :attrName | | value | - value := Python builtins getattr: self attrName: attrName. - ObjectExplorerWrapper - with: value - name: attrName - model: self ] \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st b/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st deleted file mode 100644 index 0864bd07..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/hasAttribute..st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -hasAttribute: anAttribute - ^ (Python builtins hasattr: self attr: anAttribute) asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/hasClass.st b/repository/PyPy.package/PythonObject.class/instance/hasClass.st deleted file mode 100644 index 2df639b8..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/hasClass.st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -hasClass - ^ self hasAttribute: '__class__' \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/hasContentsInExplorer.st b/repository/PyPy.package/PythonObject.class/instance/hasContentsInExplorer.st deleted file mode 100644 index ea5a3ba7..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/hasContentsInExplorer.st +++ /dev/null @@ -1,4 +0,0 @@ -inspector -hasContentsInExplorer - - ^ self allAttributes notEmpty diff --git a/repository/PyPy.package/PythonObject.class/instance/inspect.st b/repository/PyPy.package/PythonObject.class/instance/inspect.st deleted file mode 100644 index 9576f5bb..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/inspect.st +++ /dev/null @@ -1,4 +0,0 @@ -inspector -inspect - "Create and schedule an Inspector in which the user can examine the receiver's variables." - ^ PythonToolSet inspect: self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/inspectorClass.st b/repository/PyPy.package/PythonObject.class/instance/inspectorClass.st deleted file mode 100644 index 54a02214..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/inspectorClass.st +++ /dev/null @@ -1,3 +0,0 @@ -inspector -inspectorClass - ^ PythonInspector \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st b/repository/PyPy.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st deleted file mode 100644 index d0fe74a1..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/instVarNamesAndOffsetsDo..st +++ /dev/null @@ -1,9 +0,0 @@ -overrides -instVarNamesAndOffsetsDo: aBinaryBlock - "This is part of the interface between the compiler and a class's instance or field names. - The class should enumerate aBinaryBlock with the instance variable name strings and - their integer offsets. The order is important. Names evaluated later will override the - same names occurring earlier." - - "Nothing to do here; ClassDescription introduces named instance variables" - ^self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/isClass.st b/repository/PyPy.package/PythonObject.class/instance/isClass.st deleted file mode 100644 index af8b5c1a..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/isClass.st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -isClass - ^ (Python builtins isinstance: self and: Python type) asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/isKindOf..st b/repository/PyPy.package/PythonObject.class/instance/isKindOf..st deleted file mode 100644 index b036cc1c..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/isKindOf..st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -isKindOf: aClass - ^ PythonObject inheritsFrom: aClass \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/isPython.st b/repository/PyPy.package/PythonObject.class/instance/isPython.st deleted file mode 100644 index 5f13d9ba..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/isPython.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -isPython - ^ true \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/newParser.st b/repository/PyPy.package/PythonObject.class/instance/newParser.st deleted file mode 100644 index ccda3fc1..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/newParser.st +++ /dev/null @@ -1,4 +0,0 @@ -overrides -newParser - "Answer a Parser suitable for parsing source code in this Behavior" - ^ PythonParser new \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/printOn..st b/repository/PyPy.package/PythonObject.class/instance/printOn..st deleted file mode 100644 index 90a363f8..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/printOn..st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -printOn: aStream - aStream nextPutAll: (Python builtins str: self) asSmalltalk \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/pyDictKeys.st b/repository/PyPy.package/PythonObject.class/instance/pyDictKeys.st deleted file mode 100644 index 7dc8c256..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/pyDictKeys.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -pyDictKeys - (self hasAttribute: '__dict__') ifTrue: [ ^ self __dict__ keys ]. - ^ #() \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/pyDictValues.st b/repository/PyPy.package/PythonObject.class/instance/pyDictValues.st deleted file mode 100644 index b452c547..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/pyDictValues.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -pyDictValues - (self hasAttribute: '__dict__') ifTrue: [ ^ self __dict__ values ]. - ^ #() \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/pyIdentifier.st b/repository/PyPy.package/PythonObject.class/instance/pyIdentifier.st deleted file mode 100644 index 72d2f4ec..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/pyIdentifier.st +++ /dev/null @@ -1,5 +0,0 @@ -helpers -pyIdentifier - | instID | - instID := self inst_id. - ^ self class __name__, '.instances[', instID, ']'. \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/respondsTo..st b/repository/PyPy.package/PythonObject.class/instance/respondsTo..st deleted file mode 100644 index 6d3339c3..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/respondsTo..st +++ /dev/null @@ -1,6 +0,0 @@ -overrides -respondsTo: aSymbol - "Answer whether the method dictionary of the receiver's class contains - aSymbol as a message selector." - - ^PythonObject canUnderstand: aSymbol \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/shoutParserClass.st b/repository/PyPy.package/PythonObject.class/instance/shoutParserClass.st deleted file mode 100644 index eaf63606..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/shoutParserClass.st +++ /dev/null @@ -1,4 +0,0 @@ -overrides -shoutParserClass - "Answer the parser class" - ^SHParserST80 \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/instance/variablesAndOffsetsDo..st b/repository/PyPy.package/PythonObject.class/instance/variablesAndOffsetsDo..st deleted file mode 100644 index 6caeecb0..00000000 --- a/repository/PyPy.package/PythonObject.class/instance/variablesAndOffsetsDo..st +++ /dev/null @@ -1,10 +0,0 @@ -overrides -variablesAndOffsetsDo: aBinaryBlock - "This is the interface between the compiler and a class's instance or field names. The - class should enumerate aBinaryBlock with the field definitions (with nil offsets) followed - by the instance variable name strings and their integer offsets (1-relative). The order is - important; names evaluated later will override the same names occurring earlier." - - "Only need to do instance variables here. CProtoObject introduces field definitions." - "Nothing to do here; ClassDescription introduces named instance variables" - ^ self \ No newline at end of file diff --git a/repository/PyPy.package/PythonObject.class/methodProperties.json b/repository/PyPy.package/PythonObject.class/methodProperties.json deleted file mode 100644 index b270ca89..00000000 --- a/repository/PyPy.package/PythonObject.class/methodProperties.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "class" : { - "addAndClassifySelector:pyCode:withMethod:inProtocol:notifying:" : "fn 12/19/2016 14:16", - "allInstances" : "fn 12/23/2016 11:17", - "codeAt:ifAbsent:" : "fn 12/19/2016 13:03", - "codeAt:put:" : "fn 12/19/2016 13:02", - "compile:classified:withStamp:notifying:logSource:" : "fn 12/19/2016 14:17", - "compile:notifying:trailer:ifFail:" : "fn 12/19/2016 14:05", - "compiledMethodAt:ifAbsent:" : "fn 12/19/2016 14:06", - "compilerClass" : "fn 12/19/2016 14:06", - "initialize" : "fn 1/18/2017 20:18", - "new" : "fn 12/19/2016 14:14", - "nextID" : "fn 12/18/2016 23:45", - "printString2" : "fn 12/20/2016 19:24", - "pythonInitialize" : "fn 2/23/2017 21:35", - "pythonize" : "fn 12/21/2016 00:15", - "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", - "sourceCodeAt:ifAbsent:" : "fn 12/19/2016 14:07", - "startUp:" : "fn 2/23/2017 21:01", - "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 12/19/2016 14:05", - "withAll2:" : "fn 12/22/2016 15:19", - "withAll3:" : "fn 12/21/2016 14:50", - "withAll:" : "fn 12/22/2016 15:19" }, - "instance" : { - "allAttributes" : "fn 2/26/2017 21:35", - "allInstVarNames" : "fn 12/22/2016 23:20", - "asSmalltalk" : "fn 2/26/2017 21:04", - "at:" : "fn 2/26/2017 20:40", - "at:put:" : "fn 2/26/2017 20:41", - "class" : "fn 2/26/2017 21:41", - "className" : "fn 2/26/2017 22:01", - "defaultLabelForInspector" : "fn 2/26/2017 21:54", - "environment" : "fn 12/22/2016 22:00", - "evaluatorClass" : "fn 12/23/2016 00:01", - "explore" : "fn 2/24/2017 14:51", - "explorerContents" : "fn 2/24/2017 14:55", - "hasAttribute:" : "fn 2/26/2017 21:41", - "hasClass" : "fn 2/26/2017 21:52", - "hasContentsInExplorer" : "fn 12/22/2016 23:11", - "inspect" : "fn 12/22/2016 21:09", - "inspectorClass" : "fn 12/22/2016 21:16", - "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", - "isClass" : "fn 2/26/2017 21:42", - "isKindOf:" : "fn 12/25/2016 14:47", - "isPython" : "fn 2/10/2017 12:12", - "newParser" : "fn 12/22/2016 22:19", - "printOn:" : "fn 2/26/2017 21:33", - "pyDictKeys" : "fn 2/26/2017 21:42", - "pyDictValues" : "fn 2/26/2017 21:42", - "pyIdentifier" : "fn 1/18/2017 17:20", - "respondsTo:" : "fn 12/22/2016 23:36", - "shoutParserClass" : "fn 2/23/2017 22:55", - "variablesAndOffsetsDo:" : "fn 12/22/2016 23:59" } } diff --git a/repository/PyPy.package/PythonObject.class/properties.json b/repository/PyPy.package/PythonObject.class/properties.json deleted file mode 100644 index 747c8eb3..00000000 --- a/repository/PyPy.package/PythonObject.class/properties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - "NextID", - "Code" ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - "pyID" ], - "name" : "PythonObject", - "pools" : [ - ], - "super" : "Object", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonObjectExplorer.class/README.md b/repository/PyPy.package/PythonObjectExplorer.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonObjectExplorer.class/methodProperties.json b/repository/PyPy.package/PythonObjectExplorer.class/methodProperties.json deleted file mode 100644 index 0e4a6622..00000000 --- a/repository/PyPy.package/PythonObjectExplorer.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - } } diff --git a/repository/PyPy.package/PythonObjectExplorer.class/properties.json b/repository/PyPy.package/PythonObjectExplorer.class/properties.json deleted file mode 100644 index 874488b6..00000000 --- a/repository/PyPy.package/PythonObjectExplorer.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonObjectExplorer", - "pools" : [ - ], - "super" : "ObjectExplorer", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonParser.class/README.md b/repository/PyPy.package/PythonParser.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st b/repository/PyPy.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st deleted file mode 100644 index 81a9759f..00000000 --- a/repository/PyPy.package/PythonParser.class/instance/parseCue.noPattern.ifFail..st +++ /dev/null @@ -1,15 +0,0 @@ -as yet unclassified -parseCue: aCue noPattern: noPattern ifFail: aBlock - | methodNode pySource | - pySource := aCue sourceStream upToEnd. - methodNode := self newMethodNode comment: 'Python comment'. - methodNode - selector: (PythonCompiler extractPySelector: pySource) asSymbol - arguments: nil - precedence: nil - temporaries: nil - block: nil - encoder: nil - primitive: nil. - methodNode sourceText: pySource. - ^ methodNode \ No newline at end of file diff --git a/repository/PyPy.package/PythonParser.class/instance/parseSelector..st b/repository/PyPy.package/PythonParser.class/instance/parseSelector..st deleted file mode 100644 index d038bafa..00000000 --- a/repository/PyPy.package/PythonParser.class/instance/parseSelector..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -parseSelector: pyCode - prevEnd := pyCode indexOf: $:. "highlight method signature" - ^ (PythonCompiler extractPySelector: pyCode) asSymbol \ No newline at end of file diff --git a/repository/PyPy.package/PythonParser.class/methodProperties.json b/repository/PyPy.package/PythonParser.class/methodProperties.json deleted file mode 100644 index 108ad532..00000000 --- a/repository/PyPy.package/PythonParser.class/methodProperties.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "parseCue:noPattern:ifFail:" : "fn 12/19/2016 02:18", - "parseSelector:" : "fn 12/19/2016 15:00" } } diff --git a/repository/PyPy.package/PythonParser.class/properties.json b/repository/PyPy.package/PythonParser.class/properties.json deleted file mode 100644 index 1c52cef6..00000000 --- a/repository/PyPy.package/PythonParser.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonParser", - "pools" : [ - ], - "super" : "Parser", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonTest.class/README.md b/repository/PyPy.package/PythonTest.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonTest.class/instance/testIsExpression.st b/repository/PyPy.package/PythonTest.class/instance/testIsExpression.st deleted file mode 100644 index 031b5f8d..00000000 --- a/repository/PyPy.package/PythonTest.class/instance/testIsExpression.st +++ /dev/null @@ -1,10 +0,0 @@ -testing -testIsExpression - self assert: (Python isExpression: '1'). - self assert: (Python isExpression: 'foo()'). - self deny: (Python isExpression: 'x = 1'). - self assert: (Python isExpression: '1 == 1'). - self deny: (Python isExpression: 'def foo(): - return 42'). - self deny: (Python isExpression: 'def foo(): pass'). - self deny: (Python isExpression: 'import os') \ No newline at end of file diff --git a/repository/PyPy.package/PythonTest.class/methodProperties.json b/repository/PyPy.package/PythonTest.class/methodProperties.json deleted file mode 100644 index 05272ef9..00000000 --- a/repository/PyPy.package/PythonTest.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "testIsExpression" : "fn 2/23/2017 21:37" } } diff --git a/repository/PyPy.package/PythonTest.class/properties.json b/repository/PyPy.package/PythonTest.class/properties.json deleted file mode 100644 index d27961de..00000000 --- a/repository/PyPy.package/PythonTest.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy-Tests", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonTest", - "pools" : [ - ], - "super" : "TestCase", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonTestObject.class/README.md b/repository/PyPy.package/PythonTestObject.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonTestObject.class/methodProperties.json b/repository/PyPy.package/PythonTestObject.class/methodProperties.json deleted file mode 100644 index 0e4a6622..00000000 --- a/repository/PyPy.package/PythonTestObject.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - } } diff --git a/repository/PyPy.package/PythonTestObject.class/properties.json b/repository/PyPy.package/PythonTestObject.class/properties.json deleted file mode 100644 index 3b99e330..00000000 --- a/repository/PyPy.package/PythonTestObject.class/properties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - "bar", - "foo" ], - "name" : "PythonTestObject", - "pools" : [ - ], - "super" : "PythonObject", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonTextStyler.class/README.md b/repository/PyPy.package/PythonTextStyler.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st b/repository/PyPy.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st deleted file mode 100644 index e5fb30a3..00000000 --- a/repository/PyPy.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -parseableSourceCodeTemplate - - ^'def method(self, x): - return 2 * x' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTextStyler.class/instance/style..st b/repository/PyPy.package/PythonTextStyler.class/instance/style..st deleted file mode 100644 index da11a0e6..00000000 --- a/repository/PyPy.package/PythonTextStyler.class/instance/style..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -style: aText - Python vmSpeaksPython ifTrue: [^ aText]. - ^ super style: aText \ No newline at end of file diff --git a/repository/PyPy.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st b/repository/PyPy.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st deleted file mode 100644 index 144c0a14..00000000 --- a/repository/PyPy.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -styleInBackgroundProcess: aText - Python vmSpeaksPython ifTrue: [^ aText]. - ^ super styleInBackgroundProcess: aText \ No newline at end of file diff --git a/repository/PyPy.package/PythonTextStyler.class/methodProperties.json b/repository/PyPy.package/PythonTextStyler.class/methodProperties.json deleted file mode 100644 index 1f80923a..00000000 --- a/repository/PyPy.package/PythonTextStyler.class/methodProperties.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "parseableSourceCodeTemplate" : "fn 12/22/2016 15:20", - "style:" : "fn 2/10/2017 14:13", - "styleInBackgroundProcess:" : "fn 2/10/2017 14:13" } } diff --git a/repository/PyPy.package/PythonTextStyler.class/properties.json b/repository/PyPy.package/PythonTextStyler.class/properties.json deleted file mode 100644 index 0531d039..00000000 --- a/repository/PyPy.package/PythonTextStyler.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonTextStyler", - "pools" : [ - ], - "super" : "SHTextStylerST80", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonTheme.class/README.md b/repository/PyPy.package/PythonTheme.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonTheme.class/class/addButtons..st b/repository/PyPy.package/PythonTheme.class/class/addButtons..st deleted file mode 100644 index b8a07702..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/addButtons..st +++ /dev/null @@ -1,26 +0,0 @@ -instance creation -addButtons: theme - "self create apply" - theme - set: #borderColor for: #PluggableButtonMorph to: Color gray; - set: #borderWidth for: #PluggableButtonMorph to: 0; - set: #borderStyle for: #PluggableButtonMorph to: BorderStyle default; - set: #color for: #PluggableButtonMorph to: self backgroundColor lighter; - - set: #font for: #PluggableButtonMorph to: [Preferences standardButtonFont]; - set: #textColor for: #PluggableButtonMorph to: self textColor; - - set: #selectionModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.2] ]; - set: #hoverModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.4] ]; - set: #feedbackModifier for: #PluggableButtonMorph to: [ [:c | c adjustBrightness: 0.6] ]. - - "And the plus-version." - theme - set: #disabledColor for: #PluggableButtonMorphPlus to: Color transparent; - set: #disabledTextColor for: #PluggableButtonMorphPlus to: (Color gray: 0.6). - - "And the three-phase button." - theme - derive: #color for: #ThreePhaseButtonMorph from: #PluggableButtonMorph at: #textColor; - derive: #font for: #ThreePhaseButtonMorph from: #PluggableButtonMorph; - derive: #textColor for: #ThreePhaseButtonMorph from: #PluggableButtonMorph. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addDialogs..st b/repository/PyPy.package/PythonTheme.class/class/addDialogs..st deleted file mode 100644 index 9f20eda6..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/addDialogs..st +++ /dev/null @@ -1,66 +0,0 @@ -instance creation -addDialogs: theme - "self create apply." - - theme - set: #borderColor for: #DialogWindow to: Color gray; - set: #borderWidth for: #DialogWindow to: 1; - set: #borderStyle for: #DialogWindow to: BorderStyle default; - set: #color for: #DialogWindow to: self backgroundColor; - - set: #titleBorderColor for: #DialogWindow to: Color gray; - set: #titleBorderWidth for: #DialogWindow to: 0; - set: #titleBorderStyle for: #DialogWindow to: BorderStyle default; - set: #titleColor for: #DialogWindow to: self highlightColor; - set: #titleFont for: #DialogWindow to: [Preferences windowTitleFont]; - set: #titleTextColor for: #DialogWindow to: self textColor; - - set: #font for: #DialogWindow to: [Preferences standardSystemFont]; - set: #textColor for: #DialogWindow to: self textColor; - - set: #okColor for: #DialogWindow to: self green; - set: #cancelColor for: #DialogWindow to: self red; - set: #buttonColor for: #DialogWindow to: (self backgroundColor adjustBrightness: 0.2); - set: #selectionModifier for: #DialogWindow to: [ [:c | c adjustBrightness: 0.1 ] ]. - - "The List Chooser is a dialog, too." - theme - derive: #okColor for: #ListChooser from: #DialogWindow; - derive: #cancelColor for: #ListChooser from: #DialogWindow; - set: #addColor for: #ListChooser to: Color blue muchLighter; - set: #disabledColor for: #ListChooser to: Color gray. - - "And the mulitple list chooser." - theme - derive: #okColor for: #ListMultipleChooser from: #DialogWindow; - derive: #cancelColor for: #ListMultipleChooser from: #DialogWindow. - - "And the system progress bar." - theme - derive: #borderColor for: #SystemProgressMorph from: #MenuMorph; - derive: #borderWidth for: #SystemProgressMorph from: #MenuMorph; - derive: #borderStyle for: #SystemProgressMorph from: #MenuMorph; - derive: #color for: #SystemProgressMorph from: #MenuMorph; - derive: #font for: #SystemProgressMorph from: #MenuItemMorph; - derive: #textColor for: #SystemProgressMorph from: #MenuItemMorph; - - set: #borderColor for: #SystemProgressBarMorph to: Color transparent; - set: #borderWidth for: #SystemProgressBarMorph to: 0; - set: #borderStyle for: #SystemProgressBarMorph to: BorderStyle default; - set: #color for: #SystemProgressBarMorph to: (Color r: 0.977 g: 0.977 b: 0.977); - set: #barColor for: #SystemProgressBarMorph to: (Color r: 0.72 g: 0.72 b: 0.9). - - "And the balloon morphs." - theme - set: #borderColor for: #NewBalloonMorph to: self highlightColor; - set: #borderWidth for: #NewBalloonMorph to: 1; - set: #color for: #NewBalloonMorph to: self highlightColor; - set: #font for: #NewBalloonMorph to: [Preferences standardBalloonHelpFont]; - derive: #textColor for: #NewBalloonMorph from: #PluggableButtonMorph. - - theme - derive: #borderColor for: #BalloonMorph from: #NewBalloonMorph; - set: #borderWidth for: #BalloonMorph to: 0; - derive: #color for: #BalloonMorph from: #NewBalloonMorph; - derive: #font for: #BalloonMorph from: #NewBalloonMorph; - derive: #textColor for: #BalloonMorph from: #NewBalloonMorph. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addFonts..st b/repository/PyPy.package/PythonTheme.class/class/addFonts..st deleted file mode 100644 index 10b1accd..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/addFonts..st +++ /dev/null @@ -1,14 +0,0 @@ -instance creation -addFonts: theme - - theme - set: #balloonHelpFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7); - set: #standardButtonFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7); - set: #standardCodeFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); - set: #standardDefaultTextFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); - set: #standardFlapFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 7 emphasized: TextEmphasis bold emphasisCode); - set: #haloLabelFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); - set: #standardListFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); - set: #standardMenuFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); - set: #standardSystemFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9); - set: #windowTitleFont to: (StrikeFont familyName: 'Bitmap DejaVu Sans' pointSize: 9 emphasized: TextEmphasis bold emphasisCode). diff --git a/repository/PyPy.package/PythonTheme.class/class/addMenusAndDockingBars..st b/repository/PyPy.package/PythonTheme.class/class/addMenusAndDockingBars..st deleted file mode 100644 index 7e248501..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/addMenusAndDockingBars..st +++ /dev/null @@ -1,44 +0,0 @@ -instance creation -addMenusAndDockingBars: theme - "self create apply" - theme - set: #borderColor for: #MenuMorph to: Color gray; - set: #borderWidth for: #MenuMorph to: 1; - set: #borderStyle for: #MenuMorph to: BorderStyle default; - set: #color for: #MenuMorph to: self backgroundColor; - - set: #titleBorderColor for: #MenuMorph to: self backgroundColor darker; - set: #titleBorderWidth for: #MenuMorph to: 0; - set: #titleBorderStyle for: #MenuMorph to: BorderStyle default; - set: #titleColor for: #MenuMorph to: Color transparent; - set: #titleFont for: #MenuMorph to: [Preferences windowTitleFont]; - set: #titleTextColor for: #MenuMorph to: self textColor; - - set: #lineColor for: #MenuMorph to: self backgroundColor darker; - set: #lineStyle for: #MenuMorph to: BorderStyle simple; - set: #lineWidth for: #MenuMorph to: 1. - - theme - set: #font for: #MenuItemMorph to: [Preferences standardMenuFont]; - set: #textColor for: #MenuItemMorph to: self unfocusedLabelColor; - set: #disabledTextColor for: #MenuItemMorph to: Color gray; - set: #selectionColor for: #MenuItemMorph to: self backgroundColor lighter lighter; - set: #selectionTextColor for: #MenuItemMorph to: self textColor. - - "Derive some stuff for the docking bar morph, which looks mostly like a menu morph." - theme - set: #borderWidth for: #DockingBarMorph to: 0; - derive: #borderColor for: #DockingBarMorph from: #MenuMorph; - derive: #borderStyle for: #DockingBarMorph from: #MenuMorph; - derive: #color for: #DockingBarMorph from: #MenuMorph; - - derive: #lineColor for: #DockingBarMorph from: #MenuMorph; - derive: #lineStyle for: #DockingBarMorph from: #MenuMorph; - derive: #lineWidth for: #DockingBarMorph from: #MenuMorph. - - "The world main docking bar." - theme - derive: #font for: #TheWorldMainDockingBar from: #MenuItemMorph; - derive: #textColor for: #TheWorldMainDockingBar from: #MenuItemMorph; - set: #logoColor for: #TheWorldMainDockingBar to: self textColor; - set: #selectionLogoColor for: #TheWorldMainDockingBar to: Color white. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addScrollables..st b/repository/PyPy.package/PythonTheme.class/class/addScrollables..st deleted file mode 100644 index ab98b1e2..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/addScrollables..st +++ /dev/null @@ -1,71 +0,0 @@ -instance creation -addScrollables: theme - "self create apply" - - "Sliders" - theme - set: #borderColor for: #Slider to: Color gray; - set: #borderWidth for: #Slider to: 0; - set: #color for: #Slider to: Color lightGray; - set: #thumbBorderColor for: #Slider to: [Color gray: 0.6]; - set: #thumbBorderWidth for: #Slider to: 0; - set: #thumbColor for: #Slider to: Color veryVeryLightGray; - set: #thumbShadowModifier for: #Slider to: [ [:c | c alpha: 0.7] ]. - - "Scroll bars" - theme - set: #thumbBorderWidth for: #ScrollBar to: 0; - set: #thumbColorModifier for: #ScrollBar to: [ [:c | c] ]; - set: #pagingAreaColorModifier for: #ScrollBar to: [ [:c | c darker alpha: -0.35] ]; - set: #borderColorModifier for: #ScrollBar to: [ [:c | c adjustBrightness: -0.1] ]. - - "Scroll panes (includes generic stuff for list widgets, tree widgets, and text widgets." - theme - set: #borderColor for: #ScrollPane to: (Color gray: 0.6); - set: #borderWidth for: #ScrollPane to: 0; - set: #borderStyle for: #ScrollPane to: BorderStyle default; - set: #color for: #ScrollPane to: self backgroundColor. - - "List widgets" - theme - set: #font for: #PluggableListMorph to: [Preferences standardListFont]; - set: #textColor for: #PluggableListMorph to: self unfocusedLabelColor; - set: #selectionColor for: #PluggableListMorph to: self backgroundColor lighter lighter; - derive: #multiSelectionColor for: #PluggableListMorph from: #PluggableListMorph at: #selectionColor do: [:c | c lighter]; - set: #selectionTextColor for: #PluggableListMorph to: self textColor; - set: #filterColor for: #PluggableListMorph to: Color transparent; - set: #filterTextColor for: #PluggableListMorph to: self highlightColor; - set: #preSelectionModifier for: #PluggableListMorph to: [ [:c | Color gray: 0.9] ]; - set: #hoverSelectionModifier for: #PluggableListMorph to: [ [:c | c darker alpha: 0.3] ]. - - "Tree widgets" - theme - derive: #font for: #SimpleHierarchicalListMorph from: #PluggableListMorph; - derive: #textColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; - derive: #selectionColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; - derive: #selectionTextColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; - derive: #filterColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; - derive: #filterTextColor for: #SimpleHierarchicalListMorph from: #PluggableListMorph; - derive: #hoverSelectionModifier for: #SimpleHierarchicalListMorph from: #PluggableListMorph; - - set: #higlightTextColor for: #SimpleHierarchicalListMorph to: Color red; - set: #lineColor for: #SimpleHierarchicalListMorph to: Color veryLightGray. - - "Text widgets" - theme - set: #font for: #PluggableTextMorph to: [Preferences standardDefaultTextFont]; - set: #textColor for: #PluggableTextMorph to: self textColor; - set: #caretColor for: #PluggableTextMorph to: Color red; - set: #selectionColor for: #PluggableTextMorph to: self textSelectionColor; - set: #unfocusedSelectionModifier for: #PluggableTextMorph to: [[:c | self textSelectionColor ]]; - set: #adornmentReadOnly for: #PluggableTextMorph to: Color black; - set: #adornmentRefuse for: #PluggableTextMorph to: Color tan; - set: #adornmentConflict for: #PluggableTextMorph to: Color red; - set: #adornmentDiff for: #PluggableTextMorph to: Color green; - set: #adornmentNormalEdit for: #PluggableTextMorph to: Color orange; - set: #adornmentDiffEdit for: #PluggableTextMorph to: Color yellow; - set: #frameAdornmentWidth for: #PluggableTextMorph to: 1. - theme - set: #stylerClass for: #PluggableTextMorphPlus to: PythonTextStyler; - set: #balloonTextColor for: #PluggableTextMorphPlus to: (Color gray: 0.7); - derive: #balloonTextFont for: #PluggableTextMorphPlus from: #PluggableTextMorph at: #font. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addSyntaxHighlighting..st b/repository/PyPy.package/PythonTheme.class/class/addSyntaxHighlighting..st deleted file mode 100644 index fae0387d..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/addSyntaxHighlighting..st +++ /dev/null @@ -1,123 +0,0 @@ -instance creation -addSyntaxHighlighting: theme - "self create apply." - theme - set: #color for: #TextAction to: self blue; - - set: #default for: #SHTextStylerST80 to: {self foregroundColor}; - set: #invalid for: #SHTextStylerST80 to: {self red}; - set: #excessCode for: #SHTextStylerST80 to: {self red}; - set: #comment for: #SHTextStylerST80 to: {self commentColor}; - set: #unfinishedComment for: #SHTextStylerST80 to: {self red. TextEmphasis italic}; - set: #'$' for: #SHTextStylerST80 to: {self red}; - set: #character for: #SHTextStylerST80 to: {self numberColor}; - set: #integer for: #SHTextStylerST80 to: {self numberColor}; - set: #number for: #SHTextStylerST80 to: {self numberColor}; - set: #- for: #SHTextStylerST80 to: {self red}; - set: #symbol for: #SHTextStylerST80 to: {self blue}; - set: #stringSymbol for: #SHTextStylerST80 to: {self blue}; - set: #literalArray for: #SHTextStylerST80 to: {self blue}; - set: #string for: #SHTextStylerST80 to: {self stringColor. TextEmphasis normal}; - set: #unfinishedString for: #SHTextStylerST80 to: {self red. TextEmphasis normal}; - set: #assignment for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; - set: #ansiAssignment for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; - set: #literal for: #SHTextStylerST80 to: {nil. TextEmphasis italic}; - set: #keyword for: #SHTextStylerST80 to: {self blue}; - set: #binary for: #SHTextStylerST80 to: {self blue}; - set: #unary for: #SHTextStylerST80 to: {self blue}; - set: #incompleteKeyword for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; - set: #incompleteBinary for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; - set: #incompleteUnary for: #SHTextStylerST80 to: {self foregroundColor. TextEmphasis underlined}; - set: #undefinedKeyword for: #SHTextStylerST80 to: {self red}; - set: #undefinedBinary for: #SHTextStylerST80 to: {self red}; - set: #undefinedUnary for: #SHTextStylerST80 to: {self red}; - set: #patternKeyword for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; - set: #patternBinary for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; - set: #patternUnary for: #SHTextStylerST80 to: {nil. TextEmphasis bold}; - set: #self for: #SHTextStylerST80 to: {self red}; - set: #super for: #SHTextStylerST80 to: {self red}; - set: #true for: #SHTextStylerST80 to: {self red}; - set: #false for: #SHTextStylerST80 to: {self red}; - set: #nil for: #SHTextStylerST80 to: {self red}; - set: #thisContext for: #SHTextStylerST80 to: {self red}; - set: #return for: #SHTextStylerST80 to: {self red}; - set: #patternArg for: #SHTextStylerST80 to: {self blue}; - set: #methodArg for: #SHTextStylerST80 to: {self blue}; - set: #blockPatternArg for: #SHTextStylerST80 to: {self blue}; - set: #blockArg for: #SHTextStylerST80 to: {self blue}; - set: #argument for: #SHTextStylerST80 to: {self blue}; - set: #blockArgColon for: #SHTextStylerST80 to: {self foregroundColor}; - set: #leftParenthesis for: #SHTextStylerST80 to: {self foregroundColor}; - set: #rightParenthesis for: #SHTextStylerST80 to: {self foregroundColor}; - set: #leftParenthesis1 for: #SHTextStylerST80 to: {self green}; - set: #rightParenthesis1 for: #SHTextStylerST80 to: {self green}; - set: #leftParenthesis2 for: #SHTextStylerST80 to: {self magenta}; - set: #rightParenthesis2 for: #SHTextStylerST80 to: {self magenta}; - set: #leftParenthesis3 for: #SHTextStylerST80 to: {self red}; - set: #rightParenthesis3 for: #SHTextStylerST80 to: {self red}; - set: #leftParenthesis4 for: #SHTextStylerST80 to: {self green}; - set: #rightParenthesis4 for: #SHTextStylerST80 to: {self green}; - set: #leftParenthesis5 for: #SHTextStylerST80 to: {self orange}; - set: #rightParenthesis5 for: #SHTextStylerST80 to: {self orange}; - set: #leftParenthesis6 for: #SHTextStylerST80 to: {self magenta}; - set: #rightParenthesis6 for: #SHTextStylerST80 to: {self magenta}; - set: #leftParenthesis7 for: #SHTextStylerST80 to: {self blue}; - set: #rightParenthesis7 for: #SHTextStylerST80 to: {self blue}; - set: #blockStart for: #SHTextStylerST80 to: {self foregroundColor}; - set: #blockEnd for: #SHTextStylerST80 to: {self foregroundColor}; - set: #blockStart1 for: #SHTextStylerST80 to: {self green}; - set: #blockEnd1 for: #SHTextStylerST80 to: {self green}; - set: #blockStart2 for: #SHTextStylerST80 to: {self magenta}; - set: #blockEnd2 for: #SHTextStylerST80 to: {self magenta}; - set: #blockStart3 for: #SHTextStylerST80 to: {self red}; - set: #blockEnd3 for: #SHTextStylerST80 to: {self red}; - set: #blockStart4 for: #SHTextStylerST80 to: {self green}; - set: #blockEnd4 for: #SHTextStylerST80 to: {self green}; - set: #blockStart5 for: #SHTextStylerST80 to: {self orange}; - set: #blockEnd5 for: #SHTextStylerST80 to: {self orange}; - set: #blockStart6 for: #SHTextStylerST80 to: {self magenta}; - set: #blockEnd6 for: #SHTextStylerST80 to: {self magenta}; - set: #blockStart7 for: #SHTextStylerST80 to: {self blue}; - set: #blockEnd7 for: #SHTextStylerST80 to: {self blue}; - set: #arrayStart for: #SHTextStylerST80 to: {self foregroundColor}; - set: #arrayEnd for: #SHTextStylerST80 to: {self foregroundColor}; - set: #arrayStart1 for: #SHTextStylerST80 to: {self foregroundColor}; - set: #arrayEnd1 for: #SHTextStylerST80 to: {self foregroundColor}; - set: #byteArrayStart for: #SHTextStylerST80 to: {self foregroundColor}; - set: #byteArrayEnd for: #SHTextStylerST80 to: {self foregroundColor}; - set: #byteArrayStart1 for: #SHTextStylerST80 to: {self foregroundColor}; - set: #byteArrayEnd1 for: #SHTextStylerST80 to: {self foregroundColor}; - set: #leftBrace for: #SHTextStylerST80 to: {self foregroundColor}; - set: #rightBrace for: #SHTextStylerST80 to: {self foregroundColor}; - set: #cascadeSeparator for: #SHTextStylerST80 to: {self foregroundColor}; - set: #statementSeparator for: #SHTextStylerST80 to: {self foregroundColor}; - set: #externalCallType for: #SHTextStylerST80 to: {self foregroundColor}; - set: #externalCallTypePointerIndicator for: #SHTextStylerST80 to: {self foregroundColor}; - set: #primitiveOrExternalCallStart for: #SHTextStylerST80 to: {self foregroundColor}; - set: #primitiveOrExternalCallEnd for: #SHTextStylerST80 to: {self foregroundColor}; - set: #methodTempBar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #blockTempBar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #blockArgsBar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #primitive for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; - set: #pragmaKeyword for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; - set: #pragmaUnary for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; - set: #pragmaBinary for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; - set: #externalFunctionCallingConvention for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; - set: #module for: #SHTextStylerST80 to: {self green. TextEmphasis bold}; - set: #blockTempVar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #blockPatternTempVar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #instVar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #workspaceVar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #undefinedIdentifier for: #SHTextStylerST80 to: {self red}; - set: #incompleteIdentifier for: #SHTextStylerST80 to: {self foregroundColor. {TextEmphasis italic. TextEmphasis underlined}}; - set: #tempVar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #patternTempVar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #poolConstant for: #SHTextStylerST80 to: {self foregroundColor}; - set: #classVar for: #SHTextStylerST80 to: {self foregroundColor}; - set: #globalVar for: #SHTextStylerST80 to: {self foregroundColor}. - - "And the text differ" - theme - set: #insertTextAttributes for: #TextDiffBuilder to: { TextColor color: self red }; - set: #removeTextAttributes for: #TextDiffBuilder to: { TextEmphasis struckOut. TextColor color: self blue }; - set: #normalTextAttributes for: #TextDiffBuilder to: { TextEmphasis normal }. \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addToolColors..st b/repository/PyPy.package/PythonTheme.class/class/addToolColors..st deleted file mode 100644 index 4f2a299c..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/addToolColors..st +++ /dev/null @@ -1,21 +0,0 @@ -instance creation -addToolColors: theme - "Tool-specific colors." - - "SUnit's TestRunner." - theme - set: #failureColor for: #TestRunner to: self yellow; - set: #errorColor for: #TestRunner to: self red; - set: #passColor for: #TestRunner to: self green; - - derive: #failureTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor; - derive: #errorTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor; - derive: #passTextColor for: #TestRunner from: #PluggableTextMorph at: #textColor. - - "Monticello Tools." - theme - set: #revertedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis struckOut}; - set: #ignoredOperationAttributes for: #MCOperationsBrowser to: {TextColor color: Color gray}. - "set: #rejectedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis struckOut}; - set: #acceptedOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis underlined}; - set: #conflictingOperationAttributes for: #MCOperationsBrowser to: {TextEmphasis bold}." \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/addWindowColors..st b/repository/PyPy.package/PythonTheme.class/class/addWindowColors..st deleted file mode 100644 index a2546d93..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/addWindowColors..st +++ /dev/null @@ -1,42 +0,0 @@ -instance creation -addWindowColors: theme - "self create apply" - theme - set: #titleFont for: #SystemWindow to: [Preferences windowTitleFont]; - set: #borderColorModifier for: #SystemWindow to: [ [:c | c adjustBrightness: -0.2] ]; - set: #borderWidth for: #SystemWindow to: 0; - - set: #uniformWindowColor for: #Model to: self windowColor; - derive: #uniformWindowColor for: #TranscriptStream from: #Model; - derive: #color for: #SystemWindow from: #Model at: #uniformWindowColor; "Fall back for windows without models." - - set: #unfocusedWindowColorModifier for: #SystemWindow to: [ [:color | color darker] ]; - set: #unfocusedLabelColor for: #SystemWindow to: self unfocusedLabelColor; - set: #focusedLabelColor for: #SystemWindow to: self focusedLabelColor; - - set: #customWindowColor for: #Browser to: (Color r: 0.764 g: 0.9 b: 0.63); - set: #customWindowColor for: #ChangeList to: (Color r: 0.719 g: 0.9 b: 0.9); - set: #customWindowColor for: #ChangeSorter to: (Color r: 0.719 g: 0.9 b: 0.9); - set: #customWindowColor for: #ChatNotes to: (Color r: 1.0 g: 0.7 b: 0.8); - set: #customWindowColor for: #ClassCommentVersionsBrowser to: (Color r: 0.753 g: 0.677 b: 0.9); - set: #customWindowColor for: #Debugger to: (Color r: 0.9 g: 0.719 b: 0.719); - set: #customWindowColor for: #DualChangeSorter to: (Color r: 0.719 g: 0.9 b: 0.9); - set: #customWindowColor for: #FileContentsBrowser to: (Color r: 0.7 g: 0.7 b: 0.508); - set: #customWindowColor for: #FileList to: (Color r: 0.65 g: 0.65 b: 0.65); - set: #customWindowColor for: #InstanceBrowser to: (Color r: 0.726 g: 0.9 b: 0.9); - set: #customWindowColor for: #Lexicon to: (Color r: 0.79 g: 0.9 b: 0.79); - set: #customWindowColor for: #MCTool to: (Color r: 0.65 g: 0.691 b: 0.876); - set: #customWindowColor for: #MessageNames to: (Color r: 0.639 g: 0.9 b: 0.497); - set: #customWindowColor for: #MessageSet to: (Color r: 0.719 g: 0.9 b: 0.9); - set: #customWindowColor for: #PackagePaneBrowser to: (Color r: 0.9 g: 0.9 b: 0.63); - set: #customWindowColor for: #PluggableFileList to: Color lightYellow; - set: #customWindowColor for: #PreferenceBrowser to: (Color r: 0.671 g: 0.9 b: 0.9); - set: #customWindowColor for: #SMLoader to: (Color r: 0.801 g: 0.801 b: 0.614); - set: #customWindowColor for: #SMLoaderPlus to: (Color r: 0.801 g: 0.801 b: 0.614); - set: #customWindowColor for: #SMReleaseBrowser to: (Color r: 0.801 g: 0.801 b: 0.614); - set: #customWindowColor for: #ScriptingDomain to: (Color r: 0.91 g: 0.91 b: 0.91); - set: #customWindowColor for: #SelectorBrowser to: (Color r: 0.45 g: 0.9 b: 0.9); - set: #customWindowColor for: #StringHolder to: (Color r: 0.9 g: 0.9 b: 0.719); - set: #customWindowColor for: #TestRunner to: (Color r: 0.9 g: 0.576 b: 0.09); - set: #customWindowColor for: #TranscriptStream to: (Color r: 0.9 g: 0.75 b: 0.45); - set: #customWindowColor for: #VersionsBrowser to: (Color r: 0.782 g: 0.677 b: 0.9). \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/argumentColor.st b/repository/PyPy.package/PythonTheme.class/class/argumentColor.st deleted file mode 100644 index d27e34d2..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/argumentColor.st +++ /dev/null @@ -1,4 +0,0 @@ -monokai -argumentColor - - ^ Color fromString: '#FD971F' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/backgroundColor.st b/repository/PyPy.package/PythonTheme.class/class/backgroundColor.st deleted file mode 100644 index 1816569b..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/backgroundColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -backgroundColor - ^ Color fromString: '#2e2e2e' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/backgroundForm.st b/repository/PyPy.package/PythonTheme.class/class/backgroundForm.st deleted file mode 100644 index c74e0cab..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/backgroundForm.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -backgroundForm - - ^ (Form extent: 10@10 depth: 32) collectColors: [:c | self backgroundColor] \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/blue.st b/repository/PyPy.package/PythonTheme.class/class/blue.st deleted file mode 100644 index 06beb404..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/blue.st +++ /dev/null @@ -1,4 +0,0 @@ -monokai -blue - - ^ self globalColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/builtinConstColor.st b/repository/PyPy.package/PythonTheme.class/class/builtinConstColor.st deleted file mode 100644 index b0e68d70..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/builtinConstColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -builtinConstColor - ^ self numberColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/commentColor.st b/repository/PyPy.package/PythonTheme.class/class/commentColor.st deleted file mode 100644 index f9d496e9..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/commentColor.st +++ /dev/null @@ -1,4 +0,0 @@ -monokai -commentColor - - ^ Color fromString: '#75715E' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/create.st b/repository/PyPy.package/PythonTheme.class/class/create.st deleted file mode 100644 index 4fa1a566..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/create.st +++ /dev/null @@ -1,27 +0,0 @@ -instance creation -create - "self create apply." - - ^ (self named: 'Python') in: [:theme | - "General morph stuff." - theme - set: #keyboardFocusColor for: #Morph to: self highlightColor; - set: #keyboardFocusWidth for: #Morph to: 1; - set: #softShadowColor for: #Morph to: (Color black alpha: 0.01); - set: #softShadowOffset for: #Morph to: (10@8 corner: 10@12); - set: #hardShadowColor for: #Morph to: (Color black alpha: 0.5); - set: #hardShadowOffset for: #Morph to: 1@1. - - theme set: #background for: #MorphicProject to: self backgroundForm. - - self - addFonts: theme; - addWindowColors: theme; - addSyntaxHighlighting: theme; - addMenusAndDockingBars: theme; - addDialogs: theme; - addButtons: theme; - addScrollables: theme; - addToolColors: theme. - - theme] \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/focusedLabelColor.st b/repository/PyPy.package/PythonTheme.class/class/focusedLabelColor.st deleted file mode 100644 index 2d805d08..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/focusedLabelColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -focusedLabelColor - ^ self textColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/foregroundColor.st b/repository/PyPy.package/PythonTheme.class/class/foregroundColor.st deleted file mode 100644 index d47441d4..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/foregroundColor.st +++ /dev/null @@ -1,4 +0,0 @@ -monokai -foregroundColor - - ^ Color fromString: '#F8F8F2' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/globalColor.st b/repository/PyPy.package/PythonTheme.class/class/globalColor.st deleted file mode 100644 index 273d0edc..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/globalColor.st +++ /dev/null @@ -1,5 +0,0 @@ -monokai -globalColor - "library function, library constant, library class type, ..." - - ^ Color fromString: '#66D9EF' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/green.st b/repository/PyPy.package/PythonTheme.class/class/green.st deleted file mode 100644 index 0e0f4d71..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/green.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -green - ^ Color fromString: '#A6E22E' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/highlightColor.st b/repository/PyPy.package/PythonTheme.class/class/highlightColor.st deleted file mode 100644 index 1470de49..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/highlightColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -highlightColor - ^ Color fromString: '#6c98bc' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/keywordColor.st b/repository/PyPy.package/PythonTheme.class/class/keywordColor.st deleted file mode 100644 index 701ac7db..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/keywordColor.st +++ /dev/null @@ -1,5 +0,0 @@ -monokai -keywordColor - "tag name, invalid background, ..." - - ^ Color fromString: '#F92672' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/magenta.st b/repository/PyPy.package/PythonTheme.class/class/magenta.st deleted file mode 100644 index acf0463e..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/magenta.st +++ /dev/null @@ -1,4 +0,0 @@ -monokai -magenta - - ^ self keywordColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/numberColor.st b/repository/PyPy.package/PythonTheme.class/class/numberColor.st deleted file mode 100644 index 01455b39..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/numberColor.st +++ /dev/null @@ -1,6 +0,0 @@ -monokai -numberColor - "Constant, invalid deprecated background, ..." - "purple" - - ^ Color fromString: '#AE81FF' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/orange.st b/repository/PyPy.package/PythonTheme.class/class/orange.st deleted file mode 100644 index fba82a04..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/orange.st +++ /dev/null @@ -1,4 +0,0 @@ -monokai -orange - - ^ self argumentColor \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/red.st b/repository/PyPy.package/PythonTheme.class/class/red.st deleted file mode 100644 index 5d595521..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/red.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -red - ^ Color fromString: '#dc322f' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/stringColor.st b/repository/PyPy.package/PythonTheme.class/class/stringColor.st deleted file mode 100644 index 5607b46a..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/stringColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -stringColor - ^ Color fromString: '#e5b567' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/textColor.st b/repository/PyPy.package/PythonTheme.class/class/textColor.st deleted file mode 100644 index 3b3c57d4..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/textColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -textColor - ^ Color fromString: '#e8e8e8' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/textSelectionColor.st b/repository/PyPy.package/PythonTheme.class/class/textSelectionColor.st deleted file mode 100644 index aad60f29..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/textSelectionColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -textSelectionColor - ^ Color fromString: '#5a637f' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/unfocusedLabelColor.st b/repository/PyPy.package/PythonTheme.class/class/unfocusedLabelColor.st deleted file mode 100644 index 3f05d9a6..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/unfocusedLabelColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -unfocusedLabelColor - ^ Color fromString: '#747474' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/variableColor.st b/repository/PyPy.package/PythonTheme.class/class/variableColor.st deleted file mode 100644 index f360681d..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/variableColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -variableColor - ^ Color fromString: '#E87D3E' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/windowColor.st b/repository/PyPy.package/PythonTheme.class/class/windowColor.st deleted file mode 100644 index 244d2d1f..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/windowColor.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -windowColor - ^ Color fromString: '#1e1e1e' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/class/yellow.st b/repository/PyPy.package/PythonTheme.class/class/yellow.st deleted file mode 100644 index 154f2107..00000000 --- a/repository/PyPy.package/PythonTheme.class/class/yellow.st +++ /dev/null @@ -1,3 +0,0 @@ -colors -yellow - ^ Color fromString: '#b58900' \ No newline at end of file diff --git a/repository/PyPy.package/PythonTheme.class/methodProperties.json b/repository/PyPy.package/PythonTheme.class/methodProperties.json deleted file mode 100644 index 149ff0cb..00000000 --- a/repository/PyPy.package/PythonTheme.class/methodProperties.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "class" : { - "addButtons:" : "fn 2/21/2017 18:30", - "addDialogs:" : "fn 2/21/2017 18:33", - "addFonts:" : "fn 2/10/2017 10:26", - "addMenusAndDockingBars:" : "fn 2/10/2017 14:23", - "addScrollables:" : "fn 2/10/2017 12:28", - "addSyntaxHighlighting:" : "fn 2/10/2017 14:03", - "addToolColors:" : "fn 2/10/2017 11:58", - "addWindowColors:" : "fn 2/10/2017 11:59", - "argumentColor" : "fn 2/10/2017 14:04", - "backgroundColor" : "fn 2/10/2017 11:00", - "backgroundForm" : "fn 2/10/2017 11:02", - "blue" : "fn 2/10/2017 14:03", - "builtinConstColor" : "fn 2/10/2017 10:59", - "commentColor" : "fn 2/10/2017 14:02", - "create" : "fn 2/10/2017 11:51", - "focusedLabelColor" : "fn 2/10/2017 11:18", - "foregroundColor" : "fn 2/10/2017 14:02", - "globalColor" : "fn 2/10/2017 14:02", - "green" : "fn 2/10/2017 11:57", - "highlightColor" : "fn 2/10/2017 11:32", - "keywordColor" : "fn 2/10/2017 14:03", - "magenta" : "fn 2/10/2017 14:03", - "numberColor" : "fn 2/10/2017 14:02", - "orange" : "fn 2/10/2017 14:04", - "red" : "fn 2/10/2017 11:58", - "stringColor" : "fn 2/10/2017 10:58", - "textColor" : "fn 2/10/2017 11:18", - "textSelectionColor" : "fn 2/10/2017 11:35", - "unfocusedLabelColor" : "fn 2/10/2017 11:10", - "variableColor" : "fn 2/10/2017 10:59", - "windowColor" : "fn 2/10/2017 11:02", - "yellow" : "fn 2/10/2017 11:58" }, - "instance" : { - } } diff --git a/repository/PyPy.package/PythonTheme.class/properties.json b/repository/PyPy.package/PythonTheme.class/properties.json deleted file mode 100644 index 2241b13d..00000000 --- a/repository/PyPy.package/PythonTheme.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonTheme", - "pools" : [ - ], - "super" : "UserInterfaceTheme", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonToolSet.class/README.md b/repository/PyPy.package/PythonToolSet.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st b/repository/PyPy.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st deleted file mode 100644 index 28b99062..00000000 --- a/repository/PyPy.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -debug: aProcess context: aContext label: aString contents: contents fullView: aBool - "Open a debugger on the given process and context." - ^PythonDebugger openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/class/explore..st b/repository/PyPy.package/PythonToolSet.class/class/explore..st deleted file mode 100644 index 1cf1e9f3..00000000 --- a/repository/PyPy.package/PythonToolSet.class/class/explore..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -explore: anObject - - ^ PythonObjectExplorer openOn: anObject \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/class/initialize.st b/repository/PyPy.package/PythonToolSet.class/class/initialize.st deleted file mode 100644 index 8e7d4079..00000000 --- a/repository/PyPy.package/PythonToolSet.class/class/initialize.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -initialize - ToolSet register: self. \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/class/inspectorClassOf..st b/repository/PyPy.package/PythonToolSet.class/class/inspectorClassOf..st deleted file mode 100644 index 7db45e24..00000000 --- a/repository/PyPy.package/PythonToolSet.class/class/inspectorClassOf..st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -inspectorClassOf: anObject - ^ PythonInspector \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/class/interrupt.label..st b/repository/PyPy.package/PythonToolSet.class/class/interrupt.label..st deleted file mode 100644 index 87ff8543..00000000 --- a/repository/PyPy.package/PythonToolSet.class/class/interrupt.label..st +++ /dev/null @@ -1,8 +0,0 @@ -as yet unclassified -interrupt: aProcess label: aString - "Open a PythonDebugger if none exists" - ActiveWorld submorphs detect: [ :ea | ea isSystemWindow and: [ ea model class == PythonDebugger ]] - ifFound: [ super interrupt: aProcess label: aString ] - ifNone: [ PythonDebugger - openInterrupt: aString - onProcess: aProcess ] \ No newline at end of file diff --git a/repository/PyPy.package/PythonToolSet.class/methodProperties.json b/repository/PyPy.package/PythonToolSet.class/methodProperties.json deleted file mode 100644 index db6c7057..00000000 --- a/repository/PyPy.package/PythonToolSet.class/methodProperties.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "class" : { - "debug:context:label:contents:fullView:" : "fn 1/19/2017 11:56", - "explore:" : "fn 2/24/2017 14:51", - "initialize" : "fn 1/16/2017 18:52", - "inspectorClassOf:" : "fn 12/22/2016 21:11", - "interrupt:label:" : "fn 1/18/2017 15:08" }, - "instance" : { - } } diff --git a/repository/PyPy.package/PythonToolSet.class/properties.json b/repository/PyPy.package/PythonToolSet.class/properties.json deleted file mode 100644 index ba3a5ee1..00000000 --- a/repository/PyPy.package/PythonToolSet.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonToolSet", - "pools" : [ - ], - "super" : "StandardToolSet", - "type" : "normal" } diff --git a/repository/PyPy.package/PythonWorkspace.class/README.md b/repository/PyPy.package/PythonWorkspace.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/PythonWorkspace.class/class/open.st b/repository/PyPy.package/PythonWorkspace.class/class/open.st deleted file mode 100644 index 19ea69f8..00000000 --- a/repository/PyPy.package/PythonWorkspace.class/class/open.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -open - ^ (Smalltalk at: #PythonWorkspace ifAbsent:[self]) new openLabel: 'Python Workspace' diff --git a/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st b/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st deleted file mode 100644 index 2e821c0a..00000000 --- a/repository/PyPy.package/PythonWorkspace.class/instance/evaluateExpression..st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -evaluateExpression: selection - ^ Python prun: selection asString \ No newline at end of file diff --git a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json b/repository/PyPy.package/PythonWorkspace.class/methodProperties.json deleted file mode 100644 index 78860339..00000000 --- a/repository/PyPy.package/PythonWorkspace.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - "open" : "fn 12/22/2016 02:51" }, - "instance" : { - "evaluateExpression:" : "fn 2/23/2017 21:21" } } diff --git a/repository/PyPy.package/PythonWorkspace.class/properties.json b/repository/PyPy.package/PythonWorkspace.class/properties.json deleted file mode 100644 index 7659caf8..00000000 --- a/repository/PyPy.package/PythonWorkspace.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "PyPy", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonWorkspace", - "pools" : [ - ], - "super" : "Workspace", - "type" : "normal" } diff --git a/repository/PyPy.package/monticello.meta/categories.st b/repository/PyPy.package/monticello.meta/categories.st deleted file mode 100644 index b5b0f236..00000000 --- a/repository/PyPy.package/monticello.meta/categories.st +++ /dev/null @@ -1,2 +0,0 @@ -SystemOrganization addCategory: #PyPy! -SystemOrganization addCategory: #'PyPy-Tests'! diff --git a/repository/PyPy.package/monticello.meta/initializers.st b/repository/PyPy.package/monticello.meta/initializers.st deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/PyPy.package/monticello.meta/package b/repository/PyPy.package/monticello.meta/package deleted file mode 100644 index f4b92461..00000000 --- a/repository/PyPy.package/monticello.meta/package +++ /dev/null @@ -1 +0,0 @@ -(name 'PyPy') \ No newline at end of file diff --git a/repository/PyPy.package/monticello.meta/version b/repository/PyPy.package/monticello.meta/version deleted file mode 100644 index e1629a44..00000000 --- a/repository/PyPy.package/monticello.meta/version +++ /dev/null @@ -1 +0,0 @@ -(name 'PyPy-fn.12' message 'Updates' id 'f3b97d42-56d6-4f59-9da3-2493cbe1fdaf' date '26 February 2017' time '10:09:08.470218 pm' author 'fn' ancestors ((name 'PyPy-fn.11' message 'Add examples; minor bugfixes' id 'a852e871-13f5-497e-ae53-ae98c9316e6b' date '23 February 2017' time '6:08:59.626935 pm' author 'fn' ancestors ((name 'PyPy-fn.10' message 'Updates' id '756686b6-8c03-4a9c-a74f-cc14c1175d12' date '23 February 2017' time '1:23:47.638052 pm' author 'fn' ancestors ((name 'PyPy-fn.9' message 'Fix Python class>>resumeFrame; remove deprecated methods; improve theme' id '41b4e13b-2de2-40f5-afa9-b086f1f21be4' date '21 February 2017' time '10:14:39.643391 pm' author 'fn' ancestors ((name 'PyPy-fn.8' message 'Add Monokai-based PythonTheme; minor bugfixes and improvements' id '8522326f-04f2-489d-8de0-918acd7fe1e3' date '10 February 2017' time '2:25:13.165264 pm' author 'fn' ancestors ((name 'PyPy-fn.7' message 'Improve debugging' id 'a53027aa-d9f4-4d9b-b866-36c2d868f6da' date '2 February 2017' time '5:18:08.124325 pm' author 'fn' ancestors ((name 'PyPy-fn.6' message 'Add PythonDebugger' id 'd241b247-2f66-453b-8647-20921607ba6a' date '19 January 2017' time '3:52:13.068974 pm' author 'fn' ancestors ((name 'PyPy-fn.5' message 'Moar!' id '57559df2-fee3-4bbe-815e-e6a922814daa' date '16 January 2017' time '4:07:13.342195 pm' author 'fn' ancestors ((name 'PyPy-fn.4' message 'Improvements' id '6faee019-c5cd-40ec-a7dc-b73c5893ae19' date '19 December 2016' time '3:48:12.963063 pm' author 'fn' ancestors ((name 'PyPy-fn.3' message 'Misc improvements' id '2afdbb92-158f-4465-b09a-df8074701efa' date '19 December 2016' time '3:02:39.964543 pm' author 'fn' ancestors ((name 'PyPy-fn.2' message 'V2' id '14b5cff7-28b4-40a7-93e4-b23117765037' date '19 December 2016' time '2:12:58.482512 pm' author 'fn' ancestors ((name 'PyPy-fn.1' message 'Init' id '0b0df585-70de-4e0d-af6c-278bab42ed12' date '19 December 2016' time '12:34:55.984013 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/PyPy.package/properties.json b/repository/PyPy.package/properties.json deleted file mode 100644 index f037444a..00000000 --- a/repository/PyPy.package/properties.json +++ /dev/null @@ -1,2 +0,0 @@ -{ - } From 954b4161ac6f18eef053359ffbada62bf222889f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Mar 2017 00:52:11 +0100 Subject: [PATCH 108/193] Improve SDL.h patching --- .travis/install_requirements.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index cd502528..ceea37e8 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -2,6 +2,7 @@ set -ex readonly BASE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly BUILD_DIR="${BASE}/../.build" readonly TEST_IMAGES_BASE="${TRAVIS_BUILD_DIR}/rsqueakvm/test/images/" readonly TEST_IMAGES_BASE_URL="https://www.hpi.uni-potsdam.de/hirschfeld/artefacts/rsqueak/testing/images/" @@ -135,7 +136,14 @@ if [[ "${PLUGINS}" = "PythonPlugin" ]]; then # A wrong macro is applied to "const SDL_MessageBoxButtonData *buttons;" # which breaks compilation at the end. echo "Patching SDL.h for PythonPlugin" - sudo sed -i.bak "/SDL_messagebox\.h/s/^/\/\/ /" "/usr/local/include/SDL2/SDL.h" + SDLH_PATH="/usr/local/include/SDL2/SDL.h" + [[ ! -f "${SDLH_PATH}" ]] && SDLH_PATH="${BUILD_DIR}/SDL32bit/SDL.h" + [[ ! -f "${SDLH_PATH}" ]] && SDLH_PATH="${BUILD_DIR}/SDL64bit/SDL.h" + if [[ ! -f "${SDLH_PATH}" ]]; then + print "SDL.h not found." + exit 1 + fi + sudo sed -i.bak "/SDL_messagebox\.h/s/^/\/\/ /" "${SDLH_PATH}" fi if [[ -d ".build/sqpyte" ]]; then From 1f74499b14f99d3c2ba39ef855082c488850c7f4 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Mar 2017 01:01:49 +0100 Subject: [PATCH 109/193] Fix paths --- .travis/install_requirements.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index ceea37e8..4ea897f6 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -3,8 +3,8 @@ set -ex readonly BASE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly BUILD_DIR="${BASE}/../.build" -readonly TEST_IMAGES_BASE="${TRAVIS_BUILD_DIR}/rsqueakvm/test/images/" -readonly TEST_IMAGES_BASE_URL="https://www.hpi.uni-potsdam.de/hirschfeld/artefacts/rsqueak/testing/images/" +readonly TEST_IMAGES_BASE="${TRAVIS_BUILD_DIR}/rsqueakvm/test/images" +readonly TEST_IMAGES_BASE_URL="https://www.hpi.uni-potsdam.de/hirschfeld/artefacts/rsqueak/testing/images" export OPTIONS="" @@ -137,8 +137,8 @@ if [[ "${PLUGINS}" = "PythonPlugin" ]]; then # which breaks compilation at the end. echo "Patching SDL.h for PythonPlugin" SDLH_PATH="/usr/local/include/SDL2/SDL.h" - [[ ! -f "${SDLH_PATH}" ]] && SDLH_PATH="${BUILD_DIR}/SDL32bit/SDL.h" - [[ ! -f "${SDLH_PATH}" ]] && SDLH_PATH="${BUILD_DIR}/SDL64bit/SDL.h" + [[ ! -f "${SDLH_PATH}" ]] && SDLH_PATH="${BUILD_DIR}/SDL32bit/include/SDL.h" + [[ ! -f "${SDLH_PATH}" ]] && SDLH_PATH="${BUILD_DIR}/SDL64bit/include/SDL.h" if [[ ! -f "${SDLH_PATH}" ]]; then print "SDL.h not found." exit 1 From ac1650ea0aec66e8bbb59a73dfc0d6d5a45a0f9f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Mar 2017 14:32:05 +0100 Subject: [PATCH 110/193] Remove ToolBuilder components subclasses and improve Python tools and styler [ci skip] --- .../class/sourceCodeTemplate.st} | 2 +- .../PythonObject.class/methodProperties.json | 1 + .../monticello.meta/version | 2 +- .../PythonEditor.class/README.md | 0 .../PythonEditor.class/class/initialize.st | 3 -- .../instance/evaluateSelectionAndDo..st | 30 ------------------- .../PythonEditor.class/methodProperties.json | 5 ---- .../PythonEditor.class/properties.json | 14 --------- .../README.md | 0 .../instance/stylerClass.st | 3 -- .../methodProperties.json | 5 ---- .../properties.json | 14 --------- .../README.md | 0 .../instance/setText..st | 8 ----- .../instance/stylePyCode.st | 3 -- .../instance/textMorphClass.st | 5 ---- .../instance/updateStyle.st | 6 ---- .../methodProperties.json | 8 ----- .../properties.json | 14 --------- .../PythonPluggableTextSpec.class/README.md | 0 .../instance/stylerClass.st | 3 -- .../instance/textPaneClass.st | 3 -- .../methodProperties.json | 6 ---- .../properties.json | 14 --------- .../README.md | 0 .../instance/editorClass.st | 4 --- .../methodProperties.json | 5 ---- .../properties.json | 14 --------- .../instance/format..st | 5 ++++ .../instance/formatPython..st | 7 +++++ .../instance/isPythonCode..st | 3 ++ .../instance/isPythonCode.st | 3 ++ .../instance/parseablePySourceCodeTemplate.st | 3 ++ .../instance/privateFormatPython..st | 10 +++++++ .../instance/privateStyle..st | 3 -- .../PythonTextStyler.class/instance/style..st | 5 ++++ .../instance/styleInBackgroundProcess..st | 5 ++++ .../methodProperties.json | 10 +++++-- .../PythonTextStyler.class/properties.json | 2 +- .../PythonToolBuilder.class/README.md | 0 .../class/initialize.st | 4 --- .../instance/codePaneClass.st | 3 -- .../instance/pluggableCodePaneSpec.st | 3 -- .../instance/pluggableTextSpec.st | 3 -- .../instance/textPaneClass.st | 3 -- .../methodProperties.json | 8 ----- .../PythonToolBuilder.class/properties.json | 14 --------- .../monticello.meta/version | 2 +- .../instance/hasPyCodeSelected.st | 3 -- .../Model.extension/methodProperties.json | 5 ---- .../Model.extension/properties.json | 2 -- .../instance/aboutToStyle..st | 14 ++------- .../instance/buildCodePaneWith..st | 5 ++-- .../instance/defaultStylerClass.st | 3 ++ .../instance/doItReceiver.st | 4 +++ .../instance/hasPyCodeSelected.st | 1 + .../PythonBrowser.class/methodProperties.json | 8 +++-- .../class/exploreFrames.st | 2 +- .../class/filterPySource.lineno..st | 2 +- .../class/getContentsOf..st | 2 +- .../class/getPySource..st | 2 +- .../class/getSignature..st | 2 +- .../PythonDebugger.class/class/indent.by..st | 2 +- .../PythonDebugger.class/class/indentSize..st | 2 +- .../class/newPyContext.st | 2 +- .../class/prependPythonContexts..st | 2 +- .../replaceInPySource.content.lineno..st | 2 +- .../class/scopeEndIn.startingAt..st | 2 +- .../class/setPySourceContent.content..st | 2 +- .../instance/aboutToStyle..st | 11 ++----- .../instance/buildCodePaneWith..st | 5 ++-- .../instance/defaultStylerClass.st | 3 ++ .../instance/hasPyCodeSelected.st | 3 -- .../methodProperties.json | 6 ++-- .../instance/aboutToStyle..st | 5 ++++ .../instance/buildCodePaneWith..st | 5 ++-- .../methodProperties.json | 3 +- .../instance/aboutToStyle..st | 5 ++++ .../methodProperties.json | 2 +- .../instance/aboutToStyle..st | 5 ++++ .../instance/buildCodePaneWith..st | 12 ++++++++ .../instance/evaluateExpression..st | 2 +- .../instance/hasPyCodeSelected.st | 3 -- .../instance/isPython.st | 2 +- .../methodProperties.json | 3 +- .../monticello.meta/version | 2 +- 86 files changed, 135 insertions(+), 279 deletions(-) rename repository/{Python-Support.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st => Python-Core.package/PythonObject.class/class/sourceCodeTemplate.st} (63%) delete mode 100644 repository/Python-Support.package/PythonEditor.class/README.md delete mode 100644 repository/Python-Support.package/PythonEditor.class/class/initialize.st delete mode 100644 repository/Python-Support.package/PythonEditor.class/instance/evaluateSelectionAndDo..st delete mode 100644 repository/Python-Support.package/PythonEditor.class/methodProperties.json delete mode 100644 repository/Python-Support.package/PythonEditor.class/properties.json delete mode 100644 repository/Python-Support.package/PythonPluggableCodePaneSpec.class/README.md delete mode 100644 repository/Python-Support.package/PythonPluggableCodePaneSpec.class/instance/stylerClass.st delete mode 100644 repository/Python-Support.package/PythonPluggableCodePaneSpec.class/methodProperties.json delete mode 100644 repository/Python-Support.package/PythonPluggableCodePaneSpec.class/properties.json delete mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/README.md delete mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/setText..st delete mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/stylePyCode.st delete mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/textMorphClass.st delete mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/updateStyle.st delete mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/methodProperties.json delete mode 100644 repository/Python-Support.package/PythonPluggableTextMorphPlus.class/properties.json delete mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/README.md delete mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/instance/stylerClass.st delete mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/instance/textPaneClass.st delete mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/methodProperties.json delete mode 100644 repository/Python-Support.package/PythonPluggableTextSpec.class/properties.json delete mode 100644 repository/Python-Support.package/PythonTextMorphForEditView.class/README.md delete mode 100644 repository/Python-Support.package/PythonTextMorphForEditView.class/instance/editorClass.st delete mode 100644 repository/Python-Support.package/PythonTextMorphForEditView.class/methodProperties.json delete mode 100644 repository/Python-Support.package/PythonTextMorphForEditView.class/properties.json create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/format..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/formatPython..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode.st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/parseablePySourceCodeTemplate.st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/privateFormatPython..st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/privateStyle..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/style..st create mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st delete mode 100644 repository/Python-Support.package/PythonToolBuilder.class/README.md delete mode 100644 repository/Python-Support.package/PythonToolBuilder.class/class/initialize.st delete mode 100644 repository/Python-Support.package/PythonToolBuilder.class/instance/codePaneClass.st delete mode 100644 repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableCodePaneSpec.st delete mode 100644 repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableTextSpec.st delete mode 100644 repository/Python-Support.package/PythonToolBuilder.class/instance/textPaneClass.st delete mode 100644 repository/Python-Support.package/PythonToolBuilder.class/methodProperties.json delete mode 100644 repository/Python-Support.package/PythonToolBuilder.class/properties.json delete mode 100644 repository/Python-Tools.package/Model.extension/instance/hasPyCodeSelected.st delete mode 100644 repository/Python-Tools.package/Model.extension/methodProperties.json delete mode 100644 repository/Python-Tools.package/Model.extension/properties.json create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/defaultStylerClass.st create mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/doItReceiver.st create mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/defaultStylerClass.st delete mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/hasPyCodeSelected.st create mode 100644 repository/Python-Tools.package/PythonInspector.class/instance/aboutToStyle..st create mode 100644 repository/Python-Tools.package/PythonObjectExplorer.class/instance/aboutToStyle..st create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/instance/aboutToStyle..st create mode 100644 repository/Python-Tools.package/PythonWorkspace.class/instance/buildCodePaneWith..st delete mode 100644 repository/Python-Tools.package/PythonWorkspace.class/instance/hasPyCodeSelected.st diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st b/repository/Python-Core.package/PythonObject.class/class/sourceCodeTemplate.st similarity index 63% rename from repository/Python-Support.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st rename to repository/Python-Core.package/PythonObject.class/class/sourceCodeTemplate.st index a71263fd..1c9c9b4a 100644 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/parseableSourceCodeTemplate.st +++ b/repository/Python-Core.package/PythonObject.class/class/sourceCodeTemplate.st @@ -1,5 +1,5 @@ overrides -parseableSourceCodeTemplate +sourceCodeTemplate ^'def method(self, x): return 2 * x' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/methodProperties.json b/repository/Python-Core.package/PythonObject.class/methodProperties.json index 5acec3fc..7e9a5621 100644 --- a/repository/Python-Core.package/PythonObject.class/methodProperties.json +++ b/repository/Python-Core.package/PythonObject.class/methodProperties.json @@ -10,6 +10,7 @@ "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", "pythonizeAll" : "fn 3/6/2017 06:58", "sourceCodeAt:ifAbsent:" : "fn 3/7/2017 12:44", + "sourceCodeTemplate" : "fn 3/7/2017 19:08", "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 12/19/2016 14:05", "toolIconSelector:" : "fn 3/7/2017 12:43", "withAll2:" : "fn 12/22/2016 15:19", diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index 1091aab0..977c0b96 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Support.package/PythonEditor.class/README.md b/repository/Python-Support.package/PythonEditor.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/Python-Support.package/PythonEditor.class/class/initialize.st b/repository/Python-Support.package/PythonEditor.class/class/initialize.st deleted file mode 100644 index 9e62c35b..00000000 --- a/repository/Python-Support.package/PythonEditor.class/class/initialize.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -initialize - super initialize \ No newline at end of file diff --git a/repository/Python-Support.package/PythonEditor.class/instance/evaluateSelectionAndDo..st b/repository/Python-Support.package/PythonEditor.class/instance/evaluateSelectionAndDo..st deleted file mode 100644 index 8bde686a..00000000 --- a/repository/Python-Support.package/PythonEditor.class/instance/evaluateSelectionAndDo..st +++ /dev/null @@ -1,30 +0,0 @@ -as yet unclassified -evaluateSelectionAndDo: aBlock - "Treat the current selection as an expression; evaluate it and invoke aBlock with the result." - | result rcvr ctxt | - self lineSelectAndEmptyCheck: [^ nil]. - - (model respondsTo: #evaluateExpression:) ifTrue: [ - ^ aBlock value: (model perform: #evaluateExpression: with: self selection)]. - - (model respondsTo: #doItReceiver) - ifTrue: [ rcvr := model doItReceiver. - ctxt := model doItContext] - ifFalse: [rcvr := ctxt := nil]. - result := [ - PythonCompiler new - evaluate: self selectionAsStream - in: ctxt - to: rcvr - environment: (model environment ifNil: [Smalltalk globals]) - notifying: self - ifFail: [morph flash. ^ nil] - logged: true. - ] - on: OutOfScopeNotification - do: [ :ex | ex resume: true]. - - (model respondsTo: #expressionEvaluated:result:) ifTrue: [ - model perform: #expressionEvaluated:result: with: self selection with: result]. - - ^aBlock value: result \ No newline at end of file diff --git a/repository/Python-Support.package/PythonEditor.class/methodProperties.json b/repository/Python-Support.package/PythonEditor.class/methodProperties.json deleted file mode 100644 index 5c766d3a..00000000 --- a/repository/Python-Support.package/PythonEditor.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - "initialize" : "fn 3/7/2017 18:13" }, - "instance" : { - "evaluateSelectionAndDo:" : "fn 3/7/2017 18:05" } } diff --git a/repository/Python-Support.package/PythonEditor.class/properties.json b/repository/Python-Support.package/PythonEditor.class/properties.json deleted file mode 100644 index a60db215..00000000 --- a/repository/Python-Support.package/PythonEditor.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "Python-Support", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonEditor", - "pools" : [ - ], - "super" : "SmalltalkEditor", - "type" : "normal" } diff --git a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/README.md b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/instance/stylerClass.st b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/instance/stylerClass.st deleted file mode 100644 index 15df1ae0..00000000 --- a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/instance/stylerClass.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -stylerClass - ^ PythonTextStyler \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/methodProperties.json b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/methodProperties.json deleted file mode 100644 index 3c94aab4..00000000 --- a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "stylerClass" : "fn 3/6/2017 11:23" } } diff --git a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/properties.json b/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/properties.json deleted file mode 100644 index 922f1bb4..00000000 --- a/repository/Python-Support.package/PythonPluggableCodePaneSpec.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "Python-Support", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonPluggableCodePaneSpec", - "pools" : [ - ], - "super" : "PluggableCodePaneSpec", - "type" : "normal" } diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/README.md b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/setText..st b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/setText..st deleted file mode 100644 index 33cefb2e..00000000 --- a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/setText..st +++ /dev/null @@ -1,8 +0,0 @@ -as yet unclassified -setText: aText - - self okToStyle ifFalse:[^super setText: aText]. - super setText: (styler format: aText asText). - self stylePyCode - ifTrue: [ styler stylePython: textMorph contents ] - ifFalse: [ styler style: textMorph contents ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/stylePyCode.st b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/stylePyCode.st deleted file mode 100644 index 9b98c025..00000000 --- a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/stylePyCode.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -stylePyCode - ^ self model isPython and: [ self model hasPyCodeSelected ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/textMorphClass.st b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/textMorphClass.st deleted file mode 100644 index c267d9b0..00000000 --- a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/textMorphClass.st +++ /dev/null @@ -1,5 +0,0 @@ -as yet unclassified -textMorphClass - "Answer the class used to create the receiver's textMorph" - - ^ PythonTextMorphForEditView \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/updateStyle.st b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/updateStyle.st deleted file mode 100644 index 54df736b..00000000 --- a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/instance/updateStyle.st +++ /dev/null @@ -1,6 +0,0 @@ -as yet unclassified -updateStyle - self okToStyle ifTrue: [ - self stylePyCode - ifTrue: [ styler stylePythonInBackgroundProcess: textMorph contents ] - ifFalse: [ styler styleInBackgroundProcess: textMorph contents ] ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/methodProperties.json b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/methodProperties.json deleted file mode 100644 index 616382b1..00000000 --- a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/methodProperties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "setText:" : "fn 3/7/2017 16:11", - "stylePyCode" : "fn 3/7/2017 16:11", - "textMorphClass" : "fn 3/7/2017 18:03", - "updateStyle" : "fn 3/7/2017 16:26" } } diff --git a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/properties.json b/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/properties.json deleted file mode 100644 index 6de62713..00000000 --- a/repository/Python-Support.package/PythonPluggableTextMorphPlus.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "Python-Support", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonPluggableTextMorphPlus", - "pools" : [ - ], - "super" : "PluggableTextMorphPlus", - "type" : "normal" } diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/README.md b/repository/Python-Support.package/PythonPluggableTextSpec.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/stylerClass.st b/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/stylerClass.st deleted file mode 100644 index 15df1ae0..00000000 --- a/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/stylerClass.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -stylerClass - ^ PythonTextStyler \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/textPaneClass.st b/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/textPaneClass.st deleted file mode 100644 index 934e70f2..00000000 --- a/repository/Python-Support.package/PythonPluggableTextSpec.class/instance/textPaneClass.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -textPaneClass - ^ PythonPluggableTextMorphPlus \ No newline at end of file diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/methodProperties.json b/repository/Python-Support.package/PythonPluggableTextSpec.class/methodProperties.json deleted file mode 100644 index 341bb33e..00000000 --- a/repository/Python-Support.package/PythonPluggableTextSpec.class/methodProperties.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "stylerClass" : "fn 3/6/2017 14:48", - "textPaneClass" : "fn 3/6/2017 16:19" } } diff --git a/repository/Python-Support.package/PythonPluggableTextSpec.class/properties.json b/repository/Python-Support.package/PythonPluggableTextSpec.class/properties.json deleted file mode 100644 index 49543296..00000000 --- a/repository/Python-Support.package/PythonPluggableTextSpec.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "Python-Support", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonPluggableTextSpec", - "pools" : [ - ], - "super" : "PluggableTextSpec", - "type" : "normal" } diff --git a/repository/Python-Support.package/PythonTextMorphForEditView.class/README.md b/repository/Python-Support.package/PythonTextMorphForEditView.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/Python-Support.package/PythonTextMorphForEditView.class/instance/editorClass.st b/repository/Python-Support.package/PythonTextMorphForEditView.class/instance/editorClass.st deleted file mode 100644 index 94dd651d..00000000 --- a/repository/Python-Support.package/PythonTextMorphForEditView.class/instance/editorClass.st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -editorClass - "Answer the class used to create the receiver's editor" - ^ PythonEditor \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextMorphForEditView.class/methodProperties.json b/repository/Python-Support.package/PythonTextMorphForEditView.class/methodProperties.json deleted file mode 100644 index 374cdbb9..00000000 --- a/repository/Python-Support.package/PythonTextMorphForEditView.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "editorClass" : "fn 3/7/2017 18:05" } } diff --git a/repository/Python-Support.package/PythonTextMorphForEditView.class/properties.json b/repository/Python-Support.package/PythonTextMorphForEditView.class/properties.json deleted file mode 100644 index 19059d95..00000000 --- a/repository/Python-Support.package/PythonTextMorphForEditView.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "Python-Support", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonTextMorphForEditView", - "pools" : [ - ], - "super" : "TextMorphForEditView", - "type" : "normal" } diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/format..st b/repository/Python-Support.package/PythonTextStyler.class/instance/format..st new file mode 100644 index 00000000..2d5d3ad4 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/format..st @@ -0,0 +1,5 @@ +overrides +format: aText + self isPythonCode + ifTrue: [ ^ self formatPython: aText ] + ifFalse: [ ^ super format: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/formatPython..st b/repository/Python-Support.package/PythonTextStyler.class/instance/formatPython..st new file mode 100644 index 00000000..3d104359 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/formatPython..st @@ -0,0 +1,7 @@ +overrides +formatPython: aText + "Answer a copy of which has been reformatted, + or if no formatting is to be applied" + + self terminateBackgroundStylingProcess. + ^self privateFormatPython: aText \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode..st b/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode..st new file mode 100644 index 00000000..7e30fcc1 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode..st @@ -0,0 +1,3 @@ +accessing +isPythonCode: anObject + isPythonCode := anObject \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode.st b/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode.st new file mode 100644 index 00000000..5f6f8036 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode.st @@ -0,0 +1,3 @@ +accessing +isPythonCode + ^ isPythonCode ifNil: [ ^ false ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/parseablePySourceCodeTemplate.st b/repository/Python-Support.package/PythonTextStyler.class/instance/parseablePySourceCodeTemplate.st new file mode 100644 index 00000000..f604df12 --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/parseablePySourceCodeTemplate.st @@ -0,0 +1,3 @@ +overrides +parseablePySourceCodeTemplate + ^ PythonObject sourceCodeTemplate \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/privateFormatPython..st b/repository/Python-Support.package/PythonTextStyler.class/instance/privateFormatPython..st new file mode 100644 index 00000000..e7e44abc --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/privateFormatPython..st @@ -0,0 +1,10 @@ +overrides +privateFormatPython: aText + "Perform any formatting of aText necessary and answer either aText, or a formatted copy of aText" + + aText asString = Object sourceCodeTemplate + ifTrue:[ + "the original source code template does not parse, + replace it with one that does" + ^self parseablePySourceCodeTemplate asText]. + ^aText \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/privateStyle..st b/repository/Python-Support.package/PythonTextStyler.class/instance/privateStyle..st deleted file mode 100644 index a8d0ddfb..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/privateStyle..st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -privateStyle: aText - "do nothing" \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/style..st b/repository/Python-Support.package/PythonTextStyler.class/instance/style..st new file mode 100644 index 00000000..80ba5c9a --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/style..st @@ -0,0 +1,5 @@ +overrides +style: aText + self isPythonCode + ifTrue: [ self stylePython: aText ] + ifFalse: [ super style: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st b/repository/Python-Support.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st new file mode 100644 index 00000000..ed4f523a --- /dev/null +++ b/repository/Python-Support.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st @@ -0,0 +1,5 @@ +overrides +styleInBackgroundProcess: aText + self isPythonCode + ifTrue: [ self stylePythonInBackgroundProcess: aText ] + ifFalse: [ super styleInBackgroundProcess: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json b/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json index 1c4b7b08..d13add1b 100644 --- a/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json +++ b/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json @@ -3,7 +3,13 @@ "highlight:" : "fn 3/6/2017 19:04", "highlightSmalltalk:" : "fn 3/6/2017 19:14" }, "instance" : { - "parseableSourceCodeTemplate" : "fn 12/22/2016 15:20", - "privateStyle:" : "fn 3/7/2017 17:29", + "format:" : "fn 3/8/2017 13:30", + "formatPython:" : "fn 3/7/2017 19:08", + "isPythonCode" : "fn 3/8/2017 14:23", + "isPythonCode:" : "fn 3/8/2017 13:30", + "parseablePySourceCodeTemplate" : "fn 3/8/2017 14:28", + "privateFormatPython:" : "fn 3/7/2017 19:06", + "style:" : "fn 3/8/2017 13:30", + "styleInBackgroundProcess:" : "fn 3/8/2017 13:30", "stylePython:" : "fn 3/7/2017 16:12", "stylePythonInBackgroundProcess:" : "fn 3/7/2017 16:27" } } diff --git a/repository/Python-Support.package/PythonTextStyler.class/properties.json b/repository/Python-Support.package/PythonTextStyler.class/properties.json index 0df5ff19..62e6d8e9 100644 --- a/repository/Python-Support.package/PythonTextStyler.class/properties.json +++ b/repository/Python-Support.package/PythonTextStyler.class/properties.json @@ -6,7 +6,7 @@ ], "commentStamp" : "", "instvars" : [ - ], + "isPythonCode" ], "name" : "PythonTextStyler", "pools" : [ ], diff --git a/repository/Python-Support.package/PythonToolBuilder.class/README.md b/repository/Python-Support.package/PythonToolBuilder.class/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/repository/Python-Support.package/PythonToolBuilder.class/class/initialize.st b/repository/Python-Support.package/PythonToolBuilder.class/class/initialize.st deleted file mode 100644 index b3604724..00000000 --- a/repository/Python-Support.package/PythonToolBuilder.class/class/initialize.st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -initialize - super initialize. - "UIManager default builderClass: self" \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/instance/codePaneClass.st b/repository/Python-Support.package/PythonToolBuilder.class/instance/codePaneClass.st deleted file mode 100644 index 54b91e6c..00000000 --- a/repository/Python-Support.package/PythonToolBuilder.class/instance/codePaneClass.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -codePaneClass - ^ PythonPluggableTextMorphPlus \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableCodePaneSpec.st b/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableCodePaneSpec.st deleted file mode 100644 index 755ddb42..00000000 --- a/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableCodePaneSpec.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -pluggableCodePaneSpec - ^ PythonPluggableCodePaneSpec \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableTextSpec.st b/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableTextSpec.st deleted file mode 100644 index b247f70c..00000000 --- a/repository/Python-Support.package/PythonToolBuilder.class/instance/pluggableTextSpec.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -pluggableTextSpec - ^ PythonPluggableTextSpec \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/instance/textPaneClass.st b/repository/Python-Support.package/PythonToolBuilder.class/instance/textPaneClass.st deleted file mode 100644 index 934e70f2..00000000 --- a/repository/Python-Support.package/PythonToolBuilder.class/instance/textPaneClass.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -textPaneClass - ^ PythonPluggableTextMorphPlus \ No newline at end of file diff --git a/repository/Python-Support.package/PythonToolBuilder.class/methodProperties.json b/repository/Python-Support.package/PythonToolBuilder.class/methodProperties.json deleted file mode 100644 index 9744af16..00000000 --- a/repository/Python-Support.package/PythonToolBuilder.class/methodProperties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "class" : { - "initialize" : "fn 3/7/2017 13:29" }, - "instance" : { - "codePaneClass" : "fn 3/6/2017 17:03", - "pluggableCodePaneSpec" : "fn 3/6/2017 11:23", - "pluggableTextSpec" : "fn 3/6/2017 14:48", - "textPaneClass" : "fn 3/6/2017 17:04" } } diff --git a/repository/Python-Support.package/PythonToolBuilder.class/properties.json b/repository/Python-Support.package/PythonToolBuilder.class/properties.json deleted file mode 100644 index 811eae81..00000000 --- a/repository/Python-Support.package/PythonToolBuilder.class/properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "category" : "Python-Support", - "classinstvars" : [ - ], - "classvars" : [ - ], - "commentStamp" : "", - "instvars" : [ - ], - "name" : "PythonToolBuilder", - "pools" : [ - ], - "super" : "MorphicToolBuilder", - "type" : "normal" } diff --git a/repository/Python-Support.package/monticello.meta/version b/repository/Python-Support.package/monticello.meta/version index c900a41e..2866cfa6 100644 --- a/repository/Python-Support.package/monticello.meta/version +++ b/repository/Python-Support.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Support-fn.4' message 'Subclass SmalltalkEditor and TextMorphForEditView in order to be able to override more methods for Python support' id '51fa2773-8f66-4c87-addd-63154eea2da4' date '7 March 2017' time '6:17:46.751045 pm' author 'fn' ancestors ((name 'Python-Support-fn.3' message 'Bugfixes and improvements' id '4be9a02d-4982-447a-903e-e713baea85eb' date '7 March 2017' time '2:35:26.793869 pm' author 'fn' ancestors ((name 'Python-Support-fn.2' message 'Cleanups' id '43742c0b-6a9b-4827-a079-7202613e72c3' date '7 March 2017' time '12:46:02.428302 pm' author 'fn' ancestors ((name 'Python-Support-fn.1' message 'Initial commit' id 'fcd0af1c-1b0a-4cf5-be6c-b6ebab6bcfc6' date '6 March 2017' time '9:43:26.501112 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Support-fn.5' message 'Remove subclasses of ToolBuilder components and improve styler' id '54f42651-6fe8-4210-a3d6-abd6dafbf941' date '8 March 2017' time '2:31:01.373803 pm' author 'fn' ancestors ((name 'Python-Support-fn.4' message 'Subclass SmalltalkEditor and TextMorphForEditView in order to be able to override more methods for Python support' id '51fa2773-8f66-4c87-addd-63154eea2da4' date '7 March 2017' time '6:17:46.751045 pm' author 'fn' ancestors ((name 'Python-Support-fn.3' message 'Bugfixes and improvements' id '4be9a02d-4982-447a-903e-e713baea85eb' date '7 March 2017' time '2:35:26.793869 pm' author 'fn' ancestors ((name 'Python-Support-fn.2' message 'Cleanups' id '43742c0b-6a9b-4827-a079-7202613e72c3' date '7 March 2017' time '12:46:02.428302 pm' author 'fn' ancestors ((name 'Python-Support-fn.1' message 'Initial commit' id 'fcd0af1c-1b0a-4cf5-be6c-b6ebab6bcfc6' date '6 March 2017' time '9:43:26.501112 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Tools.package/Model.extension/instance/hasPyCodeSelected.st b/repository/Python-Tools.package/Model.extension/instance/hasPyCodeSelected.st deleted file mode 100644 index f2c5f44a..00000000 --- a/repository/Python-Tools.package/Model.extension/instance/hasPyCodeSelected.st +++ /dev/null @@ -1,3 +0,0 @@ -*Python-Tools -hasPyCodeSelected - ^ false \ No newline at end of file diff --git a/repository/Python-Tools.package/Model.extension/methodProperties.json b/repository/Python-Tools.package/Model.extension/methodProperties.json deleted file mode 100644 index 71d83f96..00000000 --- a/repository/Python-Tools.package/Model.extension/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "hasPyCodeSelected" : "fn 3/7/2017 14:30" } } diff --git a/repository/Python-Tools.package/Model.extension/properties.json b/repository/Python-Tools.package/Model.extension/properties.json deleted file mode 100644 index b2050178..00000000 --- a/repository/Python-Tools.package/Model.extension/properties.json +++ /dev/null @@ -1,2 +0,0 @@ -{ - "name" : "Model" } diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st b/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st index f8c5afd0..cc8803d3 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st @@ -1,13 +1,5 @@ overrides aboutToStyle: aStyler - "This is a notification that aStyler is about to re-style its text. - Set the classOrMetaClass in aStyler, so that identifiers - will be resolved correctly. - Answer true to allow styling to proceed, or false to veto the styling" - | type | - Python vmSpeaksPython ifFalse: [ ^ super aboutToStyle: aStyler ]. - self isModeStyleable ifFalse: [^false]. - type := self editSelection. - (#(newClass editClass) includes: type) ifTrue: [^false]. - (#(newMessage editMessage) includes: type) ifFalse:[ ^false]. - ^true \ No newline at end of file + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler isPythonCode: self hasPyCodeSelected. + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st b/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st index 8d5ca7ca..c6298404 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st @@ -7,13 +7,14 @@ buildCodePaneWith: builder buttonSpec := self buildOptionalButtonsWith: builder. buttonSpec frame: self optionalButtonsFrame. top children add: buttonSpec]. - textSpec := PythonPluggableCodePaneSpec new. + textSpec := builder pluggableCodePaneSpec new. textSpec model: self; getText: #contents; setText: #contents:notifying:; selection: #contentsSelection; - menu: #codePaneMenu:shifted:. + menu: #codePaneMenu:shifted:; + stylerClass: PythonTextStyler. self wantsAnnotationPane ifTrue: [ top ifNil: [ top := builder pluggablePanelSpec new. diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/defaultStylerClass.st b/repository/Python-Tools.package/PythonBrowser.class/instance/defaultStylerClass.st new file mode 100644 index 00000000..df1fd220 --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/defaultStylerClass.st @@ -0,0 +1,3 @@ +overrides +defaultStylerClass + ^ PythonTextStyler \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/doItReceiver.st b/repository/Python-Tools.package/PythonBrowser.class/instance/doItReceiver.st new file mode 100644 index 00000000..db97da75 --- /dev/null +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/doItReceiver.st @@ -0,0 +1,4 @@ +overrides +doItReceiver + "return recv with evaluatorClass SMalltalk or Python compiler" + ^ super doItReceiver \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st b/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st index 645c085a..9af0bf47 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st +++ b/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st @@ -4,4 +4,5 @@ hasPyCodeSelected class := self selectedClassOrMetaClass. selector := self selectedMessageName. class isPython ifFalse: [^ false]. + selector ifNil: [ ^ true ]. ^ class pyMethodDict includesKey: selector \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json b/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json index 9693e778..04bd958d 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json +++ b/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json @@ -2,11 +2,13 @@ "class" : { }, "instance" : { - "aboutToStyle:" : "fn 3/6/2017 19:45", - "buildCodePaneWith:" : "fn 3/6/2017 17:59", + "aboutToStyle:" : "fn 3/8/2017 14:25", + "buildCodePaneWith:" : "fn 3/8/2017 12:45", "defaultBrowserTitle" : "fn 3/6/2017 18:00", + "defaultStylerClass" : "fn 3/8/2017 11:37", "defineMessageFrom:notifying:" : "fn 3/7/2017 11:42", - "hasPyCodeSelected" : "fn 3/7/2017 14:28", + "doItReceiver" : "fn 3/8/2017 11:32", + "hasPyCodeSelected" : "fn 3/7/2017 18:58", "isPython" : "fn 3/7/2017 14:33", "selectedMessage" : "fn 3/7/2017 11:31", "systemCategoryList" : "fn 3/7/2017 11:35", diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st b/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st index 4e1367da..044f6790 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st @@ -1,4 +1,4 @@ -as yet unclassified +utilities exploreFrames | currentFrame result frameInfo | currentFrame := Python primGetTopFrame. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st b/repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st index 5a45bc50..7221b635 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st @@ -1,4 +1,4 @@ -pysource +pySource filterPySource: aString lineno: scopeStart | lines indentSize end | lines := aString lines. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st b/repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st index cea9b9d8..e24d6698 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st @@ -1,4 +1,4 @@ -pysource +pySource getContentsOf: aFileName | stream data | stream := StandardFileStream oldFileNamed: aFileName. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st b/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st index 6240afac..458970b6 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st @@ -1,4 +1,4 @@ -pysource +pySource getPySource: aContext | pyCode filename contents | pyCode := aContext pyFrame f_code. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st b/repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st index 28de70f5..67fe8229 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st @@ -1,4 +1,4 @@ -pysource +pySource getSignature: pyCode | filename content | filename := pyCode co_filename asSmalltalk. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st b/repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st index 9db8b9b0..fa865ee3 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st @@ -1,4 +1,4 @@ -pysource +pySource indent: aString by: aNumber | indent | indent := String new: aNumber withAll: Character space. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st b/repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st index 70463b5f..5a033d68 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st @@ -1,3 +1,3 @@ -pysource +pySource indentSize: aLine ^ ((aLine findFirst: [:ea | ea isSeparator not]) - 1) max: 0 \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st b/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st index 679175d7..904dc939 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st @@ -1,4 +1,4 @@ -as yet unclassified +pyContext newPyContext ^ PythonMethodContext sender: nil diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st b/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st index 35dbc99f..c1dac69e 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st @@ -1,4 +1,4 @@ -as yet unclassified +pyContext prependPythonContexts: aContext | currentPyFrame newFrames | currentPyFrame := Python primGetTopFrame. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st b/repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st index e2e9cb52..d82627c1 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st @@ -1,4 +1,4 @@ -pysource +pySource replaceInPySource: oldContent content: aString lineno: aLineno | lines end indentSize newLines | lines := oldContent lines. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st b/repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st index f9c4d93c..94b42d27 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st @@ -1,4 +1,4 @@ -pysource +pySource scopeEndIn: aString startingAt: aLineno | lines currentIndentSize end | lines := aString lines allButFirst: aLineno. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st b/repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st index 0b9cd3a1..8dcbf2ba 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st @@ -1,4 +1,4 @@ -pysource +pySource setPySourceContent: pyCode content: aString | filename oldContents newContents stream | filename := pyCode co_filename asSmalltalk. diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st b/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st index db87decf..16fac914 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st @@ -1,10 +1,5 @@ overrides aboutToStyle: aStyler - "This is a notification that aStyler is about to re-style its text. - Set the classOrMetaClass in aStyler, so that identifiers - will be resolved correctly. - Answer true to allow styling to proceed, or false to veto the styling" - self hasPyContextSelected ifFalse: [ ^ super aboutToStyle: aStyler ]. - self isModeStyleable ifFalse: [^false]. - aStyler classOrMetaClass: self selectedClassOrMetaClass. - ^true \ No newline at end of file + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler isPythonCode: self hasPyContextSelected. + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st b/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st index 7c5bab8a..983700ae 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st @@ -14,14 +14,15 @@ buildCodePaneWith: builder browseButtons frame: self optionalButtonsFrame. top children add: browseButtons]. - textSpec := PythonPluggableCodePaneSpec new. + textSpec := builder pluggableCodePaneSpec new. textSpec model: self; getText: #contents; setText: #contents:notifying:; selection: #contentsSelection; menu: #codePaneMenu:shifted:; - frame: self textFrame. + frame: self textFrame; + stylerClass: PythonTextStyler. top children add: textSpec. self wantsAnnotationPane ifTrue: [ diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/defaultStylerClass.st b/repository/Python-Tools.package/PythonDebugger.class/instance/defaultStylerClass.st new file mode 100644 index 00000000..df1fd220 --- /dev/null +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/defaultStylerClass.st @@ -0,0 +1,3 @@ +overrides +defaultStylerClass + ^ PythonTextStyler \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyCodeSelected.st b/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyCodeSelected.st deleted file mode 100644 index 84582888..00000000 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyCodeSelected.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -hasPyCodeSelected - ^ self hasPyContextSelected \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json b/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json index 1cc66c4b..41347daa 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json +++ b/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json @@ -13,13 +13,13 @@ "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", "setPySourceContent:content:" : "fn 3/6/2017 10:26" }, "instance" : { - "aboutToStyle:" : "fn 3/7/2017 14:12", - "buildCodePaneWith:" : "fn 3/7/2017 14:17", + "aboutToStyle:" : "fn 3/8/2017 14:25", + "buildCodePaneWith:" : "fn 3/8/2017 12:50", "contents:notifying:" : "fn 3/6/2017 19:17", "contextForStack:" : "fn 2/21/2017 12:48", + "defaultStylerClass" : "fn 3/8/2017 11:37", "expandStack" : "fn 1/16/2017 21:03", "guessTypeForName:" : "fn 3/7/2017 14:12", - "hasPyCodeSelected" : "fn 3/7/2017 14:31", "hasPyContextSelected" : "fn 3/7/2017 14:12", "isPython" : "fn 3/7/2017 14:32", "messageIconAt:" : "fn 3/7/2017 16:35", diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/aboutToStyle..st b/repository/Python-Tools.package/PythonInspector.class/instance/aboutToStyle..st new file mode 100644 index 00000000..08799177 --- /dev/null +++ b/repository/Python-Tools.package/PythonInspector.class/instance/aboutToStyle..st @@ -0,0 +1,5 @@ +overrides +aboutToStyle: aStyler + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler isPythonCode: true. + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st b/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st index b4aad9ee..4c4970bb 100644 --- a/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st +++ b/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st @@ -1,7 +1,7 @@ overrides buildCodePaneWith: builder | textSpec | - textSpec := PythonPluggableCodePaneSpec new. + textSpec := builder pluggableCodePaneSpec new. textSpec model: self; getText: #expression; @@ -9,5 +9,6 @@ buildCodePaneWith: builder help: #helpText; selection: #contentsSelection; menu: #codePaneMenu:shifted:; - askBeforeDiscardingEdits: false. + askBeforeDiscardingEdits: false; + stylerClass: PythonTextStyler. ^textSpec \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/methodProperties.json b/repository/Python-Tools.package/PythonInspector.class/methodProperties.json index c2398f38..83077a6a 100644 --- a/repository/Python-Tools.package/PythonInspector.class/methodProperties.json +++ b/repository/Python-Tools.package/PythonInspector.class/methodProperties.json @@ -2,7 +2,8 @@ "class" : { }, "instance" : { - "buildCodePaneWith:" : "fn 3/7/2017 17:27", + "aboutToStyle:" : "fn 3/8/2017 14:26", + "buildCodePaneWith:" : "fn 3/8/2017 12:50", "contentsIsString" : "fn 12/23/2016 11:11", "fieldList" : "fn 2/23/2017 23:10", "isPython" : "fn 3/7/2017 14:33", diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/instance/aboutToStyle..st b/repository/Python-Tools.package/PythonObjectExplorer.class/instance/aboutToStyle..st new file mode 100644 index 00000000..e61635cb --- /dev/null +++ b/repository/Python-Tools.package/PythonObjectExplorer.class/instance/aboutToStyle..st @@ -0,0 +1,5 @@ +as yet unclassified +aboutToStyle: aStyler + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler isPythonCode: true. + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json b/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json index 0e4a6622..97c081e7 100644 --- a/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json +++ b/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - } } + "aboutToStyle:" : "fn 3/8/2017 14:26" } } diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/aboutToStyle..st b/repository/Python-Tools.package/PythonWorkspace.class/instance/aboutToStyle..st new file mode 100644 index 00000000..08799177 --- /dev/null +++ b/repository/Python-Tools.package/PythonWorkspace.class/instance/aboutToStyle..st @@ -0,0 +1,5 @@ +overrides +aboutToStyle: aStyler + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler isPythonCode: true. + ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/buildCodePaneWith..st b/repository/Python-Tools.package/PythonWorkspace.class/instance/buildCodePaneWith..st new file mode 100644 index 00000000..4af1a373 --- /dev/null +++ b/repository/Python-Tools.package/PythonWorkspace.class/instance/buildCodePaneWith..st @@ -0,0 +1,12 @@ +overrides +buildCodePaneWith: builder + | textSpec | + textSpec := builder pluggableCodePaneSpec new. + textSpec + model: self; + getText: #contents; + setText: #contents:notifying:; + selection: #contentsSelection; + menu: #codePaneMenu:shifted:; + stylerClass: PythonTextStyler. + ^textSpec \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st b/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st index 2e821c0a..187a2293 100644 --- a/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st +++ b/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st @@ -1,3 +1,3 @@ -as yet unclassified +dispatching evaluateExpression: selection ^ Python prun: selection asString \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/hasPyCodeSelected.st b/repository/Python-Tools.package/PythonWorkspace.class/instance/hasPyCodeSelected.st deleted file mode 100644 index 0eb4e72c..00000000 --- a/repository/Python-Tools.package/PythonWorkspace.class/instance/hasPyCodeSelected.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -hasPyCodeSelected - ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st b/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st index bb7967f8..5f13d9ba 100644 --- a/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st +++ b/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st @@ -1,3 +1,3 @@ -as yet unclassified +overrides isPython ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json b/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json index e7ef10fb..eefdcecc 100644 --- a/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json +++ b/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json @@ -2,6 +2,7 @@ "class" : { "open" : "fn 12/22/2016 02:51" }, "instance" : { + "aboutToStyle:" : "fn 3/8/2017 14:26", + "buildCodePaneWith:" : "fn 3/8/2017 12:51", "evaluateExpression:" : "fn 2/23/2017 21:21", - "hasPyCodeSelected" : "fn 3/7/2017 14:36", "isPython" : "fn 3/7/2017 14:33" } } diff --git a/repository/Python-Tools.package/monticello.meta/version b/repository/Python-Tools.package/monticello.meta/version index a6a6e48a..d1691b51 100644 --- a/repository/Python-Tools.package/monticello.meta/version +++ b/repository/Python-Tools.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Tools-fn.4' message 'Improve tools' id 'ced3b5a9-1f04-4750-83ba-8f6843db82ae' date '7 March 2017' time '6:18:03.279361 pm' author 'fn' ancestors ((name 'Python-Tools-fn.3' message 'Bugfixes and improvements' id '792d3734-4178-4d27-bc88-d784f9183768' date '7 March 2017' time '2:35:35.338398 pm' author 'fn' ancestors ((name 'Python-Tools-fn.2' message 'Improve PythonBrowser' id 'b2daaaa3-4839-413d-83df-802a71cb1aa4' date '7 March 2017' time '12:46:26.065217 pm' author 'fn' ancestors ((name 'Python-Tools-fn.1' message 'Initial commit' id '161df5a6-e3ff-4071-9c06-90faa842786d' date '6 March 2017' time '9:43:40.029266 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Tools-fn.5' message 'Improve tools' id '7c6b41c2-c667-46b4-9abc-f5fbf69004bc' date '8 March 2017' time '2:31:16.168274 pm' author 'fn' ancestors ((name 'Python-Tools-fn.4' message 'Improve tools' id 'ced3b5a9-1f04-4750-83ba-8f6843db82ae' date '7 March 2017' time '6:18:03.279361 pm' author 'fn' ancestors ((name 'Python-Tools-fn.3' message 'Bugfixes and improvements' id '792d3734-4178-4d27-bc88-d784f9183768' date '7 March 2017' time '2:35:35.338398 pm' author 'fn' ancestors ((name 'Python-Tools-fn.2' message 'Improve PythonBrowser' id 'b2daaaa3-4839-413d-83df-802a71cb1aa4' date '7 March 2017' time '12:46:26.065217 pm' author 'fn' ancestors ((name 'Python-Tools-fn.1' message 'Initial commit' id '161df5a6-e3ff-4071-9c06-90faa842786d' date '6 March 2017' time '9:43:40.029266 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 7b9f47187225cdee831cce07e71ee6b88dc64b1c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 8 Mar 2017 14:36:12 +0100 Subject: [PATCH 111/193] Disable _minimal_curses to avoid macro problems curses and SDL2 have a naming conflict --- .travis/install_requirements.sh | 15 --------------- rsqueakvm/plugins/python/py_objspace.py | 4 ++++ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index 4ea897f6..6bef3215 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -131,21 +131,6 @@ python .build/download_dependencies.py $OPTIONS load_test_images -if [[ "${PLUGINS}" = "PythonPlugin" ]]; then - # Comment out SDL_messagebox.h in SDL.h - # A wrong macro is applied to "const SDL_MessageBoxButtonData *buttons;" - # which breaks compilation at the end. - echo "Patching SDL.h for PythonPlugin" - SDLH_PATH="/usr/local/include/SDL2/SDL.h" - [[ ! -f "${SDLH_PATH}" ]] && SDLH_PATH="${BUILD_DIR}/SDL32bit/include/SDL.h" - [[ ! -f "${SDLH_PATH}" ]] && SDLH_PATH="${BUILD_DIR}/SDL64bit/include/SDL.h" - if [[ ! -f "${SDLH_PATH}" ]]; then - print "SDL.h not found." - exit 1 - fi - sudo sed -i.bak "/SDL_messagebox\.h/s/^/\/\/ /" "${SDLH_PATH}" -fi - if [[ -d ".build/sqpyte" ]]; then # Make sqlite/sqpyte for DatabasePlugin pushd ".build/sqpyte" > /dev/null diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/py_objspace.py index a9b1c48a..b32ffe26 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/py_objspace.py @@ -19,6 +19,10 @@ def new_pypy_objspace(): pypy_config.objspace.usemodules.micronumpy = False pypy_config.objspace.usemodules.cppyy = False + # avoid macro problems with curses and SDL2 + # TODO(fniephaus): should be reenabled for pyrepl support + pypy_config.objspace.usemodules._minimal_curses = False + # cpyext causes a lot of 'Undefined symbols for architecture x86_64' errors pypy_config.objspace.usemodules.cpyext = False From b9d3481b9434f692b4a8314905d9423a21369859 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 9 Mar 2017 00:35:57 +0100 Subject: [PATCH 112/193] Allow multiple Python threads at the same time --- rsqueakvm/plugins/python/execution.py | 238 ++++++++++++------ rsqueakvm/plugins/python/global_state.py | 60 +++-- rsqueakvm/plugins/python/model.py | 4 +- rsqueakvm/plugins/python/patching.py | 10 +- rsqueakvm/plugins/python_plugin.py | 41 ++- .../test/plugins/python/test_end_to_end.py | 6 + .../plugins/python/test_pyframe_exceptions.py | 5 +- 7 files changed, 242 insertions(+), 122 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 742acdf8..7e945a9a 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -1,45 +1,129 @@ +from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.compiled_methods import ( W_SpurCompiledMethod, W_PreSpurCompiledMethod) from rsqueakvm.plugins.python import global_state as gs from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist -from rpython.rlib.rstacklet import StackletThread from rpython.rlib import objectmodel from pypy.interpreter.error import OperationError +from pypy.interpreter.executioncontext import ExecutionContext +from pypy.module._continuation.interp_continuation import build_sthread -def start_new_thread(source, filename, cmd, translated): - # import pdb; pdb.set_trace() - if translated: - cls = StackletLanguageRunner - else: - cls = GreenletLanguageRunner - language = PythonLanguage(source, filename, cmd) - runner = cls(language) - gs.py_runner.set(runner) - runner.start() +ExecutionContext.current_language = None -def resume_thread(): - runner = gs.py_runner.get() - if runner is None: - print 'No runner to resume with' - return False - runner.resume() - return gs.wp_operror.get() is None +class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): + _attrs_ = ['_runner', '_done'] + repr_classname = 'W_ForeignLanguage' + def __init__(self): + W_AbstractObjectWithIdentityHash.__init__(self) + self._done = False + if gs.translating[0]: + self._runner = StackletLanguageRunner(self) + else: + self._runner = GreenletLanguageRunner(self) -class ForeignLanguage: - pass + def run(self): + raise NotImplementedError + def set_result(self, result): + raise NotImplementedError + + def get_result(self): + raise NotImplementedError + + def set_error(self, error): + raise NotImplementedError + + def get_error(self): + raise NotImplementedError + + def start(self): + self.runner().start() + + def runner(self): + return self._runner + + def resume(self): + if self.is_done(): + # import pdb; pdb.set_trace() + print 'The runner is done and cannot be resumed' + return False + self.runner().resume() + return self.get_error() is None + + def is_done(self): + return self._done + + def set_current(self): + ec = gs.py_space.getexecutioncontext() + ec.current_language = self + + def switch_to_smalltalk(self, interp, s_frame, first_call=False): + from rsqueakvm.storage_contexts import ContextPartShadow + + # print 'Switch to Smalltalk' + if self.is_done(): + return _create_return_frame(interp.space, self.get_result()) + + resume_method = gs.w_python_resume_method.get() + s_resume_frame = ContextPartShadow.build_method_context( + interp.space, + resume_method, + gs.w_python_class.get(), + [self] + ) + # import pdb; pdb.set_trace() + # we go one up, because the s_frame.w_method() is our fake method + if first_call or s_frame.w_method() is not resume_method: + # assert s_frame.w_method() is not resume_method + s_resume_frame.store_s_sender(s_frame) + else: + if s_frame.w_method() is not resume_method: + print 'Unexpected s_frame found.' + s_resume_frame.store_s_sender(s_frame.s_sender()) + interp.quick_check_for_interrupt(s_resume_frame, + dec=interp.interrupt_counter_size) + # this will raise a ProcessSwitch if there are interrupts or timers ... + return s_resume_frame + + # Overrides + + def at0(self, space, index0): + # import pdb; pdb.set_trace() + return space.w_nil + + def atput0(self, space, index0, w_value): + # import pdb; pdb.set_trace() + pass + + def fetch(self, space, n0): + # import pdb; pdb.set_trace() + return space.w_nil + + def store(self, space, n0, w_value): + # import pdb; pdb.set_trace() + pass + + def getclass(self, space): + return gs.w_foreign_language_class.get() + + +class W_PythonLanguage(W_ForeignLanguage): + _attrs_ = ['source', 'filename', 'cmd', 'wp_result', 'wp_operror'] + repr_classname = 'W_PythonLanguage' -class PythonLanguage(ForeignLanguage): def __init__(self, source, filename, cmd): + W_ForeignLanguage.__init__(self) self.source = source self.filename = filename self.cmd = cmd + self.wp_result = None + self.wp_operror = None def run(self): print 'Python start' @@ -48,22 +132,30 @@ def run(self): gs.py_space.threadlocals.enter_thread(gs.py_space) # switch back to Squeak before executing Python code - gs.switch_action.perform() + self.runner().return_to_smalltalk() retval = _run_eval_string(self.source, self.filename, self.cmd) - self.save_result(retval) + self.set_result(retval) except OperationError as operr: # operr was not handled by users, because they pressed proceed. # save Python error as result instead. - self.save_result(operr_to_pylist(operr)) + self.set_result(operr_to_pylist(operr)) except Exception as e: print 'Unknown error in Python thread: %s' % e finally: - gs.py_runner.set(None) + self._done = True + + def set_result(self, result): + self.wp_result = result + + def get_result(self): + return self.wp_result - def save_result(self, result): - gs.wp_result.set(result) - gs.wp_operror.set(None) # unset last error + def set_error(self, error): + self.wp_operror = error + + def get_error(self): + return self.wp_operror class GlobalState: @@ -73,14 +165,26 @@ def clear(self): global_execution_state.clear() -class AbstractLanguageRunner: +class AbstractLanguageRunner(): + def __init__(self, language): - self.language = language + self._language = language + + def language(self): + return self._language def start(self): + self.language().set_current() + self.start_thread() + + def start_thread(self): raise NotImplementedError def resume(self): + self.language().set_current() + self.resume_thread() + + def resume_thread(self): raise NotImplementedError def return_to_smalltalk(self): @@ -88,40 +192,56 @@ def return_to_smalltalk(self): class StackletLanguageRunner(AbstractLanguageRunner): + sthread = None + def __init__(self, language): AbstractLanguageRunner.__init__(self, language) - self.sthread = None + self.sthread = build_sthread(gs.py_space) + self.language_handle = self.sthread.get_null_handle() + self.smalltalk_handle = self.sthread.get_null_handle() - def start(self): - self.sthread = StackletThread() + def start_thread(self): global_execution_state.origin = self - self.h1 = self.sthread.new(self.__class__.new_stacklet_callback) + self.language_handle = self.sthread.new( + self.__class__.new_stacklet_callback) - def resume(self): - self.sthread.switch(self.h1) + def resume_thread(self): + if not self._is_valid_handle(self.language_handle): + print 'language_handle not valid' + return + self.sthread.switch(self.language_handle) def return_to_smalltalk(self): - self.sthread.switch(self.h2) + if not self._is_valid_handle(self.smalltalk_handle): + print 'smalltalk_handle not valid' + return + self.sthread.switch(self.smalltalk_handle) + + def _is_valid_handle(self, h): + if (self.sthread.is_empty_handle(h) or + h == self.sthread.get_null_handle()): + return False + return True @staticmethod def new_stacklet_callback(h, arg): print 'new_stacklet_callback:', h, arg self = global_execution_state.origin - self.h2 = h + self.smalltalk_handle = h global_execution_state.clear() - self.language.run() - global_execution_state.origin = self - return self.h2 + self.language().run() + # global_execution_state.origin = self + return self.smalltalk_handle # return to Smalltalk when done class GreenletLanguageRunner(AbstractLanguageRunner): - def start(self): + def start_thread(self): from greenlet import greenlet global_execution_state.origin = self self.greenlet = greenlet(self.__class__.new_greenlet_callback()) self.resume() # stacklets also start immediately - def resume(self): + def resume_thread(self): self.greenlet.switch() def return_to_smalltalk(self): @@ -131,36 +251,7 @@ def return_to_smalltalk(self): def new_greenlet_callback(): print 'new_greenlet_callback' self = global_execution_state.origin - return self.language.run - - -def switch_to_smalltalk(interp, s_frame, first_call=False): - from rsqueakvm.storage_contexts import ContextPartShadow - - # print 'Switch to Smalltalk' - wp_result = gs.wp_result.get() - if wp_result is not None: - return _create_return_frame(interp.space, wp_result) - - resume_method = gs.w_python_resume_method.get() - s_resume_frame = ContextPartShadow.build_method_context( - interp.space, - resume_method, - gs.w_python_class.get() - ) - # import pdb; pdb.set_trace() - # we go one up, because the s_frame.w_method() is our fake method - if first_call or s_frame.w_method() is not resume_method: - # assert s_frame.w_method() is not resume_method - s_resume_frame.store_s_sender(s_frame) - else: - if s_frame.w_method() is not resume_method: - print 'Unexpected s_frame found.' - s_resume_frame.store_s_sender(s_frame.s_sender()) - interp.quick_check_for_interrupt(s_resume_frame, - dec=interp.interrupt_counter_size) - # this will raise a ProcessSwitch if there are interrupts or timers ... - return s_resume_frame + return self.language().run def _create_return_frame(space, wp_result): @@ -194,6 +285,5 @@ def _create_return_frame(space, wp_result): ]] w_cm.literals = [W_PythonObject(wp_result), space.w_nil, w_cm.compiledin_class] - gs.wp_result.set(None) return ContextPartShadow.build_method_context( space, w_cm, w_python_class) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index f25dea56..1ee53236 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -1,9 +1,9 @@ +from rsqueakvm.error import Exit from rsqueakvm.model.compiled_methods import W_CompiledMethod from rsqueakvm.model.pointers import W_PointersObject from rsqueakvm.plugins.python.py_objspace import new_pypy_objspace from rsqueakvm.util.cells import QuasiConstant, Cell -from pypy.interpreter.baseobjspace import W_Root as WP_Root from pypy.interpreter.error import OperationError from pypy.interpreter.executioncontext import PeriodicAsyncAction @@ -26,10 +26,17 @@ def __init__(self, frame=None, code=None): class SwitchToSmalltalkAction(PeriodicAsyncAction): - def perform(self, ec=None, frame=None): + + def __init__(self, py_space): + PeriodicAsyncAction.__init__(self, py_space) + + def perform(self, ec, frame): # import pdb; pdb.set_trace() - runner = py_runner.get() - if not runner: + language = ec.current_language + if language is None: + return + runner = language.runner() + if runner is None: return # print 'Python yield' @@ -37,11 +44,11 @@ def perform(self, ec=None, frame=None): # print 'Python continue' # operror has been in Smalltalk land, clear it now to allow resuming - wp_operror.set(None) + language.set_error(None) # handle py_frame_restart_info if set restart_info = py_frame_restart_info.get() - if restart_info: + if restart_info is not None: py_frame_restart_info.set(None) # import pdb; pdb.set_trace() raise RestartException(restart_info) @@ -53,17 +60,14 @@ def perform(self, ec=None, frame=None): use_bytecode_counter=True) py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) -wp_result = Cell(None, type=WP_Root) -wp_operror = Cell(None, type=WP_Root) break_on_exception = Cell(True) +w_foreign_language_class = QuasiConstant(None, type=W_PointersObject) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) w_python_object_class = QuasiConstant(None, type=W_PointersObject) w_python_plugin_send = QuasiConstant(None, type=W_PointersObject) -py_runner = Cell(None) - translating = [True] @@ -72,19 +76,39 @@ def startup(space): space.wrap_string('PythonPlugin'), space.wrap_string('send') ])) + + foreign_language_class = space.smalltalk_at('ForeignLanguage') + if foreign_language_class is None: + # disable plugin? + error_msg = 'ForeignLanguage class not found.' + print error_msg + raise Exit(error_msg) + w_foreign_language_class.set(foreign_language_class) + python_class = space.smalltalk_at('Python') - w_python_class.set( - python_class or space.w_nil.getclass(space) - ) - w_python_object_class.set( - space.smalltalk_at('PythonObject') or space.w_nil.getclass(space) - ) - resume_method_symbol = space.wrap_symbol('resumeFrame') + if python_class is None: + # disable plugin? + error_msg = 'Python class not found.' + print error_msg + raise Exit(error_msg) + w_python_class.set(python_class) + + python_object_class = space.smalltalk_at('PythonObject') + if python_object_class is None: + # disable plugin? + error_msg = 'PythonObject class not found.' + print error_msg + raise Exit(error_msg) + w_python_object_class.set(python_object_class) + + resume_method_symbol = space.wrap_symbol('resume:') python_cls_cls_s = python_class.getclass(space).as_class_get_shadow(space) resume_method = python_cls_cls_s.lookup(resume_method_symbol) if resume_method is None: # disable plugin? - print 'Python class>>resumeFrame method not found' + error_msg = 'Python class>>resumeFrame method not found.' + print error_msg + raise Exit(error_msg) w_python_resume_method.set(resume_method) translating[0] = objectmodel.we_are_translated() diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 3783ff1e..55939b81 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -1,5 +1,4 @@ from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash -from rsqueakvm.model.pointers import W_PointersObject from rsqueakvm.storage_classes import ClassShadow from rsqueakvm.storage import AbstractCachingShadow from rsqueakvm.primitives.constants import EXTERNAL_CALL @@ -8,13 +7,12 @@ from rsqueakvm.plugins.python import global_state as gs from rsqueakvm.plugins.python.global_state import py_space -from pypy.interpreter.baseobjspace import W_Root as WP_Root from pypy.interpreter.error import OperationError from rpython.rlib import objectmodel -class W_PythonObject(W_PointersObject): +class W_PythonObject(W_AbstractObjectWithIdentityHash): _attrs_ = ['wp_object', 's_class'] _immutable_fields_ = ['wp_object', 's_class?'] repr_classname = 'W_PythonObject' diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index a7ae25c8..1e75d671 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -114,9 +114,13 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): raise operr if gs.break_on_exception.get() and not self.has_exception_handler(operr): # import pdb; pdb.set_trace() - gs.wp_operror.set(operr) - print 'Python error caught' - gs.switch_action.perform() + language = ec.current_language + if language is None: + print 'Unable to handle error, no language found.' + else: + language.set_error(operr) + print 'Python error caught' + gs.switch_action.perform(ec, self) return old_handle_operation_error(self, ec, operr, attach_tb) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 74aca5e5..f80ad29f 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -17,7 +17,7 @@ from pypy.interpreter.function import (Function, Method, StaticMethod, ClassMethod) -from rpython.rlib import jit, objectmodel +from rpython.rlib import jit _DO_NOT_RELOAD = True @@ -26,9 +26,7 @@ class PythonPluginClass(Plugin): - - def we_are_translated(self): - return objectmodel.we_are_translated() + pass PythonPlugin = PythonPluginClass() @@ -43,35 +41,35 @@ def startup(space, argv): result_is_new_frame=True) def eval(interp, s_frame, w_rcvr, source, filename, cmd): from rsqueakvm.plugins.python import execution - # Reset error and state - global_state.wp_result.set(None) - global_state.wp_operror.set(None) # import pdb; pdb.set_trace() - execution.start_new_thread( - source, filename, cmd, translated=PythonPlugin.we_are_translated()) + language = execution.W_PythonLanguage(source, filename, cmd) + language.start() # when we are here, the Python process has yielded - return execution.switch_to_smalltalk(interp, s_frame, first_call=True) + return language.switch_to_smalltalk(interp, s_frame, first_call=True) -@PythonPlugin.expose_primitive(unwrap_spec=[object], result_is_new_frame=True) -def resumePython(interp, s_frame, w_rcvr): +@PythonPlugin.expose_primitive(unwrap_spec=[object, object], + result_is_new_frame=True) +def resume(interp, s_frame, w_rcvr, language): from rsqueakvm.plugins.python import execution # print 'Smalltalk yield' # import pdb; pdb.set_trace() - if not execution.resume_thread(): + if not isinstance(language, execution.W_ForeignLanguage): raise PrimitiveFailedError - return execution.switch_to_smalltalk(interp, s_frame) - - -@PythonPlugin.expose_primitive(unwrap_spec=[object]) -def lastResult(interp, s_frame, w_rcvr): - return W_PythonObject(global_state.wp_result.get()) + if not language.resume(): + raise PrimitiveFailedError + return language.switch_to_smalltalk(interp, s_frame) @PythonPlugin.expose_primitive(unwrap_spec=[object]) def lastError(interp, s_frame, w_rcvr): - operr = global_state.wp_operror.get() + language = py_space.getexecutioncontext().current_language + if language is None: + print 'language was None in lastError' + raise PrimitiveFailedError + operr = language.get_error() if operr is None: + print 'operr was None in lastError' raise PrimitiveFailedError return W_PythonObject(utils.operr_to_pylist(operr)) @@ -116,8 +114,7 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, def asSmalltalk(interp, s_frame, w_rcvr): if not isinstance(w_rcvr, model.W_PythonObject): raise PrimitiveFailedError - w_result = utils.python_to_smalltalk(interp.space, w_rcvr.wp_object) - return w_result + return utils.python_to_smalltalk(interp.space, w_rcvr.wp_object) @PythonPlugin.expose_primitive(compiled_method=True) diff --git a/rsqueakvm/test/plugins/python/test_end_to_end.py b/rsqueakvm/test/plugins/python/test_end_to_end.py index b656a59a..1b3a9d07 100644 --- a/rsqueakvm/test/plugins/python/test_end_to_end.py +++ b/rsqueakvm/test/plugins/python/test_end_to_end.py @@ -84,3 +84,9 @@ def test_smalltalk(): assert isinstance(res, W_PointersObject) assert res.getclass(space) is space.w_Array assert res.size() == 4 + + +def test_error(): + x = get_python_result('1/0', 'eval') + assert len(x) == 2 + assert x[0] == 'ZeroDivisionError' diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 48dc8a2f..0d754edb 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -1,4 +1,4 @@ -from rsqueakvm.plugins.python.global_state import py_space, wp_operror +from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.plugins.python.patching import patch_pypy from pypy.interpreter.error import OperationError @@ -21,7 +21,8 @@ def no_error_caught(code, cmd): pycode = compilecode(py_space, code, '', cmd) py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) py_frame.run() - return wp_operror.get() is None + language = py_space.getexecutioncontext().current_language + return language is not None and language.wp_operror is None def test_simple_exception(): From 7a528fc95919d472f649542d382f343e3e2bf3d7 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 9 Mar 2017 17:32:35 +0100 Subject: [PATCH 113/193] Update in-image code for new VM API [ci skip] --- .../ForeignLanguage.class/README.md | 0 .../methodProperties.json | 5 ++ .../ForeignLanguage.class/properties.json | 14 +++++ .../ForeignLanguageException.class/README.md | 0 .../instance/action..st | 3 ++ .../instance/action.st | 3 ++ .../instance/defaultAction.st | 3 ++ .../methodProperties.json | 7 +++ .../properties.json | 14 +++++ .../class/openDebuggerWithPythonFrames..st | 2 +- .../Python.class/class/primLastResult.st | 4 -- .../Python.class/class/primResume..st | 4 ++ .../Python.class/class/primResume.st | 4 -- .../Python.class/class/resume..st | 11 ++++ .../Python.class/class/resumeFrame.st | 7 --- .../Python.class/class/setUpPygments.st | 5 +- .../Python.class/methodProperties.json | 9 ++-- .../PythonObject.class/instance/isNone.st | 3 ++ .../PythonObject.class/instance/notNil.st | 3 -- .../PythonObject.class/instance/notNone.st | 3 ++ .../PythonObject.class/methodProperties.json | 3 +- .../monticello.meta/version | 2 +- .../class/highlight..st | 5 +- .../methodProperties.json | 2 +- .../monticello.meta/version | 2 +- .../class/exploreFrames.st | 2 +- .../class/prependPythonContexts..st | 2 +- .../instance/aboutToStyle..st | 7 ++- .../methodProperties.json | 6 +-- .../instance/buildWith..st | 54 +++++++++++++++++++ .../methodProperties.json | 3 +- .../monticello.meta/version | 2 +- 32 files changed, 154 insertions(+), 40 deletions(-) create mode 100644 repository/Python-Core.package/ForeignLanguage.class/README.md create mode 100644 repository/Python-Core.package/ForeignLanguage.class/methodProperties.json create mode 100644 repository/Python-Core.package/ForeignLanguage.class/properties.json create mode 100644 repository/Python-Core.package/ForeignLanguageException.class/README.md create mode 100644 repository/Python-Core.package/ForeignLanguageException.class/instance/action..st create mode 100644 repository/Python-Core.package/ForeignLanguageException.class/instance/action.st create mode 100644 repository/Python-Core.package/ForeignLanguageException.class/instance/defaultAction.st create mode 100644 repository/Python-Core.package/ForeignLanguageException.class/methodProperties.json create mode 100644 repository/Python-Core.package/ForeignLanguageException.class/properties.json delete mode 100644 repository/Python-Core.package/Python.class/class/primLastResult.st create mode 100644 repository/Python-Core.package/Python.class/class/primResume..st delete mode 100644 repository/Python-Core.package/Python.class/class/primResume.st create mode 100644 repository/Python-Core.package/Python.class/class/resume..st delete mode 100644 repository/Python-Core.package/Python.class/class/resumeFrame.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/isNone.st delete mode 100644 repository/Python-Core.package/PythonObject.class/instance/notNil.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/notNone.st create mode 100644 repository/Python-Tools.package/PythonObjectExplorer.class/instance/buildWith..st diff --git a/repository/Python-Core.package/ForeignLanguage.class/README.md b/repository/Python-Core.package/ForeignLanguage.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/ForeignLanguage.class/methodProperties.json b/repository/Python-Core.package/ForeignLanguage.class/methodProperties.json new file mode 100644 index 00000000..0e4a6622 --- /dev/null +++ b/repository/Python-Core.package/ForeignLanguage.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + } } diff --git a/repository/Python-Core.package/ForeignLanguage.class/properties.json b/repository/Python-Core.package/ForeignLanguage.class/properties.json new file mode 100644 index 00000000..d55b39ba --- /dev/null +++ b/repository/Python-Core.package/ForeignLanguage.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "ForeignLanguage", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/Python-Core.package/ForeignLanguageException.class/README.md b/repository/Python-Core.package/ForeignLanguageException.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/ForeignLanguageException.class/instance/action..st b/repository/Python-Core.package/ForeignLanguageException.class/instance/action..st new file mode 100644 index 00000000..1f24f374 --- /dev/null +++ b/repository/Python-Core.package/ForeignLanguageException.class/instance/action..st @@ -0,0 +1,3 @@ +accessing +action: anObject + action := anObject \ No newline at end of file diff --git a/repository/Python-Core.package/ForeignLanguageException.class/instance/action.st b/repository/Python-Core.package/ForeignLanguageException.class/instance/action.st new file mode 100644 index 00000000..e1deac0d --- /dev/null +++ b/repository/Python-Core.package/ForeignLanguageException.class/instance/action.st @@ -0,0 +1,3 @@ +accessing +action + ^ action \ No newline at end of file diff --git a/repository/Python-Core.package/ForeignLanguageException.class/instance/defaultAction.st b/repository/Python-Core.package/ForeignLanguageException.class/instance/defaultAction.st new file mode 100644 index 00000000..7c4499c4 --- /dev/null +++ b/repository/Python-Core.package/ForeignLanguageException.class/instance/defaultAction.st @@ -0,0 +1,3 @@ +accessing +defaultAction + self action value \ No newline at end of file diff --git a/repository/Python-Core.package/ForeignLanguageException.class/methodProperties.json b/repository/Python-Core.package/ForeignLanguageException.class/methodProperties.json new file mode 100644 index 00000000..6959dc31 --- /dev/null +++ b/repository/Python-Core.package/ForeignLanguageException.class/methodProperties.json @@ -0,0 +1,7 @@ +{ + "class" : { + }, + "instance" : { + "action" : "fn 3/9/2017 16:43", + "action:" : "fn 3/9/2017 16:43", + "defaultAction" : "fn 3/9/2017 16:45" } } diff --git a/repository/Python-Core.package/ForeignLanguageException.class/properties.json b/repository/Python-Core.package/ForeignLanguageException.class/properties.json new file mode 100644 index 00000000..6fd6b1dc --- /dev/null +++ b/repository/Python-Core.package/ForeignLanguageException.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "action" ], + "name" : "ForeignLanguageException", + "pools" : [ + ], + "super" : "Exception", + "type" : "normal" } diff --git a/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st b/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st index 3cd669ad..c263e7ac 100644 --- a/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st +++ b/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st @@ -2,7 +2,7 @@ system primitives openDebuggerWithPythonFrames: pyError | resumeCtx error | resumeCtx := thisContext sender. - [ resumeCtx method selector = #resumeFrame + [ resumeCtx method selector = #resume: and: [ resumeCtx closure isNil ] ] whileFalse: [ resumeCtx := resumeCtx sender. diff --git a/repository/Python-Core.package/Python.class/class/primLastResult.st b/repository/Python-Core.package/Python.class/class/primLastResult.st deleted file mode 100644 index 6d8aa1dc..00000000 --- a/repository/Python-Core.package/Python.class/class/primLastResult.st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primLastResult - - ^ nil \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primResume..st b/repository/Python-Core.package/Python.class/class/primResume..st new file mode 100644 index 00000000..179b7983 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primResume..st @@ -0,0 +1,4 @@ +experimental +primResume: aPyRunner + + self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primResume.st b/repository/Python-Core.package/Python.class/class/primResume.st deleted file mode 100644 index 8bd99e0e..00000000 --- a/repository/Python-Core.package/Python.class/class/primResume.st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -primResume - - self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/resume..st b/repository/Python-Core.package/Python.class/class/resume..st new file mode 100644 index 00000000..113de556 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/resume..st @@ -0,0 +1,11 @@ +special methods +resume: aPyRunner + "Magic method that is called by vm (cached in vm)" + Processor yield. + [ ^ self primResume: aPyRunner ] on: Error do: [ + Smalltalk isHeadless ifFalse: [ + self primLastError ifNotNil: [ :e | + ForeignLanguageException new + action: [ self openDebuggerWithPythonFrames: e ]; + signal ] ]. + ^ self resume: aPyRunner ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/resumeFrame.st b/repository/Python-Core.package/Python.class/class/resumeFrame.st deleted file mode 100644 index 34877bda..00000000 --- a/repository/Python-Core.package/Python.class/class/resumeFrame.st +++ /dev/null @@ -1,7 +0,0 @@ -special methods -resumeFrame - "Magic method that is called by vm (cached in vm)" - Processor yield. - [ ^ self primResume ] on: Error do: [ - self primLastError ifNotNil: [ :e | self openDebuggerWithPythonFrames: e ]. - ^ self resumeFrame ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPygments.st b/repository/Python-Core.package/Python.class/class/setUpPygments.st index a3782474..7c01f6f2 100644 --- a/repository/Python-Core.package/Python.class/class/setUpPygments.st +++ b/repository/Python-Core.package/Python.class/class/setUpPygments.st @@ -4,6 +4,7 @@ setUpPygments breakOnExceptions := self primBreakOnExceptions. self primBreakOnExceptions: false. self exec: ' +import re import pygments import pygments.lexers import pygments.formatters @@ -12,5 +13,7 @@ _pygments_lexer_python = pygments.lexers.get_lexer_by_name( _pygments_lexer_smalltalk = pygments.lexers.get_lexer_by_name( "smalltalk", encoding="utf-8", stripnl=False, ensurenl=False) _pygments_formatter = pygments.formatters.get_formatter_by_name( - "html", encoding="utf-8", style="colorful", nowrap=True, noclasses=True, lineseparator="
")'. + "html", encoding="utf-8", style="colorful", nowrap=True, noclasses=True, lineseparator="
") +def _pygments_highlight(code): + return re.sub("
$", "", pygments.highlight(code, _pygments_lexer_python, _pygments_formatter))'. self primBreakOnExceptions: breakOnExceptions. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json index f941dfc4..58b4ece7 100644 --- a/repository/Python-Core.package/Python.class/methodProperties.json +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -20,7 +20,7 @@ "isExpression:" : "fn 2/26/2017 21:45", "load:" : "fn 1/9/2017 20:54", "locals" : "fn 2/26/2017 21:46", - "openDebuggerWithPythonFrames:" : "fn 3/6/2017 10:23", + "openDebuggerWithPythonFrames:" : "fn 3/8/2017 21:52", "persistPyCode:" : "fn 2/1/2017 12:46", "peval:" : "fn 2/23/2017 21:12", "pexec:" : "fn 2/23/2017 21:12", @@ -30,10 +30,9 @@ "primEval:filename:cmd:" : "fn 2/1/2017 10:55", "primGetTopFrame" : "fn 1/11/2017 11:19", "primLastError" : "fn 1/28/2017 13:37", - "primLastResult" : "fn 1/30/2017 15:34", "primPythonAt:" : "fn 2/25/2017 17:03", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", - "primResume" : "fn 2/22/2017 10:47", + "primResume:" : "fn 3/8/2017 15:10", "prun:" : "fn 2/23/2017 21:36", "pyFormatter" : "fn 3/6/2017 07:20", "pyInspect" : "fn 1/29/2017 22:15", @@ -44,9 +43,9 @@ "restartFrame" : "fn 2/22/2017 10:21", "restartFrame:with:" : "fn 2/22/2017 14:14", "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", - "resumeFrame" : "fn 3/6/2017 12:58", + "resume:" : "fn 3/9/2017 16:45", "run:" : "fn 2/23/2017 21:37", - "setUpPygments" : "fn 3/6/2017 22:44", + "setUpPygments" : "fn 3/9/2017 16:03", "setUpPythonEnvironment" : "fn 3/6/2017 07:11", "single:" : "fn 2/1/2017 10:55", "startUp:" : "fn 3/6/2017 09:47", diff --git a/repository/Python-Core.package/PythonObject.class/instance/isNone.st b/repository/Python-Core.package/PythonObject.class/instance/isNone.st new file mode 100644 index 00000000..b578dff2 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/isNone.st @@ -0,0 +1,3 @@ +overrides +isNone + ^ self == Python None \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/notNil.st b/repository/Python-Core.package/PythonObject.class/instance/notNil.st deleted file mode 100644 index fe0f455d..00000000 --- a/repository/Python-Core.package/PythonObject.class/instance/notNil.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -notNil - ^ self ~~ Python None \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/notNone.st b/repository/Python-Core.package/PythonObject.class/instance/notNone.st new file mode 100644 index 00000000..1e61cf67 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/notNone.st @@ -0,0 +1,3 @@ +overrides +notNone + ^ self isNone not \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/methodProperties.json b/repository/Python-Core.package/PythonObject.class/methodProperties.json index 7e9a5621..d9c1d8a1 100644 --- a/repository/Python-Core.package/PythonObject.class/methodProperties.json +++ b/repository/Python-Core.package/PythonObject.class/methodProperties.json @@ -36,8 +36,9 @@ "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", "isClass" : "fn 2/26/2017 21:42", "isKindOf:" : "fn 12/25/2016 14:47", + "isNone" : "fn 3/9/2017 15:18", "isPython" : "fn 2/10/2017 12:12", - "notNil" : "fn 3/6/2017 10:21", + "notNone" : "fn 3/9/2017 15:19", "printOn:" : "fn 3/6/2017 10:07", "pyDictKeys" : "fn 2/26/2017 21:42", "pyDictValues" : "fn 2/26/2017 21:42", diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index 977c0b96..2bb01345 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st b/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st index 75192ead..474750e4 100644 --- a/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st +++ b/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st @@ -1,6 +1,7 @@ as yet unclassified highlight: aText - ^ (Python pygments + ^ (Python eval: '_pygments_highlight("""', aText string, '""")') asSmalltalk asTextFromHtml + "^ (Python pygments highlight: aText string lexer: Python pyLexerPython - formatter: Python pyFormatter) asSmalltalk asTextFromHtml \ No newline at end of file + formatter: Python pyFormatter) asSmalltalk asTextFromHtml" \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json b/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json index d13add1b..da531b42 100644 --- a/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json +++ b/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json @@ -1,6 +1,6 @@ { "class" : { - "highlight:" : "fn 3/6/2017 19:04", + "highlight:" : "fn 3/9/2017 16:04", "highlightSmalltalk:" : "fn 3/6/2017 19:14" }, "instance" : { "format:" : "fn 3/8/2017 13:30", diff --git a/repository/Python-Support.package/monticello.meta/version b/repository/Python-Support.package/monticello.meta/version index 2866cfa6..649375fd 100644 --- a/repository/Python-Support.package/monticello.meta/version +++ b/repository/Python-Support.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Support-fn.5' message 'Remove subclasses of ToolBuilder components and improve styler' id '54f42651-6fe8-4210-a3d6-abd6dafbf941' date '8 March 2017' time '2:31:01.373803 pm' author 'fn' ancestors ((name 'Python-Support-fn.4' message 'Subclass SmalltalkEditor and TextMorphForEditView in order to be able to override more methods for Python support' id '51fa2773-8f66-4c87-addd-63154eea2da4' date '7 March 2017' time '6:17:46.751045 pm' author 'fn' ancestors ((name 'Python-Support-fn.3' message 'Bugfixes and improvements' id '4be9a02d-4982-447a-903e-e713baea85eb' date '7 March 2017' time '2:35:26.793869 pm' author 'fn' ancestors ((name 'Python-Support-fn.2' message 'Cleanups' id '43742c0b-6a9b-4827-a079-7202613e72c3' date '7 March 2017' time '12:46:02.428302 pm' author 'fn' ancestors ((name 'Python-Support-fn.1' message 'Initial commit' id 'fcd0af1c-1b0a-4cf5-be6c-b6ebab6bcfc6' date '6 March 2017' time '9:43:26.501112 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Support-fn.6' message 'Use pygments directly for now' id '406bf113-f057-4281-9f92-92ed198f9b7a' date '9 March 2017' time '5:31:56.457797 pm' author 'fn' ancestors ((name 'Python-Support-fn.5' message 'Remove subclasses of ToolBuilder components and improve styler' id '54f42651-6fe8-4210-a3d6-abd6dafbf941' date '8 March 2017' time '2:31:01.373803 pm' author 'fn' ancestors ((name 'Python-Support-fn.4' message 'Subclass SmalltalkEditor and TextMorphForEditView in order to be able to override more methods for Python support' id '51fa2773-8f66-4c87-addd-63154eea2da4' date '7 March 2017' time '6:17:46.751045 pm' author 'fn' ancestors ((name 'Python-Support-fn.3' message 'Bugfixes and improvements' id '4be9a02d-4982-447a-903e-e713baea85eb' date '7 March 2017' time '2:35:26.793869 pm' author 'fn' ancestors ((name 'Python-Support-fn.2' message 'Cleanups' id '43742c0b-6a9b-4827-a079-7202613e72c3' date '7 March 2017' time '12:46:02.428302 pm' author 'fn' ancestors ((name 'Python-Support-fn.1' message 'Initial commit' id 'fcd0af1c-1b0a-4cf5-be6c-b6ebab6bcfc6' date '6 March 2017' time '9:43:26.501112 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st b/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st index 044f6790..5091bf0a 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st @@ -3,7 +3,7 @@ exploreFrames | currentFrame result frameInfo | currentFrame := Python primGetTopFrame. result := OrderedCollection new. - [ currentFrame notNil ] whileTrue: [ + [ currentFrame notNone ] whileTrue: [ frameInfo := IdentityDictionary new add: #f_lineno->(currentFrame f_lineno); add: #co_name->(currentFrame f_code co_name); diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st b/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st index c1dac69e..0de21793 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st +++ b/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st @@ -4,7 +4,7 @@ prependPythonContexts: aContext currentPyFrame := Python primGetTopFrame. currentPyFrame ifNil: [ ^ aContext ]. newFrames := OrderedCollection new. - [ currentPyFrame notNil ] + [ currentPyFrame notNone ] whileTrue: [ | newCtx | newCtx := self newPyContext. newCtx pyFrame: currentPyFrame. diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st b/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st index 16fac914..967390cc 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st +++ b/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st @@ -1,5 +1,8 @@ overrides aboutToStyle: aStyler - (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. - aStyler isPythonCode: self hasPyContextSelected. + self isModeStyleable ifFalse: [^false]. + self hasPyContextSelected ifFalse: [^ super aboutToStyle: aStyler]. + aStyler + classOrMetaClass: self selectedClassOrMetaClass; + isPythonCode: self hasPyContextSelected. ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json b/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json index 41347daa..7eeb83a1 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json +++ b/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json @@ -1,6 +1,6 @@ { "class" : { - "exploreFrames" : "fn 1/18/2017 17:34", + "exploreFrames" : "fn 3/9/2017 15:20", "filterPySource:lineno:" : "fn 2/2/2017 00:01", "getContentsOf:" : "fn 2/1/2017 22:37", "getPySource:" : "fn 3/6/2017 10:25", @@ -8,12 +8,12 @@ "indent:by:" : "fn 2/1/2017 22:41", "indentSize:" : "fn 2/1/2017 22:36", "newPyContext" : "fn 3/7/2017 13:48", - "prependPythonContexts:" : "fn 3/6/2017 10:19", + "prependPythonContexts:" : "fn 3/9/2017 15:19", "replaceInPySource:content:lineno:" : "fn 2/2/2017 00:05", "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", "setPySourceContent:content:" : "fn 3/6/2017 10:26" }, "instance" : { - "aboutToStyle:" : "fn 3/8/2017 14:25", + "aboutToStyle:" : "fn 3/8/2017 22:05", "buildCodePaneWith:" : "fn 3/8/2017 12:50", "contents:notifying:" : "fn 3/6/2017 19:17", "contextForStack:" : "fn 2/21/2017 12:48", diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/instance/buildWith..st b/repository/Python-Tools.package/PythonObjectExplorer.class/instance/buildWith..st new file mode 100644 index 00000000..4fad1914 --- /dev/null +++ b/repository/Python-Tools.package/PythonObjectExplorer.class/instance/buildWith..st @@ -0,0 +1,54 @@ +as yet unclassified +buildWith: builder + + | windowSpec treeSpec textSpec buttonSpec buttonOffset tool | + windowSpec := builder pluggableWindowSpec new. + windowSpec + model: self; + children: OrderedCollection new; + label: #label; + extent: self initialExtent. + + treeSpec := builder pluggableTreeSpec new. + treeSpec + model: self; + nodeClass: self class nodeClass; + roots: #getList; + keyPress: #explorerKey:from:event:; + getSelected: #currentSelection; + setSelected: #currentSelection:; + setSelectedParent: #currentParent:; + menu: #genericMenu:; + autoDeselect: false; + columns: (ObjectExplorerWrapper showContentsInColumns + ifTrue: [{ + [:listMorph | (listMorph filteredItems collect: [:item | + item preferredWidthOfColumn: 1]) max]. + nil "take all the space"}]); + frame: (0@0 corner: 1@0.71). + windowSpec children add: treeSpec. + + buttonOffset := (Preferences standardButtonFont widthOfString: 'inspect') * 3/2. + + textSpec := builder pluggableCodePaneSpec new. + textSpec + model: self; + getText: #expression; + editText: #expression:; + menu: #codePaneMenu:shifted:; + help: 'Evaluate expressions for the current tree selection...' translated; + frame: (LayoutFrame fractions: (0@0.71 corner: 1@1) offsets: (0@0 corner: buttonOffset negated@0)); + stylerClass: PythonTextStyler. + windowSpec children add: textSpec. + + buttonSpec := builder pluggableButtonSpec new + model: self; + label: 'inspect'; + action: #inspectObject; + help: 'Switch to an inspector tool'; + frame: (LayoutFrame fractions: (1@0.71 corner: 1@1) offsets: (buttonOffset negated@0 corner: 0 @ 0)). + windowSpec children add: buttonSpec. + + tool := builder build: windowSpec. + self changed: #expandRootsRequested. + ^ tool \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json b/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json index 97c081e7..8ea71aa3 100644 --- a/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json +++ b/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json @@ -2,4 +2,5 @@ "class" : { }, "instance" : { - "aboutToStyle:" : "fn 3/8/2017 14:26" } } + "aboutToStyle:" : "fn 3/8/2017 14:26", + "buildWith:" : "fn 3/9/2017 13:55" } } diff --git a/repository/Python-Tools.package/monticello.meta/version b/repository/Python-Tools.package/monticello.meta/version index d1691b51..83526bef 100644 --- a/repository/Python-Tools.package/monticello.meta/version +++ b/repository/Python-Tools.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Tools-fn.5' message 'Improve tools' id '7c6b41c2-c667-46b4-9abc-f5fbf69004bc' date '8 March 2017' time '2:31:16.168274 pm' author 'fn' ancestors ((name 'Python-Tools-fn.4' message 'Improve tools' id 'ced3b5a9-1f04-4750-83ba-8f6843db82ae' date '7 March 2017' time '6:18:03.279361 pm' author 'fn' ancestors ((name 'Python-Tools-fn.3' message 'Bugfixes and improvements' id '792d3734-4178-4d27-bc88-d784f9183768' date '7 March 2017' time '2:35:35.338398 pm' author 'fn' ancestors ((name 'Python-Tools-fn.2' message 'Improve PythonBrowser' id 'b2daaaa3-4839-413d-83df-802a71cb1aa4' date '7 March 2017' time '12:46:26.065217 pm' author 'fn' ancestors ((name 'Python-Tools-fn.1' message 'Initial commit' id '161df5a6-e3ff-4071-9c06-90faa842786d' date '6 March 2017' time '9:43:40.029266 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Tools-fn.6' message 'Minor bug fixes and improvements' id 'abd61547-ec74-40a6-9ff4-bb6df4fb922f' date '9 March 2017' time '5:32:14.523757 pm' author 'fn' ancestors ((name 'Python-Tools-fn.5' message 'Improve tools' id '7c6b41c2-c667-46b4-9abc-f5fbf69004bc' date '8 March 2017' time '2:31:16.168274 pm' author 'fn' ancestors ((name 'Python-Tools-fn.4' message 'Improve tools' id 'ced3b5a9-1f04-4750-83ba-8f6843db82ae' date '7 March 2017' time '6:18:03.279361 pm' author 'fn' ancestors ((name 'Python-Tools-fn.3' message 'Bugfixes and improvements' id '792d3734-4178-4d27-bc88-d784f9183768' date '7 March 2017' time '2:35:35.338398 pm' author 'fn' ancestors ((name 'Python-Tools-fn.2' message 'Improve PythonBrowser' id 'b2daaaa3-4839-413d-83df-802a71cb1aa4' date '7 March 2017' time '12:46:26.065217 pm' author 'fn' ancestors ((name 'Python-Tools-fn.1' message 'Initial commit' id '161df5a6-e3ff-4071-9c06-90faa842786d' date '6 March 2017' time '9:43:40.029266 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From c6dffa9b354803249c7162e61c6c1dbd65a3b126 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 9 Mar 2017 17:33:14 +0100 Subject: [PATCH 114/193] Enable OptionKeyBit modifier on macOS --- rsqueakvm/display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsqueakvm/display.py b/rsqueakvm/display.py index de8162fa..bfcf38ca 100644 --- a/rsqueakvm/display.py +++ b/rsqueakvm/display.py @@ -446,7 +446,7 @@ def get_mouse_event_buttons_and_mods(self): if btn == RedButtonBit: if mods & CtrlKeyBit: btn = BlueButtonBit - elif mods & CommandKeyBit: + elif mods & (CommandKeyBit | OptionKeyBit): btn = YellowButtonBit return (btn, mods) From 1ed77f71c4f18010e6d41a0d2699860e28c9fded Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 9 Mar 2017 19:53:31 +0100 Subject: [PATCH 115/193] Fix crash --- rsqueakvm/plugins/python/execution.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py index 7e945a9a..1d8c6d2c 100644 --- a/rsqueakvm/plugins/python/execution.py +++ b/rsqueakvm/plugins/python/execution.py @@ -5,11 +5,10 @@ from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist -from rpython.rlib import objectmodel +from rpython.rlib import objectmodel, rstacklet from pypy.interpreter.error import OperationError from pypy.interpreter.executioncontext import ExecutionContext -from pypy.module._continuation.interp_continuation import build_sthread ExecutionContext.current_language = None @@ -196,10 +195,15 @@ class StackletLanguageRunner(AbstractLanguageRunner): def __init__(self, language): AbstractLanguageRunner.__init__(self, language) - self.sthread = build_sthread(gs.py_space) + self.sthread = self.ensure_sthread() self.language_handle = self.sthread.get_null_handle() self.smalltalk_handle = self.sthread.get_null_handle() + def ensure_sthread(self): + if self.sthread is None: + self.sthread = rstacklet.StackletThread() + return self.sthread + def start_thread(self): global_execution_state.origin = self self.language_handle = self.sthread.new( @@ -230,7 +234,7 @@ def new_stacklet_callback(h, arg): self.smalltalk_handle = h global_execution_state.clear() self.language().run() - # global_execution_state.origin = self + global_execution_state.origin = self return self.smalltalk_handle # return to Smalltalk when done From 922cc63149de951e972bdb0de4baae7170ba8a23 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 9 Mar 2017 19:53:45 +0100 Subject: [PATCH 116/193] Return operr in send primitive --- rsqueakvm/plugins/python_plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index f80ad29f..e171cdcd 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -149,9 +149,9 @@ def send(interp, s_frame, argcount, w_method): wp_result = py_space.w_None else: wp_result = py_attr - except OperationError as operationerr: - print 'Operror in send (%s)' % operationerr.errorstr(py_space) - raise PrimitiveFailedError + except OperationError as operr: + print 'Operror in send (%s)' % operr.errorstr(py_space) + return W_PythonObject(utils.operr_to_pylist(operr)) except Exception as e: print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) raise PrimitiveFailedError From ce6aa1ffd19446ba4134aa1b8abcaa87d1a44a70 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 9 Mar 2017 23:57:52 +0100 Subject: [PATCH 117/193] Separate common code for foreign language support --- .../plugins/foreign_language/__init__.py | 0 .../plugins/foreign_language/global_state.py | 21 ++ rsqueakvm/plugins/foreign_language/model.py | 215 +++++++++++++ rsqueakvm/plugins/foreign_language/runner.py | 102 ++++++ rsqueakvm/plugins/python/execution.py | 293 ------------------ rsqueakvm/plugins/python/global_state.py | 19 +- rsqueakvm/plugins/python/language.py | 55 ++++ rsqueakvm/plugins/python/model.py | 48 +-- rsqueakvm/plugins/python_plugin.py | 17 +- .../plugins/python/test_pyframe_exceptions.py | 2 +- 10 files changed, 416 insertions(+), 356 deletions(-) create mode 100644 rsqueakvm/plugins/foreign_language/__init__.py create mode 100644 rsqueakvm/plugins/foreign_language/global_state.py create mode 100644 rsqueakvm/plugins/foreign_language/model.py create mode 100644 rsqueakvm/plugins/foreign_language/runner.py delete mode 100644 rsqueakvm/plugins/python/execution.py create mode 100644 rsqueakvm/plugins/python/language.py diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/rsqueakvm/plugins/foreign_language/global_state.py b/rsqueakvm/plugins/foreign_language/global_state.py new file mode 100644 index 00000000..b674a538 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/global_state.py @@ -0,0 +1,21 @@ +from rsqueakvm.error import Exit +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.util.cells import QuasiConstant + +w_foreign_language_class = QuasiConstant(None, type=W_PointersObject) +_initialized = [False] + + +def startup(space): + if _initialized[0]: + return + + foreign_language_class = space.smalltalk_at('ForeignLanguage') + if foreign_language_class is None: + # disable plugin? + error_msg = 'ForeignLanguage class not found.' + print error_msg + raise Exit(error_msg) + w_foreign_language_class.set(foreign_language_class) + + _initialized[0] = True diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py new file mode 100644 index 00000000..576f6b39 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -0,0 +1,215 @@ +from rsqueakvm.plugins.foreign_language import runner, global_state +from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash +from rsqueakvm.model.compiled_methods import ( + W_PreSpurCompiledMethod, W_SpurCompiledMethod) +from rsqueakvm.storage_classes import ClassShadow + +from pypy.interpreter.executioncontext import ExecutionContext + +from rpython.rlib import objectmodel + + +ExecutionContext.current_language = None + + +class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): + _attrs_ = ['_runner', '_done', 'w_result', 'w_error'] + repr_classname = 'W_ForeignLanguage' + + def __init__(self): + W_AbstractObjectWithIdentityHash.__init__(self) + self._done = False + if objectmodel.we_are_translated(): + self._runner = runner.StackletLanguageRunner(self) + else: + self._runner = runner.GreenletLanguageRunner(self) + + # W_AbstractObjectWithIdentityHash overrides + + def at0(self, space, index0): + # import pdb; pdb.set_trace() + return space.w_nil + + def atput0(self, space, index0, w_value): + # import pdb; pdb.set_trace() + pass + + def fetch(self, space, n0): + # import pdb; pdb.set_trace() + return space.w_nil + + def store(self, space, n0, w_value): + # import pdb; pdb.set_trace() + pass + + def getclass(self, space): + return global_state.w_foreign_language_class.get() + + # Abstract methods + + def run(self): + raise NotImplementedError + + def set_result(self, result): + raise NotImplementedError + + def set_error(self, error): + raise NotImplementedError + + def set_current(self): + raise NotImplementedError + + def resume_class(self): + raise NotImplementedError + + def resume_method(self): + raise NotImplementedError + + # Helpers + + def start(self): + self.runner().start() + + def resume(self): + if self.is_done(): + # import pdb; pdb.set_trace() + print 'The runner is done and cannot be resumed' + return False + self.runner().resume() + return self.get_error() is None + + def runner(self): + return self._runner + + def mark_done(self): + self._done = True + + def is_done(self): + return self._done + + def get_result(self): + return self.w_result + + def get_error(self): + return self.w_error + + def reset_error(self): + self.w_error = None + + # Switching + + def switch_to_smalltalk(self, interp, s_frame, first_call=False): + from rsqueakvm.storage_contexts import ContextPartShadow + + # print 'Switch to Smalltalk' + if self.is_done(): + return self._create_return_frame(interp.space) + + s_resume_frame = ContextPartShadow.build_method_context( + interp.space, + self.resume_method(), + self.resume_class(), + [self] + ) + # import pdb; pdb.set_trace() + # we go one up, because the s_frame.w_method() is our fake method + if first_call or s_frame.w_method() is not self.resume_method(): + # assert s_frame.w_method() is not resume_method + s_resume_frame.store_s_sender(s_frame) + else: + if s_frame.w_method() is not self.resume_method(): + print 'Unexpected s_frame found.' + s_resume_frame.store_s_sender(s_frame.s_sender()) + interp.quick_check_for_interrupt(s_resume_frame, + dec=interp.interrupt_counter_size) + # this will raise a ProcessSwitch if there are interrupts or timers ... + return s_resume_frame + + def _create_return_frame(self, space): + from rsqueakvm.storage_contexts import ContextPartShadow + print 'Python has finished and returned a result.' + # we want evalInThread and resumePython to return new frames, + # so we don't build up stack, but we also don't raise to the + # top-level loop all the time. + # For resuming, we obviously need a new frame, because that's + # how the Smalltalk scheduler knows how to continue back to Python. + # Unfortunately, a primitive can only EITHER always return a new + # frame OR a result. So when we get a result, we cannot simply + # return it. Instead, we need to build a frame that simply returns + # the result + if space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_resume_class = self.resume_class() + w_cm.header = 0 + w_cm._primitive = 0 + w_cm.literalsize = 3 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.compiledin_class = w_resume_class.getclass(space) + w_cm.lookup_selector = 'fakeReturnResult' + w_cm.bytes = [chr(b) for b in [ + 0x20, # push constant + 0x7C, # return stack top + ]] + w_cm.literals = [self.get_result(), space.w_nil, w_cm.compiledin_class] + return ContextPartShadow.build_method_context( + space, w_cm, w_resume_class) + + +class W_ForeignLanguageObject(W_AbstractObjectWithIdentityHash): + _attrs_ = [] + _immutable_fields_ = [] + repr_classname = 'W_ForeignLanguageObject' + + # W_AbstractObjectWithIdentityHash overrides + + def at0(self, space, index0): + return space.w_nil + + def atput0(self, space, index0, w_value): + pass + + def fetch(self, space, n0): + return space.w_nil + + def store(self, space, n0, w_value): + pass + + # Abstract methods + + def getclass(self, space): + raise NotImplementedError + + def class_shadow(self, space): + raise NotImplementedError + + def is_same_object(self, other): + raise NotImplementedError + + +class ForeignLanguageClassShadow(ClassShadow): + _attrs_ = ['wp_object', 'wp_class'] + _immutable_fields_ = ['wp_class'] + + # Overrides + + def changed(self): + pass # Changes to foreign classes are not handled in Smalltalk + + def lookup(self, w_selector): + w_method = self.make_method(w_selector) + if w_method is not None: + return w_method + fallback = self.fallback_class().as_class_get_shadow(self.space) + return fallback.lookup(w_selector) + + # Abstract methods + + def fallback_class(self): + raise NotImplementedError + + def make_method(self, w_selector): + raise NotImplementedError diff --git a/rsqueakvm/plugins/foreign_language/runner.py b/rsqueakvm/plugins/foreign_language/runner.py new file mode 100644 index 00000000..307b1a38 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -0,0 +1,102 @@ +from rpython.rlib import rstacklet + + +class AbstractLanguageRunner(): + + def __init__(self, language): + self._language = language + + def language(self): + return self._language + + def start(self): + self.language().set_current() + self.start_thread() + + def start_thread(self): + raise NotImplementedError + + def resume(self): + self.language().set_current() + self.resume_thread() + + def resume_thread(self): + raise NotImplementedError + + def return_to_smalltalk(self): + raise NotImplementedError + + +class StackletLanguageRunner(AbstractLanguageRunner): + sthread = None + + def __init__(self, language): + AbstractLanguageRunner.__init__(self, language) + self.sthread = self.ensure_sthread() + self.language_handle = self.sthread.get_null_handle() + self.smalltalk_handle = self.sthread.get_null_handle() + + def ensure_sthread(self): + if self.sthread is None: + self.sthread = rstacklet.StackletThread() + return self.sthread + + def start_thread(self): + global_execution_state.origin = self + self.language_handle = self.sthread.new( + self.__class__.new_stacklet_callback) + + def resume_thread(self): + if not self._is_valid_handle(self.language_handle): + print 'language_handle not valid' + return + self.sthread.switch(self.language_handle) + + def return_to_smalltalk(self): + if not self._is_valid_handle(self.smalltalk_handle): + print 'smalltalk_handle not valid' + return + self.sthread.switch(self.smalltalk_handle) + + def _is_valid_handle(self, h): + if (self.sthread.is_empty_handle(h) or + h == self.sthread.get_null_handle()): + return False + return True + + @staticmethod + def new_stacklet_callback(h, arg): + print 'new_stacklet_callback:', h, arg + self = global_execution_state.origin + self.smalltalk_handle = h + global_execution_state.clear() + self.language().run() + global_execution_state.origin = self + return self.smalltalk_handle # return to Smalltalk when done + + +class GreenletLanguageRunner(AbstractLanguageRunner): + def start_thread(self): + from greenlet import greenlet + global_execution_state.origin = self + self.greenlet = greenlet(self.__class__.new_greenlet_callback()) + self.resume() # stacklets also start immediately + + def resume_thread(self): + self.greenlet.switch() + + def return_to_smalltalk(self): + self.greenlet.parent.switch() + + @staticmethod + def new_greenlet_callback(): + print 'new_greenlet_callback' + self = global_execution_state.origin + return self.language().run + + +class GlobalState: + def clear(self): + self.origin = None +global_execution_state = GlobalState() +global_execution_state.clear() diff --git a/rsqueakvm/plugins/python/execution.py b/rsqueakvm/plugins/python/execution.py deleted file mode 100644 index 1d8c6d2c..00000000 --- a/rsqueakvm/plugins/python/execution.py +++ /dev/null @@ -1,293 +0,0 @@ -from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash -from rsqueakvm.model.compiled_methods import ( - W_SpurCompiledMethod, W_PreSpurCompiledMethod) -from rsqueakvm.plugins.python import global_state as gs -from rsqueakvm.plugins.python.model import W_PythonObject -from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist - -from rpython.rlib import objectmodel, rstacklet - -from pypy.interpreter.error import OperationError -from pypy.interpreter.executioncontext import ExecutionContext - - -ExecutionContext.current_language = None - - -class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): - _attrs_ = ['_runner', '_done'] - repr_classname = 'W_ForeignLanguage' - - def __init__(self): - W_AbstractObjectWithIdentityHash.__init__(self) - self._done = False - if gs.translating[0]: - self._runner = StackletLanguageRunner(self) - else: - self._runner = GreenletLanguageRunner(self) - - def run(self): - raise NotImplementedError - - def set_result(self, result): - raise NotImplementedError - - def get_result(self): - raise NotImplementedError - - def set_error(self, error): - raise NotImplementedError - - def get_error(self): - raise NotImplementedError - - def start(self): - self.runner().start() - - def runner(self): - return self._runner - - def resume(self): - if self.is_done(): - # import pdb; pdb.set_trace() - print 'The runner is done and cannot be resumed' - return False - self.runner().resume() - return self.get_error() is None - - def is_done(self): - return self._done - - def set_current(self): - ec = gs.py_space.getexecutioncontext() - ec.current_language = self - - def switch_to_smalltalk(self, interp, s_frame, first_call=False): - from rsqueakvm.storage_contexts import ContextPartShadow - - # print 'Switch to Smalltalk' - if self.is_done(): - return _create_return_frame(interp.space, self.get_result()) - - resume_method = gs.w_python_resume_method.get() - s_resume_frame = ContextPartShadow.build_method_context( - interp.space, - resume_method, - gs.w_python_class.get(), - [self] - ) - # import pdb; pdb.set_trace() - # we go one up, because the s_frame.w_method() is our fake method - if first_call or s_frame.w_method() is not resume_method: - # assert s_frame.w_method() is not resume_method - s_resume_frame.store_s_sender(s_frame) - else: - if s_frame.w_method() is not resume_method: - print 'Unexpected s_frame found.' - s_resume_frame.store_s_sender(s_frame.s_sender()) - interp.quick_check_for_interrupt(s_resume_frame, - dec=interp.interrupt_counter_size) - # this will raise a ProcessSwitch if there are interrupts or timers ... - return s_resume_frame - - # Overrides - - def at0(self, space, index0): - # import pdb; pdb.set_trace() - return space.w_nil - - def atput0(self, space, index0, w_value): - # import pdb; pdb.set_trace() - pass - - def fetch(self, space, n0): - # import pdb; pdb.set_trace() - return space.w_nil - - def store(self, space, n0, w_value): - # import pdb; pdb.set_trace() - pass - - def getclass(self, space): - return gs.w_foreign_language_class.get() - - -class W_PythonLanguage(W_ForeignLanguage): - _attrs_ = ['source', 'filename', 'cmd', 'wp_result', 'wp_operror'] - repr_classname = 'W_PythonLanguage' - - def __init__(self, source, filename, cmd): - W_ForeignLanguage.__init__(self) - self.source = source - self.filename = filename - self.cmd = cmd - self.wp_result = None - self.wp_operror = None - - def run(self): - print 'Python start' - try: - # ensure py_space has a fresh exectioncontext - gs.py_space.threadlocals.enter_thread(gs.py_space) - - # switch back to Squeak before executing Python code - self.runner().return_to_smalltalk() - - retval = _run_eval_string(self.source, self.filename, self.cmd) - self.set_result(retval) - except OperationError as operr: - # operr was not handled by users, because they pressed proceed. - # save Python error as result instead. - self.set_result(operr_to_pylist(operr)) - except Exception as e: - print 'Unknown error in Python thread: %s' % e - finally: - self._done = True - - def set_result(self, result): - self.wp_result = result - - def get_result(self): - return self.wp_result - - def set_error(self, error): - self.wp_operror = error - - def get_error(self): - return self.wp_operror - - -class GlobalState: - def clear(self): - self.origin = None -global_execution_state = GlobalState() -global_execution_state.clear() - - -class AbstractLanguageRunner(): - - def __init__(self, language): - self._language = language - - def language(self): - return self._language - - def start(self): - self.language().set_current() - self.start_thread() - - def start_thread(self): - raise NotImplementedError - - def resume(self): - self.language().set_current() - self.resume_thread() - - def resume_thread(self): - raise NotImplementedError - - def return_to_smalltalk(self): - raise NotImplementedError - - -class StackletLanguageRunner(AbstractLanguageRunner): - sthread = None - - def __init__(self, language): - AbstractLanguageRunner.__init__(self, language) - self.sthread = self.ensure_sthread() - self.language_handle = self.sthread.get_null_handle() - self.smalltalk_handle = self.sthread.get_null_handle() - - def ensure_sthread(self): - if self.sthread is None: - self.sthread = rstacklet.StackletThread() - return self.sthread - - def start_thread(self): - global_execution_state.origin = self - self.language_handle = self.sthread.new( - self.__class__.new_stacklet_callback) - - def resume_thread(self): - if not self._is_valid_handle(self.language_handle): - print 'language_handle not valid' - return - self.sthread.switch(self.language_handle) - - def return_to_smalltalk(self): - if not self._is_valid_handle(self.smalltalk_handle): - print 'smalltalk_handle not valid' - return - self.sthread.switch(self.smalltalk_handle) - - def _is_valid_handle(self, h): - if (self.sthread.is_empty_handle(h) or - h == self.sthread.get_null_handle()): - return False - return True - - @staticmethod - def new_stacklet_callback(h, arg): - print 'new_stacklet_callback:', h, arg - self = global_execution_state.origin - self.smalltalk_handle = h - global_execution_state.clear() - self.language().run() - global_execution_state.origin = self - return self.smalltalk_handle # return to Smalltalk when done - - -class GreenletLanguageRunner(AbstractLanguageRunner): - def start_thread(self): - from greenlet import greenlet - global_execution_state.origin = self - self.greenlet = greenlet(self.__class__.new_greenlet_callback()) - self.resume() # stacklets also start immediately - - def resume_thread(self): - self.greenlet.switch() - - def return_to_smalltalk(self): - self.greenlet.parent.switch() - - @staticmethod - def new_greenlet_callback(): - print 'new_greenlet_callback' - self = global_execution_state.origin - return self.language().run - - -def _create_return_frame(space, wp_result): - from rsqueakvm.storage_contexts import ContextPartShadow - print 'Python has finished and returned a result.' - # we want evalInThread and resumePython to return new frames, - # so we don't build up stack, but we also don't raise to the - # top-level loop all the time. - # For resuming, we obviously need a new frame, because that's - # how the Smalltalk scheduler knows how to continue back to Python. - # Unfortunately, a primitive can only EITHER always return a new - # frame OR a result. So when we get a result, we cannot simply - # return it. Instead, we need to build a frame that simply returns - # the result - if space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_python_class = gs.w_python_class.get() - w_cm.header = 0 - w_cm._primitive = 0 - w_cm.literalsize = 3 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.compiledin_class = w_python_class.getclass(space) - w_cm.lookup_selector = 'fakeReturnResult' - w_cm.bytes = [chr(b) for b in [ - 0x20, # push constant - 0x7C, # return stack top - ]] - w_cm.literals = [W_PythonObject(wp_result), space.w_nil, - w_cm.compiledin_class] - return ContextPartShadow.build_method_context( - space, w_cm, w_python_class) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py index 1ee53236..bd35afd7 100644 --- a/rsqueakvm/plugins/python/global_state.py +++ b/rsqueakvm/plugins/python/global_state.py @@ -1,14 +1,13 @@ from rsqueakvm.error import Exit from rsqueakvm.model.compiled_methods import W_CompiledMethod from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.plugins.foreign_language import global_state as fl_gs from rsqueakvm.plugins.python.py_objspace import new_pypy_objspace from rsqueakvm.util.cells import QuasiConstant, Cell from pypy.interpreter.error import OperationError from pypy.interpreter.executioncontext import PeriodicAsyncAction -from rpython.rlib import objectmodel - class RestartException(OperationError): def __init__(self, py_frame_restart_info): @@ -44,7 +43,7 @@ def perform(self, ec, frame): # print 'Python continue' # operror has been in Smalltalk land, clear it now to allow resuming - language.set_error(None) + language.reset_error() # handle py_frame_restart_info if set restart_info = py_frame_restart_info.get() @@ -68,23 +67,15 @@ def perform(self, ec, frame): w_python_object_class = QuasiConstant(None, type=W_PointersObject) w_python_plugin_send = QuasiConstant(None, type=W_PointersObject) -translating = [True] - def startup(space): + fl_gs.startup(space) + w_python_plugin_send.set(space.wrap_list_unroll_safe([ space.wrap_string('PythonPlugin'), space.wrap_string('send') ])) - foreign_language_class = space.smalltalk_at('ForeignLanguage') - if foreign_language_class is None: - # disable plugin? - error_msg = 'ForeignLanguage class not found.' - print error_msg - raise Exit(error_msg) - w_foreign_language_class.set(foreign_language_class) - python_class = space.smalltalk_at('Python') if python_class is None: # disable plugin? @@ -110,5 +101,3 @@ def startup(space): print error_msg raise Exit(error_msg) w_python_resume_method.set(resume_method) - - translating[0] = objectmodel.we_are_translated() diff --git a/rsqueakvm/plugins/python/language.py b/rsqueakvm/plugins/python/language.py new file mode 100644 index 00000000..c83bf374 --- /dev/null +++ b/rsqueakvm/plugins/python/language.py @@ -0,0 +1,55 @@ +from rsqueakvm.plugins.foreign_language.model import W_ForeignLanguage +from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.python.model import W_PythonObject +from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist + +from pypy.interpreter.error import OperationError + + +class W_PythonLanguage(W_ForeignLanguage): + _attrs_ = ['source', 'filename', 'cmd'] + repr_classname = 'W_PythonLanguage' + + def __init__(self, source, filename, cmd): + W_ForeignLanguage.__init__(self) + self.source = source + self.filename = filename + self.cmd = cmd + self.w_result = None + self.w_error = None + + def run(self): + print 'Python start' + try: + # ensure py_space has a fresh exectioncontext + gs.py_space.threadlocals.enter_thread(gs.py_space) + + # switch back to Squeak before executing Python code + self.runner().return_to_smalltalk() + + retval = _run_eval_string(self.source, self.filename, self.cmd) + self.set_result(retval) + except OperationError as operr: + # operr was not handled by users, because they pressed proceed. + # save Python error as result instead. + self.set_result(operr_to_pylist(operr)) + except Exception as e: + print 'Unknown error in Python thread: %s' % e + finally: + self.mark_done() + + def set_current(self): + ec = gs.py_space.getexecutioncontext() + ec.current_language = self + + def set_result(self, wp_result): + self.w_result = W_PythonObject(wp_result) + + def set_error(self, wp_operr): + self.w_error = W_PythonObject(operr_to_pylist(wp_operr)) + + def resume_class(self): + return gs.w_python_class.get() + + def resume_method(self): + return gs.w_python_resume_method.get() diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 55939b81..c3ae2165 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -1,49 +1,29 @@ -from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash -from rsqueakvm.storage_classes import ClassShadow -from rsqueakvm.storage import AbstractCachingShadow +from rsqueakvm.plugins.foreign_language import model as fl_model +from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.primitives.constants import EXTERNAL_CALL from rsqueakvm.model.compiled_methods import ( W_PreSpurCompiledMethod, W_SpurCompiledMethod) -from rsqueakvm.plugins.python import global_state as gs -from rsqueakvm.plugins.python.global_state import py_space +from rsqueakvm.storage import AbstractCachingShadow from pypy.interpreter.error import OperationError from rpython.rlib import objectmodel -class W_PythonObject(W_AbstractObjectWithIdentityHash): +class W_PythonObject(fl_model.W_ForeignLanguageObject): _attrs_ = ['wp_object', 's_class'] _immutable_fields_ = ['wp_object', 's_class?'] repr_classname = 'W_PythonObject' def __init__(self, wp_object): - W_AbstractObjectWithIdentityHash.__init__(self) + fl_model.W_ForeignLanguageObject.__init__(self) self.wp_object = wp_object # self.w_pyID = None self.s_class = None - def at0(self, space, index0): - # import pdb; pdb.set_trace() - return space.w_nil - - def atput0(self, space, index0, w_value): - # import pdb; pdb.set_trace() - pass - - def fetch(self, space, n0): - # import pdb; pdb.set_trace() - return space.w_nil - - def store(self, space, n0, w_value): - # import pdb; pdb.set_trace() - pass - - def safe_getclass(self, space): - return W_PythonObject(self.wp_object.getclass(py_space)) - def getclass(self, space): - return self.safe_getclass(space) + return W_PythonObject(self.wp_object.getclass(py_space)) def class_shadow(self, space): return PythonClassShadow(space, self.wp_object) @@ -59,7 +39,7 @@ def is_same_object(self, other): other.wp_object is self.wp_object) -class PythonClassShadow(ClassShadow): +class PythonClassShadow(fl_model.ForeignLanguageClassShadow): _attrs_ = ['wp_object', 'wp_class'] _immutable_fields_ = ['wp_class'] @@ -71,16 +51,8 @@ def __init__(self, space, wp_object): AbstractCachingShadow.__init__( self, space, space.w_nil, 0, space.w_nil) - def changed(self): - pass # Changes to Python classes are handled in Python land - - def lookup(self, w_selector): - w_method = self.make_method(w_selector) - # import pdb; pdb.set_trace() - if w_method is not None: - return w_method - w_po = gs.w_python_object_class.get() - return w_po.as_class_get_shadow(self.space).lookup(w_selector) + def fallback_class(self): + return gs.w_python_object_class.get() def make_method(self, w_selector): # import pdb; pdb.set_trace() diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index e171cdcd..d39dd51f 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -7,9 +7,11 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.variable import W_BytesObject +from rsqueakvm.plugins.foreign_language.model import W_ForeignLanguage from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts from rsqueakvm.plugins.python import model, global_state, utils from rsqueakvm.plugins.python.global_state import py_space +from rsqueakvm.plugins.python.language import W_PythonLanguage from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.patching import patch_pypy @@ -40,9 +42,8 @@ def startup(space, argv): @PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str], result_is_new_frame=True) def eval(interp, s_frame, w_rcvr, source, filename, cmd): - from rsqueakvm.plugins.python import execution # import pdb; pdb.set_trace() - language = execution.W_PythonLanguage(source, filename, cmd) + language = W_PythonLanguage(source, filename, cmd) language.start() # when we are here, the Python process has yielded return language.switch_to_smalltalk(interp, s_frame, first_call=True) @@ -51,10 +52,9 @@ def eval(interp, s_frame, w_rcvr, source, filename, cmd): @PythonPlugin.expose_primitive(unwrap_spec=[object, object], result_is_new_frame=True) def resume(interp, s_frame, w_rcvr, language): - from rsqueakvm.plugins.python import execution # print 'Smalltalk yield' # import pdb; pdb.set_trace() - if not isinstance(language, execution.W_ForeignLanguage): + if not isinstance(language, W_ForeignLanguage): raise PrimitiveFailedError if not language.resume(): raise PrimitiveFailedError @@ -67,11 +67,11 @@ def lastError(interp, s_frame, w_rcvr): if language is None: print 'language was None in lastError' raise PrimitiveFailedError - operr = language.get_error() - if operr is None: - print 'operr was None in lastError' + w_error = language.get_error() + if w_error is None: + print 'w_error was None in lastError' raise PrimitiveFailedError - return W_PythonObject(utils.operr_to_pylist(operr)) + return w_error @PythonPlugin.expose_primitive(clean_stack=False) @@ -150,7 +150,6 @@ def send(interp, s_frame, argcount, w_method): else: wp_result = py_attr except OperationError as operr: - print 'Operror in send (%s)' % operr.errorstr(py_space) return W_PythonObject(utils.operr_to_pylist(operr)) except Exception as e: print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 0d754edb..59549254 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -22,7 +22,7 @@ def no_error_caught(code, cmd): py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) py_frame.run() language = py_space.getexecutioncontext().current_language - return language is not None and language.wp_operror is None + return language is not None and language.get_error() is None def test_simple_exception(): From 4e478fc5c3f058db6d155169f7541080bfe6a6ab Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 12 Mar 2017 02:36:16 +0100 Subject: [PATCH 118/193] Further generalize foreign language plugin --- .../plugins/foreign_language/__init__.py | 4 + .../plugins/foreign_language/global_state.py | 21 --- .../plugins/foreign_language/language.py | 163 ++++++++++++++++++ rsqueakvm/plugins/foreign_language/model.py | 157 ----------------- rsqueakvm/plugins/foreign_language/plugin.py | 74 ++++++++ rsqueakvm/plugins/python/__init__.py | 24 +++ rsqueakvm/plugins/python/global_state.py | 103 ----------- rsqueakvm/plugins/python/language.py | 17 +- rsqueakvm/plugins/python/model.py | 19 +- rsqueakvm/plugins/python/patching.py | 33 ++-- rsqueakvm/plugins/python/plugin.py | 66 +++++++ rsqueakvm/plugins/python/switching.py | 48 ++++++ rsqueakvm/plugins/python/utils.py | 2 +- rsqueakvm/plugins/python_plugin.py | 102 ++--------- .../test/plugins/python/test_end_to_end.py | 7 +- .../plugins/python/test_pyframe_exceptions.py | 2 +- 16 files changed, 433 insertions(+), 409 deletions(-) delete mode 100644 rsqueakvm/plugins/foreign_language/global_state.py create mode 100644 rsqueakvm/plugins/foreign_language/language.py create mode 100644 rsqueakvm/plugins/foreign_language/plugin.py delete mode 100644 rsqueakvm/plugins/python/global_state.py create mode 100644 rsqueakvm/plugins/python/plugin.py create mode 100644 rsqueakvm/plugins/python/switching.py diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index e69de29b..00ab7d55 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -0,0 +1,4 @@ +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.util.cells import QuasiConstant + +w_foreign_language_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/foreign_language/global_state.py b/rsqueakvm/plugins/foreign_language/global_state.py deleted file mode 100644 index b674a538..00000000 --- a/rsqueakvm/plugins/foreign_language/global_state.py +++ /dev/null @@ -1,21 +0,0 @@ -from rsqueakvm.error import Exit -from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.util.cells import QuasiConstant - -w_foreign_language_class = QuasiConstant(None, type=W_PointersObject) -_initialized = [False] - - -def startup(space): - if _initialized[0]: - return - - foreign_language_class = space.smalltalk_at('ForeignLanguage') - if foreign_language_class is None: - # disable plugin? - error_msg = 'ForeignLanguage class not found.' - print error_msg - raise Exit(error_msg) - w_foreign_language_class.set(foreign_language_class) - - _initialized[0] = True diff --git a/rsqueakvm/plugins/foreign_language/language.py b/rsqueakvm/plugins/foreign_language/language.py new file mode 100644 index 00000000..3b82d0ea --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/language.py @@ -0,0 +1,163 @@ +from rsqueakvm.plugins.foreign_language import runner, w_foreign_language_class +from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash +from rsqueakvm.model.compiled_methods import ( + W_PreSpurCompiledMethod, W_SpurCompiledMethod) + +from pypy.interpreter.executioncontext import ExecutionContext + +from rpython.rlib import objectmodel + + +ExecutionContext.current_language = None + + +class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): + _attrs_ = [ + '_runner', '_done', 'w_result', 'w_error', '_break_on_exceptions'] + repr_classname = 'W_ForeignLanguage' + + def __init__(self, break_on_exceptions=True): + W_AbstractObjectWithIdentityHash.__init__(self) + self._done = False + self._break_on_exceptions = break_on_exceptions + if objectmodel.we_are_translated(): + self._runner = runner.StackletLanguageRunner(self) + else: + self._runner = runner.GreenletLanguageRunner(self) + + # W_AbstractObjectWithIdentityHash overrides + + def at0(self, space, index0): + # import pdb; pdb.set_trace() + return space.w_nil + + def atput0(self, space, index0, w_value): + # import pdb; pdb.set_trace() + pass + + def fetch(self, space, n0): + # import pdb; pdb.set_trace() + return space.w_nil + + def store(self, space, n0, w_value): + # import pdb; pdb.set_trace() + pass + + def getclass(self, space): + return w_foreign_language_class.get() + + # Abstract methods + + def run(self): + raise NotImplementedError + + def set_result(self, result): + raise NotImplementedError + + def set_error(self, error): + raise NotImplementedError + + def set_current(self): + raise NotImplementedError + + def resume_class(self): + raise NotImplementedError + + def resume_method(self): + raise NotImplementedError + + # Helpers + + def start(self): + self.runner().start() + + def resume(self): + if self.is_done(): + # import pdb; pdb.set_trace() + print 'The runner is done and cannot be resumed' + return False + self.runner().resume() + return self.get_error() is None + + def runner(self): + return self._runner + + def mark_done(self): + self._done = True + + def is_done(self): + return self._done + + def get_result(self): + return self.w_result + + def get_error(self): + return self.w_error + + def reset_error(self): + self.w_error = None + + def break_on_exceptions(self): + return self._break_on_exceptions + + # Switching + + def switch_to_smalltalk(self, interp, s_frame, first_call=False): + from rsqueakvm.storage_contexts import ContextPartShadow + + # print 'Switch to Smalltalk' + if self.is_done(): + return self._create_return_frame(interp.space) + + s_resume_frame = ContextPartShadow.build_method_context( + interp.space, + self.resume_method(), + self.resume_class(), + [self] + ) + # import pdb; pdb.set_trace() + # we go one up, because the s_frame.w_method() is our fake method + if first_call or s_frame.w_method() is not self.resume_method(): + # assert s_frame.w_method() is not resume_method + s_resume_frame.store_s_sender(s_frame) + else: + if s_frame.w_method() is not self.resume_method(): + print 'Unexpected s_frame found.' + s_resume_frame.store_s_sender(s_frame.s_sender()) + interp.quick_check_for_interrupt(s_resume_frame, + dec=interp.interrupt_counter_size) + # this will raise a ProcessSwitch if there are interrupts or timers ... + return s_resume_frame + + def _create_return_frame(self, space): + from rsqueakvm.storage_contexts import ContextPartShadow + print 'Python has finished and returned a result.' + # we want evalInThread and resumePython to return new frames, + # so we don't build up stack, but we also don't raise to the + # top-level loop all the time. + # For resuming, we obviously need a new frame, because that's + # how the Smalltalk scheduler knows how to continue back to Python. + # Unfortunately, a primitive can only EITHER always return a new + # frame OR a result. So when we get a result, we cannot simply + # return it. Instead, we need to build a frame that simply returns + # the result + if space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_resume_class = self.resume_class() + w_cm.header = 0 + w_cm._primitive = 0 + w_cm.literalsize = 3 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.compiledin_class = w_resume_class.getclass(space) + w_cm.lookup_selector = 'fakeReturnResult' + w_cm.bytes = [chr(b) for b in [ + 0x20, # push constant + 0x7C, # return stack top + ]] + w_cm.literals = [self.get_result(), space.w_nil, w_cm.compiledin_class] + return ContextPartShadow.build_method_context( + space, w_cm, w_resume_class) diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py index 576f6b39..096a0524 100644 --- a/rsqueakvm/plugins/foreign_language/model.py +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -1,163 +1,6 @@ -from rsqueakvm.plugins.foreign_language import runner, global_state from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash -from rsqueakvm.model.compiled_methods import ( - W_PreSpurCompiledMethod, W_SpurCompiledMethod) from rsqueakvm.storage_classes import ClassShadow -from pypy.interpreter.executioncontext import ExecutionContext - -from rpython.rlib import objectmodel - - -ExecutionContext.current_language = None - - -class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): - _attrs_ = ['_runner', '_done', 'w_result', 'w_error'] - repr_classname = 'W_ForeignLanguage' - - def __init__(self): - W_AbstractObjectWithIdentityHash.__init__(self) - self._done = False - if objectmodel.we_are_translated(): - self._runner = runner.StackletLanguageRunner(self) - else: - self._runner = runner.GreenletLanguageRunner(self) - - # W_AbstractObjectWithIdentityHash overrides - - def at0(self, space, index0): - # import pdb; pdb.set_trace() - return space.w_nil - - def atput0(self, space, index0, w_value): - # import pdb; pdb.set_trace() - pass - - def fetch(self, space, n0): - # import pdb; pdb.set_trace() - return space.w_nil - - def store(self, space, n0, w_value): - # import pdb; pdb.set_trace() - pass - - def getclass(self, space): - return global_state.w_foreign_language_class.get() - - # Abstract methods - - def run(self): - raise NotImplementedError - - def set_result(self, result): - raise NotImplementedError - - def set_error(self, error): - raise NotImplementedError - - def set_current(self): - raise NotImplementedError - - def resume_class(self): - raise NotImplementedError - - def resume_method(self): - raise NotImplementedError - - # Helpers - - def start(self): - self.runner().start() - - def resume(self): - if self.is_done(): - # import pdb; pdb.set_trace() - print 'The runner is done and cannot be resumed' - return False - self.runner().resume() - return self.get_error() is None - - def runner(self): - return self._runner - - def mark_done(self): - self._done = True - - def is_done(self): - return self._done - - def get_result(self): - return self.w_result - - def get_error(self): - return self.w_error - - def reset_error(self): - self.w_error = None - - # Switching - - def switch_to_smalltalk(self, interp, s_frame, first_call=False): - from rsqueakvm.storage_contexts import ContextPartShadow - - # print 'Switch to Smalltalk' - if self.is_done(): - return self._create_return_frame(interp.space) - - s_resume_frame = ContextPartShadow.build_method_context( - interp.space, - self.resume_method(), - self.resume_class(), - [self] - ) - # import pdb; pdb.set_trace() - # we go one up, because the s_frame.w_method() is our fake method - if first_call or s_frame.w_method() is not self.resume_method(): - # assert s_frame.w_method() is not resume_method - s_resume_frame.store_s_sender(s_frame) - else: - if s_frame.w_method() is not self.resume_method(): - print 'Unexpected s_frame found.' - s_resume_frame.store_s_sender(s_frame.s_sender()) - interp.quick_check_for_interrupt(s_resume_frame, - dec=interp.interrupt_counter_size) - # this will raise a ProcessSwitch if there are interrupts or timers ... - return s_resume_frame - - def _create_return_frame(self, space): - from rsqueakvm.storage_contexts import ContextPartShadow - print 'Python has finished and returned a result.' - # we want evalInThread and resumePython to return new frames, - # so we don't build up stack, but we also don't raise to the - # top-level loop all the time. - # For resuming, we obviously need a new frame, because that's - # how the Smalltalk scheduler knows how to continue back to Python. - # Unfortunately, a primitive can only EITHER always return a new - # frame OR a result. So when we get a result, we cannot simply - # return it. Instead, we need to build a frame that simply returns - # the result - if space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_resume_class = self.resume_class() - w_cm.header = 0 - w_cm._primitive = 0 - w_cm.literalsize = 3 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.compiledin_class = w_resume_class.getclass(space) - w_cm.lookup_selector = 'fakeReturnResult' - w_cm.bytes = [chr(b) for b in [ - 0x20, # push constant - 0x7C, # return stack top - ]] - w_cm.literals = [self.get_result(), space.w_nil, w_cm.compiledin_class] - return ContextPartShadow.build_method_context( - space, w_cm, w_resume_class) - class W_ForeignLanguageObject(W_AbstractObjectWithIdentityHash): _attrs_ = [] diff --git a/rsqueakvm/plugins/foreign_language/plugin.py b/rsqueakvm/plugins/foreign_language/plugin.py new file mode 100644 index 00000000..871fb1a3 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/plugin.py @@ -0,0 +1,74 @@ +from rsqueakvm.error import Exit, PrimitiveFailedError +from rsqueakvm.plugins.foreign_language import w_foreign_language_class +from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage +from rsqueakvm.plugins.plugin import Plugin + + +class ForeignLanguagePlugin(Plugin): + def __init__(self): + Plugin.__init__(self) + self.register_default_primitives() + + # Abstract methods + + @staticmethod + def w_language_class(): + raise NotImplementedError + + @staticmethod + def w_object_class(): + raise NotImplementedError + + @staticmethod + def to_w_object(foreign_object): + raise NotImplementedError + + @staticmethod + def startup(space, argv): + foreign_language_class = space.smalltalk_at('ForeignLanguage') + if foreign_language_class is None: + # disable plugin? + raise Exit('ForeignLanguage class not found.') + w_foreign_language_class.set(foreign_language_class) + + # Default primitives + + def register_default_primitives(self): + @self.expose_primitive(unwrap_spec=[object, str, str, str, bool], + result_is_new_frame=True) + def eval(interp, s_frame, w_rcvr, source, filename, cmd, + break_on_exceptions): + # import pdb; pdb.set_trace() + language = self.w_language_class()( + source, filename, cmd, break_on_exceptions) + language.start() + # when we are here, the foreign language process has yielded + return language.switch_to_smalltalk(interp, s_frame, + first_call=True) + + @self.expose_primitive(unwrap_spec=[object, object], + result_is_new_frame=True) + def resume(interp, s_frame, w_rcvr, language): + # print 'Smalltalk yield' + # import pdb; pdb.set_trace() + if not isinstance(language, W_ForeignLanguage): + raise PrimitiveFailedError + if not language.resume(): + raise PrimitiveFailedError + return language.switch_to_smalltalk(interp, s_frame) + + @self.expose_primitive(unwrap_spec=[object, object]) + def lastError(interp, s_frame, w_rcvr, language): + if not isinstance(language, W_ForeignLanguage): + raise PrimitiveFailedError + w_error = language.get_error() + if w_error is None: + print 'w_error was None in lastError' + raise PrimitiveFailedError + return w_error + + @self.expose_primitive(unwrap_spec=[object]) + def asSmalltalk(interp, s_frame, w_rcvr): + if not isinstance(w_rcvr, self.w_object_class()): + raise PrimitiveFailedError + return self.to_w_object(interp.space, w_rcvr) diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index e69de29b..ef1271c5 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -0,0 +1,24 @@ +from rsqueakvm.model.compiled_methods import W_CompiledMethod +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.util.cells import QuasiConstant, Cell +from rsqueakvm.plugins.python.py_objspace import new_pypy_objspace +from rsqueakvm.plugins.python.switching import PyFrameRestartInfo +from rsqueakvm.plugins.python.switching import SwitchToSmalltalkAction + + +py_space = new_pypy_objspace() +switch_action = SwitchToSmalltalkAction(py_space) +py_space.actionflag.register_periodic_action( + switch_action, use_bytecode_counter=True) + +py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) + +w_foreign_language_class = QuasiConstant(None, type=W_PointersObject) +w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) +w_python_class = QuasiConstant(None, type=W_PointersObject) +w_python_object_class = QuasiConstant(None, type=W_PointersObject) +w_python_plugin_send = QuasiConstant(None, type=W_PointersObject) + + +def set_py_frame_restart_info(frame, py_code): + py_frame_restart_info.set(PyFrameRestartInfo(frame, py_code)) diff --git a/rsqueakvm/plugins/python/global_state.py b/rsqueakvm/plugins/python/global_state.py deleted file mode 100644 index bd35afd7..00000000 --- a/rsqueakvm/plugins/python/global_state.py +++ /dev/null @@ -1,103 +0,0 @@ -from rsqueakvm.error import Exit -from rsqueakvm.model.compiled_methods import W_CompiledMethod -from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.plugins.foreign_language import global_state as fl_gs -from rsqueakvm.plugins.python.py_objspace import new_pypy_objspace -from rsqueakvm.util.cells import QuasiConstant, Cell - -from pypy.interpreter.error import OperationError -from pypy.interpreter.executioncontext import PeriodicAsyncAction - - -class RestartException(OperationError): - def __init__(self, py_frame_restart_info): - self.py_frame_restart_info = py_frame_restart_info - - def _compute_value(self, space): - print '_compute_value called in RestartException' - return None - - -class PyFrameRestartInfo(): - def __init__(self, frame=None, code=None): - self.frame = frame - self.pycode = code - - -class SwitchToSmalltalkAction(PeriodicAsyncAction): - - def __init__(self, py_space): - PeriodicAsyncAction.__init__(self, py_space) - - def perform(self, ec, frame): - # import pdb; pdb.set_trace() - language = ec.current_language - if language is None: - return - runner = language.runner() - if runner is None: - return - - # print 'Python yield' - runner.return_to_smalltalk() - # print 'Python continue' - - # operror has been in Smalltalk land, clear it now to allow resuming - language.reset_error() - - # handle py_frame_restart_info if set - restart_info = py_frame_restart_info.get() - if restart_info is not None: - py_frame_restart_info.set(None) - # import pdb; pdb.set_trace() - raise RestartException(restart_info) - - -py_space = new_pypy_objspace() -switch_action = SwitchToSmalltalkAction(py_space) -py_space.actionflag.register_periodic_action(switch_action, - use_bytecode_counter=True) -py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) - -break_on_exception = Cell(True) - -w_foreign_language_class = QuasiConstant(None, type=W_PointersObject) -w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) -w_python_class = QuasiConstant(None, type=W_PointersObject) -w_python_object_class = QuasiConstant(None, type=W_PointersObject) -w_python_plugin_send = QuasiConstant(None, type=W_PointersObject) - - -def startup(space): - fl_gs.startup(space) - - w_python_plugin_send.set(space.wrap_list_unroll_safe([ - space.wrap_string('PythonPlugin'), - space.wrap_string('send') - ])) - - python_class = space.smalltalk_at('Python') - if python_class is None: - # disable plugin? - error_msg = 'Python class not found.' - print error_msg - raise Exit(error_msg) - w_python_class.set(python_class) - - python_object_class = space.smalltalk_at('PythonObject') - if python_object_class is None: - # disable plugin? - error_msg = 'PythonObject class not found.' - print error_msg - raise Exit(error_msg) - w_python_object_class.set(python_object_class) - - resume_method_symbol = space.wrap_symbol('resume:') - python_cls_cls_s = python_class.getclass(space).as_class_get_shadow(space) - resume_method = python_cls_cls_s.lookup(resume_method_symbol) - if resume_method is None: - # disable plugin? - error_msg = 'Python class>>resumeFrame method not found.' - print error_msg - raise Exit(error_msg) - w_python_resume_method.set(resume_method) diff --git a/rsqueakvm/plugins/python/language.py b/rsqueakvm/plugins/python/language.py index c83bf374..5fffcbcb 100644 --- a/rsqueakvm/plugins/python/language.py +++ b/rsqueakvm/plugins/python/language.py @@ -1,5 +1,6 @@ -from rsqueakvm.plugins.foreign_language.model import W_ForeignLanguage -from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage +from rsqueakvm.plugins.python import ( + py_space, w_python_class, w_python_resume_method) from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist @@ -10,8 +11,8 @@ class W_PythonLanguage(W_ForeignLanguage): _attrs_ = ['source', 'filename', 'cmd'] repr_classname = 'W_PythonLanguage' - def __init__(self, source, filename, cmd): - W_ForeignLanguage.__init__(self) + def __init__(self, source, filename, cmd, break_on_exceptions=True): + W_ForeignLanguage.__init__(self, break_on_exceptions) self.source = source self.filename = filename self.cmd = cmd @@ -22,7 +23,7 @@ def run(self): print 'Python start' try: # ensure py_space has a fresh exectioncontext - gs.py_space.threadlocals.enter_thread(gs.py_space) + py_space.threadlocals.enter_thread(py_space) # switch back to Squeak before executing Python code self.runner().return_to_smalltalk() @@ -39,7 +40,7 @@ def run(self): self.mark_done() def set_current(self): - ec = gs.py_space.getexecutioncontext() + ec = py_space.getexecutioncontext() ec.current_language = self def set_result(self, wp_result): @@ -49,7 +50,7 @@ def set_error(self, wp_operr): self.w_error = W_PythonObject(operr_to_pylist(wp_operr)) def resume_class(self): - return gs.w_python_class.get() + return w_python_class.get() def resume_method(self): - return gs.w_python_resume_method.get() + return w_python_resume_method.get() diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index c3ae2165..d4f752d9 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -1,6 +1,7 @@ -from rsqueakvm.plugins.foreign_language import model as fl_model -from rsqueakvm.plugins.python import global_state as gs -from rsqueakvm.plugins.python.global_state import py_space +from rsqueakvm.plugins import python +from rsqueakvm.plugins.foreign_language.model import ( + W_ForeignLanguageObject, ForeignLanguageClassShadow) +from rsqueakvm.plugins.python import py_space from rsqueakvm.primitives.constants import EXTERNAL_CALL from rsqueakvm.model.compiled_methods import ( W_PreSpurCompiledMethod, W_SpurCompiledMethod) @@ -11,13 +12,13 @@ from rpython.rlib import objectmodel -class W_PythonObject(fl_model.W_ForeignLanguageObject): +class W_PythonObject(W_ForeignLanguageObject): _attrs_ = ['wp_object', 's_class'] _immutable_fields_ = ['wp_object', 's_class?'] repr_classname = 'W_PythonObject' def __init__(self, wp_object): - fl_model.W_ForeignLanguageObject.__init__(self) + W_ForeignLanguageObject.__init__(self) self.wp_object = wp_object # self.w_pyID = None self.s_class = None @@ -39,7 +40,7 @@ def is_same_object(self, other): other.wp_object is self.wp_object) -class PythonClassShadow(fl_model.ForeignLanguageClassShadow): +class PythonClassShadow(ForeignLanguageClassShadow): _attrs_ = ['wp_object', 'wp_class'] _immutable_fields_ = ['wp_class'] @@ -52,7 +53,7 @@ def __init__(self, space, wp_object): self, space, space.w_nil, 0, space.w_nil) def fallback_class(self): - return gs.w_python_object_class.get() + return python.w_python_object_class.get() def make_method(self, w_selector): # import pdb; pdb.set_trace() @@ -99,11 +100,11 @@ def make_method(self, w_selector): w_cm.islarge = False w_cm._tempsize = 0 w_cm.argsize = 0 - w_cm.compiledin_class = gs.w_python_class.get() + w_cm.compiledin_class = python.w_python_class.get() w_cm.lookup_selector = 'fakePythonSend' w_cm.bytes = [] w_cm.literals = [ - gs.w_python_plugin_send.get(), + python.w_python_plugin_send.get(), w_selector ] return w_cm diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 1e75d671..4fc4291f 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,4 +1,5 @@ -from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.python import py_space, switch_action +from rsqueakvm.plugins.python.switching import RestartException from pypy.interpreter.pycode import PyCode, default_magic from pypy.interpreter.pyopcode import SApplicationException @@ -27,12 +28,12 @@ def __init__frame(self, space, code, w_globals, outer_func): def new_execute_frame(self, w_inputvalue=None, operr=None): try: return old_execute_frame(self, w_inputvalue, operr) - except gs.RestartException as e: + except RestartException as e: frame = e.py_frame_restart_info.frame if frame is not None and frame is not self: - raise gs.RestartException(e.py_frame_restart_info) + raise RestartException(e.py_frame_restart_info) # Generate and execute new frame - new_frame = gs.py_space.FrameClass( + new_frame = py_space.FrameClass( self.space, e.py_frame_restart_info.pycode or self.pycode, self.w_globals, self.outer_func) return new_execute_frame(new_frame, w_inputvalue, operr) @@ -59,8 +60,7 @@ def block_handles_exception(self, block, operr_type): while next_opcode == opcodedesc.LOAD_GLOBAL.index: global_index = ord(self.pycode.co_code[next_opcode_idx + 1]) exception = self._load_global(self.getname_u(global_index)) - if gs.py_space.exception_match(operr_type, - w_check_class=exception): + if py_space.exception_match(operr_type, w_check_class=exception): return True next_opcode_idx = next_opcode_idx + 3 next_opcode = ord(self.pycode.co_code[next_opcode_idx]) @@ -75,8 +75,7 @@ def block_handles_exception(self, block, operr_type): self.getorcreatedebug().w_locals, varname) else: # fall-back exception = self._load_global(self.getname_u(nameindex)) - if gs.py_space.exception_match(operr_type, - w_check_class=exception): + if py_space.exception_match(operr_type, w_check_class=exception): return True next_opcode_idx = next_opcode_idx + 3 next_opcode = ord(self.pycode.co_code[next_opcode_idx]) @@ -87,7 +86,7 @@ def block_handles_exception(self, block, operr_type): def has_exception_handler(self, operr): "Returns True if this frame or one of his parents are able to handle operr" frame = self - error_type = operr.w_type.getname(gs.py_space) + error_type = operr.w_type.getname(py_space) forbidden_names = [] if error_type == 'AttributeError': forbidden_names = ATTRIBUTE_ERROR_FORBIDDEN_NAMES @@ -109,18 +108,16 @@ def has_exception_handler(self, operr): def new_handle_operation_error(self, ec, operr, attach_tb=True): - if isinstance(operr, gs.RestartException): + if isinstance(operr, RestartException): print 'Re-raising RestartException' raise operr - if gs.break_on_exception.get() and not self.has_exception_handler(operr): + language = ec.current_language + if (language is not None and language.break_on_exceptions() and + not self.has_exception_handler(operr)): # import pdb; pdb.set_trace() - language = ec.current_language - if language is None: - print 'Unable to handle error, no language found.' - else: - language.set_error(operr) - print 'Python error caught' - gs.switch_action.perform(ec, self) + language.set_error(operr) + print 'Python error caught' + switch_action.perform(ec, self) return old_handle_operation_error(self, ec, operr, attach_tb) diff --git a/rsqueakvm/plugins/python/plugin.py b/rsqueakvm/plugins/python/plugin.py new file mode 100644 index 00000000..4ec88182 --- /dev/null +++ b/rsqueakvm/plugins/python/plugin.py @@ -0,0 +1,66 @@ +from rsqueakvm.error import Exit +from rsqueakvm.plugins import plugin +from rsqueakvm.plugins.foreign_language.plugin import ForeignLanguagePlugin +from rsqueakvm.util import system + +from rsqueakvm.plugins import python +from rsqueakvm.plugins.python import model, utils +from rsqueakvm.plugins.python.language import W_PythonLanguage +from rsqueakvm.plugins.python.patching import patch_pypy +from rsqueakvm.plugins.python.switching import PyFrameRestartInfo + + +class PythonPlugin(ForeignLanguagePlugin): + def is_optional(self): + return True + + def setup(self): + system.translationconfig.set(thread=True) + system.translationconfig.set(continuation=True) + patch_pypy() + + @staticmethod + def startup(space, argv): + ForeignLanguagePlugin.startup(space, argv) + + python.w_python_plugin_send.set(space.wrap_list_unroll_safe([ + space.wrap_string('PythonPlugin'), + space.wrap_string('send') + ])) + + python_class = space.smalltalk_at('Python') + if python_class is None: + # disable plugin? + raise Exit('Python class not found.') + python.w_python_class.set(python_class) + + python_object_class = space.smalltalk_at('PythonObject') + if python_object_class is None: + raise Exit('PythonObject class not found.') + python.w_python_object_class.set(python_object_class) + + resume_method_symbol = space.wrap_symbol('resume:') + python_cls_cls_s = python_class.getclass( + space).as_class_get_shadow(space) + resume_method = python_cls_cls_s.lookup(resume_method_symbol) + if resume_method is None: + raise Exit('Python class>>resumeFrame method not found.') + python.w_python_resume_method.set(resume_method) + + python.py_space.startup() + + @staticmethod + def set_frame_restart_info(frame, py_code): + plugin.py_frame_restart_info = PyFrameRestartInfo(frame, py_code) + + @staticmethod + def w_language_class(): + return W_PythonLanguage + + @staticmethod + def w_object_class(): + return model.W_PythonObject + + @staticmethod + def to_w_object(space, foreign_object): + return utils.python_to_smalltalk(space, foreign_object.wp_object) diff --git a/rsqueakvm/plugins/python/switching.py b/rsqueakvm/plugins/python/switching.py new file mode 100644 index 00000000..18620fac --- /dev/null +++ b/rsqueakvm/plugins/python/switching.py @@ -0,0 +1,48 @@ +from pypy.interpreter.error import OperationError +from pypy.interpreter.executioncontext import PeriodicAsyncAction + + +class SwitchToSmalltalkAction(PeriodicAsyncAction): + + def __init__(self, py_space): + PeriodicAsyncAction.__init__(self, py_space) + + def perform(self, ec, frame): + from rsqueakvm.plugins.python import py_frame_restart_info + + # import pdb; pdb.set_trace() + language = ec.current_language + if language is None: + return + runner = language.runner() + if runner is None: + return + + # print 'Python yield' + runner.return_to_smalltalk() + # print 'Python continue' + + # operror has been in Smalltalk land, clear it now to allow resuming + language.reset_error() + + # handle py_frame_restart_info if set + restart_info = py_frame_restart_info.get() + if restart_info is not None: + py_frame_restart_info.set(None) + # import pdb; pdb.set_trace() + raise RestartException(restart_info) + + +class RestartException(OperationError): + def __init__(self, py_frame_restart_info): + self.py_frame_restart_info = py_frame_restart_info + + def _compute_value(self, space): + print '_compute_value called in RestartException' + return None + + +class PyFrameRestartInfo(): + def __init__(self, frame=None, code=None): + self.frame = frame + self.pycode = code diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 940f7ba6..fb7a54a3 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -2,8 +2,8 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger +from rsqueakvm.plugins.python import py_space from rsqueakvm.plugins.python.model import W_PythonObject -from rsqueakvm.plugins.python.global_state import py_space from rsqueakvm.model.variable import W_BytesObject from pypy.interpreter.error import OperationError diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index d39dd51f..9bb1d4d8 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -1,91 +1,25 @@ -from rsqueakvm.util import system -if 'PythonPlugin' not in system.optional_plugins: - raise LookupError -else: - system.translationconfig.set(thread=True) - system.translationconfig.set(continuation=True) - from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.variable import W_BytesObject -from rsqueakvm.plugins.foreign_language.model import W_ForeignLanguage -from rsqueakvm.plugins.plugin import Plugin, PluginStartupScripts -from rsqueakvm.plugins.python import model, global_state, utils -from rsqueakvm.plugins.python.global_state import py_space -from rsqueakvm.plugins.python.language import W_PythonLanguage -from rsqueakvm.plugins.python.model import W_PythonObject -from rsqueakvm.plugins.python.patching import patch_pypy - -from pypy.interpreter.error import OperationError -from pypy.interpreter.function import (Function, Method, StaticMethod, - ClassMethod) +from rsqueakvm.plugins.python import set_py_frame_restart_info +from rsqueakvm.plugins.python.plugin import PythonPlugin from rpython.rlib import jit +try: + from rsqueakvm.plugins.python import model, py_space, utils + from rsqueakvm.plugins.python.model import W_PythonObject -_DO_NOT_RELOAD = True - -patch_pypy() - - -class PythonPluginClass(Plugin): + from pypy.interpreter.error import OperationError + from pypy.interpreter.function import (Function, Method, StaticMethod, + ClassMethod) +except ImportError: pass -PythonPlugin = PythonPluginClass() - - -def startup(space, argv): - global_state.startup(space) - py_space.startup() -PluginStartupScripts.append(startup) - - -@PythonPlugin.expose_primitive(unwrap_spec=[object, str, str, str], - result_is_new_frame=True) -def eval(interp, s_frame, w_rcvr, source, filename, cmd): - # import pdb; pdb.set_trace() - language = W_PythonLanguage(source, filename, cmd) - language.start() - # when we are here, the Python process has yielded - return language.switch_to_smalltalk(interp, s_frame, first_call=True) - - -@PythonPlugin.expose_primitive(unwrap_spec=[object, object], - result_is_new_frame=True) -def resume(interp, s_frame, w_rcvr, language): - # print 'Smalltalk yield' - # import pdb; pdb.set_trace() - if not isinstance(language, W_ForeignLanguage): - raise PrimitiveFailedError - if not language.resume(): - raise PrimitiveFailedError - return language.switch_to_smalltalk(interp, s_frame) - - -@PythonPlugin.expose_primitive(unwrap_spec=[object]) -def lastError(interp, s_frame, w_rcvr): - language = py_space.getexecutioncontext().current_language - if language is None: - print 'language was None in lastError' - raise PrimitiveFailedError - w_error = language.get_error() - if w_error is None: - print 'w_error was None in lastError' - raise PrimitiveFailedError - return w_error - -@PythonPlugin.expose_primitive(clean_stack=False) -def breakOnExceptions(interp, s_frame, argcount): - if argcount == 0: - return interp.space.wrap_bool(global_state.break_on_exception.get()) - if argcount != 1: - raise PrimitiveFailedError - state = s_frame.pop() is interp.space.w_true - global_state.break_on_exception.set(state) - return interp.space.wrap_bool(state) +plugin = PythonPlugin() -@PythonPlugin.expose_primitive(unwrap_spec=[object]) +@plugin.expose_primitive(unwrap_spec=[object]) def getTopFrame(interp, s_frame, w_rcvr): # import pdb; pdb.set_trace() topframe = py_space.getexecutioncontext().gettopframe() @@ -94,7 +28,7 @@ def getTopFrame(interp, s_frame, w_rcvr): return W_PythonObject(topframe) -@PythonPlugin.expose_primitive(unwrap_spec=[object, object, str, str, str]) +@plugin.expose_primitive(unwrap_spec=[object, object, str, str, str]) def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, cmd): frame = None @@ -105,19 +39,11 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, py_code = utils.get_restart_pycode(source, filename, cmd) if py_code is None: return interp.space.w_false # Raising prim error causes crashes - global_state.py_frame_restart_info.set( - global_state.PyFrameRestartInfo(frame=frame, code=py_code)) + set_py_frame_restart_info(frame, py_code) return interp.space.w_true -@PythonPlugin.expose_primitive(unwrap_spec=[object]) -def asSmalltalk(interp, s_frame, w_rcvr): - if not isinstance(w_rcvr, model.W_PythonObject): - raise PrimitiveFailedError - return utils.python_to_smalltalk(interp.space, w_rcvr.wp_object) - - -@PythonPlugin.expose_primitive(compiled_method=True) +@plugin.expose_primitive(compiled_method=True) @jit.unroll_safe def send(interp, s_frame, argcount, w_method): # import pdb; pdb.set_trace() diff --git a/rsqueakvm/test/plugins/python/test_end_to_end.py b/rsqueakvm/test/plugins/python/test_end_to_end.py index 1b3a9d07..7ffeb2e8 100644 --- a/rsqueakvm/test/plugins/python/test_end_to_end.py +++ b/rsqueakvm/test/plugins/python/test_end_to_end.py @@ -1,9 +1,10 @@ from rsqueakvm.model.base import W_Object from rsqueakvm.model.numeric import W_SmallInteger from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.plugins.python import global_state as gs +from rsqueakvm.plugins.python import py_space from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.patching import patch_pypy +from rsqueakvm.plugins.python.plugin import PythonPlugin from rsqueakvm.test.util import create_space, cleanup_module, read_image @@ -33,7 +34,7 @@ def setup_module(): w = space.w space.runtime_setup(interp, '', [], '', 0) space.headless.activate() - gs.startup(space) + PythonPlugin.startup(space, []) def teardown_module(): @@ -52,7 +53,7 @@ def get_python_result(code, cmd='eval'): ^ Python %s: '%s'""" % (name, cmd, code) w_res = add_method_and_call(sourcecode, name) assert isinstance(w_res, W_PythonObject) - return gs.py_space.unwrap(w_res.wp_object) + return py_space.unwrap(w_res.wp_object) def get_smalltalk_result(code, cmd='eval'): diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 59549254..04e6d6d8 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -1,4 +1,4 @@ -from rsqueakvm.plugins.python.global_state import py_space +from rsqueakvm.plugins.python import py_space from rsqueakvm.plugins.python.patching import patch_pypy from pypy.interpreter.error import OperationError From 32c986e9b1e7328be2f1b5280768a49321506ec0 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 12 Mar 2017 14:02:23 +0100 Subject: [PATCH 119/193] Make call_method work with any number of args_w --- rsqueakvm/plugins/python/utils.py | 51 ++++-------------------------- rsqueakvm/plugins/python_plugin.py | 3 +- 2 files changed, 7 insertions(+), 47 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index fb7a54a3..bc1fead1 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -6,6 +6,7 @@ from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.model.variable import W_BytesObject +from pypy.interpreter.argument import Arguments from pypy.interpreter.error import OperationError from pypy.interpreter.main import ensure__main__, compilecode from pypy.interpreter.module import Module @@ -123,51 +124,11 @@ def get_restart_pycode(source, filename='', cmd='exec'): return -def call_method(space, wp_rcvr, methodname, args_w): - args_w_len = len(args_w) - if args_w_len == 1: - arg1 = smalltalk_to_python(space, args_w[0]) - return py_space.call_method(wp_rcvr, methodname, arg1) - elif args_w_len == 2: - arg1 = smalltalk_to_python(space, args_w[0]) - arg2 = smalltalk_to_python(space, args_w[1]) - return py_space.call_method(wp_rcvr, methodname, arg1, arg2) - elif args_w_len == 3: - arg1 = smalltalk_to_python(space, args_w[0]) - arg2 = smalltalk_to_python(space, args_w[1]) - arg3 = smalltalk_to_python(space, args_w[2]) - return py_space.call_method(wp_rcvr, methodname, arg1, arg2, arg3) - elif args_w_len == 4: - arg1 = smalltalk_to_python(space, args_w[0]) - arg2 = smalltalk_to_python(space, args_w[1]) - arg3 = smalltalk_to_python(space, args_w[2]) - arg4 = smalltalk_to_python(space, args_w[3]) - return py_space.call_method(wp_rcvr, methodname, - arg1, arg2, arg3, arg4) - return py_space.call_method(wp_rcvr, methodname) - - -def call_function(space, wp_func, args_w): - args_w_len = len(args_w) - if args_w_len == 1: - arg1 = smalltalk_to_python(space, args_w[0]) - return py_space.call_function(wp_func, arg1) - elif args_w_len == 2: - arg1 = smalltalk_to_python(space, args_w[0]) - arg2 = smalltalk_to_python(space, args_w[1]) - return py_space.call_function(wp_func, arg1, arg2) - elif args_w_len == 3: - arg1 = smalltalk_to_python(space, args_w[0]) - arg2 = smalltalk_to_python(space, args_w[1]) - arg3 = smalltalk_to_python(space, args_w[2]) - return py_space.call_function(wp_func, arg1, arg2, arg3) - elif args_w_len == 4: - arg1 = smalltalk_to_python(space, args_w[0]) - arg2 = smalltalk_to_python(space, args_w[1]) - arg3 = smalltalk_to_python(space, args_w[2]) - arg4 = smalltalk_to_python(space, args_w[3]) - return py_space.call_function(wp_func, arg1, arg2, arg3, arg4) - return py_space.call_function(wp_func) +def call_method(space, wp_obj, methodname, args_w): + # use call_args() to allow variable # of args_w (this disables speed hacks) + w_meth = py_space.getattr(wp_obj, py_space.newtext(methodname)) + args = Arguments(py_space, [smalltalk_to_python(space, a) for a in args_w]) + return py_space.call_args(w_meth, args) def operr_to_pylist(operr): diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 9bb1d4d8..92759f4a 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -65,8 +65,7 @@ def send(interp, s_frame, argcount, w_method): isinstance(py_attr, Method) or isinstance(py_attr, StaticMethod) or isinstance(py_attr, ClassMethod)): - wp_result = utils.call_method( - space, wp_rcvr, methodname, args_w) + wp_result = utils.call_method(space, wp_rcvr, methodname, args_w) else: if len(args_w) == 1: wp_value = utils.smalltalk_to_python(space, args_w[0]) From a171e0ee1f8e469206d9853e60796a5cecd35120 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 12 Mar 2017 15:51:11 +0100 Subject: [PATCH 120/193] Minor cleanups and changes --- .../plugins/foreign_language/language.py | 4 ++- rsqueakvm/plugins/foreign_language/plugin.py | 18 ++++++------- rsqueakvm/plugins/python/__init__.py | 1 - rsqueakvm/plugins/python/language.py | 2 -- rsqueakvm/plugins/python/plugin.py | 27 ++++++++++--------- rsqueakvm/plugins/python_plugin.py | 4 +-- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/language.py b/rsqueakvm/plugins/foreign_language/language.py index 3b82d0ea..5e61db73 100644 --- a/rsqueakvm/plugins/foreign_language/language.py +++ b/rsqueakvm/plugins/foreign_language/language.py @@ -19,6 +19,8 @@ class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): def __init__(self, break_on_exceptions=True): W_AbstractObjectWithIdentityHash.__init__(self) self._done = False + self.w_result = None + self.w_error = None self._break_on_exceptions = break_on_exceptions if objectmodel.we_are_translated(): self._runner = runner.StackletLanguageRunner(self) @@ -131,7 +133,7 @@ def switch_to_smalltalk(self, interp, s_frame, first_call=False): def _create_return_frame(self, space): from rsqueakvm.storage_contexts import ContextPartShadow - print 'Python has finished and returned a result.' + print 'Language has finished and returned a result.' # we want evalInThread and resumePython to return new frames, # so we don't build up stack, but we also don't raise to the # top-level loop all the time. diff --git a/rsqueakvm/plugins/foreign_language/plugin.py b/rsqueakvm/plugins/foreign_language/plugin.py index 871fb1a3..d642e0d6 100644 --- a/rsqueakvm/plugins/foreign_language/plugin.py +++ b/rsqueakvm/plugins/foreign_language/plugin.py @@ -12,7 +12,7 @@ def __init__(self): # Abstract methods @staticmethod - def w_language_class(): + def new_w_language(space, args_w): raise NotImplementedError @staticmethod @@ -34,17 +34,17 @@ def startup(space, argv): # Default primitives def register_default_primitives(self): - @self.expose_primitive(unwrap_spec=[object, str, str, str, bool], - result_is_new_frame=True) - def eval(interp, s_frame, w_rcvr, source, filename, cmd, - break_on_exceptions): + @self.expose_primitive(result_is_new_frame=True) + def eval(interp, s_frame, argcount): # import pdb; pdb.set_trace() - language = self.w_language_class()( - source, filename, cmd, break_on_exceptions) + args_w = s_frame.peek_n(argcount) + language = self.new_w_language(interp.space, args_w) language.start() # when we are here, the foreign language process has yielded - return language.switch_to_smalltalk(interp, s_frame, - first_call=True) + frame = language.switch_to_smalltalk(interp, s_frame, + first_call=True) + s_frame.pop_n(argcount + 1) + return frame @self.expose_primitive(unwrap_spec=[object, object], result_is_new_frame=True) diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index ef1271c5..c17b2791 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -13,7 +13,6 @@ py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) -w_foreign_language_class = QuasiConstant(None, type=W_PointersObject) w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) w_python_class = QuasiConstant(None, type=W_PointersObject) w_python_object_class = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/python/language.py b/rsqueakvm/plugins/python/language.py index 5fffcbcb..5b0c7e8e 100644 --- a/rsqueakvm/plugins/python/language.py +++ b/rsqueakvm/plugins/python/language.py @@ -16,8 +16,6 @@ def __init__(self, source, filename, cmd, break_on_exceptions=True): self.source = source self.filename = filename self.cmd = cmd - self.w_result = None - self.w_error = None def run(self): print 'Python start' diff --git a/rsqueakvm/plugins/python/plugin.py b/rsqueakvm/plugins/python/plugin.py index 4ec88182..75c71af7 100644 --- a/rsqueakvm/plugins/python/plugin.py +++ b/rsqueakvm/plugins/python/plugin.py @@ -1,13 +1,12 @@ -from rsqueakvm.error import Exit -from rsqueakvm.plugins import plugin +from rsqueakvm.error import Exit, PrimitiveFailedError from rsqueakvm.plugins.foreign_language.plugin import ForeignLanguagePlugin from rsqueakvm.util import system from rsqueakvm.plugins import python -from rsqueakvm.plugins.python import model, utils +from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.language import W_PythonLanguage from rsqueakvm.plugins.python.patching import patch_pypy -from rsqueakvm.plugins.python.switching import PyFrameRestartInfo +from rsqueakvm.plugins.python.utils import python_to_smalltalk class PythonPlugin(ForeignLanguagePlugin): @@ -44,23 +43,25 @@ def startup(space, argv): space).as_class_get_shadow(space) resume_method = python_cls_cls_s.lookup(resume_method_symbol) if resume_method is None: - raise Exit('Python class>>resumeFrame method not found.') + raise Exit('Python class>>resume: method not found.') python.w_python_resume_method.set(resume_method) python.py_space.startup() @staticmethod - def set_frame_restart_info(frame, py_code): - plugin.py_frame_restart_info = PyFrameRestartInfo(frame, py_code) - - @staticmethod - def w_language_class(): - return W_PythonLanguage + def new_w_language(space, args_w): + if len(args_w) != 4: + raise PrimitiveFailedError + source = space.unwrap_string(args_w[0]) + filename = space.unwrap_string(args_w[1]) + cmd = space.unwrap_string(args_w[2]) + break_on_exceptions = args_w[3] is space.w_true + return W_PythonLanguage(source, filename, cmd, break_on_exceptions) @staticmethod def w_object_class(): - return model.W_PythonObject + return W_PythonObject @staticmethod def to_w_object(space, foreign_object): - return utils.python_to_smalltalk(space, foreign_object.wp_object) + return python_to_smalltalk(space, foreign_object.wp_object) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 92759f4a..63259545 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -6,7 +6,7 @@ from rpython.rlib import jit try: - from rsqueakvm.plugins.python import model, py_space, utils + from rsqueakvm.plugins.python import py_space, utils from rsqueakvm.plugins.python.model import W_PythonObject from pypy.interpreter.error import OperationError @@ -32,7 +32,7 @@ def getTopFrame(interp, s_frame, w_rcvr): def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, cmd): frame = None - if isinstance(w_frame, model.W_PythonObject): + if isinstance(w_frame, W_PythonObject): frame = w_frame.wp_object py_code = None if source: From 986be7087b734a8c9ca947b87e17e23fc7678a3f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 12 Mar 2017 17:54:42 +0100 Subject: [PATCH 121/193] Rewrite RubyPlugin It now inherits from ForeignLanguagePlugin. --- .travis.yml | 10 +- rsqueakvm/plugins/ruby/__init__.py | 13 ++ rsqueakvm/plugins/ruby/language.py | 43 ++++++ rsqueakvm/plugins/ruby/model.py | 81 +++++++++++ rsqueakvm/plugins/ruby/patching.py | 44 ++++++ rsqueakvm/plugins/ruby/plugin.py | 63 ++++++++ rsqueakvm/plugins/ruby/utils.py | 53 +++++++ rsqueakvm/plugins/ruby_plugin.py | 224 ++++------------------------- 8 files changed, 328 insertions(+), 203 deletions(-) create mode 100644 rsqueakvm/plugins/ruby/__init__.py create mode 100644 rsqueakvm/plugins/ruby/language.py create mode 100644 rsqueakvm/plugins/ruby/model.py create mode 100644 rsqueakvm/plugins/ruby/patching.py create mode 100644 rsqueakvm/plugins/ruby/plugin.py create mode 100644 rsqueakvm/plugins/ruby/utils.py diff --git a/.travis.yml b/.travis.yml index 4981277b..38ebc259 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,9 +29,9 @@ env: # - BUILD_ARCH=armv7-a # - BUILD_ARCH=armv8-a # - BUILD_ARCH=64bit PLUGINS=DatabasePlugin - # - BUILD_ARCH=64bit PLUGINS=RubyPlugin - BUILD_ARCH=64bit TEST_TYPE=plugin PLUGINS=PythonPlugin PLUGIN_DIR=python - BUILD_ARCH=64bit PLUGINS=PythonPlugin + - BUILD_ARCH=64bit PLUGINS=RubyPlugin matrix: include: # - os: osx @@ -42,14 +42,14 @@ matrix: # osx_image: xcode7.3 # language: cpp # env: BUILD_ARCH=64bit - # - os: osx - # osx_image: xcode7.3 - # language: cpp - # env: BUILD_ARCH=64bit PLUGINS=RubyPlugin - os: osx osx_image: xcode7.3 language: cpp env: BUILD_ARCH=64bit PLUGINS=PythonPlugin + - os: osx + osx_image: xcode7.3 + language: cpp + env: BUILD_ARCH=64bit PLUGINS=RubyPlugin # allow_failures: # - env: BUILD_ARCH=64bit PLUGINS=DatabasePlugin # - env: BUILD_ARCH=64bit PLUGINS=RubyPlugin diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py new file mode 100644 index 00000000..d4add70c --- /dev/null +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -0,0 +1,13 @@ +from rsqueakvm.model.compiled_methods import W_CompiledMethod +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.util.cells import QuasiConstant + +from topaz.objspace import ObjectSpace + + +ruby_space = ObjectSpace(None) + +w_ruby_resume_method = QuasiConstant(None, type=W_CompiledMethod) +w_ruby_class = QuasiConstant(None, type=W_PointersObject) +w_ruby_object_class = QuasiConstant(None, type=W_PointersObject) +w_ruby_plugin_send = QuasiConstant(None, type=W_PointersObject) diff --git a/rsqueakvm/plugins/ruby/language.py b/rsqueakvm/plugins/ruby/language.py new file mode 100644 index 00000000..365196b8 --- /dev/null +++ b/rsqueakvm/plugins/ruby/language.py @@ -0,0 +1,43 @@ +from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage +from rsqueakvm.plugins.ruby import ( + ruby_space, w_ruby_class, w_ruby_resume_method) +from rsqueakvm.plugins.ruby.model import W_RubyObject + +from topaz.error import RubyError + + +class W_RubyLanguage(W_ForeignLanguage): + _attrs_ = ['source'] + repr_classname = 'W_RubyLanguage' + + def __init__(self, source, break_on_exceptions=True): + W_ForeignLanguage.__init__(self, break_on_exceptions) + self.source = source + + def run(self): + print 'Ruby start' + try: + retval = ruby_space.execute(self.source) + self.set_result(retval) + except RubyError as e: + self.set_result(e.w_value) + except Exception as e: + print 'Unknown error in Ruby thread: %s' % e + finally: + self.mark_done() + + def set_current(self): + ec = ruby_space.getexecutioncontext() + ec.current_language = self + + def set_result(self, wr_result): + self.w_result = W_RubyObject(wr_result) + + def set_error(self, wr_error): + self.w_error = W_RubyObject(wr_error) + + def resume_class(self): + return w_ruby_class.get() + + def resume_method(self): + return w_ruby_resume_method.get() diff --git a/rsqueakvm/plugins/ruby/model.py b/rsqueakvm/plugins/ruby/model.py new file mode 100644 index 00000000..b2fe60b3 --- /dev/null +++ b/rsqueakvm/plugins/ruby/model.py @@ -0,0 +1,81 @@ +from rsqueakvm.plugins import ruby +from rsqueakvm.plugins.foreign_language.model import ( + W_ForeignLanguageObject, ForeignLanguageClassShadow) +from rsqueakvm.plugins.ruby import ruby_space +from rsqueakvm.primitives.constants import EXTERNAL_CALL +from rsqueakvm.model.compiled_methods import ( + W_PreSpurCompiledMethod, W_SpurCompiledMethod) +from rsqueakvm.storage import AbstractCachingShadow + +from rpython.rlib import objectmodel, jit + + +RubyClassShadowCache = {} + + +class W_RubyObject(W_ForeignLanguageObject): + _attrs_ = ['wr_object', 's_class'] + _immutable_fields_ = ['wr_object', 's_class?'] + repr_classname = 'W_RubyObject' + + def __init__(self, wr_object): + W_ForeignLanguageObject.__init__(self) + self.wr_object = wr_object + # self.w_pyID = None + self.s_class = None + + def getclass(self, space): + return W_RubyObject(self.wr_object.getclass(ruby_space)) + + def class_shadow(self, space): + wr_class = ruby_space.getclass(self.wr_object) + return W_RubyObject.pure_class_shadow(space, wr_class) + + @staticmethod + @jit.elidable + def pure_class_shadow(space, wr_class): + return RubyClassShadowCache.setdefault( + wr_class, RubyClassShadow(space, wr_class)) + + def is_same_object(self, other): + return (isinstance(other, W_RubyObject) and + other.wr_object is self.wr_object) + + +class RubyClassShadow(ForeignLanguageClassShadow): + _attrs_ = ['wr_class'] + _immutable_fields_ = ['wr_class'] + + def __init__(self, space, wr_class): + self.wr_class = wr_class + self.name = wr_class.name + AbstractCachingShadow.__init__( + self, space, space.w_nil, 0, space.w_nil) + + def fallback_class(self): + return ruby.w_ruby_object_class.get() + + def make_method(self, w_selector): + methodname = self.space.unwrap_string(w_selector) + idx = methodname.find(':') + if idx > 0: + methodname = methodname[0:idx] + ruby_method = self.wr_class.find_method(ruby_space, methodname) + if ruby_method is None: + return None + if self.space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 0 + w_cm._primitive = EXTERNAL_CALL + w_cm.literalsize = 2 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.bytes = [] + w_cm.literals = [ + ruby.w_ruby_plugin_send.get(), + w_selector + ] + return w_cm diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py new file mode 100644 index 00000000..547a4876 --- /dev/null +++ b/rsqueakvm/plugins/ruby/patching.py @@ -0,0 +1,44 @@ +from topaz.frame import Frame as TopazFrame +from topaz.interpreter import Interpreter as TopazInterpreter + +old_handle_bytecode = TopazInterpreter.handle_bytecode + +SWITCH_COUNTER_SIZE = 1000 +switch_counter = [SWITCH_COUNTER_SIZE] + + +def switch_to_smalltalk(ec): + # import pdb; pdb.set_trace() + language = ec.current_language + if language is None: + return + runner = language.runner() + if runner is None: + return + + # print 'Ruby yield' + runner.return_to_smalltalk() + # print 'Ruby continue' + + # error has been in Smalltalk land, clear it now to allow resuming + language.reset_error() + + +def new_handle_bytecode(self, space, pc, frame, bytecode): + if switch_counter[0] <= 0: + switch_counter[0] = SWITCH_COUNTER_SIZE + switch_to_smalltalk(space.getexecutioncontext()) + switch_counter[0] -= 1 + + return old_handle_bytecode(self, space, pc, frame, bytecode) + + +def patch_topaz(): + # Patch-out virtualizables from Topaz so that translation works + try: + delattr(TopazFrame, "_virtualizable_") + delattr(TopazInterpreter.jitdriver, "virtualizables") + except AttributeError: + pass # this is fine + + TopazInterpreter.handle_bytecode = new_handle_bytecode diff --git a/rsqueakvm/plugins/ruby/plugin.py b/rsqueakvm/plugins/ruby/plugin.py new file mode 100644 index 00000000..91a30c5b --- /dev/null +++ b/rsqueakvm/plugins/ruby/plugin.py @@ -0,0 +1,63 @@ +from rsqueakvm.error import Exit, PrimitiveFailedError +from rsqueakvm.plugins.foreign_language.plugin import ForeignLanguagePlugin +from rsqueakvm.util import system + +from rsqueakvm.plugins import ruby +from rsqueakvm.plugins.ruby.model import W_RubyObject +from rsqueakvm.plugins.ruby.language import W_RubyLanguage +from rsqueakvm.plugins.ruby.patching import patch_topaz +from rsqueakvm.plugins.ruby.utils import ruby_to_smalltalk + + +class RubyPlugin(ForeignLanguagePlugin): + def is_optional(self): + return True + + def setup(self): + system.translationconfig.set(thread=True) + system.translationconfig.set(continuation=True) + patch_topaz() + + @staticmethod + def startup(space, argv): + ForeignLanguagePlugin.startup(space, argv) + + ruby.w_ruby_plugin_send.set(space.wrap_list_unroll_safe([ + space.wrap_string('RubyPlugin'), + space.wrap_string('send') + ])) + + ruby_class = space.smalltalk_at('Ruby') + if ruby_class is None: + # disable plugin? + raise Exit('Ruby class not found.') + ruby.w_ruby_class.set(ruby_class) + + ruby_object_class = space.smalltalk_at('RubyObject') + if ruby_object_class is None: + raise Exit('RubyObject class not found.') + ruby.w_ruby_object_class.set(ruby_object_class) + + resume_method_symbol = space.wrap_symbol('resume:') + ruby_cls_cls_s = ruby_class.getclass( + space).as_class_get_shadow(space) + resume_method = ruby_cls_cls_s.lookup(resume_method_symbol) + if resume_method is None: + raise Exit('Ruby class>>resume: method not found.') + ruby.w_ruby_resume_method.set(resume_method) + + @staticmethod + def new_w_language(space, args_w): + if len(args_w) != 2: + raise PrimitiveFailedError + source = space.unwrap_string(args_w[0]) + break_on_exceptions = args_w[1] is space.w_true + return W_RubyLanguage(source, break_on_exceptions) + + @staticmethod + def w_object_class(): + return W_RubyObject + + @staticmethod + def to_w_object(space, foreign_object): + return ruby_to_smalltalk(space, foreign_object.wr_object) diff --git a/rsqueakvm/plugins/ruby/utils.py b/rsqueakvm/plugins/ruby/utils.py new file mode 100644 index 00000000..2190f0ba --- /dev/null +++ b/rsqueakvm/plugins/ruby/utils.py @@ -0,0 +1,53 @@ +from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.model.numeric import W_Float, W_SmallInteger +from rsqueakvm.plugins.ruby import ruby_space +from rsqueakvm.plugins.ruby.model import W_RubyObject +from rsqueakvm.model.variable import W_BytesObject + +from topaz.objects.floatobject import W_FloatObject as WR_FloatObject +from topaz.objects.intobject import W_FixnumObject as WR_FixnumObject +from topaz.objects.stringobject import W_StringObject as WR_StringObject +from topaz.objects.symbolobject import W_SymbolObject as WR_SymbolObject +from topaz.objects.nilobject import W_NilObject as WR_NilObject +from topaz.objects.boolobject import ( + W_TrueObject as WR_TrueObject, W_FalseObject as WR_FalseObject) + +from rpython.rlib import objectmodel + + +def ruby_to_smalltalk(space, wr_object): + if isinstance(wr_object, WR_FloatObject): + return space.wrap_float(ruby_space.float_w(wr_object)) + elif isinstance(wr_object, WR_FixnumObject): + return space.wrap_smallint_unsafe(ruby_space.int_w(wr_object)) + elif isinstance(wr_object, WR_StringObject): + return space.wrap_string(ruby_space.str_w(wr_object)) + elif isinstance(wr_object, WR_NilObject): + return space.w_nil + elif isinstance(wr_object, WR_FalseObject): + return space.w_false + elif isinstance(wr_object, WR_TrueObject): + return space.w_true + elif isinstance(wr_object, WR_SymbolObject): + return space.wrap_symbol(ruby_space.str_w(wr_object)) + print 'Cannot convert %s to Smalltalk' % wr_object + raise PrimitiveFailedError + + +@objectmodel.specialize.argtype(0) +def smalltalk_to_ruby(space, w_object): + if isinstance(w_object, W_RubyObject): + return w_object.wr_object + elif isinstance(w_object, W_Float): + return ruby_space.newfloat(space.unwrap_float(w_object)) + elif isinstance(w_object, W_SmallInteger): + return ruby_space.newint(space.unwrap_int(w_object)) + elif isinstance(w_object, W_BytesObject): + if w_object.getclass(space).is_same_object(space.w_String): + return ruby_space.newstr_fromstr(space.unwrap_string(w_object)) + else: + w_Symbol = space.w_doesNotUnderstand.getclass(space) + if w_object.getclass(space).is_same_object(w_Symbol): + return ruby_space.newsymbol(space.unwrap_string(w_object)) + print 'Cannot convert %s to Ruby' % w_object + raise PrimitiveFailedError diff --git a/rsqueakvm/plugins/ruby_plugin.py b/rsqueakvm/plugins/ruby_plugin.py index 901c46f3..b18d0fc2 100644 --- a/rsqueakvm/plugins/ruby_plugin.py +++ b/rsqueakvm/plugins/ruby_plugin.py @@ -1,223 +1,51 @@ -from rsqueakvm.util import system from rsqueakvm.error import PrimitiveFailedError -from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.model.variable import W_BytesObject -from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash -from rsqueakvm.model.compiled_methods import ( - W_PreSpurCompiledMethod, W_SpurCompiledMethod) -from rsqueakvm.plugins.plugin import Plugin -from rsqueakvm.storage_classes import ClassShadow -from rsqueakvm.storage import AbstractCachingShadow -from rsqueakvm.primitives.constants import EXTERNAL_CALL -from rsqueakvm.util.cells import QuasiConstant +from rsqueakvm.plugins.ruby.plugin import RubyPlugin + +from rpython.rlib import jit try: - from topaz.objspace import ObjectSpace - from topaz.objects.floatobject import W_FloatObject - from topaz.objects.intobject import W_FixnumObject - from topaz.objects.stringobject import W_StringObject - from topaz.objects.symbolobject import W_SymbolObject - from topaz.objects.nilobject import W_NilObject - from topaz.objects.boolobject import W_TrueObject, W_FalseObject + from rsqueakvm.plugins.ruby import ruby_space, utils + from rsqueakvm.plugins.ruby.model import W_RubyObject + from topaz.error import RubyError, print_traceback except ImportError: pass -from rpython.rlib import objectmodel, jit - -ruby_space = None - - -class RubyPlugin(Plugin): - _attrs_ = ["w_ruby_object_class", "w_ruby_plugin_send"] - - def __init__(self): - Plugin.__init__(self) - self.w_ruby_object_class = QuasiConstant(None, type=W_AbstractObjectWithIdentityHash) - self.w_ruby_plugin_send = QuasiConstant(None, type=W_AbstractObjectWithIdentityHash) - - def is_optional(self): - return True - - def setup(self): - system.translationconfig.set(continuation=True) - setup_topaz() - - @staticmethod - def startup(space, argv): - plugin.w_ruby_plugin_send.set(space.wrap_list_unroll_safe([ - space.wrap_string("RubyPlugin"), - space.wrap_string("send") - ])) - w_ruby_class = space.smalltalk_at("RubyObject") - if w_ruby_class is None: - w_ruby_class = space.w_nil.getclass(space) - plugin.w_ruby_object_class.set(w_ruby_class) - ruby_space.setup(argv[0]) - - -def setup_topaz(): - global ruby_space - # Patch-out virtualizables from Topaz so that translation works - from topaz.frame import Frame as TopazFrame - from topaz.interpreter import Interpreter as TopazInterpreter - try: - delattr(TopazFrame, "_virtualizable_") - delattr(TopazInterpreter.jitdriver, "virtualizables") - except AttributeError: - pass # this is fine - - ruby_space = ObjectSpace(None) plugin = RubyPlugin() -@objectmodel.specialize.argtype(0) -def wrap(interp, wr_object): - space = interp.space - if isinstance(wr_object, W_FloatObject): - return space.wrap_float(ruby_space.float_w(wr_object)) - elif isinstance(wr_object, W_FixnumObject): - return space.wrap_smallint_unsafe(ruby_space.int_w(wr_object)) - elif isinstance(wr_object, W_StringObject): - return space.wrap_string(ruby_space.str_w(wr_object)) - elif isinstance(wr_object, W_NilObject): - return space.w_nil - elif isinstance(wr_object, W_FalseObject): - return space.w_false - elif isinstance(wr_object, W_TrueObject): - return space.w_true - elif isinstance(wr_object, W_SymbolObject): - w_string = space.wrap_string(ruby_space.str_w(wr_object)) - return interp.perform(w_string, selector="asSymbol") - else: - return W_RubyObject(wr_object) - - -@objectmodel.specialize.argtype(0) -def unwrap(interp, w_object): - space = interp.space - if isinstance(w_object, W_RubyObject): - return w_object.wr_object - elif isinstance(w_object, W_Float): - return ruby_space.newfloat(space.unwrap_float(w_object)) - elif isinstance(w_object, W_SmallInteger): - return ruby_space.newint(space.unwrap_int(w_object)) - elif isinstance(w_object, W_BytesObject): - if w_object.getclass(space).is_same_object(space.w_String): - return ruby_space.newstr_fromstr(space.unwrap_string(w_object)) - else: - w_Symbol = space.w_doesNotUnderstand.getclass(space) - if w_object.getclass(space).is_same_object(w_Symbol): - return ruby_space.newsymbol(space.unwrap_string(w_object)) - raise PrimitiveFailedError - - -class W_RubyObject(W_AbstractObjectWithIdentityHash): - _attrs_ = ["wr_object", "s_class"] - _immutable_fields_ = ["wr_object", "s_class?"] - repr_classname = "W_RubyObject" - - def __init__(self, wr_object): - self.wr_object = wr_object - self.s_class = None - - def getclass(self, space): - return W_RubyObject(self.wr_object.getclass(ruby_space)) - - def class_shadow(self, space): - wr_class = ruby_space.getclass(self.wr_object) - return W_RubyObject.pure_class_shadow(space, wr_class) - - @staticmethod - @jit.elidable - def pure_class_shadow(space, wr_class): - return RubyClassShadowCache.setdefault(wr_class, RubyClassShadow(space, wr_class)) - - def is_same_object(self, other): - return isinstance(other, W_RubyObject) and (other.wr_object is self.wr_object) - -RubyClassShadowCache = {} - - -class RubyClassShadow(ClassShadow): - _attrs_ = ["wr_class"] - _immutable_fields_ = ["wr_class"] - def __init__(self, space, wr_class): - self.wr_class = wr_class - self.name = wr_class.name - AbstractCachingShadow.__init__(self, space, space.w_nil, 0, space.w_nil) - - def changed(self): - pass # Changes to Ruby classes are handled in Ruby land - - def lookup(self, w_selector): - w_method = self._lookup(w_selector, self.wr_class.version) - if w_method is None: - w_ro = plugin.w_ruby_object_class.get() - return w_ro.as_class_get_shadow(self.space).lookup(w_selector) - return w_method - - @jit.elidable - def _lookup(self, w_selector, version): - return self.make_method(w_selector) - - def make_method(self, w_selector): - methodname = self.space.unwrap_string(w_selector) - idx = methodname.find(":") - if idx > 0: - methodname = methodname[0:idx] - ruby_method = self.wr_class.find_method(ruby_space, methodname) - if ruby_method is None: - return None - if self.space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 0 - w_cm._primitive = EXTERNAL_CALL - w_cm.literalsize = 2 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.bytes = [] - w_cm.literals = [ - plugin.w_ruby_plugin_send.get(), - w_selector - ] - return w_cm - - -@plugin.expose_primitive(unwrap_spec=[object, str]) -def eval(interp, s_frame, w_rcvr, source): - try: - return wrap(interp, ruby_space.execute(source)) - except RubyError as e: - print_traceback(ruby_space, e.w_value) - raise PrimitiveFailedError +# @plugin.expose_primitive(unwrap_spec=[object]) +# def getTopFrame(interp, s_frame, w_rcvr): +# # import pdb; pdb.set_trace() +# topframe = ruby_space.getexecutioncontext().gettoprubyframe() +# if topframe is None: +# raise PrimitiveFailedError +# TODO: topframe is not a topaz.objects.objectobject.W_Root object +# return W_RubyObject(topframe) @plugin.expose_primitive(compiled_method=True) @jit.unroll_safe def send(interp, s_frame, argcount, w_method): + # import pdb; pdb.set_trace() + space = interp.space args_w = s_frame.peek_n(argcount) - w_literal2 = w_method.literalat0(interp.space, 2) - methodname = "" - if isinstance(w_literal2, W_BytesObject): - wr_rcvr = unwrap(interp, s_frame.peek(argcount)) - methodname = interp.space.unwrap_string(w_literal2) - elif argcount == 3: - methodname = interp.space.unwrap_string(args_w[0]) - wr_rcvr = unwrap(interp, args_w[1]) - args_w = interp.space.unwrap_array(args_w[2]) - else: + args_rw = [utils.smalltalk_to_ruby(space, w_arg) for w_arg in args_w] + wr_rcvr = utils.smalltalk_to_ruby(space, s_frame.peek(argcount)) + w_selector_name = w_method.literalat0(space, 2) + if not isinstance(w_selector_name, W_BytesObject): + print 'w_selector_name not an instance of W_BytesObject' raise PrimitiveFailedError - idx = methodname.find(":") + methodname = space.unwrap_string(w_selector_name) + idx = methodname.find(':') if idx > 0: methodname = methodname[0:idx] - args_rw = [unwrap(interp, w_arg) for w_arg in args_w] + try: - return wrap(interp, ruby_space.send(wr_rcvr, methodname, args_w=args_rw)) + wr_result = ruby_space.send(wr_rcvr, methodname, args_w=args_rw) + return W_RubyObject(wr_result) except RubyError as e: print_traceback(ruby_space, e.w_value) raise PrimitiveFailedError From 4a10e0154633af18f757504ff914402ddd8f3d7f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 12 Mar 2017 17:55:40 +0100 Subject: [PATCH 122/193] =?UTF-8?q?Ensure=20(Python|Ruby)Plugin=20don?= =?UTF-8?q?=E2=80=99t=20throw=20ImportError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rsqueakvm/plugins/python/plugin.py | 13 ++++++++----- rsqueakvm/plugins/python_plugin.py | 4 ++-- rsqueakvm/plugins/ruby/plugin.py | 13 ++++++++----- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/rsqueakvm/plugins/python/plugin.py b/rsqueakvm/plugins/python/plugin.py index 75c71af7..c5a0b6fb 100644 --- a/rsqueakvm/plugins/python/plugin.py +++ b/rsqueakvm/plugins/python/plugin.py @@ -2,11 +2,14 @@ from rsqueakvm.plugins.foreign_language.plugin import ForeignLanguagePlugin from rsqueakvm.util import system -from rsqueakvm.plugins import python -from rsqueakvm.plugins.python.model import W_PythonObject -from rsqueakvm.plugins.python.language import W_PythonLanguage -from rsqueakvm.plugins.python.patching import patch_pypy -from rsqueakvm.plugins.python.utils import python_to_smalltalk +try: + from rsqueakvm.plugins import python + from rsqueakvm.plugins.python.model import W_PythonObject + from rsqueakvm.plugins.python.language import W_PythonLanguage + from rsqueakvm.plugins.python.patching import patch_pypy + from rsqueakvm.plugins.python.utils import python_to_smalltalk +except ImportError: + pass class PythonPlugin(ForeignLanguagePlugin): diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 63259545..816f4078 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -10,8 +10,8 @@ from rsqueakvm.plugins.python.model import W_PythonObject from pypy.interpreter.error import OperationError - from pypy.interpreter.function import (Function, Method, StaticMethod, - ClassMethod) + from pypy.interpreter.function import ( + Function, Method, StaticMethod, ClassMethod) except ImportError: pass diff --git a/rsqueakvm/plugins/ruby/plugin.py b/rsqueakvm/plugins/ruby/plugin.py index 91a30c5b..47b6c50a 100644 --- a/rsqueakvm/plugins/ruby/plugin.py +++ b/rsqueakvm/plugins/ruby/plugin.py @@ -2,11 +2,14 @@ from rsqueakvm.plugins.foreign_language.plugin import ForeignLanguagePlugin from rsqueakvm.util import system -from rsqueakvm.plugins import ruby -from rsqueakvm.plugins.ruby.model import W_RubyObject -from rsqueakvm.plugins.ruby.language import W_RubyLanguage -from rsqueakvm.plugins.ruby.patching import patch_topaz -from rsqueakvm.plugins.ruby.utils import ruby_to_smalltalk +try: + from rsqueakvm.plugins import ruby + from rsqueakvm.plugins.ruby.model import W_RubyObject + from rsqueakvm.plugins.ruby.language import W_RubyLanguage + from rsqueakvm.plugins.ruby.patching import patch_topaz + from rsqueakvm.plugins.ruby.utils import ruby_to_smalltalk +except ImportError: + pass class RubyPlugin(ForeignLanguagePlugin): From 7c399bcd8ed12217b1b17dff60f7989e6308e9fc Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 13 Mar 2017 00:52:02 +0100 Subject: [PATCH 123/193] Refactor (Python|Ruby)Plugin --- .../plugins/foreign_language/__init__.py | 73 +++++++++++++++++- .../plugins/foreign_language/language.py | 51 ++++++++++--- rsqueakvm/plugins/foreign_language/model.py | 70 ++++++++++++++--- rsqueakvm/plugins/foreign_language/plugin.py | 74 ------------------ rsqueakvm/plugins/foreign_language/runner.py | 4 +- rsqueakvm/plugins/python/__init__.py | 76 ++++++++++++++----- rsqueakvm/plugins/python/language.py | 13 +--- rsqueakvm/plugins/python/model.py | 50 +++--------- .../python/{py_objspace.py => objspace.py} | 6 ++ rsqueakvm/plugins/python/patching.py | 2 +- rsqueakvm/plugins/python/plugin.py | 70 ----------------- rsqueakvm/plugins/python/switching.py | 6 +- rsqueakvm/plugins/python/utils.py | 2 +- rsqueakvm/plugins/python_plugin.py | 5 +- rsqueakvm/plugins/ruby/__init__.py | 56 +++++++++++--- rsqueakvm/plugins/ruby/language.py | 13 +--- rsqueakvm/plugins/ruby/model.py | 37 ++------- rsqueakvm/plugins/ruby/objspace.py | 3 + rsqueakvm/plugins/ruby/utils.py | 2 +- rsqueakvm/plugins/ruby_plugin.py | 9 ++- .../test/plugins/python/test_end_to_end.py | 4 +- .../plugins/python/test_pyframe_exceptions.py | 2 +- 22 files changed, 318 insertions(+), 310 deletions(-) delete mode 100644 rsqueakvm/plugins/foreign_language/plugin.py rename rsqueakvm/plugins/python/{py_objspace.py => objspace.py} (93%) delete mode 100644 rsqueakvm/plugins/python/plugin.py create mode 100644 rsqueakvm/plugins/ruby/objspace.py diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 00ab7d55..4ac05865 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -1,4 +1,71 @@ -from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.util.cells import QuasiConstant +from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage +from rsqueakvm.plugins.plugin import Plugin -w_foreign_language_class = QuasiConstant(None, type=W_PointersObject) + +class ForeignLanguagePlugin(Plugin): + + def __init__(self): + Plugin.__init__(self) + self.register_default_primitives() + + @staticmethod + def load_special_objects(space, language_name, language_cls, shadow_cls): + language_cls.load_special_objects(language_cls, language_name, space) + shadow_cls.load_special_objects(shadow_cls, language_name, space) + + # Abstract methods + + @staticmethod + def new_w_language(space, args_w): + raise NotImplementedError + + @staticmethod + def w_object_class(): + raise NotImplementedError + + @staticmethod + def to_w_object(foreign_object): + raise NotImplementedError + + # Default primitives + + def register_default_primitives(self): + @self.expose_primitive(result_is_new_frame=True) + def eval(interp, s_frame, argcount): + # import pdb; pdb.set_trace() + args_w = s_frame.peek_n(argcount) + language = self.new_w_language(interp.space, args_w) + language.start() + # when we are here, the foreign language process has yielded + frame = language.switch_to_smalltalk(interp, s_frame, + first_call=True) + s_frame.pop_n(argcount + 1) + return frame + + @self.expose_primitive(unwrap_spec=[object, object], + result_is_new_frame=True) + def resume(interp, s_frame, w_rcvr, language): + # print 'Smalltalk yield' + # import pdb; pdb.set_trace() + if not isinstance(language, W_ForeignLanguage): + raise PrimitiveFailedError + if not language.resume(): + raise PrimitiveFailedError + return language.switch_to_smalltalk(interp, s_frame) + + @self.expose_primitive(unwrap_spec=[object, object]) + def lastError(interp, s_frame, w_rcvr, language): + if not isinstance(language, W_ForeignLanguage): + raise PrimitiveFailedError + w_error = language.get_error() + if w_error is None: + print 'w_error was None in lastError' + raise PrimitiveFailedError + return w_error + + @self.expose_primitive(unwrap_spec=[object]) + def asSmalltalk(interp, s_frame, w_rcvr): + if not isinstance(w_rcvr, self.w_object_class()): + raise PrimitiveFailedError + return self.to_w_object(interp.space, w_rcvr) diff --git a/rsqueakvm/plugins/foreign_language/language.py b/rsqueakvm/plugins/foreign_language/language.py index 5e61db73..b9264fc8 100644 --- a/rsqueakvm/plugins/foreign_language/language.py +++ b/rsqueakvm/plugins/foreign_language/language.py @@ -1,7 +1,10 @@ -from rsqueakvm.plugins.foreign_language import runner, w_foreign_language_class +from rsqueakvm.error import Exit +from rsqueakvm.plugins.foreign_language import runner from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.compiled_methods import ( W_PreSpurCompiledMethod, W_SpurCompiledMethod) +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.util.cells import QuasiConstant from pypy.interpreter.executioncontext import ExecutionContext @@ -16,6 +19,9 @@ class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): '_runner', '_done', 'w_result', 'w_error', '_break_on_exceptions'] repr_classname = 'W_ForeignLanguage' + w_foreign_class = QuasiConstant(None, type=W_PointersObject) + w_foreign_resume = QuasiConstant(None, type=W_PointersObject) + def __init__(self, break_on_exceptions=True): W_AbstractObjectWithIdentityHash.__init__(self) self._done = False @@ -27,6 +33,22 @@ def __init__(self, break_on_exceptions=True): else: self._runner = runner.GreenletLanguageRunner(self) + @staticmethod + def load_special_objects(cls, language_name, space): + foreign_class = space.smalltalk_at(language_name) + if foreign_class is None: + # disable plugin? + raise Exit('%s class not found.' % language_name) + cls.w_foreign_class.set(foreign_class) + + resume_method_symbol = space.wrap_symbol('resume:') + foreign_cls_cls_s = foreign_class.getclass( + space).as_class_get_shadow(space) + resume_method = foreign_cls_cls_s.lookup(resume_method_symbol) + if resume_method is None: + raise Exit('%s class>>resume: method not found.' % language_name) + cls.w_foreign_resume.set(resume_method) + # W_AbstractObjectWithIdentityHash overrides def at0(self, space, index0): @@ -46,7 +68,7 @@ def store(self, space, n0, w_value): pass def getclass(self, space): - return w_foreign_language_class.get() + return self.foreign_class() # Abstract methods @@ -62,13 +84,21 @@ def set_error(self, error): def set_current(self): raise NotImplementedError - def resume_class(self): - raise NotImplementedError + # Helpers - def resume_method(self): - raise NotImplementedError + def run_safe(self): + try: + self.run() + except Exception as e: + print 'Unknown error in thread: %s' % e + finally: + self._done = True - # Helpers + def foreign_class(self): + return self.w_foreign_class.get() + + def resume_method(self): + return self.w_foreign_resume.get() def start(self): self.runner().start() @@ -84,9 +114,6 @@ def resume(self): def runner(self): return self._runner - def mark_done(self): - self._done = True - def is_done(self): return self._done @@ -114,7 +141,7 @@ def switch_to_smalltalk(self, interp, s_frame, first_call=False): s_resume_frame = ContextPartShadow.build_method_context( interp.space, self.resume_method(), - self.resume_class(), + self.foreign_class(), [self] ) # import pdb; pdb.set_trace() @@ -147,7 +174,7 @@ def _create_return_frame(self, space): w_cm = objectmodel.instantiate(W_SpurCompiledMethod) else: w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_resume_class = self.resume_class() + w_resume_class = self.foreign_class() w_cm.header = 0 w_cm._primitive = 0 w_cm.literalsize = 3 diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py index 096a0524..ea382093 100644 --- a/rsqueakvm/plugins/foreign_language/model.py +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -1,5 +1,13 @@ +from rsqueakvm.error import Exit from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash -from rsqueakvm.storage_classes import ClassShadow +from rsqueakvm.model.compiled_methods import ( + W_PreSpurCompiledMethod, W_SpurCompiledMethod) +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.primitives.constants import EXTERNAL_CALL +from rsqueakvm.storage_classes import AbstractCachingShadow, ClassShadow +from rsqueakvm.util.cells import QuasiConstant + +from rpython.rlib import objectmodel class W_ForeignLanguageObject(W_AbstractObjectWithIdentityHash): @@ -34,8 +42,34 @@ def is_same_object(self, other): class ForeignLanguageClassShadow(ClassShadow): - _attrs_ = ['wp_object', 'wp_class'] - _immutable_fields_ = ['wp_class'] + _attrs_ = [] + _immutable_fields_ = [] + + w_plugin_send = QuasiConstant(None, type=W_PointersObject) + w_foreign_class = QuasiConstant(None, type=W_PointersObject) + w_foreign_object_class = QuasiConstant(None, type=W_PointersObject) + + def __init__(self, space): + AbstractCachingShadow.__init__( + self, space, space.w_nil, 0, space.w_nil) + + @staticmethod + def load_special_objects(cls, language_name, space): + cls.w_plugin_send.set(space.wrap_list_unroll_safe([ + space.wrap_string('%sPlugin' % language_name), + space.wrap_string('send') + ])) + + foreign_class = space.smalltalk_at(language_name) + if foreign_class is None: + # disable plugin? + raise Exit('%s class not found.' % language_name) + cls.w_foreign_class.set(foreign_class) + + foreign_object_class = space.smalltalk_at('%sObject' % language_name) + if foreign_object_class is None: + raise Exit('%sObject class not found.' % language_name) + cls.w_foreign_object_class.set(foreign_object_class) # Overrides @@ -43,16 +77,32 @@ def changed(self): pass # Changes to foreign classes are not handled in Smalltalk def lookup(self, w_selector): - w_method = self.make_method(w_selector) - if w_method is not None: - return w_method - fallback = self.fallback_class().as_class_get_shadow(self.space) - return fallback.lookup(w_selector) + if self.method_exists(w_selector): + return self.make_method(w_selector) + return self.w_foreign_object_class.get().as_class_get_shadow( + self.space).lookup(w_selector) # Abstract methods - def fallback_class(self): + def method_exists(self, w_selector): raise NotImplementedError + # Helpers def make_method(self, w_selector): - raise NotImplementedError + if self.space.is_spur.is_set(): + w_cm = objectmodel.instantiate(W_SpurCompiledMethod) + else: + w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) + w_cm.header = 0 + w_cm._primitive = EXTERNAL_CALL + w_cm.literalsize = 2 + w_cm.islarge = False + w_cm._tempsize = 0 + w_cm.argsize = 0 + w_cm.compiledin_class = self.w_foreign_class.get() + w_cm.bytes = [] + w_cm.literals = [ + self.w_plugin_send.get(), + w_selector + ] + return w_cm diff --git a/rsqueakvm/plugins/foreign_language/plugin.py b/rsqueakvm/plugins/foreign_language/plugin.py deleted file mode 100644 index d642e0d6..00000000 --- a/rsqueakvm/plugins/foreign_language/plugin.py +++ /dev/null @@ -1,74 +0,0 @@ -from rsqueakvm.error import Exit, PrimitiveFailedError -from rsqueakvm.plugins.foreign_language import w_foreign_language_class -from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage -from rsqueakvm.plugins.plugin import Plugin - - -class ForeignLanguagePlugin(Plugin): - def __init__(self): - Plugin.__init__(self) - self.register_default_primitives() - - # Abstract methods - - @staticmethod - def new_w_language(space, args_w): - raise NotImplementedError - - @staticmethod - def w_object_class(): - raise NotImplementedError - - @staticmethod - def to_w_object(foreign_object): - raise NotImplementedError - - @staticmethod - def startup(space, argv): - foreign_language_class = space.smalltalk_at('ForeignLanguage') - if foreign_language_class is None: - # disable plugin? - raise Exit('ForeignLanguage class not found.') - w_foreign_language_class.set(foreign_language_class) - - # Default primitives - - def register_default_primitives(self): - @self.expose_primitive(result_is_new_frame=True) - def eval(interp, s_frame, argcount): - # import pdb; pdb.set_trace() - args_w = s_frame.peek_n(argcount) - language = self.new_w_language(interp.space, args_w) - language.start() - # when we are here, the foreign language process has yielded - frame = language.switch_to_smalltalk(interp, s_frame, - first_call=True) - s_frame.pop_n(argcount + 1) - return frame - - @self.expose_primitive(unwrap_spec=[object, object], - result_is_new_frame=True) - def resume(interp, s_frame, w_rcvr, language): - # print 'Smalltalk yield' - # import pdb; pdb.set_trace() - if not isinstance(language, W_ForeignLanguage): - raise PrimitiveFailedError - if not language.resume(): - raise PrimitiveFailedError - return language.switch_to_smalltalk(interp, s_frame) - - @self.expose_primitive(unwrap_spec=[object, object]) - def lastError(interp, s_frame, w_rcvr, language): - if not isinstance(language, W_ForeignLanguage): - raise PrimitiveFailedError - w_error = language.get_error() - if w_error is None: - print 'w_error was None in lastError' - raise PrimitiveFailedError - return w_error - - @self.expose_primitive(unwrap_spec=[object]) - def asSmalltalk(interp, s_frame, w_rcvr): - if not isinstance(w_rcvr, self.w_object_class()): - raise PrimitiveFailedError - return self.to_w_object(interp.space, w_rcvr) diff --git a/rsqueakvm/plugins/foreign_language/runner.py b/rsqueakvm/plugins/foreign_language/runner.py index 307b1a38..fe03c72c 100644 --- a/rsqueakvm/plugins/foreign_language/runner.py +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -70,7 +70,7 @@ def new_stacklet_callback(h, arg): self = global_execution_state.origin self.smalltalk_handle = h global_execution_state.clear() - self.language().run() + self.language().run_safe() global_execution_state.origin = self return self.smalltalk_handle # return to Smalltalk when done @@ -92,7 +92,7 @@ def return_to_smalltalk(self): def new_greenlet_callback(): print 'new_greenlet_callback' self = global_execution_state.origin - return self.language().run + return self.language().run_safe class GlobalState: diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index c17b2791..eb92a9f9 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -1,23 +1,65 @@ -from rsqueakvm.model.compiled_methods import W_CompiledMethod -from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.util.cells import QuasiConstant, Cell -from rsqueakvm.plugins.python.py_objspace import new_pypy_objspace -from rsqueakvm.plugins.python.switching import PyFrameRestartInfo -from rsqueakvm.plugins.python.switching import SwitchToSmalltalkAction +from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.plugins.foreign_language import ForeignLanguagePlugin +from rsqueakvm.util.cells import Cell +from rsqueakvm.util.system import translationconfig +try: + from rsqueakvm.plugins.python.model import ( + W_PythonObject, PythonClassShadow) + from rsqueakvm.plugins.python.language import W_PythonLanguage + from rsqueakvm.plugins.python.objspace import py_space + from rsqueakvm.plugins.python.patching import patch_pypy + from rsqueakvm.plugins.python.switching import PyFrameRestartInfo + from rsqueakvm.plugins.python.utils import python_to_smalltalk + IMPORT_FAILED = False +except ImportError: + IMPORT_FAILED = True -py_space = new_pypy_objspace() -switch_action = SwitchToSmalltalkAction(py_space) -py_space.actionflag.register_periodic_action( - switch_action, use_bytecode_counter=True) -py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) +class PythonPlugin(ForeignLanguagePlugin): + language_name = 'Python' -w_python_resume_method = QuasiConstant(None, type=W_CompiledMethod) -w_python_class = QuasiConstant(None, type=W_PointersObject) -w_python_object_class = QuasiConstant(None, type=W_PointersObject) -w_python_plugin_send = QuasiConstant(None, type=W_PointersObject) + py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) + def is_optional(self): + return True -def set_py_frame_restart_info(frame, py_code): - py_frame_restart_info.set(PyFrameRestartInfo(frame, py_code)) + def is_enabled(self): + if IMPORT_FAILED: + return False + return ForeignLanguagePlugin.is_enabled(self) + + def setup(self): + translationconfig.set(thread=True) + translationconfig.set(continuation=True) + patch_pypy() + + @staticmethod + def startup(space, argv): + ForeignLanguagePlugin.load_special_objects( + space, PythonPlugin.language_name, + W_PythonLanguage, PythonClassShadow) + py_space.startup() + + @staticmethod + def new_w_language(space, args_w): + if len(args_w) != 4: + raise PrimitiveFailedError + source = space.unwrap_string(args_w[0]) + filename = space.unwrap_string(args_w[1]) + cmd = space.unwrap_string(args_w[2]) + break_on_exceptions = args_w[3] is space.w_true + return W_PythonLanguage(source, filename, cmd, break_on_exceptions) + + @staticmethod + def w_object_class(): + return W_PythonObject + + @staticmethod + def to_w_object(space, foreign_object): + return python_to_smalltalk(space, foreign_object.wp_object) + + @staticmethod + def set_py_frame_restart_info(frame, py_code): + PythonPlugin.py_frame_restart_info.set( + PyFrameRestartInfo(frame, py_code)) diff --git a/rsqueakvm/plugins/python/language.py b/rsqueakvm/plugins/python/language.py index 5b0c7e8e..a5fe4fa5 100644 --- a/rsqueakvm/plugins/python/language.py +++ b/rsqueakvm/plugins/python/language.py @@ -1,7 +1,6 @@ from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage -from rsqueakvm.plugins.python import ( - py_space, w_python_class, w_python_resume_method) from rsqueakvm.plugins.python.model import W_PythonObject +from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist from pypy.interpreter.error import OperationError @@ -32,10 +31,6 @@ def run(self): # operr was not handled by users, because they pressed proceed. # save Python error as result instead. self.set_result(operr_to_pylist(operr)) - except Exception as e: - print 'Unknown error in Python thread: %s' % e - finally: - self.mark_done() def set_current(self): ec = py_space.getexecutioncontext() @@ -46,9 +41,3 @@ def set_result(self, wp_result): def set_error(self, wp_operr): self.w_error = W_PythonObject(operr_to_pylist(wp_operr)) - - def resume_class(self): - return w_python_class.get() - - def resume_method(self): - return w_python_resume_method.get() diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index d4f752d9..deefe7a1 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -1,16 +1,9 @@ -from rsqueakvm.plugins import python from rsqueakvm.plugins.foreign_language.model import ( W_ForeignLanguageObject, ForeignLanguageClassShadow) -from rsqueakvm.plugins.python import py_space -from rsqueakvm.primitives.constants import EXTERNAL_CALL -from rsqueakvm.model.compiled_methods import ( - W_PreSpurCompiledMethod, W_SpurCompiledMethod) -from rsqueakvm.storage import AbstractCachingShadow +from rsqueakvm.plugins.python.objspace import py_space from pypy.interpreter.error import OperationError -from rpython.rlib import objectmodel - class W_PythonObject(W_ForeignLanguageObject): _attrs_ = ['wp_object', 's_class'] @@ -49,23 +42,15 @@ def __init__(self, space, wp_object): wp_class = py_space.type(self.wp_object) self.wp_class = wp_class self.name = wp_class.name - AbstractCachingShadow.__init__( - self, space, space.w_nil, 0, space.w_nil) - - def fallback_class(self): - return python.w_python_object_class.get() + ForeignLanguageClassShadow.__init__(self, space) - def make_method(self, w_selector): + def method_exists(self, w_selector): # import pdb; pdb.set_trace() methodname = self.space.unwrap_string(w_selector) idx = methodname.find(':') if idx > 0: methodname = methodname[0:idx] - - # import pdb; pdb.set_trace() - py_attr = None - # py_attr = True if methodname in ['pyID'] else None # 'printString' try: if py_attr is None: # check instance vars and methods @@ -79,32 +64,15 @@ def make_method(self, w_selector): pass except Exception as e: print 'Unable to create method %s: %s' % (methodname, e) - return None + return False if py_attr is None: # check builtins if self.wp_class is py_space.type(py_space.builtin): try: - builtin_func = py_space.builtin.get(methodname) - if builtin_func is None: - return None + if py_space.builtin.get(methodname) is None: + return False except OperationError: - return None + return False else: - return None - if self.space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm._primitive = EXTERNAL_CALL - w_cm.literalsize = 2 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.compiledin_class = python.w_python_class.get() - w_cm.lookup_selector = 'fakePythonSend' - w_cm.bytes = [] - w_cm.literals = [ - python.w_python_plugin_send.get(), - w_selector - ] - return w_cm + return False + return True diff --git a/rsqueakvm/plugins/python/py_objspace.py b/rsqueakvm/plugins/python/objspace.py similarity index 93% rename from rsqueakvm/plugins/python/py_objspace.py rename to rsqueakvm/plugins/python/objspace.py index b32ffe26..2f5554eb 100644 --- a/rsqueakvm/plugins/python/py_objspace.py +++ b/rsqueakvm/plugins/python/objspace.py @@ -1,3 +1,4 @@ +from rsqueakvm.plugins.python.switching import SwitchToSmalltalkAction from rsqueakvm.util import system @@ -85,3 +86,8 @@ def new_pypy_objspace(): py_space.newtext(os.path.abspath(sys.argv[0]))) return py_space + +py_space = new_pypy_objspace() +switch_action = SwitchToSmalltalkAction(py_space) +py_space.actionflag.register_periodic_action( + switch_action, use_bytecode_counter=True) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 4fc4291f..d1d95f65 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,4 +1,4 @@ -from rsqueakvm.plugins.python import py_space, switch_action +from rsqueakvm.plugins.python.objspace import py_space, switch_action from rsqueakvm.plugins.python.switching import RestartException from pypy.interpreter.pycode import PyCode, default_magic diff --git a/rsqueakvm/plugins/python/plugin.py b/rsqueakvm/plugins/python/plugin.py deleted file mode 100644 index c5a0b6fb..00000000 --- a/rsqueakvm/plugins/python/plugin.py +++ /dev/null @@ -1,70 +0,0 @@ -from rsqueakvm.error import Exit, PrimitiveFailedError -from rsqueakvm.plugins.foreign_language.plugin import ForeignLanguagePlugin -from rsqueakvm.util import system - -try: - from rsqueakvm.plugins import python - from rsqueakvm.plugins.python.model import W_PythonObject - from rsqueakvm.plugins.python.language import W_PythonLanguage - from rsqueakvm.plugins.python.patching import patch_pypy - from rsqueakvm.plugins.python.utils import python_to_smalltalk -except ImportError: - pass - - -class PythonPlugin(ForeignLanguagePlugin): - def is_optional(self): - return True - - def setup(self): - system.translationconfig.set(thread=True) - system.translationconfig.set(continuation=True) - patch_pypy() - - @staticmethod - def startup(space, argv): - ForeignLanguagePlugin.startup(space, argv) - - python.w_python_plugin_send.set(space.wrap_list_unroll_safe([ - space.wrap_string('PythonPlugin'), - space.wrap_string('send') - ])) - - python_class = space.smalltalk_at('Python') - if python_class is None: - # disable plugin? - raise Exit('Python class not found.') - python.w_python_class.set(python_class) - - python_object_class = space.smalltalk_at('PythonObject') - if python_object_class is None: - raise Exit('PythonObject class not found.') - python.w_python_object_class.set(python_object_class) - - resume_method_symbol = space.wrap_symbol('resume:') - python_cls_cls_s = python_class.getclass( - space).as_class_get_shadow(space) - resume_method = python_cls_cls_s.lookup(resume_method_symbol) - if resume_method is None: - raise Exit('Python class>>resume: method not found.') - python.w_python_resume_method.set(resume_method) - - python.py_space.startup() - - @staticmethod - def new_w_language(space, args_w): - if len(args_w) != 4: - raise PrimitiveFailedError - source = space.unwrap_string(args_w[0]) - filename = space.unwrap_string(args_w[1]) - cmd = space.unwrap_string(args_w[2]) - break_on_exceptions = args_w[3] is space.w_true - return W_PythonLanguage(source, filename, cmd, break_on_exceptions) - - @staticmethod - def w_object_class(): - return W_PythonObject - - @staticmethod - def to_w_object(space, foreign_object): - return python_to_smalltalk(space, foreign_object.wp_object) diff --git a/rsqueakvm/plugins/python/switching.py b/rsqueakvm/plugins/python/switching.py index 18620fac..f7aed165 100644 --- a/rsqueakvm/plugins/python/switching.py +++ b/rsqueakvm/plugins/python/switching.py @@ -8,7 +8,7 @@ def __init__(self, py_space): PeriodicAsyncAction.__init__(self, py_space) def perform(self, ec, frame): - from rsqueakvm.plugins.python import py_frame_restart_info + from rsqueakvm.plugins.python import PythonPlugin # import pdb; pdb.set_trace() language = ec.current_language @@ -26,9 +26,9 @@ def perform(self, ec, frame): language.reset_error() # handle py_frame_restart_info if set - restart_info = py_frame_restart_info.get() + restart_info = PythonPlugin.py_frame_restart_info.get() if restart_info is not None: - py_frame_restart_info.set(None) + PythonPlugin.py_frame_restart_info.set(None) # import pdb; pdb.set_trace() raise RestartException(restart_info) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index bc1fead1..40dd1a30 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -2,8 +2,8 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger -from rsqueakvm.plugins.python import py_space from rsqueakvm.plugins.python.model import W_PythonObject +from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.model.variable import W_BytesObject from pypy.interpreter.argument import Arguments diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 816f4078..6296b725 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -1,7 +1,6 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.variable import W_BytesObject -from rsqueakvm.plugins.python import set_py_frame_restart_info -from rsqueakvm.plugins.python.plugin import PythonPlugin +from rsqueakvm.plugins.python import PythonPlugin from rpython.rlib import jit @@ -39,7 +38,7 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, py_code = utils.get_restart_pycode(source, filename, cmd) if py_code is None: return interp.space.w_false # Raising prim error causes crashes - set_py_frame_restart_info(frame, py_code) + PythonPlugin.set_py_frame_restart_info(frame, py_code) return interp.space.w_true diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index d4add70c..49ca31cf 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -1,13 +1,51 @@ -from rsqueakvm.model.compiled_methods import W_CompiledMethod -from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.util.cells import QuasiConstant +from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.plugins.foreign_language import ForeignLanguagePlugin +from rsqueakvm.util import system -from topaz.objspace import ObjectSpace +try: + from rsqueakvm.plugins.ruby.model import W_RubyObject, RubyClassShadow + from rsqueakvm.plugins.ruby.language import W_RubyLanguage + from rsqueakvm.plugins.ruby.patching import patch_topaz + from rsqueakvm.plugins.ruby.utils import ruby_to_smalltalk + IMPORT_FAILED = False +except ImportError as e: + IMPORT_FAILED = True -ruby_space = ObjectSpace(None) +class RubyPlugin(ForeignLanguagePlugin): + language_name = 'Ruby' -w_ruby_resume_method = QuasiConstant(None, type=W_CompiledMethod) -w_ruby_class = QuasiConstant(None, type=W_PointersObject) -w_ruby_object_class = QuasiConstant(None, type=W_PointersObject) -w_ruby_plugin_send = QuasiConstant(None, type=W_PointersObject) + def is_optional(self): + return True + + def is_enabled(self): + if IMPORT_FAILED: + return False + return ForeignLanguagePlugin.is_enabled(self) + + def setup(self): + system.translationconfig.set(thread=True) + system.translationconfig.set(continuation=True) + patch_topaz() + + @staticmethod + def startup(space, argv): + ForeignLanguagePlugin.load_special_objects( + space, RubyPlugin.language_name, + W_RubyLanguage, RubyClassShadow) + + @staticmethod + def new_w_language(space, args_w): + if len(args_w) != 2: + raise PrimitiveFailedError + source = space.unwrap_string(args_w[0]) + break_on_exceptions = args_w[1] is space.w_true + return W_RubyLanguage(source, break_on_exceptions) + + @staticmethod + def w_object_class(): + return W_RubyObject + + @staticmethod + def to_w_object(space, foreign_object): + return ruby_to_smalltalk(space, foreign_object.wr_object) diff --git a/rsqueakvm/plugins/ruby/language.py b/rsqueakvm/plugins/ruby/language.py index 365196b8..b2e015e8 100644 --- a/rsqueakvm/plugins/ruby/language.py +++ b/rsqueakvm/plugins/ruby/language.py @@ -1,7 +1,6 @@ from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage -from rsqueakvm.plugins.ruby import ( - ruby_space, w_ruby_class, w_ruby_resume_method) from rsqueakvm.plugins.ruby.model import W_RubyObject +from rsqueakvm.plugins.ruby.objspace import ruby_space from topaz.error import RubyError @@ -21,10 +20,6 @@ def run(self): self.set_result(retval) except RubyError as e: self.set_result(e.w_value) - except Exception as e: - print 'Unknown error in Ruby thread: %s' % e - finally: - self.mark_done() def set_current(self): ec = ruby_space.getexecutioncontext() @@ -35,9 +30,3 @@ def set_result(self, wr_result): def set_error(self, wr_error): self.w_error = W_RubyObject(wr_error) - - def resume_class(self): - return w_ruby_class.get() - - def resume_method(self): - return w_ruby_resume_method.get() diff --git a/rsqueakvm/plugins/ruby/model.py b/rsqueakvm/plugins/ruby/model.py index b2fe60b3..15092eff 100644 --- a/rsqueakvm/plugins/ruby/model.py +++ b/rsqueakvm/plugins/ruby/model.py @@ -1,14 +1,8 @@ -from rsqueakvm.plugins import ruby from rsqueakvm.plugins.foreign_language.model import ( W_ForeignLanguageObject, ForeignLanguageClassShadow) -from rsqueakvm.plugins.ruby import ruby_space -from rsqueakvm.primitives.constants import EXTERNAL_CALL -from rsqueakvm.model.compiled_methods import ( - W_PreSpurCompiledMethod, W_SpurCompiledMethod) -from rsqueakvm.storage import AbstractCachingShadow - -from rpython.rlib import objectmodel, jit +from rsqueakvm.plugins.ruby.objspace import ruby_space +from rpython.rlib import jit RubyClassShadowCache = {} @@ -49,33 +43,12 @@ class RubyClassShadow(ForeignLanguageClassShadow): def __init__(self, space, wr_class): self.wr_class = wr_class self.name = wr_class.name - AbstractCachingShadow.__init__( - self, space, space.w_nil, 0, space.w_nil) - - def fallback_class(self): - return ruby.w_ruby_object_class.get() + ForeignLanguageClassShadow.__init__(self, space) - def make_method(self, w_selector): + def method_exists(self, w_selector): methodname = self.space.unwrap_string(w_selector) idx = methodname.find(':') if idx > 0: methodname = methodname[0:idx] ruby_method = self.wr_class.find_method(ruby_space, methodname) - if ruby_method is None: - return None - if self.space.is_spur.is_set(): - w_cm = objectmodel.instantiate(W_SpurCompiledMethod) - else: - w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_cm.header = 0 - w_cm._primitive = EXTERNAL_CALL - w_cm.literalsize = 2 - w_cm.islarge = False - w_cm._tempsize = 0 - w_cm.argsize = 0 - w_cm.bytes = [] - w_cm.literals = [ - ruby.w_ruby_plugin_send.get(), - w_selector - ] - return w_cm + return ruby_method is not None diff --git a/rsqueakvm/plugins/ruby/objspace.py b/rsqueakvm/plugins/ruby/objspace.py new file mode 100644 index 00000000..7dc98bd5 --- /dev/null +++ b/rsqueakvm/plugins/ruby/objspace.py @@ -0,0 +1,3 @@ +from topaz.objspace import ObjectSpace + +ruby_space = ObjectSpace(None) diff --git a/rsqueakvm/plugins/ruby/utils.py b/rsqueakvm/plugins/ruby/utils.py index 2190f0ba..99270d42 100644 --- a/rsqueakvm/plugins/ruby/utils.py +++ b/rsqueakvm/plugins/ruby/utils.py @@ -1,7 +1,7 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger -from rsqueakvm.plugins.ruby import ruby_space from rsqueakvm.plugins.ruby.model import W_RubyObject +from rsqueakvm.plugins.ruby.objspace import ruby_space from rsqueakvm.model.variable import W_BytesObject from topaz.objects.floatobject import W_FloatObject as WR_FloatObject diff --git a/rsqueakvm/plugins/ruby_plugin.py b/rsqueakvm/plugins/ruby_plugin.py index b18d0fc2..0508c619 100644 --- a/rsqueakvm/plugins/ruby_plugin.py +++ b/rsqueakvm/plugins/ruby_plugin.py @@ -1,12 +1,13 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.variable import W_BytesObject -from rsqueakvm.plugins.ruby.plugin import RubyPlugin +from rsqueakvm.plugins.ruby import RubyPlugin from rpython.rlib import jit try: - from rsqueakvm.plugins.ruby import ruby_space, utils from rsqueakvm.plugins.ruby.model import W_RubyObject + from rsqueakvm.plugins.ruby.objspace import ruby_space + from rsqueakvm.plugins.ruby.utils import smalltalk_to_ruby from topaz.error import RubyError, print_traceback except ImportError: @@ -32,8 +33,8 @@ def send(interp, s_frame, argcount, w_method): # import pdb; pdb.set_trace() space = interp.space args_w = s_frame.peek_n(argcount) - args_rw = [utils.smalltalk_to_ruby(space, w_arg) for w_arg in args_w] - wr_rcvr = utils.smalltalk_to_ruby(space, s_frame.peek(argcount)) + args_rw = [smalltalk_to_ruby(space, w_arg) for w_arg in args_w] + wr_rcvr = smalltalk_to_ruby(space, s_frame.peek(argcount)) w_selector_name = w_method.literalat0(space, 2) if not isinstance(w_selector_name, W_BytesObject): print 'w_selector_name not an instance of W_BytesObject' diff --git a/rsqueakvm/test/plugins/python/test_end_to_end.py b/rsqueakvm/test/plugins/python/test_end_to_end.py index 7ffeb2e8..52ee1b7d 100644 --- a/rsqueakvm/test/plugins/python/test_end_to_end.py +++ b/rsqueakvm/test/plugins/python/test_end_to_end.py @@ -1,10 +1,10 @@ from rsqueakvm.model.base import W_Object from rsqueakvm.model.numeric import W_SmallInteger from rsqueakvm.model.pointers import W_PointersObject -from rsqueakvm.plugins.python import py_space +from rsqueakvm.plugins.python import PythonPlugin from rsqueakvm.plugins.python.model import W_PythonObject +from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.plugins.python.patching import patch_pypy -from rsqueakvm.plugins.python.plugin import PythonPlugin from rsqueakvm.test.util import create_space, cleanup_module, read_image diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 04e6d6d8..7685d0cd 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -1,4 +1,4 @@ -from rsqueakvm.plugins.python import py_space +from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.plugins.python.patching import patch_pypy from pypy.interpreter.error import OperationError From 44b0b79a514ffe7908429c67aee47c432b3bcd99 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 13 Mar 2017 01:19:18 +0100 Subject: [PATCH 124/193] Re-enable _minimal_curses Problem has been fixed in Pypy: https://bitbucket.org/pypy/pypy/commits/46167d4097c8 --- rsqueakvm/plugins/python/objspace.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rsqueakvm/plugins/python/objspace.py b/rsqueakvm/plugins/python/objspace.py index 2f5554eb..4c943474 100644 --- a/rsqueakvm/plugins/python/objspace.py +++ b/rsqueakvm/plugins/python/objspace.py @@ -20,10 +20,6 @@ def new_pypy_objspace(): pypy_config.objspace.usemodules.micronumpy = False pypy_config.objspace.usemodules.cppyy = False - # avoid macro problems with curses and SDL2 - # TODO(fniephaus): should be reenabled for pyrepl support - pypy_config.objspace.usemodules._minimal_curses = False - # cpyext causes a lot of 'Undefined symbols for architecture x86_64' errors pypy_config.objspace.usemodules.cpyext = False From a9466a727388e49a908bc7350fb73c4010ea1bfe Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 13 Mar 2017 14:32:55 +0100 Subject: [PATCH 125/193] Use metaclasses to add QuasiConstants --- .travis.yml | 4 +++ .../plugins/foreign_language/language.py | 32 +++++++++++++------ rsqueakvm/plugins/foreign_language/model.py | 20 +++++++++--- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 38ebc259..ea2da772 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,6 +50,10 @@ matrix: osx_image: xcode7.3 language: cpp env: BUILD_ARCH=64bit PLUGINS=RubyPlugin + - os: osx + osx_image: xcode7.3 + language: cpp + env: BUILD_ARCH=64bit PLUGINS=PythonPluginRubyPlugin # allow_failures: # - env: BUILD_ARCH=64bit PLUGINS=DatabasePlugin # - env: BUILD_ARCH=64bit PLUGINS=RubyPlugin diff --git a/rsqueakvm/plugins/foreign_language/language.py b/rsqueakvm/plugins/foreign_language/language.py index b9264fc8..3c12821c 100644 --- a/rsqueakvm/plugins/foreign_language/language.py +++ b/rsqueakvm/plugins/foreign_language/language.py @@ -14,14 +14,34 @@ ExecutionContext.current_language = None +class ForeignLanguageMeta(type): + def __new__(cls, name, bases, attrs): + # import pdb; pdb.set_trace() + + if name != 'W_ForeignLanguage': + w_foreign_class = QuasiConstant(None, cls=W_PointersObject) + w_foreign_resume = QuasiConstant(None, cls=W_PointersObject) + + def foreign_class(self): + return w_foreign_class.get() + + def resume_method(self): + return w_foreign_resume.get() + + attrs['w_foreign_class'] = w_foreign_class + attrs['w_foreign_resume'] = w_foreign_resume + attrs['foreign_class'] = foreign_class + attrs['resume_method'] = resume_method + + return type.__new__(cls, name, bases, attrs) + + class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): + __metaclass__ = ForeignLanguageMeta _attrs_ = [ '_runner', '_done', 'w_result', 'w_error', '_break_on_exceptions'] repr_classname = 'W_ForeignLanguage' - w_foreign_class = QuasiConstant(None, type=W_PointersObject) - w_foreign_resume = QuasiConstant(None, type=W_PointersObject) - def __init__(self, break_on_exceptions=True): W_AbstractObjectWithIdentityHash.__init__(self) self._done = False @@ -94,12 +114,6 @@ def run_safe(self): finally: self._done = True - def foreign_class(self): - return self.w_foreign_class.get() - - def resume_method(self): - return self.w_foreign_resume.get() - def start(self): self.runner().start() diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py index ea382093..0d4a16ec 100644 --- a/rsqueakvm/plugins/foreign_language/model.py +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -8,6 +8,7 @@ from rsqueakvm.util.cells import QuasiConstant from rpython.rlib import objectmodel +from rpython.rlib.rstrategies.rstrategies import StrategyMetaclass class W_ForeignLanguageObject(W_AbstractObjectWithIdentityHash): @@ -41,13 +42,22 @@ def is_same_object(self, other): raise NotImplementedError +class ForeignLanguageClassShadowMeta(StrategyMetaclass): + def __new__(cls, name, bases, attrs): + # import pdb; pdb.set_trace() + if name != 'ForeignLanguageClassShadow': + attrs['w_plugin_send'] = QuasiConstant(None, cls=W_PointersObject) + attrs['w_foreign_class'] = QuasiConstant( + None, cls=W_PointersObject) + attrs['w_foreign_object_class'] = QuasiConstant( + None, cls=W_PointersObject) + + return type.__new__(cls, name, bases, attrs) + + class ForeignLanguageClassShadow(ClassShadow): + __metaclass__ = ForeignLanguageClassShadowMeta _attrs_ = [] - _immutable_fields_ = [] - - w_plugin_send = QuasiConstant(None, type=W_PointersObject) - w_foreign_class = QuasiConstant(None, type=W_PointersObject) - w_foreign_object_class = QuasiConstant(None, type=W_PointersObject) def __init__(self, space): AbstractCachingShadow.__init__( From ad09c8a292772658cf498247ff3f702e66ec6537 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 13 Mar 2017 14:33:28 +0100 Subject: [PATCH 126/193] Remove redundant file --- rsqueakvm/plugins/ruby/plugin.py | 66 -------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 rsqueakvm/plugins/ruby/plugin.py diff --git a/rsqueakvm/plugins/ruby/plugin.py b/rsqueakvm/plugins/ruby/plugin.py deleted file mode 100644 index 47b6c50a..00000000 --- a/rsqueakvm/plugins/ruby/plugin.py +++ /dev/null @@ -1,66 +0,0 @@ -from rsqueakvm.error import Exit, PrimitiveFailedError -from rsqueakvm.plugins.foreign_language.plugin import ForeignLanguagePlugin -from rsqueakvm.util import system - -try: - from rsqueakvm.plugins import ruby - from rsqueakvm.plugins.ruby.model import W_RubyObject - from rsqueakvm.plugins.ruby.language import W_RubyLanguage - from rsqueakvm.plugins.ruby.patching import patch_topaz - from rsqueakvm.plugins.ruby.utils import ruby_to_smalltalk -except ImportError: - pass - - -class RubyPlugin(ForeignLanguagePlugin): - def is_optional(self): - return True - - def setup(self): - system.translationconfig.set(thread=True) - system.translationconfig.set(continuation=True) - patch_topaz() - - @staticmethod - def startup(space, argv): - ForeignLanguagePlugin.startup(space, argv) - - ruby.w_ruby_plugin_send.set(space.wrap_list_unroll_safe([ - space.wrap_string('RubyPlugin'), - space.wrap_string('send') - ])) - - ruby_class = space.smalltalk_at('Ruby') - if ruby_class is None: - # disable plugin? - raise Exit('Ruby class not found.') - ruby.w_ruby_class.set(ruby_class) - - ruby_object_class = space.smalltalk_at('RubyObject') - if ruby_object_class is None: - raise Exit('RubyObject class not found.') - ruby.w_ruby_object_class.set(ruby_object_class) - - resume_method_symbol = space.wrap_symbol('resume:') - ruby_cls_cls_s = ruby_class.getclass( - space).as_class_get_shadow(space) - resume_method = ruby_cls_cls_s.lookup(resume_method_symbol) - if resume_method is None: - raise Exit('Ruby class>>resume: method not found.') - ruby.w_ruby_resume_method.set(resume_method) - - @staticmethod - def new_w_language(space, args_w): - if len(args_w) != 2: - raise PrimitiveFailedError - source = space.unwrap_string(args_w[0]) - break_on_exceptions = args_w[1] is space.w_true - return W_RubyLanguage(source, break_on_exceptions) - - @staticmethod - def w_object_class(): - return W_RubyObject - - @staticmethod - def to_w_object(space, foreign_object): - return ruby_to_smalltalk(space, foreign_object.wr_object) From a44a7962d0e132611a66c40ad1f3addd529c87db Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 13 Mar 2017 14:33:42 +0100 Subject: [PATCH 127/193] Fix send primitive in RubyPlugin --- rsqueakvm/plugins/ruby_plugin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rsqueakvm/plugins/ruby_plugin.py b/rsqueakvm/plugins/ruby_plugin.py index 0508c619..9371f3d2 100644 --- a/rsqueakvm/plugins/ruby_plugin.py +++ b/rsqueakvm/plugins/ruby_plugin.py @@ -46,6 +46,7 @@ def send(interp, s_frame, argcount, w_method): try: wr_result = ruby_space.send(wr_rcvr, methodname, args_w=args_rw) + s_frame.pop_n(argcount + 1) return W_RubyObject(wr_result) except RubyError as e: print_traceback(ruby_space, e.w_value) From 016645921d1c25775497d68b6b9dc12567c69d0f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 13 Mar 2017 19:51:30 +0100 Subject: [PATCH 128/193] Improve s_class caching; allow specific s_classes Also, change method lookup, so that it starts on Smalltalk side, and add an underscore fallback (e.g. to allow `inspect` via `_inspect` in Ruby). --- .../plugins/foreign_language/__init__.py | 7 +++ rsqueakvm/plugins/foreign_language/model.py | 53 +++++++++++++++++-- rsqueakvm/plugins/python/model.py | 18 +++---- rsqueakvm/plugins/ruby/model.py | 18 ++----- 4 files changed, 67 insertions(+), 29 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 4ac05865..c435c0aa 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -1,5 +1,6 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage +from rsqueakvm.plugins.foreign_language.model import W_ForeignLanguageObject from rsqueakvm.plugins.plugin import Plugin @@ -69,3 +70,9 @@ def asSmalltalk(interp, s_frame, w_rcvr): if not isinstance(w_rcvr, self.w_object_class()): raise PrimitiveFailedError return self.to_w_object(interp.space, w_rcvr) + + @self.expose_primitive(unwrap_spec=[object, object]) + def registerSpecificClass(interp, s_frame, w_rcvr, language_obj): + if not isinstance(language_obj, W_ForeignLanguageObject): + raise PrimitiveFailedError + language_obj.class_shadow(interp.space).set_specific_class(w_rcvr) diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py index 0d4a16ec..32ad8c8a 100644 --- a/rsqueakvm/plugins/foreign_language/model.py +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -7,11 +7,30 @@ from rsqueakvm.storage_classes import AbstractCachingShadow, ClassShadow from rsqueakvm.util.cells import QuasiConstant -from rpython.rlib import objectmodel +from rpython.rlib import jit, objectmodel from rpython.rlib.rstrategies.rstrategies import StrategyMetaclass +class W_ForeignLanguageObjectMeta(type): + def __new__(cls, name, bases, attrs): + # import pdb; pdb.set_trace() + if name != 'W_ForeignLanguageObject': + class_shadow_cache = {} + + @jit.elidable + def pure_class_shadow(self, space): + wf_class = self.getforeignclass(space) + shadow = self.make_class_shadow(space) + return class_shadow_cache.setdefault(wf_class, shadow) + + attrs['class_shadow_cache'] = class_shadow_cache + attrs['pure_class_shadow'] = pure_class_shadow + + return type.__new__(cls, name, bases, attrs) + + class W_ForeignLanguageObject(W_AbstractObjectWithIdentityHash): + __metaclass__ = W_ForeignLanguageObjectMeta _attrs_ = [] _immutable_fields_ = [] repr_classname = 'W_ForeignLanguageObject' @@ -35,12 +54,18 @@ def store(self, space, n0, w_value): def getclass(self, space): raise NotImplementedError - def class_shadow(self, space): + def getforeignclass(self, space): raise NotImplementedError + def class_shadow(self, space): + return self.pure_class_shadow(space) + def is_same_object(self, other): raise NotImplementedError + def make_class_shadow(self, space): + raise NotImplementedError + class ForeignLanguageClassShadowMeta(StrategyMetaclass): def __new__(cls, name, bases, attrs): @@ -57,11 +82,13 @@ def __new__(cls, name, bases, attrs): class ForeignLanguageClassShadow(ClassShadow): __metaclass__ = ForeignLanguageClassShadowMeta - _attrs_ = [] + _attrs_ = ['w_specific_class'] + _immutable_fields_ = ['w_specific_class?'] def __init__(self, space): AbstractCachingShadow.__init__( self, space, space.w_nil, 0, space.w_nil) + self.w_specific_class = None @staticmethod def load_special_objects(cls, language_name, space): @@ -87,10 +114,23 @@ def changed(self): pass # Changes to foreign classes are not handled in Smalltalk def lookup(self, w_selector): + if self.w_specific_class: + lookup_cls = self.w_specific_class + else: + lookup_cls = self.w_foreign_object_class.get() + w_cm = lookup_cls.as_class_get_shadow(self.space).lookup(w_selector) + if w_cm is not None: + return w_cm if self.method_exists(w_selector): return self.make_method(w_selector) - return self.w_foreign_object_class.get().as_class_get_shadow( - self.space).lookup(w_selector) + # try underscore fallback + methodname = w_selector.unwrap_string(self.space) + if len(methodname) > 1 and methodname[0] == '_': + w_fallback_selector = self.space.wrap_symbol(methodname[1:]) + if self.method_exists(w_fallback_selector): + return self.make_method(w_fallback_selector) + + return None # triggers a MNU # Abstract methods @@ -98,6 +138,9 @@ def method_exists(self, w_selector): raise NotImplementedError # Helpers + def set_specific_class(self, w_class): + self.w_specific_class = w_class + def make_method(self, w_selector): if self.space.is_spur.is_set(): w_cm = objectmodel.instantiate(W_SpurCompiledMethod) diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index deefe7a1..6c516768 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -13,33 +13,29 @@ class W_PythonObject(W_ForeignLanguageObject): def __init__(self, wp_object): W_ForeignLanguageObject.__init__(self) self.wp_object = wp_object - # self.w_pyID = None self.s_class = None def getclass(self, space): return W_PythonObject(self.wp_object.getclass(py_space)) - def class_shadow(self, space): - return PythonClassShadow(space, self.wp_object) - - # @staticmethod - # @jit.elidable - # def pure_class_shadow(space, wp_class): - # return PythonClassShadowCache.setdefault( - # wp_class, PythonClassShadow(space, wp_class)) + def getforeignclass(self, space): + return py_space.type(self.wp_object) def is_same_object(self, other): return (isinstance(other, W_PythonObject) and other.wp_object is self.wp_object) + def make_class_shadow(self, space): + return PythonClassShadow( + space, self.getforeignclass(space), self.wp_object) + class PythonClassShadow(ForeignLanguageClassShadow): _attrs_ = ['wp_object', 'wp_class'] _immutable_fields_ = ['wp_class'] - def __init__(self, space, wp_object): + def __init__(self, space, wp_class, wp_object): self.wp_object = wp_object - wp_class = py_space.type(self.wp_object) self.wp_class = wp_class self.name = wp_class.name ForeignLanguageClassShadow.__init__(self, space) diff --git a/rsqueakvm/plugins/ruby/model.py b/rsqueakvm/plugins/ruby/model.py index 15092eff..85b29cd0 100644 --- a/rsqueakvm/plugins/ruby/model.py +++ b/rsqueakvm/plugins/ruby/model.py @@ -2,10 +2,6 @@ W_ForeignLanguageObject, ForeignLanguageClassShadow) from rsqueakvm.plugins.ruby.objspace import ruby_space -from rpython.rlib import jit - -RubyClassShadowCache = {} - class W_RubyObject(W_ForeignLanguageObject): _attrs_ = ['wr_object', 's_class'] @@ -21,20 +17,16 @@ def __init__(self, wr_object): def getclass(self, space): return W_RubyObject(self.wr_object.getclass(ruby_space)) - def class_shadow(self, space): - wr_class = ruby_space.getclass(self.wr_object) - return W_RubyObject.pure_class_shadow(space, wr_class) - - @staticmethod - @jit.elidable - def pure_class_shadow(space, wr_class): - return RubyClassShadowCache.setdefault( - wr_class, RubyClassShadow(space, wr_class)) + def getforeignclass(self, space): + return ruby_space.getclass(self.wr_object) def is_same_object(self, other): return (isinstance(other, W_RubyObject) and other.wr_object is self.wr_object) + def make_class_shadow(self, space): + return RubyClassShadow(space, self.getforeignclass(space)) + class RubyClassShadow(ForeignLanguageClassShadow): _attrs_ = ['wr_class'] From b55fbf6d4b75c43893933ad813f9cc0385f88e5b Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 14 Mar 2017 16:31:15 +0100 Subject: [PATCH 129/193] Set up ruby_space; add W_ArrayObject conversion --- rsqueakvm/plugins/python/model.py | 2 +- rsqueakvm/plugins/ruby/__init__.py | 4 +++- rsqueakvm/plugins/ruby/utils.py | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 6c516768..97aaaba7 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -35,8 +35,8 @@ class PythonClassShadow(ForeignLanguageClassShadow): _immutable_fields_ = ['wp_class'] def __init__(self, space, wp_class, wp_object): - self.wp_object = wp_object self.wp_class = wp_class + self.wp_object = wp_object self.name = wp_class.name ForeignLanguageClassShadow.__init__(self, space) diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 49ca31cf..d2d51c0b 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -3,8 +3,9 @@ from rsqueakvm.util import system try: - from rsqueakvm.plugins.ruby.model import W_RubyObject, RubyClassShadow from rsqueakvm.plugins.ruby.language import W_RubyLanguage + from rsqueakvm.plugins.ruby.model import W_RubyObject, RubyClassShadow + from rsqueakvm.plugins.ruby.objspace import ruby_space from rsqueakvm.plugins.ruby.patching import patch_topaz from rsqueakvm.plugins.ruby.utils import ruby_to_smalltalk IMPORT_FAILED = False @@ -33,6 +34,7 @@ def startup(space, argv): ForeignLanguagePlugin.load_special_objects( space, RubyPlugin.language_name, W_RubyLanguage, RubyClassShadow) + ruby_space.setup(argv[0]) @staticmethod def new_w_language(space, args_w): diff --git a/rsqueakvm/plugins/ruby/utils.py b/rsqueakvm/plugins/ruby/utils.py index 99270d42..3540f992 100644 --- a/rsqueakvm/plugins/ruby/utils.py +++ b/rsqueakvm/plugins/ruby/utils.py @@ -4,6 +4,7 @@ from rsqueakvm.plugins.ruby.objspace import ruby_space from rsqueakvm.model.variable import W_BytesObject +from topaz.objects.arrayobject import W_ArrayObject as WR_ArrayObject from topaz.objects.floatobject import W_FloatObject as WR_FloatObject from topaz.objects.intobject import W_FixnumObject as WR_FixnumObject from topaz.objects.stringobject import W_StringObject as WR_StringObject @@ -30,6 +31,10 @@ def ruby_to_smalltalk(space, wr_object): return space.w_true elif isinstance(wr_object, WR_SymbolObject): return space.wrap_symbol(ruby_space.str_w(wr_object)) + elif isinstance(wr_object, WR_ArrayObject): + return space.wrap_list( + [ruby_to_smalltalk(space, x) for x in + wr_object.listview(ruby_space)]) print 'Cannot convert %s to Smalltalk' % wr_object raise PrimitiveFailedError From 6d63b44384e17d55955b11116ed3864ac0799daf Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 15 Mar 2017 10:29:07 +0100 Subject: [PATCH 130/193] Update in-image code This adds ForeignLanguage packages which are abstractions from the initial Python packages. The Python packages have been reworked, so that they are based on this abstractions. New Ruby packages, which are also based on the abstractions, have been added. [ci skip] --- .../.filetree | 0 .../ForeignLanguage.class/README.md | 0 .../class/availableLanguages.st | 5 ++ .../ForeignLanguage.class/class/highlight..st | 3 ++ .../class/sourceCodeTemplate.st | 3 ++ .../class/styleInBackgroundProcess..st | 3 ++ .../class/stylerFormat..st} | 6 +-- .../class/vmSpeaksLanguage.st | 3 ++ .../methodProperties.json | 10 ++++ .../ForeignLanguage.class/properties.json | 2 +- .../ForeignLanguageException.class/README.md | 0 .../instance/action..st | 0 .../instance/action.st | 0 .../instance/defaultAction.st | 0 .../methodProperties.json | 0 .../properties.json | 2 +- .../ForeignLanguageObject.class}/README.md | 0 .../instance/allInstVarNames.st | 3 ++ .../instance/asSmalltalk.st | 3 ++ .../instance/class.st | 3 ++ .../instance/className.st | 3 ++ .../instance/defaultLabelForInspector.st | 3 ++ .../instance/defaultTitleForInspector.st | 3 ++ .../instance/environment.st | 0 .../instance/explore.st | 3 ++ .../instance/inspect.st | 4 +- .../instance/inspectorClass.st | 3 ++ .../instance/instVarAt..st | 3 ++ .../instance/instVarNamed..st | 3 ++ .../instance/isForeign.st | 3 ++ .../instance/languageSymbol.st | 3 ++ .../instance/printOn..st | 3 ++ .../methodProperties.json | 19 +++++++ .../properties.json | 14 +++++ .../Object.extension/instance/isForeign.st | 3 ++ .../Object.extension/methodProperties.json | 5 ++ .../Object.extension/properties.json | 2 + .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../monticello.meta/package | 1 + .../monticello.meta/version | 1 + .../properties.json | 0 .../.filetree | 0 .../README.md | 0 .../instance/foreignFrame..st | 4 ++ .../instance/foreignFrame.st | 4 ++ .../instance/isForeign.st} | 2 +- .../instance/languageSymbol.st | 3 ++ .../instance/printOn..st | 10 ++-- .../instance/sender..st | 0 .../setSender.receiver.method.arguments..st | 2 +- .../instance/tempNames.st | 4 +- .../methodProperties.json | 12 +++++ .../properties.json | 6 +-- .../README.md | 0 .../class/highlightPython..st} | 2 +- .../class/highlightRuby..st | 8 +++ .../class/highlightSmalltalk..st | 0 .../instance/isForeign.st | 3 ++ .../instance/languageSymbol..st | 3 ++ .../instance/languageSymbol.st | 3 ++ .../instance/privateFormat..st | 6 +++ .../instance/style..st | 6 +++ .../instance/style.foreignClass..st | 9 ++++ .../instance/styleInBackgroundProcess..st | 6 +++ .../methodProperties.json | 13 +++++ .../properties.json | 6 +-- .../ForeignLanguageToolSet.class}/README.md | 0 .../class/browse.selector..st | 3 ++ .../class/browseClass..st | 3 ++ .../class/browseClass.category..st | 5 ++ .../class/browseMessageCategory.inClass..st | 4 ++ .../debug.context.label.contents.fullView..st | 4 +- .../class/debugContext.label.contents..st | 4 +- .../class/explore..st | 4 ++ .../class/initialize.st | 2 +- .../class/inspectorClassOf..st | 4 ++ .../class/interrupt.label..st | 8 +-- .../class/menuItems.st | 6 +-- .../class/openClassBrowser.st | 3 ++ .../class/openForeignLanguageBrowser.st | 3 ++ .../class/openForeignLanguageWorkspace.st | 3 ++ .../methodProperties.json | 18 +++++++ .../properties.json | 4 +- .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../monticello.meta/package | 1 + .../monticello.meta/version | 1 + .../properties.json | 0 .../ForeignLanguage-Tools.package/.filetree | 4 ++ .../ForeignLanguageBrowser.class}/README.md | 0 .../instance/aboutToStyle..st | 2 +- .../instance/addModelItemsToWindowMenu..st | 12 +++++ .../instance/buildCodePaneWith..st | 2 +- .../instance/currentLanguageSymbol.st | 5 ++ .../instance/defaultBrowserTitle.st | 2 +- .../instance/defaultStylerClass.st | 2 +- .../instance/defineMessageFrom.notifying..st | 0 .../instance/doItReceiver.st | 0 .../instance/isForeign.st | 3 ++ .../instance/isPython.st} | 2 +- .../instance/isRuby.st | 4 ++ .../instance/isSmalltalk.st | 3 ++ .../instance/labelString.st | 3 ++ .../instance/languageSymbol..st | 3 ++ .../instance/languageSymbol.st | 3 ++ .../instance/selectLanguage..st | 5 ++ .../instance/selectedMessage.st | 0 .../instance/systemCategoryList.st | 6 +++ ...idateMessageSource.forSelector.inClass..st | 2 +- .../methodProperties.json | 23 ++++++++ .../properties.json | 6 +-- .../README.md | 0 .../instance/selection.st | 4 +- .../methodProperties.json | 5 ++ .../properties.json | 4 +- .../ForeignLanguageDebugger.class}/README.md | 0 .../class/exploreFrames.st | 0 .../class/filterPySource.lineno..st | 0 .../class/getContentsOf..st | 0 .../class/getPySource..st | 6 +-- .../class/getSignature..st | 0 .../class/indent.by..st | 0 .../class/indentSize..st | 0 .../class/newForeignContext..st | 10 ++++ .../class/prependPythonContexts..st | 6 +-- .../replaceInPySource.content.lineno..st | 0 .../class/scopeEndIn.startingAt..st | 0 .../class/setPySourceContent.content..st | 0 .../instance/aboutToStyle..st | 4 +- .../instance/buildCodePaneWith..st | 2 +- .../instance/contents.notifying..st | 4 +- .../instance/contextForStack..st | 0 .../instance/defaultStylerClass.st | 2 +- .../instance/expandStack.st | 4 +- .../instance/guessTypeForName..st | 4 ++ .../instance/isPython.st | 3 ++ .../instance/isRuby.st | 3 ++ .../instance/languageSymbol.st | 5 ++ .../instance/messageIconAt..st | 4 +- .../instance/pcRange.st | 2 +- .../instance/process.controller.context..st | 0 .../instance/pyPCRange.st | 2 +- .../instance/selectedMessage.st | 2 +- .../methodProperties.json | 30 +++++++++++ .../properties.json | 4 +- .../ForeignLanguageInspector.class}/README.md | 0 .../instance/aboutToStyle..st | 2 +- .../instance/buildCodePaneWith..st | 2 +- .../instance/contentsIsString.st | 0 .../instance/fieldList.st | 2 +- .../instance/selection.st | 6 +-- .../methodProperties.json | 9 ++++ .../properties.json | 4 +- .../README.md | 0 .../instance/aboutToStyle..st | 2 +- .../instance/buildWith..st | 2 +- .../methodProperties.json | 6 +++ .../properties.json | 4 +- .../ForeignLanguageWorkspace.class}/README.md | 0 .../class/open.st | 3 ++ .../class/windowTitlePrefix.st | 3 ++ .../instance/aboutToStyle..st | 2 +- .../instance/addModelItemsToWindowMenu..st | 12 +++++ .../instance/buildCodePaneWith..st | 2 +- .../instance/evaluateExpression..st | 6 +++ .../instance/isForeign.st | 3 ++ .../instance/labelString.st | 4 ++ .../instance/languageSymbol..st | 3 ++ .../instance/languageSymbol.st | 3 ++ .../instance/selectLanguage..st | 4 ++ .../methodProperties.json | 14 +++++ .../properties.json | 6 +-- .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../monticello.meta/package | 1 + .../monticello.meta/version | 1 + .../properties.json | 2 + .../Python.class/class/breakOnExceptions..st | 3 ++ .../Python.class/class/breakOnExceptions.st | 3 ++ .../Python.class/class/checkForException..st | 7 +++ .../Python.class/class/eval..st | 2 +- .../class/eval.breakOnExceptions..st | 7 +++ .../Python.class/class/evaluateExpression..st | 4 ++ .../Python.class/class/exec..st | 2 +- .../class/exec.breakOnExceptions..st | 7 +++ .../Python.class/class/getSource..st | 3 -- .../Python.class/class/highlight..st | 3 ++ .../Python.class/class/import..st | 2 +- .../class/import.breakOnExceptions..st | 3 ++ .../Python.class/class/load..st | 3 +- .../class/load.breakOnExceptions..st | 4 ++ .../class/openDebuggerWithPythonFrames..st | 4 +- .../Python.class/class/peval..st | 6 ++- .../Python.class/class/pexec..st | 6 ++- .../class/primBreakOnExceptions..st | 4 -- .../class/primBreakOnExceptions.st | 4 -- .../class/primEval.filename.cmd..st | 4 -- ...imEval.filename.cmd.breakOnExceptions..st} | 2 +- .../Python.class/class/primGetTopFrame.st | 3 +- .../{primLastError.st => primLastError..st} | 2 +- .../Python.class/class/primPythonAt..st | 4 -- .../Python.class/class/primResume..st | 2 +- .../Python.class/class/pyInspect.st | 3 -- .../Python.class/class/pygments.st | 2 +- .../Python.class/class/re.st | 3 ++ .../Python.class/class/resume..st | 12 ++--- .../Python.class/class/setUpPygments.st | 34 ++++++------ .../class/setUpPythonEnvironment.st | 2 + .../Python.class/class/single..st | 6 ++- .../Python.class/class/sourceCodeTemplate.st | 5 ++ .../Python.class/class/startUp..st | 2 +- .../Python.class/class/sys.st | 3 ++ ...{vmSpeaksPython.st => vmSpeaksLanguage.st} | 2 +- .../Python.class/methodProperties.json | 54 ++++++++++--------- .../Python.class/properties.json | 3 +- .../PythonCompiler.class/class/parserClass.st | 2 +- .../instance/compile.in.notifying.ifFail..st | 2 +- .../methodProperties.json | 4 +- .../PythonObject.class/class/allInstances.st | 3 +- .../PythonObject.class/class/new.st | 2 +- .../class/pythonize.instVars.clsVars..st | 2 +- ...ariableNames.poolDictionaries.category..st | 2 +- .../class/toolIconSelector..st | 2 +- .../instance/allInstVarNames.st | 2 +- .../instance/defaultLabelForInspector.st | 5 -- .../instance/defaultTitleForInspector.st | 4 ++ .../PythonObject.class/instance/explore.st | 3 -- .../instance/explorerContents.st | 2 +- .../instance/hasContentsInExplorer.st | 2 +- .../instance/inspectorClass.st | 3 -- .../instance/instVarNamed..st | 3 ++ .../PythonObject.class/instance/isKindOf..st | 2 +- .../PythonObject.class/instance/isNone.st | 2 +- .../instance/languageSymbol.st | 3 ++ .../PythonObject.class/instance/notNone.st | 2 +- .../instance/variablesAndOffsetsDo..st | 7 --- .../PythonObject.class/methodProperties.json | 26 +++++---- .../PythonObject.class/properties.json | 2 +- .../PythonTheme.class/README.md | 0 .../PythonTheme.class/class/addButtons..st | 0 .../PythonTheme.class/class/addDialogs..st | 0 .../PythonTheme.class/class/addFonts..st | 0 .../class/addMenusAndDockingBars..st | 0 .../class/addScrollables..st | 2 +- .../class/addSyntaxHighlighting..st | 0 .../PythonTheme.class/class/addToolColors..st | 0 .../class/addWindowColors..st | 0 .../PythonTheme.class/class/argumentColor.st | 0 .../class/backgroundColor.st | 0 .../PythonTheme.class/class/backgroundForm.st | 0 .../PythonTheme.class/class/blue.st | 0 .../class/builtinConstColor.st | 0 .../PythonTheme.class/class/commentColor.st | 0 .../PythonTheme.class/class/create.st | 0 .../class/focusedLabelColor.st | 0 .../class/foregroundColor.st | 0 .../PythonTheme.class/class/globalColor.st | 0 .../PythonTheme.class/class/green.st | 0 .../PythonTheme.class/class/highlightColor.st | 0 .../PythonTheme.class/class/initialize.st | 0 .../PythonTheme.class/class/keywordColor.st | 0 .../PythonTheme.class/class/magenta.st | 0 .../PythonTheme.class/class/numberColor.st | 0 .../PythonTheme.class/class/orange.st | 0 .../PythonTheme.class/class/red.st | 0 .../PythonTheme.class/class/stringColor.st | 0 .../PythonTheme.class/class/textColor.st | 0 .../class/textSelectionColor.st | 0 .../class/unfocusedLabelColor.st | 0 .../PythonTheme.class/class/variableColor.st | 0 .../PythonTheme.class/class/windowColor.st | 0 .../PythonTheme.class/class/yellow.st | 0 .../PythonTheme.class/instance/stylerClass.st | 2 +- .../PythonTheme.class/methodProperties.json | 4 +- .../PythonTheme.class/properties.json | 2 +- .../ToolIcons.extension/class/Python.st | 7 +++ .../ToolIcons.extension/methodProperties.json | 2 +- .../ToolIcons.extension/properties.json | 0 .../monticello.meta/version | 2 +- .../instance/pySource..st | 3 -- .../instance/pySource.st | 3 -- .../methodProperties.json | 6 --- .../CompiledMethod.extension/properties.json | 2 - .../instance/isPython.st | 3 -- .../instance/pyFrame..st | 4 -- .../instance/pyFrame.st | 4 -- .../methodProperties.json | 11 ---- .../instance/format..st | 5 -- .../instance/formatPython..st | 7 --- .../instance/isPythonCode..st | 3 -- .../instance/isPythonCode.st | 3 -- .../instance/parseablePySourceCodeTemplate.st | 3 -- .../PythonTextStyler.class/instance/style..st | 5 -- .../instance/styleInBackgroundProcess..st | 5 -- .../instance/stylePython..st | 9 ---- .../stylePythonInBackgroundProcess..st | 3 -- .../methodProperties.json | 15 ------ .../ToolIcons.extension/class/python.st | 8 --- .../monticello.meta/categories.st | 1 - .../monticello.meta/package | 1 - .../monticello.meta/version | 1 - .../instance/testScopeEndInStartingAt.st | 2 +- .../methodProperties.json | 2 +- .../monticello.meta/version | 2 +- .../PythonBrowser.class/instance/isPython.st | 3 -- .../instance/systemCategoryList.st | 5 -- .../PythonBrowser.class/methodProperties.json | 15 ------ .../methodProperties.json | 5 -- .../class/newPyContext.st | 7 --- .../instance/guessTypeForName..st | 4 -- .../instance/hasPyContextSelected.st | 3 -- .../PythonDebugger.class/instance/isPython.st | 3 -- .../methodProperties.json | 29 ---------- .../instance/isPython.st | 3 -- .../methodProperties.json | 10 ---- .../methodProperties.json | 6 --- .../class/browse.selector..st | 3 -- .../PythonToolSet.class/class/explore..st | 4 -- .../class/inspectorClassOf..st | 4 -- .../class/openPythonClassBrowser.st | 3 -- .../class/openPythonWorkspace.st | 3 -- .../PythonToolSet.class/methodProperties.json | 14 ----- .../PythonWorkspace.class/class/open.st | 3 -- .../instance/evaluateExpression..st | 3 -- .../methodProperties.json | 8 --- .../monticello.meta/categories.st | 1 - .../monticello.meta/package | 1 - .../monticello.meta/version | 1 - repository/Ruby-Core.package/.filetree | 4 ++ .../Object.extension/instance/isRuby.st | 3 ++ .../Object.extension/methodProperties.json | 5 ++ .../Object.extension/properties.json | 2 + .../Ruby-Core.package/Ruby.class/README.md | 0 .../Ruby.class/class/checkForException..st | 5 ++ .../Ruby.class/class/eval..st | 3 ++ .../Ruby.class/class/evaluateExpression..st | 3 ++ .../Ruby.class/class/highlight..st | 3 ++ .../Ruby.class/class/kernel.st | 4 ++ .../Ruby.class/class/object.st | 4 ++ .../Ruby.class/class/primEval..st | 4 ++ .../class/primEval.breakOnExceptions..st | 4 ++ .../Ruby.class/class/primGetTopFrame.st | 4 ++ .../Ruby.class/class/primLastError..st | 4 ++ .../Ruby.class/class/primResume..st | 4 ++ .../Ruby.class/class/primSend.to.with..st | 4 ++ .../Ruby.class/class/resume..st | 7 +++ .../Ruby.class/class/sourceCodeTemplate.st | 5 ++ .../Ruby.class/class/vmSpeaksLanguage.st | 4 ++ .../Ruby.class/methodProperties.json | 19 +++++++ .../Ruby.class/properties.json | 15 ++++++ .../RubyObject.class/README.md | 0 .../instance/allInstVarNames.st | 3 ++ .../RubyObject.class/instance/asSmalltalk.st | 4 ++ .../RubyObject.class/instance/class.st | 3 ++ .../RubyObject.class/instance/className.st | 3 ++ .../instance/defaultTitleForInspector.st | 3 ++ .../instance/instVarNamed..st | 3 ++ .../RubyObject.class/instance/isRuby.st | 3 ++ .../instance/languageSymbol.st | 3 ++ .../RubyObject.class/instance/printOn..st | 3 ++ .../RubyObject.class/instance/respondsTo..st | 6 +++ .../instance/variablesAndOffsetsDo..st | 3 ++ .../RubyObject.class/methodProperties.json | 15 ++++++ .../RubyObject.class/properties.json | 14 +++++ .../ToolIcons.extension/class/Ruby.st | 7 +++ .../methodProperties.json | 2 +- .../ToolIcons.extension/properties.json | 2 + .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../Ruby-Core.package/monticello.meta/package | 1 + .../Ruby-Core.package/monticello.meta/version | 1 + repository/Ruby-Core.package/properties.json | 2 + 373 files changed, 925 insertions(+), 482 deletions(-) rename repository/{Python-Support.package => ForeignLanguage-Core.package}/.filetree (100%) rename repository/{Python-Core.package => ForeignLanguage-Core.package}/ForeignLanguage.class/README.md (100%) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/availableLanguages.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/highlight..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/sourceCodeTemplate.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/styleInBackgroundProcess..st rename repository/{Python-Support.package/PythonTextStyler.class/instance/privateFormatPython..st => ForeignLanguage-Core.package/ForeignLanguage.class/class/stylerFormat..st} (74%) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmSpeaksLanguage.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json rename repository/{Python-Core.package => ForeignLanguage-Core.package}/ForeignLanguage.class/properties.json (83%) rename repository/{Python-Core.package => ForeignLanguage-Core.package}/ForeignLanguageException.class/README.md (100%) rename repository/{Python-Core.package => ForeignLanguage-Core.package}/ForeignLanguageException.class/instance/action..st (100%) rename repository/{Python-Core.package => ForeignLanguage-Core.package}/ForeignLanguageException.class/instance/action.st (100%) rename repository/{Python-Core.package => ForeignLanguage-Core.package}/ForeignLanguageException.class/instance/defaultAction.st (100%) rename repository/{Python-Core.package => ForeignLanguage-Core.package}/ForeignLanguageException.class/methodProperties.json (100%) rename repository/{Python-Core.package => ForeignLanguage-Core.package}/ForeignLanguageException.class/properties.json (84%) rename repository/{Python-Support.package/PythonMethodContext.class => ForeignLanguage-Core.package/ForeignLanguageObject.class}/README.md (100%) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/allInstVarNames.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/asSmalltalk.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/class.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/className.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultTitleForInspector.st rename repository/{Python-Core.package/PythonObject.class => ForeignLanguage-Core.package/ForeignLanguageObject.class}/instance/environment.st (100%) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st rename repository/{Python-Core.package/PythonObject.class => ForeignLanguage-Core.package/ForeignLanguageObject.class}/instance/inspect.st (67%) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarAt..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarNamed..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/isForeign.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/languageSymbol.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/printOn..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/properties.json create mode 100644 repository/ForeignLanguage-Core.package/Object.extension/instance/isForeign.st create mode 100644 repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json create mode 100644 repository/ForeignLanguage-Core.package/Object.extension/properties.json create mode 100644 repository/ForeignLanguage-Core.package/monticello.meta/categories.st rename repository/{Python-Support.package => ForeignLanguage-Core.package}/monticello.meta/initializers.st (100%) create mode 100644 repository/ForeignLanguage-Core.package/monticello.meta/package create mode 100644 repository/ForeignLanguage-Core.package/monticello.meta/version rename repository/{Python-Support.package => ForeignLanguage-Core.package}/properties.json (100%) rename repository/{Python-Tools.package => ForeignLanguage-Support.package}/.filetree (100%) rename repository/{Python-Support.package/PythonTextStyler.class => ForeignLanguage-Support.package/ForeignLanguageMethodContext.class}/README.md (100%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame.st rename repository/{Python-Tools.package/PythonWorkspace.class/instance/isPython.st => ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/isForeign.st} (62%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageSymbol.st rename repository/{Python-Support.package/PythonMethodContext.class => ForeignLanguage-Support.package/ForeignLanguageMethodContext.class}/instance/printOn..st (62%) rename repository/{Python-Support.package/PythonMethodContext.class => ForeignLanguage-Support.package/ForeignLanguageMethodContext.class}/instance/sender..st (100%) rename repository/{Python-Support.package/PythonMethodContext.class => ForeignLanguage-Support.package/ForeignLanguageMethodContext.class}/instance/setSender.receiver.method.arguments..st (96%) rename repository/{Python-Support.package/PythonMethodContext.class => ForeignLanguage-Support.package/ForeignLanguageMethodContext.class}/instance/tempNames.st (78%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json rename repository/{Python-Support.package/PythonMethodContext.class => ForeignLanguage-Support.package/ForeignLanguageMethodContext.class}/properties.json (60%) rename repository/{Python-Support.package/PythonTheme.class => ForeignLanguage-Support.package/ForeignLanguageTextStyler.class}/README.md (100%) rename repository/{Python-Support.package/PythonTextStyler.class/class/highlight..st => ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st} (91%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st rename repository/{Python-Support.package/PythonTextStyler.class => ForeignLanguage-Support.package/ForeignLanguageTextStyler.class}/class/highlightSmalltalk..st (100%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/isForeign.st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol.st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style.foreignClass..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json rename repository/{Python-Support.package/PythonTextStyler.class => ForeignLanguage-Support.package/ForeignLanguageTextStyler.class}/properties.json (61%) rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Support.package/ForeignLanguageToolSet.class}/README.md (100%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browse.selector..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass.category..st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseMessageCategory.inClass..st rename repository/{Python-Tools.package/PythonToolSet.class => ForeignLanguage-Support.package/ForeignLanguageToolSet.class}/class/debug.context.label.contents.fullView..st (53%) rename repository/{Python-Tools.package/PythonToolSet.class => ForeignLanguage-Support.package/ForeignLanguageToolSet.class}/class/debugContext.label.contents..st (54%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/explore..st rename repository/{Python-Tools.package/PythonToolSet.class => ForeignLanguage-Support.package/ForeignLanguageToolSet.class}/class/initialize.st (63%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/inspectorClassOf..st rename repository/{Python-Tools.package/PythonToolSet.class => ForeignLanguage-Support.package/ForeignLanguageToolSet.class}/class/interrupt.label..st (62%) rename repository/{Python-Tools.package/PythonToolSet.class => ForeignLanguage-Support.package/ForeignLanguageToolSet.class}/class/menuItems.st (78%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openClassBrowser.st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageBrowser.st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageWorkspace.st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json rename repository/{Python-Tools.package/PythonToolSet.class => ForeignLanguage-Support.package/ForeignLanguageToolSet.class}/properties.json (68%) create mode 100644 repository/ForeignLanguage-Support.package/monticello.meta/categories.st rename repository/{Python-Tools.package => ForeignLanguage-Support.package}/monticello.meta/initializers.st (100%) create mode 100644 repository/ForeignLanguage-Support.package/monticello.meta/package create mode 100644 repository/ForeignLanguage-Support.package/monticello.meta/version rename repository/{Python-Tools.package => ForeignLanguage-Support.package}/properties.json (100%) create mode 100644 repository/ForeignLanguage-Tools.package/.filetree rename repository/{Python-Tools.package/PythonContextVariablesInspector.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/README.md (100%) rename repository/{Python-Tools.package/PythonWorkspace.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/instance/aboutToStyle..st (66%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/addModelItemsToWindowMenu..st rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/instance/buildCodePaneWith..st (95%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/currentLanguageSymbol.st rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/instance/defaultBrowserTitle.st (61%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/instance/defaultStylerClass.st (50%) rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/instance/defineMessageFrom.notifying..st (100%) rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/instance/doItReceiver.st (100%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isForeign.st rename repository/{Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isPython.st} (92%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isRuby.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isSmalltalk.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/labelString.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol..st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectLanguage..st rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/instance/selectedMessage.st (100%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/systemCategoryList.st rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/instance/validateMessageSource.forSelector.inClass..st (86%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/methodProperties.json rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageBrowser.class}/properties.json (61%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class}/README.md (100%) rename repository/{Python-Tools.package/PythonContextVariablesInspector.class => ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class}/instance/selection.st (68%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json rename repository/{Python-Tools.package/PythonContextVariablesInspector.class => ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class}/properties.json (65%) rename repository/{Python-Tools.package/PythonInspector.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/README.md (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/exploreFrames.st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/filterPySource.lineno..st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/getContentsOf..st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/getPySource..st (59%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/getSignature..st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/indent.by..st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/indentSize..st (100%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/newForeignContext..st rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/prependPythonContexts..st (75%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/replaceInPySource.content.lineno..st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/scopeEndIn.startingAt..st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/class/setPySourceContent.content..st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/aboutToStyle..st (55%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/buildCodePaneWith..st (95%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/contents.notifying..st (55%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/contextForStack..st (100%) rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/defaultStylerClass.st (50%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/expandStack.st (51%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/guessTypeForName..st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isPython.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isRuby.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/languageSymbol.st rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/messageIconAt..st (68%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/pcRange.st (71%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/process.controller.context..st (100%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/pyPCRange.st (88%) rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/instance/selectedMessage.st (74%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json rename repository/{Python-Tools.package/PythonDebugger.class => ForeignLanguage-Tools.package/ForeignLanguageDebugger.class}/properties.json (67%) rename repository/{Python-Tools.package/PythonObjectExplorer.class => ForeignLanguage-Tools.package/ForeignLanguageInspector.class}/README.md (100%) rename repository/{Python-Tools.package/PythonBrowser.class => ForeignLanguage-Tools.package/ForeignLanguageInspector.class}/instance/aboutToStyle..st (65%) rename repository/{Python-Tools.package/PythonInspector.class => ForeignLanguage-Tools.package/ForeignLanguageInspector.class}/instance/buildCodePaneWith..st (87%) rename repository/{Python-Tools.package/PythonInspector.class => ForeignLanguage-Tools.package/ForeignLanguageInspector.class}/instance/contentsIsString.st (100%) rename repository/{Python-Tools.package/PythonInspector.class => ForeignLanguage-Tools.package/ForeignLanguageInspector.class}/instance/fieldList.st (69%) rename repository/{Python-Tools.package/PythonInspector.class => ForeignLanguage-Tools.package/ForeignLanguageInspector.class}/instance/selection.st (64%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json rename repository/{Python-Tools.package/PythonInspector.class => ForeignLanguage-Tools.package/ForeignLanguageInspector.class}/properties.json (67%) rename repository/{Python-Tools.package/PythonToolSet.class => ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class}/README.md (100%) rename repository/{Python-Tools.package/PythonObjectExplorer.class => ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class}/instance/aboutToStyle..st (65%) rename repository/{Python-Tools.package/PythonObjectExplorer.class => ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class}/instance/buildWith..st (97%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/methodProperties.json rename repository/{Python-Tools.package/PythonObjectExplorer.class => ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class}/properties.json (66%) rename repository/{Python-Tools.package/PythonWorkspace.class => ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class}/README.md (100%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/open.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/windowTitlePrefix.st rename repository/{Python-Tools.package/PythonInspector.class => ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class}/instance/aboutToStyle..st (66%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st rename repository/{Python-Tools.package/PythonWorkspace.class => ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class}/instance/buildCodePaneWith..st (86%) create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/isForeign.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol..st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/selectLanguage..st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json rename repository/{Python-Tools.package/PythonWorkspace.class => ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class}/properties.json (60%) create mode 100644 repository/ForeignLanguage-Tools.package/monticello.meta/categories.st create mode 100644 repository/ForeignLanguage-Tools.package/monticello.meta/initializers.st create mode 100644 repository/ForeignLanguage-Tools.package/monticello.meta/package create mode 100644 repository/ForeignLanguage-Tools.package/monticello.meta/version create mode 100644 repository/ForeignLanguage-Tools.package/properties.json create mode 100644 repository/Python-Core.package/Python.class/class/breakOnExceptions..st create mode 100644 repository/Python-Core.package/Python.class/class/breakOnExceptions.st create mode 100644 repository/Python-Core.package/Python.class/class/checkForException..st create mode 100644 repository/Python-Core.package/Python.class/class/eval.breakOnExceptions..st create mode 100644 repository/Python-Core.package/Python.class/class/evaluateExpression..st create mode 100644 repository/Python-Core.package/Python.class/class/exec.breakOnExceptions..st delete mode 100644 repository/Python-Core.package/Python.class/class/getSource..st create mode 100644 repository/Python-Core.package/Python.class/class/highlight..st create mode 100644 repository/Python-Core.package/Python.class/class/import.breakOnExceptions..st create mode 100644 repository/Python-Core.package/Python.class/class/load.breakOnExceptions..st delete mode 100644 repository/Python-Core.package/Python.class/class/primBreakOnExceptions..st delete mode 100644 repository/Python-Core.package/Python.class/class/primBreakOnExceptions.st delete mode 100644 repository/Python-Core.package/Python.class/class/primEval.filename.cmd..st rename repository/Python-Core.package/Python.class/class/{primEval.cmd..st => primEval.filename.cmd.breakOnExceptions..st} (51%) rename repository/Python-Core.package/Python.class/class/{primLastError.st => primLastError..st} (73%) delete mode 100644 repository/Python-Core.package/Python.class/class/primPythonAt..st delete mode 100644 repository/Python-Core.package/Python.class/class/pyInspect.st create mode 100644 repository/Python-Core.package/Python.class/class/re.st create mode 100644 repository/Python-Core.package/Python.class/class/sourceCodeTemplate.st create mode 100644 repository/Python-Core.package/Python.class/class/sys.st rename repository/Python-Core.package/Python.class/class/{vmSpeaksPython.st => vmSpeaksLanguage.st} (82%) delete mode 100644 repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/defaultTitleForInspector.st delete mode 100644 repository/Python-Core.package/PythonObject.class/instance/explore.st delete mode 100644 repository/Python-Core.package/PythonObject.class/instance/inspectorClass.st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st create mode 100644 repository/Python-Core.package/PythonObject.class/instance/languageSymbol.st create mode 100644 repository/Python-Core.package/PythonTheme.class/README.md rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/addButtons..st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/addDialogs..st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/addFonts..st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/addMenusAndDockingBars..st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/addScrollables..st (97%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/addSyntaxHighlighting..st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/addToolColors..st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/addWindowColors..st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/argumentColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/backgroundColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/backgroundForm.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/blue.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/builtinConstColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/commentColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/create.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/focusedLabelColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/foregroundColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/globalColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/green.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/highlightColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/initialize.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/keywordColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/magenta.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/numberColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/orange.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/red.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/stringColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/textColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/textSelectionColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/unfocusedLabelColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/variableColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/windowColor.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/class/yellow.st (100%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/instance/stylerClass.st (53%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/methodProperties.json (93%) rename repository/{Python-Support.package => Python-Core.package}/PythonTheme.class/properties.json (85%) create mode 100644 repository/Python-Core.package/ToolIcons.extension/class/Python.st rename repository/{Python-Support.package => Python-Core.package}/ToolIcons.extension/methodProperties.json (50%) rename repository/{Python-Support.package => Python-Core.package}/ToolIcons.extension/properties.json (100%) delete mode 100644 repository/Python-Support.package/CompiledMethod.extension/instance/pySource..st delete mode 100644 repository/Python-Support.package/CompiledMethod.extension/instance/pySource.st delete mode 100644 repository/Python-Support.package/CompiledMethod.extension/methodProperties.json delete mode 100644 repository/Python-Support.package/CompiledMethod.extension/properties.json delete mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/isPython.st delete mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame..st delete mode 100644 repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame.st delete mode 100644 repository/Python-Support.package/PythonMethodContext.class/methodProperties.json delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/format..st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/formatPython..st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode..st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode.st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/parseablePySourceCodeTemplate.st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/style..st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/stylePython..st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/instance/stylePythonInBackgroundProcess..st delete mode 100644 repository/Python-Support.package/PythonTextStyler.class/methodProperties.json delete mode 100644 repository/Python-Support.package/ToolIcons.extension/class/python.st delete mode 100644 repository/Python-Support.package/monticello.meta/categories.st delete mode 100644 repository/Python-Support.package/monticello.meta/package delete mode 100644 repository/Python-Support.package/monticello.meta/version delete mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/isPython.st delete mode 100644 repository/Python-Tools.package/PythonBrowser.class/instance/systemCategoryList.st delete mode 100644 repository/Python-Tools.package/PythonBrowser.class/methodProperties.json delete mode 100644 repository/Python-Tools.package/PythonContextVariablesInspector.class/methodProperties.json delete mode 100644 repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st delete mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/guessTypeForName..st delete mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/hasPyContextSelected.st delete mode 100644 repository/Python-Tools.package/PythonDebugger.class/instance/isPython.st delete mode 100644 repository/Python-Tools.package/PythonDebugger.class/methodProperties.json delete mode 100644 repository/Python-Tools.package/PythonInspector.class/instance/isPython.st delete mode 100644 repository/Python-Tools.package/PythonInspector.class/methodProperties.json delete mode 100644 repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json delete mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/browse.selector..st delete mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/explore..st delete mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/inspectorClassOf..st delete mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/openPythonClassBrowser.st delete mode 100644 repository/Python-Tools.package/PythonToolSet.class/class/openPythonWorkspace.st delete mode 100644 repository/Python-Tools.package/PythonToolSet.class/methodProperties.json delete mode 100644 repository/Python-Tools.package/PythonWorkspace.class/class/open.st delete mode 100644 repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st delete mode 100644 repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json delete mode 100644 repository/Python-Tools.package/monticello.meta/categories.st delete mode 100644 repository/Python-Tools.package/monticello.meta/package delete mode 100644 repository/Python-Tools.package/monticello.meta/version create mode 100644 repository/Ruby-Core.package/.filetree create mode 100644 repository/Ruby-Core.package/Object.extension/instance/isRuby.st create mode 100644 repository/Ruby-Core.package/Object.extension/methodProperties.json create mode 100644 repository/Ruby-Core.package/Object.extension/properties.json create mode 100644 repository/Ruby-Core.package/Ruby.class/README.md create mode 100644 repository/Ruby-Core.package/Ruby.class/class/checkForException..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/eval..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/highlight..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/kernel.st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/object.st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/primEval..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/primEval.breakOnExceptions..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame.st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/primLastError..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/primResume..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/primSend.to.with..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/resume..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/sourceCodeTemplate.st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/vmSpeaksLanguage.st create mode 100644 repository/Ruby-Core.package/Ruby.class/methodProperties.json create mode 100644 repository/Ruby-Core.package/Ruby.class/properties.json create mode 100644 repository/Ruby-Core.package/RubyObject.class/README.md create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/allInstVarNames.st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/asSmalltalk.st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/class.st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/className.st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/defaultTitleForInspector.st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/instVarNamed..st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/isRuby.st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/languageSymbol.st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/printOn..st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/respondsTo..st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/variablesAndOffsetsDo..st create mode 100644 repository/Ruby-Core.package/RubyObject.class/methodProperties.json create mode 100644 repository/Ruby-Core.package/RubyObject.class/properties.json create mode 100644 repository/Ruby-Core.package/ToolIcons.extension/class/Ruby.st rename repository/{Python-Core.package/ForeignLanguage.class => Ruby-Core.package/ToolIcons.extension}/methodProperties.json (52%) create mode 100644 repository/Ruby-Core.package/ToolIcons.extension/properties.json create mode 100644 repository/Ruby-Core.package/monticello.meta/categories.st create mode 100644 repository/Ruby-Core.package/monticello.meta/initializers.st create mode 100644 repository/Ruby-Core.package/monticello.meta/package create mode 100644 repository/Ruby-Core.package/monticello.meta/version create mode 100644 repository/Ruby-Core.package/properties.json diff --git a/repository/Python-Support.package/.filetree b/repository/ForeignLanguage-Core.package/.filetree similarity index 100% rename from repository/Python-Support.package/.filetree rename to repository/ForeignLanguage-Core.package/.filetree diff --git a/repository/Python-Core.package/ForeignLanguage.class/README.md b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/README.md similarity index 100% rename from repository/Python-Core.package/ForeignLanguage.class/README.md rename to repository/ForeignLanguage-Core.package/ForeignLanguage.class/README.md diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/availableLanguages.st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/availableLanguages.st new file mode 100644 index 00000000..b1fec202 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/availableLanguages.st @@ -0,0 +1,5 @@ +helpers +availableLanguages + ^ (self subclasses collect: [ :ea | ea asString ]) sorted + inject: (OrderedCollection with: #Smalltalk) + into: [ :coll :ea | coll add: ea asSymbol; yourself ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/highlight..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/highlight..st new file mode 100644 index 00000000..0a80b394 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/highlight..st @@ -0,0 +1,3 @@ +styling +highlight: aText + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/sourceCodeTemplate.st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/sourceCodeTemplate.st new file mode 100644 index 00000000..2273eff1 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/sourceCodeTemplate.st @@ -0,0 +1,3 @@ +styling +sourceCodeTemplate + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/styleInBackgroundProcess..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/styleInBackgroundProcess..st new file mode 100644 index 00000000..e631240f --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/styleInBackgroundProcess..st @@ -0,0 +1,3 @@ +styling +styleInBackgroundProcess: aText + Project current addDeferredUIMessage: [ self style: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/privateFormatPython..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/stylerFormat..st similarity index 74% rename from repository/Python-Support.package/PythonTextStyler.class/instance/privateFormatPython..st rename to repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/stylerFormat..st index e7e44abc..c7edd271 100644 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/privateFormatPython..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/stylerFormat..st @@ -1,10 +1,10 @@ -overrides -privateFormatPython: aText +styling +stylerFormat: aText "Perform any formatting of aText necessary and answer either aText, or a formatted copy of aText" aText asString = Object sourceCodeTemplate ifTrue:[ "the original source code template does not parse, replace it with one that does" - ^self parseablePySourceCodeTemplate asText]. + ^ self sourceCodeTemplate asText]. ^aText \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmSpeaksLanguage.st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmSpeaksLanguage.st new file mode 100644 index 00000000..49c03570 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmSpeaksLanguage.st @@ -0,0 +1,3 @@ +helpers +vmSpeaksLanguage + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json new file mode 100644 index 00000000..553fb1ad --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json @@ -0,0 +1,10 @@ +{ + "class" : { + "availableLanguages" : "fn 3/14/2017 11:15", + "highlight:" : "fn 3/14/2017 11:27", + "sourceCodeTemplate" : "fn 3/14/2017 11:23", + "styleInBackgroundProcess:" : "fn 3/14/2017 11:25", + "stylerFormat:" : "fn 3/14/2017 11:21", + "vmSpeaksLanguage" : "fn 3/14/2017 11:31" }, + "instance" : { + } } diff --git a/repository/Python-Core.package/ForeignLanguage.class/properties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/properties.json similarity index 83% rename from repository/Python-Core.package/ForeignLanguage.class/properties.json rename to repository/ForeignLanguage-Core.package/ForeignLanguage.class/properties.json index d55b39ba..4d6b3b1e 100644 --- a/repository/Python-Core.package/ForeignLanguage.class/properties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Python-Core", + "category" : "ForeignLanguage-Core", "classinstvars" : [ ], "classvars" : [ diff --git a/repository/Python-Core.package/ForeignLanguageException.class/README.md b/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/README.md similarity index 100% rename from repository/Python-Core.package/ForeignLanguageException.class/README.md rename to repository/ForeignLanguage-Core.package/ForeignLanguageException.class/README.md diff --git a/repository/Python-Core.package/ForeignLanguageException.class/instance/action..st b/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/action..st similarity index 100% rename from repository/Python-Core.package/ForeignLanguageException.class/instance/action..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/action..st diff --git a/repository/Python-Core.package/ForeignLanguageException.class/instance/action.st b/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/action.st similarity index 100% rename from repository/Python-Core.package/ForeignLanguageException.class/instance/action.st rename to repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/action.st diff --git a/repository/Python-Core.package/ForeignLanguageException.class/instance/defaultAction.st b/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/defaultAction.st similarity index 100% rename from repository/Python-Core.package/ForeignLanguageException.class/instance/defaultAction.st rename to repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/defaultAction.st diff --git a/repository/Python-Core.package/ForeignLanguageException.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/methodProperties.json similarity index 100% rename from repository/Python-Core.package/ForeignLanguageException.class/methodProperties.json rename to repository/ForeignLanguage-Core.package/ForeignLanguageException.class/methodProperties.json diff --git a/repository/Python-Core.package/ForeignLanguageException.class/properties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/properties.json similarity index 84% rename from repository/Python-Core.package/ForeignLanguageException.class/properties.json rename to repository/ForeignLanguage-Core.package/ForeignLanguageException.class/properties.json index 6fd6b1dc..e8243ddc 100644 --- a/repository/Python-Core.package/ForeignLanguageException.class/properties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Python-Core", + "category" : "ForeignLanguage-Core", "classinstvars" : [ ], "classvars" : [ diff --git a/repository/Python-Support.package/PythonMethodContext.class/README.md b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/README.md similarity index 100% rename from repository/Python-Support.package/PythonMethodContext.class/README.md rename to repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/README.md diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/allInstVarNames.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/allInstVarNames.st new file mode 100644 index 00000000..5b313e5f --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/allInstVarNames.st @@ -0,0 +1,3 @@ +abstract +allInstVarNames + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/asSmalltalk.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/asSmalltalk.st new file mode 100644 index 00000000..bff03aae --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/asSmalltalk.st @@ -0,0 +1,3 @@ +abstract +asSmalltalk + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/class.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/class.st new file mode 100644 index 00000000..aee1af3b --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/class.st @@ -0,0 +1,3 @@ +abstract +class + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/className.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/className.st new file mode 100644 index 00000000..08e79725 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/className.st @@ -0,0 +1,3 @@ +abstract +className + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st new file mode 100644 index 00000000..ae3766f9 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st @@ -0,0 +1,3 @@ +overrides +defaultLabelForInspector + ^ self languageSymbol asString, ' ', self defaultTitleForInspector \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultTitleForInspector.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultTitleForInspector.st new file mode 100644 index 00000000..60f608e1 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultTitleForInspector.st @@ -0,0 +1,3 @@ +overrides +defaultTitleForInspector + self subclassResponsibility \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/environment.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/environment.st similarity index 100% rename from repository/Python-Core.package/PythonObject.class/instance/environment.st rename to repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/environment.st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st new file mode 100644 index 00000000..5e1bd300 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st @@ -0,0 +1,3 @@ +overrides +explore + ^ForeignLanguageToolSet explore: self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/inspect.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspect.st similarity index 67% rename from repository/Python-Core.package/PythonObject.class/instance/inspect.st rename to repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspect.st index 9576f5bb..ffab1cda 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/inspect.st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspect.st @@ -1,4 +1,4 @@ -inspector +overrides inspect "Create and schedule an Inspector in which the user can examine the receiver's variables." - ^ PythonToolSet inspect: self \ No newline at end of file + ^ ForeignLanguageToolSet inspect: self \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st new file mode 100644 index 00000000..5f093b82 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st @@ -0,0 +1,3 @@ +overrides +inspectorClass + ^ ForeignLanguageInspector \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarAt..st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarAt..st new file mode 100644 index 00000000..170ac3cc --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarAt..st @@ -0,0 +1,3 @@ +overrides +instVarAt: index + ^ self instVarNamed: (self instVarNames at: index) \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarNamed..st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarNamed..st new file mode 100644 index 00000000..ba66d9cc --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarNamed..st @@ -0,0 +1,3 @@ +abstract +instVarNamed: aName + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/isForeign.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/isForeign.st new file mode 100644 index 00000000..b4889410 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/isForeign.st @@ -0,0 +1,3 @@ +helpers +isForeign + ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/languageSymbol.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/languageSymbol.st new file mode 100644 index 00000000..d532102d --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/languageSymbol.st @@ -0,0 +1,3 @@ +abstract +languageSymbol + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/printOn..st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/printOn..st new file mode 100644 index 00000000..6100f3b5 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/printOn..st @@ -0,0 +1,3 @@ +abstract +printOn: aStream + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json new file mode 100644 index 00000000..b4c203e7 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json @@ -0,0 +1,19 @@ +{ + "class" : { + }, + "instance" : { + "allInstVarNames" : "fn 3/14/2017 12:02", + "asSmalltalk" : "fn 3/12/2017 19:22", + "class" : "fn 3/12/2017 19:22", + "className" : "fn 3/12/2017 19:22", + "defaultLabelForInspector" : "fn 3/14/2017 11:51", + "defaultTitleForInspector" : "fn 3/14/2017 11:52", + "environment" : "fn 3/12/2017 19:21", + "explore" : "fn 3/13/2017 17:38", + "inspect" : "fn 3/13/2017 17:38", + "inspectorClass" : "fn 3/13/2017 17:33", + "instVarAt:" : "fn 3/14/2017 12:06", + "instVarNamed:" : "fn 3/14/2017 12:06", + "isForeign" : "fn 3/12/2017 19:24", + "languageSymbol" : "fn 3/13/2017 17:10", + "printOn:" : "fn 3/12/2017 19:22" } } diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/properties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/properties.json new file mode 100644 index 00000000..48dfccde --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "ForeignLanguageObject", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Core.package/Object.extension/instance/isForeign.st b/repository/ForeignLanguage-Core.package/Object.extension/instance/isForeign.st new file mode 100644 index 00000000..d50b8600 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/Object.extension/instance/isForeign.st @@ -0,0 +1,3 @@ +*ForeignLanguage-Core +isForeign + ^ false \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json b/repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json new file mode 100644 index 00000000..742e80a3 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "isForeign" : "fn 3/12/2017 19:24" } } diff --git a/repository/ForeignLanguage-Core.package/Object.extension/properties.json b/repository/ForeignLanguage-Core.package/Object.extension/properties.json new file mode 100644 index 00000000..3d3b9ec4 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/Object.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "Object" } diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/categories.st b/repository/ForeignLanguage-Core.package/monticello.meta/categories.st new file mode 100644 index 00000000..2cdcd727 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'ForeignLanguage-Core'! diff --git a/repository/Python-Support.package/monticello.meta/initializers.st b/repository/ForeignLanguage-Core.package/monticello.meta/initializers.st similarity index 100% rename from repository/Python-Support.package/monticello.meta/initializers.st rename to repository/ForeignLanguage-Core.package/monticello.meta/initializers.st diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/package b/repository/ForeignLanguage-Core.package/monticello.meta/package new file mode 100644 index 00000000..48691103 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'ForeignLanguage-Core') \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/version b/repository/ForeignLanguage-Core.package/monticello.meta/version new file mode 100644 index 00000000..ef12338f --- /dev/null +++ b/repository/ForeignLanguage-Core.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Support.package/properties.json b/repository/ForeignLanguage-Core.package/properties.json similarity index 100% rename from repository/Python-Support.package/properties.json rename to repository/ForeignLanguage-Core.package/properties.json diff --git a/repository/Python-Tools.package/.filetree b/repository/ForeignLanguage-Support.package/.filetree similarity index 100% rename from repository/Python-Tools.package/.filetree rename to repository/ForeignLanguage-Support.package/.filetree diff --git a/repository/Python-Support.package/PythonTextStyler.class/README.md b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/README.md similarity index 100% rename from repository/Python-Support.package/PythonTextStyler.class/README.md rename to repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/README.md diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame..st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame..st new file mode 100644 index 00000000..6fb8966f --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame..st @@ -0,0 +1,4 @@ +accessing +foreignFrame: anObject + + foreignFrame := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame.st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame.st new file mode 100644 index 00000000..1255f0c5 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame.st @@ -0,0 +1,4 @@ +accessing +foreignFrame + + ^ foreignFrame \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/isForeign.st similarity index 62% rename from repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st rename to repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/isForeign.st index 5f13d9ba..6aab77f8 100644 --- a/repository/Python-Tools.package/PythonWorkspace.class/instance/isPython.st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/isForeign.st @@ -1,3 +1,3 @@ overrides -isPython +isForeign ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageSymbol.st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageSymbol.st new file mode 100644 index 00000000..d13c4229 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageSymbol.st @@ -0,0 +1,3 @@ +accessing +languageSymbol + ^ self foreignFrame languageSymbol \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/printOn..st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st similarity index 62% rename from repository/Python-Support.package/PythonMethodContext.class/instance/printOn..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st index 7d2fa8e1..8b2a0fce 100644 --- a/repository/Python-Support.package/PythonMethodContext.class/instance/printOn..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st @@ -1,12 +1,12 @@ -as yet unclassified +overrides printOn: aStream | line lineno filename currentPath | - self pyFrame ifNil: [ + self foreignFrame ifNil: [ aStream nextPutAll: 'Unknown pyFrame'. ^ self ]. - line := PythonDebugger getSignature: pyFrame f_code. - lineno := pyFrame f_lineno asSmalltalk. - filename := pyFrame f_code co_filename asSmalltalk. + line := ForeignLanguage getSignature: foreignFrame f_code. + lineno := foreignFrame f_lineno asSmalltalk. + filename := foreignFrame f_code co_filename asSmalltalk. currentPath := FileDirectory default pathName. (filename startsWith: currentPath) ifTrue: [ filename := filename allButFirst: currentPath size + 1]. diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/sender..st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/sender..st similarity index 100% rename from repository/Python-Support.package/PythonMethodContext.class/instance/sender..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/sender..st diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/setSender.receiver.method.arguments..st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/setSender.receiver.method.arguments..st similarity index 96% rename from repository/Python-Support.package/PythonMethodContext.class/instance/setSender.receiver.method.arguments..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/setSender.receiver.method.arguments..st index 6885cbdf..e9a494c4 100644 --- a/repository/Python-Support.package/PythonMethodContext.class/instance/setSender.receiver.method.arguments..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/setSender.receiver.method.arguments..st @@ -1,4 +1,4 @@ -accessing +overrides setSender: s receiver: r method: m arguments: args "Create the receiver's initial state." diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/tempNames.st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st similarity index 78% rename from repository/Python-Support.package/PythonMethodContext.class/instance/tempNames.st rename to repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st index 68b8afa4..fdd655ea 100644 --- a/repository/Python-Support.package/PythonMethodContext.class/instance/tempNames.st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st @@ -1,7 +1,7 @@ -accessing +overrides tempNames "Answer a SequenceableCollection of the names of the receiver's temporary variables, which are strings." - self pyFrame ifNil: [^ #()]. + self foreignFrame ifNil: [^ #()]. ^ self pyFrame f_locals keys asSmalltalk \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json new file mode 100644 index 00000000..4b3513f2 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json @@ -0,0 +1,12 @@ +{ + "class" : { + }, + "instance" : { + "foreignFrame" : "fn 3/14/2017 01:28", + "foreignFrame:" : "fn 3/14/2017 01:28", + "isForeign" : "fn 3/14/2017 01:29", + "languageSymbol" : "fn 3/14/2017 01:32", + "printOn:" : "fn 3/14/2017 01:30", + "sender:" : "fn 1/16/2017 21:54", + "setSender:receiver:method:arguments:" : "fn 1/18/2017 17:38", + "tempNames" : "fn 3/14/2017 01:28" } } diff --git a/repository/Python-Support.package/PythonMethodContext.class/properties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/properties.json similarity index 60% rename from repository/Python-Support.package/PythonMethodContext.class/properties.json rename to repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/properties.json index 29d02c0b..03e02ecc 100644 --- a/repository/Python-Support.package/PythonMethodContext.class/properties.json +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/properties.json @@ -1,13 +1,13 @@ { - "category" : "Python-Support", + "category" : "ForeignLanguage-Support", "classinstvars" : [ ], "classvars" : [ ], "commentStamp" : "", "instvars" : [ - "pyFrame" ], - "name" : "PythonMethodContext", + "foreignFrame" ], + "name" : "ForeignLanguageMethodContext", "pools" : [ ], "super" : "MethodContext", diff --git a/repository/Python-Support.package/PythonTheme.class/README.md b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/README.md similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/README.md rename to repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/README.md diff --git a/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st similarity index 91% rename from repository/Python-Support.package/PythonTextStyler.class/class/highlight..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st index 474750e4..14c2c26d 100644 --- a/repository/Python-Support.package/PythonTextStyler.class/class/highlight..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st @@ -1,5 +1,5 @@ as yet unclassified -highlight: aText +highlightPython: aText ^ (Python eval: '_pygments_highlight("""', aText string, '""")') asSmalltalk asTextFromHtml "^ (Python pygments highlight: aText string diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st new file mode 100644 index 00000000..0d67e565 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st @@ -0,0 +1,8 @@ +as yet unclassified +highlightRuby: aText + Python vmSpeaksLanguage ifFalse: [ ^ aText ]. + ^ (Python eval: '_pygments_highlight("""', aText string, '""", _pygments_lexer_ruby)') asSmalltalk asTextFromHtml + "^ (Python pygments + highlight: aText string + lexer: Python pyLexerPython + formatter: Python pyFormatter) asSmalltalk asTextFromHtml" \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/class/highlightSmalltalk..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightSmalltalk..st similarity index 100% rename from repository/Python-Support.package/PythonTextStyler.class/class/highlightSmalltalk..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightSmalltalk..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/isForeign.st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/isForeign.st new file mode 100644 index 00000000..d5507e24 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/isForeign.st @@ -0,0 +1,3 @@ +overrides +isForeign + ^ self languageSymbol ~~ #Smalltalk \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol..st new file mode 100644 index 00000000..42a2cf87 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol..st @@ -0,0 +1,3 @@ +accessing +languageSymbol: anObject + languageSymbol := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol.st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol.st new file mode 100644 index 00000000..556e7f19 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol.st @@ -0,0 +1,3 @@ +accessing +languageSymbol + ^ languageSymbol ifNil: [ #Smalltalk ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st new file mode 100644 index 00000000..3e69bdc1 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st @@ -0,0 +1,6 @@ +overrides +privateFormat: aText + Smalltalk at: self languageSymbol ifPresent: [ :cls | + (cls respondsTo: #stylerFormat:) + ifTrue: [ ^ cls stylerFormat: aText ] ]. + ^ super privateFormat: aText \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st new file mode 100644 index 00000000..b405a043 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st @@ -0,0 +1,6 @@ +overrides +style: aText + self isForeign ifFalse: [ ^ super style: aText ]. + Smalltalk at: self languageSymbol ifPresent: [ :cls | + (cls respondsTo: #highlight:) + ifTrue: [ ^ self style: aText foreignClass: cls ] ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style.foreignClass..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style.foreignClass..st new file mode 100644 index 00000000..169f74b5 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style.foreignClass..st @@ -0,0 +1,9 @@ +overrides +style: aText foreignClass: foreignClass + | styledText | + stylingEnabled ifFalse: [ ^ self ]. + foreignClass vmSpeaksLanguage ifFalse: [^ super style: aText]. + styledText := (foreignClass highlight: aText) first: aText size. + "Strings must be of same size, otherwise image might crash" + self assert: styledText string size = aText string size. + view ifNotNil: [ view stylerStyled: styledText ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st new file mode 100644 index 00000000..6e0e0b16 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st @@ -0,0 +1,6 @@ +overrides +styleInBackgroundProcess: aText + self isForeign ifFalse: [ ^ super styleInBackgroundProcess: aText ]. + Smalltalk at: self languageSymbol ifPresent: [ :cls | + (cls respondsTo: #styleInBackgroundProcess:) + ifTrue: [ ^ cls styleInBackgroundProcess: aText ] ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json new file mode 100644 index 00000000..00400e2d --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json @@ -0,0 +1,13 @@ +{ + "class" : { + "highlightPython:" : "fn 3/13/2017 17:22", + "highlightRuby:" : "fn 3/14/2017 11:32", + "highlightSmalltalk:" : "fn 3/6/2017 19:14" }, + "instance" : { + "isForeign" : "fn 3/14/2017 18:28", + "languageSymbol" : "fn 3/14/2017 18:29", + "languageSymbol:" : "fn 3/13/2017 17:13", + "privateFormat:" : "fn 3/14/2017 11:20", + "style:" : "fn 3/14/2017 18:28", + "style:foreignClass:" : "fn 3/14/2017 11:30", + "styleInBackgroundProcess:" : "fn 3/14/2017 18:28" } } diff --git a/repository/Python-Support.package/PythonTextStyler.class/properties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/properties.json similarity index 61% rename from repository/Python-Support.package/PythonTextStyler.class/properties.json rename to repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/properties.json index 62e6d8e9..3a6c493b 100644 --- a/repository/Python-Support.package/PythonTextStyler.class/properties.json +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/properties.json @@ -1,13 +1,13 @@ { - "category" : "Python-Support", + "category" : "ForeignLanguage-Support", "classinstvars" : [ ], "classvars" : [ ], "commentStamp" : "", "instvars" : [ - "isPythonCode" ], - "name" : "PythonTextStyler", + "languageSymbol" ], + "name" : "ForeignLanguageTextStyler", "pools" : [ ], "super" : "SHTextStylerST80", diff --git a/repository/Python-Tools.package/PythonBrowser.class/README.md b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/README.md similarity index 100% rename from repository/Python-Tools.package/PythonBrowser.class/README.md rename to repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/README.md diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browse.selector..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browse.selector..st new file mode 100644 index 00000000..c75b27a5 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browse.selector..st @@ -0,0 +1,3 @@ +browsing +browse: aClass selector: aSelector + ^ ForeignLanguageBrowser fullOnClass: aClass selector: aSelector \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass..st new file mode 100644 index 00000000..db504b93 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass..st @@ -0,0 +1,3 @@ +browsing +browseClass: aClass + ^ ForeignLanguageBrowser fullOnClass: aClass. \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass.category..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass.category..st new file mode 100644 index 00000000..7569be78 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass.category..st @@ -0,0 +1,5 @@ +browsing +browseClass: aClass category: aCategory + ^ ForeignLanguageBrowser default + fullOnClass: aClass + category: aCategory \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseMessageCategory.inClass..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseMessageCategory.inClass..st new file mode 100644 index 00000000..078826db --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseMessageCategory.inClass..st @@ -0,0 +1,4 @@ +browsing +browseMessageCategory: aCategory inClass: aClass + ^ ForeignLanguageBrowser default + newOnMessageCategory: aCategory inClass: aClass. \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st similarity index 53% rename from repository/Python-Tools.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st index 28b99062..63a292bf 100644 --- a/repository/Python-Tools.package/PythonToolSet.class/class/debug.context.label.contents.fullView..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st @@ -1,4 +1,4 @@ -as yet unclassified +debugging debug: aProcess context: aContext label: aString contents: contents fullView: aBool "Open a debugger on the given process and context." - ^PythonDebugger openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file + ^ ForeignLanguage openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/debugContext.label.contents..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st similarity index 54% rename from repository/Python-Tools.package/PythonToolSet.class/class/debugContext.label.contents..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st index b4438259..99173d7b 100644 --- a/repository/Python-Tools.package/PythonToolSet.class/class/debugContext.label.contents..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st @@ -1,4 +1,4 @@ -as yet unclassified +debugging debugContext: aContext label: aString contents: contents "Open a debugger on the given process and context." - ^ PythonDebugger openContext: aContext label: aString contents: contents \ No newline at end of file + ^ ForeignLanguage openContext: aContext label: aString contents: contents \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/explore..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/explore..st new file mode 100644 index 00000000..a8cf741a --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/explore..st @@ -0,0 +1,4 @@ +inspecting +explore: anObject + + ^ ForeignLanguageObjectExplorer openOn: anObject \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/initialize.st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/initialize.st similarity index 63% rename from repository/Python-Tools.package/PythonToolSet.class/class/initialize.st rename to repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/initialize.st index 8e7d4079..8b15285f 100644 --- a/repository/Python-Tools.package/PythonToolSet.class/class/initialize.st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/initialize.st @@ -1,3 +1,3 @@ -as yet unclassified +overrides initialize ToolSet register: self. \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/inspectorClassOf..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/inspectorClassOf..st new file mode 100644 index 00000000..18f15958 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/inspectorClassOf..st @@ -0,0 +1,4 @@ +inspecting +inspectorClassOf: anObject + anObject isForeign ifTrue: [ ^ ForeignLanguageInspector ]. + ^ super inspectorClassOf: anObject \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/interrupt.label..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st similarity index 62% rename from repository/Python-Tools.package/PythonToolSet.class/class/interrupt.label..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st index 87ff8543..9cbd238a 100644 --- a/repository/Python-Tools.package/PythonToolSet.class/class/interrupt.label..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st @@ -1,8 +1,8 @@ -as yet unclassified +debugging interrupt: aProcess label: aString - "Open a PythonDebugger if none exists" - ActiveWorld submorphs detect: [ :ea | ea isSystemWindow and: [ ea model class == PythonDebugger ]] + "Open a ForeignLanguage if none exists" + ActiveWorld submorphs detect: [ :ea | ea isSystemWindow and: [ ea model class == ForeignLanguage ]] ifFound: [ super interrupt: aProcess label: aString ] - ifNone: [ PythonDebugger + ifNone: [ ForeignLanguage openInterrupt: aString onProcess: aProcess ] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/menuItems.st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/menuItems.st similarity index 78% rename from repository/Python-Tools.package/PythonToolSet.class/class/menuItems.st rename to repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/menuItems.st index 7caa0d53..8bf3b412 100644 --- a/repository/Python-Tools.package/PythonToolSet.class/class/menuItems.st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/menuItems.st @@ -1,9 +1,9 @@ -as yet unclassified +overrides menuItems "Answer the menu items available for this tool set" ^#( - ('Python browser' #openPythonClassBrowser) - ('Python workspace' #openPythonWorkspace) + ('ForeignLanguage browser' #openForeignLanguageBrowser) + ('ForeignLanguage workspace' #openForeignLanguageWorkspace) ('Squeak browser' #openClassBrowser) ('Squeak workspace' #openWorkspace) ('file list' #openFileList) diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openClassBrowser.st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openClassBrowser.st new file mode 100644 index 00000000..57bb7522 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openClassBrowser.st @@ -0,0 +1,3 @@ +browsing +openClassBrowser + ForeignLanguageBrowser open \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageBrowser.st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageBrowser.st new file mode 100644 index 00000000..3010a26d --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageBrowser.st @@ -0,0 +1,3 @@ +inspecting +openForeignLanguageBrowser + ForeignLanguageBrowser open \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageWorkspace.st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageWorkspace.st new file mode 100644 index 00000000..50d84dc1 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageWorkspace.st @@ -0,0 +1,3 @@ +inspecting +openForeignLanguageWorkspace + ForeignLanguageWorkspace open \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json new file mode 100644 index 00000000..31f07d7d --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json @@ -0,0 +1,18 @@ +{ + "class" : { + "browse:selector:" : "fn 3/13/2017 17:43", + "browseClass:" : "fn 3/14/2017 10:46", + "browseClass:category:" : "fn 3/14/2017 10:47", + "browseMessageCategory:inClass:" : "fn 3/14/2017 10:47", + "debug:context:label:contents:fullView:" : "fn 3/14/2017 01:30", + "debugContext:label:contents:" : "fn 3/14/2017 01:30", + "explore:" : "fn 3/13/2017 17:41", + "initialize" : "fn 1/16/2017 18:52", + "inspectorClassOf:" : "fn 3/13/2017 18:36", + "interrupt:label:" : "fn 3/14/2017 01:31", + "menuItems" : "fn 3/13/2017 17:56", + "openClassBrowser" : "fn 3/14/2017 11:14", + "openForeignLanguageBrowser" : "fn 3/13/2017 17:43", + "openForeignLanguageWorkspace" : "fn 3/13/2017 17:55" }, + "instance" : { + } } diff --git a/repository/Python-Tools.package/PythonToolSet.class/properties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/properties.json similarity index 68% rename from repository/Python-Tools.package/PythonToolSet.class/properties.json rename to repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/properties.json index 9e45bc50..18616d20 100644 --- a/repository/Python-Tools.package/PythonToolSet.class/properties.json +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Python-Tools", + "category" : "ForeignLanguage-Support", "classinstvars" : [ ], "classvars" : [ @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "PythonToolSet", + "name" : "ForeignLanguageToolSet", "pools" : [ ], "super" : "StandardToolSet", diff --git a/repository/ForeignLanguage-Support.package/monticello.meta/categories.st b/repository/ForeignLanguage-Support.package/monticello.meta/categories.st new file mode 100644 index 00000000..82287bdc --- /dev/null +++ b/repository/ForeignLanguage-Support.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'ForeignLanguage-Support'! diff --git a/repository/Python-Tools.package/monticello.meta/initializers.st b/repository/ForeignLanguage-Support.package/monticello.meta/initializers.st similarity index 100% rename from repository/Python-Tools.package/monticello.meta/initializers.st rename to repository/ForeignLanguage-Support.package/monticello.meta/initializers.st diff --git a/repository/ForeignLanguage-Support.package/monticello.meta/package b/repository/ForeignLanguage-Support.package/monticello.meta/package new file mode 100644 index 00000000..f5cf13db --- /dev/null +++ b/repository/ForeignLanguage-Support.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'ForeignLanguage-Support') \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/monticello.meta/version b/repository/ForeignLanguage-Support.package/monticello.meta/version new file mode 100644 index 00000000..020eb200 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Tools.package/properties.json b/repository/ForeignLanguage-Support.package/properties.json similarity index 100% rename from repository/Python-Tools.package/properties.json rename to repository/ForeignLanguage-Support.package/properties.json diff --git a/repository/ForeignLanguage-Tools.package/.filetree b/repository/ForeignLanguage-Tools.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/Python-Tools.package/PythonContextVariablesInspector.class/README.md b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/README.md similarity index 100% rename from repository/Python-Tools.package/PythonContextVariablesInspector.class/README.md rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/README.md diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/aboutToStyle..st similarity index 66% rename from repository/Python-Tools.package/PythonWorkspace.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/aboutToStyle..st index 08799177..45f08745 100644 --- a/repository/Python-Tools.package/PythonWorkspace.class/instance/aboutToStyle..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/aboutToStyle..st @@ -1,5 +1,5 @@ overrides aboutToStyle: aStyler (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. - aStyler isPythonCode: true. + aStyler languageSymbol: self languageSymbol. ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/addModelItemsToWindowMenu..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/addModelItemsToWindowMenu..st new file mode 100644 index 00000000..3b5f792d --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/addModelItemsToWindowMenu..st @@ -0,0 +1,12 @@ +overrides +addModelItemsToWindowMenu: aMenu + aMenu addLine. + ForeignLanguage availableLanguages do: [:ea | + aMenu + add: 'select ', ea asString ,'...' + target: self + selector: #selectLanguage: + argument: ea ]. + aMenu addLine. + + super addModelItemsToWindowMenu: aMenu \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/buildCodePaneWith..st similarity index 95% rename from repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/buildCodePaneWith..st index c6298404..7cadf6c7 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/buildCodePaneWith..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/buildCodePaneWith..st @@ -14,7 +14,7 @@ buildCodePaneWith: builder setText: #contents:notifying:; selection: #contentsSelection; menu: #codePaneMenu:shifted:; - stylerClass: PythonTextStyler. + stylerClass: ForeignLanguageTextStyler. self wantsAnnotationPane ifTrue: [ top ifNil: [ top := builder pluggablePanelSpec new. diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/currentLanguageSymbol.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/currentLanguageSymbol.st new file mode 100644 index 00000000..1b57c2ba --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/currentLanguageSymbol.st @@ -0,0 +1,5 @@ +overrides +currentLanguageSymbol + self isPython ifTrue: [ ^ #Python ]. + self isRuby ifTrue: [ ^ #Ruby ]. + ^ nil \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/defaultBrowserTitle.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultBrowserTitle.st similarity index 61% rename from repository/Python-Tools.package/PythonBrowser.class/instance/defaultBrowserTitle.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultBrowserTitle.st index 2e6899b4..155b9bc7 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/defaultBrowserTitle.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultBrowserTitle.st @@ -1,3 +1,3 @@ overrides defaultBrowserTitle - ^ 'Python Browser' \ No newline at end of file + ^ 'Browser' \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/defaultStylerClass.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultStylerClass.st similarity index 50% rename from repository/Python-Tools.package/PythonDebugger.class/instance/defaultStylerClass.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultStylerClass.st index df1fd220..82ec2d42 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/defaultStylerClass.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultStylerClass.st @@ -1,3 +1,3 @@ overrides defaultStylerClass - ^ PythonTextStyler \ No newline at end of file + ^ ForeignLanguageTextStyler \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/defineMessageFrom.notifying..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defineMessageFrom.notifying..st similarity index 100% rename from repository/Python-Tools.package/PythonBrowser.class/instance/defineMessageFrom.notifying..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defineMessageFrom.notifying..st diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/doItReceiver.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/doItReceiver.st similarity index 100% rename from repository/Python-Tools.package/PythonBrowser.class/instance/doItReceiver.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/doItReceiver.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isForeign.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isForeign.st new file mode 100644 index 00000000..5dc39512 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isForeign.st @@ -0,0 +1,3 @@ +helpers +isForeign + ^ self isPython or: [ self isRuby ] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isPython.st similarity index 92% rename from repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isPython.st index 9af0bf47..5305c816 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/hasPyCodeSelected.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isPython.st @@ -1,5 +1,5 @@ helpers -hasPyCodeSelected +isPython | class selector | class := self selectedClassOrMetaClass. selector := self selectedMessageName. diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isRuby.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isRuby.st new file mode 100644 index 00000000..fd9e9c4b --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isRuby.st @@ -0,0 +1,4 @@ +helpers +isRuby + "tbd" + ^ false \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isSmalltalk.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isSmalltalk.st new file mode 100644 index 00000000..f2d264bf --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isSmalltalk.st @@ -0,0 +1,3 @@ +helpers +isSmalltalk + ^ self isForeign not \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/labelString.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/labelString.st new file mode 100644 index 00000000..4e7c3c4e --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/labelString.st @@ -0,0 +1,3 @@ +overrides +labelString + ^ self languageSymbol asString, ' ', super labelString \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol..st new file mode 100644 index 00000000..42a2cf87 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol..st @@ -0,0 +1,3 @@ +accessing +languageSymbol: anObject + languageSymbol := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol.st new file mode 100644 index 00000000..556e7f19 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol.st @@ -0,0 +1,3 @@ +accessing +languageSymbol + ^ languageSymbol ifNil: [ #Smalltalk ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectLanguage..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectLanguage..st new file mode 100644 index 00000000..aeb700c6 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectLanguage..st @@ -0,0 +1,5 @@ +foreign-language-support +selectLanguage: aLanguageSymbol + self languageSymbol: aLanguageSymbol. + self changed: #systemCategoryList. + self changed: #relabel \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/selectedMessage.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectedMessage.st similarity index 100% rename from repository/Python-Tools.package/PythonBrowser.class/instance/selectedMessage.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectedMessage.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/systemCategoryList.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/systemCategoryList.st new file mode 100644 index 00000000..3942e734 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/systemCategoryList.st @@ -0,0 +1,6 @@ +overrides +systemCategoryList + "Answer the class categories modelled by the receiver." + self languageSymbol = #Smalltalk ifTrue: [ ^ super systemCategoryList ]. + ^ (super systemCategoryList select: [:ea | + (ea beginsWith: 'ForeignLanguage') or: [ ea beginsWith: self languageSymbol asString ]]) sorted \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/validateMessageSource.forSelector.inClass..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/validateMessageSource.forSelector.inClass..st similarity index 86% rename from repository/Python-Tools.package/PythonBrowser.class/instance/validateMessageSource.forSelector.inClass..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/validateMessageSource.forSelector.inClass..st index d8d0ad23..0bcbf702 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/validateMessageSource.forSelector.inClass..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/validateMessageSource.forSelector.inClass..st @@ -1,6 +1,6 @@ overrides validateMessageSource: sourceString forSelector: aSelector inClass: theClass "Check whether there is evidence that method source is invalid" - self hasPyCodeSelected ifTrue: [^self]. + self isForeign ifTrue: [^self]. (theClass newParser parseSelector: sourceString asString) = aSelector ifFalse: [self informPossiblyCorruptSource]. \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/methodProperties.json new file mode 100644 index 00000000..cfaf36fb --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/methodProperties.json @@ -0,0 +1,23 @@ +{ + "class" : { + }, + "instance" : { + "aboutToStyle:" : "fn 3/13/2017 17:18", + "addModelItemsToWindowMenu:" : "fn 3/14/2017 00:45", + "buildCodePaneWith:" : "fn 3/13/2017 17:12", + "currentLanguageSymbol" : "fn 3/14/2017 00:51", + "defaultBrowserTitle" : "fn 3/14/2017 11:16", + "defaultStylerClass" : "fn 3/13/2017 17:12", + "defineMessageFrom:notifying:" : "fn 3/7/2017 11:42", + "doItReceiver" : "fn 3/8/2017 11:32", + "isForeign" : "fn 3/13/2017 17:45", + "isPython" : "fn 3/13/2017 17:45", + "isRuby" : "fn 3/13/2017 17:46", + "isSmalltalk" : "fn 3/14/2017 00:57", + "labelString" : "fn 3/14/2017 00:46", + "languageSymbol" : "fn 3/14/2017 00:59", + "languageSymbol:" : "fn 3/14/2017 00:42", + "selectLanguage:" : "fn 3/14/2017 00:56", + "selectedMessage" : "fn 3/7/2017 11:31", + "systemCategoryList" : "fn 3/14/2017 00:58", + "validateMessageSource:forSelector:inClass:" : "fn 3/13/2017 17:46" } } diff --git a/repository/Python-Tools.package/PythonBrowser.class/properties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/properties.json similarity index 61% rename from repository/Python-Tools.package/PythonBrowser.class/properties.json rename to repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/properties.json index e1df1f9a..c21b9b26 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/properties.json @@ -1,13 +1,13 @@ { - "category" : "Python-Tools", + "category" : "ForeignLanguage-Tools", "classinstvars" : [ ], "classvars" : [ ], "commentStamp" : "", "instvars" : [ - ], - "name" : "PythonBrowser", + "languageSymbol" ], + "name" : "ForeignLanguageBrowser", "pools" : [ ], "super" : "Browser", diff --git a/repository/Python-Tools.package/PythonDebugger.class/README.md b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/README.md similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/README.md rename to repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/README.md diff --git a/repository/Python-Tools.package/PythonContextVariablesInspector.class/instance/selection.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st similarity index 68% rename from repository/Python-Tools.package/PythonContextVariablesInspector.class/instance/selection.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st index 5473cb89..f348be95 100644 --- a/repository/Python-Tools.package/PythonContextVariablesInspector.class/instance/selection.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st @@ -5,4 +5,6 @@ selection selectionIndex = 1 ifTrue: [^ object ]. selectionIndex = 2 ifTrue: [^ object symbolic]. selectionIndex = 3 ifTrue: [^ object headerDescription]. - ^ object pyFrame f_locals values at: selectionIndex - 3 \ No newline at end of file + object isPython ifTrue: [ + ^ object foreignFrame f_locals values at: selectionIndex - 3]. + ^ 'Unexpected selection' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json new file mode 100644 index 00000000..5925e6fb --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "selection" : "fn 3/14/2017 01:28" } } diff --git a/repository/Python-Tools.package/PythonContextVariablesInspector.class/properties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/properties.json similarity index 65% rename from repository/Python-Tools.package/PythonContextVariablesInspector.class/properties.json rename to repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/properties.json index b83558bc..f11aed99 100644 --- a/repository/Python-Tools.package/PythonContextVariablesInspector.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Python-Tools", + "category" : "ForeignLanguage-Tools", "classinstvars" : [ ], "classvars" : [ @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "PythonContextVariablesInspector", + "name" : "ForeignLanguageContextVariablesInspector", "pools" : [ ], "super" : "ContextVariablesInspector", diff --git a/repository/Python-Tools.package/PythonInspector.class/README.md b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/README.md similarity index 100% rename from repository/Python-Tools.package/PythonInspector.class/README.md rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/README.md diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/exploreFrames.st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/exploreFrames.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/exploreFrames.st diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/filterPySource.lineno..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/filterPySource.lineno..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/filterPySource.lineno..st diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getContentsOf..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/getContentsOf..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getContentsOf..st diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getPySource..st similarity index 59% rename from repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getPySource..st index 458970b6..8d81f66a 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/getPySource..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getPySource..st @@ -1,9 +1,9 @@ pySource getPySource: aContext | pyCode filename contents | - pyCode := aContext pyFrame f_code. - filename := pyCode co_filename. + pyCode := aContext foreignFrame f_code. + filename := pyCode co_filename asSmalltalk. filename = '' ifTrue: [ ^ 'Unable to get source.' ]. - contents := self getContentsOf: pyCode co_filename asSmalltalk. + contents := self getContentsOf: filename. ^ self filterPySource: contents lineno: pyCode co_firstlineno asSmalltalk \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getSignature..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/getSignature..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getSignature..st diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indent.by..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/indent.by..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indent.by..st diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indentSize..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/indentSize..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indentSize..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/newForeignContext..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/newForeignContext..st new file mode 100644 index 00000000..2b1b2c72 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/newForeignContext..st @@ -0,0 +1,10 @@ +pyContext +newForeignContext: foreignFrame + | frame | + frame := ForeignLanguageMethodContext + sender: nil + receiver: PythonObject + method: (CompiledMethod newMethod: 2 header: 2) + arguments: #(). + frame foreignFrame: foreignFrame. + ^ frame \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/prependPythonContexts..st similarity index 75% rename from repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/prependPythonContexts..st index 0de21793..b42867cd 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/class/prependPythonContexts..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/prependPythonContexts..st @@ -5,10 +5,8 @@ prependPythonContexts: aContext currentPyFrame ifNil: [ ^ aContext ]. newFrames := OrderedCollection new. [ currentPyFrame notNone ] - whileTrue: [ | newCtx | - newCtx := self newPyContext. - newCtx pyFrame: currentPyFrame. - newFrames add: newCtx. + whileTrue: [ + newFrames add: (self newForeignContext: currentPyFrame). currentPyFrame := currentPyFrame f_back ]. newFrames overlappingPairsDo: [ :a :b | a sender: b ]. diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/replaceInPySource.content.lineno..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/replaceInPySource.content.lineno..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/replaceInPySource.content.lineno..st diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/scopeEndIn.startingAt..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/scopeEndIn.startingAt..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/scopeEndIn.startingAt..st diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/setPySourceContent.content..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/class/setPySourceContent.content..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/setPySourceContent.content..st diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/aboutToStyle..st similarity index 55% rename from repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/aboutToStyle..st index 967390cc..48bc51ab 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/aboutToStyle..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/aboutToStyle..st @@ -1,8 +1,8 @@ overrides aboutToStyle: aStyler self isModeStyleable ifFalse: [^false]. - self hasPyContextSelected ifFalse: [^ super aboutToStyle: aStyler]. + self selectedContext isForeign ifFalse: [^ super aboutToStyle: aStyler]. aStyler classOrMetaClass: self selectedClassOrMetaClass; - isPythonCode: self hasPyContextSelected. + languageSymbol: self languageSymbol. ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/buildCodePaneWith..st similarity index 95% rename from repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/buildCodePaneWith..st index 983700ae..f9a50a5b 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/buildCodePaneWith..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/buildCodePaneWith..st @@ -22,7 +22,7 @@ buildCodePaneWith: builder selection: #contentsSelection; menu: #codePaneMenu:shifted:; frame: self textFrame; - stylerClass: PythonTextStyler. + stylerClass: ForeignLanguageTextStyler. top children add: textSpec. self wantsAnnotationPane ifTrue: [ diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/contents.notifying..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st similarity index 55% rename from repository/Python-Tools.package/PythonDebugger.class/instance/contents.notifying..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st index a5466138..d43ad0a9 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/contents.notifying..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st @@ -2,8 +2,8 @@ overrides contents: aText notifying: aController | ctx | ctx := self selectedContext. - ctx isPython ifFalse: [^ super contents: aText notifying: aController]. - self class setPySourceContent: ctx pyFrame f_code content: aText asString. + ctx isForeign ifFalse: [^ super contents: aText notifying: aController]. + self class setPySourceContent: ctx foreignFrame f_code content: aText asString. Python restartFrame: ctx pyFrame with: aText asString withUnixLineEndings. contents := aText. ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/contextForStack..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contextForStack..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/instance/contextForStack..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contextForStack..st diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/defaultStylerClass.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/defaultStylerClass.st similarity index 50% rename from repository/Python-Tools.package/PythonBrowser.class/instance/defaultStylerClass.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/defaultStylerClass.st index df1fd220..82ec2d42 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/defaultStylerClass.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/defaultStylerClass.st @@ -1,3 +1,3 @@ overrides defaultStylerClass - ^ PythonTextStyler \ No newline at end of file + ^ ForeignLanguageTextStyler \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/expandStack.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st similarity index 51% rename from repository/Python-Tools.package/PythonDebugger.class/instance/expandStack.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st index fab69b10..2efb9325 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/expandStack.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st @@ -3,5 +3,5 @@ expandStack "A Notifier is being turned into a full debugger. Show a substantial amount of stack in the context pane." super expandStack. - receiverInspector := PythonInspector inspect: nil. - contextVariablesInspector := PythonContextVariablesInspector inspect: nil. \ No newline at end of file + receiverInspector := ForeignLanguageInspector inspect: nil. + contextVariablesInspector := ForeignLanguageContextVariablesInspector inspect: nil. \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/guessTypeForName..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/guessTypeForName..st new file mode 100644 index 00000000..ef40aa9c --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/guessTypeForName..st @@ -0,0 +1,4 @@ +overrides +guessTypeForName: aString + self selectedContext isForeign ifFalse: [ ^ super guessTypeForName: aString ]. + ^ nil \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isPython.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isPython.st new file mode 100644 index 00000000..ca5546ab --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isPython.st @@ -0,0 +1,3 @@ +overrides +isPython + ^ self languageSymbol = #Python \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isRuby.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isRuby.st new file mode 100644 index 00000000..f010f863 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isRuby.st @@ -0,0 +1,3 @@ +overrides +isRuby + ^ self languageSymbol = #Ruby \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/languageSymbol.st new file mode 100644 index 00000000..90eee1f4 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/languageSymbol.st @@ -0,0 +1,5 @@ +overrides +languageSymbol + ^ self selectedContext isForeign + ifTrue: [ self selectedContext languageSymbol ] + ifFalse: [ #Smalltalk ] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/messageIconAt..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st similarity index 68% rename from repository/Python-Tools.package/PythonDebugger.class/instance/messageIconAt..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st index cd681744..b6fef4e3 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/messageIconAt..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st @@ -4,6 +4,6 @@ messageIconAt: anIndex Browser showMessageIcons ifFalse: [^ nil]. context := contextStack at: anIndex. - context isPython - ifTrue: [ ^ ToolIcons iconNamed: #python ] + context isForeign + ifTrue: [ ^ ToolIcons iconNamed: context languageSymbol ] ifFalse: [ ^ super messageIconAt: anIndex ] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/pcRange.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st similarity index 71% rename from repository/Python-Tools.package/PythonDebugger.class/instance/pcRange.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st index d4352cc8..e91a7a86 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/pcRange.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st @@ -2,5 +2,5 @@ overrides pcRange "Answer the indices in the source code for the method corresponding to the selected context's program counter value." - self hasPyContextSelected ifFalse: [ ^ super pcRange ]. + self selectedContext isForeign ifFalse: [ ^ super pcRange ]. ^ self pyPCRange \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/process.controller.context..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/process.controller.context..st similarity index 100% rename from repository/Python-Tools.package/PythonDebugger.class/instance/process.controller.context..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/process.controller.context..st diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/pyPCRange.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pyPCRange.st similarity index 88% rename from repository/Python-Tools.package/PythonDebugger.class/instance/pyPCRange.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pyPCRange.st index fac9b7be..e3f7cf1c 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/pyPCRange.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pyPCRange.st @@ -1,7 +1,7 @@ overrides pyPCRange | pyFrame relativeLine lineCount | - pyFrame := self selectedContext pyFrame. + pyFrame := self selectedContext foreignFrame. relativeLine := pyFrame f_lineno asSmalltalk - pyFrame f_code co_firstlineno asSmalltalk. lineCount := 0. (self class getPySource: self selectedContext) lineIndicesDo: [:start :endWithoutDelimiters :end | diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/selectedMessage.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st similarity index 74% rename from repository/Python-Tools.package/PythonDebugger.class/instance/selectedMessage.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st index 2e7b8478..1626981d 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/selectedMessage.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st @@ -3,5 +3,5 @@ selectedMessage "Answer the source code of the currently selected context." | aContext | aContext := self selectedContext. - aContext isPython ifFalse: [ ^ super selectedMessage ]. + aContext isForeign ifFalse: [ ^ super selectedMessage ]. ^ self class getPySource: aContext \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json new file mode 100644 index 00000000..9c0a4180 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json @@ -0,0 +1,30 @@ +{ + "class" : { + "exploreFrames" : "fn 3/9/2017 15:20", + "filterPySource:lineno:" : "fn 2/2/2017 00:01", + "getContentsOf:" : "fn 2/1/2017 22:37", + "getPySource:" : "fn 3/14/2017 01:28", + "getSignature:" : "fn 3/6/2017 10:25", + "indent:by:" : "fn 2/1/2017 22:41", + "indentSize:" : "fn 2/1/2017 22:36", + "newForeignContext:" : "fn 3/14/2017 01:34", + "prependPythonContexts:" : "fn 3/14/2017 01:34", + "replaceInPySource:content:lineno:" : "fn 2/2/2017 00:05", + "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", + "setPySourceContent:content:" : "fn 3/6/2017 10:26" }, + "instance" : { + "aboutToStyle:" : "fn 3/14/2017 01:31", + "buildCodePaneWith:" : "fn 3/13/2017 17:12", + "contents:notifying:" : "fn 3/14/2017 01:29", + "contextForStack:" : "fn 2/21/2017 12:48", + "defaultStylerClass" : "fn 3/13/2017 17:12", + "expandStack" : "fn 3/13/2017 17:54", + "guessTypeForName:" : "fn 3/14/2017 01:31", + "isPython" : "fn 3/14/2017 01:33", + "isRuby" : "fn 3/14/2017 01:33", + "languageSymbol" : "fn 3/14/2017 01:32", + "messageIconAt:" : "fn 3/14/2017 01:29", + "pcRange" : "fn 3/14/2017 01:31", + "process:controller:context:" : "fn 1/16/2017 19:34", + "pyPCRange" : "fn 3/14/2017 01:28", + "selectedMessage" : "fn 3/14/2017 01:29" } } diff --git a/repository/Python-Tools.package/PythonDebugger.class/properties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/properties.json similarity index 67% rename from repository/Python-Tools.package/PythonDebugger.class/properties.json rename to repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/properties.json index 0f4008b7..80dc623b 100644 --- a/repository/Python-Tools.package/PythonDebugger.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Python-Tools", + "category" : "ForeignLanguage-Tools", "classinstvars" : [ ], "classvars" : [ @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "PythonDebugger", + "name" : "ForeignLanguageDebugger", "pools" : [ ], "super" : "Debugger", diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/README.md b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/README.md similarity index 100% rename from repository/Python-Tools.package/PythonObjectExplorer.class/README.md rename to repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/README.md diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/aboutToStyle..st similarity index 65% rename from repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/aboutToStyle..st index cc8803d3..c72354ef 100644 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/aboutToStyle..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/aboutToStyle..st @@ -1,5 +1,5 @@ overrides aboutToStyle: aStyler (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. - aStyler isPythonCode: self hasPyCodeSelected. + aStyler languageSymbol: object languageSymbol. ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/buildCodePaneWith..st similarity index 87% rename from repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/buildCodePaneWith..st index 4c4970bb..04625704 100644 --- a/repository/Python-Tools.package/PythonInspector.class/instance/buildCodePaneWith..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/buildCodePaneWith..st @@ -10,5 +10,5 @@ buildCodePaneWith: builder selection: #contentsSelection; menu: #codePaneMenu:shifted:; askBeforeDiscardingEdits: false; - stylerClass: PythonTextStyler. + stylerClass: ForeignLanguageTextStyler. ^textSpec \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/contentsIsString.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/contentsIsString.st similarity index 100% rename from repository/Python-Tools.package/PythonInspector.class/instance/contentsIsString.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/contentsIsString.st diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/fieldList.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/fieldList.st similarity index 69% rename from repository/Python-Tools.package/PythonInspector.class/instance/fieldList.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/fieldList.st index 51edeae1..baa9233f 100644 --- a/repository/Python-Tools.package/PythonInspector.class/instance/fieldList.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/fieldList.st @@ -4,5 +4,5 @@ fieldList | keys | keys := OrderedCollection new. keys add: 'self'. - keys addAll: object allAttributes. + object isForeign ifTrue: [ keys addAll: object allInstVarNames ]. ^ keys \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/selection.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/selection.st similarity index 64% rename from repository/Python-Tools.package/PythonInspector.class/instance/selection.st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/selection.st index 1d9e117d..623ab4fe 100644 --- a/repository/Python-Tools.package/PythonInspector.class/instance/selection.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/selection.st @@ -2,8 +2,8 @@ overrides selection "The receiver has a list of variables of its inspected object. One of these is selected. Answer the value of the selected variable." - | attrName | selectionIndex = 0 ifTrue: [^ '']. selectionIndex = 1 ifTrue: [^ object]. - attrName := object allAttributes at: selectionIndex - 1. - ^ Python builtins getattr: object attrName: attrName. \ No newline at end of file + object isForeign ifTrue: [ + ^ object instVarAt: selectionIndex - 1 ]. + ^ super selection \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json new file mode 100644 index 00000000..ceed638c --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json @@ -0,0 +1,9 @@ +{ + "class" : { + }, + "instance" : { + "aboutToStyle:" : "fn 3/13/2017 17:35", + "buildCodePaneWith:" : "fn 3/13/2017 17:12", + "contentsIsString" : "fn 12/23/2016 11:11", + "fieldList" : "fn 3/14/2017 12:01", + "selection" : "fn 3/14/2017 12:08" } } diff --git a/repository/Python-Tools.package/PythonInspector.class/properties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/properties.json similarity index 67% rename from repository/Python-Tools.package/PythonInspector.class/properties.json rename to repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/properties.json index 4896a3e7..8a500f9b 100644 --- a/repository/Python-Tools.package/PythonInspector.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Python-Tools", + "category" : "ForeignLanguage-Tools", "classinstvars" : [ ], "classvars" : [ @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "PythonInspector", + "name" : "ForeignLanguageInspector", "pools" : [ ], "super" : "Inspector", diff --git a/repository/Python-Tools.package/PythonToolSet.class/README.md b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/README.md similarity index 100% rename from repository/Python-Tools.package/PythonToolSet.class/README.md rename to repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/README.md diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/aboutToStyle..st similarity index 65% rename from repository/Python-Tools.package/PythonObjectExplorer.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/aboutToStyle..st index e61635cb..3635f9aa 100644 --- a/repository/Python-Tools.package/PythonObjectExplorer.class/instance/aboutToStyle..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/aboutToStyle..st @@ -1,5 +1,5 @@ as yet unclassified aboutToStyle: aStyler (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. - aStyler isPythonCode: true. + aStyler languageSymbol: self object languageSymbol. ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/instance/buildWith..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/buildWith..st similarity index 97% rename from repository/Python-Tools.package/PythonObjectExplorer.class/instance/buildWith..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/buildWith..st index 4fad1914..d809cd04 100644 --- a/repository/Python-Tools.package/PythonObjectExplorer.class/instance/buildWith..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/buildWith..st @@ -38,7 +38,7 @@ buildWith: builder menu: #codePaneMenu:shifted:; help: 'Evaluate expressions for the current tree selection...' translated; frame: (LayoutFrame fractions: (0@0.71 corner: 1@1) offsets: (0@0 corner: buttonOffset negated@0)); - stylerClass: PythonTextStyler. + stylerClass: ForeignLanguageTextStyler. windowSpec children add: textSpec. buttonSpec := builder pluggableButtonSpec new diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/methodProperties.json new file mode 100644 index 00000000..4abd3da6 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "aboutToStyle:" : "fn 3/13/2017 17:42", + "buildWith:" : "fn 3/13/2017 17:12" } } diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/properties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/properties.json similarity index 66% rename from repository/Python-Tools.package/PythonObjectExplorer.class/properties.json rename to repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/properties.json index b9060f5f..1dd1e9e3 100644 --- a/repository/Python-Tools.package/PythonObjectExplorer.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Python-Tools", + "category" : "ForeignLanguage-Tools", "classinstvars" : [ ], "classvars" : [ @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "PythonObjectExplorer", + "name" : "ForeignLanguageObjectExplorer", "pools" : [ ], "super" : "ObjectExplorer", diff --git a/repository/Python-Tools.package/PythonWorkspace.class/README.md b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/README.md similarity index 100% rename from repository/Python-Tools.package/PythonWorkspace.class/README.md rename to repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/README.md diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/open.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/open.st new file mode 100644 index 00000000..3227c1ce --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/open.st @@ -0,0 +1,3 @@ +as yet unclassified +open + ^ self new openLabel: 'Smalltalk ', self windowTitlePrefix \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/windowTitlePrefix.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/windowTitlePrefix.st new file mode 100644 index 00000000..321afdfe --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/windowTitlePrefix.st @@ -0,0 +1,3 @@ +as yet unclassified +windowTitlePrefix + ^ 'Workspace' \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/aboutToStyle..st similarity index 66% rename from repository/Python-Tools.package/PythonInspector.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/aboutToStyle..st index 08799177..45f08745 100644 --- a/repository/Python-Tools.package/PythonInspector.class/instance/aboutToStyle..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/aboutToStyle..st @@ -1,5 +1,5 @@ overrides aboutToStyle: aStyler (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. - aStyler isPythonCode: true. + aStyler languageSymbol: self languageSymbol. ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st new file mode 100644 index 00000000..3b5f792d --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st @@ -0,0 +1,12 @@ +overrides +addModelItemsToWindowMenu: aMenu + aMenu addLine. + ForeignLanguage availableLanguages do: [:ea | + aMenu + add: 'select ', ea asString ,'...' + target: self + selector: #selectLanguage: + argument: ea ]. + aMenu addLine. + + super addModelItemsToWindowMenu: aMenu \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/buildCodePaneWith..st similarity index 86% rename from repository/Python-Tools.package/PythonWorkspace.class/instance/buildCodePaneWith..st rename to repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/buildCodePaneWith..st index 4af1a373..e94e198e 100644 --- a/repository/Python-Tools.package/PythonWorkspace.class/instance/buildCodePaneWith..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/buildCodePaneWith..st @@ -8,5 +8,5 @@ buildCodePaneWith: builder setText: #contents:notifying:; selection: #contentsSelection; menu: #codePaneMenu:shifted:; - stylerClass: PythonTextStyler. + stylerClass: ForeignLanguageTextStyler. ^textSpec \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st new file mode 100644 index 00000000..a461a993 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st @@ -0,0 +1,6 @@ +execution +evaluateExpression: selection + self isForeign ifFalse: [ ^ Compiler evaluate: selection asString ]. + Smalltalk at: self languageSymbol ifPresent: [ :cls | + (cls respondsTo: #evaluateExpression:) + ifTrue: [ ^ cls evaluateExpression: selection ] ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/isForeign.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/isForeign.st new file mode 100644 index 00000000..14435f59 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/isForeign.st @@ -0,0 +1,3 @@ +foreign-language-support +isForeign + ^ self languageSymbol ~~ #Smalltalk \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st new file mode 100644 index 00000000..c6cecb5b --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st @@ -0,0 +1,4 @@ +foreign-language-support +labelString + ^ self languageSymbol asString, ' ', self class windowTitlePrefix + \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol..st new file mode 100644 index 00000000..42a2cf87 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol..st @@ -0,0 +1,3 @@ +accessing +languageSymbol: anObject + languageSymbol := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol.st new file mode 100644 index 00000000..556e7f19 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol.st @@ -0,0 +1,3 @@ +accessing +languageSymbol + ^ languageSymbol ifNil: [ #Smalltalk ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/selectLanguage..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/selectLanguage..st new file mode 100644 index 00000000..077e6cdd --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/selectLanguage..st @@ -0,0 +1,4 @@ +foreign-language-support +selectLanguage: aLanguageSymbol + self languageSymbol: aLanguageSymbol. + self changed: #relabel \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json new file mode 100644 index 00000000..767ecf4a --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json @@ -0,0 +1,14 @@ +{ + "class" : { + "open" : "fn 3/14/2017 00:49", + "windowTitlePrefix" : "fn 3/14/2017 00:48" }, + "instance" : { + "aboutToStyle:" : "fn 3/13/2017 17:51", + "addModelItemsToWindowMenu:" : "fn 3/14/2017 00:47", + "buildCodePaneWith:" : "fn 3/13/2017 17:51", + "evaluateExpression:" : "fn 3/14/2017 18:31", + "isForeign" : "fn 3/14/2017 18:32", + "labelString" : "fn 3/14/2017 00:49", + "languageSymbol" : "fn 3/14/2017 01:00", + "languageSymbol:" : "fn 3/13/2017 18:02", + "selectLanguage:" : "fn 3/14/2017 00:48" } } diff --git a/repository/Python-Tools.package/PythonWorkspace.class/properties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json similarity index 60% rename from repository/Python-Tools.package/PythonWorkspace.class/properties.json rename to repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json index 2eea5a8d..026c98a8 100644 --- a/repository/Python-Tools.package/PythonWorkspace.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json @@ -1,13 +1,13 @@ { - "category" : "Python-Tools", + "category" : "ForeignLanguage-Tools", "classinstvars" : [ ], "classvars" : [ ], "commentStamp" : "", "instvars" : [ - ], - "name" : "PythonWorkspace", + "languageSymbol" ], + "name" : "ForeignLanguageWorkspace", "pools" : [ ], "super" : "Workspace", diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/categories.st b/repository/ForeignLanguage-Tools.package/monticello.meta/categories.st new file mode 100644 index 00000000..c2c04d68 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'ForeignLanguage-Tools'! diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/initializers.st b/repository/ForeignLanguage-Tools.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/package b/repository/ForeignLanguage-Tools.package/monticello.meta/package new file mode 100644 index 00000000..0037d5d7 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'ForeignLanguage-Tools') \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/version b/repository/ForeignLanguage-Tools.package/monticello.meta/version new file mode 100644 index 00000000..68fb8a11 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/properties.json b/repository/ForeignLanguage-Tools.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/properties.json @@ -0,0 +1,2 @@ +{ + } diff --git a/repository/Python-Core.package/Python.class/class/breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/breakOnExceptions..st new file mode 100644 index 00000000..a3f8ae15 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/breakOnExceptions..st @@ -0,0 +1,3 @@ +helpers +breakOnExceptions: aBool + BreakOnExceptions := aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/breakOnExceptions.st b/repository/Python-Core.package/Python.class/class/breakOnExceptions.st new file mode 100644 index 00000000..dbfaff6f --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/breakOnExceptions.st @@ -0,0 +1,3 @@ +helpers +breakOnExceptions + ^ BreakOnExceptions ifNil: [ BreakOnExceptions := true ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/checkForException..st b/repository/Python-Core.package/Python.class/class/checkForException..st new file mode 100644 index 00000000..7ae05ffe --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/checkForException..st @@ -0,0 +1,7 @@ +special methods +checkForException: aPyLanguage + Smalltalk isHeadless ifTrue: [ ^ self ]. + (self primLastError: aPyLanguage) ifNotNil: [ :e | + ForeignLanguageException new + action: [ self openDebuggerWithPythonFrames: e ]; + signal ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/eval..st b/repository/Python-Core.package/Python.class/class/eval..st index 7da4cb30..51f948d0 100644 --- a/repository/Python-Core.package/Python.class/class/eval..st +++ b/repository/Python-Core.package/Python.class/class/eval..st @@ -1,3 +1,3 @@ execution eval: aString - ^ self primEval: aString filename: '' cmd: 'eval' \ No newline at end of file + ^ self eval: aString breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/eval.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/eval.breakOnExceptions..st new file mode 100644 index 00000000..33ebe9f0 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/eval.breakOnExceptions..st @@ -0,0 +1,7 @@ +execution +eval: aString breakOnExceptions: aBool + ^ self + primEval: aString + filename: '' + cmd: 'eval' + breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/evaluateExpression..st b/repository/Python-Core.package/Python.class/class/evaluateExpression..st new file mode 100644 index 00000000..81dc5a1d --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression..st @@ -0,0 +1,4 @@ +execution +evaluateExpression: selection + ^ Python prun: selection asString + \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/exec..st b/repository/Python-Core.package/Python.class/class/exec..st index 8002b84f..ddc668a7 100644 --- a/repository/Python-Core.package/Python.class/class/exec..st +++ b/repository/Python-Core.package/Python.class/class/exec..st @@ -1,3 +1,3 @@ execution exec: aString - ^ self primEval: aString filename: '' cmd: 'exec' \ No newline at end of file + ^ self exec: aString breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/exec.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/exec.breakOnExceptions..st new file mode 100644 index 00000000..d32f414c --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/exec.breakOnExceptions..st @@ -0,0 +1,7 @@ +execution +exec: aString breakOnExceptions: aBool + ^ self + primEval: aString + filename: '' + cmd: 'exec' + breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/getSource..st b/repository/Python-Core.package/Python.class/class/getSource..st deleted file mode 100644 index 37d80f0a..00000000 --- a/repository/Python-Core.package/Python.class/class/getSource..st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -getSource: pyCode - self pyInspect getsource: pyCode \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/highlight..st b/repository/Python-Core.package/Python.class/class/highlight..st new file mode 100644 index 00000000..4cb4ff7b --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/highlight..st @@ -0,0 +1,3 @@ +styling +highlight: aText + ^ ForeignLanguageTextStyler highlightPython: aText \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/import..st b/repository/Python-Core.package/Python.class/class/import..st index 2a4bd7b3..527d8f35 100644 --- a/repository/Python-Core.package/Python.class/class/import..st +++ b/repository/Python-Core.package/Python.class/class/import..st @@ -1,3 +1,3 @@ helpers import: aModuleName - Python exec: 'import ', aModuleName \ No newline at end of file + Python exec: 'import ', aModuleName breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/import.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/import.breakOnExceptions..st new file mode 100644 index 00000000..dce1579b --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/import.breakOnExceptions..st @@ -0,0 +1,3 @@ +helpers +import: aModuleName breakOnExceptions: aBool + Python exec: 'import ', aModuleName breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/load..st b/repository/Python-Core.package/Python.class/class/load..st index 7e4d6aaf..e48bcd29 100644 --- a/repository/Python-Core.package/Python.class/class/load..st +++ b/repository/Python-Core.package/Python.class/class/load..st @@ -1,4 +1,3 @@ helpers load: aModuleName - self import: aModuleName. - ^ Python eval: aModuleName \ No newline at end of file + ^ self load: aModuleName breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/load.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/load.breakOnExceptions..st new file mode 100644 index 00000000..00d884f8 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/load.breakOnExceptions..st @@ -0,0 +1,4 @@ +helpers +load: aModuleName breakOnExceptions: aBool + self import: aModuleName breakOnExceptions: aBool. + ^ self fromObjectCache: aModuleName \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st b/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st index c263e7ac..e4e08a8a 100644 --- a/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st +++ b/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st @@ -8,9 +8,9 @@ openDebuggerWithPythonFrames: pyError resumeCtx := resumeCtx sender. resumeCtx ifNil: [ ^ self error: 'resumeCtx not found' ] ]. error := pyError asSmalltalk. - PythonDebugger + ForeignLanguage openOn: Processor activeProcess - context: (PythonDebugger prependPythonContexts: resumeCtx) + context: (ForeignLanguage prependPythonContexts: resumeCtx) label: error first, ': ', error second contents: nil fullView: true \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/peval..st b/repository/Python-Core.package/Python.class/class/peval..st index 7d75798a..33a00f0e 100644 --- a/repository/Python-Core.package/Python.class/class/peval..st +++ b/repository/Python-Core.package/Python.class/class/peval..st @@ -1,3 +1,7 @@ execution peval: aString - ^ self primEval: aString filename: (self persistPyCode: aString) cmd: 'eval' \ No newline at end of file + ^ self + primEval: aString + filename: (self persistPyCode: aString) + cmd: 'eval' + breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pexec..st b/repository/Python-Core.package/Python.class/class/pexec..st index fe3fb2df..93b9ca2d 100644 --- a/repository/Python-Core.package/Python.class/class/pexec..st +++ b/repository/Python-Core.package/Python.class/class/pexec..st @@ -1,3 +1,7 @@ execution pexec: aString - ^ self primEval: aString filename: (self persistPyCode: aString) cmd: 'exec' \ No newline at end of file + ^ self + primEval: aString + filename: (self persistPyCode: aString) + cmd: 'exec' + breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primBreakOnExceptions..st b/repository/Python-Core.package/Python.class/class/primBreakOnExceptions..st deleted file mode 100644 index cc295c68..00000000 --- a/repository/Python-Core.package/Python.class/class/primBreakOnExceptions..st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -primBreakOnExceptions: aBool - - self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primBreakOnExceptions.st b/repository/Python-Core.package/Python.class/class/primBreakOnExceptions.st deleted file mode 100644 index f15a4e16..00000000 --- a/repository/Python-Core.package/Python.class/class/primBreakOnExceptions.st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -primBreakOnExceptions - - self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primEval.filename.cmd..st b/repository/Python-Core.package/Python.class/class/primEval.filename.cmd..st deleted file mode 100644 index 19e70782..00000000 --- a/repository/Python-Core.package/Python.class/class/primEval.filename.cmd..st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primEval: aString filename: aFilename cmd: aEvalOrExec - - self primitiveFailed. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primEval.cmd..st b/repository/Python-Core.package/Python.class/class/primEval.filename.cmd.breakOnExceptions..st similarity index 51% rename from repository/Python-Core.package/Python.class/class/primEval.cmd..st rename to repository/Python-Core.package/Python.class/class/primEval.filename.cmd.breakOnExceptions..st index 2fcfb210..8e61c432 100644 --- a/repository/Python-Core.package/Python.class/class/primEval.cmd..st +++ b/repository/Python-Core.package/Python.class/class/primEval.filename.cmd.breakOnExceptions..st @@ -1,4 +1,4 @@ system primitives -primEval: aString cmd: aEvalOrExec +primEval: aString filename: aFilename cmd: aEvalOrExec breakOnExceptions: aBool self primitiveFailed. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primGetTopFrame.st b/repository/Python-Core.package/Python.class/class/primGetTopFrame.st index b4d5b440..47d6a0f4 100644 --- a/repository/Python-Core.package/Python.class/class/primGetTopFrame.st +++ b/repository/Python-Core.package/Python.class/class/primGetTopFrame.st @@ -1,5 +1,4 @@ experimental primGetTopFrame - self primitiveFailed. - \ No newline at end of file + self primitiveFailed. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primLastError.st b/repository/Python-Core.package/Python.class/class/primLastError..st similarity index 73% rename from repository/Python-Core.package/Python.class/class/primLastError.st rename to repository/Python-Core.package/Python.class/class/primLastError..st index 5f036a85..2336645d 100644 --- a/repository/Python-Core.package/Python.class/class/primLastError.st +++ b/repository/Python-Core.package/Python.class/class/primLastError..st @@ -1,4 +1,4 @@ system primitives -primLastError +primLastError: aPyLanguage ^ nil \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primPythonAt..st b/repository/Python-Core.package/Python.class/class/primPythonAt..st deleted file mode 100644 index dedd6673..00000000 --- a/repository/Python-Core.package/Python.class/class/primPythonAt..st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -primPythonAt: aKeyOrIndex - - self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primResume..st b/repository/Python-Core.package/Python.class/class/primResume..st index 179b7983..fcbf1737 100644 --- a/repository/Python-Core.package/Python.class/class/primResume..st +++ b/repository/Python-Core.package/Python.class/class/primResume..st @@ -1,4 +1,4 @@ experimental -primResume: aPyRunner +primResume: aPyLanguage self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pyInspect.st b/repository/Python-Core.package/Python.class/class/pyInspect.st deleted file mode 100644 index 24d47cf3..00000000 --- a/repository/Python-Core.package/Python.class/class/pyInspect.st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -pyInspect - self eval: 'inspect' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pygments.st b/repository/Python-Core.package/Python.class/class/pygments.st index c95191ec..837a167b 100644 --- a/repository/Python-Core.package/Python.class/class/pygments.st +++ b/repository/Python-Core.package/Python.class/class/pygments.st @@ -1,3 +1,3 @@ special objects pygments - ^ self eval: 'pygments' \ No newline at end of file + ^ self fromObjectCache: 'pygments' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/re.st b/repository/Python-Core.package/Python.class/class/re.st new file mode 100644 index 00000000..db7fd8c0 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/re.st @@ -0,0 +1,3 @@ +special objects +re + ^ self fromObjectCache: 're' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/resume..st b/repository/Python-Core.package/Python.class/class/resume..st index 113de556..8c362fea 100644 --- a/repository/Python-Core.package/Python.class/class/resume..st +++ b/repository/Python-Core.package/Python.class/class/resume..st @@ -1,11 +1,7 @@ special methods -resume: aPyRunner +resume: aPyLanguage "Magic method that is called by vm (cached in vm)" Processor yield. - [ ^ self primResume: aPyRunner ] on: Error do: [ - Smalltalk isHeadless ifFalse: [ - self primLastError ifNotNil: [ :e | - ForeignLanguageException new - action: [ self openDebuggerWithPythonFrames: e ]; - signal ] ]. - ^ self resume: aPyRunner ] \ No newline at end of file + [ ^ self primResume: aPyLanguage ] on: Error do: [ + self checkForException: aPyLanguage. + ^ self resume: aPyLanguage ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPygments.st b/repository/Python-Core.package/Python.class/class/setUpPygments.st index 7c01f6f2..0bed3231 100644 --- a/repository/Python-Core.package/Python.class/class/setUpPygments.st +++ b/repository/Python-Core.package/Python.class/class/setUpPygments.st @@ -1,19 +1,21 @@ overrides setUpPygments - | breakOnExceptions | - breakOnExceptions := self primBreakOnExceptions. - self primBreakOnExceptions: false. + self load: 'pygments' breakOnExceptions: false. self exec: ' -import re -import pygments -import pygments.lexers -import pygments.formatters -_pygments_lexer_python = pygments.lexers.get_lexer_by_name( - "python", encoding="utf-8", stripnl=False, ensurenl=False) -_pygments_lexer_smalltalk = pygments.lexers.get_lexer_by_name( - "smalltalk", encoding="utf-8", stripnl=False, ensurenl=False) -_pygments_formatter = pygments.formatters.get_formatter_by_name( - "html", encoding="utf-8", style="colorful", nowrap=True, noclasses=True, lineseparator="
") -def _pygments_highlight(code): - return re.sub("
$", "", pygments.highlight(code, _pygments_lexer_python, _pygments_formatter))'. - self primBreakOnExceptions: breakOnExceptions. \ No newline at end of file +try: + import pygments.lexers + import pygments.formatters + _pygments_lexer_python = pygments.lexers.get_lexer_by_name( + "python", encoding="utf-8", stripnl=False, ensurenl=False) + _pygments_lexer_ruby = pygments.lexers.get_lexer_by_name( + "ruby", encoding="utf-8", stripnl=False, ensurenl=False) + _pygments_lexer_smalltalk = pygments.lexers.get_lexer_by_name( + "smalltalk", encoding="utf-8", stripnl=False, ensurenl=False) + _pygments_formatter = pygments.formatters.get_formatter_by_name( + "html", encoding="utf-8", style="colorful", nowrap=True, noclasses=True, lineseparator="
") + def _pygments_highlight(code, lexer=_pygments_lexer_python): + return re.sub("
$", "", pygments.highlight(code, lexer, _pygments_formatter)) +except ImportError: + def _pygments_highlight(code): + return code +' breakOnExceptions: false. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st b/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st index 3bebb421..e1c7c645 100644 --- a/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st +++ b/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st @@ -1,5 +1,6 @@ overrides setUpPythonEnvironment + self load: 'sys'. self exec: ' import sys sys.path = ["', Smalltalk image imagePath, '", @@ -17,4 +18,5 @@ def _isExpression(x): return True except SyntaxError: return False'. + self load: 're'. self setUpPygments \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/single..st b/repository/Python-Core.package/Python.class/class/single..st index 7cde647f..e73ef268 100644 --- a/repository/Python-Core.package/Python.class/class/single..st +++ b/repository/Python-Core.package/Python.class/class/single..st @@ -1,3 +1,7 @@ helpers single: aString - ^ self primEval: aString filename: '' cmd: 'single' \ No newline at end of file + ^ self + primEval: aString + filename: '' + cmd: 'single' + breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/sourceCodeTemplate.st b/repository/Python-Core.package/Python.class/class/sourceCodeTemplate.st new file mode 100644 index 00000000..1c9c9b4a --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/sourceCodeTemplate.st @@ -0,0 +1,5 @@ +overrides +sourceCodeTemplate + + ^'def method(self, x): + return 2 * x' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/startUp..st b/repository/Python-Core.package/Python.class/class/startUp..st index 5059cb51..576d352b 100644 --- a/repository/Python-Core.package/Python.class/class/startUp..st +++ b/repository/Python-Core.package/Python.class/class/startUp..st @@ -1,7 +1,7 @@ overrides startUp: resuming self reset. - (resuming and: [ self vmSpeaksPython ]) + (resuming and: [ self vmSpeaksLanguage ]) ifTrue: [ self setUpPythonEnvironment. PythonObject pythonizeAll ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/sys.st b/repository/Python-Core.package/Python.class/class/sys.st new file mode 100644 index 00000000..c530da99 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/sys.st @@ -0,0 +1,3 @@ +special objects +sys + ^ self fromObjectCache: 'sys' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/vmSpeaksPython.st b/repository/Python-Core.package/Python.class/class/vmSpeaksLanguage.st similarity index 82% rename from repository/Python-Core.package/Python.class/class/vmSpeaksPython.st rename to repository/Python-Core.package/Python.class/class/vmSpeaksLanguage.st index 61bd766b..b105f92e 100644 --- a/repository/Python-Core.package/Python.class/class/vmSpeaksPython.st +++ b/repository/Python-Core.package/Python.class/class/vmSpeaksLanguage.st @@ -1,3 +1,3 @@ helpers -vmSpeaksPython +vmSpeaksLanguage ^ VMSpeaksPython ifNil: [ VMSpeaksPython := self basicVmSpeaksPython ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json index 58b4ece7..eb2f9110 100644 --- a/repository/Python-Core.package/Python.class/methodProperties.json +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -4,52 +4,58 @@ "None" : "fn 3/6/2017 10:13", "True" : "fn 3/6/2017 10:54", "basicVmSpeaksPython" : "fn 2/23/2017 20:59", + "breakOnExceptions" : "fn 3/11/2017 14:46", + "breakOnExceptions:" : "fn 3/11/2017 14:46", "builtins" : "fn 2/23/2017 18:34", + "checkForException:" : "fn 3/11/2017 19:23", "cmdFor:" : "fn 2/23/2017 21:36", - "eval:" : "fn 2/23/2017 21:10", + "eval:" : "fn 3/11/2017 18:47", + "eval:breakOnExceptions:" : "fn 3/11/2017 18:47", + "evaluateExpression:" : "fn 3/14/2017 18:31", "evaluatorClass" : "fn 12/22/2016 02:53", - "exec:" : "fn 2/23/2017 21:11", + "exec:" : "fn 3/11/2017 18:48", + "exec:breakOnExceptions:" : "fn 3/11/2017 18:47", "from:import:" : "fn 1/9/2017 20:54", "from:load:" : "fn 1/9/2017 20:55", "fromObjectCache:" : "fn 2/23/2017 18:40", - "getSource:" : "fn 1/29/2017 22:15", "globals" : "fn 2/26/2017 21:46", - "import:" : "fn 1/9/2017 20:54", + "highlight:" : "fn 3/14/2017 11:27", + "import:" : "fn 3/12/2017 02:47", + "import:breakOnExceptions:" : "fn 3/12/2017 02:47", "initialize" : "fn 3/6/2017 22:13", "isCallable:" : "fn 2/26/2017 21:45", "isExpression:" : "fn 2/26/2017 21:45", - "load:" : "fn 1/9/2017 20:54", + "load:" : "fn 3/12/2017 02:48", + "load:breakOnExceptions:" : "fn 3/12/2017 02:46", "locals" : "fn 2/26/2017 21:46", - "openDebuggerWithPythonFrames:" : "fn 3/8/2017 21:52", + "openDebuggerWithPythonFrames:" : "fn 3/14/2017 01:30", "persistPyCode:" : "fn 2/1/2017 12:46", - "peval:" : "fn 2/23/2017 21:12", - "pexec:" : "fn 2/23/2017 21:12", - "primBreakOnExceptions" : "fn 3/6/2017 07:43", - "primBreakOnExceptions:" : "fn 3/6/2017 07:43", - "primEval:cmd:" : "fn 2/2/2017 17:12", - "primEval:filename:cmd:" : "fn 2/1/2017 10:55", - "primGetTopFrame" : "fn 1/11/2017 11:19", - "primLastError" : "fn 1/28/2017 13:37", - "primPythonAt:" : "fn 2/25/2017 17:03", + "peval:" : "fn 3/11/2017 14:47", + "pexec:" : "fn 3/11/2017 14:47", + "primEval:filename:cmd:breakOnExceptions:" : "fn 3/11/2017 14:45", + "primGetTopFrame" : "fn 3/14/2017 22:23", + "primLastError:" : "fn 3/11/2017 14:48", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", - "primResume:" : "fn 3/8/2017 15:10", + "primResume:" : "fn 3/12/2017 14:54", "prun:" : "fn 2/23/2017 21:36", "pyFormatter" : "fn 3/6/2017 07:20", - "pyInspect" : "fn 1/29/2017 22:15", "pyLexerPython" : "fn 3/6/2017 19:05", "pyLexerSmalltalk" : "fn 3/6/2017 19:05", - "pygments" : "fn 3/6/2017 13:15", + "pygments" : "fn 3/9/2017 17:52", + "re" : "fn 3/9/2017 17:53", "reset" : "fn 2/23/2017 21:13", "restartFrame" : "fn 2/22/2017 10:21", "restartFrame:with:" : "fn 2/22/2017 14:14", "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", - "resume:" : "fn 3/9/2017 16:45", + "resume:" : "fn 3/11/2017 15:00", "run:" : "fn 2/23/2017 21:37", - "setUpPygments" : "fn 3/9/2017 16:03", - "setUpPythonEnvironment" : "fn 3/6/2017 07:11", - "single:" : "fn 2/1/2017 10:55", - "startUp:" : "fn 3/6/2017 09:47", + "setUpPygments" : "fn 3/13/2017 17:24", + "setUpPythonEnvironment" : "fn 3/9/2017 17:54", + "single:" : "fn 3/11/2017 14:47", + "sourceCodeTemplate" : "fn 3/14/2017 11:22", + "startUp:" : "fn 3/14/2017 11:32", + "sys" : "fn 3/9/2017 17:54", "type" : "fn 2/23/2017 18:34", - "vmSpeaksPython" : "fn 2/23/2017 21:00" }, + "vmSpeaksLanguage" : "fn 3/14/2017 11:31" }, "instance" : { } } diff --git a/repository/Python-Core.package/Python.class/properties.json b/repository/Python-Core.package/Python.class/properties.json index 0e364404..0d26c810 100644 --- a/repository/Python-Core.package/Python.class/properties.json +++ b/repository/Python-Core.package/Python.class/properties.json @@ -3,6 +3,7 @@ "classinstvars" : [ ], "classvars" : [ + "BreakOnExceptions", "ObjectCache", "VMSpeaksPython" ], "commentStamp" : "", @@ -11,5 +12,5 @@ "name" : "Python", "pools" : [ ], - "super" : "Object", + "super" : "ForeignLanguage", "type" : "normal" } diff --git a/repository/Python-Core.package/PythonCompiler.class/class/parserClass.st b/repository/Python-Core.package/PythonCompiler.class/class/parserClass.st index c571b1d0..b9883124 100644 --- a/repository/Python-Core.package/PythonCompiler.class/class/parserClass.st +++ b/repository/Python-Core.package/PythonCompiler.class/class/parserClass.st @@ -1,5 +1,5 @@ as yet unclassified parserClass - Python vmSpeaksPython ifFalse: [ ^ Parser ]. + Python vmSpeaksLanguage ifFalse: [ ^ Parser ]. ^ PythonParser "PythonParser" \ No newline at end of file diff --git a/repository/Python-Core.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st b/repository/Python-Core.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st index be949f5a..7038688b 100644 --- a/repository/Python-Core.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st +++ b/repository/Python-Core.package/PythonCompiler.class/instance/compile.in.notifying.ifFail..st @@ -1,4 +1,4 @@ as yet unclassified compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock - Python vmSpeaksPython ifTrue: [ self pythonCompile: textOrStream class: aClass ifFail: failBlock ]. + Python vmSpeaksLanguage ifTrue: [ self pythonCompile: textOrStream class: aClass ifFail: failBlock ]. ^ super compile: textOrStream in: aClass notifying: aRequestor ifFail: failBlock \ No newline at end of file diff --git a/repository/Python-Core.package/PythonCompiler.class/methodProperties.json b/repository/Python-Core.package/PythonCompiler.class/methodProperties.json index c6e2a48e..89027b42 100644 --- a/repository/Python-Core.package/PythonCompiler.class/methodProperties.json +++ b/repository/Python-Core.package/PythonCompiler.class/methodProperties.json @@ -1,8 +1,8 @@ { "class" : { "extractPySelector:" : "fn 12/19/2016 02:57", - "parserClass" : "fn 12/25/2016 15:08" }, + "parserClass" : "fn 3/14/2017 11:32" }, "instance" : { - "compile:in:notifying:ifFail:" : "fn 3/7/2017 10:02", + "compile:in:notifying:ifFail:" : "fn 3/14/2017 11:32", "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/24/2017 11:58", "pythonCompile:class:ifFail:" : "fn 12/19/2016 02:18" } } diff --git a/repository/Python-Core.package/PythonObject.class/class/allInstances.st b/repository/Python-Core.package/PythonObject.class/class/allInstances.st index 28f49cc5..7f5d5748 100644 --- a/repository/Python-Core.package/PythonObject.class/class/allInstances.st +++ b/repository/Python-Core.package/PythonObject.class/class/allInstances.st @@ -1,3 +1,4 @@ overrides allInstances - ^ Python eval: self name, '.instances.values()' \ No newline at end of file + ^ super allInstances" + ^ Python eval: self name, '.instances.values()'" \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/new.st b/repository/Python-Core.package/PythonObject.class/class/new.st index 3dfc8d49..c22bd4d7 100644 --- a/repository/Python-Core.package/PythonObject.class/class/new.st +++ b/repository/Python-Core.package/PythonObject.class/class/new.st @@ -1,5 +1,5 @@ overrides new - Python vmSpeaksPython ifFalse: [ ^ super new ]. + Python vmSpeaksLanguage ifFalse: [ ^ super new ]. ^ self withAll: #() \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/pythonize.instVars.clsVars..st b/repository/Python-Core.package/PythonObject.class/class/pythonize.instVars.clsVars..st index cb0a603b..70fbabe5 100644 --- a/repository/Python-Core.package/PythonObject.class/class/pythonize.instVars.clsVars..st +++ b/repository/Python-Core.package/PythonObject.class/class/pythonize.instVars.clsVars..st @@ -6,7 +6,7 @@ pythonize: t instVars: f clsVars: d initSignature := 'self'. instVars do: [ :ea | initSignature := initSignature, ', ', ea, '=None']. - pySuperclass := (self superclass = Object + pySuperclass := (self superclass = ForeignLanguageObject ifTrue: [ 'object' ] ifFalse: [ self superclass name asString ]). code := 'class ', t asString, '(', pySuperclass, '):', String cr. diff --git a/repository/Python-Core.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st b/repository/Python-Core.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st index 37fe112a..a261a652 100644 --- a/repository/Python-Core.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st +++ b/repository/Python-Core.package/PythonObject.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st @@ -1,4 +1,4 @@ as yet unclassified subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat - Python vmSpeaksPython ifTrue: [ self pythonize: t instVars: f clsVars: d ]. + Python vmSpeaksLanguage ifTrue: [ self pythonize: t instVars: f clsVars: d ]. ^ super subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/toolIconSelector..st b/repository/Python-Core.package/PythonObject.class/class/toolIconSelector..st index 1644aa1c..cee29824 100644 --- a/repository/Python-Core.package/PythonObject.class/class/toolIconSelector..st +++ b/repository/Python-Core.package/PythonObject.class/class/toolIconSelector..st @@ -2,4 +2,4 @@ overrides toolIconSelector: aSelector (self isMeta or: [(self pyMethodDict includesKey: aSelector) not]) ifTrue: [^ super toolIconSelector: aSelector]. - ^#python \ No newline at end of file + ^#Python \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st b/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st index c8f110e7..36b194a3 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st +++ b/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st @@ -1,3 +1,3 @@ overrides allInstVarNames - ^ self allAttributes \ No newline at end of file + ^ (Python builtins dir: self) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st b/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st deleted file mode 100644 index d63a8ce0..00000000 --- a/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -defaultLabelForInspector - "Answer the default label to be used for an Inspector window on the receiver." - self hasClass ifTrue: [ ^ self className, ': ', self asString ]. - ^ self asString \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/defaultTitleForInspector.st b/repository/Python-Core.package/PythonObject.class/instance/defaultTitleForInspector.st new file mode 100644 index 00000000..754968fc --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/defaultTitleForInspector.st @@ -0,0 +1,4 @@ +overrides +defaultTitleForInspector + self hasClass ifTrue: [ ^ self className, ': ', self asString ]. + ^ self asString \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/explore.st b/repository/Python-Core.package/PythonObject.class/instance/explore.st deleted file mode 100644 index 6aacfcbf..00000000 --- a/repository/Python-Core.package/PythonObject.class/instance/explore.st +++ /dev/null @@ -1,3 +0,0 @@ -inspector -explore - ^PythonToolSet explore: self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st b/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st index 3a67d6e8..be3b1a56 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st +++ b/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st @@ -1,6 +1,6 @@ explorer explorerContents - ^ self allAttributes asOrderedCollection collect: [ :attrName | | value | + ^ self allInstVarNames asOrderedCollection collect: [ :attrName | | value | value := Python builtins getattr: self attrName: attrName. ObjectExplorerWrapper with: value diff --git a/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st b/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st index ea5a3ba7..fd6853ca 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st +++ b/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st @@ -1,4 +1,4 @@ inspector hasContentsInExplorer - ^ self allAttributes notEmpty + ^ self allInstVarNames notEmpty diff --git a/repository/Python-Core.package/PythonObject.class/instance/inspectorClass.st b/repository/Python-Core.package/PythonObject.class/instance/inspectorClass.st deleted file mode 100644 index 54a02214..00000000 --- a/repository/Python-Core.package/PythonObject.class/instance/inspectorClass.st +++ /dev/null @@ -1,3 +0,0 @@ -inspector -inspectorClass - ^ PythonInspector \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st b/repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st new file mode 100644 index 00000000..eee386bc --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st @@ -0,0 +1,3 @@ +overrides +instVarNamed: aName + ^ Python builtins getattr: self attrName: aName \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st b/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st index b036cc1c..cf7e262a 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st +++ b/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st @@ -1,3 +1,3 @@ -overrides +helpers isKindOf: aClass ^ PythonObject inheritsFrom: aClass \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/isNone.st b/repository/Python-Core.package/PythonObject.class/instance/isNone.st index b578dff2..e0196449 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/isNone.st +++ b/repository/Python-Core.package/PythonObject.class/instance/isNone.st @@ -1,3 +1,3 @@ -overrides +helpers isNone ^ self == Python None \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/languageSymbol.st b/repository/Python-Core.package/PythonObject.class/instance/languageSymbol.st new file mode 100644 index 00000000..a102388f --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/languageSymbol.st @@ -0,0 +1,3 @@ +overrides +languageSymbol + ^ #Python \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/notNone.st b/repository/Python-Core.package/PythonObject.class/instance/notNone.st index 1e61cf67..72feedc3 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/notNone.st +++ b/repository/Python-Core.package/PythonObject.class/instance/notNone.st @@ -1,3 +1,3 @@ -overrides +helpers notNone ^ self isNone not \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st b/repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st index 6caeecb0..6dffa013 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st +++ b/repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st @@ -1,10 +1,3 @@ overrides variablesAndOffsetsDo: aBinaryBlock - "This is the interface between the compiler and a class's instance or field names. The - class should enumerate aBinaryBlock with the field definitions (with nil offsets) followed - by the instance variable name strings and their integer offsets (1-relative). The order is - important; names evaluated later will override the same names occurring earlier." - - "Only need to do instance variables here. CProtoObject introduces field definitions." - "Nothing to do here; ClassDescription introduces named instance variables" ^ self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/methodProperties.json b/repository/Python-Core.package/PythonObject.class/methodProperties.json index d9c1d8a1..e09e8646 100644 --- a/repository/Python-Core.package/PythonObject.class/methodProperties.json +++ b/repository/Python-Core.package/PythonObject.class/methodProperties.json @@ -1,47 +1,45 @@ { "class" : { - "allInstances" : "fn 12/23/2016 11:17", + "allInstances" : "fn 3/12/2017 19:20", "isPython" : "fn 3/7/2017 11:56", - "new" : "fn 12/19/2016 14:14", + "new" : "fn 3/14/2017 11:32", "nextID" : "fn 12/18/2016 23:45", "pyCompile:classified:notifying:" : "fn 3/7/2017 11:44", "pyMethodDict" : "fn 3/7/2017 10:24", "pythonize" : "fn 12/21/2016 00:15", - "pythonize:instVars:clsVars:" : "fn 12/23/2016 10:59", + "pythonize:instVars:clsVars:" : "fn 3/13/2017 10:53", "pythonizeAll" : "fn 3/6/2017 06:58", "sourceCodeAt:ifAbsent:" : "fn 3/7/2017 12:44", "sourceCodeTemplate" : "fn 3/7/2017 19:08", - "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 12/19/2016 14:05", - "toolIconSelector:" : "fn 3/7/2017 12:43", + "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 3/14/2017 11:32", + "toolIconSelector:" : "fn 3/14/2017 01:35", "withAll2:" : "fn 12/22/2016 15:19", "withAll3:" : "fn 12/21/2016 14:50", "withAll:" : "fn 12/22/2016 15:19" }, "instance" : { "allAttributes" : "fn 2/26/2017 21:35", - "allInstVarNames" : "fn 12/22/2016 23:20", + "allInstVarNames" : "fn 3/14/2017 12:01", "asSmalltalk" : "fn 2/26/2017 21:04", "at:" : "fn 2/26/2017 20:40", "at:put:" : "fn 2/26/2017 20:41", "class" : "fn 2/26/2017 21:41", "className" : "fn 2/26/2017 22:01", - "defaultLabelForInspector" : "fn 2/26/2017 21:54", - "environment" : "fn 12/22/2016 22:00", - "explore" : "fn 2/24/2017 14:51", - "explorerContents" : "fn 2/24/2017 14:55", + "defaultTitleForInspector" : "fn 3/14/2017 11:52", + "explorerContents" : "fn 3/14/2017 12:02", "hasAttribute:" : "fn 2/26/2017 21:41", "hasClass" : "fn 2/26/2017 21:52", - "hasContentsInExplorer" : "fn 12/22/2016 23:11", - "inspect" : "fn 12/22/2016 21:09", - "inspectorClass" : "fn 12/22/2016 21:16", + "hasContentsInExplorer" : "fn 3/14/2017 12:02", + "instVarNamed:" : "fn 3/14/2017 12:07", "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", "isClass" : "fn 2/26/2017 21:42", "isKindOf:" : "fn 12/25/2016 14:47", "isNone" : "fn 3/9/2017 15:18", "isPython" : "fn 2/10/2017 12:12", + "languageSymbol" : "fn 3/14/2017 00:50", "notNone" : "fn 3/9/2017 15:19", "printOn:" : "fn 3/6/2017 10:07", "pyDictKeys" : "fn 2/26/2017 21:42", "pyDictValues" : "fn 2/26/2017 21:42", "pyIdentifier" : "fn 1/18/2017 17:20", "respondsTo:" : "fn 12/22/2016 23:36", - "variablesAndOffsetsDo:" : "fn 12/22/2016 23:59" } } + "variablesAndOffsetsDo:" : "fn 3/12/2017 19:19" } } diff --git a/repository/Python-Core.package/PythonObject.class/properties.json b/repository/Python-Core.package/PythonObject.class/properties.json index a23b5e11..da309938 100644 --- a/repository/Python-Core.package/PythonObject.class/properties.json +++ b/repository/Python-Core.package/PythonObject.class/properties.json @@ -11,5 +11,5 @@ "name" : "PythonObject", "pools" : [ ], - "super" : "Object", + "super" : "ForeignLanguageObject", "type" : "normal" } diff --git a/repository/Python-Core.package/PythonTheme.class/README.md b/repository/Python-Core.package/PythonTheme.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Support.package/PythonTheme.class/class/addButtons..st b/repository/Python-Core.package/PythonTheme.class/class/addButtons..st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/addButtons..st rename to repository/Python-Core.package/PythonTheme.class/class/addButtons..st diff --git a/repository/Python-Support.package/PythonTheme.class/class/addDialogs..st b/repository/Python-Core.package/PythonTheme.class/class/addDialogs..st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/addDialogs..st rename to repository/Python-Core.package/PythonTheme.class/class/addDialogs..st diff --git a/repository/Python-Support.package/PythonTheme.class/class/addFonts..st b/repository/Python-Core.package/PythonTheme.class/class/addFonts..st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/addFonts..st rename to repository/Python-Core.package/PythonTheme.class/class/addFonts..st diff --git a/repository/Python-Support.package/PythonTheme.class/class/addMenusAndDockingBars..st b/repository/Python-Core.package/PythonTheme.class/class/addMenusAndDockingBars..st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/addMenusAndDockingBars..st rename to repository/Python-Core.package/PythonTheme.class/class/addMenusAndDockingBars..st diff --git a/repository/Python-Support.package/PythonTheme.class/class/addScrollables..st b/repository/Python-Core.package/PythonTheme.class/class/addScrollables..st similarity index 97% rename from repository/Python-Support.package/PythonTheme.class/class/addScrollables..st rename to repository/Python-Core.package/PythonTheme.class/class/addScrollables..st index ab98b1e2..76e2439c 100644 --- a/repository/Python-Support.package/PythonTheme.class/class/addScrollables..st +++ b/repository/Python-Core.package/PythonTheme.class/class/addScrollables..st @@ -66,6 +66,6 @@ addScrollables: theme set: #adornmentDiffEdit for: #PluggableTextMorph to: Color yellow; set: #frameAdornmentWidth for: #PluggableTextMorph to: 1. theme - set: #stylerClass for: #PluggableTextMorphPlus to: PythonTextStyler; + set: #stylerClass for: #PluggableTextMorphPlus to: ForeignLanguageTextStyler; set: #balloonTextColor for: #PluggableTextMorphPlus to: (Color gray: 0.7); derive: #balloonTextFont for: #PluggableTextMorphPlus from: #PluggableTextMorph at: #font. \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/class/addSyntaxHighlighting..st b/repository/Python-Core.package/PythonTheme.class/class/addSyntaxHighlighting..st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/addSyntaxHighlighting..st rename to repository/Python-Core.package/PythonTheme.class/class/addSyntaxHighlighting..st diff --git a/repository/Python-Support.package/PythonTheme.class/class/addToolColors..st b/repository/Python-Core.package/PythonTheme.class/class/addToolColors..st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/addToolColors..st rename to repository/Python-Core.package/PythonTheme.class/class/addToolColors..st diff --git a/repository/Python-Support.package/PythonTheme.class/class/addWindowColors..st b/repository/Python-Core.package/PythonTheme.class/class/addWindowColors..st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/addWindowColors..st rename to repository/Python-Core.package/PythonTheme.class/class/addWindowColors..st diff --git a/repository/Python-Support.package/PythonTheme.class/class/argumentColor.st b/repository/Python-Core.package/PythonTheme.class/class/argumentColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/argumentColor.st rename to repository/Python-Core.package/PythonTheme.class/class/argumentColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/backgroundColor.st b/repository/Python-Core.package/PythonTheme.class/class/backgroundColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/backgroundColor.st rename to repository/Python-Core.package/PythonTheme.class/class/backgroundColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/backgroundForm.st b/repository/Python-Core.package/PythonTheme.class/class/backgroundForm.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/backgroundForm.st rename to repository/Python-Core.package/PythonTheme.class/class/backgroundForm.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/blue.st b/repository/Python-Core.package/PythonTheme.class/class/blue.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/blue.st rename to repository/Python-Core.package/PythonTheme.class/class/blue.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/builtinConstColor.st b/repository/Python-Core.package/PythonTheme.class/class/builtinConstColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/builtinConstColor.st rename to repository/Python-Core.package/PythonTheme.class/class/builtinConstColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/commentColor.st b/repository/Python-Core.package/PythonTheme.class/class/commentColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/commentColor.st rename to repository/Python-Core.package/PythonTheme.class/class/commentColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/create.st b/repository/Python-Core.package/PythonTheme.class/class/create.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/create.st rename to repository/Python-Core.package/PythonTheme.class/class/create.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/focusedLabelColor.st b/repository/Python-Core.package/PythonTheme.class/class/focusedLabelColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/focusedLabelColor.st rename to repository/Python-Core.package/PythonTheme.class/class/focusedLabelColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/foregroundColor.st b/repository/Python-Core.package/PythonTheme.class/class/foregroundColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/foregroundColor.st rename to repository/Python-Core.package/PythonTheme.class/class/foregroundColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/globalColor.st b/repository/Python-Core.package/PythonTheme.class/class/globalColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/globalColor.st rename to repository/Python-Core.package/PythonTheme.class/class/globalColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/green.st b/repository/Python-Core.package/PythonTheme.class/class/green.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/green.st rename to repository/Python-Core.package/PythonTheme.class/class/green.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/highlightColor.st b/repository/Python-Core.package/PythonTheme.class/class/highlightColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/highlightColor.st rename to repository/Python-Core.package/PythonTheme.class/class/highlightColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/initialize.st b/repository/Python-Core.package/PythonTheme.class/class/initialize.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/initialize.st rename to repository/Python-Core.package/PythonTheme.class/class/initialize.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/keywordColor.st b/repository/Python-Core.package/PythonTheme.class/class/keywordColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/keywordColor.st rename to repository/Python-Core.package/PythonTheme.class/class/keywordColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/magenta.st b/repository/Python-Core.package/PythonTheme.class/class/magenta.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/magenta.st rename to repository/Python-Core.package/PythonTheme.class/class/magenta.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/numberColor.st b/repository/Python-Core.package/PythonTheme.class/class/numberColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/numberColor.st rename to repository/Python-Core.package/PythonTheme.class/class/numberColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/orange.st b/repository/Python-Core.package/PythonTheme.class/class/orange.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/orange.st rename to repository/Python-Core.package/PythonTheme.class/class/orange.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/red.st b/repository/Python-Core.package/PythonTheme.class/class/red.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/red.st rename to repository/Python-Core.package/PythonTheme.class/class/red.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/stringColor.st b/repository/Python-Core.package/PythonTheme.class/class/stringColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/stringColor.st rename to repository/Python-Core.package/PythonTheme.class/class/stringColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/textColor.st b/repository/Python-Core.package/PythonTheme.class/class/textColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/textColor.st rename to repository/Python-Core.package/PythonTheme.class/class/textColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/textSelectionColor.st b/repository/Python-Core.package/PythonTheme.class/class/textSelectionColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/textSelectionColor.st rename to repository/Python-Core.package/PythonTheme.class/class/textSelectionColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/unfocusedLabelColor.st b/repository/Python-Core.package/PythonTheme.class/class/unfocusedLabelColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/unfocusedLabelColor.st rename to repository/Python-Core.package/PythonTheme.class/class/unfocusedLabelColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/variableColor.st b/repository/Python-Core.package/PythonTheme.class/class/variableColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/variableColor.st rename to repository/Python-Core.package/PythonTheme.class/class/variableColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/windowColor.st b/repository/Python-Core.package/PythonTheme.class/class/windowColor.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/windowColor.st rename to repository/Python-Core.package/PythonTheme.class/class/windowColor.st diff --git a/repository/Python-Support.package/PythonTheme.class/class/yellow.st b/repository/Python-Core.package/PythonTheme.class/class/yellow.st similarity index 100% rename from repository/Python-Support.package/PythonTheme.class/class/yellow.st rename to repository/Python-Core.package/PythonTheme.class/class/yellow.st diff --git a/repository/Python-Support.package/PythonTheme.class/instance/stylerClass.st b/repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st similarity index 53% rename from repository/Python-Support.package/PythonTheme.class/instance/stylerClass.st rename to repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st index 15df1ae0..0c77a964 100644 --- a/repository/Python-Support.package/PythonTheme.class/instance/stylerClass.st +++ b/repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st @@ -1,3 +1,3 @@ as yet unclassified stylerClass - ^ PythonTextStyler \ No newline at end of file + ^ ForeignLanguageTextStyler \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTheme.class/methodProperties.json b/repository/Python-Core.package/PythonTheme.class/methodProperties.json similarity index 93% rename from repository/Python-Support.package/PythonTheme.class/methodProperties.json rename to repository/Python-Core.package/PythonTheme.class/methodProperties.json index 52128ccb..7dfac982 100644 --- a/repository/Python-Support.package/PythonTheme.class/methodProperties.json +++ b/repository/Python-Core.package/PythonTheme.class/methodProperties.json @@ -4,7 +4,7 @@ "addDialogs:" : "fn 2/21/2017 18:33", "addFonts:" : "fn 2/10/2017 10:26", "addMenusAndDockingBars:" : "fn 2/10/2017 14:23", - "addScrollables:" : "fn 2/10/2017 12:28", + "addScrollables:" : "fn 3/13/2017 17:12", "addSyntaxHighlighting:" : "fn 2/10/2017 14:03", "addToolColors:" : "fn 2/10/2017 11:58", "addWindowColors:" : "fn 2/10/2017 11:59", @@ -34,4 +34,4 @@ "windowColor" : "fn 2/10/2017 11:02", "yellow" : "fn 2/10/2017 11:58" }, "instance" : { - "stylerClass" : "fn 3/6/2017 11:02" } } + "stylerClass" : "fn 3/13/2017 17:12" } } diff --git a/repository/Python-Support.package/PythonTheme.class/properties.json b/repository/Python-Core.package/PythonTheme.class/properties.json similarity index 85% rename from repository/Python-Support.package/PythonTheme.class/properties.json rename to repository/Python-Core.package/PythonTheme.class/properties.json index 4f2987b6..a72b10dd 100644 --- a/repository/Python-Support.package/PythonTheme.class/properties.json +++ b/repository/Python-Core.package/PythonTheme.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "Python-Support", + "category" : "Python-Core", "classinstvars" : [ ], "classvars" : [ diff --git a/repository/Python-Core.package/ToolIcons.extension/class/Python.st b/repository/Python-Core.package/ToolIcons.extension/class/Python.st new file mode 100644 index 00000000..a1346fd0 --- /dev/null +++ b/repository/Python-Core.package/ToolIcons.extension/class/Python.st @@ -0,0 +1,7 @@ +*Python-Core +Python + ^ Form + extent: 12@12 + depth: 32 + fromArray: #( 0 0 17106438 1713124940 3425987223 4198333875 4181490607 3610602391 1444424508 0 0 0 0 0 167904263 3307888007 2082159445 4282023348 4281890989 4282088368 3710869899 67108866 0 0 0 0 167970056 2753777007 2988988028 3291175811 4281889702 4282022059 3811598988 319622152 151586562 0 1041112619 3324797068 3627051158 3526255502 3543032204 3576652171 4281889444 4282021287 3693697928 2947059764 3722298432 1381123094 3677382807 4282155708 4282023348 4282088883 4282154163 4282088111 4282021288 4282021802 3559085186 3284181302 4294962507 3823352378 4281891505 4281956783 4282022576 3962398877 3458947717 3492633731 3492633473 3324597883 2218740287 3891054140 4294957892 4294956096 4281890989 4282022318 3895289754 2220842808 3318067774 3486496319 3486495549 3452940344 3958557245 4294958405 4294956352 4294955325 3794888595 4282154935 3291240314 3554458685 4294963795 4294960974 4294961741 4294961226 4294959430 4294958146 4294958913 3705450290 1376920628 3727779476 2955694187 3689004863 4294960718 4294957640 3604395322 3553866039 3553865525 3654923061 3368592174 1077948942 0 151126789 319425289 3806511169 4294960204 4294956869 3284378419 2998048301 2762244902 202115331 0 0 0 0 50594560 3722229821 4294960457 4294957636 4294958146 2088527390 3334839340 185206786 0 0 0 0 0 1431981084 3621567807 4194227524 4211070018 3436293685 1735153180 17171973 0 0) + offset: 0@0 \ No newline at end of file diff --git a/repository/Python-Support.package/ToolIcons.extension/methodProperties.json b/repository/Python-Core.package/ToolIcons.extension/methodProperties.json similarity index 50% rename from repository/Python-Support.package/ToolIcons.extension/methodProperties.json rename to repository/Python-Core.package/ToolIcons.extension/methodProperties.json index 8b674499..453949cd 100644 --- a/repository/Python-Support.package/ToolIcons.extension/methodProperties.json +++ b/repository/Python-Core.package/ToolIcons.extension/methodProperties.json @@ -1,5 +1,5 @@ { "class" : { - "python" : "fn 3/7/2017 11:53" }, + "Python" : "fn 3/14/2017 01:41" }, "instance" : { } } diff --git a/repository/Python-Support.package/ToolIcons.extension/properties.json b/repository/Python-Core.package/ToolIcons.extension/properties.json similarity index 100% rename from repository/Python-Support.package/ToolIcons.extension/properties.json rename to repository/Python-Core.package/ToolIcons.extension/properties.json diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index 2bb01345..43e7afee 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Support.package/CompiledMethod.extension/instance/pySource..st b/repository/Python-Support.package/CompiledMethod.extension/instance/pySource..st deleted file mode 100644 index 841a74f9..00000000 --- a/repository/Python-Support.package/CompiledMethod.extension/instance/pySource..st +++ /dev/null @@ -1,3 +0,0 @@ -*Python-Support -pySource: aPySource - self literalAt: 1 put: aPySource \ No newline at end of file diff --git a/repository/Python-Support.package/CompiledMethod.extension/instance/pySource.st b/repository/Python-Support.package/CompiledMethod.extension/instance/pySource.st deleted file mode 100644 index c555cd83..00000000 --- a/repository/Python-Support.package/CompiledMethod.extension/instance/pySource.st +++ /dev/null @@ -1,3 +0,0 @@ -*Python-Support -pySource - ^ self literalAt: 1 \ No newline at end of file diff --git a/repository/Python-Support.package/CompiledMethod.extension/methodProperties.json b/repository/Python-Support.package/CompiledMethod.extension/methodProperties.json deleted file mode 100644 index 4d5e9083..00000000 --- a/repository/Python-Support.package/CompiledMethod.extension/methodProperties.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "pySource" : "fn 3/6/2017 22:51", - "pySource:" : "fn 3/6/2017 22:51" } } diff --git a/repository/Python-Support.package/CompiledMethod.extension/properties.json b/repository/Python-Support.package/CompiledMethod.extension/properties.json deleted file mode 100644 index c19cf97e..00000000 --- a/repository/Python-Support.package/CompiledMethod.extension/properties.json +++ /dev/null @@ -1,2 +0,0 @@ -{ - "name" : "CompiledMethod" } diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/isPython.st b/repository/Python-Support.package/PythonMethodContext.class/instance/isPython.st deleted file mode 100644 index 7f96a000..00000000 --- a/repository/Python-Support.package/PythonMethodContext.class/instance/isPython.st +++ /dev/null @@ -1,3 +0,0 @@ -accessing -isPython - ^ true \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame..st b/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame..st deleted file mode 100644 index 9cba0a4b..00000000 --- a/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame..st +++ /dev/null @@ -1,4 +0,0 @@ -accessing -pyFrame: anObject - - pyFrame := anObject \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame.st b/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame.st deleted file mode 100644 index abbedaa6..00000000 --- a/repository/Python-Support.package/PythonMethodContext.class/instance/pyFrame.st +++ /dev/null @@ -1,4 +0,0 @@ -accessing -pyFrame - - ^ pyFrame \ No newline at end of file diff --git a/repository/Python-Support.package/PythonMethodContext.class/methodProperties.json b/repository/Python-Support.package/PythonMethodContext.class/methodProperties.json deleted file mode 100644 index 74467303..00000000 --- a/repository/Python-Support.package/PythonMethodContext.class/methodProperties.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "isPython" : "fn 3/6/2017 19:17", - "printOn:" : "fn 3/6/2017 10:28", - "pyFrame" : "fn 1/16/2017 19:30", - "pyFrame:" : "fn 1/16/2017 19:30", - "sender:" : "fn 1/16/2017 21:54", - "setSender:receiver:method:arguments:" : "fn 1/18/2017 17:38", - "tempNames" : "fn 3/6/2017 10:29" } } diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/format..st b/repository/Python-Support.package/PythonTextStyler.class/instance/format..st deleted file mode 100644 index 2d5d3ad4..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/format..st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -format: aText - self isPythonCode - ifTrue: [ ^ self formatPython: aText ] - ifFalse: [ ^ super format: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/formatPython..st b/repository/Python-Support.package/PythonTextStyler.class/instance/formatPython..st deleted file mode 100644 index 3d104359..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/formatPython..st +++ /dev/null @@ -1,7 +0,0 @@ -overrides -formatPython: aText - "Answer a copy of which has been reformatted, - or if no formatting is to be applied" - - self terminateBackgroundStylingProcess. - ^self privateFormatPython: aText \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode..st b/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode..st deleted file mode 100644 index 7e30fcc1..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode..st +++ /dev/null @@ -1,3 +0,0 @@ -accessing -isPythonCode: anObject - isPythonCode := anObject \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode.st b/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode.st deleted file mode 100644 index 5f6f8036..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/isPythonCode.st +++ /dev/null @@ -1,3 +0,0 @@ -accessing -isPythonCode - ^ isPythonCode ifNil: [ ^ false ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/parseablePySourceCodeTemplate.st b/repository/Python-Support.package/PythonTextStyler.class/instance/parseablePySourceCodeTemplate.st deleted file mode 100644 index f604df12..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/parseablePySourceCodeTemplate.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -parseablePySourceCodeTemplate - ^ PythonObject sourceCodeTemplate \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/style..st b/repository/Python-Support.package/PythonTextStyler.class/instance/style..st deleted file mode 100644 index 80ba5c9a..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/style..st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -style: aText - self isPythonCode - ifTrue: [ self stylePython: aText ] - ifFalse: [ super style: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st b/repository/Python-Support.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st deleted file mode 100644 index ed4f523a..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/styleInBackgroundProcess..st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -styleInBackgroundProcess: aText - self isPythonCode - ifTrue: [ self stylePythonInBackgroundProcess: aText ] - ifFalse: [ super styleInBackgroundProcess: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/stylePython..st b/repository/Python-Support.package/PythonTextStyler.class/instance/stylePython..st deleted file mode 100644 index bebe77e3..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/stylePython..st +++ /dev/null @@ -1,9 +0,0 @@ -overrides -stylePython: aText - | styledText | - stylingEnabled ifFalse: [ ^ self ]. - Python vmSpeaksPython ifFalse: [^ super style: aText]. - styledText := (PythonTextStyler highlight: aText) first: aText size. - "Strings must be of same size, otherwise image might crash" - self assert: styledText string size = aText string size. - view ifNotNil:[view stylerStyled: styledText] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/instance/stylePythonInBackgroundProcess..st b/repository/Python-Support.package/PythonTextStyler.class/instance/stylePythonInBackgroundProcess..st deleted file mode 100644 index a7d0f087..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/instance/stylePythonInBackgroundProcess..st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -stylePythonInBackgroundProcess: aText - Project current addDeferredUIMessage: [ self stylePython: aText ] \ No newline at end of file diff --git a/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json b/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json deleted file mode 100644 index da531b42..00000000 --- a/repository/Python-Support.package/PythonTextStyler.class/methodProperties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "class" : { - "highlight:" : "fn 3/9/2017 16:04", - "highlightSmalltalk:" : "fn 3/6/2017 19:14" }, - "instance" : { - "format:" : "fn 3/8/2017 13:30", - "formatPython:" : "fn 3/7/2017 19:08", - "isPythonCode" : "fn 3/8/2017 14:23", - "isPythonCode:" : "fn 3/8/2017 13:30", - "parseablePySourceCodeTemplate" : "fn 3/8/2017 14:28", - "privateFormatPython:" : "fn 3/7/2017 19:06", - "style:" : "fn 3/8/2017 13:30", - "styleInBackgroundProcess:" : "fn 3/8/2017 13:30", - "stylePython:" : "fn 3/7/2017 16:12", - "stylePythonInBackgroundProcess:" : "fn 3/7/2017 16:27" } } diff --git a/repository/Python-Support.package/ToolIcons.extension/class/python.st b/repository/Python-Support.package/ToolIcons.extension/class/python.st deleted file mode 100644 index ccba73ec..00000000 --- a/repository/Python-Support.package/ToolIcons.extension/class/python.st +++ /dev/null @@ -1,8 +0,0 @@ -*Python-Support -python - - ^ Form - extent: 12@12 - depth: 32 - fromArray: #( 16711422 16711422 16777215 552005365 2223813585 2860230601 2893653189 2307632842 468316147 16777215 16711422 16711422 16711422 16777215 16777215 3179457998 4284585663 4280774568 4279657118 4278209419 3311636659 16777215 16777215 16711422 16777215 16777215 16777215 2359213526 3330451912 3379534783 4181489833 4279984022 3779886758 16711679 16711679 16711679 50200061 2409151447 3194592453 3211697859 3160380090 3244791225 4181620646 4279786389 3461250730 2717839523 3003051662 402323952 1756679906 4279330215 4280775083 4280971431 4279787935 4279196056 4279983767 4278208141 3292493491 3841978490 4294959397 2465851810 2894245070 4280577963 4282219691 4230573743 3293611196 3260582326 3276702131 3124458934 2947398308 3925864805 4294958141 3388793206 2877336266 4280117412 4079513007 3013128110 3019831440 3254776464 3237998225 3221221259 4093636449 4294958672 4294956854 3489520742 1890174168 4278208397 4012074928 3103714195 4294966360 4294961761 4294960716 4294959680 4294957887 4294956339 4294952960 2532958346 183957753 2959907004 3059321790 3203720595 4294962009 4294893921 3455836793 3288063596 3355237740 3472677468 3137001573 402323434 16777215 16777215 16777215 3187468170 4294958402 4294892883 3506167148 3355173248 2969165441 16383231 16646143 16711679 16711422 16777215 16777215 2717574803 4294955030 4294955814 4294954776 4294957661 3623476346 16580351 16777215 16711422 16711422 16711422 16711679 268171762 2214127001 3204242276 3271284829 2381962882 486143719 16711679 16711422 16711422) - offset: 0@0 \ No newline at end of file diff --git a/repository/Python-Support.package/monticello.meta/categories.st b/repository/Python-Support.package/monticello.meta/categories.st deleted file mode 100644 index 79fed287..00000000 --- a/repository/Python-Support.package/monticello.meta/categories.st +++ /dev/null @@ -1 +0,0 @@ -SystemOrganization addCategory: #'Python-Support'! diff --git a/repository/Python-Support.package/monticello.meta/package b/repository/Python-Support.package/monticello.meta/package deleted file mode 100644 index 1b10b7b6..00000000 --- a/repository/Python-Support.package/monticello.meta/package +++ /dev/null @@ -1 +0,0 @@ -(name 'Python-Support') \ No newline at end of file diff --git a/repository/Python-Support.package/monticello.meta/version b/repository/Python-Support.package/monticello.meta/version deleted file mode 100644 index 649375fd..00000000 --- a/repository/Python-Support.package/monticello.meta/version +++ /dev/null @@ -1 +0,0 @@ -(name 'Python-Support-fn.6' message 'Use pygments directly for now' id '406bf113-f057-4281-9f92-92ed198f9b7a' date '9 March 2017' time '5:31:56.457797 pm' author 'fn' ancestors ((name 'Python-Support-fn.5' message 'Remove subclasses of ToolBuilder components and improve styler' id '54f42651-6fe8-4210-a3d6-abd6dafbf941' date '8 March 2017' time '2:31:01.373803 pm' author 'fn' ancestors ((name 'Python-Support-fn.4' message 'Subclass SmalltalkEditor and TextMorphForEditView in order to be able to override more methods for Python support' id '51fa2773-8f66-4c87-addd-63154eea2da4' date '7 March 2017' time '6:17:46.751045 pm' author 'fn' ancestors ((name 'Python-Support-fn.3' message 'Bugfixes and improvements' id '4be9a02d-4982-447a-903e-e713baea85eb' date '7 March 2017' time '2:35:26.793869 pm' author 'fn' ancestors ((name 'Python-Support-fn.2' message 'Cleanups' id '43742c0b-6a9b-4827-a079-7202613e72c3' date '7 March 2017' time '12:46:02.428302 pm' author 'fn' ancestors ((name 'Python-Support-fn.1' message 'Initial commit' id 'fcd0af1c-1b0a-4cf5-be6c-b6ebab6bcfc6' date '6 March 2017' time '9:43:26.501112 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st b/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st index bb82dd07..8fd3b3cc 100644 --- a/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st @@ -1,7 +1,7 @@ as yet unclassified testScopeEndInStartingAt | d input | - d := PythonDebugger. + d := ForeignLanguage. input := ' a = 2 def foo(): diff --git a/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json b/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json index 31f107b7..4d9fa3db 100644 --- a/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "testScopeEndInStartingAt" : "fn 2/1/2017 22:43" } } + "testScopeEndInStartingAt" : "fn 3/14/2017 01:31" } } diff --git a/repository/Python-Tests.package/monticello.meta/version b/repository/Python-Tests.package/monticello.meta/version index 8ec4948a..36d00304 100644 --- a/repository/Python-Tests.package/monticello.meta/version +++ b/repository/Python-Tests.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Tests-fn.1' message 'Initial commit' id 'c3c0a7f2-bf15-4217-a468-c5aa7dcac35d' date '6 March 2017' time '9:43:34.293217 pm' author 'fn' ancestors () stepChildren ()) \ No newline at end of file +(name 'Python-Tests-fn.2' message 'Update test' id 'b05d2fe6-a180-4e18-bc32-5858e26fc346' date '14 March 2017' time '10:55:08.394541 am' author 'fn' ancestors ((name 'Python-Tests-fn.1' message 'Initial commit' id 'c3c0a7f2-bf15-4217-a468-c5aa7dcac35d' date '6 March 2017' time '9:43:34.293217 pm' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/isPython.st b/repository/Python-Tools.package/PythonBrowser.class/instance/isPython.st deleted file mode 100644 index 5f13d9ba..00000000 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/isPython.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -isPython - ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/instance/systemCategoryList.st b/repository/Python-Tools.package/PythonBrowser.class/instance/systemCategoryList.st deleted file mode 100644 index 412bf4c7..00000000 --- a/repository/Python-Tools.package/PythonBrowser.class/instance/systemCategoryList.st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -systemCategoryList - "Answer the class categories modelled by the receiver." - - ^ super systemCategoryList select: [:ea | ea beginsWith: 'Python'] \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json b/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json deleted file mode 100644 index 04bd958d..00000000 --- a/repository/Python-Tools.package/PythonBrowser.class/methodProperties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "aboutToStyle:" : "fn 3/8/2017 14:25", - "buildCodePaneWith:" : "fn 3/8/2017 12:45", - "defaultBrowserTitle" : "fn 3/6/2017 18:00", - "defaultStylerClass" : "fn 3/8/2017 11:37", - "defineMessageFrom:notifying:" : "fn 3/7/2017 11:42", - "doItReceiver" : "fn 3/8/2017 11:32", - "hasPyCodeSelected" : "fn 3/7/2017 18:58", - "isPython" : "fn 3/7/2017 14:33", - "selectedMessage" : "fn 3/7/2017 11:31", - "systemCategoryList" : "fn 3/7/2017 11:35", - "validateMessageSource:forSelector:inClass:" : "fn 3/7/2017 14:30" } } diff --git a/repository/Python-Tools.package/PythonContextVariablesInspector.class/methodProperties.json b/repository/Python-Tools.package/PythonContextVariablesInspector.class/methodProperties.json deleted file mode 100644 index b893d906..00000000 --- a/repository/Python-Tools.package/PythonContextVariablesInspector.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "selection" : "fn 2/26/2017 21:44" } } diff --git a/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st b/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st deleted file mode 100644 index 904dc939..00000000 --- a/repository/Python-Tools.package/PythonDebugger.class/class/newPyContext.st +++ /dev/null @@ -1,7 +0,0 @@ -pyContext -newPyContext - ^ PythonMethodContext - sender: nil - receiver: PythonObject - method: (CompiledMethod newMethod: 2 header: 2) - arguments: #() \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/guessTypeForName..st b/repository/Python-Tools.package/PythonDebugger.class/instance/guessTypeForName..st deleted file mode 100644 index 3175749e..00000000 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/guessTypeForName..st +++ /dev/null @@ -1,4 +0,0 @@ -overrides -guessTypeForName: aString - self hasPyContextSelected ifFalse: [ ^ super guessTypeForName: aString ]. - ^ nil \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyContextSelected.st b/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyContextSelected.st deleted file mode 100644 index 29b183cf..00000000 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/hasPyContextSelected.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -hasPyContextSelected - ^ self selectedContext isPython \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/instance/isPython.st b/repository/Python-Tools.package/PythonDebugger.class/instance/isPython.st deleted file mode 100644 index 5f13d9ba..00000000 --- a/repository/Python-Tools.package/PythonDebugger.class/instance/isPython.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -isPython - ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json b/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json deleted file mode 100644 index 7eeb83a1..00000000 --- a/repository/Python-Tools.package/PythonDebugger.class/methodProperties.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "class" : { - "exploreFrames" : "fn 3/9/2017 15:20", - "filterPySource:lineno:" : "fn 2/2/2017 00:01", - "getContentsOf:" : "fn 2/1/2017 22:37", - "getPySource:" : "fn 3/6/2017 10:25", - "getSignature:" : "fn 3/6/2017 10:25", - "indent:by:" : "fn 2/1/2017 22:41", - "indentSize:" : "fn 2/1/2017 22:36", - "newPyContext" : "fn 3/7/2017 13:48", - "prependPythonContexts:" : "fn 3/9/2017 15:19", - "replaceInPySource:content:lineno:" : "fn 2/2/2017 00:05", - "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", - "setPySourceContent:content:" : "fn 3/6/2017 10:26" }, - "instance" : { - "aboutToStyle:" : "fn 3/8/2017 22:05", - "buildCodePaneWith:" : "fn 3/8/2017 12:50", - "contents:notifying:" : "fn 3/6/2017 19:17", - "contextForStack:" : "fn 2/21/2017 12:48", - "defaultStylerClass" : "fn 3/8/2017 11:37", - "expandStack" : "fn 1/16/2017 21:03", - "guessTypeForName:" : "fn 3/7/2017 14:12", - "hasPyContextSelected" : "fn 3/7/2017 14:12", - "isPython" : "fn 3/7/2017 14:32", - "messageIconAt:" : "fn 3/7/2017 16:35", - "pcRange" : "fn 3/7/2017 14:12", - "process:controller:context:" : "fn 1/16/2017 19:34", - "pyPCRange" : "fn 3/6/2017 10:26", - "selectedMessage" : "fn 3/6/2017 19:17" } } diff --git a/repository/Python-Tools.package/PythonInspector.class/instance/isPython.st b/repository/Python-Tools.package/PythonInspector.class/instance/isPython.st deleted file mode 100644 index 5f13d9ba..00000000 --- a/repository/Python-Tools.package/PythonInspector.class/instance/isPython.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -isPython - ^ true \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonInspector.class/methodProperties.json b/repository/Python-Tools.package/PythonInspector.class/methodProperties.json deleted file mode 100644 index 83077a6a..00000000 --- a/repository/Python-Tools.package/PythonInspector.class/methodProperties.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "aboutToStyle:" : "fn 3/8/2017 14:26", - "buildCodePaneWith:" : "fn 3/8/2017 12:50", - "contentsIsString" : "fn 12/23/2016 11:11", - "fieldList" : "fn 2/23/2017 23:10", - "isPython" : "fn 3/7/2017 14:33", - "selection" : "fn 2/23/2017 23:10" } } diff --git a/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json b/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json deleted file mode 100644 index 8ea71aa3..00000000 --- a/repository/Python-Tools.package/PythonObjectExplorer.class/methodProperties.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "aboutToStyle:" : "fn 3/8/2017 14:26", - "buildWith:" : "fn 3/9/2017 13:55" } } diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/browse.selector..st b/repository/Python-Tools.package/PythonToolSet.class/class/browse.selector..st deleted file mode 100644 index 2afc9cda..00000000 --- a/repository/Python-Tools.package/PythonToolSet.class/class/browse.selector..st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -browse: aClass selector: aSelector - ^ PythonBrowser fullOnClass: aClass selector: aSelector \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/explore..st b/repository/Python-Tools.package/PythonToolSet.class/class/explore..st deleted file mode 100644 index 1cf1e9f3..00000000 --- a/repository/Python-Tools.package/PythonToolSet.class/class/explore..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -explore: anObject - - ^ PythonObjectExplorer openOn: anObject \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/inspectorClassOf..st b/repository/Python-Tools.package/PythonToolSet.class/class/inspectorClassOf..st deleted file mode 100644 index b094a210..00000000 --- a/repository/Python-Tools.package/PythonToolSet.class/class/inspectorClassOf..st +++ /dev/null @@ -1,4 +0,0 @@ -as yet unclassified -inspectorClassOf: anObject - anObject isPython ifFalse: [ ^ super inspectorClassOf: anObject ]. - ^ PythonInspector \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/openPythonClassBrowser.st b/repository/Python-Tools.package/PythonToolSet.class/class/openPythonClassBrowser.st deleted file mode 100644 index b29417d5..00000000 --- a/repository/Python-Tools.package/PythonToolSet.class/class/openPythonClassBrowser.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -openPythonClassBrowser - PythonBrowser open \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/class/openPythonWorkspace.st b/repository/Python-Tools.package/PythonToolSet.class/class/openPythonWorkspace.st deleted file mode 100644 index 3cc4e4e8..00000000 --- a/repository/Python-Tools.package/PythonToolSet.class/class/openPythonWorkspace.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -openPythonWorkspace - PythonWorkspace open \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonToolSet.class/methodProperties.json b/repository/Python-Tools.package/PythonToolSet.class/methodProperties.json deleted file mode 100644 index 292c15da..00000000 --- a/repository/Python-Tools.package/PythonToolSet.class/methodProperties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "class" : { - "browse:selector:" : "fn 3/6/2017 17:54", - "debug:context:label:contents:fullView:" : "fn 1/19/2017 11:56", - "debugContext:label:contents:" : "fn 3/6/2017 17:57", - "explore:" : "fn 3/6/2017 17:57", - "initialize" : "fn 1/16/2017 18:52", - "inspectorClassOf:" : "fn 3/6/2017 17:56", - "interrupt:label:" : "fn 1/18/2017 15:08", - "menuItems" : "fn 3/6/2017 18:07", - "openPythonClassBrowser" : "fn 3/6/2017 18:05", - "openPythonWorkspace" : "fn 3/6/2017 18:08" }, - "instance" : { - } } diff --git a/repository/Python-Tools.package/PythonWorkspace.class/class/open.st b/repository/Python-Tools.package/PythonWorkspace.class/class/open.st deleted file mode 100644 index 19ea69f8..00000000 --- a/repository/Python-Tools.package/PythonWorkspace.class/class/open.st +++ /dev/null @@ -1,3 +0,0 @@ -as yet unclassified -open - ^ (Smalltalk at: #PythonWorkspace ifAbsent:[self]) new openLabel: 'Python Workspace' diff --git a/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st b/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st deleted file mode 100644 index 187a2293..00000000 --- a/repository/Python-Tools.package/PythonWorkspace.class/instance/evaluateExpression..st +++ /dev/null @@ -1,3 +0,0 @@ -dispatching -evaluateExpression: selection - ^ Python prun: selection asString \ No newline at end of file diff --git a/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json b/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json deleted file mode 100644 index eefdcecc..00000000 --- a/repository/Python-Tools.package/PythonWorkspace.class/methodProperties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "class" : { - "open" : "fn 12/22/2016 02:51" }, - "instance" : { - "aboutToStyle:" : "fn 3/8/2017 14:26", - "buildCodePaneWith:" : "fn 3/8/2017 12:51", - "evaluateExpression:" : "fn 2/23/2017 21:21", - "isPython" : "fn 3/7/2017 14:33" } } diff --git a/repository/Python-Tools.package/monticello.meta/categories.st b/repository/Python-Tools.package/monticello.meta/categories.st deleted file mode 100644 index 838506df..00000000 --- a/repository/Python-Tools.package/monticello.meta/categories.st +++ /dev/null @@ -1 +0,0 @@ -SystemOrganization addCategory: #'Python-Tools'! diff --git a/repository/Python-Tools.package/monticello.meta/package b/repository/Python-Tools.package/monticello.meta/package deleted file mode 100644 index 936a5b0f..00000000 --- a/repository/Python-Tools.package/monticello.meta/package +++ /dev/null @@ -1 +0,0 @@ -(name 'Python-Tools') \ No newline at end of file diff --git a/repository/Python-Tools.package/monticello.meta/version b/repository/Python-Tools.package/monticello.meta/version deleted file mode 100644 index 83526bef..00000000 --- a/repository/Python-Tools.package/monticello.meta/version +++ /dev/null @@ -1 +0,0 @@ -(name 'Python-Tools-fn.6' message 'Minor bug fixes and improvements' id 'abd61547-ec74-40a6-9ff4-bb6df4fb922f' date '9 March 2017' time '5:32:14.523757 pm' author 'fn' ancestors ((name 'Python-Tools-fn.5' message 'Improve tools' id '7c6b41c2-c667-46b4-9abc-f5fbf69004bc' date '8 March 2017' time '2:31:16.168274 pm' author 'fn' ancestors ((name 'Python-Tools-fn.4' message 'Improve tools' id 'ced3b5a9-1f04-4750-83ba-8f6843db82ae' date '7 March 2017' time '6:18:03.279361 pm' author 'fn' ancestors ((name 'Python-Tools-fn.3' message 'Bugfixes and improvements' id '792d3734-4178-4d27-bc88-d784f9183768' date '7 March 2017' time '2:35:35.338398 pm' author 'fn' ancestors ((name 'Python-Tools-fn.2' message 'Improve PythonBrowser' id 'b2daaaa3-4839-413d-83df-802a71cb1aa4' date '7 March 2017' time '12:46:26.065217 pm' author 'fn' ancestors ((name 'Python-Tools-fn.1' message 'Initial commit' id '161df5a6-e3ff-4071-9c06-90faa842786d' date '6 March 2017' time '9:43:40.029266 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Ruby-Core.package/.filetree b/repository/Ruby-Core.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/Ruby-Core.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/Ruby-Core.package/Object.extension/instance/isRuby.st b/repository/Ruby-Core.package/Object.extension/instance/isRuby.st new file mode 100644 index 00000000..56745c28 --- /dev/null +++ b/repository/Ruby-Core.package/Object.extension/instance/isRuby.st @@ -0,0 +1,3 @@ +*Ruby-Core +isRuby + ^ false \ No newline at end of file diff --git a/repository/Ruby-Core.package/Object.extension/methodProperties.json b/repository/Ruby-Core.package/Object.extension/methodProperties.json new file mode 100644 index 00000000..16b0021d --- /dev/null +++ b/repository/Ruby-Core.package/Object.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "isRuby" : "fn 3/12/2017 19:24" } } diff --git a/repository/Ruby-Core.package/Object.extension/properties.json b/repository/Ruby-Core.package/Object.extension/properties.json new file mode 100644 index 00000000..3d3b9ec4 --- /dev/null +++ b/repository/Ruby-Core.package/Object.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "Object" } diff --git a/repository/Ruby-Core.package/Ruby.class/README.md b/repository/Ruby-Core.package/Ruby.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Ruby-Core.package/Ruby.class/class/checkForException..st b/repository/Ruby-Core.package/Ruby.class/class/checkForException..st new file mode 100644 index 00000000..c87531cf --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/checkForException..st @@ -0,0 +1,5 @@ +special methods +checkForException: aRbLanguage + Smalltalk isHeadless ifTrue: [ ^ self ]. + (self primLastError: aRbLanguage) ifNotNil: [ :e | + 1 halt ] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/eval..st b/repository/Ruby-Core.package/Ruby.class/class/eval..st new file mode 100644 index 00000000..f96db4c5 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/eval..st @@ -0,0 +1,3 @@ +execution +eval: aString + ^ self primEval: aString breakOnExceptions: true \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st new file mode 100644 index 00000000..b379908e --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st @@ -0,0 +1,3 @@ +execution +evaluateExpression: selection + ^ Ruby eval: selection asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/highlight..st b/repository/Ruby-Core.package/Ruby.class/class/highlight..st new file mode 100644 index 00000000..1c0eec04 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/highlight..st @@ -0,0 +1,3 @@ +styling +highlight: aText + ^ ForeignLanguageTextStyler highlightRuby: aText \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/kernel.st b/repository/Ruby-Core.package/Ruby.class/class/kernel.st new file mode 100644 index 00000000..3d7712b0 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/kernel.st @@ -0,0 +1,4 @@ +accessing +kernel + + ^ RubyKernel ifNil: [RubyKernel := self primEval: 'Kernel'] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/object.st b/repository/Ruby-Core.package/Ruby.class/class/object.st new file mode 100644 index 00000000..8d12fbf1 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/object.st @@ -0,0 +1,4 @@ +accessing +object + + ^ RubyObject ifNil: [RubyObject := self primEval: 'Object'] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primEval..st b/repository/Ruby-Core.package/Ruby.class/class/primEval..st new file mode 100644 index 00000000..146d9537 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primEval..st @@ -0,0 +1,4 @@ +primitives +primEval: aString + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primEval.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/primEval.breakOnExceptions..st new file mode 100644 index 00000000..ecf9b6ea --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primEval.breakOnExceptions..st @@ -0,0 +1,4 @@ +system primitives +primEval: aString breakOnExceptions: aBool + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame.st b/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame.st new file mode 100644 index 00000000..000cacda --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame.st @@ -0,0 +1,4 @@ +system primitives +primGetTopFrame + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primLastError..st b/repository/Ruby-Core.package/Ruby.class/class/primLastError..st new file mode 100644 index 00000000..1d93e296 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primLastError..st @@ -0,0 +1,4 @@ +system primitives +primLastError: aRbLanguage + + ^ nil \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primResume..st b/repository/Ruby-Core.package/Ruby.class/class/primResume..st new file mode 100644 index 00000000..6245ffff --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primResume..st @@ -0,0 +1,4 @@ +system primitives +primResume: aRbLanguage + + self primitiveFailed \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primSend.to.with..st b/repository/Ruby-Core.package/Ruby.class/class/primSend.to.with..st new file mode 100644 index 00000000..130cf8dd --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primSend.to.with..st @@ -0,0 +1,4 @@ +primitives +primSend: aSelector to: anObject with: argsArray + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/resume..st b/repository/Ruby-Core.package/Ruby.class/class/resume..st new file mode 100644 index 00000000..f02fa596 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/resume..st @@ -0,0 +1,7 @@ +special methods +resume: aRbLanguage + "Magic method that is called by vm (cached in vm)" + Processor yield. + [ ^ self primResume: aRbLanguage ] on: Error do: [ + self checkForException: aRbLanguage. + ^ self resume: aRbLanguage ] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/sourceCodeTemplate.st b/repository/Ruby-Core.package/Ruby.class/class/sourceCodeTemplate.st new file mode 100644 index 00000000..558f6c2a --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/sourceCodeTemplate.st @@ -0,0 +1,5 @@ +overrides +sourceCodeTemplate + ^ 'def method + puts "Hello World" +end' \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/vmSpeaksLanguage.st b/repository/Ruby-Core.package/Ruby.class/class/vmSpeaksLanguage.st new file mode 100644 index 00000000..b4241e90 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/vmSpeaksLanguage.st @@ -0,0 +1,4 @@ +overrides +vmSpeaksLanguage + [ Ruby eval: '1' ] on: Error do: [ ^ false ]. + ^ true \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json new file mode 100644 index 00000000..3b1b268a --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -0,0 +1,19 @@ +{ + "class" : { + "checkForException:" : "fn 3/12/2017 14:56", + "eval:" : "fn 3/12/2017 15:17", + "evaluateExpression:" : "fn 3/14/2017 18:31", + "highlight:" : "fn 3/14/2017 11:27", + "kernel" : "tfel 8/16/2016 07:04", + "object" : "tfel 8/16/2016 07:04", + "primEval:" : "tfel 8/16/2016 07:03", + "primEval:breakOnExceptions:" : "fn 3/12/2017 15:02", + "primGetTopFrame" : "fn 3/14/2017 22:23", + "primLastError:" : "fn 3/12/2017 14:55", + "primResume:" : "fn 3/12/2017 14:54", + "primSend:to:with:" : "tfel 8/16/2016 07:03", + "resume:" : "fn 3/12/2017 14:54", + "sourceCodeTemplate" : "fn 3/14/2017 11:22", + "vmSpeaksLanguage" : "fn 3/14/2017 11:33" }, + "instance" : { + } } diff --git a/repository/Ruby-Core.package/Ruby.class/properties.json b/repository/Ruby-Core.package/Ruby.class/properties.json new file mode 100644 index 00000000..943f9b95 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "Ruby-Core", + "classinstvars" : [ + ], + "classvars" : [ + "BreakOnExceptions", + "VMSpeaksRuby" ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "Ruby", + "pools" : [ + ], + "super" : "ForeignLanguage", + "type" : "normal" } diff --git a/repository/Ruby-Core.package/RubyObject.class/README.md b/repository/Ruby-Core.package/RubyObject.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/allInstVarNames.st b/repository/Ruby-Core.package/RubyObject.class/instance/allInstVarNames.st new file mode 100644 index 00000000..6324debf --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/allInstVarNames.st @@ -0,0 +1,3 @@ +overrides +allInstVarNames + ^ self class instance_variables asSmalltalk \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/asSmalltalk.st b/repository/Ruby-Core.package/RubyObject.class/instance/asSmalltalk.st new file mode 100644 index 00000000..c49f6f13 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/asSmalltalk.st @@ -0,0 +1,4 @@ +overrides +asSmalltalk + + self primitiveFailed \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/class.st b/repository/Ruby-Core.package/RubyObject.class/instance/class.st new file mode 100644 index 00000000..293a4c2f --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/class.st @@ -0,0 +1,3 @@ +overrides +class + ^ self _class \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/className.st b/repository/Ruby-Core.package/RubyObject.class/instance/className.st new file mode 100644 index 00000000..a047b895 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/className.st @@ -0,0 +1,3 @@ +overrides +className + ^ self class inspect asSmalltalk \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/defaultTitleForInspector.st b/repository/Ruby-Core.package/RubyObject.class/instance/defaultTitleForInspector.st new file mode 100644 index 00000000..d8e9c9df --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/defaultTitleForInspector.st @@ -0,0 +1,3 @@ +overrides +defaultTitleForInspector + ^ self _class asString, ': ', self asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/instVarNamed..st b/repository/Ruby-Core.package/RubyObject.class/instance/instVarNamed..st new file mode 100644 index 00000000..ed750acf --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/instVarNamed..st @@ -0,0 +1,3 @@ +overrides +instVarNamed: aName + ^ self instance_variable_get: aName \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/isRuby.st b/repository/Ruby-Core.package/RubyObject.class/instance/isRuby.st new file mode 100644 index 00000000..d55431b7 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/isRuby.st @@ -0,0 +1,3 @@ +helpers +isRuby + ^ true \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/languageSymbol.st b/repository/Ruby-Core.package/RubyObject.class/instance/languageSymbol.st new file mode 100644 index 00000000..2c6231f3 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/languageSymbol.st @@ -0,0 +1,3 @@ +overrides +languageSymbol + ^ #Ruby \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st b/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st new file mode 100644 index 00000000..891fd882 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st @@ -0,0 +1,3 @@ +overrides +printOn: aStream + aStream nextPutAll: self _inspect asSmalltalk \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/respondsTo..st b/repository/Ruby-Core.package/RubyObject.class/instance/respondsTo..st new file mode 100644 index 00000000..dfa702d4 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/respondsTo..st @@ -0,0 +1,6 @@ +overrides +respondsTo: aSymbol + "Answer whether the method dictionary of the receiver's class contains + aSymbol as a message selector." + + ^ RubyObject canUnderstand: aSymbol \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/variablesAndOffsetsDo..st b/repository/Ruby-Core.package/RubyObject.class/instance/variablesAndOffsetsDo..st new file mode 100644 index 00000000..6dffa013 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/variablesAndOffsetsDo..st @@ -0,0 +1,3 @@ +overrides +variablesAndOffsetsDo: aBinaryBlock + ^ self \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/methodProperties.json b/repository/Ruby-Core.package/RubyObject.class/methodProperties.json new file mode 100644 index 00000000..6d677af9 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/methodProperties.json @@ -0,0 +1,15 @@ +{ + "class" : { + }, + "instance" : { + "allInstVarNames" : "fn 3/14/2017 13:22", + "asSmalltalk" : "fn 3/12/2017 17:43", + "class" : "fn 3/14/2017 13:22", + "className" : "fn 3/12/2017 19:09", + "defaultTitleForInspector" : "fn 3/14/2017 11:52", + "instVarNamed:" : "fn 3/14/2017 12:08", + "isRuby" : "fn 3/12/2017 19:24", + "languageSymbol" : "fn 3/14/2017 00:51", + "printOn:" : "fn 3/14/2017 01:00", + "respondsTo:" : "fn 3/12/2017 19:17", + "variablesAndOffsetsDo:" : "fn 3/12/2017 19:19" } } diff --git a/repository/Ruby-Core.package/RubyObject.class/properties.json b/repository/Ruby-Core.package/RubyObject.class/properties.json new file mode 100644 index 00000000..49d3645a --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Ruby-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "RubyObject", + "pools" : [ + ], + "super" : "ForeignLanguageObject", + "type" : "normal" } diff --git a/repository/Ruby-Core.package/ToolIcons.extension/class/Ruby.st b/repository/Ruby-Core.package/ToolIcons.extension/class/Ruby.st new file mode 100644 index 00000000..ce95cf68 --- /dev/null +++ b/repository/Ruby-Core.package/ToolIcons.extension/class/Ruby.st @@ -0,0 +1,7 @@ +*Ruby-Core +Ruby + ^ Form + extent: 12@12 + depth: 32 + fromArray: #( 0 0 0 0 788528374 2280232076 3638778966 3941767561 3922874945 3903324160 3465481235 1071235004 0 0 0 1894761396 4290123795 4289134592 4289593344 4293483828 4294166461 4288610561 4286054400 3985383183 0 0 2129047450 4288151552 4288610304 4290058752 4289789952 4292034328 4293816653 4274793216 4288548864 4252368896 0 1827654333 4287692800 4288610304 4289797120 4289265664 4290126848 4291911494 4289527808 4290184960 4289202432 3834190347 217446133 4288158979 4287561728 4289469440 4289069056 4288282624 4293836204 4275410051 4287430656 4288612096 4286971904 3516802322 2530975377 4284678144 4287567360 4288217088 4288348160 4291650372 4294878603 4274868787 4287496192 4288023296 4286709760 3248893469 3790710941 4288151552 4284874752 4287768088 4292113237 4292231983 4291035136 4290448128 4287827456 4286778880 4286775296 2964535591 3724126617 4294027158 4291856517 4292721841 4290392358 4288806912 4289724416 4290183168 4287695616 4286451713 4287168512 2646821176 3921947146 4294093461 4294952356 4292236860 4287037440 4288219904 4288022528 4288153088 4287433216 4286385664 4287234048 2346211914 4220583936 4290905088 4293338368 4289527808 4288087040 4288153856 4287039744 4287563520 4290251776 4288285952 4285792256 2044618325 3835765778 4287430656 4290249216 4288872448 4287561728 4286578688 4287496192 4289658880 4291100672 4292083712 4288151552 1909614935 988267711 3482063127 3986161664 3785888768 3500222224 3232117538 2964667436 2696824629 2429047360 2162319438 1877698383 569491638) + offset: 0@0 \ No newline at end of file diff --git a/repository/Python-Core.package/ForeignLanguage.class/methodProperties.json b/repository/Ruby-Core.package/ToolIcons.extension/methodProperties.json similarity index 52% rename from repository/Python-Core.package/ForeignLanguage.class/methodProperties.json rename to repository/Ruby-Core.package/ToolIcons.extension/methodProperties.json index 0e4a6622..3591f2b7 100644 --- a/repository/Python-Core.package/ForeignLanguage.class/methodProperties.json +++ b/repository/Ruby-Core.package/ToolIcons.extension/methodProperties.json @@ -1,5 +1,5 @@ { "class" : { - }, + "Ruby" : "fn 3/14/2017 01:42" }, "instance" : { } } diff --git a/repository/Ruby-Core.package/ToolIcons.extension/properties.json b/repository/Ruby-Core.package/ToolIcons.extension/properties.json new file mode 100644 index 00000000..09fddafd --- /dev/null +++ b/repository/Ruby-Core.package/ToolIcons.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "ToolIcons" } diff --git a/repository/Ruby-Core.package/monticello.meta/categories.st b/repository/Ruby-Core.package/monticello.meta/categories.st new file mode 100644 index 00000000..c16fc37e --- /dev/null +++ b/repository/Ruby-Core.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'Ruby-Core'! diff --git a/repository/Ruby-Core.package/monticello.meta/initializers.st b/repository/Ruby-Core.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b diff --git a/repository/Ruby-Core.package/monticello.meta/package b/repository/Ruby-Core.package/monticello.meta/package new file mode 100644 index 00000000..686fcd8c --- /dev/null +++ b/repository/Ruby-Core.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'Ruby-Core') \ No newline at end of file diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version new file mode 100644 index 00000000..76b13db4 --- /dev/null +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Ruby-Core.package/properties.json b/repository/Ruby-Core.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/Ruby-Core.package/properties.json @@ -0,0 +1,2 @@ +{ + } From c67aac9caf299b2d5662c092ed300c9a2b8ec6b2 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 15 Mar 2017 10:31:51 +0100 Subject: [PATCH 131/193] Move send and getTopFrame prims into FL plugin Also, introduce a WR_FrameObject class which allows to expose Ruby frames as Ruby objects --- .../plugins/foreign_language/__init__.py | 26 ++++++++ rsqueakvm/plugins/python/__init__.py | 56 +++++++++++++++- rsqueakvm/plugins/python/patching.py | 3 + rsqueakvm/plugins/python/utils.py | 8 --- rsqueakvm/plugins/python_plugin.py | 65 +------------------ rsqueakvm/plugins/ruby/__init__.py | 35 +++++++++- rsqueakvm/plugins/ruby/frame.py | 40 ++++++++++++ rsqueakvm/plugins/ruby/patching.py | 2 + rsqueakvm/plugins/ruby_plugin.py | 50 -------------- 9 files changed, 159 insertions(+), 126 deletions(-) create mode 100644 rsqueakvm/plugins/ruby/frame.py diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index c435c0aa..969de23e 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -1,8 +1,11 @@ from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage from rsqueakvm.plugins.foreign_language.model import W_ForeignLanguageObject from rsqueakvm.plugins.plugin import Plugin +from rpython.rlib import jit + class ForeignLanguagePlugin(Plugin): @@ -25,6 +28,10 @@ def new_w_language(space, args_w): def w_object_class(): raise NotImplementedError + @staticmethod + def top_w_frame(): + raise PrimitiveFailedError + @staticmethod def to_w_object(foreign_object): raise NotImplementedError @@ -55,6 +62,21 @@ def resume(interp, s_frame, w_rcvr, language): raise PrimitiveFailedError return language.switch_to_smalltalk(interp, s_frame) + @self.expose_primitive(compiled_method=True) + @jit.unroll_safe + def send(interp, s_frame, argcount, w_method): + # import pdb; pdb.set_trace() + space = interp.space + args_w = s_frame.peek_n(argcount) + w_rcvr = s_frame.peek(argcount) + w_selector_name = w_method.literalat0(space, 2) + if not isinstance(w_selector_name, W_BytesObject): + raise PrimitiveFailedError + method_name = space.unwrap_string(w_selector_name) + w_result = self.perform_send(space, w_rcvr, method_name, args_w) + s_frame.pop_n(argcount + 1) + return w_result + @self.expose_primitive(unwrap_spec=[object, object]) def lastError(interp, s_frame, w_rcvr, language): if not isinstance(language, W_ForeignLanguage): @@ -65,6 +87,10 @@ def lastError(interp, s_frame, w_rcvr, language): raise PrimitiveFailedError return w_error + @self.expose_primitive(unwrap_spec=[object]) + def getTopFrame(interp, s_frame, w_rcvr): + return self.top_w_frame() + @self.expose_primitive(unwrap_spec=[object]) def asSmalltalk(interp, s_frame, w_rcvr): if not isinstance(w_rcvr, self.w_object_class()): diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index eb92a9f9..40143e77 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -4,13 +4,19 @@ from rsqueakvm.util.system import translationconfig try: + from rsqueakvm.plugins.python import utils from rsqueakvm.plugins.python.model import ( W_PythonObject, PythonClassShadow) from rsqueakvm.plugins.python.language import W_PythonLanguage from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.plugins.python.patching import patch_pypy from rsqueakvm.plugins.python.switching import PyFrameRestartInfo - from rsqueakvm.plugins.python.utils import python_to_smalltalk + + from pypy.interpreter.argument import Arguments + from pypy.interpreter.error import OperationError + from pypy.interpreter.function import ( + Function, Method, StaticMethod, ClassMethod) + IMPORT_FAILED = False except ImportError: IMPORT_FAILED = True @@ -55,9 +61,55 @@ def new_w_language(space, args_w): def w_object_class(): return W_PythonObject + @staticmethod + def perform_send(space, w_rcvr, attrname, args_w): + wp_rcvr = utils.smalltalk_to_python(space, w_rcvr) + idx = attrname.find(':') + if idx > 0: + attrname = attrname[0:idx] + wp_result = None + try: + py_attr = py_space.getattr(wp_rcvr, py_space.newtext(attrname)) + if (isinstance(py_attr, Function) or + isinstance(py_attr, Method) or + isinstance(py_attr, StaticMethod) or + isinstance(py_attr, ClassMethod)): + args_wp = [utils.smalltalk_to_python(space, a) for a in args_w] + # use call_args() to allow variable number of args_w + # (but this disables speed hacks in Pypy) + w_meth = py_space.getattr(wp_rcvr, py_space.newtext(attrname)) + args = Arguments(py_space, args_wp) + wp_result = py_space.call_args(w_meth, args) + else: + if len(args_w) == 1: + wp_value = utils.smalltalk_to_python(space, args_w[0]) + py_space.setattr(wp_rcvr, py_space.newtext(attrname), + wp_value) + wp_result = py_space.w_None + else: + wp_result = py_attr + except OperationError as operr: + return W_PythonObject(utils.operr_to_pylist(operr)) + except Exception as e: + print 'Unable to call %s on %s: %s' % (attrname, wp_rcvr, e) + raise PrimitiveFailedError + if wp_result is None: + # import pdb; pdb.set_trace() + print ('No result in send primitive (wp_rcvr: %s, attrname: %s)' + % (wp_rcvr, attrname)) + raise PrimitiveFailedError + return W_PythonObject(wp_result) + + @staticmethod + def top_w_frame(): + topframe = py_space.getexecutioncontext().gettopframe() + if topframe is None: + raise PrimitiveFailedError + return W_PythonObject(topframe) + @staticmethod def to_w_object(space, foreign_object): - return python_to_smalltalk(space, foreign_object.wp_object) + return utils.python_to_smalltalk(space, foreign_object.wp_object) @staticmethod def set_py_frame_restart_info(frame, py_code): diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index d1d95f65..b92510a2 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -3,6 +3,7 @@ from pypy.interpreter.pycode import PyCode, default_magic from pypy.interpreter.pyopcode import SApplicationException +from pypy.interpreter.executioncontext import ExecutionContext from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver from pypy.tool.stdlib_opcode import bytecode_spec @@ -141,6 +142,8 @@ def patch_pypy(): except AttributeError: pass + ExecutionContext.current_language = None + PyFrame.__init__ = __init__frame PyFrame.execute_frame = new_execute_frame PyFrame.block_handles_exception = block_handles_exception diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 40dd1a30..a6765fe8 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -6,7 +6,6 @@ from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.model.variable import W_BytesObject -from pypy.interpreter.argument import Arguments from pypy.interpreter.error import OperationError from pypy.interpreter.main import ensure__main__, compilecode from pypy.interpreter.module import Module @@ -124,13 +123,6 @@ def get_restart_pycode(source, filename='', cmd='exec'): return -def call_method(space, wp_obj, methodname, args_w): - # use call_args() to allow variable # of args_w (this disables speed hacks) - w_meth = py_space.getattr(wp_obj, py_space.newtext(methodname)) - args = Arguments(py_space, [smalltalk_to_python(space, a) for a in args_w]) - return py_space.call_args(w_meth, args) - - def operr_to_pylist(operr): if not isinstance(operr, OperationError): return diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index 6296b725..ab79142d 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -1,32 +1,14 @@ -from rsqueakvm.error import PrimitiveFailedError -from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.plugins.python import PythonPlugin -from rpython.rlib import jit - try: - from rsqueakvm.plugins.python import py_space, utils + from rsqueakvm.plugins.python import utils from rsqueakvm.plugins.python.model import W_PythonObject - - from pypy.interpreter.error import OperationError - from pypy.interpreter.function import ( - Function, Method, StaticMethod, ClassMethod) except ImportError: pass - plugin = PythonPlugin() -@plugin.expose_primitive(unwrap_spec=[object]) -def getTopFrame(interp, s_frame, w_rcvr): - # import pdb; pdb.set_trace() - topframe = py_space.getexecutioncontext().gettopframe() - if topframe is None: - raise PrimitiveFailedError - return W_PythonObject(topframe) - - @plugin.expose_primitive(unwrap_spec=[object, object, str, str, str]) def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, cmd): @@ -40,48 +22,3 @@ def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, return interp.space.w_false # Raising prim error causes crashes PythonPlugin.set_py_frame_restart_info(frame, py_code) return interp.space.w_true - - -@plugin.expose_primitive(compiled_method=True) -@jit.unroll_safe -def send(interp, s_frame, argcount, w_method): - # import pdb; pdb.set_trace() - space = interp.space - args_w = s_frame.peek_n(argcount) - wp_rcvr = utils.smalltalk_to_python(space, s_frame.peek(argcount)) - w_selector_name = w_method.literalat0(space, 2) - if not isinstance(w_selector_name, W_BytesObject): - print 'w_selector_name not an instance of W_BytesObject' - raise PrimitiveFailedError - methodname = space.unwrap_string(w_selector_name) - idx = methodname.find(':') - if idx > 0: - methodname = methodname[0:idx] - wp_result = None - try: - py_attr = py_space.getattr(wp_rcvr, py_space.newtext(methodname)) - if (isinstance(py_attr, Function) or - isinstance(py_attr, Method) or - isinstance(py_attr, StaticMethod) or - isinstance(py_attr, ClassMethod)): - wp_result = utils.call_method(space, wp_rcvr, methodname, args_w) - else: - if len(args_w) == 1: - wp_value = utils.smalltalk_to_python(space, args_w[0]) - py_space.setattr(wp_rcvr, py_space.newtext(methodname), - wp_value) - wp_result = py_space.w_None - else: - wp_result = py_attr - except OperationError as operr: - return W_PythonObject(utils.operr_to_pylist(operr)) - except Exception as e: - print 'Unable to call %s on %s: %s' % (methodname, wp_rcvr, e) - raise PrimitiveFailedError - if wp_result is None: - # import pdb; pdb.set_trace() - print ('Result failure in send primitive (wp_rcvr: %s, methodname: %s)' - % (wp_rcvr, methodname)) - raise PrimitiveFailedError - s_frame.pop_n(argcount + 1) - return W_PythonObject(wp_result) diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index d2d51c0b..a98c7a3c 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -3,11 +3,15 @@ from rsqueakvm.util import system try: + from rsqueakvm.plugins.ruby import utils + from rsqueakvm.plugins.ruby.frame import WR_FrameObject from rsqueakvm.plugins.ruby.language import W_RubyLanguage from rsqueakvm.plugins.ruby.model import W_RubyObject, RubyClassShadow from rsqueakvm.plugins.ruby.objspace import ruby_space from rsqueakvm.plugins.ruby.patching import patch_topaz - from rsqueakvm.plugins.ruby.utils import ruby_to_smalltalk + + from topaz.error import RubyError, print_traceback + IMPORT_FAILED = False except ImportError as e: IMPORT_FAILED = True @@ -48,6 +52,33 @@ def new_w_language(space, args_w): def w_object_class(): return W_RubyObject + @staticmethod + def perform_send(space, w_rcvr, methodname, args_w): + wr_rcvr = utils.smalltalk_to_ruby(space, w_rcvr) + args_rw = [utils.smalltalk_to_ruby(space, w_arg) for w_arg in args_w] + idx = methodname.find(':') + if idx > 0: + methodname = methodname[0:idx] + wr_result = None + try: + wr_result = ruby_space.send(wr_rcvr, methodname, args_w=args_rw) + except RubyError as e: + print_traceback(ruby_space, e.w_value) + raise PrimitiveFailedError + if wr_result is None: + # import pdb; pdb.set_trace() + print ('No result in send primitive (wr_rcvr: %s, methodname: %s)' + % (wr_rcvr, methodname)) + raise PrimitiveFailedError + return W_RubyObject(wr_result) + + @staticmethod + def top_w_frame(): + topframe = ruby_space.getexecutioncontext().gettoprubyframe() + if topframe is None: + raise PrimitiveFailedError + return W_RubyObject(WR_FrameObject(topframe)) + @staticmethod def to_w_object(space, foreign_object): - return ruby_to_smalltalk(space, foreign_object.wr_object) + return utils.ruby_to_smalltalk(space, foreign_object.wr_object) diff --git a/rsqueakvm/plugins/ruby/frame.py b/rsqueakvm/plugins/ruby/frame.py new file mode 100644 index 00000000..25a41a7b --- /dev/null +++ b/rsqueakvm/plugins/ruby/frame.py @@ -0,0 +1,40 @@ +from topaz.module import ClassDef +from topaz.objects.objectobject import W_BaseObject as WR_BaseObject + + +class WR_FrameObject(WR_BaseObject): + _attrs_ = ['frame_object'] + _immutable_fields_ = ['frame_object'] + + classdef = ClassDef('FrameObject', WR_BaseObject.classdef) + + def __init__(self, frame_object): + self.frame_object = frame_object + + @classdef.method('get_previous') + def method_get_previous(self, space): + previous = self.frame_object.backref() + if previous is not None: + return WR_FrameObject(previous) + return space.w_nil + + @classdef.method('has_contents') + def method_has_contents(self, space): + return space.newbool(self.frame_object.has_contents()) + + @classdef.method('get_filename') + def method_get_filename(self, space): + return space.newstr_fromstr(self.frame_object.get_filename()) + + @classdef.method('get_lineno') + def method_get_lineno(self, space, prev_wr_frame=None): + prev_frame = None + if prev_wr_frame is not None: + if not isinstance(prev_wr_frame, WR_FrameObject): + return space.w_nil + prev_frame = prev_wr_frame.frame_object + return space.newstr_fromstr(self.frame_object.get_lineno(prev_frame)) + + @classdef.method('get_code_name') + def method_get_code_name(self, space): + return space.newstr_fromstr(self.frame_object.get_code_name()) diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index 547a4876..68762492 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -1,3 +1,4 @@ +from topaz.executioncontext import ExecutionContext as TopazExecutionContext from topaz.frame import Frame as TopazFrame from topaz.interpreter import Interpreter as TopazInterpreter @@ -42,3 +43,4 @@ def patch_topaz(): pass # this is fine TopazInterpreter.handle_bytecode = new_handle_bytecode + TopazExecutionContext.current_language = None diff --git a/rsqueakvm/plugins/ruby_plugin.py b/rsqueakvm/plugins/ruby_plugin.py index 9371f3d2..d65f973d 100644 --- a/rsqueakvm/plugins/ruby_plugin.py +++ b/rsqueakvm/plugins/ruby_plugin.py @@ -1,53 +1,3 @@ -from rsqueakvm.error import PrimitiveFailedError -from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.plugins.ruby import RubyPlugin -from rpython.rlib import jit - -try: - from rsqueakvm.plugins.ruby.model import W_RubyObject - from rsqueakvm.plugins.ruby.objspace import ruby_space - from rsqueakvm.plugins.ruby.utils import smalltalk_to_ruby - - from topaz.error import RubyError, print_traceback -except ImportError: - pass - - plugin = RubyPlugin() - - -# @plugin.expose_primitive(unwrap_spec=[object]) -# def getTopFrame(interp, s_frame, w_rcvr): -# # import pdb; pdb.set_trace() -# topframe = ruby_space.getexecutioncontext().gettoprubyframe() -# if topframe is None: -# raise PrimitiveFailedError -# TODO: topframe is not a topaz.objects.objectobject.W_Root object -# return W_RubyObject(topframe) - - -@plugin.expose_primitive(compiled_method=True) -@jit.unroll_safe -def send(interp, s_frame, argcount, w_method): - # import pdb; pdb.set_trace() - space = interp.space - args_w = s_frame.peek_n(argcount) - args_rw = [smalltalk_to_ruby(space, w_arg) for w_arg in args_w] - wr_rcvr = smalltalk_to_ruby(space, s_frame.peek(argcount)) - w_selector_name = w_method.literalat0(space, 2) - if not isinstance(w_selector_name, W_BytesObject): - print 'w_selector_name not an instance of W_BytesObject' - raise PrimitiveFailedError - methodname = space.unwrap_string(w_selector_name) - idx = methodname.find(':') - if idx > 0: - methodname = methodname[0:idx] - - try: - wr_result = ruby_space.send(wr_rcvr, methodname, args_w=args_rw) - s_frame.pop_n(argcount + 1) - return W_RubyObject(wr_result) - except RubyError as e: - print_traceback(ruby_space, e.w_value) - raise PrimitiveFailedError From 1cee8b4aeede16e8e6b2dada488dfc06bfe17d3c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 15 Mar 2017 11:23:30 +0100 Subject: [PATCH 132/193] Add debugging helpers --- rsqueakvm/plugins/python/__init__.py | 7 +++++++ rsqueakvm/plugins/ruby/__init__.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index 40143e77..a740f589 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -19,6 +19,13 @@ IMPORT_FAILED = False except ImportError: + try: + __import__('pypy') + # if pypy can be imported, then there must be a problem in the plugin + import pdb + pdb.set_trace() + except: + pass IMPORT_FAILED = True diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index a98c7a3c..2e23f3f6 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -14,6 +14,13 @@ IMPORT_FAILED = False except ImportError as e: + try: + __import__('topaz') + # if topaz can be imported, then there must be a problem in the plugin + import pdb + pdb.set_trace() + except: + pass IMPORT_FAILED = True From 4b6b040ffdf9558781e402294a68f46b3ca84085 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 18 Mar 2017 13:48:51 +0100 Subject: [PATCH 133/193] Implement exception catching for Ruby Frame walker is implemented, block analysis not yet. Therefore, RSqueak switches back to Smalltalk an all errors. --- rsqueakvm/plugins/python/patching.py | 2 +- rsqueakvm/plugins/ruby/patching.py | 44 ++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index b92510a2..b7103cd7 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -85,7 +85,7 @@ def block_handles_exception(self, block, operr_type): def has_exception_handler(self, operr): - "Returns True if this frame or one of his parents are able to handle operr" + "Returns True if this frame or one of its parents are able to handle operr" frame = self error_type = operr.w_type.getname(py_space) forbidden_names = [] diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index 68762492..a8f9a94b 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -1,8 +1,10 @@ from topaz.executioncontext import ExecutionContext as TopazExecutionContext from topaz.frame import Frame as TopazFrame -from topaz.interpreter import Interpreter as TopazInterpreter +from topaz.interpreter import ( + ApplicationException, Interpreter as TopazInterpreter) old_handle_bytecode = TopazInterpreter.handle_bytecode +old_handle_ruby_error = TopazInterpreter.handle_ruby_error SWITCH_COUNTER_SIZE = 1000 switch_counter = [SWITCH_COUNTER_SIZE] @@ -25,15 +27,48 @@ def switch_to_smalltalk(ec): language.reset_error() +def block_handles_exception(self, block, error_type): + # import pdb; pdb.set_trace() + return False + + +def has_exception_handler(self, error): + "Returns True if this frame or one of its parents are able to handle operr" + frame = self + while frame is not None: + if not isinstance(frame, TopazFrame): # only TopazFrames have blocks + print '%s is not a topaz `Frame`.' % frame + return True + block = frame.lastblock + while block is not None: + # block needs to be an ExceptBlock and able to handle operr + if ((block.handling_mask & ApplicationException.kind) != 0 and + frame.block_handles_exception(block, error.w_value)): + return True + block = block.lastblock + frame = frame.backref() + return False + + def new_handle_bytecode(self, space, pc, frame, bytecode): if switch_counter[0] <= 0: switch_counter[0] = SWITCH_COUNTER_SIZE switch_to_smalltalk(space.getexecutioncontext()) switch_counter[0] -= 1 - return old_handle_bytecode(self, space, pc, frame, bytecode) +def new_handle_ruby_error(self, space, pc, frame, bytecode, error): + ec = space.getexecutioncontext() + language = ec.current_language + if (language is not None and language.break_on_exceptions() and + not frame.has_exception_handler(error)): + language.set_error(error.w_value) + print 'Ruby error caught' + switch_to_smalltalk(ec) + return old_handle_ruby_error(self, space, pc, frame, bytecode, error) + + def patch_topaz(): # Patch-out virtualizables from Topaz so that translation works try: @@ -42,5 +77,8 @@ def patch_topaz(): except AttributeError: pass # this is fine - TopazInterpreter.handle_bytecode = new_handle_bytecode TopazExecutionContext.current_language = None + TopazFrame.has_exception_handler = has_exception_handler + TopazFrame.block_handles_exception = block_handles_exception + TopazInterpreter.handle_bytecode = new_handle_bytecode + TopazInterpreter.handle_ruby_error = new_handle_ruby_error From c11ab31150550d867cb4744a20ee153db0f727e8 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 20 Mar 2017 13:25:36 +0100 Subject: [PATCH 134/193] Improve Ruby integration;disable plugins on demand --- .../plugins/foreign_language/__init__.py | 5 +++++ .../plugins/foreign_language/language.py | 10 ++-------- rsqueakvm/plugins/foreign_language/model.py | 6 ++---- rsqueakvm/plugins/python/__init__.py | 18 +++++++++++++++--- rsqueakvm/plugins/python/language.py | 8 +++++--- rsqueakvm/plugins/python/objspace.py | 7 ++++--- rsqueakvm/plugins/ruby/__init__.py | 19 +++++++++++++++---- rsqueakvm/plugins/ruby/frame.py | 8 +++++++- rsqueakvm/plugins/ruby/language.py | 11 ++++++++--- rsqueakvm/plugins/ruby/model.py | 1 - rsqueakvm/plugins/ruby/objspace.py | 15 ++++++++++++++- 11 files changed, 77 insertions(+), 31 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 969de23e..359cde32 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -20,6 +20,9 @@ def load_special_objects(space, language_name, language_cls, shadow_cls): # Abstract methods + def is_operational(self): + raise NotImplementedError + @staticmethod def new_w_language(space, args_w): raise NotImplementedError @@ -41,6 +44,8 @@ def to_w_object(foreign_object): def register_default_primitives(self): @self.expose_primitive(result_is_new_frame=True) def eval(interp, s_frame, argcount): + if not self.is_operational(): + raise PrimitiveFailedError # import pdb; pdb.set_trace() args_w = s_frame.peek_n(argcount) language = self.new_w_language(interp.space, args_w) diff --git a/rsqueakvm/plugins/foreign_language/language.py b/rsqueakvm/plugins/foreign_language/language.py index 3c12821c..5a065449 100644 --- a/rsqueakvm/plugins/foreign_language/language.py +++ b/rsqueakvm/plugins/foreign_language/language.py @@ -1,4 +1,3 @@ -from rsqueakvm.error import Exit from rsqueakvm.plugins.foreign_language import runner from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.compiled_methods import ( @@ -6,14 +5,9 @@ from rsqueakvm.model.pointers import W_PointersObject from rsqueakvm.util.cells import QuasiConstant -from pypy.interpreter.executioncontext import ExecutionContext - from rpython.rlib import objectmodel -ExecutionContext.current_language = None - - class ForeignLanguageMeta(type): def __new__(cls, name, bases, attrs): # import pdb; pdb.set_trace() @@ -58,7 +52,7 @@ def load_special_objects(cls, language_name, space): foreign_class = space.smalltalk_at(language_name) if foreign_class is None: # disable plugin? - raise Exit('%s class not found.' % language_name) + print '%s class not found.' % language_name cls.w_foreign_class.set(foreign_class) resume_method_symbol = space.wrap_symbol('resume:') @@ -66,7 +60,7 @@ def load_special_objects(cls, language_name, space): space).as_class_get_shadow(space) resume_method = foreign_cls_cls_s.lookup(resume_method_symbol) if resume_method is None: - raise Exit('%s class>>resume: method not found.' % language_name) + print '%s class>>resume: method not found.' % language_name cls.w_foreign_resume.set(resume_method) # W_AbstractObjectWithIdentityHash overrides diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py index 32ad8c8a..d8a88293 100644 --- a/rsqueakvm/plugins/foreign_language/model.py +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -1,4 +1,3 @@ -from rsqueakvm.error import Exit from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.compiled_methods import ( W_PreSpurCompiledMethod, W_SpurCompiledMethod) @@ -99,13 +98,12 @@ def load_special_objects(cls, language_name, space): foreign_class = space.smalltalk_at(language_name) if foreign_class is None: - # disable plugin? - raise Exit('%s class not found.' % language_name) + print '%s class not found.' % language_name cls.w_foreign_class.set(foreign_class) foreign_object_class = space.smalltalk_at('%sObject' % language_name) if foreign_object_class is None: - raise Exit('%sObject class not found.' % language_name) + print '%sObject class not found.' % language_name cls.w_foreign_object_class.set(foreign_object_class) # Overrides diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index a740f589..6e4f53e8 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -1,4 +1,5 @@ from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.plugins.foreign_language import ForeignLanguagePlugin from rsqueakvm.util.cells import Cell from rsqueakvm.util.system import translationconfig @@ -42,6 +43,10 @@ def is_enabled(self): return False return ForeignLanguagePlugin.is_enabled(self) + def is_operational(self): + return (W_PythonLanguage.w_foreign_class.get() is not None and + PythonClassShadow.w_foreign_class.get() is not None) + def setup(self): translationconfig.set(thread=True) translationconfig.set(continuation=True) @@ -58,9 +63,16 @@ def startup(space, argv): def new_w_language(space, args_w): if len(args_w) != 4: raise PrimitiveFailedError - source = space.unwrap_string(args_w[0]) - filename = space.unwrap_string(args_w[1]) - cmd = space.unwrap_string(args_w[2]) + source_w = args_w[0] + filename_w = args_w[1] + cmd_w = args_w[2] + if (not isinstance(source_w, W_BytesObject) or + not isinstance(filename_w, W_BytesObject) or + not isinstance(cmd_w, W_BytesObject)): + raise PrimitiveFailedError + source = space.unwrap_string(source_w) + filename = space.unwrap_string(filename_w) + cmd = space.unwrap_string(cmd_w) break_on_exceptions = args_w[3] is space.w_true return W_PythonLanguage(source, filename, cmd, break_on_exceptions) diff --git a/rsqueakvm/plugins/python/language.py b/rsqueakvm/plugins/python/language.py index a5fe4fa5..dfb1f9fc 100644 --- a/rsqueakvm/plugins/python/language.py +++ b/rsqueakvm/plugins/python/language.py @@ -18,10 +18,9 @@ def __init__(self, source, filename, cmd, break_on_exceptions=True): def run(self): print 'Python start' + # ensure py_space has a fresh exectioncontext + must_leave = py_space.threadlocals.try_enter_thread(py_space) try: - # ensure py_space has a fresh exectioncontext - py_space.threadlocals.enter_thread(py_space) - # switch back to Squeak before executing Python code self.runner().return_to_smalltalk() @@ -31,6 +30,9 @@ def run(self): # operr was not handled by users, because they pressed proceed. # save Python error as result instead. self.set_result(operr_to_pylist(operr)) + finally: + if must_leave: + py_space.threadlocals.leave_thread(py_space) def set_current(self): ec = py_space.getexecutioncontext() diff --git a/rsqueakvm/plugins/python/objspace.py b/rsqueakvm/plugins/python/objspace.py index 4c943474..2a02a2d0 100644 --- a/rsqueakvm/plugins/python/objspace.py +++ b/rsqueakvm/plugins/python/objspace.py @@ -1,11 +1,11 @@ +import os +import sys + from rsqueakvm.plugins.python.switching import SwitchToSmalltalkAction from rsqueakvm.util import system def new_pypy_objspace(): - import os - import sys - # This module is reloaded, but pypy_getudir has already been deleted from pypy.module import sys as pypy_sys reload(pypy_sys) @@ -83,6 +83,7 @@ def new_pypy_objspace(): return py_space + py_space = new_pypy_objspace() switch_action = SwitchToSmalltalkAction(py_space) py_space.actionflag.register_periodic_action( diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 2e23f3f6..7f02f4fd 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -1,4 +1,5 @@ from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.plugins.foreign_language import ForeignLanguagePlugin from rsqueakvm.util import system @@ -35,6 +36,10 @@ def is_enabled(self): return False return ForeignLanguagePlugin.is_enabled(self) + def is_operational(self): + return (W_RubyLanguage.w_foreign_class.get() is not None and + RubyClassShadow.w_foreign_class.get() is not None) + def setup(self): system.translationconfig.set(thread=True) system.translationconfig.set(continuation=True) @@ -49,11 +54,17 @@ def startup(space, argv): @staticmethod def new_w_language(space, args_w): - if len(args_w) != 2: + if (len(args_w) != 3): + raise PrimitiveFailedError + source_w = args_w[0] + filepath_w = args_w[1] + if (not isinstance(source_w, W_BytesObject) or + not isinstance(filepath_w, W_BytesObject)): raise PrimitiveFailedError - source = space.unwrap_string(args_w[0]) - break_on_exceptions = args_w[1] is space.w_true - return W_RubyLanguage(source, break_on_exceptions) + source = space.unwrap_string(source_w) + filepath = space.unwrap_string(filepath_w) + break_on_exceptions = args_w[2] is space.w_true + return W_RubyLanguage(source, filepath, break_on_exceptions) @staticmethod def w_object_class(): diff --git a/rsqueakvm/plugins/ruby/frame.py b/rsqueakvm/plugins/ruby/frame.py index 25a41a7b..cd703adf 100644 --- a/rsqueakvm/plugins/ruby/frame.py +++ b/rsqueakvm/plugins/ruby/frame.py @@ -11,6 +11,12 @@ class WR_FrameObject(WR_BaseObject): def __init__(self, frame_object): self.frame_object = frame_object + @classdef.method('inspect') + @classdef.method('to_s') + def method_to_s(self, space): + return space.newstr_fromstr( + 'Wrapped topaz frame (%s)' % self.frame_object) + @classdef.method('get_previous') def method_get_previous(self, space): previous = self.frame_object.backref() @@ -33,7 +39,7 @@ def method_get_lineno(self, space, prev_wr_frame=None): if not isinstance(prev_wr_frame, WR_FrameObject): return space.w_nil prev_frame = prev_wr_frame.frame_object - return space.newstr_fromstr(self.frame_object.get_lineno(prev_frame)) + return space.newint(self.frame_object.get_lineno(prev_frame)) @classdef.method('get_code_name') def method_get_code_name(self, space): diff --git a/rsqueakvm/plugins/ruby/language.py b/rsqueakvm/plugins/ruby/language.py index b2e015e8..3c4943b5 100644 --- a/rsqueakvm/plugins/ruby/language.py +++ b/rsqueakvm/plugins/ruby/language.py @@ -6,20 +6,25 @@ class W_RubyLanguage(W_ForeignLanguage): - _attrs_ = ['source'] + _attrs_ = ['source', 'filepath'] repr_classname = 'W_RubyLanguage' - def __init__(self, source, break_on_exceptions=True): + def __init__(self, source, filepath='-e', break_on_exceptions=True): W_ForeignLanguage.__init__(self, break_on_exceptions) self.source = source + self.filepath = filepath def run(self): print 'Ruby start' + must_leave = ruby_space.threadlocals.try_enter_thread() try: - retval = ruby_space.execute(self.source) + retval = ruby_space.execute(self.source, filepath=self.filepath) self.set_result(retval) except RubyError as e: self.set_result(e.w_value) + finally: + if must_leave: + ruby_space.threadlocals.leave_thread() def set_current(self): ec = ruby_space.getexecutioncontext() diff --git a/rsqueakvm/plugins/ruby/model.py b/rsqueakvm/plugins/ruby/model.py index 85b29cd0..61f6bf46 100644 --- a/rsqueakvm/plugins/ruby/model.py +++ b/rsqueakvm/plugins/ruby/model.py @@ -11,7 +11,6 @@ class W_RubyObject(W_ForeignLanguageObject): def __init__(self, wr_object): W_ForeignLanguageObject.__init__(self) self.wr_object = wr_object - # self.w_pyID = None self.s_class = None def getclass(self, space): diff --git a/rsqueakvm/plugins/ruby/objspace.py b/rsqueakvm/plugins/ruby/objspace.py index 7dc98bd5..af32e29d 100644 --- a/rsqueakvm/plugins/ruby/objspace.py +++ b/rsqueakvm/plugins/ruby/objspace.py @@ -1,3 +1,16 @@ +import sys + +from topaz.main import get_topaz_config_options from topaz.objspace import ObjectSpace -ruby_space = ObjectSpace(None) +from rpython.config.translationoption import get_combined_translation_config + + +def new_topaz_objspace(): + translating = sys.argv[0] == '.build/build.py' # make better + config = get_combined_translation_config(translating=translating) + config.set(**get_topaz_config_options()) + config.translation.suggest(check_str_without_nul=True) + return ObjectSpace(config) + +ruby_space = new_topaz_objspace() From a90fd0e6e6458778acfe2ba56f2be1cd6573ab92 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 21 Mar 2017 13:07:36 +0100 Subject: [PATCH 135/193] Temporarily use threadlocals branch for topaz --- .build/download_dependencies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build/download_dependencies.py b/.build/download_dependencies.py index c9fd1e11..40a10409 100755 --- a/.build/download_dependencies.py +++ b/.build/download_dependencies.py @@ -181,7 +181,7 @@ def buildsdl(directory, args=None): Dependency("https://github.com/alex/rply/archive/master.zip", "rply", test=plugin("RubyPlugin")), Dependency("https://github.com/ActiveState/appdirs/archive/master.zip", "appdirs", test=plugin("RubyPlugin")), - Dependency("https://github.com/topazproject/topaz/archive/master.zip", "topaz", test=plugin("RubyPlugin")), + Dependency("https://github.com/fniephaus/topaz/archive/threadlocals.zip", "topaz", test=plugin("RubyPlugin")), Dependency("https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-win32.zip", "Windows/pypybin", test=windows, callback=pypywin32), Dependency("http://libsdl.org/release/SDL2-devel-2.0.5-VC.zip", "Windows/SDL", test=windows), From 121900a162de7552fed6803fd2f6bee86c94b882 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 11:19:12 +0100 Subject: [PATCH 136/193] Improve frame walking topaz BaseFrames are used for builtins, so skip them for now. --- rsqueakvm/plugins/ruby/patching.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index a8f9a94b..aaf11035 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -36,16 +36,14 @@ def has_exception_handler(self, error): "Returns True if this frame or one of its parents are able to handle operr" frame = self while frame is not None: - if not isinstance(frame, TopazFrame): # only TopazFrames have blocks - print '%s is not a topaz `Frame`.' % frame - return True - block = frame.lastblock - while block is not None: - # block needs to be an ExceptBlock and able to handle operr - if ((block.handling_mask & ApplicationException.kind) != 0 and - frame.block_handles_exception(block, error.w_value)): - return True - block = block.lastblock + if isinstance(frame, TopazFrame): # skip BaseFrames + block = frame.lastblock + while block is not None: + # block needs to be an ExceptBlock and able to handle operr + if ((block.handling_mask & ApplicationException.kind) != 0 and + frame.block_handles_exception(block, error.w_value)): + return True + block = block.lastblock frame = frame.backref() return False From 15315787ad34b68bc6226497520268901bc1d9c5 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 14:08:59 +0100 Subject: [PATCH 137/193] Improve the use of stacklet handles --- rsqueakvm/plugins/foreign_language/runner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/runner.py b/rsqueakvm/plugins/foreign_language/runner.py index fe03c72c..6673d109 100644 --- a/rsqueakvm/plugins/foreign_language/runner.py +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -50,16 +50,16 @@ def resume_thread(self): if not self._is_valid_handle(self.language_handle): print 'language_handle not valid' return - self.sthread.switch(self.language_handle) + self.language_handle = self.sthread.switch(self.language_handle) def return_to_smalltalk(self): if not self._is_valid_handle(self.smalltalk_handle): print 'smalltalk_handle not valid' return - self.sthread.switch(self.smalltalk_handle) + self.smalltalk_handle = self.sthread.switch(self.smalltalk_handle) def _is_valid_handle(self, h): - if (self.sthread.is_empty_handle(h) or + if (h is None or self.sthread.is_empty_handle(h) or h == self.sthread.get_null_handle()): return False return True From 5a630c8a5359faaec8436021771f5852b3aa1e58 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 14:10:39 +0100 Subject: [PATCH 138/193] Use a new ec per language process --- .../plugins/foreign_language/__init__.py | 12 ++++----- .../plugins/foreign_language/language.py | 4 +++ rsqueakvm/plugins/python/__init__.py | 7 ----- rsqueakvm/plugins/python/language.py | 20 ++++++++------ rsqueakvm/plugins/python/patching.py | 19 ++++++++++--- rsqueakvm/plugins/python/switching.py | 2 +- rsqueakvm/plugins/ruby/__init__.py | 8 ------ rsqueakvm/plugins/ruby/language.py | 21 ++++++++++----- rsqueakvm/plugins/ruby/patching.py | 27 +++++++++++++------ 9 files changed, 70 insertions(+), 50 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 359cde32..0f7f240a 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -31,10 +31,6 @@ def new_w_language(space, args_w): def w_object_class(): raise NotImplementedError - @staticmethod - def top_w_frame(): - raise PrimitiveFailedError - @staticmethod def to_w_object(foreign_object): raise NotImplementedError @@ -92,9 +88,11 @@ def lastError(interp, s_frame, w_rcvr, language): raise PrimitiveFailedError return w_error - @self.expose_primitive(unwrap_spec=[object]) - def getTopFrame(interp, s_frame, w_rcvr): - return self.top_w_frame() + @self.expose_primitive(unwrap_spec=[object, object]) + def getTopFrame(interp, s_frame, w_rcvr, language): + if not isinstance(language, W_ForeignLanguage): + raise PrimitiveFailedError + return language.top_w_frame() @self.expose_primitive(unwrap_spec=[object]) def asSmalltalk(interp, s_frame, w_rcvr): diff --git a/rsqueakvm/plugins/foreign_language/language.py b/rsqueakvm/plugins/foreign_language/language.py index 5a065449..e171fc72 100644 --- a/rsqueakvm/plugins/foreign_language/language.py +++ b/rsqueakvm/plugins/foreign_language/language.py @@ -1,3 +1,4 @@ +from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.plugins.foreign_language import runner from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.compiled_methods import ( @@ -98,6 +99,9 @@ def set_error(self, error): def set_current(self): raise NotImplementedError + def top_w_frame(self): + raise PrimitiveFailedError + # Helpers def run_safe(self): diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index 6e4f53e8..8be5d6e8 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -119,13 +119,6 @@ def perform_send(space, w_rcvr, attrname, args_w): raise PrimitiveFailedError return W_PythonObject(wp_result) - @staticmethod - def top_w_frame(): - topframe = py_space.getexecutioncontext().gettopframe() - if topframe is None: - raise PrimitiveFailedError - return W_PythonObject(topframe) - @staticmethod def to_w_object(space, foreign_object): return utils.python_to_smalltalk(space, foreign_object.wp_object) diff --git a/rsqueakvm/plugins/python/language.py b/rsqueakvm/plugins/python/language.py index dfb1f9fc..3e0ec241 100644 --- a/rsqueakvm/plugins/python/language.py +++ b/rsqueakvm/plugins/python/language.py @@ -1,3 +1,4 @@ +from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.objspace import py_space @@ -7,7 +8,7 @@ class W_PythonLanguage(W_ForeignLanguage): - _attrs_ = ['source', 'filename', 'cmd'] + _attrs_ = ['source', 'filename', 'cmd', 'ec'] repr_classname = 'W_PythonLanguage' def __init__(self, source, filename, cmd, break_on_exceptions=True): @@ -15,11 +16,10 @@ def __init__(self, source, filename, cmd, break_on_exceptions=True): self.source = source self.filename = filename self.cmd = cmd + self.ec = py_space.createexecutioncontext() def run(self): print 'Python start' - # ensure py_space has a fresh exectioncontext - must_leave = py_space.threadlocals.try_enter_thread(py_space) try: # switch back to Squeak before executing Python code self.runner().return_to_smalltalk() @@ -30,16 +30,20 @@ def run(self): # operr was not handled by users, because they pressed proceed. # save Python error as result instead. self.set_result(operr_to_pylist(operr)) - finally: - if must_leave: - py_space.threadlocals.leave_thread(py_space) def set_current(self): - ec = py_space.getexecutioncontext() - ec.current_language = self + py_space.current_language.set(self) def set_result(self, wp_result): self.w_result = W_PythonObject(wp_result) def set_error(self, wp_operr): self.w_error = W_PythonObject(operr_to_pylist(wp_operr)) + + def top_w_frame(self): + if self.ec is None: + raise PrimitiveFailedError + topframe = self.ec.gettopframe() + if topframe is None: + raise PrimitiveFailedError + return W_PythonObject(topframe) diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index b7103cd7..3485dea4 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,10 +1,12 @@ +from rsqueakvm.plugins.python.language import W_PythonLanguage from rsqueakvm.plugins.python.objspace import py_space, switch_action from rsqueakvm.plugins.python.switching import RestartException +from rsqueakvm.util.cells import QuasiConstant from pypy.interpreter.pycode import PyCode, default_magic from pypy.interpreter.pyopcode import SApplicationException -from pypy.interpreter.executioncontext import ExecutionContext from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver +from pypy.objspace.std import StdObjSpace as PyStdObjSpace from pypy.tool.stdlib_opcode import bytecode_spec from rpython.rlib.rarithmetic import intmask @@ -15,6 +17,7 @@ old_execute_frame = PyFrame.execute_frame old_handle_operation_error = PyFrame.handle_operation_error old_init_pycode = PyCode.__init__ +old_getexecutioncontext = PyStdObjSpace.getexecutioncontext ATTRIBUTE_ERROR_FORBIDDEN_NAMES = ['getattr'] STOP_ITERATION_FORBIDDEN_NAMES = ['next'] @@ -112,7 +115,7 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): if isinstance(operr, RestartException): print 'Re-raising RestartException' raise operr - language = ec.current_language + language = self.space.current_language.get() if (language is not None and language.break_on_exceptions() and not self.has_exception_handler(operr)): # import pdb; pdb.set_trace() @@ -133,6 +136,13 @@ def __init__pycode(self, space, argcount, nlocals, stacksize, flags, hidden_applevel, magic) +def new_getexecutioncontext(self): + current_language = self.current_language.get() + if current_language is not None: + return current_language.ec + return old_getexecutioncontext(self) + + def patch_pypy(): # Patch-out virtualizables from PyPy so that translation works try: @@ -142,8 +152,6 @@ def patch_pypy(): except AttributeError: pass - ExecutionContext.current_language = None - PyFrame.__init__ = __init__frame PyFrame.execute_frame = new_execute_frame PyFrame.block_handles_exception = block_handles_exception @@ -152,3 +160,6 @@ def patch_pypy(): PyCode.__init__ = __init__pycode PyCode._immutable_fields_.append('_co_names[*]') + + PyStdObjSpace.current_language = QuasiConstant(None, W_PythonLanguage) + PyStdObjSpace.getexecutioncontext = new_getexecutioncontext diff --git a/rsqueakvm/plugins/python/switching.py b/rsqueakvm/plugins/python/switching.py index f7aed165..57827a98 100644 --- a/rsqueakvm/plugins/python/switching.py +++ b/rsqueakvm/plugins/python/switching.py @@ -11,7 +11,7 @@ def perform(self, ec, frame): from rsqueakvm.plugins.python import PythonPlugin # import pdb; pdb.set_trace() - language = ec.current_language + language = ec.space.current_language.get() if language is None: return runner = language.runner() diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 7f02f4fd..05924f6b 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -5,7 +5,6 @@ try: from rsqueakvm.plugins.ruby import utils - from rsqueakvm.plugins.ruby.frame import WR_FrameObject from rsqueakvm.plugins.ruby.language import W_RubyLanguage from rsqueakvm.plugins.ruby.model import W_RubyObject, RubyClassShadow from rsqueakvm.plugins.ruby.objspace import ruby_space @@ -90,13 +89,6 @@ def perform_send(space, w_rcvr, methodname, args_w): raise PrimitiveFailedError return W_RubyObject(wr_result) - @staticmethod - def top_w_frame(): - topframe = ruby_space.getexecutioncontext().gettoprubyframe() - if topframe is None: - raise PrimitiveFailedError - return W_RubyObject(WR_FrameObject(topframe)) - @staticmethod def to_w_object(space, foreign_object): return utils.ruby_to_smalltalk(space, foreign_object.wr_object) diff --git a/rsqueakvm/plugins/ruby/language.py b/rsqueakvm/plugins/ruby/language.py index 3c4943b5..ce3bb950 100644 --- a/rsqueakvm/plugins/ruby/language.py +++ b/rsqueakvm/plugins/ruby/language.py @@ -1,37 +1,44 @@ +from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage +from rsqueakvm.plugins.ruby.frame import WR_FrameObject from rsqueakvm.plugins.ruby.model import W_RubyObject from rsqueakvm.plugins.ruby.objspace import ruby_space from topaz.error import RubyError +from topaz.executioncontext import ExecutionContext class W_RubyLanguage(W_ForeignLanguage): - _attrs_ = ['source', 'filepath'] + _attrs_ = ['source', 'filepath', 'ec'] repr_classname = 'W_RubyLanguage' def __init__(self, source, filepath='-e', break_on_exceptions=True): W_ForeignLanguage.__init__(self, break_on_exceptions) self.source = source self.filepath = filepath + self.ec = ExecutionContext() def run(self): print 'Ruby start' - must_leave = ruby_space.threadlocals.try_enter_thread() try: retval = ruby_space.execute(self.source, filepath=self.filepath) self.set_result(retval) except RubyError as e: self.set_result(e.w_value) - finally: - if must_leave: - ruby_space.threadlocals.leave_thread() def set_current(self): - ec = ruby_space.getexecutioncontext() - ec.current_language = self + ruby_space.current_language.set(self) def set_result(self, wr_result): self.w_result = W_RubyObject(wr_result) def set_error(self, wr_error): self.w_error = W_RubyObject(wr_error) + + def top_w_frame(self): + if self.ec is None: + raise PrimitiveFailedError + topframe = self.ec.gettoprubyframe() + if topframe is None: + raise PrimitiveFailedError + return W_RubyObject(WR_FrameObject(topframe)) diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index aaf11035..b91f3581 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -1,18 +1,21 @@ -from topaz.executioncontext import ExecutionContext as TopazExecutionContext +from rsqueakvm.plugins.ruby.language import W_RubyLanguage +from rsqueakvm.util.cells import QuasiConstant + from topaz.frame import Frame as TopazFrame from topaz.interpreter import ( ApplicationException, Interpreter as TopazInterpreter) +from topaz.objspace import ObjectSpace as TopazObjectSpace old_handle_bytecode = TopazInterpreter.handle_bytecode old_handle_ruby_error = TopazInterpreter.handle_ruby_error +old_getexecutioncontext = TopazObjectSpace.getexecutioncontext SWITCH_COUNTER_SIZE = 1000 switch_counter = [SWITCH_COUNTER_SIZE] -def switch_to_smalltalk(ec): +def switch_to_smalltalk(language): # import pdb; pdb.set_trace() - language = ec.current_language if language is None: return runner = language.runner() @@ -51,22 +54,28 @@ def has_exception_handler(self, error): def new_handle_bytecode(self, space, pc, frame, bytecode): if switch_counter[0] <= 0: switch_counter[0] = SWITCH_COUNTER_SIZE - switch_to_smalltalk(space.getexecutioncontext()) + switch_to_smalltalk(space.current_language.get()) switch_counter[0] -= 1 return old_handle_bytecode(self, space, pc, frame, bytecode) def new_handle_ruby_error(self, space, pc, frame, bytecode, error): - ec = space.getexecutioncontext() - language = ec.current_language + language = space.current_language.get() if (language is not None and language.break_on_exceptions() and not frame.has_exception_handler(error)): language.set_error(error.w_value) print 'Ruby error caught' - switch_to_smalltalk(ec) + switch_to_smalltalk(space.current_language.get()) return old_handle_ruby_error(self, space, pc, frame, bytecode, error) +def new_getexecutioncontext(self): + current_language = self.current_language.get() + if current_language is not None: + return current_language.ec + return old_getexecutioncontext(self) + + def patch_topaz(): # Patch-out virtualizables from Topaz so that translation works try: @@ -75,8 +84,10 @@ def patch_topaz(): except AttributeError: pass # this is fine - TopazExecutionContext.current_language = None TopazFrame.has_exception_handler = has_exception_handler TopazFrame.block_handles_exception = block_handles_exception TopazInterpreter.handle_bytecode = new_handle_bytecode TopazInterpreter.handle_ruby_error = new_handle_ruby_error + + TopazObjectSpace.current_language = QuasiConstant(None, W_RubyLanguage) + TopazObjectSpace.getexecutioncontext = new_getexecutioncontext From ef36c53883d2538a4a54349e917c2f1aee9e7e46 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 14:11:36 +0100 Subject: [PATCH 139/193] Ensure sys.(prefix|exec_prefix) are set and re-enable allworkingmodules --- rsqueakvm/plugins/python/objspace.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/python/objspace.py b/rsqueakvm/plugins/python/objspace.py index 2a02a2d0..b562f5a1 100644 --- a/rsqueakvm/plugins/python/objspace.py +++ b/rsqueakvm/plugins/python/objspace.py @@ -4,6 +4,8 @@ from rsqueakvm.plugins.python.switching import SwitchToSmalltalkAction from rsqueakvm.util import system +from pypy.module.sys.initpath import pypy_find_stdlib + def new_pypy_objspace(): # This module is reloaded, but pypy_getudir has already been deleted @@ -26,9 +28,9 @@ def new_pypy_objspace(): # disabling cffi backend for now, it also causes an undefined symbol error pypy_config.objspace.usemodules._cffi_backend = False - # disabled to save compile time - # from pypy.config.pypyoption import enable_allworkingmodules - # enable_allworkingmodules(pypy_config) + # disable to save compile time + from pypy.config.pypyoption import enable_allworkingmodules + enable_allworkingmodules(pypy_config) from pypy.config.pypyoption import enable_translationmodules enable_translationmodules(pypy_config) @@ -81,6 +83,9 @@ def new_pypy_objspace(): py_space.setattr(w_sys, py_space.newtext('executable'), py_space.newtext(os.path.abspath(sys.argv[0]))) + # Set sys.(prefix|exec_prefix) in PyPy + pypy_find_stdlib(py_space, sys.argv[0]) + return py_space From 4310f6aa5dec566c5b466d2e200d27863d6115a5 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 14:30:55 +0100 Subject: [PATCH 140/193] =?UTF-8?q?Rename=20=E2=80=9CLanguage=E2=80=9D=20t?= =?UTF-8?q?o=20=E2=80=9CProcess=E2=80=9D=20where=20appropriate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rsqueakvm/plugins/foreign_language/__init__.py | 12 ++++++------ .../foreign_language/{language.py => process.py} | 10 +++++----- rsqueakvm/plugins/python/__init__.py | 14 +++++++------- rsqueakvm/plugins/python/patching.py | 4 ++-- .../plugins/python/{language.py => process.py} | 8 ++++---- rsqueakvm/plugins/ruby/__init__.py | 15 +++++++-------- rsqueakvm/plugins/ruby/patching.py | 4 ++-- .../plugins/ruby/{language.py => process.py} | 8 ++++---- 8 files changed, 37 insertions(+), 38 deletions(-) rename rsqueakvm/plugins/foreign_language/{language.py => process.py} (96%) rename rsqueakvm/plugins/python/{language.py => process.py} (86%) rename rsqueakvm/plugins/ruby/{language.py => process.py} (84%) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 0f7f240a..3f935507 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -1,7 +1,7 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.variable import W_BytesObject -from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage from rsqueakvm.plugins.foreign_language.model import W_ForeignLanguageObject +from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess from rsqueakvm.plugins.plugin import Plugin from rpython.rlib import jit @@ -24,7 +24,7 @@ def is_operational(self): raise NotImplementedError @staticmethod - def new_w_language(space, args_w): + def new_w_language_process(space, args_w): raise NotImplementedError @staticmethod @@ -44,7 +44,7 @@ def eval(interp, s_frame, argcount): raise PrimitiveFailedError # import pdb; pdb.set_trace() args_w = s_frame.peek_n(argcount) - language = self.new_w_language(interp.space, args_w) + language = self.new_w_language_process(interp.space, args_w) language.start() # when we are here, the foreign language process has yielded frame = language.switch_to_smalltalk(interp, s_frame, @@ -57,7 +57,7 @@ def eval(interp, s_frame, argcount): def resume(interp, s_frame, w_rcvr, language): # print 'Smalltalk yield' # import pdb; pdb.set_trace() - if not isinstance(language, W_ForeignLanguage): + if not isinstance(language, W_ForeignLanguageProcess): raise PrimitiveFailedError if not language.resume(): raise PrimitiveFailedError @@ -80,7 +80,7 @@ def send(interp, s_frame, argcount, w_method): @self.expose_primitive(unwrap_spec=[object, object]) def lastError(interp, s_frame, w_rcvr, language): - if not isinstance(language, W_ForeignLanguage): + if not isinstance(language, W_ForeignLanguageProcess): raise PrimitiveFailedError w_error = language.get_error() if w_error is None: @@ -90,7 +90,7 @@ def lastError(interp, s_frame, w_rcvr, language): @self.expose_primitive(unwrap_spec=[object, object]) def getTopFrame(interp, s_frame, w_rcvr, language): - if not isinstance(language, W_ForeignLanguage): + if not isinstance(language, W_ForeignLanguageProcess): raise PrimitiveFailedError return language.top_w_frame() diff --git a/rsqueakvm/plugins/foreign_language/language.py b/rsqueakvm/plugins/foreign_language/process.py similarity index 96% rename from rsqueakvm/plugins/foreign_language/language.py rename to rsqueakvm/plugins/foreign_language/process.py index e171fc72..a1361d89 100644 --- a/rsqueakvm/plugins/foreign_language/language.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -9,11 +9,11 @@ from rpython.rlib import objectmodel -class ForeignLanguageMeta(type): +class ForeignLanguageProcessMeta(type): def __new__(cls, name, bases, attrs): # import pdb; pdb.set_trace() - if name != 'W_ForeignLanguage': + if name != 'W_ForeignLanguageProcess': w_foreign_class = QuasiConstant(None, cls=W_PointersObject) w_foreign_resume = QuasiConstant(None, cls=W_PointersObject) @@ -31,11 +31,11 @@ def resume_method(self): return type.__new__(cls, name, bases, attrs) -class W_ForeignLanguage(W_AbstractObjectWithIdentityHash): - __metaclass__ = ForeignLanguageMeta +class W_ForeignLanguageProcess(W_AbstractObjectWithIdentityHash): + __metaclass__ = ForeignLanguageProcessMeta _attrs_ = [ '_runner', '_done', 'w_result', 'w_error', '_break_on_exceptions'] - repr_classname = 'W_ForeignLanguage' + repr_classname = 'W_ForeignLanguageProcess' def __init__(self, break_on_exceptions=True): W_AbstractObjectWithIdentityHash.__init__(self) diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index 8be5d6e8..60fa6627 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -8,9 +8,9 @@ from rsqueakvm.plugins.python import utils from rsqueakvm.plugins.python.model import ( W_PythonObject, PythonClassShadow) - from rsqueakvm.plugins.python.language import W_PythonLanguage from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.plugins.python.patching import patch_pypy + from rsqueakvm.plugins.python.process import W_PythonProcess from rsqueakvm.plugins.python.switching import PyFrameRestartInfo from pypy.interpreter.argument import Arguments @@ -25,8 +25,8 @@ # if pypy can be imported, then there must be a problem in the plugin import pdb pdb.set_trace() - except: - pass + except Exception as e: + print e IMPORT_FAILED = True @@ -44,7 +44,7 @@ def is_enabled(self): return ForeignLanguagePlugin.is_enabled(self) def is_operational(self): - return (W_PythonLanguage.w_foreign_class.get() is not None and + return (W_PythonProcess.w_foreign_class.get() is not None and PythonClassShadow.w_foreign_class.get() is not None) def setup(self): @@ -56,11 +56,11 @@ def setup(self): def startup(space, argv): ForeignLanguagePlugin.load_special_objects( space, PythonPlugin.language_name, - W_PythonLanguage, PythonClassShadow) + W_PythonProcess, PythonClassShadow) py_space.startup() @staticmethod - def new_w_language(space, args_w): + def new_w_language_process(space, args_w): if len(args_w) != 4: raise PrimitiveFailedError source_w = args_w[0] @@ -74,7 +74,7 @@ def new_w_language(space, args_w): filename = space.unwrap_string(filename_w) cmd = space.unwrap_string(cmd_w) break_on_exceptions = args_w[3] is space.w_true - return W_PythonLanguage(source, filename, cmd, break_on_exceptions) + return W_PythonProcess(source, filename, cmd, break_on_exceptions) @staticmethod def w_object_class(): diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 3485dea4..8dc6c550 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,5 +1,5 @@ -from rsqueakvm.plugins.python.language import W_PythonLanguage from rsqueakvm.plugins.python.objspace import py_space, switch_action +from rsqueakvm.plugins.python.process import W_PythonProcess from rsqueakvm.plugins.python.switching import RestartException from rsqueakvm.util.cells import QuasiConstant @@ -161,5 +161,5 @@ def patch_pypy(): PyCode.__init__ = __init__pycode PyCode._immutable_fields_.append('_co_names[*]') - PyStdObjSpace.current_language = QuasiConstant(None, W_PythonLanguage) + PyStdObjSpace.current_language = QuasiConstant(None, W_PythonProcess) PyStdObjSpace.getexecutioncontext = new_getexecutioncontext diff --git a/rsqueakvm/plugins/python/language.py b/rsqueakvm/plugins/python/process.py similarity index 86% rename from rsqueakvm/plugins/python/language.py rename to rsqueakvm/plugins/python/process.py index 3e0ec241..0260a900 100644 --- a/rsqueakvm/plugins/python/language.py +++ b/rsqueakvm/plugins/python/process.py @@ -1,5 +1,5 @@ from rsqueakvm.error import PrimitiveFailedError -from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage +from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist @@ -7,12 +7,12 @@ from pypy.interpreter.error import OperationError -class W_PythonLanguage(W_ForeignLanguage): +class W_PythonProcess(W_ForeignLanguageProcess): _attrs_ = ['source', 'filename', 'cmd', 'ec'] - repr_classname = 'W_PythonLanguage' + repr_classname = 'W_PythonProcess' def __init__(self, source, filename, cmd, break_on_exceptions=True): - W_ForeignLanguage.__init__(self, break_on_exceptions) + W_ForeignLanguageProcess.__init__(self, break_on_exceptions) self.source = source self.filename = filename self.cmd = cmd diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 05924f6b..7c987c10 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -5,10 +5,10 @@ try: from rsqueakvm.plugins.ruby import utils - from rsqueakvm.plugins.ruby.language import W_RubyLanguage from rsqueakvm.plugins.ruby.model import W_RubyObject, RubyClassShadow from rsqueakvm.plugins.ruby.objspace import ruby_space from rsqueakvm.plugins.ruby.patching import patch_topaz + from rsqueakvm.plugins.ruby.process import W_RubyProcess from topaz.error import RubyError, print_traceback @@ -19,8 +19,8 @@ # if topaz can be imported, then there must be a problem in the plugin import pdb pdb.set_trace() - except: - pass + except Exception as e: + print e IMPORT_FAILED = True @@ -36,7 +36,7 @@ def is_enabled(self): return ForeignLanguagePlugin.is_enabled(self) def is_operational(self): - return (W_RubyLanguage.w_foreign_class.get() is not None and + return (W_RubyProcess.w_foreign_class.get() is not None and RubyClassShadow.w_foreign_class.get() is not None) def setup(self): @@ -47,12 +47,11 @@ def setup(self): @staticmethod def startup(space, argv): ForeignLanguagePlugin.load_special_objects( - space, RubyPlugin.language_name, - W_RubyLanguage, RubyClassShadow) + space, RubyPlugin.language_name, W_RubyProcess, RubyClassShadow) ruby_space.setup(argv[0]) @staticmethod - def new_w_language(space, args_w): + def new_w_language_process(space, args_w): if (len(args_w) != 3): raise PrimitiveFailedError source_w = args_w[0] @@ -63,7 +62,7 @@ def new_w_language(space, args_w): source = space.unwrap_string(source_w) filepath = space.unwrap_string(filepath_w) break_on_exceptions = args_w[2] is space.w_true - return W_RubyLanguage(source, filepath, break_on_exceptions) + return W_RubyProcess(source, filepath, break_on_exceptions) @staticmethod def w_object_class(): diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index b91f3581..9c375aff 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -1,4 +1,4 @@ -from rsqueakvm.plugins.ruby.language import W_RubyLanguage +from rsqueakvm.plugins.ruby.process import W_RubyProcess from rsqueakvm.util.cells import QuasiConstant from topaz.frame import Frame as TopazFrame @@ -89,5 +89,5 @@ def patch_topaz(): TopazInterpreter.handle_bytecode = new_handle_bytecode TopazInterpreter.handle_ruby_error = new_handle_ruby_error - TopazObjectSpace.current_language = QuasiConstant(None, W_RubyLanguage) + TopazObjectSpace.current_language = QuasiConstant(None, W_RubyProcess) TopazObjectSpace.getexecutioncontext = new_getexecutioncontext diff --git a/rsqueakvm/plugins/ruby/language.py b/rsqueakvm/plugins/ruby/process.py similarity index 84% rename from rsqueakvm/plugins/ruby/language.py rename to rsqueakvm/plugins/ruby/process.py index ce3bb950..37db820c 100644 --- a/rsqueakvm/plugins/ruby/language.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -1,5 +1,5 @@ from rsqueakvm.error import PrimitiveFailedError -from rsqueakvm.plugins.foreign_language.language import W_ForeignLanguage +from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess from rsqueakvm.plugins.ruby.frame import WR_FrameObject from rsqueakvm.plugins.ruby.model import W_RubyObject from rsqueakvm.plugins.ruby.objspace import ruby_space @@ -8,12 +8,12 @@ from topaz.executioncontext import ExecutionContext -class W_RubyLanguage(W_ForeignLanguage): +class W_RubyProcess(W_ForeignLanguageProcess): _attrs_ = ['source', 'filepath', 'ec'] - repr_classname = 'W_RubyLanguage' + repr_classname = 'W_RubyProcess' def __init__(self, source, filepath='-e', break_on_exceptions=True): - W_ForeignLanguage.__init__(self, break_on_exceptions) + W_ForeignLanguageProcess.__init__(self, break_on_exceptions) self.source = source self.filepath = filepath self.ec = ExecutionContext() From 4dd6a4ba0c3bff942cbefcaeb209df542856e4aa Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 14:31:05 +0100 Subject: [PATCH 141/193] Revert "Temporarily use threadlocals branch for topaz" This reverts commit a90fd0e6e6458778acfe2ba56f2be1cd6573ab92. --- .build/download_dependencies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build/download_dependencies.py b/.build/download_dependencies.py index 40a10409..c9fd1e11 100755 --- a/.build/download_dependencies.py +++ b/.build/download_dependencies.py @@ -181,7 +181,7 @@ def buildsdl(directory, args=None): Dependency("https://github.com/alex/rply/archive/master.zip", "rply", test=plugin("RubyPlugin")), Dependency("https://github.com/ActiveState/appdirs/archive/master.zip", "appdirs", test=plugin("RubyPlugin")), - Dependency("https://github.com/fniephaus/topaz/archive/threadlocals.zip", "topaz", test=plugin("RubyPlugin")), + Dependency("https://github.com/topazproject/topaz/archive/master.zip", "topaz", test=plugin("RubyPlugin")), Dependency("https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-win32.zip", "Windows/pypybin", test=windows, callback=pypywin32), Dependency("http://libsdl.org/release/SDL2-devel-2.0.5-VC.zip", "Windows/SDL", test=windows), From a1fd23f84a96ea813b5f623f6f58f2f73551a420 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 15:42:23 +0100 Subject: [PATCH 142/193] =?UTF-8?q?More=20=E2=80=9CLanguage=E2=80=9D=20to?= =?UTF-8?q?=20=E2=80=9CProcess=E2=80=9D=20renamings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/foreign_language/__init__.py | 30 +++++++++---------- rsqueakvm/plugins/python/__init__.py | 2 +- rsqueakvm/plugins/python/patching.py | 10 +++---- rsqueakvm/plugins/python/process.py | 2 +- rsqueakvm/plugins/python/switching.py | 8 ++--- rsqueakvm/plugins/ruby/__init__.py | 2 +- rsqueakvm/plugins/ruby/patching.py | 22 +++++++------- rsqueakvm/plugins/ruby/process.py | 2 +- .../plugins/python/test_pyframe_exceptions.py | 2 +- 9 files changed, 40 insertions(+), 40 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 3f935507..01cbb8e4 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -24,7 +24,7 @@ def is_operational(self): raise NotImplementedError @staticmethod - def new_w_language_process(space, args_w): + def new_language_process(space, args_w): raise NotImplementedError @staticmethod @@ -44,24 +44,24 @@ def eval(interp, s_frame, argcount): raise PrimitiveFailedError # import pdb; pdb.set_trace() args_w = s_frame.peek_n(argcount) - language = self.new_w_language_process(interp.space, args_w) - language.start() + language_process = self.new_language_process(interp.space, args_w) + language_process.start() # when we are here, the foreign language process has yielded - frame = language.switch_to_smalltalk(interp, s_frame, - first_call=True) + frame = language_process.switch_to_smalltalk( + interp, s_frame, first_call=True) s_frame.pop_n(argcount + 1) return frame @self.expose_primitive(unwrap_spec=[object, object], result_is_new_frame=True) - def resume(interp, s_frame, w_rcvr, language): + def resume(interp, s_frame, w_rcvr, language_process): # print 'Smalltalk yield' # import pdb; pdb.set_trace() - if not isinstance(language, W_ForeignLanguageProcess): + if not isinstance(language_process, W_ForeignLanguageProcess): raise PrimitiveFailedError - if not language.resume(): + if not language_process.resume(): raise PrimitiveFailedError - return language.switch_to_smalltalk(interp, s_frame) + return language_process.switch_to_smalltalk(interp, s_frame) @self.expose_primitive(compiled_method=True) @jit.unroll_safe @@ -79,20 +79,20 @@ def send(interp, s_frame, argcount, w_method): return w_result @self.expose_primitive(unwrap_spec=[object, object]) - def lastError(interp, s_frame, w_rcvr, language): - if not isinstance(language, W_ForeignLanguageProcess): + def lastError(interp, s_frame, w_rcvr, language_process): + if not isinstance(language_process, W_ForeignLanguageProcess): raise PrimitiveFailedError - w_error = language.get_error() + w_error = language_process.get_error() if w_error is None: print 'w_error was None in lastError' raise PrimitiveFailedError return w_error @self.expose_primitive(unwrap_spec=[object, object]) - def getTopFrame(interp, s_frame, w_rcvr, language): - if not isinstance(language, W_ForeignLanguageProcess): + def getTopFrame(interp, s_frame, w_rcvr, language_process): + if not isinstance(language_process, W_ForeignLanguageProcess): raise PrimitiveFailedError - return language.top_w_frame() + return language_process.top_w_frame() @self.expose_primitive(unwrap_spec=[object]) def asSmalltalk(interp, s_frame, w_rcvr): diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index 60fa6627..6d6bba81 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -60,7 +60,7 @@ def startup(space, argv): py_space.startup() @staticmethod - def new_w_language_process(space, args_w): + def new_language_process(space, args_w): if len(args_w) != 4: raise PrimitiveFailedError source_w = args_w[0] diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 8dc6c550..73fef666 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -115,7 +115,7 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): if isinstance(operr, RestartException): print 'Re-raising RestartException' raise operr - language = self.space.current_language.get() + language = self.space.current_python_process.get() if (language is not None and language.break_on_exceptions() and not self.has_exception_handler(operr)): # import pdb; pdb.set_trace() @@ -137,9 +137,9 @@ def __init__pycode(self, space, argcount, nlocals, stacksize, flags, def new_getexecutioncontext(self): - current_language = self.current_language.get() - if current_language is not None: - return current_language.ec + current_python_process = self.current_python_process.get() + if current_python_process is not None: + return current_python_process.ec return old_getexecutioncontext(self) @@ -161,5 +161,5 @@ def patch_pypy(): PyCode.__init__ = __init__pycode PyCode._immutable_fields_.append('_co_names[*]') - PyStdObjSpace.current_language = QuasiConstant(None, W_PythonProcess) + PyStdObjSpace.current_python_process = QuasiConstant(None, W_PythonProcess) PyStdObjSpace.getexecutioncontext = new_getexecutioncontext diff --git a/rsqueakvm/plugins/python/process.py b/rsqueakvm/plugins/python/process.py index 0260a900..de8bb8cd 100644 --- a/rsqueakvm/plugins/python/process.py +++ b/rsqueakvm/plugins/python/process.py @@ -32,7 +32,7 @@ def run(self): self.set_result(operr_to_pylist(operr)) def set_current(self): - py_space.current_language.set(self) + py_space.current_python_process.set(self) def set_result(self, wp_result): self.w_result = W_PythonObject(wp_result) diff --git a/rsqueakvm/plugins/python/switching.py b/rsqueakvm/plugins/python/switching.py index 57827a98..4a8e6141 100644 --- a/rsqueakvm/plugins/python/switching.py +++ b/rsqueakvm/plugins/python/switching.py @@ -11,10 +11,10 @@ def perform(self, ec, frame): from rsqueakvm.plugins.python import PythonPlugin # import pdb; pdb.set_trace() - language = ec.space.current_language.get() - if language is None: + process = self.space.current_python_process.get() + if process is None: return - runner = language.runner() + runner = process.runner() if runner is None: return @@ -23,7 +23,7 @@ def perform(self, ec, frame): # print 'Python continue' # operror has been in Smalltalk land, clear it now to allow resuming - language.reset_error() + process.reset_error() # handle py_frame_restart_info if set restart_info = PythonPlugin.py_frame_restart_info.get() diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 7c987c10..544c0d80 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -51,7 +51,7 @@ def startup(space, argv): ruby_space.setup(argv[0]) @staticmethod - def new_w_language_process(space, args_w): + def new_language_process(space, args_w): if (len(args_w) != 3): raise PrimitiveFailedError source_w = args_w[0] diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index 9c375aff..930df1a9 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -14,11 +14,11 @@ switch_counter = [SWITCH_COUNTER_SIZE] -def switch_to_smalltalk(language): +def switch_to_smalltalk(ruby_process): # import pdb; pdb.set_trace() - if language is None: + if ruby_process is None: return - runner = language.runner() + runner = ruby_process.runner() if runner is None: return @@ -27,7 +27,7 @@ def switch_to_smalltalk(language): # print 'Ruby continue' # error has been in Smalltalk land, clear it now to allow resuming - language.reset_error() + ruby_process.reset_error() def block_handles_exception(self, block, error_type): @@ -54,25 +54,25 @@ def has_exception_handler(self, error): def new_handle_bytecode(self, space, pc, frame, bytecode): if switch_counter[0] <= 0: switch_counter[0] = SWITCH_COUNTER_SIZE - switch_to_smalltalk(space.current_language.get()) + switch_to_smalltalk(space.current_ruby_process.get()) switch_counter[0] -= 1 return old_handle_bytecode(self, space, pc, frame, bytecode) def new_handle_ruby_error(self, space, pc, frame, bytecode, error): - language = space.current_language.get() + language = space.current_ruby_process.get() if (language is not None and language.break_on_exceptions() and not frame.has_exception_handler(error)): language.set_error(error.w_value) print 'Ruby error caught' - switch_to_smalltalk(space.current_language.get()) + switch_to_smalltalk(space.current_ruby_process.get()) return old_handle_ruby_error(self, space, pc, frame, bytecode, error) def new_getexecutioncontext(self): - current_language = self.current_language.get() - if current_language is not None: - return current_language.ec + current_ruby_process = self.current_ruby_process.get() + if current_ruby_process is not None: + return current_ruby_process.ec return old_getexecutioncontext(self) @@ -89,5 +89,5 @@ def patch_topaz(): TopazInterpreter.handle_bytecode = new_handle_bytecode TopazInterpreter.handle_ruby_error = new_handle_ruby_error - TopazObjectSpace.current_language = QuasiConstant(None, W_RubyProcess) + TopazObjectSpace.current_ruby_process = QuasiConstant(None, W_RubyProcess) TopazObjectSpace.getexecutioncontext = new_getexecutioncontext diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index 37db820c..4d017ed4 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -27,7 +27,7 @@ def run(self): self.set_result(e.w_value) def set_current(self): - ruby_space.current_language.set(self) + ruby_space.current_ruby_process.set(self) def set_result(self, wr_result): self.w_result = W_RubyObject(wr_result) diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 7685d0cd..7671b179 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -21,7 +21,7 @@ def no_error_caught(code, cmd): pycode = compilecode(py_space, code, '', cmd) py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) py_frame.run() - language = py_space.getexecutioncontext().current_language + language = py_space.current_language.get() return language is not None and language.get_error() is None From 600accd365d17cab488b40b9596af270367250ff Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 20:55:21 +0100 Subject: [PATCH 143/193] Fix test and initialize pypy space correctly --- rsqueakvm/plugins/python/__init__.py | 3 +- rsqueakvm/plugins/python/objspace.py | 28 ++++++++++++------- .../plugins/python/test_pyframe_exceptions.py | 4 +-- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index 6d6bba81..bf8de7d2 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -8,7 +8,7 @@ from rsqueakvm.plugins.python import utils from rsqueakvm.plugins.python.model import ( W_PythonObject, PythonClassShadow) - from rsqueakvm.plugins.python.objspace import py_space + from rsqueakvm.plugins.python.objspace import initialize_py_space, py_space from rsqueakvm.plugins.python.patching import patch_pypy from rsqueakvm.plugins.python.process import W_PythonProcess from rsqueakvm.plugins.python.switching import PyFrameRestartInfo @@ -57,6 +57,7 @@ def startup(space, argv): ForeignLanguagePlugin.load_special_objects( space, PythonPlugin.language_name, W_PythonProcess, PythonClassShadow) + initialize_py_space(space, argv) py_space.startup() @staticmethod diff --git a/rsqueakvm/plugins/python/objspace.py b/rsqueakvm/plugins/python/objspace.py index b562f5a1..720bab4d 100644 --- a/rsqueakvm/plugins/python/objspace.py +++ b/rsqueakvm/plugins/python/objspace.py @@ -4,8 +4,6 @@ from rsqueakvm.plugins.python.switching import SwitchToSmalltalkAction from rsqueakvm.util import system -from pypy.module.sys.initpath import pypy_find_stdlib - def new_pypy_objspace(): # This module is reloaded, but pypy_getudir has already been deleted @@ -65,8 +63,10 @@ def new_pypy_objspace(): # encapsulate it inside the entry point with a closure. from pypy.objspace.std import StdObjSpace as PyStdObjSpace - py_space = PyStdObjSpace(pypy_config) + return PyStdObjSpace(pypy_config) + +def initialize_py_space(space, argv): # equivalent to the hack in app_main.py of PyPy, albiet interp-level. w_sys = py_space.sys w_modnames = w_sys.get('builtin_module_names') @@ -79,14 +79,22 @@ def new_pypy_objspace(): w_sys_path = py_space.getattr(w_sys, py_space.newtext('path')) py_space.call_method(w_sys_path, 'append', py_space.newtext('.')) - # Set sys.executable in PyPy -- some modules rely upon this existing. + # Determine image_path for sys.prefix + splitpaths = space.get_image_name().split(os.sep) + splitlen = len(splitpaths) + # The dance below makes translation work. os.path.dirname breaks :( + image_path = splitpaths[0] if splitlen > 0 else '' + if splitlen > 2: + splitlen = splitlen - 1 + assert splitlen >= 0 + image_path = os.sep.join(splitpaths[0:splitlen]) + w_prefix = py_space.newtext(image_path) + + # Set attributes on sys in PyPy -- some modules rely upon this existing. py_space.setattr(w_sys, py_space.newtext('executable'), - py_space.newtext(os.path.abspath(sys.argv[0]))) - - # Set sys.(prefix|exec_prefix) in PyPy - pypy_find_stdlib(py_space, sys.argv[0]) - - return py_space + py_space.newtext(space.executable_path())) + py_space.setattr(w_sys, py_space.newtext('prefix'), w_prefix) + py_space.setattr(w_sys, py_space.newtext('exec_prefix'), w_prefix) py_space = new_pypy_objspace() diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 7671b179..3bc3451f 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -21,8 +21,8 @@ def no_error_caught(code, cmd): pycode = compilecode(py_space, code, '', cmd) py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) py_frame.run() - language = py_space.current_language.get() - return language is not None and language.get_error() is None + process = py_space.current_python_process.get() + return process is not None and process.get_error() is None def test_simple_exception(): From a11b21f11c39cb165e4bc4c6dd6c25d5de8edd24 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 22:34:28 +0100 Subject: [PATCH 144/193] Fix interrupt counter for topaz A prebuilt list does not work as intended --- rsqueakvm/plugins/ruby/patching.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index 930df1a9..416f5fc6 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -10,8 +10,25 @@ old_handle_ruby_error = TopazInterpreter.handle_ruby_error old_getexecutioncontext = TopazObjectSpace.getexecutioncontext -SWITCH_COUNTER_SIZE = 1000 -switch_counter = [SWITCH_COUNTER_SIZE] + +class InterruptCounter: + counter_size = 1000 + + def __init__(self): + self.reset() + + def reset(self): + self._counter = self.counter_size + + def triggers(self): + self._counter -= 1 + if self._counter <= 0: + self._counter = self.counter_size + return True + return False + + +interrupt_counter = InterruptCounter() def switch_to_smalltalk(ruby_process): @@ -52,10 +69,8 @@ def has_exception_handler(self, error): def new_handle_bytecode(self, space, pc, frame, bytecode): - if switch_counter[0] <= 0: - switch_counter[0] = SWITCH_COUNTER_SIZE + if interrupt_counter.triggers(): switch_to_smalltalk(space.current_ruby_process.get()) - switch_counter[0] -= 1 return old_handle_bytecode(self, space, pc, frame, bytecode) From dac2303f4a9d21bcda65926e9af63c0b86a3e7bf Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 22 Mar 2017 22:35:01 +0100 Subject: [PATCH 145/193] Update in-image code [ci skip] --- .../class/checkForException..st | 7 +++ .../class/debuggerPrintItem.on..st | 3 + .../class/debuggerTitle..st | 3 + .../class/evaluateExpression.in.to..st | 3 + .../class/fileExtension.st | 3 + .../class/findResumeFrame..st | 10 ++++ .../class/getContentsOf..st | 3 +- .../class/getForeignFrames..st | 3 + .../ForeignLanguage.class/class/getSource..st | 3 + .../class/newForeignContextFor..st | 3 + .../class/openDebuggerOn.languageProcess..st | 10 ++++ .../ForeignLanguage.class/class/pcRange..st | 3 + .../class/persistEvalCode..st | 10 ++++ .../class/prependContexts.languageProcess..st | 10 ++++ .../class/primGetTopFrame..st | 3 + .../class/restartFrame.with..st | 3 + .../class/styleInBackgroundProcess..st | 3 - .../class/tempNamesIn..st | 3 + .../class/tempVariableAt.in..st | 3 + .../methodProperties.json | 19 ++++++- .../instance/languageSymbol.st | 3 + .../Object.extension/methodProperties.json | 3 +- .../monticello.meta/version | 2 +- .../class/newFor..st} | 4 +- .../instance/languageClass.st | 3 + .../instance/printOn..st | 12 +--- .../instance/tempNames.st | 7 +-- .../methodProperties.json | 7 ++- .../instance/languageClass.st | 3 + .../instance/privateFormat..st | 6 +- .../instance/style..st | 4 +- .../instance/styleInBackgroundProcess..st | 5 +- .../methodProperties.json | 7 ++- .../debug.context.label.contents.fullView..st | 2 +- .../class/debugContext.label.contents..st | 2 +- .../methodProperties.json | 4 +- .../monticello.meta/version | 2 +- .../instance/selection.st | 6 +- .../methodProperties.json | 2 +- .../class/exploreFrames.st | 18 ------ .../class/prependPythonContexts..st | 14 ----- .../instance/contents.notifying..st | 5 +- .../instance/contextForStack..st | 5 -- .../instance/expandStack.st | 2 - .../instance/messageIconAt..st | 6 +- .../instance/pcRange.st | 9 +-- .../instance/process.controller.context..st | 16 ------ .../instance/pyPCRange.st | 10 ---- .../instance/selectedMessage.st | 3 +- .../methodProperties.json | 26 ++------- .../instance/evaluateExpression..st | 4 ++ .../instance/languageClass.st | 3 + .../methodProperties.json | 2 + .../instance/addModelItemsToWindowMenu..st | 2 + .../instance/breakOnExceptions..st | 3 + .../instance/breakOnExceptions.st | 3 + .../instance/breakOnExceptionsText.st | 5 ++ .../instance/evaluateExpression..st | 4 +- .../instance/labelString.st | 7 ++- .../instance/languageClass.st | 3 + .../instance/toggleBreakOnExceptions.st | 4 ++ .../methodProperties.json | 13 +++-- .../properties.json | 1 + .../monticello.meta/version | 2 +- .../Python.class/class/breakOnExceptions..st | 3 - .../Python.class/class/breakOnExceptions.st | 3 - .../Python.class/class/checkForException..st | 7 --- .../Python.class/class/cmdFor..st | 4 +- .../class/debuggerPrintItem.on..st | 13 +++++ .../Python.class/class/debuggerTitle..st | 5 ++ .../Python.class/class/eval..st | 2 +- .../evaluateExpression.breakOnExceptions..st | 4 ++ .../class/evaluateExpression.in.to..st | 26 +++++++++ .../Python.class/class/exec..st | 2 +- .../Python.class/class/fileExtension.st | 3 + .../class/filterPySource.lineno..st | 2 +- .../Python.class/class/getForeignFrames..st | 10 ++++ .../Python.class}/class/getSignature..st | 2 +- .../Python.class/class/getSource..st} | 9 ++- .../Python.class/class/import..st | 2 +- .../Python.class}/class/indent.by..st | 2 +- .../Python.class}/class/indentSize..st | 2 +- .../Python.class/class/load..st | 2 +- .../class/openDebuggerWithPythonFrames..st | 16 ------ .../Python.class/class/pcRange..st | 9 +++ .../Python.class/class/persistPyCode..st | 9 --- .../Python.class/class/peval..st | 4 +- .../class/peval.breakOnExceptions..st | 7 +++ .../Python.class/class/pexec..st | 4 +- .../class/pexec.breakOnExceptions..st | 7 +++ ...primGetTopFrame.st => primGetTopFrame..st} | 4 +- .../Python.class/class/primLastError..st | 2 +- ...startSpecificFrame.source.filename.cmd..st | 2 +- .../Python.class/class/primResume..st | 4 +- .../class/prun.breakOnExceptions..st | 5 ++ .../replaceInPySource.content.lineno..st | 2 +- .../Python.class/class/restartFrame.st | 3 - .../Python.class/class/restartFrame.with..st | 2 +- .../class/restartFrameWith.cmd..st | 4 -- .../Python.class/class/resume..st | 8 +-- .../class/scopeEndIn.startingAt..st | 2 +- .../Python.class/class/setSource.to..st} | 14 ++--- .../Python.class/class/setUpPygments.st | 5 +- .../Python.class/class/single..st | 2 +- .../Python.class/class/tempNamesIn..st | 3 + .../Python.class/class/tempVariableAt.in..st | 3 + .../Python.class/methodProperties.json | 55 ++++++++++++------- .../monticello.meta/version | 2 +- .../instance/testScopeEndInStartingAt.st | 2 +- .../methodProperties.json | 2 +- .../monticello.meta/version | 2 +- .../Ruby.class/class/checkForException..st | 5 -- .../Ruby.class/class/debuggerPrintItem.on..st | 10 ++++ .../Ruby.class/class/debuggerTitle..st | 3 + .../Ruby.class/class/eval..st | 2 +- .../Ruby.class/class/eval.filePath..st | 3 + .../Ruby.class/class/evaluateExpression..st | 2 +- .../evaluateExpression.breakOnExceptions..st | 3 + .../Ruby.class/class/fileExtension.st | 3 + .../Ruby.class/class/getForeignFrames..st | 10 ++++ .../Ruby.class/class/getSource..st | 7 +++ .../Ruby-Core.package/Ruby.class/class/nil.st | 3 + .../Ruby.class/class/pcRange..st | 4 ++ .../Ruby.class/class/peval..st | 3 + .../class/peval.breakOnExceptions..st | 3 + ...> primEval.filePath.breakOnExceptions..st} | 2 +- .../Ruby.class/class/primGetTopFrame..st | 4 ++ .../Ruby.class/class/primLastError..st | 2 +- .../Ruby.class/class/primResume..st | 2 +- .../Ruby.class/class/restartFrame.with..st | 3 + .../Ruby.class/class/resume..st | 8 +-- .../Ruby.class/class/tempNamesIn..st | 3 + .../Ruby.class/class/tempVariableAt.in..st | 3 + .../Ruby.class/methodProperties.json | 28 +++++++--- .../RubyObject.class/instance/isNil.st | 3 + .../RubyObject.class/instance/notNil.st | 3 + .../RubyObject.class/methodProperties.json | 2 + .../Ruby-Core.package/monticello.meta/version | 2 +- 138 files changed, 488 insertions(+), 287 deletions(-) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerPrintItem.on..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerTitle..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/evaluateExpression.in.to..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/fileExtension.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class => ForeignLanguage-Core.package/ForeignLanguage.class}/class/getContentsOf..st (69%) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getForeignFrames..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getSource..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pcRange..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/persistEvalCode..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/prependContexts.languageProcess..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/restartFrame.with..st delete mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/styleInBackgroundProcess..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/tempNamesIn..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/tempVariableAt.in..st create mode 100644 repository/ForeignLanguage-Core.package/Object.extension/instance/languageSymbol.st rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/newForeignContext..st => ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/class/newFor..st} (82%) create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageClass.st create mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageClass.st delete mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/exploreFrames.st delete mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/prependPythonContexts..st delete mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contextForStack..st delete mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/process.controller.context..st delete mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pyPCRange.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/evaluateExpression..st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/languageClass.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions..st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptionsText.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageClass.st create mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/toggleBreakOnExceptions.st delete mode 100644 repository/Python-Core.package/Python.class/class/breakOnExceptions..st delete mode 100644 repository/Python-Core.package/Python.class/class/breakOnExceptions.st delete mode 100644 repository/Python-Core.package/Python.class/class/checkForException..st create mode 100644 repository/Python-Core.package/Python.class/class/debuggerPrintItem.on..st create mode 100644 repository/Python-Core.package/Python.class/class/debuggerTitle..st create mode 100644 repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st create mode 100644 repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st create mode 100644 repository/Python-Core.package/Python.class/class/fileExtension.st rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class => Python-Core.package/Python.class}/class/filterPySource.lineno..st (97%) create mode 100644 repository/Python-Core.package/Python.class/class/getForeignFrames..st rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class => Python-Core.package/Python.class}/class/getSignature..st (96%) rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getPySource..st => Python-Core.package/Python.class/class/getSource..st} (74%) rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class => Python-Core.package/Python.class}/class/indent.by..st (93%) rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class => Python-Core.package/Python.class}/class/indentSize..st (86%) delete mode 100644 repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st create mode 100644 repository/Python-Core.package/Python.class/class/pcRange..st delete mode 100644 repository/Python-Core.package/Python.class/class/persistPyCode..st create mode 100644 repository/Python-Core.package/Python.class/class/peval.breakOnExceptions..st create mode 100644 repository/Python-Core.package/Python.class/class/pexec.breakOnExceptions..st rename repository/Python-Core.package/Python.class/class/{primGetTopFrame.st => primGetTopFrame..st} (61%) create mode 100644 repository/Python-Core.package/Python.class/class/prun.breakOnExceptions..st rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class => Python-Core.package/Python.class}/class/replaceInPySource.content.lineno..st (97%) delete mode 100644 repository/Python-Core.package/Python.class/class/restartFrame.st delete mode 100644 repository/Python-Core.package/Python.class/class/restartFrameWith.cmd..st rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class => Python-Core.package/Python.class}/class/scopeEndIn.startingAt..st (96%) rename repository/{ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/setPySourceContent.content..st => Python-Core.package/Python.class/class/setSource.to..st} (56%) create mode 100644 repository/Python-Core.package/Python.class/class/tempNamesIn..st create mode 100644 repository/Python-Core.package/Python.class/class/tempVariableAt.in..st delete mode 100644 repository/Ruby-Core.package/Ruby.class/class/checkForException..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/debuggerTitle..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/fileExtension.st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/getForeignFrames..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/getSource..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/nil.st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/pcRange..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/peval..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/peval.breakOnExceptions..st rename repository/Ruby-Core.package/Ruby.class/class/{primEval.breakOnExceptions..st => primEval.filePath.breakOnExceptions..st} (56%) create mode 100644 repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/restartFrame.with..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/tempNamesIn..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/tempVariableAt.in..st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/isNil.st create mode 100644 repository/Ruby-Core.package/RubyObject.class/instance/notNil.st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st new file mode 100644 index 00000000..ecf0dcb7 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st @@ -0,0 +1,7 @@ +debugging +checkForException: languageProcess + Smalltalk isHeadless ifTrue: [ ^ self ]. + (self primLastError: languageProcess) ifNotNil: [ :e | + ForeignLanguageException new + action: [ self openDebuggerOn: e languageProcess: languageProcess ]; + signal ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerPrintItem.on..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerPrintItem.on..st new file mode 100644 index 00000000..d38d1346 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerPrintItem.on..st @@ -0,0 +1,3 @@ +debugging +debuggerPrintItem: pyFrame on: aStream + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerTitle..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerTitle..st new file mode 100644 index 00000000..198301fe --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerTitle..st @@ -0,0 +1,3 @@ +debugging +debuggerTitle: foreignError + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/evaluateExpression.in.to..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/evaluateExpression.in.to..st new file mode 100644 index 00000000..4d7f2ca6 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/evaluateExpression.in.to..st @@ -0,0 +1,3 @@ +execution +evaluateExpression: selection in: aContext to: aReceiver + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/fileExtension.st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/fileExtension.st new file mode 100644 index 00000000..61b52061 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/fileExtension.st @@ -0,0 +1,3 @@ +source code +fileExtension + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st new file mode 100644 index 00000000..07168cb3 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st @@ -0,0 +1,10 @@ +debugging +findResumeFrame: aContext + | currentCtx | + currentCtx := aContext. + [ currentCtx notNil ] whileTrue: [ + (currentCtx method selector = #resume: + and: [ currentCtx closure isNil ]) + ifTrue: [ ^ currentCtx ]. + currentCtx := currentCtx sender ]. + self error: 'resume context not found' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getContentsOf..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st similarity index 69% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getContentsOf..st rename to repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st index e24d6698..5bcc285c 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getContentsOf..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st @@ -1,6 +1,7 @@ -pySource +helpers getContentsOf: aFileName | stream data | + (FileStream isAFileNamed: aFileName) ifFalse: [ ^ 'File does not exist' ]. stream := StandardFileStream oldFileNamed: aFileName. stream := MultiByteFileStream newFrom: stream. data := stream contents. diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getForeignFrames..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getForeignFrames..st new file mode 100644 index 00000000..7412ae41 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getForeignFrames..st @@ -0,0 +1,3 @@ +debugging +getForeignFrames: topForeignFrame + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getSource..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getSource..st new file mode 100644 index 00000000..ee0bc284 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getSource..st @@ -0,0 +1,3 @@ +source code +getSource: foreignFrame + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st new file mode 100644 index 00000000..da14a5c4 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st @@ -0,0 +1,3 @@ +helpers +newForeignContextFor: foreignFrame + ^ ForeignLanguageMethodContext newFor: foreignFrame \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st new file mode 100644 index 00000000..667279c7 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st @@ -0,0 +1,10 @@ +debugging +openDebuggerOn: foreignError languageProcess: languageProcess + | resumeCtx | + resumeCtx := self findResumeFrame: thisContext sender. + ForeignLanguageDebugger + openOn: Processor activeProcess + context: (self prependContexts: resumeCtx languageProcess: languageProcess) + label: (self debuggerTitle: foreignError) + contents: nil + fullView: true \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pcRange..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pcRange..st new file mode 100644 index 00000000..bff759e8 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pcRange..st @@ -0,0 +1,3 @@ +debugging +pcRange: foreignFrame + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/persistEvalCode..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/persistEvalCode..st new file mode 100644 index 00000000..b45079d9 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/persistEvalCode..st @@ -0,0 +1,10 @@ +source code +persistEvalCode: aSource + | directory filename stream | + directory := 'eval', FileDirectory pathNameDelimiter. + filename := directory, Time millisecondClockValue, self fileExtension. + stream := StandardFileStream forceNewFileNamed: filename. + stream := MultiByteFileStream newFrom: stream. + stream write: aSource. + stream close. + ^ filename \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/prependContexts.languageProcess..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/prependContexts.languageProcess..st new file mode 100644 index 00000000..d65d10ed --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/prependContexts.languageProcess..st @@ -0,0 +1,10 @@ +debugging +prependContexts: resumeContext languageProcess: languageProcess + | topForeignFrame newFrames | + [ topForeignFrame := self primGetTopFrame: languageProcess ] + on: Error do: [ ^ resumeContext ]. + newFrames := ((self getForeignFrames: topForeignFrame) + collect: [ :ea | self newForeignContextFor: ea ]) + overlappingPairsDo: [ :a :b | a sender: b ]. + newFrames last sender: resumeContext. + ^ newFrames first \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st new file mode 100644 index 00000000..82cb2342 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st @@ -0,0 +1,3 @@ +system primitives +primGetTopFrame: languageProcess + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/restartFrame.with..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/restartFrame.with..st new file mode 100644 index 00000000..4047a1a3 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/restartFrame.with..st @@ -0,0 +1,3 @@ +debugging +restartFrame: foreignFrame with: aSource + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/styleInBackgroundProcess..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/styleInBackgroundProcess..st deleted file mode 100644 index e631240f..00000000 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/styleInBackgroundProcess..st +++ /dev/null @@ -1,3 +0,0 @@ -styling -styleInBackgroundProcess: aText - Project current addDeferredUIMessage: [ self style: aText ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/tempNamesIn..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/tempNamesIn..st new file mode 100644 index 00000000..339b2ac3 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/tempNamesIn..st @@ -0,0 +1,3 @@ +debugging +tempNamesIn: foreignFrame + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/tempVariableAt.in..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/tempVariableAt.in..st new file mode 100644 index 00000000..5bf01492 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/tempVariableAt.in..st @@ -0,0 +1,3 @@ +debugging +tempVariableAt: anIndex in: pyFrame + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json index 553fb1ad..fd7b2059 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json @@ -1,10 +1,27 @@ { "class" : { "availableLanguages" : "fn 3/14/2017 11:15", + "checkForException:" : "fn 3/22/2017 15:14", + "debuggerPrintItem:on:" : "fn 3/16/2017 22:31", + "debuggerTitle:" : "fn 3/16/2017 15:12", + "evaluateExpression:in:to:" : "fn 3/21/2017 11:32", + "fileExtension" : "fn 3/17/2017 10:20", + "findResumeFrame:" : "fn 3/16/2017 16:03", + "getContentsOf:" : "fn 3/17/2017 10:48", + "getForeignFrames:" : "fn 3/16/2017 21:26", + "getSource:" : "fn 3/16/2017 21:57", "highlight:" : "fn 3/14/2017 11:27", + "newForeignContextFor:" : "fn 3/16/2017 13:35", + "openDebuggerOn:languageProcess:" : "fn 3/22/2017 15:15", + "pcRange:" : "fn 3/16/2017 22:03", + "persistEvalCode:" : "fn 3/17/2017 10:23", + "prependContexts:languageProcess:" : "fn 3/22/2017 15:15", + "primGetTopFrame:" : "fn 3/22/2017 15:13", + "restartFrame:with:" : "fn 3/16/2017 21:57", "sourceCodeTemplate" : "fn 3/14/2017 11:23", - "styleInBackgroundProcess:" : "fn 3/14/2017 11:25", "stylerFormat:" : "fn 3/14/2017 11:21", + "tempNamesIn:" : "fn 3/16/2017 22:45", + "tempVariableAt:in:" : "fn 3/16/2017 22:44", "vmSpeaksLanguage" : "fn 3/14/2017 11:31" }, "instance" : { } } diff --git a/repository/ForeignLanguage-Core.package/Object.extension/instance/languageSymbol.st b/repository/ForeignLanguage-Core.package/Object.extension/instance/languageSymbol.st new file mode 100644 index 00000000..34051283 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/Object.extension/instance/languageSymbol.st @@ -0,0 +1,3 @@ +*ForeignLanguage-Core +languageSymbol + ^ #Smalltalk \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json b/repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json index 742e80a3..2eb087fe 100644 --- a/repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json @@ -2,4 +2,5 @@ "class" : { }, "instance" : { - "isForeign" : "fn 3/12/2017 19:24" } } + "isForeign" : "fn 3/12/2017 19:24", + "languageSymbol" : "fn 3/21/2017 11:39" } } diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/version b/repository/ForeignLanguage-Core.package/monticello.meta/version index ef12338f..a3eb03d9 100644 --- a/repository/ForeignLanguage-Core.package/monticello.meta/version +++ b/repository/ForeignLanguage-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/newForeignContext..st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/class/newFor..st similarity index 82% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/newForeignContext..st rename to repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/class/newFor..st index 2b1b2c72..2a37a478 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/newForeignContext..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/class/newFor..st @@ -1,5 +1,5 @@ -pyContext -newForeignContext: foreignFrame +as yet unclassified +newFor: foreignFrame | frame | frame := ForeignLanguageMethodContext sender: nil diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageClass.st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageClass.st new file mode 100644 index 00000000..5851945e --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageClass.st @@ -0,0 +1,3 @@ +accessing +languageClass + ^ Smalltalk at: self languageSymbol \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st index 8b2a0fce..fff08bd3 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st @@ -1,13 +1,3 @@ overrides printOn: aStream - | line lineno filename currentPath | - self foreignFrame ifNil: [ - aStream nextPutAll: 'Unknown pyFrame'. - ^ self ]. - line := ForeignLanguage getSignature: foreignFrame f_code. - lineno := foreignFrame f_lineno asSmalltalk. - filename := foreignFrame f_code co_filename asSmalltalk. - currentPath := FileDirectory default pathName. - (filename startsWith: currentPath) ifTrue: [ - filename := filename allButFirst: currentPath size + 1]. - aStream nextPutAll: line, ' (line ' , lineno asString, ' in ', filename, ')' \ No newline at end of file + ^ self languageClass debuggerPrintItem: self foreignFrame on: aStream \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st index fdd655ea..c4d39f71 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st @@ -1,7 +1,4 @@ overrides tempNames - "Answer a SequenceableCollection of the names of the receiver's temporary - variables, which are strings." - - self foreignFrame ifNil: [^ #()]. - ^ self pyFrame f_locals keys asSmalltalk \ No newline at end of file + self isForeign ifFalse: [ ^ super tempNames ]. + ^ self languageClass tempNamesIn: self foreignFrame \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json index 4b3513f2..43273897 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json @@ -1,12 +1,13 @@ { "class" : { - }, + "newFor:" : "fn 3/16/2017 13:34" }, "instance" : { "foreignFrame" : "fn 3/14/2017 01:28", "foreignFrame:" : "fn 3/14/2017 01:28", "isForeign" : "fn 3/14/2017 01:29", + "languageClass" : "fn 3/16/2017 22:39", "languageSymbol" : "fn 3/14/2017 01:32", - "printOn:" : "fn 3/14/2017 01:30", + "printOn:" : "fn 3/16/2017 22:40", "sender:" : "fn 1/16/2017 21:54", "setSender:receiver:method:arguments:" : "fn 1/18/2017 17:38", - "tempNames" : "fn 3/14/2017 01:28" } } + "tempNames" : "fn 3/16/2017 22:44" } } diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageClass.st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageClass.st new file mode 100644 index 00000000..5851945e --- /dev/null +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageClass.st @@ -0,0 +1,3 @@ +accessing +languageClass + ^ Smalltalk at: self languageSymbol \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st index 3e69bdc1..8d106173 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st @@ -1,6 +1,4 @@ overrides privateFormat: aText - Smalltalk at: self languageSymbol ifPresent: [ :cls | - (cls respondsTo: #stylerFormat:) - ifTrue: [ ^ cls stylerFormat: aText ] ]. - ^ super privateFormat: aText \ No newline at end of file + self isForeign ifFalse: [ ^ super privateFormat: aText ]. + ^ self languageClass stylerFormat: aText \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st index b405a043..6b9a322c 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st @@ -1,6 +1,4 @@ overrides style: aText self isForeign ifFalse: [ ^ super style: aText ]. - Smalltalk at: self languageSymbol ifPresent: [ :cls | - (cls respondsTo: #highlight:) - ifTrue: [ ^ self style: aText foreignClass: cls ] ] \ No newline at end of file + ^ self style: aText foreignClass: self languageClass \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st index 6e0e0b16..bae55997 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st @@ -1,6 +1,5 @@ overrides styleInBackgroundProcess: aText self isForeign ifFalse: [ ^ super styleInBackgroundProcess: aText ]. - Smalltalk at: self languageSymbol ifPresent: [ :cls | - (cls respondsTo: #styleInBackgroundProcess:) - ifTrue: [ ^ cls styleInBackgroundProcess: aText ] ] \ No newline at end of file + ^ Project current addDeferredUIMessage: [ + self style: aText foreignClass: self languageClass ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json index 00400e2d..52c06f44 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json @@ -5,9 +5,10 @@ "highlightSmalltalk:" : "fn 3/6/2017 19:14" }, "instance" : { "isForeign" : "fn 3/14/2017 18:28", + "languageClass" : "fn 3/16/2017 22:41", "languageSymbol" : "fn 3/14/2017 18:29", "languageSymbol:" : "fn 3/13/2017 17:13", - "privateFormat:" : "fn 3/14/2017 11:20", - "style:" : "fn 3/14/2017 18:28", + "privateFormat:" : "fn 3/16/2017 22:42", + "style:" : "fn 3/16/2017 22:42", "style:foreignClass:" : "fn 3/14/2017 11:30", - "styleInBackgroundProcess:" : "fn 3/14/2017 18:28" } } + "styleInBackgroundProcess:" : "fn 3/21/2017 11:25" } } diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st index 63a292bf..3ff9b19f 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st @@ -1,4 +1,4 @@ debugging debug: aProcess context: aContext label: aString contents: contents fullView: aBool "Open a debugger on the given process and context." - ^ ForeignLanguage openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file + ^ ForeignLanguageDebugger openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st index 99173d7b..a7f47564 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st @@ -1,4 +1,4 @@ debugging debugContext: aContext label: aString contents: contents "Open a debugger on the given process and context." - ^ ForeignLanguage openContext: aContext label: aString contents: contents \ No newline at end of file + ^ ForeignLanguageDebugger openContext: aContext label: aString contents: contents \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json index 31f07d7d..19915ddb 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json @@ -4,8 +4,8 @@ "browseClass:" : "fn 3/14/2017 10:46", "browseClass:category:" : "fn 3/14/2017 10:47", "browseMessageCategory:inClass:" : "fn 3/14/2017 10:47", - "debug:context:label:contents:fullView:" : "fn 3/14/2017 01:30", - "debugContext:label:contents:" : "fn 3/14/2017 01:30", + "debug:context:label:contents:fullView:" : "fn 3/16/2017 11:59", + "debugContext:label:contents:" : "fn 3/16/2017 11:59", "explore:" : "fn 3/13/2017 17:41", "initialize" : "fn 1/16/2017 18:52", "inspectorClassOf:" : "fn 3/13/2017 18:36", diff --git a/repository/ForeignLanguage-Support.package/monticello.meta/version b/repository/ForeignLanguage-Support.package/monticello.meta/version index 020eb200..39bb6e69 100644 --- a/repository/ForeignLanguage-Support.package/monticello.meta/version +++ b/repository/ForeignLanguage-Support.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st index f348be95..b12a4253 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st @@ -1,10 +1,10 @@ overrides selection - self object isPython ifFalse: [ ^ super selection ]. + self object isForeign ifFalse: [ ^ super selection ]. selectionIndex = 0 ifTrue: [^ '']. selectionIndex = 1 ifTrue: [^ object ]. selectionIndex = 2 ifTrue: [^ object symbolic]. selectionIndex = 3 ifTrue: [^ object headerDescription]. - object isPython ifTrue: [ - ^ object foreignFrame f_locals values at: selectionIndex - 3]. + Smalltalk at: object languageSymbol ifPresent: [ :cls | + ^ cls tempVariableAt: selectionIndex - 3 in: object foreignFrame ]. ^ 'Unexpected selection' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json index 5925e6fb..cd5cf0ef 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "selection" : "fn 3/14/2017 01:28" } } + "selection" : "fn 3/16/2017 22:43" } } diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/exploreFrames.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/exploreFrames.st deleted file mode 100644 index 5091bf0a..00000000 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/exploreFrames.st +++ /dev/null @@ -1,18 +0,0 @@ -utilities -exploreFrames - | currentFrame result frameInfo | - currentFrame := Python primGetTopFrame. - result := OrderedCollection new. - [ currentFrame notNone ] whileTrue: [ - frameInfo := IdentityDictionary new - add: #f_lineno->(currentFrame f_lineno); - add: #co_name->(currentFrame f_code co_name); - add: #co_firstlineno->(currentFrame f_code co_firstlineno); - add: #co_filename->(currentFrame f_code co_filename); - add: #f_locals->(currentFrame f_locals __str__); - add: #f_globals->(currentFrame f_globals __str__); - yourself. - result add: frameInfo. - currentFrame := currentFrame f_back ]. - result explore - \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/prependPythonContexts..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/prependPythonContexts..st deleted file mode 100644 index b42867cd..00000000 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/prependPythonContexts..st +++ /dev/null @@ -1,14 +0,0 @@ -pyContext -prependPythonContexts: aContext - | currentPyFrame newFrames | - currentPyFrame := Python primGetTopFrame. - currentPyFrame ifNil: [ ^ aContext ]. - newFrames := OrderedCollection new. - [ currentPyFrame notNone ] - whileTrue: [ - newFrames add: (self newForeignContext: currentPyFrame). - currentPyFrame := currentPyFrame f_back ]. - newFrames overlappingPairsDo: [ :a :b | - a sender: b ]. - newFrames last sender: aContext. - ^ newFrames first \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st index d43ad0a9..405a4286 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st @@ -3,7 +3,8 @@ contents: aText notifying: aController | ctx | ctx := self selectedContext. ctx isForeign ifFalse: [^ super contents: aText notifying: aController]. - self class setPySourceContent: ctx foreignFrame f_code content: aText asString. - Python restartFrame: ctx pyFrame with: aText asString withUnixLineEndings. + Smalltalk at: ctx languageSymbol ifPresent: [ :cls | + cls setSource: ctx foreignFrame to: aText asString. + cls restartFrame: ctx foreignFrame with: aText asString withUnixLineEndings ]. contents := aText. ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contextForStack..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contextForStack..st deleted file mode 100644 index 8fa17106..00000000 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contextForStack..st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -contextForStack: aContext - aContext method selector = #resumeFrame - ifFalse: [ ^ aContext ]. "Normal MethodContext" - ^ self class prependPythonContexts: aContext \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st index 2efb9325..4ca01cd2 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st @@ -1,7 +1,5 @@ overrides expandStack - "A Notifier is being turned into a full debugger. Show a substantial amount of stack in the context pane." - super expandStack. receiverInspector := ForeignLanguageInspector inspect: nil. contextVariablesInspector := ForeignLanguageContextVariablesInspector inspect: nil. \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st index b6fef4e3..f420536c 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st @@ -4,6 +4,6 @@ messageIconAt: anIndex Browser showMessageIcons ifFalse: [^ nil]. context := contextStack at: anIndex. - context isForeign - ifTrue: [ ^ ToolIcons iconNamed: context languageSymbol ] - ifFalse: [ ^ super messageIconAt: anIndex ] \ No newline at end of file + ^ context isForeign + ifTrue: [ ToolIcons iconNamed: context languageSymbol ] + ifFalse: [ super messageIconAt: anIndex ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st index e91a7a86..b438eb9b 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st @@ -1,6 +1,7 @@ overrides pcRange - "Answer the indices in the source code for the method corresponding to - the selected context's program counter value." - self selectedContext isForeign ifFalse: [ ^ super pcRange ]. - ^ self pyPCRange \ No newline at end of file + | ctx | + ctx := self selectedContext. + ctx isForeign ifFalse: [ ^ super pcRange ]. + Smalltalk at: ctx languageSymbol ifPresent: [ :cls | + ^ cls pcRange: ctx foreignFrame ]. \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/process.controller.context..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/process.controller.context..st deleted file mode 100644 index f45fa1b1..00000000 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/process.controller.context..st +++ /dev/null @@ -1,16 +0,0 @@ -overrides -process: aProcess controller: aController context: aContext - | contextForStack | - super initialize. - Smalltalk at: #MessageTally ifPresentAndInMemory: [ :tally | - tally terminateTimerProcess]. - contents := nil. - interruptedProcess := aProcess. - interruptedController := aController. - contextForStack := self contextForStack: aContext. - self newStack: (contextForStack stackOfSize: 1). - contextStackIndex := 1. - externalInterrupt := false. - selectingPC := true. - Smalltalk isMorphic ifTrue: - [errorWasInUIProcess := false] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pyPCRange.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pyPCRange.st deleted file mode 100644 index e3f7cf1c..00000000 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pyPCRange.st +++ /dev/null @@ -1,10 +0,0 @@ -overrides -pyPCRange - | pyFrame relativeLine lineCount | - pyFrame := self selectedContext foreignFrame. - relativeLine := pyFrame f_lineno asSmalltalk - pyFrame f_code co_firstlineno asSmalltalk. - lineCount := 0. - (self class getPySource: self selectedContext) lineIndicesDo: [:start :endWithoutDelimiters :end | - (lineCount := lineCount + 1) = (relativeLine + 1) - ifTrue: [ ^ start to: end ]]. - ^1 to: 0 \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st index 1626981d..0ac16570 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st @@ -4,4 +4,5 @@ selectedMessage | aContext | aContext := self selectedContext. aContext isForeign ifFalse: [ ^ super selectedMessage ]. - ^ self class getPySource: aContext \ No newline at end of file + Smalltalk at: aContext languageSymbol ifPresent: [ :cls | + ^ cls getSource: aContext foreignFrame ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json index 9c0a4180..97b65c25 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json @@ -1,30 +1,16 @@ { "class" : { - "exploreFrames" : "fn 3/9/2017 15:20", - "filterPySource:lineno:" : "fn 2/2/2017 00:01", - "getContentsOf:" : "fn 2/1/2017 22:37", - "getPySource:" : "fn 3/14/2017 01:28", - "getSignature:" : "fn 3/6/2017 10:25", - "indent:by:" : "fn 2/1/2017 22:41", - "indentSize:" : "fn 2/1/2017 22:36", - "newForeignContext:" : "fn 3/14/2017 01:34", - "prependPythonContexts:" : "fn 3/14/2017 01:34", - "replaceInPySource:content:lineno:" : "fn 2/2/2017 00:05", - "scopeEndIn:startingAt:" : "fn 2/1/2017 22:36", - "setPySourceContent:content:" : "fn 3/6/2017 10:26" }, + }, "instance" : { "aboutToStyle:" : "fn 3/14/2017 01:31", "buildCodePaneWith:" : "fn 3/13/2017 17:12", - "contents:notifying:" : "fn 3/14/2017 01:29", - "contextForStack:" : "fn 2/21/2017 12:48", + "contents:notifying:" : "fn 3/16/2017 21:56", "defaultStylerClass" : "fn 3/13/2017 17:12", - "expandStack" : "fn 3/13/2017 17:54", + "expandStack" : "fn 3/16/2017 22:00", "guessTypeForName:" : "fn 3/14/2017 01:31", "isPython" : "fn 3/14/2017 01:33", "isRuby" : "fn 3/14/2017 01:33", "languageSymbol" : "fn 3/14/2017 01:32", - "messageIconAt:" : "fn 3/14/2017 01:29", - "pcRange" : "fn 3/14/2017 01:31", - "process:controller:context:" : "fn 1/16/2017 19:34", - "pyPCRange" : "fn 3/14/2017 01:28", - "selectedMessage" : "fn 3/14/2017 01:29" } } + "messageIconAt:" : "fn 3/16/2017 22:18", + "pcRange" : "fn 3/16/2017 22:18", + "selectedMessage" : "fn 3/16/2017 21:49" } } diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/evaluateExpression..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/evaluateExpression..st new file mode 100644 index 00000000..d10c3b81 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/evaluateExpression..st @@ -0,0 +1,4 @@ +overrides +evaluateExpression: selection + object languageSymbol = #Smalltalk ifTrue: [ ^ Compiler evaluate: selection asString ]. + ^ self languageClass evaluateExpression: selection in: self doItContext to: self doItReceiver \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/languageClass.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/languageClass.st new file mode 100644 index 00000000..e3b06087 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/languageClass.st @@ -0,0 +1,3 @@ +helpers +languageClass + ^ Smalltalk at: object languageSymbol \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json index ceed638c..8ac53f20 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json @@ -5,5 +5,7 @@ "aboutToStyle:" : "fn 3/13/2017 17:35", "buildCodePaneWith:" : "fn 3/13/2017 17:12", "contentsIsString" : "fn 12/23/2016 11:11", + "evaluateExpression:" : "fn 3/21/2017 11:39", "fieldList" : "fn 3/14/2017 12:01", + "languageClass" : "fn 3/21/2017 11:40", "selection" : "fn 3/14/2017 12:08" } } diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st index 3b5f792d..1cea3aa4 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st @@ -8,5 +8,7 @@ addModelItemsToWindowMenu: aMenu selector: #selectLanguage: argument: ea ]. aMenu addLine. + aMenu addUpdating: #breakOnExceptionsText target: self action: #toggleBreakOnExceptions. + aMenu addLine. super addModelItemsToWindowMenu: aMenu \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions..st new file mode 100644 index 00000000..51bc2ff5 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions..st @@ -0,0 +1,3 @@ +accessing +breakOnExceptions: anObject + breakOnExceptions := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st new file mode 100644 index 00000000..c4b8ca22 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st @@ -0,0 +1,3 @@ +accessing +breakOnExceptions + ^ breakOnExceptions ifNil: [ breakOnExceptions := true ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptionsText.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptionsText.st new file mode 100644 index 00000000..6f39844b --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptionsText.st @@ -0,0 +1,5 @@ +accessing +breakOnExceptionsText + ^ (self breakOnExceptions + ifTrue: [ '' ] + ifFalse: ['' ]), ' break on exceptions' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st index a461a993..9aa8e55d 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st @@ -1,6 +1,4 @@ execution evaluateExpression: selection self isForeign ifFalse: [ ^ Compiler evaluate: selection asString ]. - Smalltalk at: self languageSymbol ifPresent: [ :cls | - (cls respondsTo: #evaluateExpression:) - ifTrue: [ ^ cls evaluateExpression: selection ] ] \ No newline at end of file + ^ self languageClass evaluateExpression: selection breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st index c6cecb5b..084e233f 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st @@ -1,4 +1,9 @@ foreign-language-support labelString - ^ self languageSymbol asString, ' ', self class windowTitlePrefix + | breakOnExceptionsText | + breakOnExceptionsText := self breakOnExceptions + ifTrue: [ 'break on exceptions' ] + ifFalse: [ 'no break on exceptions' ]. + ^ self languageSymbol asString, ' ', + self class windowTitlePrefix, ' (', breakOnExceptionsText, ')' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageClass.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageClass.st new file mode 100644 index 00000000..5851945e --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageClass.st @@ -0,0 +1,3 @@ +accessing +languageClass + ^ Smalltalk at: self languageSymbol \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/toggleBreakOnExceptions.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/toggleBreakOnExceptions.st new file mode 100644 index 00000000..bc7af061 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/toggleBreakOnExceptions.st @@ -0,0 +1,4 @@ +accessing +toggleBreakOnExceptions + self breakOnExceptions: self breakOnExceptions not. + self changed: #relabel \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json index 767ecf4a..4b975d19 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json @@ -4,11 +4,16 @@ "windowTitlePrefix" : "fn 3/14/2017 00:48" }, "instance" : { "aboutToStyle:" : "fn 3/13/2017 17:51", - "addModelItemsToWindowMenu:" : "fn 3/14/2017 00:47", + "addModelItemsToWindowMenu:" : "fn 3/21/2017 23:10", + "breakOnExceptions" : "fn 3/21/2017 23:07", + "breakOnExceptions:" : "fn 3/21/2017 23:06", + "breakOnExceptionsText" : "fn 3/21/2017 23:11", "buildCodePaneWith:" : "fn 3/13/2017 17:51", - "evaluateExpression:" : "fn 3/14/2017 18:31", + "evaluateExpression:" : "fn 3/21/2017 23:16", "isForeign" : "fn 3/14/2017 18:32", - "labelString" : "fn 3/14/2017 00:49", + "labelString" : "fn 3/22/2017 09:51", + "languageClass" : "fn 3/16/2017 22:40", "languageSymbol" : "fn 3/14/2017 01:00", "languageSymbol:" : "fn 3/13/2017 18:02", - "selectLanguage:" : "fn 3/14/2017 00:48" } } + "selectLanguage:" : "fn 3/14/2017 00:48", + "toggleBreakOnExceptions" : "fn 3/22/2017 09:47" } } diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json index 026c98a8..93e295e6 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json @@ -6,6 +6,7 @@ ], "commentStamp" : "", "instvars" : [ + "breakOnExceptions", "languageSymbol" ], "name" : "ForeignLanguageWorkspace", "pools" : [ diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/version b/repository/ForeignLanguage-Tools.package/monticello.meta/version index 68fb8a11..49ade0ba 100644 --- a/repository/ForeignLanguage-Tools.package/monticello.meta/version +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/breakOnExceptions..st deleted file mode 100644 index a3f8ae15..00000000 --- a/repository/Python-Core.package/Python.class/class/breakOnExceptions..st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -breakOnExceptions: aBool - BreakOnExceptions := aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/breakOnExceptions.st b/repository/Python-Core.package/Python.class/class/breakOnExceptions.st deleted file mode 100644 index dbfaff6f..00000000 --- a/repository/Python-Core.package/Python.class/class/breakOnExceptions.st +++ /dev/null @@ -1,3 +0,0 @@ -helpers -breakOnExceptions - ^ BreakOnExceptions ifNil: [ BreakOnExceptions := true ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/checkForException..st b/repository/Python-Core.package/Python.class/class/checkForException..st deleted file mode 100644 index 7ae05ffe..00000000 --- a/repository/Python-Core.package/Python.class/class/checkForException..st +++ /dev/null @@ -1,7 +0,0 @@ -special methods -checkForException: aPyLanguage - Smalltalk isHeadless ifTrue: [ ^ self ]. - (self primLastError: aPyLanguage) ifNotNil: [ :e | - ForeignLanguageException new - action: [ self openDebuggerWithPythonFrames: e ]; - signal ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/cmdFor..st b/repository/Python-Core.package/Python.class/class/cmdFor..st index 2280e30d..65979c5c 100644 --- a/repository/Python-Core.package/Python.class/class/cmdFor..st +++ b/repository/Python-Core.package/Python.class/class/cmdFor..st @@ -1,5 +1,5 @@ helpers -cmdFor: aPySource - (self isExpression: aPySource) +cmdFor: pySource + (self isExpression: pySource) ifTrue: [ ^ 'eval' ] ifFalse: [ ^ 'exec' ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/debuggerPrintItem.on..st b/repository/Python-Core.package/Python.class/class/debuggerPrintItem.on..st new file mode 100644 index 00000000..8b53ec6b --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/debuggerPrintItem.on..st @@ -0,0 +1,13 @@ +debugging +debuggerPrintItem: pyFrame on: aStream + | line lineno filename currentPath | + pyFrame ifNil: [ + aStream nextPutAll: 'Unknown pyFrame'. + ^ self ]. + line := self getSignature: pyFrame f_code. + lineno := pyFrame f_lineno asSmalltalk. + filename := pyFrame f_code co_filename asSmalltalk. + currentPath := FileDirectory default pathName. + (filename startsWith: currentPath) ifTrue: [ + filename := filename allButFirst: currentPath size + 1]. + aStream nextPutAll: line, ' (line ' , lineno asString, ' in ', filename, ')' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/debuggerTitle..st b/repository/Python-Core.package/Python.class/class/debuggerTitle..st new file mode 100644 index 00000000..bdce6308 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/debuggerTitle..st @@ -0,0 +1,5 @@ +debugging +debuggerTitle: pyError + | error | + error := pyError asSmalltalk. + ^ error first, ': ', error second \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/eval..st b/repository/Python-Core.package/Python.class/class/eval..st index 51f948d0..9fcfc706 100644 --- a/repository/Python-Core.package/Python.class/class/eval..st +++ b/repository/Python-Core.package/Python.class/class/eval..st @@ -1,3 +1,3 @@ execution eval: aString - ^ self eval: aString breakOnExceptions: self breakOnExceptions \ No newline at end of file + ^ self eval: aString breakOnExceptions: false \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st new file mode 100644 index 00000000..44811955 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st @@ -0,0 +1,4 @@ +execution +evaluateExpression: selection breakOnExceptions: aBool + ^ Python prun: selection asString breakOnExceptions: aBool + \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st b/repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st new file mode 100644 index 00000000..93c1be75 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st @@ -0,0 +1,26 @@ +execution +evaluateExpression: aSelection in: aContext to: receiver + | pyCode | + pyCode := aSelection asString. + + Python exec: 'rcvr_locals = dict()'. + (Python eval: 'rcvr_locals') setdefault: 'self' to: receiver. + + (Python isExpression: pyCode) + ifTrue: [ + ^ Python builtins + eval: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] + ifFalse: [ + ^ Python builtins + exec: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] + + "pyCode := pyCode copyReplaceAll: 'self.' with: ''. + method := (pyCode copyUpTo: $() asSymbol. + args := ((((pyCode copyAfter: $() copyUpTo: $)) + findTokens: {$,}) + collect: [ :ea | ea withBlanksTrimmed ]) asArray. + ^ receiver perform: method withArguments: args" \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/exec..st b/repository/Python-Core.package/Python.class/class/exec..st index ddc668a7..94aaa55b 100644 --- a/repository/Python-Core.package/Python.class/class/exec..st +++ b/repository/Python-Core.package/Python.class/class/exec..st @@ -1,3 +1,3 @@ execution exec: aString - ^ self exec: aString breakOnExceptions: self breakOnExceptions \ No newline at end of file + ^ self exec: aString breakOnExceptions: false \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/fileExtension.st b/repository/Python-Core.package/Python.class/class/fileExtension.st new file mode 100644 index 00000000..4b0f657e --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/fileExtension.st @@ -0,0 +1,3 @@ +source code +fileExtension + ^ '.py' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/filterPySource.lineno..st b/repository/Python-Core.package/Python.class/class/filterPySource.lineno..st similarity index 97% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/filterPySource.lineno..st rename to repository/Python-Core.package/Python.class/class/filterPySource.lineno..st index 7221b635..4090ad04 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/filterPySource.lineno..st +++ b/repository/Python-Core.package/Python.class/class/filterPySource.lineno..st @@ -1,4 +1,4 @@ -pySource +source code filterPySource: aString lineno: scopeStart | lines indentSize end | lines := aString lines. diff --git a/repository/Python-Core.package/Python.class/class/getForeignFrames..st b/repository/Python-Core.package/Python.class/class/getForeignFrames..st new file mode 100644 index 00000000..c3780ee3 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/getForeignFrames..st @@ -0,0 +1,10 @@ +debugging +getForeignFrames: topPyFrame + | currentPyFrame newFrames | + currentPyFrame := topPyFrame. + newFrames := OrderedCollection new. + [ currentPyFrame notNone ] + whileTrue: [ + newFrames add: currentPyFrame. + currentPyFrame := currentPyFrame f_back ]. + ^ newFrames \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getSignature..st b/repository/Python-Core.package/Python.class/class/getSignature..st similarity index 96% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getSignature..st rename to repository/Python-Core.package/Python.class/class/getSignature..st index 67fe8229..87258f1c 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getSignature..st +++ b/repository/Python-Core.package/Python.class/class/getSignature..st @@ -1,4 +1,4 @@ -pySource +debugging getSignature: pyCode | filename content | filename := pyCode co_filename asSmalltalk. diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getPySource..st b/repository/Python-Core.package/Python.class/class/getSource..st similarity index 74% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getPySource..st rename to repository/Python-Core.package/Python.class/class/getSource..st index 8d81f66a..d57842be 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/getPySource..st +++ b/repository/Python-Core.package/Python.class/class/getSource..st @@ -1,9 +1,8 @@ -pySource -getPySource: aContext +source code +getSource: pyFrame | pyCode filename contents | - pyCode := aContext foreignFrame f_code. + pyCode := pyFrame f_code. filename := pyCode co_filename asSmalltalk. filename = '' ifTrue: [ ^ 'Unable to get source.' ]. contents := self getContentsOf: filename. - ^ self filterPySource: contents lineno: pyCode co_firstlineno asSmalltalk - \ No newline at end of file + ^ self filterPySource: contents lineno: pyCode co_firstlineno asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/import..st b/repository/Python-Core.package/Python.class/class/import..st index 527d8f35..5a57c83f 100644 --- a/repository/Python-Core.package/Python.class/class/import..st +++ b/repository/Python-Core.package/Python.class/class/import..st @@ -1,3 +1,3 @@ helpers import: aModuleName - Python exec: 'import ', aModuleName breakOnExceptions: self breakOnExceptions \ No newline at end of file + Python exec: 'import ', aModuleName breakOnExceptions: false \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indent.by..st b/repository/Python-Core.package/Python.class/class/indent.by..st similarity index 93% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indent.by..st rename to repository/Python-Core.package/Python.class/class/indent.by..st index fa865ee3..e89bd824 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indent.by..st +++ b/repository/Python-Core.package/Python.class/class/indent.by..st @@ -1,4 +1,4 @@ -pySource +source code indent: aString by: aNumber | indent | indent := String new: aNumber withAll: Character space. diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indentSize..st b/repository/Python-Core.package/Python.class/class/indentSize..st similarity index 86% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indentSize..st rename to repository/Python-Core.package/Python.class/class/indentSize..st index 5a033d68..558128a1 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/indentSize..st +++ b/repository/Python-Core.package/Python.class/class/indentSize..st @@ -1,3 +1,3 @@ -pySource +source code indentSize: aLine ^ ((aLine findFirst: [:ea | ea isSeparator not]) - 1) max: 0 \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/load..st b/repository/Python-Core.package/Python.class/class/load..st index e48bcd29..8edc8fb3 100644 --- a/repository/Python-Core.package/Python.class/class/load..st +++ b/repository/Python-Core.package/Python.class/class/load..st @@ -1,3 +1,3 @@ helpers load: aModuleName - ^ self load: aModuleName breakOnExceptions: self breakOnExceptions \ No newline at end of file + ^ self load: aModuleName breakOnExceptions: false \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st b/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st deleted file mode 100644 index e4e08a8a..00000000 --- a/repository/Python-Core.package/Python.class/class/openDebuggerWithPythonFrames..st +++ /dev/null @@ -1,16 +0,0 @@ -system primitives -openDebuggerWithPythonFrames: pyError - | resumeCtx error | - resumeCtx := thisContext sender. - [ resumeCtx method selector = #resume: - and: [ resumeCtx closure isNil ] ] - whileFalse: [ - resumeCtx := resumeCtx sender. - resumeCtx ifNil: [ ^ self error: 'resumeCtx not found' ] ]. - error := pyError asSmalltalk. - ForeignLanguage - openOn: Processor activeProcess - context: (ForeignLanguage prependPythonContexts: resumeCtx) - label: error first, ': ', error second - contents: nil - fullView: true \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pcRange..st b/repository/Python-Core.package/Python.class/class/pcRange..st new file mode 100644 index 00000000..01a82895 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pcRange..st @@ -0,0 +1,9 @@ +debugging +pcRange: pyFrame + | relativeLine lineCount | + relativeLine := pyFrame f_lineno asSmalltalk - pyFrame f_code co_firstlineno asSmalltalk. + lineCount := 0. + (Python getSource: pyFrame) lineIndicesDo: [:start :endWithoutDelimiters :end | + (lineCount := lineCount + 1) = (relativeLine + 1) + ifTrue: [ ^ start to: end ]]. + ^ 1 to: 0 \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/persistPyCode..st b/repository/Python-Core.package/Python.class/class/persistPyCode..st deleted file mode 100644 index 18192812..00000000 --- a/repository/Python-Core.package/Python.class/class/persistPyCode..st +++ /dev/null @@ -1,9 +0,0 @@ -experimental -persistPyCode: pySource - | filename stream | - filename := 'py_files', FileDirectory pathNameDelimiter ,'source_', Time millisecondClockValue, '.py'. - stream := StandardFileStream forceNewFileNamed: filename. - stream := MultiByteFileStream newFrom: stream. - stream write: pySource. - stream close. - ^ filename \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/peval..st b/repository/Python-Core.package/Python.class/class/peval..st index 33a00f0e..5d8272ac 100644 --- a/repository/Python-Core.package/Python.class/class/peval..st +++ b/repository/Python-Core.package/Python.class/class/peval..st @@ -2,6 +2,6 @@ execution peval: aString ^ self primEval: aString - filename: (self persistPyCode: aString) + filename: (self persistEvalCode: aString) cmd: 'eval' - breakOnExceptions: self breakOnExceptions \ No newline at end of file + breakOnExceptions: false \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/peval.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/peval.breakOnExceptions..st new file mode 100644 index 00000000..d10963bf --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/peval.breakOnExceptions..st @@ -0,0 +1,7 @@ +execution +peval: aString breakOnExceptions: aBool + ^ self + primEval: aString + filename: (self persistEvalCode: aString) + cmd: 'eval' + breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pexec..st b/repository/Python-Core.package/Python.class/class/pexec..st index 93b9ca2d..759fb1fa 100644 --- a/repository/Python-Core.package/Python.class/class/pexec..st +++ b/repository/Python-Core.package/Python.class/class/pexec..st @@ -2,6 +2,6 @@ execution pexec: aString ^ self primEval: aString - filename: (self persistPyCode: aString) + filename: (self persistEvalCode: aString) cmd: 'exec' - breakOnExceptions: self breakOnExceptions \ No newline at end of file + breakOnExceptions: false \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pexec.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/pexec.breakOnExceptions..st new file mode 100644 index 00000000..71488efc --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pexec.breakOnExceptions..st @@ -0,0 +1,7 @@ +execution +pexec: aString breakOnExceptions: aBool + ^ self + primEval: aString + filename: (self persistEvalCode: aString) + cmd: 'exec' + breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primGetTopFrame.st b/repository/Python-Core.package/Python.class/class/primGetTopFrame..st similarity index 61% rename from repository/Python-Core.package/Python.class/class/primGetTopFrame.st rename to repository/Python-Core.package/Python.class/class/primGetTopFrame..st index 47d6a0f4..82042ab2 100644 --- a/repository/Python-Core.package/Python.class/class/primGetTopFrame.st +++ b/repository/Python-Core.package/Python.class/class/primGetTopFrame..st @@ -1,4 +1,4 @@ -experimental -primGetTopFrame +system primitives +primGetTopFrame: pyProcess self primitiveFailed. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primLastError..st b/repository/Python-Core.package/Python.class/class/primLastError..st index 2336645d..dca57b5f 100644 --- a/repository/Python-Core.package/Python.class/class/primLastError..st +++ b/repository/Python-Core.package/Python.class/class/primLastError..st @@ -1,4 +1,4 @@ system primitives -primLastError: aPyLanguage +primLastError: pyProcess ^ nil \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st b/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st index 243c13f1..78ee2451 100644 --- a/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st +++ b/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st @@ -1,4 +1,4 @@ -experimental +system primitives primRestartSpecificFrame: pyFrame source: pySource filename: aFilename cmd: evalOrExec self primitiveFailed. diff --git a/repository/Python-Core.package/Python.class/class/primResume..st b/repository/Python-Core.package/Python.class/class/primResume..st index fcbf1737..435b7a8c 100644 --- a/repository/Python-Core.package/Python.class/class/primResume..st +++ b/repository/Python-Core.package/Python.class/class/primResume..st @@ -1,4 +1,4 @@ -experimental -primResume: aPyLanguage +system primitives +primResume: pyProcess self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/prun.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/prun.breakOnExceptions..st new file mode 100644 index 00000000..23ea6160 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/prun.breakOnExceptions..st @@ -0,0 +1,5 @@ +execution +prun: pyCode breakOnExceptions: aBool + (self isExpression: pyCode) + ifTrue: [ [^ self peval: pyCode breakOnExceptions: aBool ] on: Error do: [] ]. + ^ self pexec: pyCode breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/replaceInPySource.content.lineno..st b/repository/Python-Core.package/Python.class/class/replaceInPySource.content.lineno..st similarity index 97% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/replaceInPySource.content.lineno..st rename to repository/Python-Core.package/Python.class/class/replaceInPySource.content.lineno..st index d82627c1..e41f402f 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/replaceInPySource.content.lineno..st +++ b/repository/Python-Core.package/Python.class/class/replaceInPySource.content.lineno..st @@ -1,4 +1,4 @@ -pySource +source code replaceInPySource: oldContent content: aString lineno: aLineno | lines end indentSize newLines | lines := oldContent lines. diff --git a/repository/Python-Core.package/Python.class/class/restartFrame.st b/repository/Python-Core.package/Python.class/class/restartFrame.st deleted file mode 100644 index 6cdd679f..00000000 --- a/repository/Python-Core.package/Python.class/class/restartFrame.st +++ /dev/null @@ -1,3 +0,0 @@ -experimental -restartFrame - self primRestartSpecificFrame: nil source: '' filename: '' cmd: '' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/restartFrame.with..st b/repository/Python-Core.package/Python.class/class/restartFrame.with..st index b0c31b90..29a35f9e 100644 --- a/repository/Python-Core.package/Python.class/class/restartFrame.with..st +++ b/repository/Python-Core.package/Python.class/class/restartFrame.with..st @@ -1,4 +1,4 @@ -experimental +debugging restartFrame: pyFrame with: aSource self primRestartSpecificFrame: pyFrame diff --git a/repository/Python-Core.package/Python.class/class/restartFrameWith.cmd..st b/repository/Python-Core.package/Python.class/class/restartFrameWith.cmd..st deleted file mode 100644 index 186e3f50..00000000 --- a/repository/Python-Core.package/Python.class/class/restartFrameWith.cmd..st +++ /dev/null @@ -1,4 +0,0 @@ -experimental -restartFrameWith: pySource cmd: evalOrExec - self primRestartSpecificFrame: nil source: pySource filename: '' cmd: evalOrExec - \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/resume..st b/repository/Python-Core.package/Python.class/class/resume..st index 8c362fea..42306e43 100644 --- a/repository/Python-Core.package/Python.class/class/resume..st +++ b/repository/Python-Core.package/Python.class/class/resume..st @@ -1,7 +1,7 @@ special methods -resume: aPyLanguage +resume: pyProcess "Magic method that is called by vm (cached in vm)" Processor yield. - [ ^ self primResume: aPyLanguage ] on: Error do: [ - self checkForException: aPyLanguage. - ^ self resume: aPyLanguage ] \ No newline at end of file + [ ^ self primResume: pyProcess ] on: Error do: [ + self checkForException: pyProcess. + ^ self resume: pyProcess ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/scopeEndIn.startingAt..st b/repository/Python-Core.package/Python.class/class/scopeEndIn.startingAt..st similarity index 96% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/scopeEndIn.startingAt..st rename to repository/Python-Core.package/Python.class/class/scopeEndIn.startingAt..st index 94b42d27..4d6e5285 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/scopeEndIn.startingAt..st +++ b/repository/Python-Core.package/Python.class/class/scopeEndIn.startingAt..st @@ -1,4 +1,4 @@ -pySource +source code scopeEndIn: aString startingAt: aLineno | lines currentIndentSize end | lines := aString lines allButFirst: aLineno. diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/setPySourceContent.content..st b/repository/Python-Core.package/Python.class/class/setSource.to..st similarity index 56% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/setPySourceContent.content..st rename to repository/Python-Core.package/Python.class/class/setSource.to..st index 8dcbf2ba..62ed7f48 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/class/setPySourceContent.content..st +++ b/repository/Python-Core.package/Python.class/class/setSource.to..st @@ -1,13 +1,13 @@ -pySource -setPySourceContent: pyCode content: aString - | filename oldContents newContents stream | - filename := pyCode co_filename asSmalltalk. +source code +setSource: pyFrame to: aString + | filename oldContents lineno newContents stream | + filename := pyFrame f_code co_filename asSmalltalk. stream := StandardFileStream readOnlyFileNamed: filename. oldContents := stream contents. stream close. - newContents := self replaceInPySource: oldContents content: aString lineno: pyCode co_firstlineno asSmalltalk. + lineno := pyFrame f_code co_firstlineno asSmalltalk. + newContents := self replaceInPySource: oldContents content: aString lineno: lineno. stream := StandardFileStream forceNewFileNamed: filename. stream := MultiByteFileStream newFrom: stream. stream write: newContents. - stream close - \ No newline at end of file + stream close \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPygments.st b/repository/Python-Core.package/Python.class/class/setUpPygments.st index 0bed3231..4ee57f78 100644 --- a/repository/Python-Core.package/Python.class/class/setUpPygments.st +++ b/repository/Python-Core.package/Python.class/class/setUpPygments.st @@ -14,7 +14,10 @@ try: _pygments_formatter = pygments.formatters.get_formatter_by_name( "html", encoding="utf-8", style="colorful", nowrap=True, noclasses=True, lineseparator="
") def _pygments_highlight(code, lexer=_pygments_lexer_python): - return re.sub("
$", "", pygments.highlight(code, lexer, _pygments_formatter)) + try: + return re.sub("
$", "", pygments.highlight(code, lexer, _pygments_formatter)) + except: + return code except ImportError: def _pygments_highlight(code): return code diff --git a/repository/Python-Core.package/Python.class/class/single..st b/repository/Python-Core.package/Python.class/class/single..st index e73ef268..ae06f637 100644 --- a/repository/Python-Core.package/Python.class/class/single..st +++ b/repository/Python-Core.package/Python.class/class/single..st @@ -4,4 +4,4 @@ single: aString primEval: aString filename: '' cmd: 'single' - breakOnExceptions: self breakOnExceptions \ No newline at end of file + breakOnExceptions: false \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/tempNamesIn..st b/repository/Python-Core.package/Python.class/class/tempNamesIn..st new file mode 100644 index 00000000..451b6431 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/tempNamesIn..st @@ -0,0 +1,3 @@ +debugging +tempNamesIn: pyFrame + ^ pyFrame f_locals keys asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/tempVariableAt.in..st b/repository/Python-Core.package/Python.class/class/tempVariableAt.in..st new file mode 100644 index 00000000..f796a7d6 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/tempVariableAt.in..st @@ -0,0 +1,3 @@ +debugging +tempVariableAt: anIndex in: pyFrame + ^ pyFrame f_locals values at: anIndex \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json index eb2f9110..8c09e4a5 100644 --- a/repository/Python-Core.package/Python.class/methodProperties.json +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -4,57 +4,70 @@ "None" : "fn 3/6/2017 10:13", "True" : "fn 3/6/2017 10:54", "basicVmSpeaksPython" : "fn 2/23/2017 20:59", - "breakOnExceptions" : "fn 3/11/2017 14:46", - "breakOnExceptions:" : "fn 3/11/2017 14:46", "builtins" : "fn 2/23/2017 18:34", - "checkForException:" : "fn 3/11/2017 19:23", - "cmdFor:" : "fn 2/23/2017 21:36", - "eval:" : "fn 3/11/2017 18:47", + "cmdFor:" : "fn 3/16/2017 21:57", + "debuggerPrintItem:on:" : "fn 3/16/2017 21:58", + "debuggerTitle:" : "fn 3/16/2017 15:12", + "eval:" : "fn 3/21/2017 23:14", "eval:breakOnExceptions:" : "fn 3/11/2017 18:47", "evaluateExpression:" : "fn 3/14/2017 18:31", + "evaluateExpression:breakOnExceptions:" : "fn 3/21/2017 23:13", + "evaluateExpression:in:to:" : "fn 3/21/2017 11:33", "evaluatorClass" : "fn 12/22/2016 02:53", - "exec:" : "fn 3/11/2017 18:48", + "exec:" : "fn 3/21/2017 23:14", "exec:breakOnExceptions:" : "fn 3/11/2017 18:47", + "fileExtension" : "fn 3/17/2017 10:20", + "filterPySource:lineno:" : "fn 3/16/2017 21:37", "from:import:" : "fn 1/9/2017 20:54", "from:load:" : "fn 1/9/2017 20:55", "fromObjectCache:" : "fn 2/23/2017 18:40", + "getForeignFrames:" : "fn 3/16/2017 21:58", + "getSignature:" : "fn 3/16/2017 16:18", + "getSource:" : "fn 3/16/2017 21:58", "globals" : "fn 2/26/2017 21:46", "highlight:" : "fn 3/14/2017 11:27", - "import:" : "fn 3/12/2017 02:47", + "import:" : "fn 3/21/2017 23:14", "import:breakOnExceptions:" : "fn 3/12/2017 02:47", + "indent:by:" : "fn 3/16/2017 21:38", + "indentSize:" : "fn 3/16/2017 21:37", "initialize" : "fn 3/6/2017 22:13", "isCallable:" : "fn 2/26/2017 21:45", "isExpression:" : "fn 2/26/2017 21:45", - "load:" : "fn 3/12/2017 02:48", + "load:" : "fn 3/21/2017 23:14", "load:breakOnExceptions:" : "fn 3/12/2017 02:46", "locals" : "fn 2/26/2017 21:46", - "openDebuggerWithPythonFrames:" : "fn 3/14/2017 01:30", - "persistPyCode:" : "fn 2/1/2017 12:46", - "peval:" : "fn 3/11/2017 14:47", - "pexec:" : "fn 3/11/2017 14:47", + "pcRange:" : "fn 3/16/2017 22:21", + "peval:" : "fn 3/21/2017 23:15", + "peval:breakOnExceptions:" : "fn 3/22/2017 13:12", + "pexec:" : "fn 3/21/2017 23:15", + "pexec:breakOnExceptions:" : "fn 3/21/2017 23:14", "primEval:filename:cmd:breakOnExceptions:" : "fn 3/11/2017 14:45", - "primGetTopFrame" : "fn 3/14/2017 22:23", - "primLastError:" : "fn 3/11/2017 14:48", + "primGetTopFrame:" : "fn 3/22/2017 15:12", + "primLastError:" : "fn 3/22/2017 15:12", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", - "primResume:" : "fn 3/12/2017 14:54", + "primResume:" : "fn 3/22/2017 15:12", "prun:" : "fn 2/23/2017 21:36", + "prun:breakOnExceptions:" : "fn 3/21/2017 23:13", "pyFormatter" : "fn 3/6/2017 07:20", "pyLexerPython" : "fn 3/6/2017 19:05", "pyLexerSmalltalk" : "fn 3/6/2017 19:05", "pygments" : "fn 3/9/2017 17:52", "re" : "fn 3/9/2017 17:53", + "replaceInPySource:content:lineno:" : "fn 3/16/2017 21:37", "reset" : "fn 2/23/2017 21:13", - "restartFrame" : "fn 2/22/2017 10:21", - "restartFrame:with:" : "fn 2/22/2017 14:14", - "restartFrameWith:cmd:" : "fn 2/1/2017 10:57", - "resume:" : "fn 3/11/2017 15:00", + "restartFrame:with:" : "fn 3/16/2017 21:56", + "resume:" : "fn 3/22/2017 15:12", "run:" : "fn 2/23/2017 21:37", - "setUpPygments" : "fn 3/13/2017 17:24", + "scopeEndIn:startingAt:" : "fn 3/16/2017 21:38", + "setSource:to:" : "fn 3/16/2017 21:58", + "setUpPygments" : "fn 3/22/2017 00:30", "setUpPythonEnvironment" : "fn 3/9/2017 17:54", - "single:" : "fn 3/11/2017 14:47", + "single:" : "fn 3/21/2017 23:15", "sourceCodeTemplate" : "fn 3/14/2017 11:22", "startUp:" : "fn 3/14/2017 11:32", "sys" : "fn 3/9/2017 17:54", + "tempNamesIn:" : "fn 3/16/2017 22:43", + "tempVariableAt:in:" : "fn 3/16/2017 22:43", "type" : "fn 2/23/2017 18:34", "vmSpeaksLanguage" : "fn 3/14/2017 11:31" }, "instance" : { diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index 43e7afee..67992979 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st b/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st index 8fd3b3cc..0a0c8ce0 100644 --- a/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st @@ -1,7 +1,7 @@ as yet unclassified testScopeEndInStartingAt | d input | - d := ForeignLanguage. + d := Python. input := ' a = 2 def foo(): diff --git a/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json b/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json index 4d9fa3db..94b52f05 100644 --- a/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { }, "instance" : { - "testScopeEndInStartingAt" : "fn 3/14/2017 01:31" } } + "testScopeEndInStartingAt" : "fn 3/16/2017 21:38" } } diff --git a/repository/Python-Tests.package/monticello.meta/version b/repository/Python-Tests.package/monticello.meta/version index 36d00304..1bef2237 100644 --- a/repository/Python-Tests.package/monticello.meta/version +++ b/repository/Python-Tests.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Tests-fn.2' message 'Update test' id 'b05d2fe6-a180-4e18-bc32-5858e26fc346' date '14 March 2017' time '10:55:08.394541 am' author 'fn' ancestors ((name 'Python-Tests-fn.1' message 'Initial commit' id 'c3c0a7f2-bf15-4217-a468-c5aa7dcac35d' date '6 March 2017' time '9:43:34.293217 pm' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Tests-fn.3' message 'Update in-image code' id 'be75fa6c-5bb6-43f2-8cb5-152619eb0540' date '22 March 2017' time '9:44:50.30627 pm' author 'fn' ancestors ((name 'Python-Tests-fn.2' message 'Update test' id 'b05d2fe6-a180-4e18-bc32-5858e26fc346' date '14 March 2017' time '10:55:08.394541 am' author 'fn' ancestors ((name 'Python-Tests-fn.1' message 'Initial commit' id 'c3c0a7f2-bf15-4217-a468-c5aa7dcac35d' date '6 March 2017' time '9:43:34.293217 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/checkForException..st b/repository/Ruby-Core.package/Ruby.class/class/checkForException..st deleted file mode 100644 index c87531cf..00000000 --- a/repository/Ruby-Core.package/Ruby.class/class/checkForException..st +++ /dev/null @@ -1,5 +0,0 @@ -special methods -checkForException: aRbLanguage - Smalltalk isHeadless ifTrue: [ ^ self ]. - (self primLastError: aRbLanguage) ifNotNil: [ :e | - 1 halt ] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st b/repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st new file mode 100644 index 00000000..e33bc3ef --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st @@ -0,0 +1,10 @@ +debugging +debuggerPrintItem: rbFrame on: aStream + | name lineno filename currentPath | + name := rbFrame get_code_name asSmalltalk. + lineno := '1'"rbFrame get_lineno asSmalltalk asString". + filename := rbFrame get_filename asSmalltalk. + currentPath := FileDirectory default pathName. + (filename startsWith: currentPath) ifTrue: [ + filename := filename allButFirst: currentPath size + 1]. + aStream nextPutAll: name, ' (line ' , lineno, ' in ', filename, ')' \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/debuggerTitle..st b/repository/Ruby-Core.package/Ruby.class/class/debuggerTitle..st new file mode 100644 index 00000000..91986ba1 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/debuggerTitle..st @@ -0,0 +1,3 @@ +debugging +debuggerTitle: rbError + ^ rbError class asString, ': ', rbError asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/eval..st b/repository/Ruby-Core.package/Ruby.class/class/eval..st index f96db4c5..b6241609 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/eval..st +++ b/repository/Ruby-Core.package/Ruby.class/class/eval..st @@ -1,3 +1,3 @@ execution eval: aString - ^ self primEval: aString breakOnExceptions: true \ No newline at end of file + ^ self eval: aString filePath: '-e' \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st b/repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st new file mode 100644 index 00000000..6b88b937 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st @@ -0,0 +1,3 @@ +execution +eval: aString filePath: aFilePath + ^ self primEval: aString filePath: aFilePath breakOnExceptions: true \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st index b379908e..cbce00cb 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st @@ -1,3 +1,3 @@ execution evaluateExpression: selection - ^ Ruby eval: selection asString \ No newline at end of file + ^ Ruby peval: selection asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st new file mode 100644 index 00000000..756d975b --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st @@ -0,0 +1,3 @@ +execution +evaluateExpression: selection breakOnExceptions: aBool + ^ Ruby peval: selection asString breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/fileExtension.st b/repository/Ruby-Core.package/Ruby.class/class/fileExtension.st new file mode 100644 index 00000000..3f28de26 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/fileExtension.st @@ -0,0 +1,3 @@ +source code +fileExtension + ^ '.rb' \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/getForeignFrames..st b/repository/Ruby-Core.package/Ruby.class/class/getForeignFrames..st new file mode 100644 index 00000000..cffd487a --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/getForeignFrames..st @@ -0,0 +1,10 @@ +debugging +getForeignFrames: topRbFrame + | currentRbFrame newFrames | + currentRbFrame := topRbFrame. + newFrames := OrderedCollection new. + [ currentRbFrame notNil ] + whileTrue: [ + newFrames add: currentRbFrame. + currentRbFrame := currentRbFrame get_previous ]. + ^ newFrames \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/getSource..st b/repository/Ruby-Core.package/Ruby.class/class/getSource..st new file mode 100644 index 00000000..23057593 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/getSource..st @@ -0,0 +1,7 @@ +source code +getSource: rbFrame + | filename | + rbFrame has_contents asSmalltalk ifFalse: [ ^ 'no contents' ]. + filename := rbFrame get_filename asSmalltalk. + filename = '-e' ifTrue: [ ^ 'source unavailable (-e)' ]. + ^ self getContentsOf: filename \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/nil.st b/repository/Ruby-Core.package/Ruby.class/class/nil.st new file mode 100644 index 00000000..79b6f691 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/nil.st @@ -0,0 +1,3 @@ +special objects +nil + ^ Ruby eval: 'nil' \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/pcRange..st b/repository/Ruby-Core.package/Ruby.class/class/pcRange..st new file mode 100644 index 00000000..22ae8b45 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/pcRange..st @@ -0,0 +1,4 @@ +debugging +pcRange: rbFrame + "TBD" + ^ 1 to: 0 \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/peval..st b/repository/Ruby-Core.package/Ruby.class/class/peval..st new file mode 100644 index 00000000..6ee98bc8 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/peval..st @@ -0,0 +1,3 @@ +execution +peval: aString + ^ self eval: aString filePath: (self persistEvalCode: aString) \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/peval.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/peval.breakOnExceptions..st new file mode 100644 index 00000000..d599269c --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/peval.breakOnExceptions..st @@ -0,0 +1,3 @@ +execution +peval: aString breakOnExceptions: aBool + ^ self primEval: aString filePath: (self persistEvalCode: aString) breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primEval.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/primEval.filePath.breakOnExceptions..st similarity index 56% rename from repository/Ruby-Core.package/Ruby.class/class/primEval.breakOnExceptions..st rename to repository/Ruby-Core.package/Ruby.class/class/primEval.filePath.breakOnExceptions..st index ecf9b6ea..e3aef03b 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/primEval.breakOnExceptions..st +++ b/repository/Ruby-Core.package/Ruby.class/class/primEval.filePath.breakOnExceptions..st @@ -1,4 +1,4 @@ system primitives -primEval: aString breakOnExceptions: aBool +primEval: aString filePath: aFilePath breakOnExceptions: aBool self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame..st b/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame..st new file mode 100644 index 00000000..6c14fc5b --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame..st @@ -0,0 +1,4 @@ +system primitives +primGetTopFrame: rbProcess + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primLastError..st b/repository/Ruby-Core.package/Ruby.class/class/primLastError..st index 1d93e296..1795ac69 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/primLastError..st +++ b/repository/Ruby-Core.package/Ruby.class/class/primLastError..st @@ -1,4 +1,4 @@ system primitives -primLastError: aRbLanguage +primLastError: rbProcess ^ nil \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primResume..st b/repository/Ruby-Core.package/Ruby.class/class/primResume..st index 6245ffff..42849ec0 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/primResume..st +++ b/repository/Ruby-Core.package/Ruby.class/class/primResume..st @@ -1,4 +1,4 @@ system primitives -primResume: aRbLanguage +primResume: rbProcess self primitiveFailed \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/restartFrame.with..st b/repository/Ruby-Core.package/Ruby.class/class/restartFrame.with..st new file mode 100644 index 00000000..09efd45f --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/restartFrame.with..st @@ -0,0 +1,3 @@ +debugging +restartFrame: rbFrame with: aSource + self subclassResponsibility \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/resume..st b/repository/Ruby-Core.package/Ruby.class/class/resume..st index f02fa596..962eae8d 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/resume..st +++ b/repository/Ruby-Core.package/Ruby.class/class/resume..st @@ -1,7 +1,7 @@ special methods -resume: aRbLanguage +resume: rbProcess "Magic method that is called by vm (cached in vm)" Processor yield. - [ ^ self primResume: aRbLanguage ] on: Error do: [ - self checkForException: aRbLanguage. - ^ self resume: aRbLanguage ] \ No newline at end of file + [ ^ self primResume: rbProcess ] on: Error do: [ + self checkForException: rbProcess. + ^ self resume: rbProcess ] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/tempNamesIn..st b/repository/Ruby-Core.package/Ruby.class/class/tempNamesIn..st new file mode 100644 index 00000000..3e13543d --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/tempNamesIn..st @@ -0,0 +1,3 @@ +debugging +tempNamesIn: pyFrame + ^ #() \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/tempVariableAt.in..st b/repository/Ruby-Core.package/Ruby.class/class/tempVariableAt.in..st new file mode 100644 index 00000000..8823ab98 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/tempVariableAt.in..st @@ -0,0 +1,3 @@ +debugging +tempVariableAt: anIndex in: pyFrame + ^ 'tdb' \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json index 3b1b268a..64aa2032 100644 --- a/repository/Ruby-Core.package/Ruby.class/methodProperties.json +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -1,19 +1,33 @@ { "class" : { - "checkForException:" : "fn 3/12/2017 14:56", - "eval:" : "fn 3/12/2017 15:17", - "evaluateExpression:" : "fn 3/14/2017 18:31", + "debuggerPrintItem:on:" : "fn 3/16/2017 22:37", + "debuggerTitle:" : "fn 3/16/2017 22:47", + "eval:" : "fn 3/16/2017 13:41", + "eval:filePath:" : "fn 3/16/2017 13:42", + "evaluateExpression:" : "fn 3/17/2017 10:22", + "evaluateExpression:breakOnExceptions:" : "fn 3/21/2017 23:13", + "fileExtension" : "fn 3/17/2017 10:20", + "getForeignFrames:" : "fn 3/16/2017 22:22", + "getSource:" : "fn 3/17/2017 10:46", "highlight:" : "fn 3/14/2017 11:27", "kernel" : "tfel 8/16/2016 07:04", + "nil" : "fn 3/16/2017 13:37", "object" : "tfel 8/16/2016 07:04", + "pcRange:" : "fn 3/16/2017 22:22", + "peval:" : "fn 3/17/2017 10:22", + "peval:breakOnExceptions:" : "fn 3/19/2017 01:09", "primEval:" : "tfel 8/16/2016 07:03", - "primEval:breakOnExceptions:" : "fn 3/12/2017 15:02", + "primEval:filePath:breakOnExceptions:" : "fn 3/16/2017 13:40", "primGetTopFrame" : "fn 3/14/2017 22:23", - "primLastError:" : "fn 3/12/2017 14:55", - "primResume:" : "fn 3/12/2017 14:54", + "primGetTopFrame:" : "fn 3/22/2017 15:12", + "primLastError:" : "fn 3/22/2017 15:13", + "primResume:" : "fn 3/22/2017 15:13", "primSend:to:with:" : "tfel 8/16/2016 07:03", - "resume:" : "fn 3/12/2017 14:54", + "restartFrame:with:" : "fn 3/16/2017 22:22", + "resume:" : "fn 3/22/2017 15:13", "sourceCodeTemplate" : "fn 3/14/2017 11:22", + "tempNamesIn:" : "fn 3/16/2017 22:45", + "tempVariableAt:in:" : "fn 3/16/2017 22:44", "vmSpeaksLanguage" : "fn 3/14/2017 11:33" }, "instance" : { } } diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/isNil.st b/repository/Ruby-Core.package/RubyObject.class/instance/isNil.st new file mode 100644 index 00000000..2a5e9f78 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/isNil.st @@ -0,0 +1,3 @@ +overrides +isNil + ^ self == Ruby nil \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/notNil.st b/repository/Ruby-Core.package/RubyObject.class/instance/notNil.st new file mode 100644 index 00000000..499af8fb --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/notNil.st @@ -0,0 +1,3 @@ +overrides +notNil + ^ self isNil not \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/methodProperties.json b/repository/Ruby-Core.package/RubyObject.class/methodProperties.json index 6d677af9..f2042701 100644 --- a/repository/Ruby-Core.package/RubyObject.class/methodProperties.json +++ b/repository/Ruby-Core.package/RubyObject.class/methodProperties.json @@ -8,8 +8,10 @@ "className" : "fn 3/12/2017 19:09", "defaultTitleForInspector" : "fn 3/14/2017 11:52", "instVarNamed:" : "fn 3/14/2017 12:08", + "isNil" : "fn 3/16/2017 13:38", "isRuby" : "fn 3/12/2017 19:24", "languageSymbol" : "fn 3/14/2017 00:51", + "notNil" : "fn 3/16/2017 13:38", "printOn:" : "fn 3/14/2017 01:00", "respondsTo:" : "fn 3/12/2017 19:17", "variablesAndOffsetsDo:" : "fn 3/12/2017 19:19" } } diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version index 76b13db4..2ee59ee5 100644 --- a/repository/Ruby-Core.package/monticello.meta/version +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From dd62d5c8d581d4af4f18a4ebeaba9a858b601836 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Mar 2017 00:31:22 +0100 Subject: [PATCH 146/193] =?UTF-8?q?Ensure=20resume=20prim=20doesn=E2=80=99?= =?UTF-8?q?t=20fail=20when=20not=20breakOnEx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rsqueakvm/plugins/foreign_language/process.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index a1361d89..f5e5c30d 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -121,6 +121,10 @@ def resume(self): print 'The runner is done and cannot be resumed' return False self.runner().resume() + if not self.break_on_exceptions(): + # resume is always successful in this case, otherwise the image + # would start looking for an error + return True return self.get_error() is None def runner(self): From b1cd6b3120e3e52f5b0882bde21e6e21f861888f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Mar 2017 00:31:50 +0100 Subject: [PATCH 147/193] Minor changes --- .../plugins/foreign_language/__init__.py | 5 ++++- rsqueakvm/plugins/foreign_language/process.py | 17 ++++++++--------- rsqueakvm/plugins/python/__init__.py | 2 +- rsqueakvm/plugins/python/patching.py | 3 ++- rsqueakvm/plugins/python/process.py | 19 ++++++------------- rsqueakvm/plugins/python/utils.py | 4 ++-- rsqueakvm/plugins/ruby/patching.py | 3 ++- rsqueakvm/plugins/ruby/process.py | 17 +++++------------ 8 files changed, 30 insertions(+), 40 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 01cbb8e4..55998149 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -92,7 +92,10 @@ def lastError(interp, s_frame, w_rcvr, language_process): def getTopFrame(interp, s_frame, w_rcvr, language_process): if not isinstance(language_process, W_ForeignLanguageProcess): raise PrimitiveFailedError - return language_process.top_w_frame() + w_top_frame = language_process.w_top_frame() + if w_top_frame is None: + raise PrimitiveFailedError + return w_top_frame @self.expose_primitive(unwrap_spec=[object]) def asSmalltalk(interp, s_frame, w_rcvr): diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index f5e5c30d..4a5dbb4f 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -1,4 +1,3 @@ -from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.plugins.foreign_language import runner from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.compiled_methods import ( @@ -90,17 +89,11 @@ def getclass(self, space): def run(self): raise NotImplementedError - def set_result(self, result): - raise NotImplementedError - - def set_error(self, error): - raise NotImplementedError - def set_current(self): raise NotImplementedError - def top_w_frame(self): - raise PrimitiveFailedError + def w_top_frame(self): + raise NotImplementedError # Helpers @@ -136,9 +129,15 @@ def is_done(self): def get_result(self): return self.w_result + def set_result(self, w_result): + self.w_result = w_result + def get_error(self): return self.w_error + def set_error(self, w_error): + self.w_error = w_error + def reset_error(self): self.w_error = None diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index bf8de7d2..c3c62757 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -109,7 +109,7 @@ def perform_send(space, w_rcvr, attrname, args_w): else: wp_result = py_attr except OperationError as operr: - return W_PythonObject(utils.operr_to_pylist(operr)) + return utils.operr_to_w_object(operr) except Exception as e: print 'Unable to call %s on %s: %s' % (attrname, wp_rcvr, e) raise PrimitiveFailedError diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 73fef666..bf1de65c 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -1,6 +1,7 @@ from rsqueakvm.plugins.python.objspace import py_space, switch_action from rsqueakvm.plugins.python.process import W_PythonProcess from rsqueakvm.plugins.python.switching import RestartException +from rsqueakvm.plugins.python.utils import operr_to_w_object from rsqueakvm.util.cells import QuasiConstant from pypy.interpreter.pycode import PyCode, default_magic @@ -119,7 +120,7 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): if (language is not None and language.break_on_exceptions() and not self.has_exception_handler(operr)): # import pdb; pdb.set_trace() - language.set_error(operr) + language.set_error(operr_to_w_object(operr)) print 'Python error caught' switch_action.perform(ec, self) return old_handle_operation_error(self, ec, operr, attach_tb) diff --git a/rsqueakvm/plugins/python/process.py b/rsqueakvm/plugins/python/process.py index de8bb8cd..25a538c8 100644 --- a/rsqueakvm/plugins/python/process.py +++ b/rsqueakvm/plugins/python/process.py @@ -1,8 +1,7 @@ -from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.objspace import py_space -from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_pylist +from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_w_object from pypy.interpreter.error import OperationError @@ -25,25 +24,19 @@ def run(self): self.runner().return_to_smalltalk() retval = _run_eval_string(self.source, self.filename, self.cmd) - self.set_result(retval) + self.set_result(W_PythonObject(retval)) except OperationError as operr: # operr was not handled by users, because they pressed proceed. # save Python error as result instead. - self.set_result(operr_to_pylist(operr)) + self.set_result(operr_to_w_object(operr)) def set_current(self): py_space.current_python_process.set(self) - def set_result(self, wp_result): - self.w_result = W_PythonObject(wp_result) - - def set_error(self, wp_operr): - self.w_error = W_PythonObject(operr_to_pylist(wp_operr)) - - def top_w_frame(self): + def w_top_frame(self): if self.ec is None: - raise PrimitiveFailedError + return None topframe = self.ec.gettopframe() if topframe is None: - raise PrimitiveFailedError + return None return W_PythonObject(topframe) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index a6765fe8..b061e4c0 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -123,13 +123,13 @@ def get_restart_pycode(source, filename='', cmd='exec'): return -def operr_to_pylist(operr): +def operr_to_w_object(operr): if not isinstance(operr, OperationError): return wp_exception = py_space.newtext(operr.w_type.getname(py_space)) wp_value = operr.get_w_value(py_space) # wp_traceback = operr.get_traceback() or py_space.w_None - return py_space.newlist([wp_exception, wp_value]) # wp_traceback]) + return W_PythonObject(py_space.newlist([wp_exception, wp_value])) def entry_point(argv): diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index 416f5fc6..cf8be9c3 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -1,3 +1,4 @@ +from rsqueakvm.plugins.ruby.model import W_RubyObject from rsqueakvm.plugins.ruby.process import W_RubyProcess from rsqueakvm.util.cells import QuasiConstant @@ -78,7 +79,7 @@ def new_handle_ruby_error(self, space, pc, frame, bytecode, error): language = space.current_ruby_process.get() if (language is not None and language.break_on_exceptions() and not frame.has_exception_handler(error)): - language.set_error(error.w_value) + language.set_error(W_RubyObject(error.w_value)) print 'Ruby error caught' switch_to_smalltalk(space.current_ruby_process.get()) return old_handle_ruby_error(self, space, pc, frame, bytecode, error) diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index 4d017ed4..d8e31aae 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -1,4 +1,3 @@ -from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess from rsqueakvm.plugins.ruby.frame import WR_FrameObject from rsqueakvm.plugins.ruby.model import W_RubyObject @@ -22,23 +21,17 @@ def run(self): print 'Ruby start' try: retval = ruby_space.execute(self.source, filepath=self.filepath) - self.set_result(retval) + self.set_result(W_RubyObject(retval)) except RubyError as e: - self.set_result(e.w_value) + self.set_result(W_RubyObject(e.w_value)) def set_current(self): ruby_space.current_ruby_process.set(self) - def set_result(self, wr_result): - self.w_result = W_RubyObject(wr_result) - - def set_error(self, wr_error): - self.w_error = W_RubyObject(wr_error) - - def top_w_frame(self): + def w_top_frame(self): if self.ec is None: - raise PrimitiveFailedError + return None topframe = self.ec.gettoprubyframe() if topframe is None: - raise PrimitiveFailedError + return None return W_RubyObject(WR_FrameObject(topframe)) From e2b089e0d0032e0b00d14eded2077c0831fddc40 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Mar 2017 10:14:06 +0100 Subject: [PATCH 148/193] Adjust switch_to_smalltalk to #resume: methods Ensure that it stores a #resume: frame with closure = nil --- rsqueakvm/plugins/foreign_language/process.py | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index 4a5dbb4f..c6400192 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -160,14 +160,26 @@ def switch_to_smalltalk(self, interp, s_frame, first_call=False): [self] ) # import pdb; pdb.set_trace() - # we go one up, because the s_frame.w_method() is our fake method - if first_call or s_frame.w_method() is not self.resume_method(): - # assert s_frame.w_method() is not resume_method + if first_call: # attach s_frame with resume method for the first time s_resume_frame.store_s_sender(s_frame) + elif s_frame.w_method() is self.resume_method(): + if s_frame.closure is None: + resume_frame = s_frame + else: + # up up, because there is an #on:do: in between + resume_frame = s_frame.s_sender().s_sender() + # Ensure #resume: method with closure = nil + if (resume_frame.w_method() is self.resume_method() and + resume_frame.closure is None): + # instead of chaining resume frames, store original sender + s_resume_frame.store_s_sender(resume_frame.s_sender()) + else: + print ('Unexpected resume_frame found:\n%s' % + s_frame.print_stack()) + s_resume_frame.store_s_sender(s_frame) else: - if s_frame.w_method() is not self.resume_method(): - print 'Unexpected s_frame found.' - s_resume_frame.store_s_sender(s_frame.s_sender()) + print 'Unexpected s_frame found:\n%s' % s_frame.print_stack() + s_resume_frame.store_s_sender(s_frame) interp.quick_check_for_interrupt(s_resume_frame, dec=interp.interrupt_counter_size) # this will raise a ProcessSwitch if there are interrupts or timers ... From b65f645bac79c165499985e63cd5b31b087b7de6 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 23 Mar 2017 10:15:10 +0100 Subject: [PATCH 149/193] Raise interrupt counter size + jit optimizations --- rsqueakvm/plugins/ruby/patching.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index cf8be9c3..6443ab7a 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -7,13 +7,16 @@ ApplicationException, Interpreter as TopazInterpreter) from topaz.objspace import ObjectSpace as TopazObjectSpace +from rpython.rlib import jit + old_handle_bytecode = TopazInterpreter.handle_bytecode old_handle_ruby_error = TopazInterpreter.handle_ruby_error +old_jump = TopazInterpreter.jump old_getexecutioncontext = TopazObjectSpace.getexecutioncontext class InterruptCounter: - counter_size = 1000 + counter_size = 10000 def __init__(self): self.reset() @@ -21,8 +24,8 @@ def __init__(self): def reset(self): self._counter = self.counter_size - def triggers(self): - self._counter -= 1 + def triggers(self, decr_by=1): + self._counter -= decr_by if self._counter <= 0: self._counter = self.counter_size return True @@ -70,7 +73,7 @@ def has_exception_handler(self, error): def new_handle_bytecode(self, space, pc, frame, bytecode): - if interrupt_counter.triggers(): + if not jit.we_are_jitted() and interrupt_counter.triggers(): switch_to_smalltalk(space.current_ruby_process.get()) return old_handle_bytecode(self, space, pc, frame, bytecode) @@ -85,6 +88,15 @@ def new_handle_ruby_error(self, space, pc, frame, bytecode, error): return old_handle_ruby_error(self, space, pc, frame, bytecode, error) +def new_jump(self, space, bytecode, frame, cur_pc, target_pc): + if target_pc < cur_pc and jit.we_are_jitted(): + trace_length = jit.current_trace_length() + decr_by = int(trace_length >> 12 | 1) + if interrupt_counter.triggers(decr_by=decr_by): + switch_to_smalltalk(space.current_ruby_process.get()) + return old_jump(self, space, bytecode, frame, cur_pc, target_pc) + + def new_getexecutioncontext(self): current_ruby_process = self.current_ruby_process.get() if current_ruby_process is not None: @@ -104,6 +116,7 @@ def patch_topaz(): TopazFrame.block_handles_exception = block_handles_exception TopazInterpreter.handle_bytecode = new_handle_bytecode TopazInterpreter.handle_ruby_error = new_handle_ruby_error + TopazInterpreter.jump = new_jump TopazObjectSpace.current_ruby_process = QuasiConstant(None, W_RubyProcess) TopazObjectSpace.getexecutioncontext = new_getexecutioncontext From 7270026e70818739ba85a1c83db7d48079851019 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 29 Mar 2017 18:51:48 +0200 Subject: [PATCH 150/193] Annotate code objects with their source also move interrupt counter and switch_to_smalltalk to switching.py in Ruby --- rsqueakvm/plugins/python/patching.py | 35 ++++++++++++-- rsqueakvm/plugins/ruby/frame.py | 4 ++ rsqueakvm/plugins/ruby/patching.py | 70 ++++++++++++++-------------- rsqueakvm/plugins/ruby/switching.py | 34 ++++++++++++++ 4 files changed, 104 insertions(+), 39 deletions(-) create mode 100644 rsqueakvm/plugins/ruby/switching.py diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index bf1de65c..58a61344 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -6,8 +6,11 @@ from pypy.interpreter.pycode import PyCode, default_magic from pypy.interpreter.pyopcode import SApplicationException +from pypy.interpreter.typedef import interp_attrproperty +from pypy.interpreter.pycompiler import PythonAstCompiler from pypy.module.pypyjit.interp_jit import PyFrame, PyPyJitDriver from pypy.objspace.std import StdObjSpace as PyStdObjSpace +from pypy.objspace.std.typeobject import TypeCache from pypy.tool.stdlib_opcode import bytecode_spec from rpython.rlib.rarithmetic import intmask @@ -19,6 +22,8 @@ old_handle_operation_error = PyFrame.handle_operation_error old_init_pycode = PyCode.__init__ old_getexecutioncontext = PyStdObjSpace.getexecutioncontext +old_compile = PythonAstCompiler.compile +old_compile_ast = PythonAstCompiler.compile_ast ATTRIBUTE_ERROR_FORBIDDEN_NAMES = ['getattr'] STOP_ITERATION_FORBIDDEN_NAMES = ['next'] @@ -56,7 +61,7 @@ def block_handles_exception(self, block, operr_type): if prev_opcode == opcodedesc.JUMP_FORWARD.index: return True elif current_opcode != opcodedesc.DUP_TOP.index: - print "Unknown case; expected DUP_TOP" + print "Unknown case; expected DUP_TOP, got: %s" % current_opcode return True # unknown, so assume it handles exception next_opcode_idx = block.handlerposition + 1 next_opcode = ord(self.pycode.co_code[next_opcode_idx]) @@ -131,6 +136,7 @@ def __init__pycode(self, space, argcount, nlocals, stacksize, flags, name, firstlineno, lnotab, freevars, cellvars, hidden_applevel=False, magic=default_magic): self._co_names = names + self.co_source = None old_init_pycode(self, space, argcount, nlocals, stacksize, flags, code, consts, names, varnames, filename, name, firstlineno, lnotab, freevars, cellvars, @@ -144,6 +150,20 @@ def new_getexecutioncontext(self): return old_getexecutioncontext(self) +def annotate_pycode(w_code, source): + if not isinstance(w_code, PyCode): + return + w_code.co_source = source + for const_w in w_code.co_consts_w: + annotate_pycode(const_w, source) + + +def new_compile(self, source, filename, mode, flags, hidden_applevel=False): + w_code = old_compile(self, source, filename, mode, flags, hidden_applevel) + annotate_pycode(w_code, source) + return w_code + + def patch_pypy(): # Patch-out virtualizables from PyPy so that translation works try: @@ -153,6 +173,9 @@ def patch_pypy(): except AttributeError: pass + PyStdObjSpace.current_python_process = QuasiConstant(None, W_PythonProcess) + PyStdObjSpace.getexecutioncontext = new_getexecutioncontext + PyFrame.__init__ = __init__frame PyFrame.execute_frame = new_execute_frame PyFrame.block_handles_exception = block_handles_exception @@ -160,7 +183,11 @@ def patch_pypy(): PyFrame.handle_operation_error = new_handle_operation_error PyCode.__init__ = __init__pycode - PyCode._immutable_fields_.append('_co_names[*]') + PyCode._immutable_fields_.extend(['_co_names[*]', 'co_source']) - PyStdObjSpace.current_python_process = QuasiConstant(None, W_PythonProcess) - PyStdObjSpace.getexecutioncontext = new_getexecutioncontext + # Add app-level `co_source` to PyCode (this is hacky) + w_code_type = py_space.fromcache(TypeCache).getorbuild(PyCode.typedef) + w_code_type.dict_w['co_source'] = interp_attrproperty( + 'co_source', cls=PyCode, wrapfn="newtext_or_none") + + PythonAstCompiler.compile = new_compile diff --git a/rsqueakvm/plugins/ruby/frame.py b/rsqueakvm/plugins/ruby/frame.py index cd703adf..be02198d 100644 --- a/rsqueakvm/plugins/ruby/frame.py +++ b/rsqueakvm/plugins/ruby/frame.py @@ -44,3 +44,7 @@ def method_get_lineno(self, space, prev_wr_frame=None): @classdef.method('get_code_name') def method_get_code_name(self, space): return space.newstr_fromstr(self.frame_object.get_code_name()) + + @classdef.method('get_code_source') + def method_get_code_source(self, space): + return space.newstr_fromstr(self.frame_object.get_code_source()) diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py index 6443ab7a..6292aeb8 100644 --- a/rsqueakvm/plugins/ruby/patching.py +++ b/rsqueakvm/plugins/ruby/patching.py @@ -1,10 +1,13 @@ from rsqueakvm.plugins.ruby.model import W_RubyObject from rsqueakvm.plugins.ruby.process import W_RubyProcess +from rsqueakvm.plugins.ruby.switching import ( + interrupt_counter, switch_to_smalltalk) from rsqueakvm.util.cells import QuasiConstant -from topaz.frame import Frame as TopazFrame +from topaz import frame as topaz_frame from topaz.interpreter import ( ApplicationException, Interpreter as TopazInterpreter) +from topaz.objects.codeobject import W_CodeObject from topaz.objspace import ObjectSpace as TopazObjectSpace from rpython.rlib import jit @@ -12,43 +15,20 @@ old_handle_bytecode = TopazInterpreter.handle_bytecode old_handle_ruby_error = TopazInterpreter.handle_ruby_error old_jump = TopazInterpreter.jump +old_compile = TopazObjectSpace.compile old_getexecutioncontext = TopazObjectSpace.getexecutioncontext -class InterruptCounter: - counter_size = 10000 +def base_frame_get_code_source(self): + raise NotImplementedError - def __init__(self): - self.reset() - def reset(self): - self._counter = self.counter_size +def frame_get_code_source(self): + return self.bytecode.source - def triggers(self, decr_by=1): - self._counter -= decr_by - if self._counter <= 0: - self._counter = self.counter_size - return True - return False - -interrupt_counter = InterruptCounter() - - -def switch_to_smalltalk(ruby_process): - # import pdb; pdb.set_trace() - if ruby_process is None: - return - runner = ruby_process.runner() - if runner is None: - return - - # print 'Ruby yield' - runner.return_to_smalltalk() - # print 'Ruby continue' - - # error has been in Smalltalk land, clear it now to allow resuming - ruby_process.reset_error() +def builtin_frame_get_code_source(self): + return self.name def block_handles_exception(self, block, error_type): @@ -60,7 +40,7 @@ def has_exception_handler(self, error): "Returns True if this frame or one of its parents are able to handle operr" frame = self while frame is not None: - if isinstance(frame, TopazFrame): # skip BaseFrames + if isinstance(frame, topaz_frame.Frame): # skip BaseFrames block = frame.lastblock while block is not None: # block needs to be an ExceptBlock and able to handle operr @@ -97,6 +77,20 @@ def new_jump(self, space, bytecode, frame, cur_pc, target_pc): return old_jump(self, space, bytecode, frame, cur_pc, target_pc) +def annotate_code_object(w_code, source): + if not isinstance(w_code, W_CodeObject): + return + w_code.source = source + for const_w in w_code.consts_w: + annotate_code_object(const_w, source) + + +def new_compile(self, source, filepath, initial_lineno=1, symtable=None): + bc = old_compile(self, source, filepath, initial_lineno, symtable) + annotate_code_object(bc, source) + return bc + + def new_getexecutioncontext(self): current_ruby_process = self.current_ruby_process.get() if current_ruby_process is not None: @@ -107,16 +101,22 @@ def new_getexecutioncontext(self): def patch_topaz(): # Patch-out virtualizables from Topaz so that translation works try: - delattr(TopazFrame, "_virtualizable_") + delattr(topaz_frame.Frame, "_virtualizable_") delattr(TopazInterpreter.jitdriver, "virtualizables") except AttributeError: pass # this is fine - TopazFrame.has_exception_handler = has_exception_handler - TopazFrame.block_handles_exception = block_handles_exception + W_CodeObject._immutable_fields_.append('source') + topaz_frame.BaseFrame.get_code_source = base_frame_get_code_source + topaz_frame.Frame.get_code_source = frame_get_code_source + topaz_frame.BuiltinFrame.get_code_source = builtin_frame_get_code_source + + topaz_frame.Frame.has_exception_handler = has_exception_handler + topaz_frame.Frame.block_handles_exception = block_handles_exception TopazInterpreter.handle_bytecode = new_handle_bytecode TopazInterpreter.handle_ruby_error = new_handle_ruby_error TopazInterpreter.jump = new_jump + TopazObjectSpace.compile = new_compile TopazObjectSpace.current_ruby_process = QuasiConstant(None, W_RubyProcess) TopazObjectSpace.getexecutioncontext = new_getexecutioncontext diff --git a/rsqueakvm/plugins/ruby/switching.py b/rsqueakvm/plugins/ruby/switching.py new file mode 100644 index 00000000..881666b2 --- /dev/null +++ b/rsqueakvm/plugins/ruby/switching.py @@ -0,0 +1,34 @@ +class InterruptCounter: + counter_size = 10000 + + def __init__(self): + self.reset() + + def reset(self): + self._counter = self.counter_size + + def triggers(self, decr_by=1): + self._counter -= decr_by + if self._counter <= 0: + self._counter = self.counter_size + return True + return False + + +interrupt_counter = InterruptCounter() + + +def switch_to_smalltalk(ruby_process): + # import pdb; pdb.set_trace() + if ruby_process is None: + return + runner = ruby_process.runner() + if runner is None: + return + + # print 'Ruby yield' + runner.return_to_smalltalk() + # print 'Ruby continue' + + # error has been in Smalltalk land, clear it now to allow resuming + ruby_process.reset_error() From 3ecb269e92213cdd7712c3d4fa890e39401c0109 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 30 Mar 2017 17:10:24 +0200 Subject: [PATCH 151/193] Fix tuple unwrapping and add exception unwrapping --- rsqueakvm/plugins/python/utils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index b061e4c0..66014b75 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -11,11 +11,14 @@ from pypy.interpreter.module import Module from pypy.interpreter.pycode import PyCode from pypy.module.__builtin__ import compiling as py_compiling +from pypy.module.exceptions.interp_exceptions import ( + W_BaseException as WP_BaseException) from pypy.objspace.std.bytesobject import W_BytesObject as WP_BytesObject from pypy.objspace.std.floatobject import W_FloatObject as WP_FloatObject from pypy.objspace.std.intobject import W_IntObject as WP_IntObject from pypy.objspace.std.listobject import W_ListObject as WP_ListObject -from pypy.objspace.std.tupleobject import W_TupleObject as WP_TupleObject +from pypy.objspace.std.tupleobject import ( + W_AbstractTupleObject as WP_AbstractTupleObject) from pypy.objspace.std.unicodeobject import W_UnicodeObject as WP_UnicodeObject from rpython.rlib import objectmodel @@ -60,7 +63,7 @@ def python_to_smalltalk(space, wp_object): elif isinstance(wp_object, WP_ListObject): return space.wrap_list( [python_to_smalltalk(space, x) for x in wp_object.getitems()]) - elif isinstance(wp_object, WP_TupleObject): + elif isinstance(wp_object, WP_AbstractTupleObject): return space.wrap_list( [python_to_smalltalk(space, x) for x in wp_object.tolist()]) elif wp_object is None or wp_object is py_space.w_None: @@ -72,6 +75,10 @@ def python_to_smalltalk(space, wp_object): elif wp_object is py_space.w_True: return space.w_true return space.wrap_int(py_space.int_w(wp_object)) + elif isinstance(wp_object, WP_BaseException): + w_name = space.wrap_string(py_space.type(wp_object).getname(py_space)) + w_error_str = python_to_smalltalk(space, wp_object.descr_str(py_space)) + return space.wrap_list([w_name, w_error_str]) print 'Cannot convert %s to Smalltalk' % wp_object raise PrimitiveFailedError From d8d47e839e8eb83f528f10f645aa2d234b0d2153 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 30 Mar 2017 17:12:30 +0200 Subject: [PATCH 152/193] Adjust send, so that only __call__ can call a func Also, clean up Python/Ruby model --- rsqueakvm/plugins/python/__init__.py | 37 +++++++++----------------- rsqueakvm/plugins/python/model.py | 39 +++++++--------------------- rsqueakvm/plugins/ruby/model.py | 5 ++-- 3 files changed, 24 insertions(+), 57 deletions(-) diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index c3c62757..f58b7cbb 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -15,8 +15,6 @@ from pypy.interpreter.argument import Arguments from pypy.interpreter.error import OperationError - from pypy.interpreter.function import ( - Function, Method, StaticMethod, ClassMethod) IMPORT_FAILED = False except ImportError: @@ -87,38 +85,27 @@ def perform_send(space, w_rcvr, attrname, args_w): idx = attrname.find(':') if idx > 0: attrname = attrname[0:idx] - wp_result = None + wp_attrname = py_space.newtext(attrname) + # import pdb; pdb.set_trace() try: - py_attr = py_space.getattr(wp_rcvr, py_space.newtext(attrname)) - if (isinstance(py_attr, Function) or - isinstance(py_attr, Method) or - isinstance(py_attr, StaticMethod) or - isinstance(py_attr, ClassMethod)): + if attrname == '__call__': # special __call__ case + w_meth = py_space.getattr(wp_rcvr, wp_attrname) args_wp = [utils.smalltalk_to_python(space, a) for a in args_w] # use call_args() to allow variable number of args_w # (but this disables speed hacks in Pypy) - w_meth = py_space.getattr(wp_rcvr, py_space.newtext(attrname)) args = Arguments(py_space, args_wp) - wp_result = py_space.call_args(w_meth, args) - else: - if len(args_w) == 1: - wp_value = utils.smalltalk_to_python(space, args_w[0]) - py_space.setattr(wp_rcvr, py_space.newtext(attrname), - wp_value) - wp_result = py_space.w_None - else: - wp_result = py_attr + return W_PythonObject(py_space.call_args(w_meth, args)) + elif len(args_w) == 1: # setattr when one argument + wp_value = utils.smalltalk_to_python(space, args_w[0]) + py_space.setattr(wp_rcvr, wp_attrname, wp_value) + return W_PythonObject(py_space.w_None) + else: # otherwise getattr + return W_PythonObject(py_space.getattr(wp_rcvr, wp_attrname)) except OperationError as operr: return utils.operr_to_w_object(operr) except Exception as e: print 'Unable to call %s on %s: %s' % (attrname, wp_rcvr, e) - raise PrimitiveFailedError - if wp_result is None: - # import pdb; pdb.set_trace() - print ('No result in send primitive (wp_rcvr: %s, attrname: %s)' - % (wp_rcvr, attrname)) - raise PrimitiveFailedError - return W_PythonObject(wp_result) + raise PrimitiveFailedError @staticmethod def to_w_object(space, foreign_object): diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 97aaaba7..df3c9d84 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -6,14 +6,13 @@ class W_PythonObject(W_ForeignLanguageObject): - _attrs_ = ['wp_object', 's_class'] - _immutable_fields_ = ['wp_object', 's_class?'] + _attrs_ = ['wp_object'] + _immutable_fields_ = ['wp_object'] repr_classname = 'W_PythonObject' def __init__(self, wp_object): W_ForeignLanguageObject.__init__(self) self.wp_object = wp_object - self.s_class = None def getclass(self, space): return W_PythonObject(self.wp_object.getclass(py_space)) @@ -31,11 +30,10 @@ def make_class_shadow(self, space): class PythonClassShadow(ForeignLanguageClassShadow): - _attrs_ = ['wp_object', 'wp_class'] - _immutable_fields_ = ['wp_class'] + _attrs_ = ['wp_object'] + _immutable_fields_ = [] def __init__(self, space, wp_class, wp_object): - self.wp_class = wp_class self.wp_object = wp_object self.name = wp_class.name ForeignLanguageClassShadow.__init__(self, space) @@ -46,29 +44,12 @@ def method_exists(self, w_selector): idx = methodname.find(':') if idx > 0: methodname = methodname[0:idx] - py_attr = None + wp_methodname = py_space.newtext(methodname) try: - if py_attr is None: - # check instance vars and methods - py_attr = py_space.getattr(self.wp_object, - py_space.newtext(methodname)) - if py_attr is None: - # check class vars and methods - py_attr = py_space.getattr(self.wp_class, - py_space.newtext(methodname)) - except OperationError: - pass + if py_space.getattr(self.wp_object, wp_methodname) is not None: + return True + except OperationError as operror: + print operror.errorstr(py_space) except Exception as e: print 'Unable to create method %s: %s' % (methodname, e) - return False - if py_attr is None: - # check builtins - if self.wp_class is py_space.type(py_space.builtin): - try: - if py_space.builtin.get(methodname) is None: - return False - except OperationError: - return False - else: - return False - return True + return False diff --git a/rsqueakvm/plugins/ruby/model.py b/rsqueakvm/plugins/ruby/model.py index 61f6bf46..4315a5af 100644 --- a/rsqueakvm/plugins/ruby/model.py +++ b/rsqueakvm/plugins/ruby/model.py @@ -4,14 +4,13 @@ class W_RubyObject(W_ForeignLanguageObject): - _attrs_ = ['wr_object', 's_class'] - _immutable_fields_ = ['wr_object', 's_class?'] + _attrs_ = ['wr_object'] + _immutable_fields_ = ['wr_object'] repr_classname = 'W_RubyObject' def __init__(self, wr_object): W_ForeignLanguageObject.__init__(self) self.wr_object = wr_object - self.s_class = None def getclass(self, space): return W_RubyObject(self.wr_object.getclass(ruby_space)) From 8f18c40a8748912d3eb09c0b91ec38069f1883db Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 30 Mar 2017 22:48:10 +0200 Subject: [PATCH 153/193] Make process switching more bullet proof Avoid that a Python send attempts to return_to_smalltalk which is impossible, because the send happens in the main thread. There still are a few problems with setting the language process on the space, but checks ensure that the VM does not segfault for now. --- rsqueakvm/plugins/foreign_language/process.py | 9 +- rsqueakvm/plugins/foreign_language/runner.py | 97 +++++++++++-------- rsqueakvm/plugins/python/patching.py | 6 +- rsqueakvm/plugins/python/process.py | 9 +- rsqueakvm/plugins/python/switching.py | 5 + rsqueakvm/plugins/ruby/process.py | 6 +- .../plugins/python/test_pyframe_exceptions.py | 8 +- 7 files changed, 87 insertions(+), 53 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index c6400192..d502dc2a 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -89,8 +89,11 @@ def getclass(self, space): def run(self): raise NotImplementedError - def set_current(self): - raise NotImplementedError + def pre_resume(self): # called on every switch to language process + pass + + def post_resume(self): # called as soon as Smalltalk continues + pass def w_top_frame(self): raise NotImplementedError @@ -149,6 +152,8 @@ def break_on_exceptions(self): def switch_to_smalltalk(self, interp, s_frame, first_call=False): from rsqueakvm.storage_contexts import ContextPartShadow + self.post_resume() + # print 'Switch to Smalltalk' if self.is_done(): return self._create_return_frame(interp.space) diff --git a/rsqueakvm/plugins/foreign_language/runner.py b/rsqueakvm/plugins/foreign_language/runner.py index 6673d109..91fb9d30 100644 --- a/rsqueakvm/plugins/foreign_language/runner.py +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -3,76 +3,90 @@ class AbstractLanguageRunner(): - def __init__(self, language): - self._language = language + def __init__(self, language_process): + self._language_process = language_process - def language(self): - return self._language + def language_process(self): + return self._language_process def start(self): - self.language().set_current() + self.language_process().pre_resume() self.start_thread() - def start_thread(self): - raise NotImplementedError - def resume(self): - self.language().set_current() + self.language_process().pre_resume() self.resume_thread() + def return_to_smalltalk(self): + self.yield_thread() + + def start_thread(self): + raise NotImplementedError + def resume_thread(self): raise NotImplementedError - def return_to_smalltalk(self): + def resumable(self): + raise NotImplementedError + + def yield_thread(self): raise NotImplementedError class StackletLanguageRunner(AbstractLanguageRunner): sthread = None - def __init__(self, language): - AbstractLanguageRunner.__init__(self, language) - self.sthread = self.ensure_sthread() - self.language_handle = self.sthread.get_null_handle() - self.smalltalk_handle = self.sthread.get_null_handle() - - def ensure_sthread(self): - if self.sthread is None: - self.sthread = rstacklet.StackletThread() - return self.sthread + def __init__(self, language_process): + AbstractLanguageRunner.__init__(self, language_process) + self.sthread = rstacklet.StackletThread() + # there can only be one valid handle at a time (main or foreign thread) + self.handle = self.sthread.get_null_handle() def start_thread(self): global_execution_state.origin = self - self.language_handle = self.sthread.new( - self.__class__.new_stacklet_callback) + self.handle = self.sthread.new(self.__class__.new_stacklet_callback) def resume_thread(self): - if not self._is_valid_handle(self.language_handle): - print 'language_handle not valid' - return - self.language_handle = self.sthread.switch(self.language_handle) + self.switch_to_handle() - def return_to_smalltalk(self): - if not self._is_valid_handle(self.smalltalk_handle): - print 'smalltalk_handle not valid' - return - self.smalltalk_handle = self.sthread.switch(self.smalltalk_handle) + def resumable(self): + return self._has_valid_handle() + + def yield_thread(self): + self.switch_to_handle() - def _is_valid_handle(self, h): - if (h is None or self.sthread.is_empty_handle(h) or - h == self.sthread.get_null_handle()): + def switch_to_handle(self): + if not self._has_valid_handle(): + print 'handle not valid: %s' % self.handle + return + self.handle = self.sthread.switch(self.handle) + if self.handle is self.sthread.get_null_handle(): + print 'language_process thread has finished1' + if self.sthread.is_empty_handle(self.handle): + print 'language_process thread has finished2' + + def _has_valid_handle(self): + # TODO: make less verbose when this proved to work + if not bool(self.handle): + print 'handle evaluates to False: %s' % self.handle + return False + if self.sthread.is_empty_handle(self.handle): + print 'handle is empty: %s' % self.handle + return False + if self.handle is self.sthread.get_null_handle(): + print 'handle is null handle: %s' % self.handle return False return True @staticmethod def new_stacklet_callback(h, arg): - print 'new_stacklet_callback:', h, arg + print 'new_stacklet_callback:', h self = global_execution_state.origin - self.smalltalk_handle = h + self.handle = h global_execution_state.clear() - self.language().run_safe() + self.language_process().run_safe() global_execution_state.origin = self - return self.smalltalk_handle # return to Smalltalk when done + return self.handle # return to Smalltalk when done class GreenletLanguageRunner(AbstractLanguageRunner): @@ -85,14 +99,17 @@ def start_thread(self): def resume_thread(self): self.greenlet.switch() - def return_to_smalltalk(self): + def resumable(self): + return not self.greenlet.dead + + def yield_thread(self): self.greenlet.parent.switch() @staticmethod def new_greenlet_callback(): print 'new_greenlet_callback' self = global_execution_state.origin - return self.language().run_safe + return self.language_process().run_safe class GlobalState: diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index 58a61344..ea4c221d 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -121,11 +121,11 @@ def new_handle_operation_error(self, ec, operr, attach_tb=True): if isinstance(operr, RestartException): print 'Re-raising RestartException' raise operr - language = self.space.current_python_process.get() - if (language is not None and language.break_on_exceptions() and + python_process = self.space.current_python_process.get() + if (python_process is not None and python_process.break_on_exceptions() and not self.has_exception_handler(operr)): # import pdb; pdb.set_trace() - language.set_error(operr_to_w_object(operr)) + python_process.set_error(operr_to_w_object(operr)) print 'Python error caught' switch_action.perform(ec, self) return old_handle_operation_error(self, ec, operr, attach_tb) diff --git a/rsqueakvm/plugins/python/process.py b/rsqueakvm/plugins/python/process.py index 25a538c8..df26b883 100644 --- a/rsqueakvm/plugins/python/process.py +++ b/rsqueakvm/plugins/python/process.py @@ -20,9 +20,6 @@ def __init__(self, source, filename, cmd, break_on_exceptions=True): def run(self): print 'Python start' try: - # switch back to Squeak before executing Python code - self.runner().return_to_smalltalk() - retval = _run_eval_string(self.source, self.filename, self.cmd) self.set_result(W_PythonObject(retval)) except OperationError as operr: @@ -30,9 +27,13 @@ def run(self): # save Python error as result instead. self.set_result(operr_to_w_object(operr)) - def set_current(self): + def pre_resume(self): py_space.current_python_process.set(self) + def post_resume(self): + # unset `current_python_process` to restore original behavior + py_space.current_python_process.set(None) + def w_top_frame(self): if self.ec is None: return None diff --git a/rsqueakvm/plugins/python/switching.py b/rsqueakvm/plugins/python/switching.py index 4a8e6141..70eaf51f 100644 --- a/rsqueakvm/plugins/python/switching.py +++ b/rsqueakvm/plugins/python/switching.py @@ -13,9 +13,14 @@ def perform(self, ec, frame): # import pdb; pdb.set_trace() process = self.space.current_python_process.get() if process is None: + print 'no language process' return runner = process.runner() if runner is None: + print 'no runner' + return + if not runner.resumable(): + print 'not resumable' return # print 'Python yield' diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index d8e31aae..51164dea 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -25,9 +25,13 @@ def run(self): except RubyError as e: self.set_result(W_RubyObject(e.w_value)) - def set_current(self): + def pre_resume(self): ruby_space.current_ruby_process.set(self) + def post_resume(self): + # unset `current_ruby_process` to restore original behavior + ruby_space.current_ruby_process.set(None) + def w_top_frame(self): if self.ec is None: return None diff --git a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py index 3bc3451f..0137d150 100644 --- a/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -20,9 +20,11 @@ def has_exception_handler(code): def no_error_caught(code, cmd): pycode = compilecode(py_space, code, '', cmd) py_frame = py_space.FrameClass(py_space, pycode, py_space.newdict(), None) - py_frame.run() - process = py_space.current_python_process.get() - return process is not None and process.get_error() is None + try: + py_frame.run() + return True + except: + return False def test_simple_exception(): From ad1e2a8a2909657313dd0dc4db10fe900eefcdba Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 30 Mar 2017 23:17:44 +0200 Subject: [PATCH 154/193] Implement guess_classname and str_content --- rsqueakvm/plugins/foreign_language/model.py | 4 ++-- rsqueakvm/plugins/python/model.py | 16 ++++++++++------ rsqueakvm/plugins/ruby/model.py | 10 ++++++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py index d8a88293..b8d9821f 100644 --- a/rsqueakvm/plugins/foreign_language/model.py +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -18,7 +18,7 @@ def __new__(cls, name, bases, attrs): @jit.elidable def pure_class_shadow(self, space): - wf_class = self.getforeignclass(space) + wf_class = self.getforeignclass() shadow = self.make_class_shadow(space) return class_shadow_cache.setdefault(wf_class, shadow) @@ -53,7 +53,7 @@ def store(self, space, n0, w_value): def getclass(self, space): raise NotImplementedError - def getforeignclass(self, space): + def getforeignclass(self): raise NotImplementedError def class_shadow(self, space): diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index df3c9d84..3a1771dd 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -17,25 +17,29 @@ def __init__(self, wp_object): def getclass(self, space): return W_PythonObject(self.wp_object.getclass(py_space)) - def getforeignclass(self, space): + def getforeignclass(self): return py_space.type(self.wp_object) + def guess_classname(self): + return self.getforeignclass().getname(py_space) + + def str_content(self): + return str(self.wp_object) + def is_same_object(self, other): return (isinstance(other, W_PythonObject) and other.wp_object is self.wp_object) def make_class_shadow(self, space): - return PythonClassShadow( - space, self.getforeignclass(space), self.wp_object) + return PythonClassShadow(space, self.wp_object) class PythonClassShadow(ForeignLanguageClassShadow): _attrs_ = ['wp_object'] - _immutable_fields_ = [] + _immutable_fields_ = ['wp_object'] - def __init__(self, space, wp_class, wp_object): + def __init__(self, space, wp_object): self.wp_object = wp_object - self.name = wp_class.name ForeignLanguageClassShadow.__init__(self, space) def method_exists(self, w_selector): diff --git a/rsqueakvm/plugins/ruby/model.py b/rsqueakvm/plugins/ruby/model.py index 4315a5af..ccea9724 100644 --- a/rsqueakvm/plugins/ruby/model.py +++ b/rsqueakvm/plugins/ruby/model.py @@ -15,15 +15,21 @@ def __init__(self, wr_object): def getclass(self, space): return W_RubyObject(self.wr_object.getclass(ruby_space)) - def getforeignclass(self, space): + def getforeignclass(self): return ruby_space.getclass(self.wr_object) + def guess_classname(self): + return self.getforeignclass().name + + def str_content(self): + return ruby_space.str_w(ruby_space.send(self.wr_object, 'inspect')) + def is_same_object(self, other): return (isinstance(other, W_RubyObject) and other.wr_object is self.wr_object) def make_class_shadow(self, space): - return RubyClassShadow(space, self.getforeignclass(space)) + return RubyClassShadow(space, self.getforeignclass()) class RubyClassShadow(ForeignLanguageClassShadow): From e677816e8d419b238351d97cd6d5e70af42dff88 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 31 Mar 2017 00:39:39 +0200 Subject: [PATCH 155/193] Update in-image code [ci skip] --- .../class/getContentsOf..st | 1 - .../methodProperties.json | 2 +- .../instance/defaultLabelForInspector.st | 2 +- .../instance/defaultTitleForInspector.st | 3 -- .../instance/instVarNames.st | 3 ++ .../methodProperties.json | 4 +-- .../monticello.meta/version | 2 +- .../class/highlightPython..st | 7 ++--- .../class/highlightRuby..st | 9 +++--- .../class/highlightSmalltalk..st | 6 ---- .../methodProperties.json | 5 ++-- .../class/interrupt.label..st | 9 ++---- .../methodProperties.json | 2 +- .../monticello.meta/version | 2 +- .../instance/breakOnExceptions.st | 2 +- .../instance/labelString.st | 12 ++++---- .../methodProperties.json | 4 +-- .../monticello.meta/version | 2 +- .../Python.class/class/evaluateExpression..st | 3 +- .../evaluateExpression.breakOnExceptions..st | 2 +- .../class/evaluateExpression.in.to..st | 19 ++++-------- .../Python.class/class/getSignature..st | 5 +++- .../Python.class/class/getSource..st | 5 ++-- .../Python.class/class/isExpression..st | 3 +- .../Python.class/class/peval..st | 7 ----- .../class/peval.breakOnExceptions..st | 7 ----- .../Python.class/class/pexec..st | 7 ----- .../class/pexec.breakOnExceptions..st | 7 ----- .../Python.class/class/prun..st | 5 ---- .../class/prun.breakOnExceptions..st | 5 ---- .../Python.class/class/pyLexerRuby.st | 3 ++ .../Python.class/class/pygments.st | 3 -- .../Python.class/class/pygmentsHighlight.st | 3 ++ .../class/run.breakOnExceptions..st | 5 ++++ .../Python.class/class/setUpPygments.st | 10 ++----- .../class/setUpPythonEnvironment.st | 2 +- .../Python.class/class/tempNamesIn..st | 2 +- .../Python.class/class/tempVariableAt.in..st | 2 +- .../Python.class/methodProperties.json | 30 ++++++++----------- ...evaluate.in.to.notifying.ifFail.logged..st | 19 ++++-------- .../methodProperties.json | 2 +- .../PythonExamples.class/class/average..st | 2 +- .../PythonExamples.class/class/average.st | 2 +- .../PythonExamples.class/class/fibonacci..st | 2 +- .../PythonExamples.class/class/fibonacci9.st | 2 +- .../PythonExamples.class/class/miniexample.st | 2 +- .../methodProperties.json | 10 +++---- .../PythonObject.class/class/nextID.st | 6 ---- .../PythonObject.class/class/withAll2..st | 8 ----- .../PythonObject.class/class/withAll3..st | 6 ---- .../instance/allAttributes.st | 2 +- .../instance/allInstVarNames.st | 2 +- .../PythonObject.class/instance/at..st | 2 +- .../PythonObject.class/instance/at.put..st | 2 +- .../PythonObject.class/instance/class.st | 2 +- ...spector.st => defaultLabelForInspector.st} | 2 +- .../instance/explorerContents.st | 2 +- .../instance/hasAttribute..st | 2 +- .../instance/hasContentsInExplorer.st | 1 - .../instance/instVarNamed..st | 2 +- .../PythonObject.class/instance/isClass.st | 2 +- .../PythonObject.class/instance/printOn..st | 2 +- .../PythonObject.class/instance/pyDictKeys.st | 4 --- .../instance/pyDictValues.st | 4 --- .../instance/pyIdentifier.st | 5 ---- .../PythonObject.class/methodProperties.json | 30 ++++++++----------- .../monticello.meta/version | 2 +- .../class/eval.breakOnExceptions..st | 3 ++ .../Ruby.class/class/eval.filePath..st | 2 +- .../class/eval.filePath.breakOnExceptions..st | 3 ++ .../Ruby.class/class/evaluateExpression..st | 2 +- .../evaluateExpression.breakOnExceptions..st | 2 +- .../Ruby.class/class/getSource..st | 5 ++-- .../Ruby.class/class/peval..st | 3 -- .../class/peval.breakOnExceptions..st | 3 -- .../Ruby.class/methodProperties.json | 12 ++++---- ...spector.st => defaultLabelForInspector.st} | 2 +- .../RubyObject.class/instance/printOn..st | 2 +- .../RubyObject.class/methodProperties.json | 4 +-- .../Ruby-Core.package/monticello.meta/version | 2 +- 80 files changed, 140 insertions(+), 246 deletions(-) delete mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultTitleForInspector.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarNames.st delete mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightSmalltalk..st delete mode 100644 repository/Python-Core.package/Python.class/class/peval..st delete mode 100644 repository/Python-Core.package/Python.class/class/peval.breakOnExceptions..st delete mode 100644 repository/Python-Core.package/Python.class/class/pexec..st delete mode 100644 repository/Python-Core.package/Python.class/class/pexec.breakOnExceptions..st delete mode 100644 repository/Python-Core.package/Python.class/class/prun..st delete mode 100644 repository/Python-Core.package/Python.class/class/prun.breakOnExceptions..st create mode 100644 repository/Python-Core.package/Python.class/class/pyLexerRuby.st delete mode 100644 repository/Python-Core.package/Python.class/class/pygments.st create mode 100644 repository/Python-Core.package/Python.class/class/pygmentsHighlight.st create mode 100644 repository/Python-Core.package/Python.class/class/run.breakOnExceptions..st delete mode 100644 repository/Python-Core.package/PythonObject.class/class/nextID.st delete mode 100644 repository/Python-Core.package/PythonObject.class/class/withAll2..st delete mode 100644 repository/Python-Core.package/PythonObject.class/class/withAll3..st rename repository/Python-Core.package/PythonObject.class/instance/{defaultTitleForInspector.st => defaultLabelForInspector.st} (78%) delete mode 100644 repository/Python-Core.package/PythonObject.class/instance/pyDictKeys.st delete mode 100644 repository/Python-Core.package/PythonObject.class/instance/pyDictValues.st delete mode 100644 repository/Python-Core.package/PythonObject.class/instance/pyIdentifier.st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/eval.breakOnExceptions..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/eval.filePath.breakOnExceptions..st delete mode 100644 repository/Ruby-Core.package/Ruby.class/class/peval..st delete mode 100644 repository/Ruby-Core.package/Ruby.class/class/peval.breakOnExceptions..st rename repository/Ruby-Core.package/RubyObject.class/instance/{defaultTitleForInspector.st => defaultLabelForInspector.st} (68%) diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st index 5bcc285c..e7b31be9 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st @@ -1,7 +1,6 @@ helpers getContentsOf: aFileName | stream data | - (FileStream isAFileNamed: aFileName) ifFalse: [ ^ 'File does not exist' ]. stream := StandardFileStream oldFileNamed: aFileName. stream := MultiByteFileStream newFrom: stream. data := stream contents. diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json index fd7b2059..9d9f7638 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json @@ -7,7 +7,7 @@ "evaluateExpression:in:to:" : "fn 3/21/2017 11:32", "fileExtension" : "fn 3/17/2017 10:20", "findResumeFrame:" : "fn 3/16/2017 16:03", - "getContentsOf:" : "fn 3/17/2017 10:48", + "getContentsOf:" : "fn 3/27/2017 21:54", "getForeignFrames:" : "fn 3/16/2017 21:26", "getSource:" : "fn 3/16/2017 21:57", "highlight:" : "fn 3/14/2017 11:27", diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st index ae3766f9..9422159c 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st @@ -1,3 +1,3 @@ overrides defaultLabelForInspector - ^ self languageSymbol asString, ' ', self defaultTitleForInspector \ No newline at end of file + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultTitleForInspector.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultTitleForInspector.st deleted file mode 100644 index 60f608e1..00000000 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultTitleForInspector.st +++ /dev/null @@ -1,3 +0,0 @@ -overrides -defaultTitleForInspector - self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarNames.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarNames.st new file mode 100644 index 00000000..edaf02af --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/instVarNames.st @@ -0,0 +1,3 @@ +overrides +instVarNames + ^ self allInstVarNames \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json index b4c203e7..6927783e 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json @@ -6,14 +6,14 @@ "asSmalltalk" : "fn 3/12/2017 19:22", "class" : "fn 3/12/2017 19:22", "className" : "fn 3/12/2017 19:22", - "defaultLabelForInspector" : "fn 3/14/2017 11:51", - "defaultTitleForInspector" : "fn 3/14/2017 11:52", + "defaultLabelForInspector" : "fn 3/28/2017 15:00", "environment" : "fn 3/12/2017 19:21", "explore" : "fn 3/13/2017 17:38", "inspect" : "fn 3/13/2017 17:38", "inspectorClass" : "fn 3/13/2017 17:33", "instVarAt:" : "fn 3/14/2017 12:06", "instVarNamed:" : "fn 3/14/2017 12:06", + "instVarNames" : "fn 3/30/2017 23:33", "isForeign" : "fn 3/12/2017 19:24", "languageSymbol" : "fn 3/13/2017 17:10", "printOn:" : "fn 3/12/2017 19:22" } } diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/version b/repository/ForeignLanguage-Core.package/monticello.meta/version index a3eb03d9..79bb1293 100644 --- a/repository/ForeignLanguage-Core.package/monticello.meta/version +++ b/repository/ForeignLanguage-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st index 14c2c26d..efb66509 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st @@ -1,7 +1,6 @@ as yet unclassified highlightPython: aText - ^ (Python eval: '_pygments_highlight("""', aText string, '""")') asSmalltalk asTextFromHtml - "^ (Python pygments - highlight: aText string + ^ (Python pygmentsHighlight + __call__: aText string lexer: Python pyLexerPython - formatter: Python pyFormatter) asSmalltalk asTextFromHtml" \ No newline at end of file + formatter: Python pyFormatter) asSmalltalk asTextFromHtml \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st index 0d67e565..457567f1 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st @@ -1,8 +1,7 @@ as yet unclassified highlightRuby: aText Python vmSpeaksLanguage ifFalse: [ ^ aText ]. - ^ (Python eval: '_pygments_highlight("""', aText string, '""", _pygments_lexer_ruby)') asSmalltalk asTextFromHtml - "^ (Python pygments - highlight: aText string - lexer: Python pyLexerPython - formatter: Python pyFormatter) asSmalltalk asTextFromHtml" \ No newline at end of file + ^ (Python pygmentsHighlight + __call__: aText string + lexer: Python pyLexerRuby + formatter: Python pyFormatter) asSmalltalk asTextFromHtml \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightSmalltalk..st b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightSmalltalk..st deleted file mode 100644 index a9a7e297..00000000 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightSmalltalk..st +++ /dev/null @@ -1,6 +0,0 @@ -as yet unclassified -highlightSmalltalk: aText - ^ (Python pygments - highlight: aText string - lexer: Python pyLexerSmalltalk - formatter: Python pyFormatter) asSmalltalk asTextFromHtml \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json index 52c06f44..18382ec0 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json @@ -1,8 +1,7 @@ { "class" : { - "highlightPython:" : "fn 3/13/2017 17:22", - "highlightRuby:" : "fn 3/14/2017 11:32", - "highlightSmalltalk:" : "fn 3/6/2017 19:14" }, + "highlightPython:" : "fn 3/30/2017 22:17", + "highlightRuby:" : "fn 3/30/2017 22:17" }, "instance" : { "isForeign" : "fn 3/14/2017 18:28", "languageClass" : "fn 3/16/2017 22:41", diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st index 9cbd238a..ed2bba92 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st @@ -1,8 +1,5 @@ debugging interrupt: aProcess label: aString - "Open a ForeignLanguage if none exists" - ActiveWorld submorphs detect: [ :ea | ea isSystemWindow and: [ ea model class == ForeignLanguage ]] - ifFound: [ super interrupt: aProcess label: aString ] - ifNone: [ ForeignLanguage - openInterrupt: aString - onProcess: aProcess ] \ No newline at end of file + ForeignLanguageDebugger + openInterrupt: aString + onProcess: aProcess \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json index 19915ddb..9dec930e 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json @@ -9,7 +9,7 @@ "explore:" : "fn 3/13/2017 17:41", "initialize" : "fn 1/16/2017 18:52", "inspectorClassOf:" : "fn 3/13/2017 18:36", - "interrupt:label:" : "fn 3/14/2017 01:31", + "interrupt:label:" : "fn 3/22/2017 22:07", "menuItems" : "fn 3/13/2017 17:56", "openClassBrowser" : "fn 3/14/2017 11:14", "openForeignLanguageBrowser" : "fn 3/13/2017 17:43", diff --git a/repository/ForeignLanguage-Support.package/monticello.meta/version b/repository/ForeignLanguage-Support.package/monticello.meta/version index 39bb6e69..1970cdf6 100644 --- a/repository/ForeignLanguage-Support.package/monticello.meta/version +++ b/repository/ForeignLanguage-Support.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Support-fn.4' message 'Update in-image code' id 'aac05489-0e6a-4f54-8ba1-7a72a08123d5' date '31 March 2017' time '12:38:59.949445 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st index c4b8ca22..51feff7d 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st @@ -1,3 +1,3 @@ accessing breakOnExceptions - ^ breakOnExceptions ifNil: [ breakOnExceptions := true ] \ No newline at end of file + ^ breakOnExceptions ifNil: [ breakOnExceptions := false ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st index 084e233f..3666d1b9 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st @@ -1,9 +1,7 @@ foreign-language-support labelString - | breakOnExceptionsText | - breakOnExceptionsText := self breakOnExceptions - ifTrue: [ 'break on exceptions' ] - ifFalse: [ 'no break on exceptions' ]. - ^ self languageSymbol asString, ' ', - self class windowTitlePrefix, ' (', breakOnExceptionsText, ')' - \ No newline at end of file + | title | + title := self languageSymbol asString, ' ', self class windowTitlePrefix. + ^ self breakOnExceptions + ifTrue: [ title, ' (break on exceptions)' ] + ifFalse: [ title ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json index 4b975d19..a01c1c4c 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json @@ -5,13 +5,13 @@ "instance" : { "aboutToStyle:" : "fn 3/13/2017 17:51", "addModelItemsToWindowMenu:" : "fn 3/21/2017 23:10", - "breakOnExceptions" : "fn 3/21/2017 23:07", + "breakOnExceptions" : "fn 3/23/2017 00:36", "breakOnExceptions:" : "fn 3/21/2017 23:06", "breakOnExceptionsText" : "fn 3/21/2017 23:11", "buildCodePaneWith:" : "fn 3/13/2017 17:51", "evaluateExpression:" : "fn 3/21/2017 23:16", "isForeign" : "fn 3/14/2017 18:32", - "labelString" : "fn 3/22/2017 09:51", + "labelString" : "fn 3/30/2017 23:24", "languageClass" : "fn 3/16/2017 22:40", "languageSymbol" : "fn 3/14/2017 01:00", "languageSymbol:" : "fn 3/13/2017 18:02", diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/version b/repository/ForeignLanguage-Tools.package/monticello.meta/version index 49ade0ba..883ba495 100644 --- a/repository/ForeignLanguage-Tools.package/monticello.meta/version +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Tools-fn.4' message 'Update in-image code' id 'b7af137b-818c-4196-9439-01a40952f2ba' date '31 March 2017' time '12:39:05.754067 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/evaluateExpression..st b/repository/Python-Core.package/Python.class/class/evaluateExpression..st index 81dc5a1d..7458bff5 100644 --- a/repository/Python-Core.package/Python.class/class/evaluateExpression..st +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression..st @@ -1,4 +1,3 @@ execution evaluateExpression: selection - ^ Python prun: selection asString - \ No newline at end of file + ^ Python run: selection asString \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st index 44811955..7606e85a 100644 --- a/repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st @@ -1,4 +1,4 @@ execution evaluateExpression: selection breakOnExceptions: aBool - ^ Python prun: selection asString breakOnExceptions: aBool + ^ Python run: selection asString breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st b/repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st index 93c1be75..5ce6eead 100644 --- a/repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st @@ -4,23 +4,16 @@ evaluateExpression: aSelection in: aContext to: receiver pyCode := aSelection asString. Python exec: 'rcvr_locals = dict()'. - (Python eval: 'rcvr_locals') setdefault: 'self' to: receiver. + (Python eval: 'rcvr_locals') setdefault __call__: 'self' to: receiver. (Python isExpression: pyCode) ifTrue: [ - ^ Python builtins - eval: pyCode + ^ Python builtins eval + __call__: pyCode globals: (Python eval: 'globals()') locals: (Python eval: 'rcvr_locals')] ifFalse: [ - ^ Python builtins - exec: pyCode + ^ Python builtins exec + __call__: pyCode globals: (Python eval: 'globals()') - locals: (Python eval: 'rcvr_locals')] - - "pyCode := pyCode copyReplaceAll: 'self.' with: ''. - method := (pyCode copyUpTo: $() asSymbol. - args := ((((pyCode copyAfter: $() copyUpTo: $)) - findTokens: {$,}) - collect: [ :ea | ea withBlanksTrimmed ]) asArray. - ^ receiver perform: method withArguments: args" \ No newline at end of file + locals: (Python eval: 'rcvr_locals')] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/getSignature..st b/repository/Python-Core.package/Python.class/class/getSignature..st index 87258f1c..ac97030b 100644 --- a/repository/Python-Core.package/Python.class/class/getSignature..st +++ b/repository/Python-Core.package/Python.class/class/getSignature..st @@ -2,6 +2,9 @@ debugging getSignature: pyCode | filename content | filename := pyCode co_filename asSmalltalk. - filename = '' ifTrue: [ ^ 'unknown' ]. + (FileStream isAFileNamed: filename) + ifFalse: [ ^ pyCode co_source asSmalltalk + ifNotNil: [ :s | s lines first ] + ifNil: [ 'unknown' ]]. content := self getContentsOf: pyCode co_filename asSmalltalk. ^ content lines at: pyCode co_firstlineno asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/getSource..st b/repository/Python-Core.package/Python.class/class/getSource..st index d57842be..9fdf13bb 100644 --- a/repository/Python-Core.package/Python.class/class/getSource..st +++ b/repository/Python-Core.package/Python.class/class/getSource..st @@ -3,6 +3,7 @@ getSource: pyFrame | pyCode filename contents | pyCode := pyFrame f_code. filename := pyCode co_filename asSmalltalk. - filename = '' ifTrue: [ ^ 'Unable to get source.' ]. - contents := self getContentsOf: filename. + contents := (FileStream isAFileNamed: filename) + ifTrue: [ self getContentsOf: filename ] + ifFalse: [ pyCode co_source asSmalltalk ifNil: [ 'unknown' ] ]. ^ self filterPySource: contents lineno: pyCode co_firstlineno asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/isExpression..st b/repository/Python-Core.package/Python.class/class/isExpression..st index 093da59d..512677f4 100644 --- a/repository/Python-Core.package/Python.class/class/isExpression..st +++ b/repository/Python-Core.package/Python.class/class/isExpression..st @@ -1,4 +1,3 @@ helpers isExpression: aPySource - ^ (self eval: '_isExpression("""', -aPySource, '""")') asSmalltalk \ No newline at end of file + ^ ((Python globals __getitem__ __call__: '_is_expression') __call__: aPySource) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/peval..st b/repository/Python-Core.package/Python.class/class/peval..st deleted file mode 100644 index 5d8272ac..00000000 --- a/repository/Python-Core.package/Python.class/class/peval..st +++ /dev/null @@ -1,7 +0,0 @@ -execution -peval: aString - ^ self - primEval: aString - filename: (self persistEvalCode: aString) - cmd: 'eval' - breakOnExceptions: false \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/peval.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/peval.breakOnExceptions..st deleted file mode 100644 index d10963bf..00000000 --- a/repository/Python-Core.package/Python.class/class/peval.breakOnExceptions..st +++ /dev/null @@ -1,7 +0,0 @@ -execution -peval: aString breakOnExceptions: aBool - ^ self - primEval: aString - filename: (self persistEvalCode: aString) - cmd: 'eval' - breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pexec..st b/repository/Python-Core.package/Python.class/class/pexec..st deleted file mode 100644 index 759fb1fa..00000000 --- a/repository/Python-Core.package/Python.class/class/pexec..st +++ /dev/null @@ -1,7 +0,0 @@ -execution -pexec: aString - ^ self - primEval: aString - filename: (self persistEvalCode: aString) - cmd: 'exec' - breakOnExceptions: false \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pexec.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/pexec.breakOnExceptions..st deleted file mode 100644 index 71488efc..00000000 --- a/repository/Python-Core.package/Python.class/class/pexec.breakOnExceptions..st +++ /dev/null @@ -1,7 +0,0 @@ -execution -pexec: aString breakOnExceptions: aBool - ^ self - primEval: aString - filename: (self persistEvalCode: aString) - cmd: 'exec' - breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/prun..st b/repository/Python-Core.package/Python.class/class/prun..st deleted file mode 100644 index 9593ed09..00000000 --- a/repository/Python-Core.package/Python.class/class/prun..st +++ /dev/null @@ -1,5 +0,0 @@ -execution -prun: pyCode - (self isExpression: pyCode) - ifTrue: [ [^ self peval: pyCode ] on: Error do: [] ]. - ^ self pexec: pyCode \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/prun.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/prun.breakOnExceptions..st deleted file mode 100644 index 23ea6160..00000000 --- a/repository/Python-Core.package/Python.class/class/prun.breakOnExceptions..st +++ /dev/null @@ -1,5 +0,0 @@ -execution -prun: pyCode breakOnExceptions: aBool - (self isExpression: pyCode) - ifTrue: [ [^ self peval: pyCode breakOnExceptions: aBool ] on: Error do: [] ]. - ^ self pexec: pyCode breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pyLexerRuby.st b/repository/Python-Core.package/Python.class/class/pyLexerRuby.st new file mode 100644 index 00000000..35053e1c --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pyLexerRuby.st @@ -0,0 +1,3 @@ +special objects +pyLexerRuby + ^ self fromObjectCache: '_pygments_lexer_ruby' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pygments.st b/repository/Python-Core.package/Python.class/class/pygments.st deleted file mode 100644 index 837a167b..00000000 --- a/repository/Python-Core.package/Python.class/class/pygments.st +++ /dev/null @@ -1,3 +0,0 @@ -special objects -pygments - ^ self fromObjectCache: 'pygments' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pygmentsHighlight.st b/repository/Python-Core.package/Python.class/class/pygmentsHighlight.st new file mode 100644 index 00000000..de4dd5fd --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pygmentsHighlight.st @@ -0,0 +1,3 @@ +special objects +pygmentsHighlight + ^ self fromObjectCache: 'pygments.highlight' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/run.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/run.breakOnExceptions..st new file mode 100644 index 00000000..42a7ed68 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/run.breakOnExceptions..st @@ -0,0 +1,5 @@ +execution +run: pyCode breakOnExceptions: aBool + (self isExpression: pyCode) + ifTrue: [ [^ self eval: pyCode breakOnExceptions: aBool ] on: Error do: [] ]. + ^ self exec: pyCode breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPygments.st b/repository/Python-Core.package/Python.class/class/setUpPygments.st index 4ee57f78..6be0ab86 100644 --- a/repository/Python-Core.package/Python.class/class/setUpPygments.st +++ b/repository/Python-Core.package/Python.class/class/setUpPygments.st @@ -1,8 +1,8 @@ overrides setUpPygments - self load: 'pygments' breakOnExceptions: false. self exec: ' try: + import pygments import pygments.lexers import pygments.formatters _pygments_lexer_python = pygments.lexers.get_lexer_by_name( @@ -13,12 +13,6 @@ try: "smalltalk", encoding="utf-8", stripnl=False, ensurenl=False) _pygments_formatter = pygments.formatters.get_formatter_by_name( "html", encoding="utf-8", style="colorful", nowrap=True, noclasses=True, lineseparator="
") - def _pygments_highlight(code, lexer=_pygments_lexer_python): - try: - return re.sub("
$", "", pygments.highlight(code, lexer, _pygments_formatter)) - except: - return code except ImportError: - def _pygments_highlight(code): - return code + pass ' breakOnExceptions: false. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st b/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st index e1c7c645..4b2570f1 100644 --- a/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st +++ b/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st @@ -12,7 +12,7 @@ sys.path = ["', Smalltalk image imagePath, '", "', Smalltalk image imagePath, '/pypy/lib-python/2.7/plat-mac/lib-scriptpackages", "', Smalltalk image imagePath, '/site-packages", "." ] -def _isExpression(x): +def _is_expression(x): try: compile(x, "", "eval") return True diff --git a/repository/Python-Core.package/Python.class/class/tempNamesIn..st b/repository/Python-Core.package/Python.class/class/tempNamesIn..st index 451b6431..4e020c68 100644 --- a/repository/Python-Core.package/Python.class/class/tempNamesIn..st +++ b/repository/Python-Core.package/Python.class/class/tempNamesIn..st @@ -1,3 +1,3 @@ debugging tempNamesIn: pyFrame - ^ pyFrame f_locals keys asSmalltalk \ No newline at end of file + ^ pyFrame f_locals keys __call__ asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/tempVariableAt.in..st b/repository/Python-Core.package/Python.class/class/tempVariableAt.in..st index f796a7d6..d200dafc 100644 --- a/repository/Python-Core.package/Python.class/class/tempVariableAt.in..st +++ b/repository/Python-Core.package/Python.class/class/tempVariableAt.in..st @@ -1,3 +1,3 @@ debugging tempVariableAt: anIndex in: pyFrame - ^ pyFrame f_locals values at: anIndex \ No newline at end of file + ^ pyFrame f_locals values __call__ at: anIndex \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json index 8c09e4a5..b99c5751 100644 --- a/repository/Python-Core.package/Python.class/methodProperties.json +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -10,9 +10,9 @@ "debuggerTitle:" : "fn 3/16/2017 15:12", "eval:" : "fn 3/21/2017 23:14", "eval:breakOnExceptions:" : "fn 3/11/2017 18:47", - "evaluateExpression:" : "fn 3/14/2017 18:31", - "evaluateExpression:breakOnExceptions:" : "fn 3/21/2017 23:13", - "evaluateExpression:in:to:" : "fn 3/21/2017 11:33", + "evaluateExpression:" : "fn 3/27/2017 21:55", + "evaluateExpression:breakOnExceptions:" : "fn 3/27/2017 21:55", + "evaluateExpression:in:to:" : "fn 3/30/2017 18:19", "evaluatorClass" : "fn 12/22/2016 02:53", "exec:" : "fn 3/21/2017 23:14", "exec:breakOnExceptions:" : "fn 3/11/2017 18:47", @@ -22,8 +22,8 @@ "from:load:" : "fn 1/9/2017 20:55", "fromObjectCache:" : "fn 2/23/2017 18:40", "getForeignFrames:" : "fn 3/16/2017 21:58", - "getSignature:" : "fn 3/16/2017 16:18", - "getSource:" : "fn 3/16/2017 21:58", + "getSignature:" : "fn 3/28/2017 01:38", + "getSource:" : "fn 3/28/2017 12:02", "globals" : "fn 2/26/2017 21:46", "highlight:" : "fn 3/14/2017 11:27", "import:" : "fn 3/21/2017 23:14", @@ -32,42 +32,38 @@ "indentSize:" : "fn 3/16/2017 21:37", "initialize" : "fn 3/6/2017 22:13", "isCallable:" : "fn 2/26/2017 21:45", - "isExpression:" : "fn 2/26/2017 21:45", + "isExpression:" : "fn 3/30/2017 00:00", "load:" : "fn 3/21/2017 23:14", "load:breakOnExceptions:" : "fn 3/12/2017 02:46", "locals" : "fn 2/26/2017 21:46", "pcRange:" : "fn 3/16/2017 22:21", - "peval:" : "fn 3/21/2017 23:15", - "peval:breakOnExceptions:" : "fn 3/22/2017 13:12", - "pexec:" : "fn 3/21/2017 23:15", - "pexec:breakOnExceptions:" : "fn 3/21/2017 23:14", "primEval:filename:cmd:breakOnExceptions:" : "fn 3/11/2017 14:45", "primGetTopFrame:" : "fn 3/22/2017 15:12", "primLastError:" : "fn 3/22/2017 15:12", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", "primResume:" : "fn 3/22/2017 15:12", - "prun:" : "fn 2/23/2017 21:36", - "prun:breakOnExceptions:" : "fn 3/21/2017 23:13", "pyFormatter" : "fn 3/6/2017 07:20", "pyLexerPython" : "fn 3/6/2017 19:05", + "pyLexerRuby" : "fn 3/28/2017 12:22", "pyLexerSmalltalk" : "fn 3/6/2017 19:05", - "pygments" : "fn 3/9/2017 17:52", + "pygmentsHighlight" : "fn 3/30/2017 22:17", "re" : "fn 3/9/2017 17:53", "replaceInPySource:content:lineno:" : "fn 3/16/2017 21:37", "reset" : "fn 2/23/2017 21:13", "restartFrame:with:" : "fn 3/16/2017 21:56", "resume:" : "fn 3/22/2017 15:12", "run:" : "fn 2/23/2017 21:37", + "run:breakOnExceptions:" : "fn 3/27/2017 21:55", "scopeEndIn:startingAt:" : "fn 3/16/2017 21:38", "setSource:to:" : "fn 3/16/2017 21:58", - "setUpPygments" : "fn 3/22/2017 00:30", - "setUpPythonEnvironment" : "fn 3/9/2017 17:54", + "setUpPygments" : "fn 3/30/2017 22:44", + "setUpPythonEnvironment" : "fn 3/28/2017 11:59", "single:" : "fn 3/21/2017 23:15", "sourceCodeTemplate" : "fn 3/14/2017 11:22", "startUp:" : "fn 3/14/2017 11:32", "sys" : "fn 3/9/2017 17:54", - "tempNamesIn:" : "fn 3/16/2017 22:43", - "tempVariableAt:in:" : "fn 3/16/2017 22:43", + "tempNamesIn:" : "fn 3/31/2017 00:15", + "tempVariableAt:in:" : "fn 3/31/2017 00:18", "type" : "fn 2/23/2017 18:34", "vmSpeaksLanguage" : "fn 3/14/2017 11:31" }, "instance" : { diff --git a/repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st b/repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st index 51046664..74890295 100644 --- a/repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st +++ b/repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st @@ -4,23 +4,16 @@ evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: f pyCode := textOrStream contents. Python exec: 'rcvr_locals = dict()'. - (Python eval: 'rcvr_locals') setdefault: 'self' to: receiver. + (Python eval: 'rcvr_locals') setdefault __call__: 'self' to: receiver. (Python isExpression: pyCode) ifTrue: [ - ^ Python builtins - eval: pyCode + ^ Python builtins eval + __call__: pyCode globals: (Python eval: 'globals()') locals: (Python eval: 'rcvr_locals')] ifFalse: [ - ^ Python builtins - exec: pyCode + ^ Python builtins exec + __call__: pyCode globals: (Python eval: 'globals()') - locals: (Python eval: 'rcvr_locals')] - - "pyCode := pyCode copyReplaceAll: 'self.' with: ''. - method := (pyCode copyUpTo: $() asSymbol. - args := ((((pyCode copyAfter: $() copyUpTo: $)) - findTokens: {$,}) - collect: [ :ea | ea withBlanksTrimmed ]) asArray. - ^ receiver perform: method withArguments: args" \ No newline at end of file + locals: (Python eval: 'rcvr_locals')] \ No newline at end of file diff --git a/repository/Python-Core.package/PythonCompiler.class/methodProperties.json b/repository/Python-Core.package/PythonCompiler.class/methodProperties.json index 89027b42..13311480 100644 --- a/repository/Python-Core.package/PythonCompiler.class/methodProperties.json +++ b/repository/Python-Core.package/PythonCompiler.class/methodProperties.json @@ -4,5 +4,5 @@ "parserClass" : "fn 3/14/2017 11:32" }, "instance" : { "compile:in:notifying:ifFail:" : "fn 3/14/2017 11:32", - "evaluate:in:to:notifying:ifFail:logged:" : "fn 2/24/2017 11:58", + "evaluate:in:to:notifying:ifFail:logged:" : "fn 3/30/2017 18:20", "pythonCompile:class:ifFail:" : "fn 12/19/2016 02:18" } } diff --git a/repository/Python-Core.package/PythonExamples.class/class/average..st b/repository/Python-Core.package/PythonExamples.class/class/average..st index e7948e92..699634a5 100644 --- a/repository/Python-Core.package/PythonExamples.class/class/average..st +++ b/repository/Python-Core.package/PythonExamples.class/class/average..st @@ -1,6 +1,6 @@ debugging average: anIterableDef - Python pexec: ' + Python exec: ' def average(iterable): return sum(iterable) / len(iterable)'. ^ Python eval: 'average(', anIterableDef, ')' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonExamples.class/class/average.st b/repository/Python-Core.package/PythonExamples.class/class/average.st index 19968836..ea1c0bb3 100644 --- a/repository/Python-Core.package/PythonExamples.class/class/average.st +++ b/repository/Python-Core.package/PythonExamples.class/class/average.st @@ -1,6 +1,6 @@ debugging average - Python pexec: ' + Python exec: ' def average(iterable): return sum(iterable) / len(iterable)'. ^ Python eval: 'average([])' \ No newline at end of file diff --git a/repository/Python-Core.package/PythonExamples.class/class/fibonacci..st b/repository/Python-Core.package/PythonExamples.class/class/fibonacci..st index dd7be796..e76666ac 100644 --- a/repository/Python-Core.package/PythonExamples.class/class/fibonacci..st +++ b/repository/Python-Core.package/PythonExamples.class/class/fibonacci..st @@ -1,6 +1,6 @@ debugging fibonacci: x - Python pexec: ' + Python exec: ' def fibonacci(number): lookup_table = [0] for i in range(2, number + 1): diff --git a/repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st b/repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st index 91034740..72efe856 100644 --- a/repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st +++ b/repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st @@ -1,6 +1,6 @@ debugging fibonacci9 - Python pexec: ' + Python exec: ' def fibonacci9(): number = 9 lookup_table = [0] diff --git a/repository/Python-Core.package/PythonExamples.class/class/miniexample.st b/repository/Python-Core.package/PythonExamples.class/class/miniexample.st index 88bc5a68..7b413a62 100644 --- a/repository/Python-Core.package/PythonExamples.class/class/miniexample.st +++ b/repository/Python-Core.package/PythonExamples.class/class/miniexample.st @@ -1,7 +1,7 @@ debugging miniexample "Use user interrupt to interrupt while loop" - ^ Python pexec: ' + ^ Python exec: ' x = 0 def start(): diff --git a/repository/Python-Core.package/PythonExamples.class/methodProperties.json b/repository/Python-Core.package/PythonExamples.class/methodProperties.json index 5c4d0636..c5c3147d 100644 --- a/repository/Python-Core.package/PythonExamples.class/methodProperties.json +++ b/repository/Python-Core.package/PythonExamples.class/methodProperties.json @@ -1,10 +1,10 @@ { "class" : { - "average" : "fn 2/23/2017 21:12", - "average:" : "fn 2/23/2017 21:12", - "fibonacci9" : "fn 2/23/2017 21:13", - "fibonacci:" : "fn 2/23/2017 21:13", - "miniexample" : "fn 2/23/2017 21:13", + "average" : "fn 3/27/2017 21:56", + "average:" : "fn 3/27/2017 21:56", + "fibonacci9" : "fn 3/27/2017 21:56", + "fibonacci:" : "fn 3/27/2017 21:56", + "miniexample" : "fn 3/27/2017 21:56", "server" : "fn 2/23/2017 17:59" }, "instance" : { } } diff --git a/repository/Python-Core.package/PythonObject.class/class/nextID.st b/repository/Python-Core.package/PythonObject.class/class/nextID.st deleted file mode 100644 index 1a290885..00000000 --- a/repository/Python-Core.package/PythonObject.class/class/nextID.st +++ /dev/null @@ -1,6 +0,0 @@ -overrides -nextID - "NextID = nil" - NextID ifNil: [ NextID := 0 ]. - NextID := NextID + 1. - ^ NextID \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/withAll2..st b/repository/Python-Core.package/PythonObject.class/class/withAll2..st deleted file mode 100644 index 26e83602..00000000 --- a/repository/Python-Core.package/PythonObject.class/class/withAll2..st +++ /dev/null @@ -1,8 +0,0 @@ -as yet unclassified -withAll2: anArray - | id obj | - id := 'inst', PythonObject nextID asString. - Python exec: id, ' = ', self name asString, '(', (anArray joinSeparatedBy: ',') , ')'. - obj := Python eval: id. - obj pyID: id. - ^ obj \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/class/withAll3..st b/repository/Python-Core.package/PythonObject.class/class/withAll3..st deleted file mode 100644 index fd6417ea..00000000 --- a/repository/Python-Core.package/PythonObject.class/class/withAll3..st +++ /dev/null @@ -1,6 +0,0 @@ -as yet unclassified -withAll3: anArray - | id | - id := 'inst', PythonObject nextID asString. - Python exec: id, ' = ', self name asString, '(', (anArray joinSeparatedBy: ',') , ')'. - ^ self basicNew initialize pyID: id; yourself \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st b/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st index 28742c5f..405674c9 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st +++ b/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st @@ -1,3 +1,3 @@ helpers allAttributes - ^ (Python builtins dir: self) asSmalltalk \ No newline at end of file + ^ (Python builtins dir __call__: self) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st b/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st index 36b194a3..53dc5826 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st +++ b/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st @@ -1,3 +1,3 @@ overrides allInstVarNames - ^ (Python builtins dir: self) asSmalltalk \ No newline at end of file + ^ (Python builtins dir __call__: self) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/at..st b/repository/Python-Core.package/PythonObject.class/instance/at..st index 7282371f..f7f9a347 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/at..st +++ b/repository/Python-Core.package/PythonObject.class/instance/at..st @@ -1,3 +1,3 @@ overrides at: aKeyOrIndex - ^ self __getitem__: aKeyOrIndex \ No newline at end of file + ^ self __getitem__ __call__: aKeyOrIndex \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/at.put..st b/repository/Python-Core.package/PythonObject.class/instance/at.put..st index 70812ae6..3c4a09a7 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/at.put..st +++ b/repository/Python-Core.package/PythonObject.class/instance/at.put..st @@ -1,3 +1,3 @@ overrides at: aKeyOrIndex put: aValue - ^ self __setitem__: aKeyOrIndex to: aValue \ No newline at end of file + ^ self __setitem__ __call__: aKeyOrIndex to: aValue \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/class.st b/repository/Python-Core.package/PythonObject.class/instance/class.st index 8e78e221..4f9a1b4b 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/class.st +++ b/repository/Python-Core.package/PythonObject.class/instance/class.st @@ -1,3 +1,3 @@ overrides class - ^ Python builtins type: self \ No newline at end of file + ^ Python builtins type __call__: self \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/defaultTitleForInspector.st b/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st similarity index 78% rename from repository/Python-Core.package/PythonObject.class/instance/defaultTitleForInspector.st rename to repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st index 754968fc..ed320bef 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/defaultTitleForInspector.st +++ b/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st @@ -1,4 +1,4 @@ overrides -defaultTitleForInspector +defaultLabelForInspector self hasClass ifTrue: [ ^ self className, ': ', self asString ]. ^ self asString \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st b/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st index be3b1a56..cb023dde 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st +++ b/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st @@ -1,7 +1,7 @@ explorer explorerContents ^ self allInstVarNames asOrderedCollection collect: [ :attrName | | value | - value := Python builtins getattr: self attrName: attrName. + value := Python builtins getattr __call__: self attrName: attrName. ObjectExplorerWrapper with: value name: attrName diff --git a/repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st b/repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st index 0864bd07..0906d056 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st +++ b/repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st @@ -1,3 +1,3 @@ helpers hasAttribute: anAttribute - ^ (Python builtins hasattr: self attr: anAttribute) asSmalltalk \ No newline at end of file + ^ (Python builtins hasattr __call__: self attr: anAttribute) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st b/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st index fd6853ca..21040471 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st +++ b/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st @@ -1,4 +1,3 @@ inspector hasContentsInExplorer - ^ self allInstVarNames notEmpty diff --git a/repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st b/repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st index eee386bc..5df62a7b 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st +++ b/repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st @@ -1,3 +1,3 @@ overrides instVarNamed: aName - ^ Python builtins getattr: self attrName: aName \ No newline at end of file + ^ Python builtins getattr __call__: self attrName: aName \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/isClass.st b/repository/Python-Core.package/PythonObject.class/instance/isClass.st index af8b5c1a..a91db106 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/isClass.st +++ b/repository/Python-Core.package/PythonObject.class/instance/isClass.st @@ -1,3 +1,3 @@ helpers isClass - ^ (Python builtins isinstance: self and: Python type) asSmalltalk \ No newline at end of file + ^ (Python builtins isinstance __call__: self and: Python type) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/printOn..st b/repository/Python-Core.package/PythonObject.class/instance/printOn..st index 05da728b..7d1ba1bd 100644 --- a/repository/Python-Core.package/PythonObject.class/instance/printOn..st +++ b/repository/Python-Core.package/PythonObject.class/instance/printOn..st @@ -1,3 +1,3 @@ overrides printOn: aStream - aStream nextPutAll: (Python builtins str __call__: self) asSmalltalk \ No newline at end of file + aStream nextPutAll: 'Python ', (Python builtins str __call__: self) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/pyDictKeys.st b/repository/Python-Core.package/PythonObject.class/instance/pyDictKeys.st deleted file mode 100644 index 7dc8c256..00000000 --- a/repository/Python-Core.package/PythonObject.class/instance/pyDictKeys.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -pyDictKeys - (self hasAttribute: '__dict__') ifTrue: [ ^ self __dict__ keys ]. - ^ #() \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/pyDictValues.st b/repository/Python-Core.package/PythonObject.class/instance/pyDictValues.st deleted file mode 100644 index b452c547..00000000 --- a/repository/Python-Core.package/PythonObject.class/instance/pyDictValues.st +++ /dev/null @@ -1,4 +0,0 @@ -helpers -pyDictValues - (self hasAttribute: '__dict__') ifTrue: [ ^ self __dict__ values ]. - ^ #() \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/instance/pyIdentifier.st b/repository/Python-Core.package/PythonObject.class/instance/pyIdentifier.st deleted file mode 100644 index 72d2f4ec..00000000 --- a/repository/Python-Core.package/PythonObject.class/instance/pyIdentifier.st +++ /dev/null @@ -1,5 +0,0 @@ -helpers -pyIdentifier - | instID | - instID := self inst_id. - ^ self class __name__, '.instances[', instID, ']'. \ No newline at end of file diff --git a/repository/Python-Core.package/PythonObject.class/methodProperties.json b/repository/Python-Core.package/PythonObject.class/methodProperties.json index e09e8646..3d3d8a9e 100644 --- a/repository/Python-Core.package/PythonObject.class/methodProperties.json +++ b/repository/Python-Core.package/PythonObject.class/methodProperties.json @@ -3,7 +3,6 @@ "allInstances" : "fn 3/12/2017 19:20", "isPython" : "fn 3/7/2017 11:56", "new" : "fn 3/14/2017 11:32", - "nextID" : "fn 12/18/2016 23:45", "pyCompile:classified:notifying:" : "fn 3/7/2017 11:44", "pyMethodDict" : "fn 3/7/2017 10:24", "pythonize" : "fn 12/21/2016 00:15", @@ -13,33 +12,28 @@ "sourceCodeTemplate" : "fn 3/7/2017 19:08", "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 3/14/2017 11:32", "toolIconSelector:" : "fn 3/14/2017 01:35", - "withAll2:" : "fn 12/22/2016 15:19", - "withAll3:" : "fn 12/21/2016 14:50", "withAll:" : "fn 12/22/2016 15:19" }, "instance" : { - "allAttributes" : "fn 2/26/2017 21:35", - "allInstVarNames" : "fn 3/14/2017 12:01", + "allAttributes" : "fn 3/29/2017 23:36", + "allInstVarNames" : "fn 3/29/2017 23:37", "asSmalltalk" : "fn 2/26/2017 21:04", - "at:" : "fn 2/26/2017 20:40", - "at:put:" : "fn 2/26/2017 20:41", - "class" : "fn 2/26/2017 21:41", + "at:" : "fn 3/29/2017 23:41", + "at:put:" : "fn 3/29/2017 23:42", + "class" : "fn 3/29/2017 23:37", "className" : "fn 2/26/2017 22:01", - "defaultTitleForInspector" : "fn 3/14/2017 11:52", - "explorerContents" : "fn 3/14/2017 12:02", - "hasAttribute:" : "fn 2/26/2017 21:41", + "defaultLabelForInspector" : "fn 3/28/2017 15:00", + "explorerContents" : "fn 3/29/2017 23:37", + "hasAttribute:" : "fn 3/29/2017 23:37", "hasClass" : "fn 2/26/2017 21:52", - "hasContentsInExplorer" : "fn 3/14/2017 12:02", - "instVarNamed:" : "fn 3/14/2017 12:07", + "hasContentsInExplorer" : "fn 3/29/2017 23:42", + "instVarNamed:" : "fn 3/29/2017 23:37", "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", - "isClass" : "fn 2/26/2017 21:42", + "isClass" : "fn 3/29/2017 23:37", "isKindOf:" : "fn 12/25/2016 14:47", "isNone" : "fn 3/9/2017 15:18", "isPython" : "fn 2/10/2017 12:12", "languageSymbol" : "fn 3/14/2017 00:50", "notNone" : "fn 3/9/2017 15:19", - "printOn:" : "fn 3/6/2017 10:07", - "pyDictKeys" : "fn 2/26/2017 21:42", - "pyDictValues" : "fn 2/26/2017 21:42", - "pyIdentifier" : "fn 1/18/2017 17:20", + "printOn:" : "fn 3/29/2017 23:37", "respondsTo:" : "fn 12/22/2016 23:36", "variablesAndOffsetsDo:" : "fn 3/12/2017 19:19" } } diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index 67992979..9186ab0e 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/eval.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/eval.breakOnExceptions..st new file mode 100644 index 00000000..9b41d742 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/eval.breakOnExceptions..st @@ -0,0 +1,3 @@ +execution +eval: aString breakOnExceptions: aBool + ^ self eval: aString filePath: '-e' breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st b/repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st index 6b88b937..aa7f09d0 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st +++ b/repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st @@ -1,3 +1,3 @@ execution eval: aString filePath: aFilePath - ^ self primEval: aString filePath: aFilePath breakOnExceptions: true \ No newline at end of file + ^ self eval: aString filePath: aFilePath breakOnExceptions: true \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/eval.filePath.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/eval.filePath.breakOnExceptions..st new file mode 100644 index 00000000..20738a2b --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/eval.filePath.breakOnExceptions..st @@ -0,0 +1,3 @@ +execution +eval: aString filePath: aFilePath breakOnExceptions: aBool + ^ self primEval: aString filePath: aFilePath breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st index cbce00cb..b379908e 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression..st @@ -1,3 +1,3 @@ execution evaluateExpression: selection - ^ Ruby peval: selection asString \ No newline at end of file + ^ Ruby eval: selection asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st index 756d975b..1957bdcf 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st @@ -1,3 +1,3 @@ execution evaluateExpression: selection breakOnExceptions: aBool - ^ Ruby peval: selection asString breakOnExceptions: aBool \ No newline at end of file + ^ Ruby eval: selection asString breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/getSource..st b/repository/Ruby-Core.package/Ruby.class/class/getSource..st index 23057593..2bbbc619 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/getSource..st +++ b/repository/Ruby-Core.package/Ruby.class/class/getSource..st @@ -3,5 +3,6 @@ getSource: rbFrame | filename | rbFrame has_contents asSmalltalk ifFalse: [ ^ 'no contents' ]. filename := rbFrame get_filename asSmalltalk. - filename = '-e' ifTrue: [ ^ 'source unavailable (-e)' ]. - ^ self getContentsOf: filename \ No newline at end of file + ^ (FileStream isAFileNamed: filename) + ifTrue: [ self getContentsOf: filename ] + ifFalse: [ rbFrame get_code_source asSmalltalk ] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/peval..st b/repository/Ruby-Core.package/Ruby.class/class/peval..st deleted file mode 100644 index 6ee98bc8..00000000 --- a/repository/Ruby-Core.package/Ruby.class/class/peval..st +++ /dev/null @@ -1,3 +0,0 @@ -execution -peval: aString - ^ self eval: aString filePath: (self persistEvalCode: aString) \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/peval.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/peval.breakOnExceptions..st deleted file mode 100644 index d599269c..00000000 --- a/repository/Ruby-Core.package/Ruby.class/class/peval.breakOnExceptions..st +++ /dev/null @@ -1,3 +0,0 @@ -execution -peval: aString breakOnExceptions: aBool - ^ self primEval: aString filePath: (self persistEvalCode: aString) breakOnExceptions: aBool \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json index 64aa2032..eeae8cf0 100644 --- a/repository/Ruby-Core.package/Ruby.class/methodProperties.json +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -3,19 +3,19 @@ "debuggerPrintItem:on:" : "fn 3/16/2017 22:37", "debuggerTitle:" : "fn 3/16/2017 22:47", "eval:" : "fn 3/16/2017 13:41", - "eval:filePath:" : "fn 3/16/2017 13:42", - "evaluateExpression:" : "fn 3/17/2017 10:22", - "evaluateExpression:breakOnExceptions:" : "fn 3/21/2017 23:13", + "eval:breakOnExceptions:" : "fn 3/23/2017 08:59", + "eval:filePath:" : "fn 3/23/2017 08:59", + "eval:filePath:breakOnExceptions:" : "fn 3/23/2017 08:59", + "evaluateExpression:" : "fn 3/27/2017 23:53", + "evaluateExpression:breakOnExceptions:" : "fn 3/27/2017 23:53", "fileExtension" : "fn 3/17/2017 10:20", "getForeignFrames:" : "fn 3/16/2017 22:22", - "getSource:" : "fn 3/17/2017 10:46", + "getSource:" : "fn 3/27/2017 23:54", "highlight:" : "fn 3/14/2017 11:27", "kernel" : "tfel 8/16/2016 07:04", "nil" : "fn 3/16/2017 13:37", "object" : "tfel 8/16/2016 07:04", "pcRange:" : "fn 3/16/2017 22:22", - "peval:" : "fn 3/17/2017 10:22", - "peval:breakOnExceptions:" : "fn 3/19/2017 01:09", "primEval:" : "tfel 8/16/2016 07:03", "primEval:filePath:breakOnExceptions:" : "fn 3/16/2017 13:40", "primGetTopFrame" : "fn 3/14/2017 22:23", diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/defaultTitleForInspector.st b/repository/Ruby-Core.package/RubyObject.class/instance/defaultLabelForInspector.st similarity index 68% rename from repository/Ruby-Core.package/RubyObject.class/instance/defaultTitleForInspector.st rename to repository/Ruby-Core.package/RubyObject.class/instance/defaultLabelForInspector.st index d8e9c9df..2196b192 100644 --- a/repository/Ruby-Core.package/RubyObject.class/instance/defaultTitleForInspector.st +++ b/repository/Ruby-Core.package/RubyObject.class/instance/defaultLabelForInspector.st @@ -1,3 +1,3 @@ overrides -defaultTitleForInspector +defaultLabelForInspector ^ self _class asString, ': ', self asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st b/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st index 891fd882..692bef45 100644 --- a/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st +++ b/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st @@ -1,3 +1,3 @@ overrides printOn: aStream - aStream nextPutAll: self _inspect asSmalltalk \ No newline at end of file + aStream nextPutAll: 'Ruby ', self _inspect asSmalltalk \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyObject.class/methodProperties.json b/repository/Ruby-Core.package/RubyObject.class/methodProperties.json index f2042701..2036b300 100644 --- a/repository/Ruby-Core.package/RubyObject.class/methodProperties.json +++ b/repository/Ruby-Core.package/RubyObject.class/methodProperties.json @@ -6,12 +6,12 @@ "asSmalltalk" : "fn 3/12/2017 17:43", "class" : "fn 3/14/2017 13:22", "className" : "fn 3/12/2017 19:09", - "defaultTitleForInspector" : "fn 3/14/2017 11:52", + "defaultLabelForInspector" : "fn 3/28/2017 15:00", "instVarNamed:" : "fn 3/14/2017 12:08", "isNil" : "fn 3/16/2017 13:38", "isRuby" : "fn 3/12/2017 19:24", "languageSymbol" : "fn 3/14/2017 00:51", "notNil" : "fn 3/16/2017 13:38", - "printOn:" : "fn 3/14/2017 01:00", + "printOn:" : "fn 3/28/2017 15:01", "respondsTo:" : "fn 3/12/2017 19:17", "variablesAndOffsetsDo:" : "fn 3/12/2017 19:19" } } diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version index 2ee59ee5..5dc1ff33 100644 --- a/repository/Ruby-Core.package/monticello.meta/version +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 434089e559ccd8ddc9e582eee9f2a8decf05469c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 31 Mar 2017 09:51:08 +0200 Subject: [PATCH 156/193] Make ProfilerPlugin optional --- rsqueakvm/plugins/profiler_plugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rsqueakvm/plugins/profiler_plugin.py b/rsqueakvm/plugins/profiler_plugin.py index 6c439c01..3ab0606a 100644 --- a/rsqueakvm/plugins/profiler_plugin.py +++ b/rsqueakvm/plugins/profiler_plugin.py @@ -13,6 +13,10 @@ class ProfilerPlugin(Plugin): + + def is_optional(self): + return True + def patch(self): patch_interpreter() From 45cef95b5a4c06c72636786740bd2ec9747ead95 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 31 Mar 2017 22:41:11 +0200 Subject: [PATCH 157/193] Extend Ruby wrap methods --- rsqueakvm/plugins/ruby/utils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/rsqueakvm/plugins/ruby/utils.py b/rsqueakvm/plugins/ruby/utils.py index 3540f992..d2306d02 100644 --- a/rsqueakvm/plugins/ruby/utils.py +++ b/rsqueakvm/plugins/ruby/utils.py @@ -9,9 +9,6 @@ from topaz.objects.intobject import W_FixnumObject as WR_FixnumObject from topaz.objects.stringobject import W_StringObject as WR_StringObject from topaz.objects.symbolobject import W_SymbolObject as WR_SymbolObject -from topaz.objects.nilobject import W_NilObject as WR_NilObject -from topaz.objects.boolobject import ( - W_TrueObject as WR_TrueObject, W_FalseObject as WR_FalseObject) from rpython.rlib import objectmodel @@ -23,11 +20,11 @@ def ruby_to_smalltalk(space, wr_object): return space.wrap_smallint_unsafe(ruby_space.int_w(wr_object)) elif isinstance(wr_object, WR_StringObject): return space.wrap_string(ruby_space.str_w(wr_object)) - elif isinstance(wr_object, WR_NilObject): + elif wr_object is ruby_space.w_nil: return space.w_nil - elif isinstance(wr_object, WR_FalseObject): + elif wr_object is ruby_space.w_false: return space.w_false - elif isinstance(wr_object, WR_TrueObject): + elif wr_object is ruby_space.w_true: return space.w_true elif isinstance(wr_object, WR_SymbolObject): return space.wrap_symbol(ruby_space.str_w(wr_object)) @@ -43,6 +40,12 @@ def ruby_to_smalltalk(space, wr_object): def smalltalk_to_ruby(space, w_object): if isinstance(w_object, W_RubyObject): return w_object.wr_object + elif w_object is None or w_object is space.w_nil: + return ruby_space.w_nil + elif w_object is space.w_true: + return ruby_space.w_true + elif w_object is space.w_false: + return ruby_space.w_false elif isinstance(w_object, W_Float): return ruby_space.newfloat(space.unwrap_float(w_object)) elif isinstance(w_object, W_SmallInteger): From 07f97d675029d71c2e9c3260042da1df85a5d157 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 31 Mar 2017 22:41:37 +0200 Subject: [PATCH 158/193] Disable _vmprof in PyPy --- rsqueakvm/plugins/python/objspace.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rsqueakvm/plugins/python/objspace.py b/rsqueakvm/plugins/python/objspace.py index 720bab4d..c074de49 100644 --- a/rsqueakvm/plugins/python/objspace.py +++ b/rsqueakvm/plugins/python/objspace.py @@ -20,6 +20,9 @@ def new_pypy_objspace(): pypy_config.objspace.usemodules.micronumpy = False pypy_config.objspace.usemodules.cppyy = False + # disable vmprof + pypy_config.objspace.usemodules._vmprof = False + # cpyext causes a lot of 'Undefined symbols for architecture x86_64' errors pypy_config.objspace.usemodules.cpyext = False From b448b4a51650f890da55e6ab90dc56b427507d3f Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 1 Apr 2017 11:38:44 +0200 Subject: [PATCH 159/193] =?UTF-8?q?Make=20=E2=80=94disabled=5Fplugins=20wo?= =?UTF-8?q?rk=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rsqueakvm/plugins/plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rsqueakvm/plugins/plugin.py b/rsqueakvm/plugins/plugin.py index 6b0b7ce6..e8ceb3f8 100644 --- a/rsqueakvm/plugins/plugin.py +++ b/rsqueakvm/plugins/plugin.py @@ -28,6 +28,8 @@ def is_optional(self): return False def is_enabled(self): + if self.name() in system.disabled_plugins: + return False if self.is_optional(): return (self.name() in system.optional_plugins or system.IS_SPHINX) return True # enabled by default From 2f4440765f881fdef7675516305e866c7dfecd63 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 1 Apr 2017 11:39:13 +0200 Subject: [PATCH 160/193] No need for ProfilerPlugin to be optional anymore --- rsqueakvm/plugins/profiler_plugin.py | 3 --- targetrsqueak.py | 9 ++++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rsqueakvm/plugins/profiler_plugin.py b/rsqueakvm/plugins/profiler_plugin.py index 3ab0606a..e8718c79 100644 --- a/rsqueakvm/plugins/profiler_plugin.py +++ b/rsqueakvm/plugins/profiler_plugin.py @@ -14,9 +14,6 @@ class ProfilerPlugin(Plugin): - def is_optional(self): - return True - def patch(self): patch_interpreter() diff --git a/targetrsqueak.py b/targetrsqueak.py index f6f0fdbc..a925445a 100755 --- a/targetrsqueak.py +++ b/targetrsqueak.py @@ -29,14 +29,17 @@ def target(driver, args): config.translating = True system.expose_options(driver.config) + + if 'PythonPlugin' in system.optional_plugins: + # Disable vmprof, because it causes compiling errors + system.disabled_plugins += ',ProfilerPlugin' + # We must not import this before the config was exposed from rsqueakvm.main import safe_entry_point - if "PythonPlugin" in system.optional_plugins: + if 'PythonPlugin' in system.optional_plugins: from rsqueakvm.plugins.python.utils import entry_point from pypy.tool.ann_override import PyPyAnnotatorPolicy ann_policy = PyPyAnnotatorPolicy() - # Disable vmprof, because it causes compiling errors - system.disabled_plugins += ',ProfilerPlugin' return entry_point, None, ann_policy return safe_entry_point, None, None From 1c37038157292e36e866384aa605449da4ba56fa Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 1 Apr 2017 11:43:25 +0200 Subject: [PATCH 161/193] Make send async just like eval There unfortunately still is an issue when translating with topaz --- .../plugins/foreign_language/__init__.py | 52 ++++++++++++------- rsqueakvm/plugins/foreign_language/process.py | 41 +++++++++++++-- rsqueakvm/plugins/foreign_language/runner.py | 4 +- rsqueakvm/plugins/python/__init__.py | 43 ++++----------- rsqueakvm/plugins/python/process.py | 46 +++++++++++++--- rsqueakvm/plugins/python/utils.py | 10 ++-- rsqueakvm/plugins/ruby/__init__.py | 34 ++++-------- rsqueakvm/plugins/ruby/process.py | 37 +++++++++++-- rsqueakvm/plugins/ruby/utils.py | 7 ++- 9 files changed, 170 insertions(+), 104 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 55998149..d8eca397 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -4,8 +4,6 @@ from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess from rsqueakvm.plugins.plugin import Plugin -from rpython.rlib import jit - class ForeignLanguagePlugin(Plugin): @@ -24,7 +22,11 @@ def is_operational(self): raise NotImplementedError @staticmethod - def new_language_process(space, args_w): + def new_eval_process(space, args_w): + raise NotImplementedError + + @staticmethod + def new_send_process(space, w_rcvr, method_name, args_w): raise NotImplementedError @staticmethod @@ -44,7 +46,7 @@ def eval(interp, s_frame, argcount): raise PrimitiveFailedError # import pdb; pdb.set_trace() args_w = s_frame.peek_n(argcount) - language_process = self.new_language_process(interp.space, args_w) + language_process = self.new_eval_process(interp.space, args_w) language_process.start() # when we are here, the foreign language process has yielded frame = language_process.switch_to_smalltalk( @@ -52,6 +54,28 @@ def eval(interp, s_frame, argcount): s_frame.pop_n(argcount + 1) return frame + @self.expose_primitive(result_is_new_frame=True, compiled_method=True) + def send(interp, s_frame, argcount, w_method): + if not self.is_operational(): + raise PrimitiveFailedError + # import pdb; pdb.set_trace() + args_w = s_frame.peek_n(argcount) + w_rcvr = s_frame.peek(argcount) + w_selector_name = w_method.literalat0(interp.space, 2) + if not isinstance(w_selector_name, W_BytesObject): + raise PrimitiveFailedError + method_name = interp.space.unwrap_string(w_selector_name) + idx = method_name.find(':') + if idx > 0: + method_name = method_name[0:idx] + language_process = self.new_send_process( + interp.space, w_rcvr, method_name, args_w) + language_process.start() + frame = language_process.switch_to_smalltalk( + interp, s_frame, first_call=True) + s_frame.pop_n(argcount + 1) + return frame + @self.expose_primitive(unwrap_spec=[object, object], result_is_new_frame=True) def resume(interp, s_frame, w_rcvr, language_process): @@ -63,21 +87,6 @@ def resume(interp, s_frame, w_rcvr, language_process): raise PrimitiveFailedError return language_process.switch_to_smalltalk(interp, s_frame) - @self.expose_primitive(compiled_method=True) - @jit.unroll_safe - def send(interp, s_frame, argcount, w_method): - # import pdb; pdb.set_trace() - space = interp.space - args_w = s_frame.peek_n(argcount) - w_rcvr = s_frame.peek(argcount) - w_selector_name = w_method.literalat0(space, 2) - if not isinstance(w_selector_name, W_BytesObject): - raise PrimitiveFailedError - method_name = space.unwrap_string(w_selector_name) - w_result = self.perform_send(space, w_rcvr, method_name, args_w) - s_frame.pop_n(argcount + 1) - return w_result - @self.expose_primitive(unwrap_spec=[object, object]) def lastError(interp, s_frame, w_rcvr, language_process): if not isinstance(language_process, W_ForeignLanguageProcess): @@ -101,7 +110,10 @@ def getTopFrame(interp, s_frame, w_rcvr, language_process): def asSmalltalk(interp, s_frame, w_rcvr): if not isinstance(w_rcvr, self.w_object_class()): raise PrimitiveFailedError - return self.to_w_object(interp.space, w_rcvr) + w_result = self.to_w_object(interp.space, w_rcvr) + if w_result is None: + raise PrimitiveFailedError + return w_result @self.expose_primitive(unwrap_spec=[object, object]) def registerSpecificClass(interp, s_frame, w_rcvr, language_obj): diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index d502dc2a..142593ca 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -33,20 +33,31 @@ def resume_method(self): class W_ForeignLanguageProcess(W_AbstractObjectWithIdentityHash): __metaclass__ = ForeignLanguageProcessMeta _attrs_ = [ - '_runner', '_done', 'w_result', 'w_error', '_break_on_exceptions'] + '_runner', '_done', 'w_result', 'w_error', + '_space', 'w_rcvr', 'method_name', 'args_w', + '_is_send', '_break_on_exceptions'] repr_classname = 'W_ForeignLanguageProcess' - def __init__(self, break_on_exceptions=True): + def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, + is_send=False, break_on_exceptions=False): W_AbstractObjectWithIdentityHash.__init__(self) + self._space = space + self.w_rcvr = w_rcvr + self.method_name = method_name + self.args_w = args_w self._done = False self.w_result = None self.w_error = None + self._is_send = is_send self._break_on_exceptions = break_on_exceptions if objectmodel.we_are_translated(): self._runner = runner.StackletLanguageRunner(self) else: self._runner = runner.GreenletLanguageRunner(self) + def space(self): + return self._space + @staticmethod def load_special_objects(cls, language_name, space): foreign_class = space.smalltalk_at(language_name) @@ -86,7 +97,10 @@ def getclass(self, space): # Abstract methods - def run(self): + def eval(self): + raise NotImplementedError + + def send(self): raise NotImplementedError def pre_resume(self): # called on every switch to language process @@ -100,14 +114,27 @@ def w_top_frame(self): # Helpers - def run_safe(self): + def safe_run(self): try: - self.run() + if self._is_send: + self.guarded_send() + else: + self.eval() except Exception as e: print 'Unknown error in thread: %s' % e finally: self._done = True + def guarded_send(self): + if (self.w_rcvr is None or self.method_name is None or + self.args_w is None): + error_msg = 'Invalid send (w_rcvr: %s, method: %s, args_w: %s)' % ( + self.w_rcvr, self.method_name, self.args_w) + print error_msg + self.set_error(self.space().wrap_string(error_msg)) + return + self.send() + def start(self): self.runner().start() @@ -129,6 +156,10 @@ def runner(self): def is_done(self): return self._done + def fail(self, error_msg): + print error_msg + self.set_error(self.space().wrap_string(error_msg)) + def get_result(self): return self.w_result diff --git a/rsqueakvm/plugins/foreign_language/runner.py b/rsqueakvm/plugins/foreign_language/runner.py index 91fb9d30..0fc1d6b3 100644 --- a/rsqueakvm/plugins/foreign_language/runner.py +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -84,7 +84,7 @@ def new_stacklet_callback(h, arg): self = global_execution_state.origin self.handle = h global_execution_state.clear() - self.language_process().run_safe() + self.language_process().safe_run() global_execution_state.origin = self return self.handle # return to Smalltalk when done @@ -109,7 +109,7 @@ def yield_thread(self): def new_greenlet_callback(): print 'new_greenlet_callback' self = global_execution_state.origin - return self.language_process().run_safe + return self.language_process().safe_run class GlobalState: diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index f58b7cbb..59bff301 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -13,9 +13,6 @@ from rsqueakvm.plugins.python.process import W_PythonProcess from rsqueakvm.plugins.python.switching import PyFrameRestartInfo - from pypy.interpreter.argument import Arguments - from pypy.interpreter.error import OperationError - IMPORT_FAILED = False except ImportError: try: @@ -59,7 +56,7 @@ def startup(space, argv): py_space.startup() @staticmethod - def new_language_process(space, args_w): + def new_eval_process(space, args_w): if len(args_w) != 4: raise PrimitiveFailedError source_w = args_w[0] @@ -73,39 +70,19 @@ def new_language_process(space, args_w): filename = space.unwrap_string(filename_w) cmd = space.unwrap_string(cmd_w) break_on_exceptions = args_w[3] is space.w_true - return W_PythonProcess(source, filename, cmd, break_on_exceptions) + return W_PythonProcess( + space, source=source, filename=filename, cmd=cmd, + break_on_exceptions=break_on_exceptions) @staticmethod - def w_object_class(): - return W_PythonObject + def new_send_process(space, w_rcvr, method_name, args_w): + return W_PythonProcess( + space, is_send=True, + w_rcvr=w_rcvr, method_name=method_name, args_w=args_w) @staticmethod - def perform_send(space, w_rcvr, attrname, args_w): - wp_rcvr = utils.smalltalk_to_python(space, w_rcvr) - idx = attrname.find(':') - if idx > 0: - attrname = attrname[0:idx] - wp_attrname = py_space.newtext(attrname) - # import pdb; pdb.set_trace() - try: - if attrname == '__call__': # special __call__ case - w_meth = py_space.getattr(wp_rcvr, wp_attrname) - args_wp = [utils.smalltalk_to_python(space, a) for a in args_w] - # use call_args() to allow variable number of args_w - # (but this disables speed hacks in Pypy) - args = Arguments(py_space, args_wp) - return W_PythonObject(py_space.call_args(w_meth, args)) - elif len(args_w) == 1: # setattr when one argument - wp_value = utils.smalltalk_to_python(space, args_w[0]) - py_space.setattr(wp_rcvr, wp_attrname, wp_value) - return W_PythonObject(py_space.w_None) - else: # otherwise getattr - return W_PythonObject(py_space.getattr(wp_rcvr, wp_attrname)) - except OperationError as operr: - return utils.operr_to_w_object(operr) - except Exception as e: - print 'Unable to call %s on %s: %s' % (attrname, wp_rcvr, e) - raise PrimitiveFailedError + def w_object_class(): + return W_PythonObject @staticmethod def to_w_object(space, foreign_object): diff --git a/rsqueakvm/plugins/python/process.py b/rsqueakvm/plugins/python/process.py index df26b883..39407cf4 100644 --- a/rsqueakvm/plugins/python/process.py +++ b/rsqueakvm/plugins/python/process.py @@ -1,8 +1,9 @@ from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.objspace import py_space -from rsqueakvm.plugins.python.utils import _run_eval_string, operr_to_w_object +from rsqueakvm.plugins.python import utils +from pypy.interpreter.argument import Arguments from pypy.interpreter.error import OperationError @@ -10,22 +11,55 @@ class W_PythonProcess(W_ForeignLanguageProcess): _attrs_ = ['source', 'filename', 'cmd', 'ec'] repr_classname = 'W_PythonProcess' - def __init__(self, source, filename, cmd, break_on_exceptions=True): - W_ForeignLanguageProcess.__init__(self, break_on_exceptions) + def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, + source=None, filename=None, cmd=None, + is_send=False, break_on_exceptions=False): + W_ForeignLanguageProcess.__init__( + self, space, w_rcvr, method_name, args_w, + is_send, break_on_exceptions) self.source = source self.filename = filename self.cmd = cmd self.ec = py_space.createexecutioncontext() - def run(self): + def eval(self): + if self.source is None or self.filename is None or self.cmd is None: + return self.fail('Invalid Python eval') print 'Python start' try: - retval = _run_eval_string(self.source, self.filename, self.cmd) + retval = utils._run_eval_string( + self.source, self.filename, self.cmd) self.set_result(W_PythonObject(retval)) except OperationError as operr: # operr was not handled by users, because they pressed proceed. # save Python error as result instead. - self.set_result(operr_to_w_object(operr)) + self.set_result(utils.operr_to_w_object(operr)) + + def send(self): + st_to_py = utils.smalltalk_to_python + wp_rcvr = st_to_py(self.space(), self.w_rcvr) + wp_attrname = py_space.newtext(self.method_name) + try: + if self.method_name == '__call__': # special __call__ case + w_meth = py_space.getattr(wp_rcvr, wp_attrname) + args_wp = [st_to_py(self.space(), a) for a in self.args_w] + # use call_args() to allow variable number of args_w + # (but this disables speed hacks in Pypy) + args = Arguments(py_space, args_wp) + self.set_result(W_PythonObject( + py_space.call_args(w_meth, args))) + elif len(self.args_w) == 1: # setattr when one argument + wp_value = st_to_py(self.space(), self.args_w[0]) + py_space.setattr(wp_rcvr, wp_attrname, wp_value) + self.set_result(W_PythonObject(py_space.w_None)) + else: # otherwise getattr + self.set_result(W_PythonObject( + py_space.getattr(wp_rcvr, wp_attrname))) + except OperationError as operr: + self.set_result(utils.operr_to_w_object(operr)) + except Exception as e: + self.fail('Unable to call %s on %s: %s' % ( + self.method_name, wp_rcvr, e)) def pre_resume(self): py_space.current_python_process.set(self) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 66014b75..05a11385 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,6 +1,5 @@ import os -from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.objspace import py_space @@ -66,7 +65,7 @@ def python_to_smalltalk(space, wp_object): elif isinstance(wp_object, WP_AbstractTupleObject): return space.wrap_list( [python_to_smalltalk(space, x) for x in wp_object.tolist()]) - elif wp_object is None or wp_object is py_space.w_None: + elif wp_object is py_space.w_None: return space.w_nil elif isinstance(wp_object, WP_IntObject): # WP_BoolObject inherits from WP_IntObject @@ -80,14 +79,14 @@ def python_to_smalltalk(space, wp_object): w_error_str = python_to_smalltalk(space, wp_object.descr_str(py_space)) return space.wrap_list([w_name, w_error_str]) print 'Cannot convert %s to Smalltalk' % wp_object - raise PrimitiveFailedError + return None @objectmodel.specialize.argtype(0) def smalltalk_to_python(space, w_object): if isinstance(w_object, W_PythonObject): return w_object.wp_object - elif w_object is None or w_object is space.w_nil: + elif w_object is space.w_nil: return py_space.w_None elif w_object is space.w_true: return py_space.w_True @@ -102,7 +101,7 @@ def smalltalk_to_python(space, w_object): return py_space.newtext(space.unwrap_string(w_object)) # import pdb; pdb.set_trace() print 'Cannot convert %s to Python' % w_object - raise PrimitiveFailedError + return None def get_restart_pycode(source, filename='', cmd='exec'): @@ -127,7 +126,6 @@ def get_restart_pycode(source, filename='', cmd='exec'): except OperationError as e: # import pdb; pdb.set_trace() print 'Failed to compile new frame: %s' % e.errorstr(py_space) - return def operr_to_w_object(operr): diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 544c0d80..e868ef86 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -10,8 +10,6 @@ from rsqueakvm.plugins.ruby.patching import patch_topaz from rsqueakvm.plugins.ruby.process import W_RubyProcess - from topaz.error import RubyError, print_traceback - IMPORT_FAILED = False except ImportError as e: try: @@ -51,7 +49,7 @@ def startup(space, argv): ruby_space.setup(argv[0]) @staticmethod - def new_language_process(space, args_w): + def new_eval_process(space, args_w): if (len(args_w) != 3): raise PrimitiveFailedError source_w = args_w[0] @@ -62,31 +60,19 @@ def new_language_process(space, args_w): source = space.unwrap_string(source_w) filepath = space.unwrap_string(filepath_w) break_on_exceptions = args_w[2] is space.w_true - return W_RubyProcess(source, filepath, break_on_exceptions) + return W_RubyProcess( + space, source=source, filepath=filepath, + break_on_exceptions=break_on_exceptions) @staticmethod - def w_object_class(): - return W_RubyObject + def new_send_process(space, w_rcvr, method_name, args_w): + return W_RubyProcess( + space, w_rcvr=w_rcvr, method_name=method_name, args_w=args_w, + is_send=True) @staticmethod - def perform_send(space, w_rcvr, methodname, args_w): - wr_rcvr = utils.smalltalk_to_ruby(space, w_rcvr) - args_rw = [utils.smalltalk_to_ruby(space, w_arg) for w_arg in args_w] - idx = methodname.find(':') - if idx > 0: - methodname = methodname[0:idx] - wr_result = None - try: - wr_result = ruby_space.send(wr_rcvr, methodname, args_w=args_rw) - except RubyError as e: - print_traceback(ruby_space, e.w_value) - raise PrimitiveFailedError - if wr_result is None: - # import pdb; pdb.set_trace() - print ('No result in send primitive (wr_rcvr: %s, methodname: %s)' - % (wr_rcvr, methodname)) - raise PrimitiveFailedError - return W_RubyObject(wr_result) + def w_object_class(): + return W_RubyObject @staticmethod def to_w_object(space, foreign_object): diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index 51164dea..c88f4e73 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -1,9 +1,10 @@ from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess +from rsqueakvm.plugins.ruby import utils from rsqueakvm.plugins.ruby.frame import WR_FrameObject from rsqueakvm.plugins.ruby.model import W_RubyObject from rsqueakvm.plugins.ruby.objspace import ruby_space -from topaz.error import RubyError +from topaz.error import RubyError, print_traceback from topaz.executioncontext import ExecutionContext @@ -11,13 +12,19 @@ class W_RubyProcess(W_ForeignLanguageProcess): _attrs_ = ['source', 'filepath', 'ec'] repr_classname = 'W_RubyProcess' - def __init__(self, source, filepath='-e', break_on_exceptions=True): - W_ForeignLanguageProcess.__init__(self, break_on_exceptions) + def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, + source=None, filepath=None, + is_send=False, break_on_exceptions=False): + W_ForeignLanguageProcess.__init__( + self, space, w_rcvr, method_name, args_w, + is_send, break_on_exceptions) self.source = source - self.filepath = filepath + self.filepath = filepath or '-e' self.ec = ExecutionContext() def run(self): + if self.source is None: + return self.fail('Invalid Ruby eval') print 'Ruby start' try: retval = ruby_space.execute(self.source, filepath=self.filepath) @@ -25,6 +32,28 @@ def run(self): except RubyError as e: self.set_result(W_RubyObject(e.w_value)) + def send(self): + wr_rcvr = utils.smalltalk_to_ruby(self.space(), self.w_rcvr) + if wr_rcvr is None: + return self.fail('wr_rcvr is None') + args_rw = [] + for w_arg in self.args_w: + arg_wr = utils.smalltalk_to_ruby(self.space(), w_arg) + if wr_rcvr is None: + return self.fail('wr_rcvr is None') + args_rw.append(arg_wr) + try: + wr_result = ruby_space.send( + wr_rcvr, self.method_name, args_w=args_rw) + self.set_result(W_RubyObject(wr_result)) + except RubyError as e: + print_traceback(ruby_space, e.w_value) + self.set_result(W_RubyObject(e.w_value)) + except: + # import pdb; pdb.set_trace() + self.fail('No result in send prim (wr_rcvr: %s, methodname: %s)' + % (wr_rcvr, self.method_name)) + def pre_resume(self): ruby_space.current_ruby_process.set(self) diff --git a/rsqueakvm/plugins/ruby/utils.py b/rsqueakvm/plugins/ruby/utils.py index d2306d02..9517b72b 100644 --- a/rsqueakvm/plugins/ruby/utils.py +++ b/rsqueakvm/plugins/ruby/utils.py @@ -1,4 +1,3 @@ -from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.numeric import W_Float, W_SmallInteger from rsqueakvm.plugins.ruby.model import W_RubyObject from rsqueakvm.plugins.ruby.objspace import ruby_space @@ -33,14 +32,14 @@ def ruby_to_smalltalk(space, wr_object): [ruby_to_smalltalk(space, x) for x in wr_object.listview(ruby_space)]) print 'Cannot convert %s to Smalltalk' % wr_object - raise PrimitiveFailedError + return None @objectmodel.specialize.argtype(0) def smalltalk_to_ruby(space, w_object): if isinstance(w_object, W_RubyObject): return w_object.wr_object - elif w_object is None or w_object is space.w_nil: + elif w_object is space.w_nil: return ruby_space.w_nil elif w_object is space.w_true: return ruby_space.w_true @@ -58,4 +57,4 @@ def smalltalk_to_ruby(space, w_object): if w_object.getclass(space).is_same_object(w_Symbol): return ruby_space.newsymbol(space.unwrap_string(w_object)) print 'Cannot convert %s to Ruby' % w_object - raise PrimitiveFailedError + return None From 28be8928b4bcd663da3eab2e311595adfbd67345 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 1 Apr 2017 12:29:34 +0200 Subject: [PATCH 162/193] Ensure wrap primitives do not return None --- rsqueakvm/plugins/foreign_language/__init__.py | 5 +---- rsqueakvm/plugins/python/utils.py | 4 ++-- rsqueakvm/plugins/ruby/process.py | 12 +++--------- rsqueakvm/plugins/ruby/utils.py | 5 +++-- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index d8eca397..5ad43e08 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -110,10 +110,7 @@ def getTopFrame(interp, s_frame, w_rcvr, language_process): def asSmalltalk(interp, s_frame, w_rcvr): if not isinstance(w_rcvr, self.w_object_class()): raise PrimitiveFailedError - w_result = self.to_w_object(interp.space, w_rcvr) - if w_result is None: - raise PrimitiveFailedError - return w_result + return self.to_w_object(interp.space, w_rcvr) @self.expose_primitive(unwrap_spec=[object, object]) def registerSpecificClass(interp, s_frame, w_rcvr, language_obj): diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 05a11385..3dc888a7 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -79,7 +79,7 @@ def python_to_smalltalk(space, wp_object): w_error_str = python_to_smalltalk(space, wp_object.descr_str(py_space)) return space.wrap_list([w_name, w_error_str]) print 'Cannot convert %s to Smalltalk' % wp_object - return None + return space.w_nil @objectmodel.specialize.argtype(0) @@ -101,7 +101,7 @@ def smalltalk_to_python(space, w_object): return py_space.newtext(space.unwrap_string(w_object)) # import pdb; pdb.set_trace() print 'Cannot convert %s to Python' % w_object - return None + return py_space.w_None def get_restart_pycode(source, filename='', cmd='exec'): diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index c88f4e73..32049328 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -33,15 +33,9 @@ def run(self): self.set_result(W_RubyObject(e.w_value)) def send(self): - wr_rcvr = utils.smalltalk_to_ruby(self.space(), self.w_rcvr) - if wr_rcvr is None: - return self.fail('wr_rcvr is None') - args_rw = [] - for w_arg in self.args_w: - arg_wr = utils.smalltalk_to_ruby(self.space(), w_arg) - if wr_rcvr is None: - return self.fail('wr_rcvr is None') - args_rw.append(arg_wr) + st_to_rb = utils.smalltalk_to_ruby + wr_rcvr = st_to_rb(self.space(), self.w_rcvr) + args_rw = [st_to_rb(self.space(), w_arg) for w_arg in self.args_w] try: wr_result = ruby_space.send( wr_rcvr, self.method_name, args_w=args_rw) diff --git a/rsqueakvm/plugins/ruby/utils.py b/rsqueakvm/plugins/ruby/utils.py index 9517b72b..bc55279e 100644 --- a/rsqueakvm/plugins/ruby/utils.py +++ b/rsqueakvm/plugins/ruby/utils.py @@ -12,6 +12,7 @@ from rpython.rlib import objectmodel +@objectmodel.specialize.argtype(0) def ruby_to_smalltalk(space, wr_object): if isinstance(wr_object, WR_FloatObject): return space.wrap_float(ruby_space.float_w(wr_object)) @@ -32,7 +33,7 @@ def ruby_to_smalltalk(space, wr_object): [ruby_to_smalltalk(space, x) for x in wr_object.listview(ruby_space)]) print 'Cannot convert %s to Smalltalk' % wr_object - return None + return space.w_nil @objectmodel.specialize.argtype(0) @@ -57,4 +58,4 @@ def smalltalk_to_ruby(space, w_object): if w_object.getclass(space).is_same_object(w_Symbol): return ruby_space.newsymbol(space.unwrap_string(w_object)) print 'Cannot convert %s to Ruby' % w_object - return None + return ruby_space.w_nil From dc02053a891df323054afb06f23952b85be39900 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 1 Apr 2017 16:10:10 +0200 Subject: [PATCH 163/193] Ensure inst var strings cannot be None --- rsqueakvm/plugins/foreign_language/process.py | 7 +++---- rsqueakvm/plugins/python/process.py | 8 ++++---- rsqueakvm/plugins/ruby/process.py | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index 142593ca..df3469db 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -43,8 +43,8 @@ def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, W_AbstractObjectWithIdentityHash.__init__(self) self._space = space self.w_rcvr = w_rcvr - self.method_name = method_name - self.args_w = args_w + self.method_name = method_name or '' + self.args_w = args_w or [] self._done = False self.w_result = None self.w_error = None @@ -126,8 +126,7 @@ def safe_run(self): self._done = True def guarded_send(self): - if (self.w_rcvr is None or self.method_name is None or - self.args_w is None): + if (self.w_rcvr is None or self.method_name == ''): error_msg = 'Invalid send (w_rcvr: %s, method: %s, args_w: %s)' % ( self.w_rcvr, self.method_name, self.args_w) print error_msg diff --git a/rsqueakvm/plugins/python/process.py b/rsqueakvm/plugins/python/process.py index 39407cf4..1b23bd44 100644 --- a/rsqueakvm/plugins/python/process.py +++ b/rsqueakvm/plugins/python/process.py @@ -17,13 +17,13 @@ def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, W_ForeignLanguageProcess.__init__( self, space, w_rcvr, method_name, args_w, is_send, break_on_exceptions) - self.source = source - self.filename = filename - self.cmd = cmd + self.source = source or '' + self.filename = filename or '' + self.cmd = cmd or '' self.ec = py_space.createexecutioncontext() def eval(self): - if self.source is None or self.filename is None or self.cmd is None: + if self.source == '' or self.filename == '' or self.cmd == '': return self.fail('Invalid Python eval') print 'Python start' try: diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index 32049328..aff02159 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -18,12 +18,12 @@ def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, W_ForeignLanguageProcess.__init__( self, space, w_rcvr, method_name, args_w, is_send, break_on_exceptions) - self.source = source + self.source = source or '' self.filepath = filepath or '-e' self.ec = ExecutionContext() def run(self): - if self.source is None: + if self.source == '': return self.fail('Invalid Ruby eval') print 'Ruby start' try: From 4272dbdcb28520d035791567508af50d24e15f79 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 1 Apr 2017 16:13:32 +0200 Subject: [PATCH 164/193] Avoid ProfilerPlugin patching when disabled --- rsqueakvm/plugins/profiler_plugin.py | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/rsqueakvm/plugins/profiler_plugin.py b/rsqueakvm/plugins/profiler_plugin.py index e8718c79..7c013171 100644 --- a/rsqueakvm/plugins/profiler_plugin.py +++ b/rsqueakvm/plugins/profiler_plugin.py @@ -12,18 +12,9 @@ from rpython.rlib.rjitlog import rjitlog -class ProfilerPlugin(Plugin): - - def patch(self): - patch_interpreter() - -plugin = ProfilerPlugin() - -# ____________________________________________________________ - def patch_interpreter(): - from rpython.rlib import rvmprof from rsqueakvm.interpreter import Interpreter + def _get_code(interp, s_frame, s_sender, may_context_switch=True): return s_frame.w_method() _decorator = rvmprof.vmprof_execute_code("rsqueak", _get_code) @@ -42,19 +33,31 @@ def _get_full_name(w_cm): # must not be longer than 255 chars return "st:%s:0:/img" % _safe(w_cm.safe_identifier_string()) -rvmprof.register_code_object_class(W_CompiledMethod, _get_full_name) - def patch_compiled_method(): def _my_post_init(self): from rpython.rlib import rvmprof rvmprof.register_code(self, _get_full_name) W_CompiledMethod.post_init = _my_post_init -patch_compiled_method() # ____________________________________________________________ +class ProfilerPlugin(Plugin): + + def is_optional(self): + return True + + def setup(self): + rvmprof.register_code_object_class(W_CompiledMethod, _get_full_name) + + def patch(self): + patch_interpreter() + patch_compiled_method() + +plugin = ProfilerPlugin() + + @plugin.expose_primitive(unwrap_spec=[object, int, float]) @jit.dont_look_inside def enableProfiler(interp, s_frame, w_rcvr, fileno, period): From ac966b2380c8a1ee0fa6a18889d0e5ff381c9d59 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 2 Apr 2017 13:33:32 +0200 Subject: [PATCH 165/193] Use #vmEval: and #vmResume: to minimize overhead --- rsqueakvm/plugins/foreign_language/process.py | 78 ++++++++++--------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index df3469db..40335c78 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -14,18 +14,12 @@ def __new__(cls, name, bases, attrs): if name != 'W_ForeignLanguageProcess': w_foreign_class = QuasiConstant(None, cls=W_PointersObject) - w_foreign_resume = QuasiConstant(None, cls=W_PointersObject) def foreign_class(self): return w_foreign_class.get() - def resume_method(self): - return w_foreign_resume.get() - attrs['w_foreign_class'] = w_foreign_class - attrs['w_foreign_resume'] = w_foreign_resume attrs['foreign_class'] = foreign_class - attrs['resume_method'] = resume_method return type.__new__(cls, name, bases, attrs) @@ -38,12 +32,15 @@ class W_ForeignLanguageProcess(W_AbstractObjectWithIdentityHash): '_is_send', '_break_on_exceptions'] repr_classname = 'W_ForeignLanguageProcess' - def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, + eval_method = QuasiConstant(None, cls=W_PointersObject) + resume_method = QuasiConstant(None, cls=W_PointersObject) + + def __init__(self, space, w_rcvr=None, method_name='', args_w=None, is_send=False, break_on_exceptions=False): W_AbstractObjectWithIdentityHash.__init__(self) self._space = space self.w_rcvr = w_rcvr - self.method_name = method_name or '' + self.method_name = method_name self.args_w = args_w or [] self._done = False self.w_result = None @@ -60,19 +57,31 @@ def space(self): @staticmethod def load_special_objects(cls, language_name, space): - foreign_class = space.smalltalk_at(language_name) - if foreign_class is None: + language_class = space.smalltalk_at(language_name) + if language_class is None: # disable plugin? print '%s class not found.' % language_name - cls.w_foreign_class.set(foreign_class) + cls.w_foreign_class.set(language_class) - resume_method_symbol = space.wrap_symbol('resume:') + # this part is called twice -> make better + foreign_class = space.smalltalk_at('ForeignLanguage') + + eval_method_symbol = space.wrap_symbol('vmEval:') foreign_cls_cls_s = foreign_class.getclass( space).as_class_get_shadow(space) - resume_method = foreign_cls_cls_s.lookup(resume_method_symbol) + eval_method = foreign_cls_cls_s.lookup(eval_method_symbol) + if eval_method is None: + print '%s class>>vmEval: method not found.' % language_name + W_ForeignLanguageProcess.eval_method.set(eval_method) + + resume_method_symbol = space.wrap_symbol('vmResume:') + foreign_cls_cls_s = foreign_class.getclass( + space).as_class_get_shadow(space) + resume_method = foreign_cls_cls_s.lookup( + resume_method_symbol) if resume_method is None: - print '%s class>>resume: method not found.' % language_name - cls.w_foreign_resume.set(resume_method) + print '%s class>>vmResume: method not found.' % language_name + W_ForeignLanguageProcess.resume_method.set(resume_method) # W_AbstractObjectWithIdentityHash overrides @@ -180,46 +189,45 @@ def break_on_exceptions(self): # Switching def switch_to_smalltalk(self, interp, s_frame, first_call=False): - from rsqueakvm.storage_contexts import ContextPartShadow - self.post_resume() - # print 'Switch to Smalltalk' if self.is_done(): return self._create_return_frame(interp.space) - s_resume_frame = ContextPartShadow.build_method_context( - interp.space, - self.resume_method(), - self.foreign_class(), - [self] - ) # import pdb; pdb.set_trace() if first_call: # attach s_frame with resume method for the first time + s_resume_frame = self._build_resume_method( + interp.space, is_eval=True) s_resume_frame.store_s_sender(s_frame) - elif s_frame.w_method() is self.resume_method(): - if s_frame.closure is None: - resume_frame = s_frame - else: - # up up, because there is an #on:do: in between - resume_frame = s_frame.s_sender().s_sender() + elif s_frame.w_method() is self.resume_method.get(): + s_resume_frame = self._build_resume_method(interp.space) + eval_frame = s_frame.s_sender() # Ensure #resume: method with closure = nil - if (resume_frame.w_method() is self.resume_method() and - resume_frame.closure is None): + if (eval_frame.w_method() is self.eval_method.get() and + eval_frame.closure is not None): # instead of chaining resume frames, store original sender - s_resume_frame.store_s_sender(resume_frame.s_sender()) + s_resume_frame.store_s_sender(eval_frame) else: - print ('Unexpected resume_frame found:\n%s' % + print ('Unexpected eval_frame found:\n%s' % s_frame.print_stack()) s_resume_frame.store_s_sender(s_frame) else: print 'Unexpected s_frame found:\n%s' % s_frame.print_stack() - s_resume_frame.store_s_sender(s_frame) + s_resume_frame = s_frame interp.quick_check_for_interrupt(s_resume_frame, dec=interp.interrupt_counter_size) # this will raise a ProcessSwitch if there are interrupts or timers ... return s_resume_frame + def _build_resume_method(self, space, is_eval=False): + from rsqueakvm.storage_contexts import ContextPartShadow + if is_eval: + method = self.eval_method.get() + else: + method = self.resume_method.get() + return ContextPartShadow.build_method_context( + space, method, self.foreign_class(), [self]) + def _create_return_frame(self, space): from rsqueakvm.storage_contexts import ContextPartShadow print 'Language has finished and returned a result.' From 0f9033dca2eb88e73866679a70962042e39231e6 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 2 Apr 2017 13:34:34 +0200 Subject: [PATCH 166/193] Add logging for language runner (DEBUG_LANG=true) --- rsqueakvm/plugins/foreign_language/process.py | 4 +++- rsqueakvm/plugins/foreign_language/runner.py | 10 +++++++--- rsqueakvm/plugins/foreign_language/utils.py | 6 ++++++ rsqueakvm/plugins/python/process.py | 17 +++++++++++------ rsqueakvm/plugins/ruby/process.py | 14 ++++++++------ 5 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 rsqueakvm/plugins/foreign_language/utils.py diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index 40335c78..1ceb7cd9 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -1,4 +1,5 @@ from rsqueakvm.plugins.foreign_language import runner +from rsqueakvm.plugins.foreign_language.utils import log from rsqueakvm.model.base import W_AbstractObjectWithIdentityHash from rsqueakvm.model.compiled_methods import ( W_PreSpurCompiledMethod, W_SpurCompiledMethod) @@ -190,6 +191,7 @@ def break_on_exceptions(self): def switch_to_smalltalk(self, interp, s_frame, first_call=False): self.post_resume() + log('Switching to Smalltalk...') if self.is_done(): return self._create_return_frame(interp.space) @@ -230,7 +232,7 @@ def _build_resume_method(self, space, is_eval=False): def _create_return_frame(self, space): from rsqueakvm.storage_contexts import ContextPartShadow - print 'Language has finished and returned a result.' + log('Language has finished and returned a result.') # we want evalInThread and resumePython to return new frames, # so we don't build up stack, but we also don't raise to the # top-level loop all the time. diff --git a/rsqueakvm/plugins/foreign_language/runner.py b/rsqueakvm/plugins/foreign_language/runner.py index 0fc1d6b3..32660917 100644 --- a/rsqueakvm/plugins/foreign_language/runner.py +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -1,3 +1,5 @@ +from rsqueakvm.plugins.foreign_language.utils import log + from rpython.rlib import rstacklet @@ -10,10 +12,12 @@ def language_process(self): return self._language_process def start(self): + log('Starting %s...' % self.language_process()) self.language_process().pre_resume() self.start_thread() def resume(self): + log('Resuming %s...' % self.language_process()) self.language_process().pre_resume() self.resume_thread() @@ -61,9 +65,9 @@ def switch_to_handle(self): return self.handle = self.sthread.switch(self.handle) if self.handle is self.sthread.get_null_handle(): - print 'language_process thread has finished1' + log('language_process thread has finished (handle is null)') if self.sthread.is_empty_handle(self.handle): - print 'language_process thread has finished2' + log('language_process thread has finished (handle is empty)') def _has_valid_handle(self): # TODO: make less verbose when this proved to work @@ -80,7 +84,7 @@ def _has_valid_handle(self): @staticmethod def new_stacklet_callback(h, arg): - print 'new_stacklet_callback:', h + log('new_stacklet_callback: %s' % h) self = global_execution_state.origin self.handle = h global_execution_state.clear() diff --git a/rsqueakvm/plugins/foreign_language/utils.py b/rsqueakvm/plugins/foreign_language/utils.py new file mode 100644 index 00000000..cbba0a35 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/utils.py @@ -0,0 +1,6 @@ +import os + + +def log(msg): + if os.environ.get('DEBUG_LANG'): + print msg diff --git a/rsqueakvm/plugins/python/process.py b/rsqueakvm/plugins/python/process.py index 1b23bd44..da812f60 100644 --- a/rsqueakvm/plugins/python/process.py +++ b/rsqueakvm/plugins/python/process.py @@ -11,21 +11,20 @@ class W_PythonProcess(W_ForeignLanguageProcess): _attrs_ = ['source', 'filename', 'cmd', 'ec'] repr_classname = 'W_PythonProcess' - def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, - source=None, filename=None, cmd=None, + def __init__(self, space, w_rcvr=None, method_name='', args_w=None, + source='', filename='', cmd='', is_send=False, break_on_exceptions=False): W_ForeignLanguageProcess.__init__( self, space, w_rcvr, method_name, args_w, is_send, break_on_exceptions) - self.source = source or '' - self.filename = filename or '' - self.cmd = cmd or '' + self.source = source + self.filename = filename + self.cmd = cmd self.ec = py_space.createexecutioncontext() def eval(self): if self.source == '' or self.filename == '' or self.cmd == '': return self.fail('Invalid Python eval') - print 'Python start' try: retval = utils._run_eval_string( self.source, self.filename, self.cmd) @@ -75,3 +74,9 @@ def w_top_frame(self): if topframe is None: return None return W_PythonObject(topframe) + + def guess_classname(self): + return self.repr_classname + + def str_content(self): + return self.cmd diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index aff02159..ca4194db 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -12,20 +12,19 @@ class W_RubyProcess(W_ForeignLanguageProcess): _attrs_ = ['source', 'filepath', 'ec'] repr_classname = 'W_RubyProcess' - def __init__(self, space, w_rcvr=None, method_name=None, args_w=None, - source=None, filepath=None, + def __init__(self, space, w_rcvr=None, method_name='', args_w=None, + source='', filepath='-e', is_send=False, break_on_exceptions=False): W_ForeignLanguageProcess.__init__( self, space, w_rcvr, method_name, args_w, is_send, break_on_exceptions) - self.source = source or '' - self.filepath = filepath or '-e' + self.source = source + self.filepath = filepath self.ec = ExecutionContext() - def run(self): + def eval(self): if self.source == '': return self.fail('Invalid Ruby eval') - print 'Ruby start' try: retval = ruby_space.execute(self.source, filepath=self.filepath) self.set_result(W_RubyObject(retval)) @@ -62,3 +61,6 @@ def w_top_frame(self): if topframe is None: return None return W_RubyObject(WR_FrameObject(topframe)) + + def guess_classname(self): + return self.repr_classname From 6430c74676370c69b978360e5bccbfcce2a01060 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 3 Apr 2017 11:36:02 +0200 Subject: [PATCH 167/193] Less verbose output by default --- rsqueakvm/plugins/python/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 3dc888a7..5db72534 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -1,6 +1,7 @@ import os from rsqueakvm.model.numeric import W_Float, W_SmallInteger +from rsqueakvm.plugins.foreign_language.utils import log from rsqueakvm.plugins.python.model import W_PythonObject from rsqueakvm.plugins.python.objspace import py_space from rsqueakvm.model.variable import W_BytesObject @@ -105,7 +106,7 @@ def smalltalk_to_python(space, w_object): def get_restart_pycode(source, filename='', cmd='exec'): - print 'Trying to patch:\n%s' % source + log('Trying to patch:\n%s' % source) try: py_code = py_compiling.compile(py_space, py_space.newtext(source), filename, cmd) @@ -117,10 +118,10 @@ def get_restart_pycode(source, filename='', cmd='exec'): co_consts_w_len = len(py_code.co_consts_w) if co_consts_w_len >= 1: if co_consts_w_len > 1: - print 'More than 1 const produced: %s' % co_consts_w_len + log('More than 1 const produced: %s' % co_consts_w_len) first_consts_w = py_code.co_consts_w[0] if not isinstance(first_consts_w, PyCode): - print 'First const is not a PyCode' + log('First const is not a PyCode') return py_code return first_consts_w except OperationError as e: From 24d9fa9855b9062e8ba1b3228ded0553cb2d84d8 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 3 Apr 2017 11:36:57 +0200 Subject: [PATCH 168/193] Temporary fix for get_lineno; minor improvements --- rsqueakvm/plugins/ruby/frame.py | 16 ++++++++-------- rsqueakvm/plugins/ruby/process.py | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/rsqueakvm/plugins/ruby/frame.py b/rsqueakvm/plugins/ruby/frame.py index be02198d..dc7cba0f 100644 --- a/rsqueakvm/plugins/ruby/frame.py +++ b/rsqueakvm/plugins/ruby/frame.py @@ -15,7 +15,7 @@ def __init__(self, frame_object): @classdef.method('to_s') def method_to_s(self, space): return space.newstr_fromstr( - 'Wrapped topaz frame (%s)' % self.frame_object) + 'wrapped topaz frame (%s)' % self.frame_object) @classdef.method('get_previous') def method_get_previous(self, space): @@ -33,13 +33,13 @@ def method_get_filename(self, space): return space.newstr_fromstr(self.frame_object.get_filename()) @classdef.method('get_lineno') - def method_get_lineno(self, space, prev_wr_frame=None): - prev_frame = None - if prev_wr_frame is not None: - if not isinstance(prev_wr_frame, WR_FrameObject): - return space.w_nil - prev_frame = prev_wr_frame.frame_object - return space.newint(self.frame_object.get_lineno(prev_frame)) + def method_get_lineno(self, space): + # prev_frame = None + # if prev_wr_frame is not None: + # if not isinstance(prev_wr_frame, WR_FrameObject): + # return space.w_nil + # prev_frame = prev_wr_frame.frame_object + return space.newint(self.frame_object.get_lineno(None)) @classdef.method('get_code_name') def method_get_code_name(self, space): diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index ca4194db..7713bfe9 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -42,10 +42,11 @@ def send(self): except RubyError as e: print_traceback(ruby_space, e.w_value) self.set_result(W_RubyObject(e.w_value)) - except: + except Exception as e: # import pdb; pdb.set_trace() - self.fail('No result in send prim (wr_rcvr: %s, methodname: %s)' - % (wr_rcvr, self.method_name)) + self.fail( + 'No result in send prim (wr_rcvr: %s, methodname: %s, "%s")' + % (wr_rcvr, self.method_name, e)) def pre_resume(self): ruby_space.current_ruby_process.set(self) From 635e893881260afed7fa00a47efde8645deab9a2 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 3 Apr 2017 16:10:59 +0200 Subject: [PATCH 169/193] Move trace_pointers() to W_Object classes --- rsqueakvm/model/base.py | 3 +++ rsqueakvm/model/block_closure.py | 4 ++++ rsqueakvm/model/compiled_methods.py | 4 ++++ rsqueakvm/model/pointers.py | 4 ++++ rsqueakvm/primitives/storage.py | 11 +---------- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/rsqueakvm/model/base.py b/rsqueakvm/model/base.py index 1c047db9..592a6afd 100644 --- a/rsqueakvm/model/base.py +++ b/rsqueakvm/model/base.py @@ -83,6 +83,9 @@ def store(self, space, n0, w_value): consult the Blue Book).""" raise NotImplementedError() + def trace_pointers(self, space): + return [self.getclass(space)] + def fillin(self, space, g_self): raise NotImplementedError() diff --git a/rsqueakvm/model/block_closure.py b/rsqueakvm/model/block_closure.py index be7041cc..942a64a0 100644 --- a/rsqueakvm/model/block_closure.py +++ b/rsqueakvm/model/block_closure.py @@ -67,6 +67,10 @@ def __init__(self, space, w_outerctxt, startpc, numArgs, size, stack=None): self._fillin_w_method(space) self._fillin_w_receiver(space) + def trace_pointers(self, space): + ptrs = W_AbstractObjectWithIdentityHash.trace_pointers(self, space) + return ptrs + self.fetch_all(space) + def fillin(self, space, g_self): W_AbstractObjectWithIdentityHash.fillin(self, space, g_self) self._startpc_stacklen_args = r_uint(0) diff --git a/rsqueakvm/model/compiled_methods.py b/rsqueakvm/model/compiled_methods.py index 8af2138b..34697c17 100644 --- a/rsqueakvm/model/compiled_methods.py +++ b/rsqueakvm/model/compiled_methods.py @@ -112,6 +112,10 @@ def post_init(self): # A hook, usually left empty, but patched e.g. in profiler_plugin pass + def trace_pointers(self, space): + ptrs = W_AbstractObjectWithIdentityHash.trace_pointers(self, space) + return ptrs + self.literals + # === Setters === def setheader(self, space, header, initializing=False): diff --git a/rsqueakvm/model/pointers.py b/rsqueakvm/model/pointers.py index 055be276..ff397ff3 100644 --- a/rsqueakvm/model/pointers.py +++ b/rsqueakvm/model/pointers.py @@ -25,6 +25,10 @@ def _initialize_storage(self, space, w_class, size, weak=False): storage_type = space.strategy_factory.empty_storage_type(self, size, weak) space.strategy_factory.set_initial_strategy(self, storage_type, w_class, size) + def trace_pointers(self, space): + ptrs = W_AbstractObjectWithIdentityHash.trace_pointers(self, space) + return ptrs + self.fetch_all(space) + def fillin(self, space, g_self): W_AbstractObjectWithIdentityHash.fillin(self, space, g_self) # Recursive fillin required to enable specialized storage strategies. diff --git a/rsqueakvm/primitives/storage.py b/rsqueakvm/primitives/storage.py index 4f5eb628..689a201d 100644 --- a/rsqueakvm/primitives/storage.py +++ b/rsqueakvm/primitives/storage.py @@ -181,18 +181,9 @@ def get_instances_array_trace(interp, w_class, some_instance=False): return [w_obj] else: result_w.append(w_obj) - pending.extend(_trace_pointers(interp.space, w_obj)) + pending.extend(w_obj.trace_pointers(interp.space)) return result_w -def _trace_pointers(space, w_obj): - p_w = [w_obj.getclass(space)] - if isinstance(w_obj, W_CompiledMethod): - p_w.extend(w_obj.literals) - elif isinstance(w_obj, W_PointersObject): - p_w.extend(w_obj.fetch_all(space)) - elif isinstance(w_obj, W_BlockClosure): - p_w.extend(w_obj.fetch_all(space)) - return p_w def get_instances_array(interp, s_frame, w_class=None, store=True, some_instance=False): From f79257b4dbbc7211785fd00030db6bf3afd37a33 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 3 Apr 2017 22:10:23 +0200 Subject: [PATCH 170/193] Fix memory leak (e.g. Process allSubInstances) This avoid the generation of new classes whenever getclass() is called. For now, this means that ForeignLanguage allInstances is not supported. --- rsqueakvm/plugins/foreign_language/model.py | 29 ++++++++++++++++----- rsqueakvm/plugins/python/model.py | 6 ++--- rsqueakvm/plugins/ruby/model.py | 6 ++--- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py index b8d9821f..c2c42192 100644 --- a/rsqueakvm/plugins/foreign_language/model.py +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -28,12 +28,21 @@ def pure_class_shadow(self, space): return type.__new__(cls, name, bases, attrs) +def _initialize_w_class(foreign_obj): + foreign_obj.initialize_w_class() + return foreign_obj.w_class + + class W_ForeignLanguageObject(W_AbstractObjectWithIdentityHash): __metaclass__ = W_ForeignLanguageObjectMeta - _attrs_ = [] - _immutable_fields_ = [] + _attrs_ = ['w_class'] + _immutable_fields_ = ['w_class'] repr_classname = 'W_ForeignLanguageObject' + def __init__(self): + W_AbstractObjectWithIdentityHash.__init__(self) + self.w_class = None + # W_AbstractObjectWithIdentityHash overrides def at0(self, space, index0): @@ -48,16 +57,24 @@ def fetch(self, space, n0): def store(self, space, n0, w_value): pass - # Abstract methods + def trace_pointers(self, space): + "allInstances not supported" + return [] def getclass(self, space): - raise NotImplementedError + return jit.conditional_call_elidable( + self.w_class, _initialize_w_class, self) + + def class_shadow(self, space): + return self.pure_class_shadow(space) + + # Abstract methods def getforeignclass(self): raise NotImplementedError - def class_shadow(self, space): - return self.pure_class_shadow(space) + def initialize_w_class(self): + raise NotImplementedError def is_same_object(self, other): raise NotImplementedError diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 3a1771dd..8cc4dca5 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -14,12 +14,12 @@ def __init__(self, wp_object): W_ForeignLanguageObject.__init__(self) self.wp_object = wp_object - def getclass(self, space): - return W_PythonObject(self.wp_object.getclass(py_space)) - def getforeignclass(self): return py_space.type(self.wp_object) + def initialize_w_class(self): + self.w_class = W_PythonObject(self.wp_object.getclass(py_space)) + def guess_classname(self): return self.getforeignclass().getname(py_space) diff --git a/rsqueakvm/plugins/ruby/model.py b/rsqueakvm/plugins/ruby/model.py index ccea9724..178a057f 100644 --- a/rsqueakvm/plugins/ruby/model.py +++ b/rsqueakvm/plugins/ruby/model.py @@ -12,12 +12,12 @@ def __init__(self, wr_object): W_ForeignLanguageObject.__init__(self) self.wr_object = wr_object - def getclass(self, space): - return W_RubyObject(self.wr_object.getclass(ruby_space)) - def getforeignclass(self): return ruby_space.getclass(self.wr_object) + def initialize_w_class(self): + self.w_class = W_RubyObject(self.wr_object.getclass(ruby_space)) + def guess_classname(self): return self.getforeignclass().name From 6732e4bf30d20f817139ab6b09d0601390da152f Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Mon, 3 Apr 2017 00:12:58 +0200 Subject: [PATCH 171/193] Make stack_frame no longer take a default argument make life easier for annotating rvmprof --- rsqueakvm/interpreter.py | 6 +++--- rsqueakvm/interpreter_bytecodes.py | 4 ++-- rsqueakvm/plugins/profiler_plugin.py | 2 +- rsqueakvm/plugins/simulation.py | 2 +- rsqueakvm/plugins/tailcall_plugin.py | 4 ++-- rsqueakvm/test/test_interpreter.py | 2 +- rsqueakvm/test/util.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rsqueakvm/interpreter.py b/rsqueakvm/interpreter.py index 9abf651b..42929f0c 100644 --- a/rsqueakvm/interpreter.py +++ b/rsqueakvm/interpreter.py @@ -226,7 +226,7 @@ def loop(self, w_active_context): s_context=s_context) s_sender = s_context.s_sender() try: - self.stack_frame(s_context, None) + self.stack_frame(s_context, None, True) raise Exception("loop_bytecodes left without raising...") except ProcessSwitch, e: if self.is_tracing() or self.trace_important: @@ -264,7 +264,7 @@ def loop(self, w_active_context): # This is a wrapper around loop_bytecodes that cleanly enters/leaves the frame, # handles the stack overflow protection mechanism and handles/dispatches Returns. - def stack_frame(self, s_frame, s_sender, may_context_switch=True): + def stack_frame(self, s_frame, s_sender, may_context_switch): if self.is_tracing(): self.stack_depth += 1 vref = s_frame.enter_virtual_frame(s_sender) @@ -306,7 +306,7 @@ def getreceiverclass(self, s_context): def getblockmethod(self, s_context): return s_context.blockmethod - def loop_bytecodes(self, s_context, may_context_switch=True): + def loop_bytecodes(self, s_context, may_context_switch): old_pc = 0 if not jit.we_are_jitted() and may_context_switch: self.quick_check_for_interrupt(s_context) diff --git a/rsqueakvm/interpreter_bytecodes.py b/rsqueakvm/interpreter_bytecodes.py index c8a46346..ec4bae2b 100644 --- a/rsqueakvm/interpreter_bytecodes.py +++ b/rsqueakvm/interpreter_bytecodes.py @@ -349,7 +349,7 @@ def _sendSelector(self, w_selector, argcount, interp, receiver, if interp.is_tracing(): interp.print_padded('-> ' + s_frame.short_str()) - return interp.stack_frame(s_frame, self) + return interp.stack_frame(s_frame, self, True) def _invokeObjectAsMethod(self, w_selector, argcount, interp, w_receiver): args_w = self.pop_and_return_n(argcount) @@ -390,7 +390,7 @@ def _sendSpecialSelector(self, interp, receiver, special_selector, w_args=[]): if interp.is_tracing(): interp.print_padded('-> %s %s' % (special_selector, s_frame.short_str())) - return interp.stack_frame(s_frame, self) + return interp.stack_frame(s_frame, self, True) def _doesNotUnderstand(self, w_selector, argcount, interp, receiver): arguments = self.pop_and_return_n(argcount) diff --git a/rsqueakvm/plugins/profiler_plugin.py b/rsqueakvm/plugins/profiler_plugin.py index 7c013171..49b41ee1 100644 --- a/rsqueakvm/plugins/profiler_plugin.py +++ b/rsqueakvm/plugins/profiler_plugin.py @@ -15,7 +15,7 @@ def patch_interpreter(): from rsqueakvm.interpreter import Interpreter - def _get_code(interp, s_frame, s_sender, may_context_switch=True): + def _get_code(interp, s_frame, s_sender, may_context_switch): return s_frame.w_method() _decorator = rvmprof.vmprof_execute_code("rsqueak", _get_code) _my_stack_frame = _decorator(Interpreter.stack_frame) diff --git a/rsqueakvm/plugins/simulation.py b/rsqueakvm/plugins/simulation.py index f2f0e9e0..725d2959 100644 --- a/rsqueakvm/plugins/simulation.py +++ b/rsqueakvm/plugins/simulation.py @@ -49,7 +49,7 @@ def _simulate(self, w_name, interp, s_frame, argcount, w_method): oldinterrupt_check_ctr = interp.interrupt_check_counter interp.interrupt_check_counter = constants.MAXINT try: - interp.stack_frame(s_sim_frame, s_frame) + interp.stack_frame(s_sim_frame, s_frame, True) finally: interp.interrupt_check_counter = oldinterrupt_check_ctr - 1 diff --git a/rsqueakvm/plugins/tailcall_plugin.py b/rsqueakvm/plugins/tailcall_plugin.py index 52829c08..4d21338c 100644 --- a/rsqueakvm/plugins/tailcall_plugin.py +++ b/rsqueakvm/plugins/tailcall_plugin.py @@ -38,7 +38,7 @@ def _patch_interpreter(): from rsqueakvm.interpreter import Interpreter original_stack_frame = Interpreter.stack_frame @jit.unroll_safe - def stack_frame(self, s_frame, old_s_frame): + def stack_frame(self, s_frame, old_s_frame, may_context_switch): if old_s_frame.is_tailcall_context() \ and s_frame.w_method() is old_s_frame.w_method() \ and old_s_frame.pc() == s_frame.w_method.end_pc(): @@ -49,7 +49,7 @@ def stack_frame(self, s_frame, old_s_frame): import pdb; pdb.set_trace() old_s_frame.initialize_temps(self.space, w_arguments) else: - return original_stack_frame(self, s_frame, old_s_frame) + return original_stack_frame(self, s_frame, old_s_frame, may_context_switch) Interpreter.stack_frame = stack_frame diff --git a/rsqueakvm/test/test_interpreter.py b/rsqueakvm/test/test_interpreter.py index 4288f11a..4ea114ce 100644 --- a/rsqueakvm/test/test_interpreter.py +++ b/rsqueakvm/test/test_interpreter.py @@ -1016,7 +1016,7 @@ def test_raise_NonVirtualReturn_on_dirty_frame(): interp._loop = True def do_test(): - interp.stack_frame(s_frame, None) + interp.stack_frame(s_frame, None, True) py.test.raises(interpreter.NonVirtualReturn, do_test) diff --git a/rsqueakvm/test/util.py b/rsqueakvm/test/util.py index 61fa70d1..719824d7 100644 --- a/rsqueakvm/test/util.py +++ b/rsqueakvm/test/util.py @@ -158,7 +158,7 @@ def loop(self, w_active_context): self._loop = True return interpreter.Interpreter.loop(self, w_active_context) - def stack_frame(self, s_new_frame, s_sender, may_context_switch=True): + def stack_frame(self, s_new_frame, s_sender, may_context_switch): if not self._loop: # this test is done to not loop in test, but rather step just once where wanted # Unfortunately, we have to mimick some of the original behaviour. From 25cc922e847ea585f3474a497694b1c14d029303 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 4 Apr 2017 22:11:03 +0200 Subject: [PATCH 172/193] Revert "Disable _vmprof in PyPy" This reverts commit 07f97d675029d71c2e9c3260042da1df85a5d157. --- rsqueakvm/plugins/python/objspace.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/rsqueakvm/plugins/python/objspace.py b/rsqueakvm/plugins/python/objspace.py index c074de49..720bab4d 100644 --- a/rsqueakvm/plugins/python/objspace.py +++ b/rsqueakvm/plugins/python/objspace.py @@ -20,9 +20,6 @@ def new_pypy_objspace(): pypy_config.objspace.usemodules.micronumpy = False pypy_config.objspace.usemodules.cppyy = False - # disable vmprof - pypy_config.objspace.usemodules._vmprof = False - # cpyext causes a lot of 'Undefined symbols for architecture x86_64' errors pypy_config.objspace.usemodules.cpyext = False From 1ddc4ca4aa3194598e487a4fd79b3f7fb76fb135 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 6 Apr 2017 14:18:45 +0200 Subject: [PATCH 173/193] Fix segfault when opening an image w/o FL support --- rsqueakvm/plugins/foreign_language/__init__.py | 4 ++-- rsqueakvm/plugins/foreign_language/process.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 5ad43e08..56f370b6 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -12,8 +12,8 @@ def __init__(self): self.register_default_primitives() @staticmethod - def load_special_objects(space, language_name, language_cls, shadow_cls): - language_cls.load_special_objects(language_cls, language_name, space) + def load_special_objects(space, language_name, process_cls, shadow_cls): + process_cls.load_special_objects(process_cls, language_name, space) shadow_cls.load_special_objects(shadow_cls, language_name, space) # Abstract methods diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index 1ceb7cd9..055b0b98 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -67,6 +67,10 @@ def load_special_objects(cls, language_name, space): # this part is called twice -> make better foreign_class = space.smalltalk_at('ForeignLanguage') + if foreign_class is None: + print 'ForeignLanguage class not found.' + return + eval_method_symbol = space.wrap_symbol('vmEval:') foreign_cls_cls_s = foreign_class.getclass( space).as_class_get_shadow(space) From 2c8d93296c2137b180e006f6bd12427421f315b8 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 28 Apr 2017 16:46:50 +0200 Subject: [PATCH 174/193] Refactor and clean up runner.py --- rsqueakvm/plugins/foreign_language/runner.py | 46 ++++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/runner.py b/rsqueakvm/plugins/foreign_language/runner.py index 32660917..68eddbc1 100644 --- a/rsqueakvm/plugins/foreign_language/runner.py +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -1,6 +1,6 @@ from rsqueakvm.plugins.foreign_language.utils import log -from rpython.rlib import rstacklet +from rpython.rlib.rstacklet import StackletThread class AbstractLanguageRunner(): @@ -14,26 +14,26 @@ def language_process(self): def start(self): log('Starting %s...' % self.language_process()) self.language_process().pre_resume() - self.start_thread() + self._start_thread() def resume(self): log('Resuming %s...' % self.language_process()) self.language_process().pre_resume() - self.resume_thread() + self._resume_thread() def return_to_smalltalk(self): - self.yield_thread() + self._yield_thread() - def start_thread(self): + def resumable(self): raise NotImplementedError - def resume_thread(self): + def _start_thread(self): raise NotImplementedError - def resumable(self): + def _resume_thread(self): raise NotImplementedError - def yield_thread(self): + def _yield_thread(self): raise NotImplementedError @@ -42,24 +42,24 @@ class StackletLanguageRunner(AbstractLanguageRunner): def __init__(self, language_process): AbstractLanguageRunner.__init__(self, language_process) - self.sthread = rstacklet.StackletThread() + self.sthread = StackletThread() # there can only be one valid handle at a time (main or foreign thread) self.handle = self.sthread.get_null_handle() - def start_thread(self): + def resumable(self): + return self._has_valid_handle() + + def _start_thread(self): global_execution_state.origin = self self.handle = self.sthread.new(self.__class__.new_stacklet_callback) - def resume_thread(self): - self.switch_to_handle() - - def resumable(self): - return self._has_valid_handle() + def _resume_thread(self): + self._switch_to_handle() - def yield_thread(self): - self.switch_to_handle() + def _yield_thread(self): + self._switch_to_handle() - def switch_to_handle(self): + def _switch_to_handle(self): if not self._has_valid_handle(): print 'handle not valid: %s' % self.handle return @@ -94,19 +94,19 @@ def new_stacklet_callback(h, arg): class GreenletLanguageRunner(AbstractLanguageRunner): - def start_thread(self): + def _start_thread(self): from greenlet import greenlet global_execution_state.origin = self self.greenlet = greenlet(self.__class__.new_greenlet_callback()) self.resume() # stacklets also start immediately - def resume_thread(self): - self.greenlet.switch() - def resumable(self): return not self.greenlet.dead - def yield_thread(self): + def _resume_thread(self): + self.greenlet.switch() + + def _yield_thread(self): self.greenlet.parent.switch() @staticmethod From 346f83a92fd0d16d2b21789e5a4cdffee009876b Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 28 Apr 2017 16:47:50 +0200 Subject: [PATCH 175/193] In-image: use FL namespace, minor changes [ci skip] --- .../class/checkForException..st | 2 +- .../class/compilePrimitivesIn..st | 8 ++++++++ .../class/findResumeFrame..st | 2 +- .../class/getFilename..st | 3 +++ .../class/newForeignContextFor..st | 2 +- .../class/openDebuggerOn.languageProcess..st | 2 +- .../ForeignLanguage.class/class/primEval..st | 4 ++++ .../class/primGetTopFrame..st | 3 ++- .../class/primLastError..st | 4 ++++ .../class/primRestartSpecificFrame..st | 4 ++++ .../class/primResume..st | 4 ++++ ...ariableNames.poolDictionaries.category..st | 6 ++++++ .../ForeignLanguage.class/class/vmEval..st | 5 +++++ .../ForeignLanguage.class/class/vmResume..st | 5 +++++ .../methodProperties.json | 19 ++++++++++++++----- .../instance/explore.st | 2 +- .../instance/inspect.st | 2 +- .../instance/inspectorClass.st | 2 +- .../methodProperties.json | 6 +++--- .../monticello.meta/version | 2 +- .../FLException.class}/README.md | 0 .../FLException.class}/instance/action..st | 0 .../FLException.class}/instance/action.st | 0 .../instance/defaultAction.st | 0 .../FLException.class}/methodProperties.json | 0 .../FLException.class}/properties.json | 4 ++-- .../README.md | 0 .../class/newFor..st | 2 +- .../instance/foreignFrame..st | 0 .../instance/foreignFrame.st | 0 .../instance/isForeign.st | 0 .../instance/languageClass.st | 0 .../instance/languageSymbol.st | 0 .../instance/printOn..st | 0 .../instance/sender..st | 0 .../setSender.receiver.method.arguments..st | 0 .../instance/tempNames.st | 0 .../methodProperties.json | 2 +- .../properties.json | 2 +- .../README.md | 0 .../class/highlightPython..st | 0 .../class/highlightRuby..st | 0 .../instance/isForeign.st | 0 .../instance/languageClass.st | 0 .../instance/languageSymbol..st | 0 .../instance/languageSymbol.st | 0 .../instance/privateFormat..st | 0 .../instance/style..st | 0 .../instance/style.foreignClass..st | 0 .../instance/styleInBackgroundProcess..st | 0 .../methodProperties.json | 0 .../properties.json | 2 +- .../README.md | 0 .../FLToolSet.class/class/browse.selector..st | 3 +++ .../FLToolSet.class/class/browseClass..st | 3 +++ .../class/browseClass.category..st | 2 +- .../class/browseMessageCategory.inClass..st | 2 +- .../debug.context.label.contents.fullView..st | 2 +- .../class/debugContext.label.contents..st | 2 +- .../FLToolSet.class/class/explore..st | 4 ++++ .../class/initialize.st | 0 .../class/inspectorClassOf..st | 2 +- .../class/interrupt.label..st | 2 +- .../class/menuItems.st | 0 .../FLToolSet.class/class/openClassBrowser.st | 3 +++ .../class/openForeignLanguageBrowser.st | 2 +- .../class/openForeignLanguageWorkspace.st | 2 +- .../FLToolSet.class/methodProperties.json | 18 ++++++++++++++++++ .../properties.json | 2 +- .../class/browse.selector..st | 3 --- .../class/browseClass..st | 3 --- .../class/explore..st | 4 ---- .../class/openClassBrowser.st | 3 --- .../methodProperties.json | 18 ------------------ .../monticello.meta/version | 2 +- .../README.md | 0 .../instance/aboutToStyle..st | 0 .../instance/addModelItemsToWindowMenu..st | 0 .../instance/buildCodePaneWith..st | 2 +- .../instance/currentLanguageSymbol.st | 0 .../instance/defaultBrowserTitle.st | 0 .../instance/defaultStylerClass.st | 2 +- .../instance/defineMessageFrom.notifying..st | 0 .../instance/doItReceiver.st | 0 .../instance/isForeign.st | 0 .../instance/isPython.st | 0 .../instance/isRuby.st | 0 .../instance/isSmalltalk.st | 0 .../instance/labelString.st | 0 .../instance/languageSymbol..st | 0 .../instance/languageSymbol.st | 0 .../instance/selectLanguage..st | 0 .../instance/selectedMessage.st | 0 .../instance/systemCategoryList.st | 0 ...idateMessageSource.forSelector.inClass..st | 0 .../methodProperties.json | 4 ++-- .../properties.json | 2 +- .../README.md | 0 .../instance/fieldList.st | 4 ++++ .../instance/selection.st | 4 ++-- .../methodProperties.json | 6 ++++++ .../properties.json | 2 +- .../README.md | 0 .../instance/aboutToStyle..st | 0 .../instance/buildCodePaneWith..st | 2 +- .../instance/contents.notifying..st | 2 +- .../instance/defaultStylerClass.st | 2 +- .../FLDebugger.class/instance/expandStack.st | 5 +++++ .../instance/guessTypeForName..st | 0 .../instance/isPython.st | 0 .../instance/isRuby.st | 0 .../instance/languageSymbol.st | 0 .../instance/messageIconAt..st | 0 .../instance/pcRange.st | 0 .../instance/process.controller.context..st | 8 ++++++++ .../instance/selectedMessage.st | 0 .../methodProperties.json | 9 +++++---- .../properties.json | 2 +- .../README.md | 0 .../instance/aboutToStyle..st | 0 .../instance/buildCodePaneWith..st | 2 +- .../instance/contentsIsString.st | 0 .../instance/evaluateExpression..st | 0 .../instance/fieldList.st | 0 .../instance/languageClass.st | 0 .../instance/selection.st | 0 .../methodProperties.json | 2 +- .../properties.json | 2 +- .../README.md | 0 .../instance/aboutToStyle..st | 0 .../instance/buildWith..st | 2 +- .../methodProperties.json | 2 +- .../properties.json | 2 +- .../README.md | 0 .../class/open.st | 0 .../class/windowTitlePrefix.st | 0 .../instance/aboutToStyle..st | 0 .../instance/addModelItemsToWindowMenu..st | 0 .../instance/breakOnExceptions..st | 0 .../instance/breakOnExceptions.st | 0 .../instance/breakOnExceptionsText.st | 0 .../instance/buildCodePaneWith..st | 2 +- .../instance/evaluateExpression..st | 0 .../instance/isForeign.st | 0 .../instance/labelString.st | 0 .../instance/languageClass.st | 0 .../instance/languageSymbol..st | 0 .../instance/languageSymbol.st | 0 .../instance/selectLanguage..st | 0 .../instance/toggleBreakOnExceptions.st | 0 .../methodProperties.json | 2 +- .../properties.json | 2 +- .../methodProperties.json | 5 ----- .../instance/expandStack.st | 5 ----- .../monticello.meta/version | 2 +- .../Python.class/class/getFilename..st | 3 +++ .../Python.class/class/highlight..st | 2 +- .../Python.class/class/restartFrame.with..st | 2 +- .../Python.class/class/resume..st | 7 ------- .../Python.class/class/setUpPygments.st | 2 +- .../Python.class/methodProperties.json | 8 ++++---- .../PythonObject.class/methodProperties.json | 2 +- .../class/addScrollables..st | 2 +- .../PythonTheme.class/instance/stylerClass.st | 2 +- .../PythonTheme.class/methodProperties.json | 4 ++-- .../monticello.meta/version | 2 +- .../Ruby.class/class/debuggerPrintItem.on..st | 2 +- .../Ruby.class/class/getFilename..st | 3 +++ .../Ruby.class/class/highlight..st | 2 +- .../Ruby.class/class/pcRange..st | 7 ++++++- .../Ruby.class/class/primGetTopFrame.st | 4 ---- .../Ruby.class/class/resume..st | 7 ------- .../Ruby.class/methodProperties.json | 9 ++++----- .../Ruby-Core.package/monticello.meta/version | 2 +- 174 files changed, 199 insertions(+), 140 deletions(-) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getFilename..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primEval..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primRestartSpecificFrame..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmEval..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmResume..st rename repository/{ForeignLanguage-Core.package/ForeignLanguageException.class => ForeignLanguage-Support.package/FLException.class}/README.md (100%) rename repository/{ForeignLanguage-Core.package/ForeignLanguageException.class => ForeignLanguage-Support.package/FLException.class}/instance/action..st (100%) rename repository/{ForeignLanguage-Core.package/ForeignLanguageException.class => ForeignLanguage-Support.package/FLException.class}/instance/action.st (100%) rename repository/{ForeignLanguage-Core.package/ForeignLanguageException.class => ForeignLanguage-Support.package/FLException.class}/instance/defaultAction.st (100%) rename repository/{ForeignLanguage-Core.package/ForeignLanguageException.class => ForeignLanguage-Support.package/FLException.class}/methodProperties.json (100%) rename repository/{ForeignLanguage-Core.package/ForeignLanguageException.class => ForeignLanguage-Support.package/FLException.class}/properties.json (68%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/README.md (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/class/newFor..st (84%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/foreignFrame..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/foreignFrame.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/isForeign.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/languageClass.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/languageSymbol.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/printOn..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/sender..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/setSender.receiver.method.arguments..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/instance/tempNames.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/methodProperties.json (91%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageMethodContext.class => FLMethodContext.class}/properties.json (84%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/README.md (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/class/highlightPython..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/class/highlightRuby..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/instance/isForeign.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/instance/languageClass.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/instance/languageSymbol..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/instance/languageSymbol.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/instance/privateFormat..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/instance/style..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/instance/style.foreignClass..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/instance/styleInBackgroundProcess..st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/methodProperties.json (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageTextStyler.class => FLTextStyler.class}/properties.json (85%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/README.md (100%) create mode 100644 repository/ForeignLanguage-Support.package/FLToolSet.class/class/browse.selector..st create mode 100644 repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass..st rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/browseClass.category..st (73%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/browseMessageCategory.inClass..st (76%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/debug.context.label.contents.fullView..st (56%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/debugContext.label.contents..st (59%) create mode 100644 repository/ForeignLanguage-Support.package/FLToolSet.class/class/explore..st rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/initialize.st (100%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/inspectorClassOf..st (54%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/interrupt.label..st (78%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/menuItems.st (100%) create mode 100644 repository/ForeignLanguage-Support.package/FLToolSet.class/class/openClassBrowser.st rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/openForeignLanguageBrowser.st (57%) rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/class/openForeignLanguageWorkspace.st (57%) create mode 100644 repository/ForeignLanguage-Support.package/FLToolSet.class/methodProperties.json rename repository/ForeignLanguage-Support.package/{ForeignLanguageToolSet.class => FLToolSet.class}/properties.json (85%) delete mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browse.selector..st delete mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass..st delete mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/explore..st delete mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openClassBrowser.st delete mode 100644 repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/README.md (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/aboutToStyle..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/addModelItemsToWindowMenu..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/buildCodePaneWith..st (95%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/currentLanguageSymbol.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/defaultBrowserTitle.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/defaultStylerClass.st (50%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/defineMessageFrom.notifying..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/doItReceiver.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/isForeign.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/isPython.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/isRuby.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/isSmalltalk.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/labelString.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/languageSymbol..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/languageSymbol.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/selectLanguage..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/selectedMessage.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/systemCategoryList.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/instance/validateMessageSource.forSelector.inClass..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/methodProperties.json (89%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageBrowser.class => FLBrowser.class}/properties.json (85%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageContextVariablesInspector.class => FLContextVariablesInspector.class}/README.md (100%) create mode 100644 repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/fieldList.st rename repository/ForeignLanguage-Tools.package/{ForeignLanguageContextVariablesInspector.class => FLContextVariablesInspector.class}/instance/selection.st (70%) create mode 100644 repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json rename repository/ForeignLanguage-Tools.package/{ForeignLanguageContextVariablesInspector.class => FLContextVariablesInspector.class}/properties.json (79%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/README.md (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/aboutToStyle..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/buildCodePaneWith..st (95%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/contents.notifying..st (85%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/defaultStylerClass.st (50%) create mode 100644 repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/expandStack.st rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/guessTypeForName..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/isPython.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/isRuby.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/languageSymbol.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/messageIconAt..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/pcRange.st (100%) create mode 100644 repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/instance/selectedMessage.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/methodProperties.json (60%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageDebugger.class => FLDebugger.class}/properties.json (84%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/README.md (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/instance/aboutToStyle..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/instance/buildCodePaneWith..st (87%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/instance/contentsIsString.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/instance/evaluateExpression..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/instance/fieldList.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/instance/languageClass.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/instance/selection.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/methodProperties.json (86%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageInspector.class => FLInspector.class}/properties.json (83%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageObjectExplorer.class => FLObjectExplorer.class}/README.md (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageObjectExplorer.class => FLObjectExplorer.class}/instance/aboutToStyle..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageObjectExplorer.class => FLObjectExplorer.class}/instance/buildWith..st (97%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageObjectExplorer.class => FLObjectExplorer.class}/methodProperties.json (65%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageObjectExplorer.class => FLObjectExplorer.class}/properties.json (82%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/README.md (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/class/open.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/class/windowTitlePrefix.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/aboutToStyle..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/addModelItemsToWindowMenu..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/breakOnExceptions..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/breakOnExceptions.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/breakOnExceptionsText.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/buildCodePaneWith..st (86%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/evaluateExpression..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/isForeign.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/labelString.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/languageClass.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/languageSymbol..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/languageSymbol.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/selectLanguage..st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/instance/toggleBreakOnExceptions.st (100%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/methodProperties.json (93%) rename repository/ForeignLanguage-Tools.package/{ForeignLanguageWorkspace.class => FLWorkspace.class}/properties.json (86%) delete mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json delete mode 100644 repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st create mode 100644 repository/Python-Core.package/Python.class/class/getFilename..st delete mode 100644 repository/Python-Core.package/Python.class/class/resume..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/getFilename..st delete mode 100644 repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame.st delete mode 100644 repository/Ruby-Core.package/Ruby.class/class/resume..st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st index ecf0dcb7..4fe84ad7 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st @@ -2,6 +2,6 @@ debugging checkForException: languageProcess Smalltalk isHeadless ifTrue: [ ^ self ]. (self primLastError: languageProcess) ifNotNil: [ :e | - ForeignLanguageException new + FLException new action: [ self openDebuggerOn: e languageProcess: languageProcess ]; signal ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st new file mode 100644 index 00000000..fab5c78b --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st @@ -0,0 +1,8 @@ +initialize-release +compilePrimitivesIn: newClass + | primitiveSelectors | + primitiveSelectors := ForeignLanguage class organization listAtCategoryNamed: 'system primitives'. + primitiveSelectors do: [:selector | | template | + template := (ForeignLanguage class >> selector) getSource asString. + newClass class compile: ( + template copyReplaceAll: '{ForeignLanguage}' with: newClass name)] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st index 07168cb3..e036c435 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st @@ -3,7 +3,7 @@ findResumeFrame: aContext | currentCtx | currentCtx := aContext. [ currentCtx notNil ] whileTrue: [ - (currentCtx method selector = #resume: + (currentCtx method selector = #vmEval: and: [ currentCtx closure isNil ]) ifTrue: [ ^ currentCtx ]. currentCtx := currentCtx sender ]. diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getFilename..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getFilename..st new file mode 100644 index 00000000..0b68fd9b --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getFilename..st @@ -0,0 +1,3 @@ +debugging +getFilename: foreignFrame + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st index da14a5c4..33cd8f89 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st @@ -1,3 +1,3 @@ helpers newForeignContextFor: foreignFrame - ^ ForeignLanguageMethodContext newFor: foreignFrame \ No newline at end of file + ^ FLMethodContext newFor: foreignFrame \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st index 667279c7..a00b07e1 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st @@ -2,7 +2,7 @@ debugging openDebuggerOn: foreignError languageProcess: languageProcess | resumeCtx | resumeCtx := self findResumeFrame: thisContext sender. - ForeignLanguageDebugger + FLDebugger openOn: Processor activeProcess context: (self prependContexts: resumeCtx languageProcess: languageProcess) label: (self debuggerTitle: foreignError) diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primEval..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primEval..st new file mode 100644 index 00000000..941ce308 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primEval..st @@ -0,0 +1,4 @@ +system primitives +primEval: aString + + self primitiveFailed. \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st index 82cb2342..a98388a9 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st @@ -1,3 +1,4 @@ system primitives primGetTopFrame: languageProcess - self subclassResponsibility \ No newline at end of file + + self primitiveFailed. \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError..st new file mode 100644 index 00000000..a4a8624c --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError..st @@ -0,0 +1,4 @@ +system primitives +primLastError: languageProcess + + ^ nil \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primRestartSpecificFrame..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primRestartSpecificFrame..st new file mode 100644 index 00000000..045b8b7c --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primRestartSpecificFrame..st @@ -0,0 +1,4 @@ +system primitives +primRestartSpecificFrame: foreignFrame + + self primitiveFailed. \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume..st new file mode 100644 index 00000000..d8f307d4 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume..st @@ -0,0 +1,4 @@ +system primitives +primResume: languageProcess + + ^ nil \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st new file mode 100644 index 00000000..e4f8df1c --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/subclass.instanceVariableNames.classVariableNames.poolDictionaries.category..st @@ -0,0 +1,6 @@ +initialize-release +subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat + | newClass | + newClass := super subclass: t instanceVariableNames: f classVariableNames: d poolDictionaries: s category: cat. + self compilePrimitivesIn: newClass. + ^ newClass \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmEval..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmEval..st new file mode 100644 index 00000000..11fafeea --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmEval..st @@ -0,0 +1,5 @@ +special methods +vmEval: languageProcess + [ ^ self vmResume: languageProcess ] on: Error do: [ + self checkForException: languageProcess. + ^ self vmEval: languageProcess ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmResume..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmResume..st new file mode 100644 index 00000000..45905733 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmResume..st @@ -0,0 +1,5 @@ +special methods +vmResume: languageProcess + "Magic method that is called by vm (cached in vm)" + Processor yield. + ^ self primResume: languageProcess \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json index 9d9f7638..5718b33a 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json @@ -1,27 +1,36 @@ { "class" : { "availableLanguages" : "fn 3/14/2017 11:15", - "checkForException:" : "fn 3/22/2017 15:14", + "checkForException:" : "fn 4/28/2017 16:07", + "compilePrimitivesIn:" : "fn 4/28/2017 16:01", "debuggerPrintItem:on:" : "fn 3/16/2017 22:31", "debuggerTitle:" : "fn 3/16/2017 15:12", "evaluateExpression:in:to:" : "fn 3/21/2017 11:32", "fileExtension" : "fn 3/17/2017 10:20", - "findResumeFrame:" : "fn 3/16/2017 16:03", + "findResumeFrame:" : "fn 4/2/2017 00:34", "getContentsOf:" : "fn 3/27/2017 21:54", + "getFilename:" : "fn 4/2/2017 19:32", "getForeignFrames:" : "fn 3/16/2017 21:26", "getSource:" : "fn 3/16/2017 21:57", "highlight:" : "fn 3/14/2017 11:27", - "newForeignContextFor:" : "fn 3/16/2017 13:35", - "openDebuggerOn:languageProcess:" : "fn 3/22/2017 15:15", + "newForeignContextFor:" : "fn 4/28/2017 16:07", + "openDebuggerOn:languageProcess:" : "fn 4/28/2017 16:06", "pcRange:" : "fn 3/16/2017 22:03", "persistEvalCode:" : "fn 3/17/2017 10:23", "prependContexts:languageProcess:" : "fn 3/22/2017 15:15", - "primGetTopFrame:" : "fn 3/22/2017 15:13", + "primEval:" : "fn 4/28/2017 15:30", + "primGetTopFrame:" : "fn 4/28/2017 15:28", + "primLastError:" : "fn 4/28/2017 15:29", + "primRestartSpecificFrame:" : "fn 4/28/2017 15:31", + "primResume:" : "fn 4/28/2017 15:29", "restartFrame:with:" : "fn 3/16/2017 21:57", "sourceCodeTemplate" : "fn 3/14/2017 11:23", "stylerFormat:" : "fn 3/14/2017 11:21", + "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 4/28/2017 16:00", "tempNamesIn:" : "fn 3/16/2017 22:45", "tempVariableAt:in:" : "fn 3/16/2017 22:44", + "vmEval:" : "fn 4/2/2017 00:36", + "vmResume:" : "fn 4/2/2017 00:36", "vmSpeaksLanguage" : "fn 3/14/2017 11:31" }, "instance" : { } } diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st index 5e1bd300..b819e2cc 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st @@ -1,3 +1,3 @@ overrides explore - ^ForeignLanguageToolSet explore: self \ No newline at end of file + ^FLToolSet explore: self \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspect.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspect.st index ffab1cda..72a1d8d1 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspect.st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspect.st @@ -1,4 +1,4 @@ overrides inspect "Create and schedule an Inspector in which the user can examine the receiver's variables." - ^ ForeignLanguageToolSet inspect: self \ No newline at end of file + ^ FLToolSet inspect: self \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st index 5f093b82..2ffb6333 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st @@ -1,3 +1,3 @@ overrides inspectorClass - ^ ForeignLanguageInspector \ No newline at end of file + ^ FLInspector \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json index 6927783e..9b5ad55a 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json @@ -8,9 +8,9 @@ "className" : "fn 3/12/2017 19:22", "defaultLabelForInspector" : "fn 3/28/2017 15:00", "environment" : "fn 3/12/2017 19:21", - "explore" : "fn 3/13/2017 17:38", - "inspect" : "fn 3/13/2017 17:38", - "inspectorClass" : "fn 3/13/2017 17:33", + "explore" : "fn 4/28/2017 16:08", + "inspect" : "fn 4/28/2017 16:08", + "inspectorClass" : "fn 4/28/2017 16:06", "instVarAt:" : "fn 3/14/2017 12:06", "instVarNamed:" : "fn 3/14/2017 12:06", "instVarNames" : "fn 3/30/2017 23:33", diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/version b/repository/ForeignLanguage-Core.package/monticello.meta/version index 79bb1293..9c31db4d 100644 --- a/repository/ForeignLanguage-Core.package/monticello.meta/version +++ b/repository/ForeignLanguage-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Core-fn.5' message 'Updates' id '1b83a434-c31d-45ae-a79c-00e02f2f7d0d' date '28 April 2017' time '4:43:06.982288 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/README.md b/repository/ForeignLanguage-Support.package/FLException.class/README.md similarity index 100% rename from repository/ForeignLanguage-Core.package/ForeignLanguageException.class/README.md rename to repository/ForeignLanguage-Support.package/FLException.class/README.md diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/action..st b/repository/ForeignLanguage-Support.package/FLException.class/instance/action..st similarity index 100% rename from repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/action..st rename to repository/ForeignLanguage-Support.package/FLException.class/instance/action..st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/action.st b/repository/ForeignLanguage-Support.package/FLException.class/instance/action.st similarity index 100% rename from repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/action.st rename to repository/ForeignLanguage-Support.package/FLException.class/instance/action.st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/defaultAction.st b/repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st similarity index 100% rename from repository/ForeignLanguage-Core.package/ForeignLanguageException.class/instance/defaultAction.st rename to repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/methodProperties.json b/repository/ForeignLanguage-Support.package/FLException.class/methodProperties.json similarity index 100% rename from repository/ForeignLanguage-Core.package/ForeignLanguageException.class/methodProperties.json rename to repository/ForeignLanguage-Support.package/FLException.class/methodProperties.json diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/properties.json b/repository/ForeignLanguage-Support.package/FLException.class/properties.json similarity index 68% rename from repository/ForeignLanguage-Core.package/ForeignLanguageException.class/properties.json rename to repository/ForeignLanguage-Support.package/FLException.class/properties.json index e8243ddc..c7480061 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageException.class/properties.json +++ b/repository/ForeignLanguage-Support.package/FLException.class/properties.json @@ -1,5 +1,5 @@ { - "category" : "ForeignLanguage-Core", + "category" : "ForeignLanguage-Support", "classinstvars" : [ ], "classvars" : [ @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ "action" ], - "name" : "ForeignLanguageException", + "name" : "FLException", "pools" : [ ], "super" : "Exception", diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/README.md b/repository/ForeignLanguage-Support.package/FLMethodContext.class/README.md similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/README.md rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/README.md diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/class/newFor..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/class/newFor..st similarity index 84% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/class/newFor..st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/class/newFor..st index 2a37a478..d25e0b18 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/class/newFor..st +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/class/newFor..st @@ -1,7 +1,7 @@ as yet unclassified newFor: foreignFrame | frame | - frame := ForeignLanguageMethodContext + frame := FLMethodContext sender: nil receiver: PythonObject method: (CompiledMethod newMethod: 2 header: 2) diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/foreignFrame..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame..st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/foreignFrame..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/foreignFrame.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/foreignFrame.st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/foreignFrame.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/isForeign.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/isForeign.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/isForeign.st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/isForeign.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageClass.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/languageClass.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageClass.st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/languageClass.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageSymbol.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/languageSymbol.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/languageSymbol.st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/languageSymbol.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/printOn..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/printOn..st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/printOn..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/sender..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sender..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/sender..st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sender..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/setSender.receiver.method.arguments..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/setSender.receiver.method.arguments..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/setSender.receiver.method.arguments..st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/setSender.receiver.method.arguments..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/tempNames.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/instance/tempNames.st rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/tempNames.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json b/repository/ForeignLanguage-Support.package/FLMethodContext.class/methodProperties.json similarity index 91% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/methodProperties.json index 43273897..620e86ab 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/methodProperties.json @@ -1,6 +1,6 @@ { "class" : { - "newFor:" : "fn 3/16/2017 13:34" }, + "newFor:" : "fn 4/28/2017 16:07" }, "instance" : { "foreignFrame" : "fn 3/14/2017 01:28", "foreignFrame:" : "fn 3/14/2017 01:28", diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/properties.json b/repository/ForeignLanguage-Support.package/FLMethodContext.class/properties.json similarity index 84% rename from repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/properties.json rename to repository/ForeignLanguage-Support.package/FLMethodContext.class/properties.json index 03e02ecc..af753aaa 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageMethodContext.class/properties.json +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/properties.json @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ "foreignFrame" ], - "name" : "ForeignLanguageMethodContext", + "name" : "FLMethodContext", "pools" : [ ], "super" : "MethodContext", diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/README.md b/repository/ForeignLanguage-Support.package/FLTextStyler.class/README.md similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/README.md rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/README.md diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightPython..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightPython..st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightPython..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightRuby..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/class/highlightRuby..st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightRuby..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/isForeign.st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/isForeign.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/isForeign.st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/isForeign.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageClass.st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageClass.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageClass.st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageClass.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageSymbol..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol..st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageSymbol..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol.st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageSymbol.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/languageSymbol.st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageSymbol.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/privateFormat..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/privateFormat..st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/privateFormat..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style..st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style.foreignClass..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style.foreignClass..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/style.foreignClass..st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style.foreignClass..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/styleInBackgroundProcess..st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/instance/styleInBackgroundProcess..st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/styleInBackgroundProcess..st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json b/repository/ForeignLanguage-Support.package/FLTextStyler.class/methodProperties.json similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/methodProperties.json rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/methodProperties.json diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/properties.json b/repository/ForeignLanguage-Support.package/FLTextStyler.class/properties.json similarity index 85% rename from repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/properties.json rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/properties.json index 3a6c493b..4518dd56 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageTextStyler.class/properties.json +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/properties.json @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ "languageSymbol" ], - "name" : "ForeignLanguageTextStyler", + "name" : "FLTextStyler", "pools" : [ ], "super" : "SHTextStylerST80", diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/README.md b/repository/ForeignLanguage-Support.package/FLToolSet.class/README.md similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/README.md rename to repository/ForeignLanguage-Support.package/FLToolSet.class/README.md diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browse.selector..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browse.selector..st new file mode 100644 index 00000000..0b84bbdf --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browse.selector..st @@ -0,0 +1,3 @@ +browsing +browse: aClass selector: aSelector + ^ FLBrowser fullOnClass: aClass selector: aSelector \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass..st new file mode 100644 index 00000000..ad8c6a79 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass..st @@ -0,0 +1,3 @@ +browsing +browseClass: aClass + ^ FLBrowser fullOnClass: aClass. \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass.category..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass.category..st similarity index 73% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass.category..st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass.category..st index 7569be78..5aea6063 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass.category..st +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass.category..st @@ -1,5 +1,5 @@ browsing browseClass: aClass category: aCategory - ^ ForeignLanguageBrowser default + ^ FLBrowser default fullOnClass: aClass category: aCategory \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseMessageCategory.inClass..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseMessageCategory.inClass..st similarity index 76% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseMessageCategory.inClass..st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseMessageCategory.inClass..st index 078826db..42ce06ff 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseMessageCategory.inClass..st +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseMessageCategory.inClass..st @@ -1,4 +1,4 @@ browsing browseMessageCategory: aCategory inClass: aClass - ^ ForeignLanguageBrowser default + ^ FLBrowser default newOnMessageCategory: aCategory inClass: aClass. \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debug.context.label.contents.fullView..st similarity index 56% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/debug.context.label.contents.fullView..st index 3ff9b19f..b3c7ec84 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debug.context.label.contents.fullView..st +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debug.context.label.contents.fullView..st @@ -1,4 +1,4 @@ debugging debug: aProcess context: aContext label: aString contents: contents fullView: aBool "Open a debugger on the given process and context." - ^ ForeignLanguageDebugger openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file + ^ FLDebugger openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debugContext.label.contents..st similarity index 59% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/debugContext.label.contents..st index a7f47564..aeb916c3 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/debugContext.label.contents..st +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debugContext.label.contents..st @@ -1,4 +1,4 @@ debugging debugContext: aContext label: aString contents: contents "Open a debugger on the given process and context." - ^ ForeignLanguageDebugger openContext: aContext label: aString contents: contents \ No newline at end of file + ^ FLDebugger openContext: aContext label: aString contents: contents \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/explore..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/explore..st new file mode 100644 index 00000000..06d2dc97 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/explore..st @@ -0,0 +1,4 @@ +inspecting +explore: anObject + + ^ FLObjectExplorer openOn: anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/initialize.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/initialize.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/initialize.st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/initialize.st diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/inspectorClassOf..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/inspectorClassOf..st similarity index 54% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/inspectorClassOf..st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/inspectorClassOf..st index 18f15958..4c9322c5 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/inspectorClassOf..st +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/inspectorClassOf..st @@ -1,4 +1,4 @@ inspecting inspectorClassOf: anObject - anObject isForeign ifTrue: [ ^ ForeignLanguageInspector ]. + anObject isForeign ifTrue: [ ^ FLInspector ]. ^ super inspectorClassOf: anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/interrupt.label..st similarity index 78% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/interrupt.label..st index ed2bba92..44e07e50 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/interrupt.label..st +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/interrupt.label..st @@ -1,5 +1,5 @@ debugging interrupt: aProcess label: aString - ForeignLanguageDebugger + FLDebugger openInterrupt: aString onProcess: aProcess \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/menuItems.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/menuItems.st similarity index 100% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/menuItems.st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/menuItems.st diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openClassBrowser.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openClassBrowser.st new file mode 100644 index 00000000..3b10aaae --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openClassBrowser.st @@ -0,0 +1,3 @@ +browsing +openClassBrowser + FLBrowser open \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageBrowser.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageBrowser.st similarity index 57% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageBrowser.st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageBrowser.st index 3010a26d..e0d66869 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageBrowser.st +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageBrowser.st @@ -1,3 +1,3 @@ inspecting openForeignLanguageBrowser - ForeignLanguageBrowser open \ No newline at end of file + FLBrowser open \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageWorkspace.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageWorkspace.st similarity index 57% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageWorkspace.st rename to repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageWorkspace.st index 50d84dc1..2f8d3222 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openForeignLanguageWorkspace.st +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageWorkspace.st @@ -1,3 +1,3 @@ inspecting openForeignLanguageWorkspace - ForeignLanguageWorkspace open \ No newline at end of file + FLWorkspace open \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/methodProperties.json b/repository/ForeignLanguage-Support.package/FLToolSet.class/methodProperties.json new file mode 100644 index 00000000..0c53fbbf --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/methodProperties.json @@ -0,0 +1,18 @@ +{ + "class" : { + "browse:selector:" : "fn 4/28/2017 16:05", + "browseClass:" : "fn 4/28/2017 16:05", + "browseClass:category:" : "fn 4/28/2017 16:05", + "browseMessageCategory:inClass:" : "fn 4/28/2017 16:05", + "debug:context:label:contents:fullView:" : "fn 4/28/2017 16:06", + "debugContext:label:contents:" : "fn 4/28/2017 16:06", + "explore:" : "fn 4/28/2017 16:06", + "initialize" : "fn 1/16/2017 18:52", + "inspectorClassOf:" : "fn 4/28/2017 16:06", + "interrupt:label:" : "fn 4/28/2017 16:06", + "menuItems" : "fn 3/13/2017 17:56", + "openClassBrowser" : "fn 4/28/2017 16:05", + "openForeignLanguageBrowser" : "fn 4/28/2017 16:05", + "openForeignLanguageWorkspace" : "fn 4/28/2017 16:06" }, + "instance" : { + } } diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/properties.json b/repository/ForeignLanguage-Support.package/FLToolSet.class/properties.json similarity index 85% rename from repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/properties.json rename to repository/ForeignLanguage-Support.package/FLToolSet.class/properties.json index 18616d20..01e3fde0 100644 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/properties.json +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/properties.json @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "ForeignLanguageToolSet", + "name" : "FLToolSet", "pools" : [ ], "super" : "StandardToolSet", diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browse.selector..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browse.selector..st deleted file mode 100644 index c75b27a5..00000000 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browse.selector..st +++ /dev/null @@ -1,3 +0,0 @@ -browsing -browse: aClass selector: aSelector - ^ ForeignLanguageBrowser fullOnClass: aClass selector: aSelector \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass..st deleted file mode 100644 index db504b93..00000000 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/browseClass..st +++ /dev/null @@ -1,3 +0,0 @@ -browsing -browseClass: aClass - ^ ForeignLanguageBrowser fullOnClass: aClass. \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/explore..st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/explore..st deleted file mode 100644 index a8cf741a..00000000 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/explore..st +++ /dev/null @@ -1,4 +0,0 @@ -inspecting -explore: anObject - - ^ ForeignLanguageObjectExplorer openOn: anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openClassBrowser.st b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openClassBrowser.st deleted file mode 100644 index 57bb7522..00000000 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/class/openClassBrowser.st +++ /dev/null @@ -1,3 +0,0 @@ -browsing -openClassBrowser - ForeignLanguageBrowser open \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json b/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json deleted file mode 100644 index 9dec930e..00000000 --- a/repository/ForeignLanguage-Support.package/ForeignLanguageToolSet.class/methodProperties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "class" : { - "browse:selector:" : "fn 3/13/2017 17:43", - "browseClass:" : "fn 3/14/2017 10:46", - "browseClass:category:" : "fn 3/14/2017 10:47", - "browseMessageCategory:inClass:" : "fn 3/14/2017 10:47", - "debug:context:label:contents:fullView:" : "fn 3/16/2017 11:59", - "debugContext:label:contents:" : "fn 3/16/2017 11:59", - "explore:" : "fn 3/13/2017 17:41", - "initialize" : "fn 1/16/2017 18:52", - "inspectorClassOf:" : "fn 3/13/2017 18:36", - "interrupt:label:" : "fn 3/22/2017 22:07", - "menuItems" : "fn 3/13/2017 17:56", - "openClassBrowser" : "fn 3/14/2017 11:14", - "openForeignLanguageBrowser" : "fn 3/13/2017 17:43", - "openForeignLanguageWorkspace" : "fn 3/13/2017 17:55" }, - "instance" : { - } } diff --git a/repository/ForeignLanguage-Support.package/monticello.meta/version b/repository/ForeignLanguage-Support.package/monticello.meta/version index 1970cdf6..0feaec89 100644 --- a/repository/ForeignLanguage-Support.package/monticello.meta/version +++ b/repository/ForeignLanguage-Support.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Support-fn.4' message 'Update in-image code' id 'aac05489-0e6a-4f54-8ba1-7a72a08123d5' date '31 March 2017' time '12:38:59.949445 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Support-fn.5' message 'Use FL namespace instead' id '46ee84e8-2aa7-45cd-9999-c54679d0ab08' date '28 April 2017' time '4:43:26.93281 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.4' message 'Update in-image code' id 'aac05489-0e6a-4f54-8ba1-7a72a08123d5' date '31 March 2017' time '12:38:59.949445 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/README.md b/repository/ForeignLanguage-Tools.package/FLBrowser.class/README.md similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/README.md rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/README.md diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/aboutToStyle..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/aboutToStyle..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/addModelItemsToWindowMenu..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/addModelItemsToWindowMenu..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/addModelItemsToWindowMenu..st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/addModelItemsToWindowMenu..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/buildCodePaneWith..st similarity index 95% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/buildCodePaneWith..st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/buildCodePaneWith..st index 7cadf6c7..0d531c2c 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/buildCodePaneWith..st +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/buildCodePaneWith..st @@ -14,7 +14,7 @@ buildCodePaneWith: builder setText: #contents:notifying:; selection: #contentsSelection; menu: #codePaneMenu:shifted:; - stylerClass: ForeignLanguageTextStyler. + stylerClass: FLTextStyler. self wantsAnnotationPane ifTrue: [ top ifNil: [ top := builder pluggablePanelSpec new. diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/currentLanguageSymbol.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/currentLanguageSymbol.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/currentLanguageSymbol.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/currentLanguageSymbol.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultBrowserTitle.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultBrowserTitle.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultBrowserTitle.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultBrowserTitle.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultStylerClass.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultStylerClass.st similarity index 50% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultStylerClass.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultStylerClass.st index 82ec2d42..378a6867 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defaultStylerClass.st +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultStylerClass.st @@ -1,3 +1,3 @@ overrides defaultStylerClass - ^ ForeignLanguageTextStyler \ No newline at end of file + ^ FLTextStyler \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defineMessageFrom.notifying..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defineMessageFrom.notifying..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/defineMessageFrom.notifying..st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defineMessageFrom.notifying..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/doItReceiver.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/doItReceiver.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/doItReceiver.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/doItReceiver.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isForeign.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isForeign.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isForeign.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isForeign.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isPython.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isPython.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isPython.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isPython.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isRuby.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isRuby.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isRuby.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isRuby.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isSmalltalk.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isSmalltalk.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/isSmalltalk.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isSmalltalk.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/labelString.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/labelString.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/labelString.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/labelString.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/languageSymbol..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol..st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/languageSymbol..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/languageSymbol.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/languageSymbol.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/languageSymbol.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectLanguage..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/selectLanguage..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectLanguage..st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/selectLanguage..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectedMessage.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/selectedMessage.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/selectedMessage.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/selectedMessage.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/systemCategoryList.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/systemCategoryList.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/systemCategoryList.st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/systemCategoryList.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/validateMessageSource.forSelector.inClass..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/validateMessageSource.forSelector.inClass..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/instance/validateMessageSource.forSelector.inClass..st rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/validateMessageSource.forSelector.inClass..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLBrowser.class/methodProperties.json similarity index 89% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/methodProperties.json rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/methodProperties.json index cfaf36fb..f5fcc119 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/methodProperties.json @@ -4,10 +4,10 @@ "instance" : { "aboutToStyle:" : "fn 3/13/2017 17:18", "addModelItemsToWindowMenu:" : "fn 3/14/2017 00:45", - "buildCodePaneWith:" : "fn 3/13/2017 17:12", + "buildCodePaneWith:" : "fn 4/28/2017 16:07", "currentLanguageSymbol" : "fn 3/14/2017 00:51", "defaultBrowserTitle" : "fn 3/14/2017 11:16", - "defaultStylerClass" : "fn 3/13/2017 17:12", + "defaultStylerClass" : "fn 4/28/2017 16:07", "defineMessageFrom:notifying:" : "fn 3/7/2017 11:42", "doItReceiver" : "fn 3/8/2017 11:32", "isForeign" : "fn 3/13/2017 17:45", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/properties.json b/repository/ForeignLanguage-Tools.package/FLBrowser.class/properties.json similarity index 85% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/properties.json rename to repository/ForeignLanguage-Tools.package/FLBrowser.class/properties.json index c21b9b26..fd08481e 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageBrowser.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/properties.json @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ "languageSymbol" ], - "name" : "ForeignLanguageBrowser", + "name" : "FLBrowser", "pools" : [ ], "super" : "Browser", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/README.md b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/README.md similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/README.md rename to repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/README.md diff --git a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/fieldList.st b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/fieldList.st new file mode 100644 index 00000000..52cb3b45 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/fieldList.st @@ -0,0 +1,4 @@ +overrides +fieldList + self object isForeign ifFalse: [ ^ super fieldList ]. + ^fieldList ifNil:[fieldList := (Array with: 'thisContext' with: 'foreign frame' with: 'filename') , object tempNames] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/selection.st similarity index 70% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st rename to repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/selection.st index b12a4253..e87e67aa 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/instance/selection.st +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/selection.st @@ -3,8 +3,8 @@ selection self object isForeign ifFalse: [ ^ super selection ]. selectionIndex = 0 ifTrue: [^ '']. selectionIndex = 1 ifTrue: [^ object ]. - selectionIndex = 2 ifTrue: [^ object symbolic]. - selectionIndex = 3 ifTrue: [^ object headerDescription]. + selectionIndex = 2 ifTrue: [^ object foreignFrame ]. Smalltalk at: object languageSymbol ifPresent: [ :cls | + selectionIndex = 3 ifTrue: [^ cls getFilename: object foreignFrame ]. ^ cls tempVariableAt: selectionIndex - 3 in: object foreignFrame ]. ^ 'Unexpected selection' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json new file mode 100644 index 00000000..806c1384 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "fieldList" : "fn 4/2/2017 19:30", + "selection" : "fn 4/2/2017 19:33" } } diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/properties.json b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/properties.json similarity index 79% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/properties.json rename to repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/properties.json index f11aed99..f12cb6bd 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/properties.json @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "ForeignLanguageContextVariablesInspector", + "name" : "FLContextVariablesInspector", "pools" : [ ], "super" : "ContextVariablesInspector", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/README.md b/repository/ForeignLanguage-Tools.package/FLDebugger.class/README.md similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/README.md rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/README.md diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/aboutToStyle..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/aboutToStyle..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/buildCodePaneWith..st similarity index 95% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/buildCodePaneWith..st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/buildCodePaneWith..st index f9a50a5b..826e0384 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/buildCodePaneWith..st +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/buildCodePaneWith..st @@ -22,7 +22,7 @@ buildCodePaneWith: builder selection: #contentsSelection; menu: #codePaneMenu:shifted:; frame: self textFrame; - stylerClass: ForeignLanguageTextStyler. + stylerClass: FLTextStyler. top children add: textSpec. self wantsAnnotationPane ifTrue: [ diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/contents.notifying..st similarity index 85% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/contents.notifying..st index 405a4286..dceecafa 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/contents.notifying..st +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/contents.notifying..st @@ -4,7 +4,7 @@ contents: aText notifying: aController ctx := self selectedContext. ctx isForeign ifFalse: [^ super contents: aText notifying: aController]. Smalltalk at: ctx languageSymbol ifPresent: [ :cls | - cls setSource: ctx foreignFrame to: aText asString. + "cls setSource: ctx foreignFrame to: aText asString." cls restartFrame: ctx foreignFrame with: aText asString withUnixLineEndings ]. contents := aText. ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/defaultStylerClass.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/defaultStylerClass.st similarity index 50% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/defaultStylerClass.st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/defaultStylerClass.st index 82ec2d42..378a6867 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/defaultStylerClass.st +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/defaultStylerClass.st @@ -1,3 +1,3 @@ overrides defaultStylerClass - ^ ForeignLanguageTextStyler \ No newline at end of file + ^ FLTextStyler \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/expandStack.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/expandStack.st new file mode 100644 index 00000000..9e5df3e5 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/expandStack.st @@ -0,0 +1,5 @@ +overrides +expandStack + super expandStack. + receiverInspector := FLInspector inspect: nil. + contextVariablesInspector := FLContextVariablesInspector inspect: nil. \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/guessTypeForName..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/guessTypeForName..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/guessTypeForName..st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/guessTypeForName..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isPython.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/isPython.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isPython.st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/isPython.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isRuby.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/isRuby.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/isRuby.st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/isRuby.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/languageSymbol.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/languageSymbol.st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/languageSymbol.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/messageIconAt..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/messageIconAt..st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/messageIconAt..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/pcRange.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/pcRange.st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/pcRange.st diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st new file mode 100644 index 00000000..0e08d8db --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st @@ -0,0 +1,8 @@ +overrides +process: aProcess controller: aController context: aContext + | ctx | + (aContext method selector = #vmResume: and: [ + aContext receiver inheritsFrom: ForeignLanguage ]) + ifFalse: [ ^ super process: aProcess controller: aController context: aContext]. + ctx := aContext receiver prependContexts: aContext languageProcess: (aContext at: 1). + super process: aProcess controller: aController context: ctx \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/selectedMessage.st rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json similarity index 60% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json index 97b65c25..dfdd7da5 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json @@ -3,14 +3,15 @@ }, "instance" : { "aboutToStyle:" : "fn 3/14/2017 01:31", - "buildCodePaneWith:" : "fn 3/13/2017 17:12", - "contents:notifying:" : "fn 3/16/2017 21:56", - "defaultStylerClass" : "fn 3/13/2017 17:12", - "expandStack" : "fn 3/16/2017 22:00", + "buildCodePaneWith:" : "fn 4/28/2017 16:07", + "contents:notifying:" : "fn 4/2/2017 23:26", + "defaultStylerClass" : "fn 4/28/2017 16:07", + "expandStack" : "fn 4/28/2017 16:06", "guessTypeForName:" : "fn 3/14/2017 01:31", "isPython" : "fn 3/14/2017 01:33", "isRuby" : "fn 3/14/2017 01:33", "languageSymbol" : "fn 3/14/2017 01:32", "messageIconAt:" : "fn 3/16/2017 22:18", "pcRange" : "fn 3/16/2017 22:18", + "process:controller:context:" : "fn 4/2/2017 13:17", "selectedMessage" : "fn 3/16/2017 21:49" } } diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/properties.json b/repository/ForeignLanguage-Tools.package/FLDebugger.class/properties.json similarity index 84% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/properties.json rename to repository/ForeignLanguage-Tools.package/FLDebugger.class/properties.json index 80dc623b..2e8883fa 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/properties.json @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "ForeignLanguageDebugger", + "name" : "FLDebugger", "pools" : [ ], "super" : "Debugger", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/README.md b/repository/ForeignLanguage-Tools.package/FLInspector.class/README.md similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/README.md rename to repository/ForeignLanguage-Tools.package/FLInspector.class/README.md diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/aboutToStyle..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/FLInspector.class/instance/aboutToStyle..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/buildCodePaneWith..st similarity index 87% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/buildCodePaneWith..st rename to repository/ForeignLanguage-Tools.package/FLInspector.class/instance/buildCodePaneWith..st index 04625704..5272156e 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/buildCodePaneWith..st +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/buildCodePaneWith..st @@ -10,5 +10,5 @@ buildCodePaneWith: builder selection: #contentsSelection; menu: #codePaneMenu:shifted:; askBeforeDiscardingEdits: false; - stylerClass: ForeignLanguageTextStyler. + stylerClass: FLTextStyler. ^textSpec \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/contentsIsString.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/contentsIsString.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/contentsIsString.st rename to repository/ForeignLanguage-Tools.package/FLInspector.class/instance/contentsIsString.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/evaluateExpression..st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/evaluateExpression..st rename to repository/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/fieldList.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/fieldList.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/fieldList.st rename to repository/ForeignLanguage-Tools.package/FLInspector.class/instance/fieldList.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/languageClass.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/languageClass.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/languageClass.st rename to repository/ForeignLanguage-Tools.package/FLInspector.class/instance/languageClass.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/selection.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/selection.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/instance/selection.st rename to repository/ForeignLanguage-Tools.package/FLInspector.class/instance/selection.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLInspector.class/methodProperties.json similarity index 86% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json rename to repository/ForeignLanguage-Tools.package/FLInspector.class/methodProperties.json index 8ac53f20..bbaad200 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/methodProperties.json @@ -3,7 +3,7 @@ }, "instance" : { "aboutToStyle:" : "fn 3/13/2017 17:35", - "buildCodePaneWith:" : "fn 3/13/2017 17:12", + "buildCodePaneWith:" : "fn 4/28/2017 16:07", "contentsIsString" : "fn 12/23/2016 11:11", "evaluateExpression:" : "fn 3/21/2017 11:39", "fieldList" : "fn 3/14/2017 12:01", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/properties.json b/repository/ForeignLanguage-Tools.package/FLInspector.class/properties.json similarity index 83% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/properties.json rename to repository/ForeignLanguage-Tools.package/FLInspector.class/properties.json index 8a500f9b..06196822 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageInspector.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/properties.json @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "ForeignLanguageInspector", + "name" : "FLInspector", "pools" : [ ], "super" : "Inspector", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/README.md b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/README.md similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/README.md rename to repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/README.md diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/aboutToStyle..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/aboutToStyle..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/buildWith..st b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/buildWith..st similarity index 97% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/buildWith..st rename to repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/buildWith..st index d809cd04..d1986c35 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/instance/buildWith..st +++ b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/buildWith..st @@ -38,7 +38,7 @@ buildWith: builder menu: #codePaneMenu:shifted:; help: 'Evaluate expressions for the current tree selection...' translated; frame: (LayoutFrame fractions: (0@0.71 corner: 1@1) offsets: (0@0 corner: buttonOffset negated@0)); - stylerClass: ForeignLanguageTextStyler. + stylerClass: FLTextStyler. windowSpec children add: textSpec. buttonSpec := builder pluggableButtonSpec new diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/methodProperties.json similarity index 65% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/methodProperties.json rename to repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/methodProperties.json index 4abd3da6..023149d0 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/methodProperties.json @@ -3,4 +3,4 @@ }, "instance" : { "aboutToStyle:" : "fn 3/13/2017 17:42", - "buildWith:" : "fn 3/13/2017 17:12" } } + "buildWith:" : "fn 4/28/2017 16:07" } } diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/properties.json b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/properties.json similarity index 82% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/properties.json rename to repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/properties.json index 1dd1e9e3..b163f924 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageObjectExplorer.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/properties.json @@ -7,7 +7,7 @@ "commentStamp" : "", "instvars" : [ ], - "name" : "ForeignLanguageObjectExplorer", + "name" : "FLObjectExplorer", "pools" : [ ], "super" : "ObjectExplorer", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/README.md b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/README.md similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/README.md rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/README.md diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/open.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/class/open.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/open.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/class/open.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/windowTitlePrefix.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/class/windowTitlePrefix.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/class/windowTitlePrefix.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/class/windowTitlePrefix.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/aboutToStyle..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/aboutToStyle..st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/aboutToStyle..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/addModelItemsToWindowMenu..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/addModelItemsToWindowMenu..st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/addModelItemsToWindowMenu..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptions..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions..st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptions..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptions.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptions.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptions.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptionsText.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptionsText.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/breakOnExceptionsText.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptionsText.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/buildCodePaneWith..st similarity index 86% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/buildCodePaneWith..st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/buildCodePaneWith..st index e94e198e..392ac195 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/buildCodePaneWith..st +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/buildCodePaneWith..st @@ -8,5 +8,5 @@ buildCodePaneWith: builder setText: #contents:notifying:; selection: #contentsSelection; menu: #codePaneMenu:shifted:; - stylerClass: ForeignLanguageTextStyler. + stylerClass: FLTextStyler. ^textSpec \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/evaluateExpression..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/evaluateExpression..st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/evaluateExpression..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/isForeign.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/isForeign.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/isForeign.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/isForeign.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/labelString.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/labelString.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/labelString.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageClass.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageClass.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageClass.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageClass.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageSymbol..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol..st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageSymbol..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageSymbol.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/languageSymbol.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageSymbol.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/selectLanguage..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/selectLanguage..st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/selectLanguage..st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/selectLanguage..st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/toggleBreakOnExceptions.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/toggleBreakOnExceptions.st similarity index 100% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/instance/toggleBreakOnExceptions.st rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/toggleBreakOnExceptions.st diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/methodProperties.json similarity index 93% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/methodProperties.json index a01c1c4c..f16b8b1d 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/methodProperties.json @@ -8,7 +8,7 @@ "breakOnExceptions" : "fn 3/23/2017 00:36", "breakOnExceptions:" : "fn 3/21/2017 23:06", "breakOnExceptionsText" : "fn 3/21/2017 23:11", - "buildCodePaneWith:" : "fn 3/13/2017 17:51", + "buildCodePaneWith:" : "fn 4/28/2017 16:08", "evaluateExpression:" : "fn 3/21/2017 23:16", "isForeign" : "fn 3/14/2017 18:32", "labelString" : "fn 3/30/2017 23:24", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/properties.json similarity index 86% rename from repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json rename to repository/ForeignLanguage-Tools.package/FLWorkspace.class/properties.json index 93e295e6..ff48237f 100644 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageWorkspace.class/properties.json +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/properties.json @@ -8,7 +8,7 @@ "instvars" : [ "breakOnExceptions", "languageSymbol" ], - "name" : "ForeignLanguageWorkspace", + "name" : "FLWorkspace", "pools" : [ ], "super" : "Workspace", diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json deleted file mode 100644 index cd5cf0ef..00000000 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageContextVariablesInspector.class/methodProperties.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class" : { - }, - "instance" : { - "selection" : "fn 3/16/2017 22:43" } } diff --git a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st b/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st deleted file mode 100644 index 4ca01cd2..00000000 --- a/repository/ForeignLanguage-Tools.package/ForeignLanguageDebugger.class/instance/expandStack.st +++ /dev/null @@ -1,5 +0,0 @@ -overrides -expandStack - super expandStack. - receiverInspector := ForeignLanguageInspector inspect: nil. - contextVariablesInspector := ForeignLanguageContextVariablesInspector inspect: nil. \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/version b/repository/ForeignLanguage-Tools.package/monticello.meta/version index 883ba495..88b3ba59 100644 --- a/repository/ForeignLanguage-Tools.package/monticello.meta/version +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Tools-fn.4' message 'Update in-image code' id 'b7af137b-818c-4196-9439-01a40952f2ba' date '31 March 2017' time '12:39:05.754067 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Tools-fn.5' message 'Use FL namespace instead' id '996f4850-069f-46b0-95f0-e26ed5627893' date '28 April 2017' time '4:43:38.939853 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.4' message 'Update in-image code' id 'b7af137b-818c-4196-9439-01a40952f2ba' date '31 March 2017' time '12:39:05.754067 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/getFilename..st b/repository/Python-Core.package/Python.class/class/getFilename..st new file mode 100644 index 00000000..3ebcd607 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/getFilename..st @@ -0,0 +1,3 @@ +debugging +getFilename: pyFrame + ^ pyFrame f_code co_filename asSmalltalk \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/highlight..st b/repository/Python-Core.package/Python.class/class/highlight..st index 4cb4ff7b..6d317bf7 100644 --- a/repository/Python-Core.package/Python.class/class/highlight..st +++ b/repository/Python-Core.package/Python.class/class/highlight..st @@ -1,3 +1,3 @@ styling highlight: aText - ^ ForeignLanguageTextStyler highlightPython: aText \ No newline at end of file + ^ FLTextStyler highlightPython: aText \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/restartFrame.with..st b/repository/Python-Core.package/Python.class/class/restartFrame.with..st index 29a35f9e..6d82617c 100644 --- a/repository/Python-Core.package/Python.class/class/restartFrame.with..st +++ b/repository/Python-Core.package/Python.class/class/restartFrame.with..st @@ -3,5 +3,5 @@ restartFrame: pyFrame with: aSource self primRestartSpecificFrame: pyFrame source: aSource - filename: pyFrame f_code co_filename + filename: pyFrame f_code co_filename asSmalltalk cmd: (self cmdFor: aSource) \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/resume..st b/repository/Python-Core.package/Python.class/class/resume..st deleted file mode 100644 index 42306e43..00000000 --- a/repository/Python-Core.package/Python.class/class/resume..st +++ /dev/null @@ -1,7 +0,0 @@ -special methods -resume: pyProcess - "Magic method that is called by vm (cached in vm)" - Processor yield. - [ ^ self primResume: pyProcess ] on: Error do: [ - self checkForException: pyProcess. - ^ self resume: pyProcess ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/setUpPygments.st b/repository/Python-Core.package/Python.class/class/setUpPygments.st index 6be0ab86..eac3faf2 100644 --- a/repository/Python-Core.package/Python.class/class/setUpPygments.st +++ b/repository/Python-Core.package/Python.class/class/setUpPygments.st @@ -12,7 +12,7 @@ try: _pygments_lexer_smalltalk = pygments.lexers.get_lexer_by_name( "smalltalk", encoding="utf-8", stripnl=False, ensurenl=False) _pygments_formatter = pygments.formatters.get_formatter_by_name( - "html", encoding="utf-8", style="colorful", nowrap=True, noclasses=True, lineseparator="
") + "html", encoding="utf-8", style="squeak", nowrap=True, noclasses=True, lineseparator="
") except ImportError: pass ' breakOnExceptions: false. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json index b99c5751..62235a35 100644 --- a/repository/Python-Core.package/Python.class/methodProperties.json +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -21,11 +21,12 @@ "from:import:" : "fn 1/9/2017 20:54", "from:load:" : "fn 1/9/2017 20:55", "fromObjectCache:" : "fn 2/23/2017 18:40", + "getFilename:" : "fn 4/2/2017 19:33", "getForeignFrames:" : "fn 3/16/2017 21:58", "getSignature:" : "fn 3/28/2017 01:38", "getSource:" : "fn 3/28/2017 12:02", "globals" : "fn 2/26/2017 21:46", - "highlight:" : "fn 3/14/2017 11:27", + "highlight:" : "fn 4/28/2017 16:08", "import:" : "fn 3/21/2017 23:14", "import:breakOnExceptions:" : "fn 3/12/2017 02:47", "indent:by:" : "fn 3/16/2017 21:38", @@ -50,13 +51,12 @@ "re" : "fn 3/9/2017 17:53", "replaceInPySource:content:lineno:" : "fn 3/16/2017 21:37", "reset" : "fn 2/23/2017 21:13", - "restartFrame:with:" : "fn 3/16/2017 21:56", - "resume:" : "fn 3/22/2017 15:12", + "restartFrame:with:" : "fn 4/2/2017 23:26", "run:" : "fn 2/23/2017 21:37", "run:breakOnExceptions:" : "fn 3/27/2017 21:55", "scopeEndIn:startingAt:" : "fn 3/16/2017 21:38", "setSource:to:" : "fn 3/16/2017 21:58", - "setUpPygments" : "fn 3/30/2017 22:44", + "setUpPygments" : "fn 4/24/2017 23:07", "setUpPythonEnvironment" : "fn 3/28/2017 11:59", "single:" : "fn 3/21/2017 23:15", "sourceCodeTemplate" : "fn 3/14/2017 11:22", diff --git a/repository/Python-Core.package/PythonObject.class/methodProperties.json b/repository/Python-Core.package/PythonObject.class/methodProperties.json index 3d3d8a9e..4fc2b71b 100644 --- a/repository/Python-Core.package/PythonObject.class/methodProperties.json +++ b/repository/Python-Core.package/PythonObject.class/methodProperties.json @@ -6,7 +6,7 @@ "pyCompile:classified:notifying:" : "fn 3/7/2017 11:44", "pyMethodDict" : "fn 3/7/2017 10:24", "pythonize" : "fn 12/21/2016 00:15", - "pythonize:instVars:clsVars:" : "fn 3/13/2017 10:53", + "pythonize:instVars:clsVars:" : "fn 4/28/2017 16:09", "pythonizeAll" : "fn 3/6/2017 06:58", "sourceCodeAt:ifAbsent:" : "fn 3/7/2017 12:44", "sourceCodeTemplate" : "fn 3/7/2017 19:08", diff --git a/repository/Python-Core.package/PythonTheme.class/class/addScrollables..st b/repository/Python-Core.package/PythonTheme.class/class/addScrollables..st index 76e2439c..d4e76e72 100644 --- a/repository/Python-Core.package/PythonTheme.class/class/addScrollables..st +++ b/repository/Python-Core.package/PythonTheme.class/class/addScrollables..st @@ -66,6 +66,6 @@ addScrollables: theme set: #adornmentDiffEdit for: #PluggableTextMorph to: Color yellow; set: #frameAdornmentWidth for: #PluggableTextMorph to: 1. theme - set: #stylerClass for: #PluggableTextMorphPlus to: ForeignLanguageTextStyler; + set: #stylerClass for: #PluggableTextMorphPlus to: FLTextStyler; set: #balloonTextColor for: #PluggableTextMorphPlus to: (Color gray: 0.7); derive: #balloonTextFont for: #PluggableTextMorphPlus from: #PluggableTextMorph at: #font. \ No newline at end of file diff --git a/repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st b/repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st index 0c77a964..9fac2f50 100644 --- a/repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st +++ b/repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st @@ -1,3 +1,3 @@ as yet unclassified stylerClass - ^ ForeignLanguageTextStyler \ No newline at end of file + ^ FLTextStyler \ No newline at end of file diff --git a/repository/Python-Core.package/PythonTheme.class/methodProperties.json b/repository/Python-Core.package/PythonTheme.class/methodProperties.json index 7dfac982..9461731f 100644 --- a/repository/Python-Core.package/PythonTheme.class/methodProperties.json +++ b/repository/Python-Core.package/PythonTheme.class/methodProperties.json @@ -4,7 +4,7 @@ "addDialogs:" : "fn 2/21/2017 18:33", "addFonts:" : "fn 2/10/2017 10:26", "addMenusAndDockingBars:" : "fn 2/10/2017 14:23", - "addScrollables:" : "fn 3/13/2017 17:12", + "addScrollables:" : "fn 4/28/2017 16:08", "addSyntaxHighlighting:" : "fn 2/10/2017 14:03", "addToolColors:" : "fn 2/10/2017 11:58", "addWindowColors:" : "fn 2/10/2017 11:59", @@ -34,4 +34,4 @@ "windowColor" : "fn 2/10/2017 11:02", "yellow" : "fn 2/10/2017 11:58" }, "instance" : { - "stylerClass" : "fn 3/13/2017 17:12" } } + "stylerClass" : "fn 4/28/2017 16:08" } } diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index 9186ab0e..b4f5d37b 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.9' message 'Updates' id '1a2fafe2-19a7-4de3-b2e9-e47ca2977965' date '28 April 2017' time '4:43:57.571228 pm' author 'fn' ancestors ((name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st b/repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st index e33bc3ef..cc4da1fa 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st +++ b/repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st @@ -2,7 +2,7 @@ debugging debuggerPrintItem: rbFrame on: aStream | name lineno filename currentPath | name := rbFrame get_code_name asSmalltalk. - lineno := '1'"rbFrame get_lineno asSmalltalk asString". + lineno := rbFrame get_lineno asSmalltalk asString. filename := rbFrame get_filename asSmalltalk. currentPath := FileDirectory default pathName. (filename startsWith: currentPath) ifTrue: [ diff --git a/repository/Ruby-Core.package/Ruby.class/class/getFilename..st b/repository/Ruby-Core.package/Ruby.class/class/getFilename..st new file mode 100644 index 00000000..dae72e0d --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/getFilename..st @@ -0,0 +1,3 @@ +debugging +getFilename: rbFrame + ^ rbFrame get_filename asSmalltalk \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/highlight..st b/repository/Ruby-Core.package/Ruby.class/class/highlight..st index 1c0eec04..5e696c23 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/highlight..st +++ b/repository/Ruby-Core.package/Ruby.class/class/highlight..st @@ -1,3 +1,3 @@ styling highlight: aText - ^ ForeignLanguageTextStyler highlightRuby: aText \ No newline at end of file + ^ FLTextStyler highlightRuby: aText \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/pcRange..st b/repository/Ruby-Core.package/Ruby.class/class/pcRange..st index 22ae8b45..67fa6333 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/pcRange..st +++ b/repository/Ruby-Core.package/Ruby.class/class/pcRange..st @@ -1,4 +1,9 @@ debugging pcRange: rbFrame - "TBD" + | lineNumber lineCount | + lineNumber := rbFrame get_lineno asSmalltalk. + lineCount := 0. + (Ruby getSource: rbFrame) lineIndicesDo: [:start :endWithoutDelimiters :end | + (lineCount := lineCount + 1) = lineNumber + ifTrue: [ ^ start to: end ]]. ^ 1 to: 0 \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame.st b/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame.st deleted file mode 100644 index 000cacda..00000000 --- a/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame.st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primGetTopFrame - - self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/resume..st b/repository/Ruby-Core.package/Ruby.class/class/resume..st deleted file mode 100644 index 962eae8d..00000000 --- a/repository/Ruby-Core.package/Ruby.class/class/resume..st +++ /dev/null @@ -1,7 +0,0 @@ -special methods -resume: rbProcess - "Magic method that is called by vm (cached in vm)" - Processor yield. - [ ^ self primResume: rbProcess ] on: Error do: [ - self checkForException: rbProcess. - ^ self resume: rbProcess ] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json index eeae8cf0..345c2949 100644 --- a/repository/Ruby-Core.package/Ruby.class/methodProperties.json +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -1,6 +1,6 @@ { "class" : { - "debuggerPrintItem:on:" : "fn 3/16/2017 22:37", + "debuggerPrintItem:on:" : "fn 4/2/2017 19:58", "debuggerTitle:" : "fn 3/16/2017 22:47", "eval:" : "fn 3/16/2017 13:41", "eval:breakOnExceptions:" : "fn 3/23/2017 08:59", @@ -9,22 +9,21 @@ "evaluateExpression:" : "fn 3/27/2017 23:53", "evaluateExpression:breakOnExceptions:" : "fn 3/27/2017 23:53", "fileExtension" : "fn 3/17/2017 10:20", + "getFilename:" : "fn 4/2/2017 19:33", "getForeignFrames:" : "fn 3/16/2017 22:22", "getSource:" : "fn 3/27/2017 23:54", - "highlight:" : "fn 3/14/2017 11:27", + "highlight:" : "fn 4/28/2017 16:08", "kernel" : "tfel 8/16/2016 07:04", "nil" : "fn 3/16/2017 13:37", "object" : "tfel 8/16/2016 07:04", - "pcRange:" : "fn 3/16/2017 22:22", + "pcRange:" : "fn 4/2/2017 19:58", "primEval:" : "tfel 8/16/2016 07:03", "primEval:filePath:breakOnExceptions:" : "fn 3/16/2017 13:40", - "primGetTopFrame" : "fn 3/14/2017 22:23", "primGetTopFrame:" : "fn 3/22/2017 15:12", "primLastError:" : "fn 3/22/2017 15:13", "primResume:" : "fn 3/22/2017 15:13", "primSend:to:with:" : "tfel 8/16/2016 07:03", "restartFrame:with:" : "fn 3/16/2017 22:22", - "resume:" : "fn 3/22/2017 15:13", "sourceCodeTemplate" : "fn 3/14/2017 11:22", "tempNamesIn:" : "fn 3/16/2017 22:45", "tempVariableAt:in:" : "fn 3/16/2017 22:44", diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version index 5dc1ff33..58fb7399 100644 --- a/repository/Ruby-Core.package/monticello.meta/version +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 3f1d5b13168fb7d835c8a9518894a3a1c9b4dfdb Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 29 Apr 2017 19:24:59 +0200 Subject: [PATCH 176/193] Also check for errors in eval primitive This should be the reason no debugger is opened for short-running code that fails --- .../plugins/foreign_language/__init__.py | 25 +++++++++++-------- rsqueakvm/plugins/foreign_language/process.py | 8 +++--- rsqueakvm/plugins/python/patching.py | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 56f370b6..5583e1d6 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -49,11 +49,25 @@ def eval(interp, s_frame, argcount): language_process = self.new_eval_process(interp.space, args_w) language_process.start() # when we are here, the foreign language process has yielded + if language_process.error_detected(): + raise PrimitiveFailedError frame = language_process.switch_to_smalltalk( interp, s_frame, first_call=True) s_frame.pop_n(argcount + 1) return frame + @self.expose_primitive(unwrap_spec=[object, object], + result_is_new_frame=True) + def resume(interp, s_frame, w_rcvr, language_process): + # print 'Smalltalk yield' + # import pdb; pdb.set_trace() + if not isinstance(language_process, W_ForeignLanguageProcess): + raise PrimitiveFailedError + language_process.resume() + if language_process.error_detected(): + raise PrimitiveFailedError + return language_process.switch_to_smalltalk(interp, s_frame) + @self.expose_primitive(result_is_new_frame=True, compiled_method=True) def send(interp, s_frame, argcount, w_method): if not self.is_operational(): @@ -76,17 +90,6 @@ def send(interp, s_frame, argcount, w_method): s_frame.pop_n(argcount + 1) return frame - @self.expose_primitive(unwrap_spec=[object, object], - result_is_new_frame=True) - def resume(interp, s_frame, w_rcvr, language_process): - # print 'Smalltalk yield' - # import pdb; pdb.set_trace() - if not isinstance(language_process, W_ForeignLanguageProcess): - raise PrimitiveFailedError - if not language_process.resume(): - raise PrimitiveFailedError - return language_process.switch_to_smalltalk(interp, s_frame) - @self.expose_primitive(unwrap_spec=[object, object]) def lastError(interp, s_frame, w_rcvr, language_process): if not isinstance(language_process, W_ForeignLanguageProcess): diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index 055b0b98..92783d25 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -157,11 +157,11 @@ def resume(self): print 'The runner is done and cannot be resumed' return False self.runner().resume() + + def error_detected(self): if not self.break_on_exceptions(): - # resume is always successful in this case, otherwise the image - # would start looking for an error - return True - return self.get_error() is None + return False # pretend everything is ok and move on + return self.get_error() is not None def runner(self): return self._runner diff --git a/rsqueakvm/plugins/python/patching.py b/rsqueakvm/plugins/python/patching.py index ea4c221d..9650e51d 100644 --- a/rsqueakvm/plugins/python/patching.py +++ b/rsqueakvm/plugins/python/patching.py @@ -95,13 +95,13 @@ def block_handles_exception(self, block, operr_type): def has_exception_handler(self, operr): "Returns True if this frame or one of its parents are able to handle operr" - frame = self error_type = operr.w_type.getname(py_space) forbidden_names = [] if error_type == 'AttributeError': forbidden_names = ATTRIBUTE_ERROR_FORBIDDEN_NAMES elif error_type == 'StopIteration': forbidden_names = STOP_ITERATION_FORBIDDEN_NAMES + frame = self while frame is not None: for name in forbidden_names: if name in frame.pycode._co_names: From e2ee6fcb7cff00453c9cdf0a29fb1eb6f8abb78e Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 30 Apr 2017 19:17:22 +0200 Subject: [PATCH 177/193] Fix compilation error --- rsqueakvm/plugins/foreign_language/process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index 92783d25..399b9afd 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -155,7 +155,7 @@ def resume(self): if self.is_done(): # import pdb; pdb.set_trace() print 'The runner is done and cannot be resumed' - return False + return self.runner().resume() def error_detected(self): From 205df9f84286f0912072df41a707792c985609bb Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sun, 30 Apr 2017 19:32:36 +0200 Subject: [PATCH 178/193] Move restartSpecificFrame primitive to FL plugin --- .../plugins/foreign_language/__init__.py | 12 +++++++++ rsqueakvm/plugins/python/__init__.py | 25 +++++++++++++++++++ rsqueakvm/plugins/python_plugin.py | 21 ---------------- rsqueakvm/plugins/ruby/__init__.py | 5 ++++ 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 5583e1d6..c75a67bc 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -37,6 +37,10 @@ def w_object_class(): def to_w_object(foreign_object): raise NotImplementedError + @staticmethod + def restart_specific_frame(space, args_w): + raise NotImplementedError + # Default primitives def register_default_primitives(self): @@ -115,6 +119,14 @@ def asSmalltalk(interp, s_frame, w_rcvr): raise PrimitiveFailedError return self.to_w_object(interp.space, w_rcvr) + @self.expose_primitive() + def restartSpecificFrame(interp, s_frame, argcount): + # import pdb; pdb.set_trace() + args_w = s_frame.peek_n(argcount) + result = self.restart_specific_frame(interp.space, args_w) + s_frame.pop_n(argcount + 1) + return interp.space.wrap_bool(result) + @self.expose_primitive(unwrap_spec=[object, object]) def registerSpecificClass(interp, s_frame, w_rcvr, language_obj): if not isinstance(language_obj, W_ForeignLanguageObject): diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index 59bff301..364c455b 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -92,3 +92,28 @@ def to_w_object(space, foreign_object): def set_py_frame_restart_info(frame, py_code): PythonPlugin.py_frame_restart_info.set( PyFrameRestartInfo(frame, py_code)) + + @staticmethod + def restart_specific_frame(space, args_w): + frame_w = args_w[0] + source_w = args_w[1] + filename_w = args_w[2] + cmd_w = args_w[3] + + if not (isinstance(frame_w, W_PythonObject) and + isinstance(source_w, W_BytesObject) and + isinstance(filename_w, W_BytesObject) and + isinstance(cmd_w, W_BytesObject)): + return False + frame = frame_w.wp_object + source = space.unwrap_string(source_w) + filename = space.unwrap_string(filename_w) + cmd = space.unwrap_string(cmd_w) + + py_code = None + if source: + py_code = utils.get_restart_pycode(source, filename, cmd) + if py_code is None: + return False + PythonPlugin.set_py_frame_restart_info(frame, py_code) + return True diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py index ab79142d..27fd6d8c 100644 --- a/rsqueakvm/plugins/python_plugin.py +++ b/rsqueakvm/plugins/python_plugin.py @@ -1,24 +1,3 @@ from rsqueakvm.plugins.python import PythonPlugin -try: - from rsqueakvm.plugins.python import utils - from rsqueakvm.plugins.python.model import W_PythonObject -except ImportError: - pass - plugin = PythonPlugin() - - -@plugin.expose_primitive(unwrap_spec=[object, object, str, str, str]) -def restartSpecificFrame(interp, s_frame, w_rcvr, w_frame, source, filename, - cmd): - frame = None - if isinstance(w_frame, W_PythonObject): - frame = w_frame.wp_object - py_code = None - if source: - py_code = utils.get_restart_pycode(source, filename, cmd) - if py_code is None: - return interp.space.w_false # Raising prim error causes crashes - PythonPlugin.set_py_frame_restart_info(frame, py_code) - return interp.space.w_true diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index e868ef86..89ea5881 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -77,3 +77,8 @@ def w_object_class(): @staticmethod def to_w_object(space, foreign_object): return utils.ruby_to_smalltalk(space, foreign_object.wr_object) + + @staticmethod + def restart_specific_frame(space, args_w): + print 'Not yet implemented for Topaz' + return False From d271fa1fc3d86662c54800df5433ffcc11f97f55 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 1 May 2017 11:17:02 +0200 Subject: [PATCH 179/193] Do not install primitives when plugin is disabled This should remove all references to rvmprof in profiler_plugin which causes compilation errors --- rsqueakvm/plugins/plugin.py | 2 ++ rsqueakvm/plugins/profiler_plugin.py | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/plugin.py b/rsqueakvm/plugins/plugin.py index e8ceb3f8..64d07388 100644 --- a/rsqueakvm/plugins/plugin.py +++ b/rsqueakvm/plugins/plugin.py @@ -62,6 +62,8 @@ def _find_prim(self, name): @not_rpython def expose_primitive(self, wrap_func=None, **kwargs): + if not self.is_enabled(): + return lambda x: x # do not install primitives when disabled from rsqueakvm.primitives import wrap_primitive, unwrap_alternatives if not wrap_func: if kwargs.get('unwrap_specs', None): diff --git a/rsqueakvm/plugins/profiler_plugin.py b/rsqueakvm/plugins/profiler_plugin.py index 49b41ee1..6bf12048 100644 --- a/rsqueakvm/plugins/profiler_plugin.py +++ b/rsqueakvm/plugins/profiler_plugin.py @@ -36,7 +36,6 @@ def _get_full_name(w_cm): def patch_compiled_method(): def _my_post_init(self): - from rpython.rlib import rvmprof rvmprof.register_code(self, _get_full_name) W_CompiledMethod.post_init = _my_post_init From d22bb56c4e2337310ff3eb6b859e260a9998695c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 1 May 2017 14:30:31 +0200 Subject: [PATCH 180/193] =?UTF-8?q?Disable=20=5Fvmprof=20in=20Topaz?= =?UTF-8?q?=E2=80=99s=20objspace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rsqueakvm/plugins/ruby/objspace.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rsqueakvm/plugins/ruby/objspace.py b/rsqueakvm/plugins/ruby/objspace.py index af32e29d..1732558d 100644 --- a/rsqueakvm/plugins/ruby/objspace.py +++ b/rsqueakvm/plugins/ruby/objspace.py @@ -11,6 +11,7 @@ def new_topaz_objspace(): config = get_combined_translation_config(translating=translating) config.set(**get_topaz_config_options()) config.translation.suggest(check_str_without_nul=True) + config.objspace.usemodules._vmprof = False return ObjectSpace(config) ruby_space = new_topaz_objspace() From 6b3247608c247b5bbf774b3124a4a51c2cbd31f2 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 1 May 2017 16:15:13 +0200 Subject: [PATCH 181/193] =?UTF-8?q?Revert=20"Disable=20=5Fvmprof=20in=20To?= =?UTF-8?q?paz=E2=80=99s=20objspace"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d22bb56c4e2337310ff3eb6b859e260a9998695c. --- rsqueakvm/plugins/ruby/objspace.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rsqueakvm/plugins/ruby/objspace.py b/rsqueakvm/plugins/ruby/objspace.py index 1732558d..af32e29d 100644 --- a/rsqueakvm/plugins/ruby/objspace.py +++ b/rsqueakvm/plugins/ruby/objspace.py @@ -11,7 +11,6 @@ def new_topaz_objspace(): config = get_combined_translation_config(translating=translating) config.set(**get_topaz_config_options()) config.translation.suggest(check_str_without_nul=True) - config.objspace.usemodules._vmprof = False return ObjectSpace(config) ruby_space = new_topaz_objspace() From 8411fd1c6be76fe8df6cfd95bbbd2f15fb127f40 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 2 May 2017 13:27:10 +0200 Subject: [PATCH 182/193] Simplify method_exists() --- rsqueakvm/plugins/foreign_language/model.py | 18 +++++++++++------- rsqueakvm/plugins/python/model.py | 12 ++++-------- rsqueakvm/plugins/ruby/model.py | 9 ++------- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py index c2c42192..4ca3d309 100644 --- a/rsqueakvm/plugins/foreign_language/model.py +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -136,20 +136,24 @@ def lookup(self, w_selector): w_cm = lookup_cls.as_class_get_shadow(self.space).lookup(w_selector) if w_cm is not None: return w_cm - if self.method_exists(w_selector): + method_name = w_selector.unwrap_string(self.space) + idx = method_name.find(':') + if idx > 0: + method_name = method_name[0:idx] + if self.method_exists(method_name): return self.make_method(w_selector) # try underscore fallback - methodname = w_selector.unwrap_string(self.space) - if len(methodname) > 1 and methodname[0] == '_': - w_fallback_selector = self.space.wrap_symbol(methodname[1:]) - if self.method_exists(w_fallback_selector): - return self.make_method(w_fallback_selector) + if len(method_name) > 1 and method_name[0] == '_': + fallback_method_name = method_name[1:] + if self.method_exists(fallback_method_name): + return self.make_method( + self.space.wrap_symbol(fallback_method_name)) return None # triggers a MNU # Abstract methods - def method_exists(self, w_selector): + def method_exists(self, method_name): raise NotImplementedError # Helpers diff --git a/rsqueakvm/plugins/python/model.py b/rsqueakvm/plugins/python/model.py index 8cc4dca5..04e26328 100644 --- a/rsqueakvm/plugins/python/model.py +++ b/rsqueakvm/plugins/python/model.py @@ -42,18 +42,14 @@ def __init__(self, space, wp_object): self.wp_object = wp_object ForeignLanguageClassShadow.__init__(self, space) - def method_exists(self, w_selector): + def method_exists(self, method_name): # import pdb; pdb.set_trace() - methodname = self.space.unwrap_string(w_selector) - idx = methodname.find(':') - if idx > 0: - methodname = methodname[0:idx] - wp_methodname = py_space.newtext(methodname) + wp_method_name = py_space.newtext(method_name) try: - if py_space.getattr(self.wp_object, wp_methodname) is not None: + if py_space.getattr(self.wp_object, wp_method_name) is not None: return True except OperationError as operror: print operror.errorstr(py_space) except Exception as e: - print 'Unable to create method %s: %s' % (methodname, e) + print 'Unable to create method %s: %s' % (method_name, e) return False diff --git a/rsqueakvm/plugins/ruby/model.py b/rsqueakvm/plugins/ruby/model.py index 178a057f..99063d91 100644 --- a/rsqueakvm/plugins/ruby/model.py +++ b/rsqueakvm/plugins/ruby/model.py @@ -41,10 +41,5 @@ def __init__(self, space, wr_class): self.name = wr_class.name ForeignLanguageClassShadow.__init__(self, space) - def method_exists(self, w_selector): - methodname = self.space.unwrap_string(w_selector) - idx = methodname.find(':') - if idx > 0: - methodname = methodname[0:idx] - ruby_method = self.wr_class.find_method(ruby_space, methodname) - return ruby_method is not None + def method_exists(self, method_name): + return self.wr_class.find_method(ruby_space, method_name) is not None From a4e3d70c4672c0ae59528999191f359a57675356 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 2 May 2017 13:28:02 +0200 Subject: [PATCH 183/193] Simplify primitives that take a language process --- rsqueakvm/plugins/foreign_language/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index c75a67bc..dc821281 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -60,9 +60,9 @@ def eval(interp, s_frame, argcount): s_frame.pop_n(argcount + 1) return frame - @self.expose_primitive(unwrap_spec=[object, object], + @self.expose_primitive(unwrap_spec=[object], result_is_new_frame=True) - def resume(interp, s_frame, w_rcvr, language_process): + def resume(interp, s_frame, language_process): # print 'Smalltalk yield' # import pdb; pdb.set_trace() if not isinstance(language_process, W_ForeignLanguageProcess): @@ -94,8 +94,8 @@ def send(interp, s_frame, argcount, w_method): s_frame.pop_n(argcount + 1) return frame - @self.expose_primitive(unwrap_spec=[object, object]) - def lastError(interp, s_frame, w_rcvr, language_process): + @self.expose_primitive(unwrap_spec=[object]) + def lastError(interp, s_frame, language_process): if not isinstance(language_process, W_ForeignLanguageProcess): raise PrimitiveFailedError w_error = language_process.get_error() @@ -104,8 +104,8 @@ def lastError(interp, s_frame, w_rcvr, language_process): raise PrimitiveFailedError return w_error - @self.expose_primitive(unwrap_spec=[object, object]) - def getTopFrame(interp, s_frame, w_rcvr, language_process): + @self.expose_primitive(unwrap_spec=[object]) + def getTopFrame(interp, s_frame, language_process): if not isinstance(language_process, W_ForeignLanguageProcess): raise PrimitiveFailedError w_top_frame = language_process.w_top_frame() From 888ec29188ab85fad0e9643797927dd4dfc7aed0 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 6 May 2017 14:31:01 +0200 Subject: [PATCH 184/193] Add support for Array to tuple conversion --- rsqueakvm/plugins/python/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 5db72534..16d6edbe 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -100,6 +100,9 @@ def smalltalk_to_python(space, w_object): elif isinstance(w_object, W_BytesObject): # if w_object.getclass(space).is_same_object(space.w_String): return py_space.newtext(space.unwrap_string(w_object)) + elif w_object.getclass(space).is_same_object(space.w_Array): + return py_space.newtuple([smalltalk_to_python(space, x) + for x in space.unwrap_array(w_object)]) # import pdb; pdb.set_trace() print 'Cannot convert %s to Python' % w_object return py_space.w_None From caed4708d46fde9084c9f77c67b8cfb121661091 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 6 May 2017 20:43:49 +0200 Subject: [PATCH 185/193] Expose lang processes as instance of FLProcess Also, eval primitive only creates a new lang process. The resume primitive is the only one which can execute a foreign language. This way, the debugger opening logic only needs to be implemented once --- .../plugins/foreign_language/__init__.py | 6 +-- rsqueakvm/plugins/foreign_language/process.py | 50 +++++++++---------- rsqueakvm/plugins/foreign_language/runner.py | 26 ++++------ rsqueakvm/plugins/python/__init__.py | 2 +- rsqueakvm/plugins/python/process.py | 3 +- rsqueakvm/plugins/ruby/__init__.py | 2 +- rsqueakvm/plugins/ruby/process.py | 1 + 7 files changed, 41 insertions(+), 49 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index dc821281..5243902c 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -51,10 +51,7 @@ def eval(interp, s_frame, argcount): # import pdb; pdb.set_trace() args_w = s_frame.peek_n(argcount) language_process = self.new_eval_process(interp.space, args_w) - language_process.start() # when we are here, the foreign language process has yielded - if language_process.error_detected(): - raise PrimitiveFailedError frame = language_process.switch_to_smalltalk( interp, s_frame, first_call=True) s_frame.pop_n(argcount + 1) @@ -88,7 +85,6 @@ def send(interp, s_frame, argcount, w_method): method_name = method_name[0:idx] language_process = self.new_send_process( interp.space, w_rcvr, method_name, args_w) - language_process.start() frame = language_process.switch_to_smalltalk( interp, s_frame, first_call=True) s_frame.pop_n(argcount + 1) @@ -105,7 +101,7 @@ def lastError(interp, s_frame, language_process): return w_error @self.expose_primitive(unwrap_spec=[object]) - def getTopFrame(interp, s_frame, language_process): + def topFrame(interp, s_frame, language_process): if not isinstance(language_process, W_ForeignLanguageProcess): raise PrimitiveFailedError w_top_frame = language_process.w_top_frame() diff --git a/rsqueakvm/plugins/foreign_language/process.py b/rsqueakvm/plugins/foreign_language/process.py index 399b9afd..c7ccc712 100644 --- a/rsqueakvm/plugins/foreign_language/process.py +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -14,13 +14,13 @@ def __new__(cls, name, bases, attrs): # import pdb; pdb.set_trace() if name != 'W_ForeignLanguageProcess': - w_foreign_class = QuasiConstant(None, cls=W_PointersObject) + w_foreign_process_class = QuasiConstant(None, cls=W_PointersObject) - def foreign_class(self): - return w_foreign_class.get() + def foreign_process_class(self): + return w_foreign_process_class.get() - attrs['w_foreign_class'] = w_foreign_class - attrs['foreign_class'] = foreign_class + attrs['w_foreign_process_class'] = w_foreign_process_class + attrs['foreign_process_class'] = foreign_process_class return type.__new__(cls, name, bases, attrs) @@ -48,6 +48,8 @@ def __init__(self, space, w_rcvr=None, method_name='', args_w=None, self.w_error = None self._is_send = is_send self._break_on_exceptions = break_on_exceptions + + def init_runner(self): if objectmodel.we_are_translated(): self._runner = runner.StackletLanguageRunner(self) else: @@ -58,34 +60,34 @@ def space(self): @staticmethod def load_special_objects(cls, language_name, space): - language_class = space.smalltalk_at(language_name) - if language_class is None: + language_process_class = space.smalltalk_at( + '%sProcess' % language_name) + if language_process_class is None: # disable plugin? print '%s class not found.' % language_name - cls.w_foreign_class.set(language_class) + cls.w_foreign_process_class.set(language_process_class) # this part is called twice -> make better - foreign_class = space.smalltalk_at('ForeignLanguage') + foreign_class = space.smalltalk_at('ForeignLanguageProcess') if foreign_class is None: print 'ForeignLanguage class not found.' return - eval_method_symbol = space.wrap_symbol('vmEval:') - foreign_cls_cls_s = foreign_class.getclass( - space).as_class_get_shadow(space) - eval_method = foreign_cls_cls_s.lookup(eval_method_symbol) + language_process_class_s = language_process_class.as_class_get_shadow( + space) + + eval_method_symbol = space.wrap_symbol('vmEval') + eval_method = language_process_class_s.lookup(eval_method_symbol) if eval_method is None: - print '%s class>>vmEval: method not found.' % language_name + print 'ForeignLanguageProcess>>vmEval method not found.' W_ForeignLanguageProcess.eval_method.set(eval_method) - resume_method_symbol = space.wrap_symbol('vmResume:') - foreign_cls_cls_s = foreign_class.getclass( - space).as_class_get_shadow(space) - resume_method = foreign_cls_cls_s.lookup( + resume_method_symbol = space.wrap_symbol('vmResume') + resume_method = language_process_class_s.lookup( resume_method_symbol) if resume_method is None: - print '%s class>>vmResume: method not found.' % language_name + print 'ForeignLanguageProcess>>vmResume: method not found.' W_ForeignLanguageProcess.resume_method.set(resume_method) # W_AbstractObjectWithIdentityHash overrides @@ -107,7 +109,7 @@ def store(self, space, n0, w_value): pass def getclass(self, space): - return self.foreign_class() + return self.foreign_process_class() # Abstract methods @@ -148,9 +150,6 @@ def guarded_send(self): return self.send() - def start(self): - self.runner().start() - def resume(self): if self.is_done(): # import pdb; pdb.set_trace() @@ -231,8 +230,7 @@ def _build_resume_method(self, space, is_eval=False): method = self.eval_method.get() else: method = self.resume_method.get() - return ContextPartShadow.build_method_context( - space, method, self.foreign_class(), [self]) + return ContextPartShadow.build_method_context(space, method, self) def _create_return_frame(self, space): from rsqueakvm.storage_contexts import ContextPartShadow @@ -250,7 +248,7 @@ def _create_return_frame(self, space): w_cm = objectmodel.instantiate(W_SpurCompiledMethod) else: w_cm = objectmodel.instantiate(W_PreSpurCompiledMethod) - w_resume_class = self.foreign_class() + w_resume_class = self.foreign_process_class() w_cm.header = 0 w_cm._primitive = 0 w_cm.literalsize = 3 diff --git a/rsqueakvm/plugins/foreign_language/runner.py b/rsqueakvm/plugins/foreign_language/runner.py index 68eddbc1..50376e58 100644 --- a/rsqueakvm/plugins/foreign_language/runner.py +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -6,16 +6,12 @@ class AbstractLanguageRunner(): def __init__(self, language_process): + log('Starting %s...' % language_process) self._language_process = language_process def language_process(self): return self._language_process - def start(self): - log('Starting %s...' % self.language_process()) - self.language_process().pre_resume() - self._start_thread() - def resume(self): log('Resuming %s...' % self.language_process()) self.language_process().pre_resume() @@ -27,9 +23,6 @@ def return_to_smalltalk(self): def resumable(self): raise NotImplementedError - def _start_thread(self): - raise NotImplementedError - def _resume_thread(self): raise NotImplementedError @@ -43,16 +36,13 @@ class StackletLanguageRunner(AbstractLanguageRunner): def __init__(self, language_process): AbstractLanguageRunner.__init__(self, language_process) self.sthread = StackletThread() + global_execution_state.origin = self # there can only be one valid handle at a time (main or foreign thread) - self.handle = self.sthread.get_null_handle() + self.handle = self.sthread.new(self.__class__.new_stacklet_callback) def resumable(self): return self._has_valid_handle() - def _start_thread(self): - global_execution_state.origin = self - self.handle = self.sthread.new(self.__class__.new_stacklet_callback) - def _resume_thread(self): self._switch_to_handle() @@ -88,17 +78,23 @@ def new_stacklet_callback(h, arg): self = global_execution_state.origin self.handle = h global_execution_state.clear() + # stacklets start immediate, so yield back before executing any code, + # code is only executed when the resume primitive is used, + # eval primitive only creates a new language process + self.return_to_smalltalk() self.language_process().safe_run() global_execution_state.origin = self return self.handle # return to Smalltalk when done class GreenletLanguageRunner(AbstractLanguageRunner): - def _start_thread(self): + + def __init__(self, language_process): from greenlet import greenlet + + AbstractLanguageRunner.__init__(self, language_process) global_execution_state.origin = self self.greenlet = greenlet(self.__class__.new_greenlet_callback()) - self.resume() # stacklets also start immediately def resumable(self): return not self.greenlet.dead diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index 364c455b..ae0109fb 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -39,7 +39,7 @@ def is_enabled(self): return ForeignLanguagePlugin.is_enabled(self) def is_operational(self): - return (W_PythonProcess.w_foreign_class.get() is not None and + return (W_PythonProcess.w_foreign_process_class.get() is not None and PythonClassShadow.w_foreign_class.get() is not None) def setup(self): diff --git a/rsqueakvm/plugins/python/process.py b/rsqueakvm/plugins/python/process.py index da812f60..4f657ac2 100644 --- a/rsqueakvm/plugins/python/process.py +++ b/rsqueakvm/plugins/python/process.py @@ -21,6 +21,7 @@ def __init__(self, space, w_rcvr=None, method_name='', args_w=None, self.filename = filename self.cmd = cmd self.ec = py_space.createexecutioncontext() + self.init_runner() def eval(self): if self.source == '' or self.filename == '' or self.cmd == '': @@ -79,4 +80,4 @@ def guess_classname(self): return self.repr_classname def str_content(self): - return self.cmd + return '%s: "%s"' % (self.cmd, self.source) diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 89ea5881..2722fc80 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -34,7 +34,7 @@ def is_enabled(self): return ForeignLanguagePlugin.is_enabled(self) def is_operational(self): - return (W_RubyProcess.w_foreign_class.get() is not None and + return (W_RubyProcess.w_foreign_process_class.get() is not None and RubyClassShadow.w_foreign_class.get() is not None) def setup(self): diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index 7713bfe9..b8947ba5 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -21,6 +21,7 @@ def __init__(self, space, w_rcvr=None, method_name='', args_w=None, self.source = source self.filepath = filepath self.ec = ExecutionContext() + self.init_runner() def eval(self): if self.source == '': From 2324cbc7e2a9d705ab76b0aa8595245257f7bde8 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Sat, 6 May 2017 20:44:14 +0200 Subject: [PATCH 186/193] Update in-image code after last vm changes --- .../class/checkForException..st | 7 ------- .../class/compilePrimitivesIn..st | 1 + .../{primGetTopFrame..st => primGetTopFrame.st} | 2 +- .../{primLastError..st => primLastError.st} | 2 +- .../class/{primResume..st => primResume.st} | 2 +- .../ForeignLanguage.class/class/vmEval..st | 5 ----- .../ForeignLanguage.class/methodProperties.json | 17 ++++------------- .../class/isVariable.st | 3 +++ .../methodProperties.json | 2 +- .../ForeignLanguageProcess.class/README.md | 0 .../instance/checkForException.st | 7 +++++++ .../instance}/debuggerTitle..st | 2 +- .../instance}/findResumeFrame..st | 4 ++-- .../instance}/getForeignFrames..st | 2 +- .../instance}/newForeignContextFor..st | 0 .../instance/openDebuggerOn..st} | 6 +++--- .../instance/prependContexts..st} | 6 +++--- .../instance/primLastError.st | 3 +++ .../instance/primResume.st | 3 +++ .../instance/primTopFrame.st | 3 +++ .../instance/vmEval.st | 5 +++++ .../instance/vmResume.st} | 4 ++-- .../methodProperties.json | 16 ++++++++++++++++ .../properties.json | 14 ++++++++++++++ .../monticello.meta/version | 2 +- .../instance/fieldList.st | 2 +- .../instance/selection.st | 7 +++---- .../methodProperties.json | 4 ++-- .../instance/process.controller.context..st | 4 ++-- .../FLDebugger.class/methodProperties.json | 2 +- .../monticello.meta/version | 2 +- .../Python.class/class/primGetTopFrame..st | 4 ---- .../Python.class/methodProperties.json | 5 ----- .../PythonProcess.class/README.md | 0 .../instance}/debuggerTitle..st | 2 +- .../instance}/getForeignFrames..st | 2 +- .../instance/primLastError.st} | 2 +- .../instance/primResume.st} | 2 +- .../instance/primTopFrame.st | 4 ++++ .../PythonProcess.class/methodProperties.json | 9 +++++++++ .../PythonProcess.class/properties.json | 14 ++++++++++++++ .../Python-Core.package/monticello.meta/version | 2 +- .../Ruby.class/class/primGetTopFrame..st | 4 ---- .../Ruby.class/methodProperties.json | 5 ----- .../RubyProcess.class/README.md | 0 .../instance}/debuggerTitle..st | 2 +- .../instance}/getForeignFrames..st | 2 +- .../instance/primLastError.st} | 2 +- .../instance/primResume.st} | 2 +- .../RubyProcess.class/instance/primTopFrame.st | 4 ++++ .../RubyProcess.class/methodProperties.json | 9 +++++++++ .../RubyProcess.class/properties.json | 14 ++++++++++++++ .../Ruby-Core.package/monticello.meta/version | 2 +- 53 files changed, 150 insertions(+), 81 deletions(-) delete mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st rename repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/{primGetTopFrame..st => primGetTopFrame.st} (75%) rename repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/{primLastError..st => primLastError.st} (73%) rename repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/{primResume..st => primResume.st} (74%) delete mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmEval..st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/class/isVariable.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/README.md create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st rename repository/ForeignLanguage-Core.package/{ForeignLanguage.class/class => ForeignLanguageProcess.class/instance}/debuggerTitle..st (84%) rename repository/ForeignLanguage-Core.package/{ForeignLanguage.class/class => ForeignLanguageProcess.class/instance}/findResumeFrame..st (78%) rename repository/ForeignLanguage-Core.package/{ForeignLanguage.class/class => ForeignLanguageProcess.class/instance}/getForeignFrames..st (86%) rename repository/ForeignLanguage-Core.package/{ForeignLanguage.class/class => ForeignLanguageProcess.class/instance}/newForeignContextFor..st (100%) rename repository/ForeignLanguage-Core.package/{ForeignLanguage.class/class/openDebuggerOn.languageProcess..st => ForeignLanguageProcess.class/instance/openDebuggerOn..st} (56%) rename repository/ForeignLanguage-Core.package/{ForeignLanguage.class/class/prependContexts.languageProcess..st => ForeignLanguageProcess.class/instance/prependContexts..st} (67%) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primLastError.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primResume.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primTopFrame.st create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmEval.st rename repository/ForeignLanguage-Core.package/{ForeignLanguage.class/class/vmResume..st => ForeignLanguageProcess.class/instance/vmResume.st} (58%) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/properties.json delete mode 100644 repository/Python-Core.package/Python.class/class/primGetTopFrame..st create mode 100644 repository/Python-Core.package/PythonProcess.class/README.md rename repository/Python-Core.package/{Python.class/class => PythonProcess.class/instance}/debuggerTitle..st (90%) rename repository/Python-Core.package/{Python.class/class => PythonProcess.class/instance}/getForeignFrames..st (96%) rename repository/Python-Core.package/{Python.class/class/primLastError..st => PythonProcess.class/instance/primLastError.st} (74%) rename repository/Python-Core.package/{Python.class/class/primResume..st => PythonProcess.class/instance/primResume.st} (79%) create mode 100644 repository/Python-Core.package/PythonProcess.class/instance/primTopFrame.st create mode 100644 repository/Python-Core.package/PythonProcess.class/methodProperties.json create mode 100644 repository/Python-Core.package/PythonProcess.class/properties.json delete mode 100644 repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame..st create mode 100644 repository/Ruby-Core.package/RubyProcess.class/README.md rename repository/Ruby-Core.package/{Ruby.class/class => RubyProcess.class/instance}/debuggerTitle..st (87%) rename repository/Ruby-Core.package/{Ruby.class/class => RubyProcess.class/instance}/getForeignFrames..st (96%) rename repository/Ruby-Core.package/{Ruby.class/class/primLastError..st => RubyProcess.class/instance/primLastError.st} (73%) rename repository/Ruby-Core.package/{Ruby.class/class/primResume..st => RubyProcess.class/instance/primResume.st} (79%) create mode 100644 repository/Ruby-Core.package/RubyProcess.class/instance/primTopFrame.st create mode 100644 repository/Ruby-Core.package/RubyProcess.class/methodProperties.json create mode 100644 repository/Ruby-Core.package/RubyProcess.class/properties.json diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st deleted file mode 100644 index 4fe84ad7..00000000 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/checkForException..st +++ /dev/null @@ -1,7 +0,0 @@ -debugging -checkForException: languageProcess - Smalltalk isHeadless ifTrue: [ ^ self ]. - (self primLastError: languageProcess) ifNotNil: [ :e | - FLException new - action: [ self openDebuggerOn: e languageProcess: languageProcess ]; - signal ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st index fab5c78b..620a3a7d 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st @@ -1,6 +1,7 @@ initialize-release compilePrimitivesIn: newClass | primitiveSelectors | + self flag: #instanceSidePrimitives. primitiveSelectors := ForeignLanguage class organization listAtCategoryNamed: 'system primitives'. primitiveSelectors do: [:selector | | template | template := (ForeignLanguage class >> selector) getSource asString. diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame.st similarity index 75% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st rename to repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame.st index a98388a9..86b19800 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame.st @@ -1,4 +1,4 @@ system primitives -primGetTopFrame: languageProcess +primGetTopFrame self primitiveFailed. \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError.st similarity index 73% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError..st rename to repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError.st index a4a8624c..d8c5ffed 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError.st @@ -1,4 +1,4 @@ system primitives -primLastError: languageProcess +primLastError ^ nil \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume.st similarity index 74% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume..st rename to repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume.st index d8f307d4..971dddb5 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume.st @@ -1,4 +1,4 @@ system primitives -primResume: languageProcess +primResume ^ nil \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmEval..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmEval..st deleted file mode 100644 index 11fafeea..00000000 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmEval..st +++ /dev/null @@ -1,5 +0,0 @@ -special methods -vmEval: languageProcess - [ ^ self vmResume: languageProcess ] on: Error do: [ - self checkForException: languageProcess. - ^ self vmEval: languageProcess ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json index 5718b33a..97bdfc19 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json @@ -1,36 +1,27 @@ { "class" : { "availableLanguages" : "fn 3/14/2017 11:15", - "checkForException:" : "fn 4/28/2017 16:07", - "compilePrimitivesIn:" : "fn 4/28/2017 16:01", + "compilePrimitivesIn:" : "fn 5/6/2017 13:20", "debuggerPrintItem:on:" : "fn 3/16/2017 22:31", - "debuggerTitle:" : "fn 3/16/2017 15:12", "evaluateExpression:in:to:" : "fn 3/21/2017 11:32", "fileExtension" : "fn 3/17/2017 10:20", - "findResumeFrame:" : "fn 4/2/2017 00:34", "getContentsOf:" : "fn 3/27/2017 21:54", "getFilename:" : "fn 4/2/2017 19:32", - "getForeignFrames:" : "fn 3/16/2017 21:26", "getSource:" : "fn 3/16/2017 21:57", "highlight:" : "fn 3/14/2017 11:27", - "newForeignContextFor:" : "fn 4/28/2017 16:07", - "openDebuggerOn:languageProcess:" : "fn 4/28/2017 16:06", "pcRange:" : "fn 3/16/2017 22:03", "persistEvalCode:" : "fn 3/17/2017 10:23", - "prependContexts:languageProcess:" : "fn 3/22/2017 15:15", "primEval:" : "fn 4/28/2017 15:30", - "primGetTopFrame:" : "fn 4/28/2017 15:28", - "primLastError:" : "fn 4/28/2017 15:29", + "primGetTopFrame" : "fn 5/2/2017 13:13", + "primLastError" : "fn 5/2/2017 13:11", "primRestartSpecificFrame:" : "fn 4/28/2017 15:31", - "primResume:" : "fn 4/28/2017 15:29", + "primResume" : "fn 5/2/2017 13:10", "restartFrame:with:" : "fn 3/16/2017 21:57", "sourceCodeTemplate" : "fn 3/14/2017 11:23", "stylerFormat:" : "fn 3/14/2017 11:21", "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 4/28/2017 16:00", "tempNamesIn:" : "fn 3/16/2017 22:45", "tempVariableAt:in:" : "fn 3/16/2017 22:44", - "vmEval:" : "fn 4/2/2017 00:36", - "vmResume:" : "fn 4/2/2017 00:36", "vmSpeaksLanguage" : "fn 3/14/2017 11:31" }, "instance" : { } } diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/class/isVariable.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/class/isVariable.st new file mode 100644 index 00000000..56d9d1ec --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/class/isVariable.st @@ -0,0 +1,3 @@ +testing +isVariable + ^ false \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json index 9b5ad55a..d5533685 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json @@ -1,6 +1,6 @@ { "class" : { - }, + "isVariable" : "fn 4/28/2017 17:09" }, "instance" : { "allInstVarNames" : "fn 3/14/2017 12:02", "asSmalltalk" : "fn 3/12/2017 19:22", diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/README.md b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st new file mode 100644 index 00000000..e5df627c --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st @@ -0,0 +1,7 @@ +helpers +checkForException + Smalltalk isHeadless ifTrue: [ ^ self ]. + (self primLastError) ifNotNil: [ :e | + FLException new + action: [ self openDebuggerOn: e ]; + signal ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerTitle..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/debuggerTitle..st similarity index 84% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerTitle..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/debuggerTitle..st index 198301fe..f11375bc 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/debuggerTitle..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/debuggerTitle..st @@ -1,3 +1,3 @@ -debugging +helpers debuggerTitle: foreignError self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeFrame..st similarity index 78% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeFrame..st index e036c435..a75a794c 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/findResumeFrame..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeFrame..st @@ -1,9 +1,9 @@ -debugging +helpers findResumeFrame: aContext | currentCtx | currentCtx := aContext. [ currentCtx notNil ] whileTrue: [ - (currentCtx method selector = #vmEval: + (currentCtx method selector = #vmEval "special selector" and: [ currentCtx closure isNil ]) ifTrue: [ ^ currentCtx ]. currentCtx := currentCtx sender ]. diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getForeignFrames..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/getForeignFrames..st similarity index 86% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getForeignFrames..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/getForeignFrames..st index 7412ae41..83f93a95 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getForeignFrames..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/getForeignFrames..st @@ -1,3 +1,3 @@ -debugging +helpers getForeignFrames: topForeignFrame self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/newForeignContextFor..st similarity index 100% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/newForeignContextFor..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/newForeignContextFor..st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st similarity index 56% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st index a00b07e1..e0064678 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/openDebuggerOn.languageProcess..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st @@ -1,10 +1,10 @@ -debugging -openDebuggerOn: foreignError languageProcess: languageProcess +helpers +openDebuggerOn: foreignError | resumeCtx | resumeCtx := self findResumeFrame: thisContext sender. FLDebugger openOn: Processor activeProcess - context: (self prependContexts: resumeCtx languageProcess: languageProcess) + context: (self prependContexts: resumeCtx) label: (self debuggerTitle: foreignError) contents: nil fullView: true \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/prependContexts.languageProcess..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/prependContexts..st similarity index 67% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/prependContexts.languageProcess..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/prependContexts..st index d65d10ed..c92b13a0 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/prependContexts.languageProcess..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/prependContexts..st @@ -1,7 +1,7 @@ -debugging -prependContexts: resumeContext languageProcess: languageProcess +helpers +prependContexts: resumeContext | topForeignFrame newFrames | - [ topForeignFrame := self primGetTopFrame: languageProcess ] + [ topForeignFrame := self primTopFrame ] on: Error do: [ ^ resumeContext ]. newFrames := ((self getForeignFrames: topForeignFrame) collect: [ :ea | self newForeignContextFor: ea ]) diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primLastError.st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primLastError.st new file mode 100644 index 00000000..eb7ac2f7 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primLastError.st @@ -0,0 +1,3 @@ +system primitives +primLastError + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primResume.st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primResume.st new file mode 100644 index 00000000..385cf90a --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primResume.st @@ -0,0 +1,3 @@ +system primitives +primResume + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primTopFrame.st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primTopFrame.st new file mode 100644 index 00000000..a8390f84 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/primTopFrame.st @@ -0,0 +1,3 @@ +system primitives +primTopFrame + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmEval.st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmEval.st new file mode 100644 index 00000000..a60599d9 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmEval.st @@ -0,0 +1,5 @@ +special methods +vmEval + [ ^ self vmResume ] on: Error do: [ + self checkForException. + ^ self vmEval ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmResume..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmResume.st similarity index 58% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmResume..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmResume.st index 45905733..e5f2661f 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/vmResume..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmResume.st @@ -1,5 +1,5 @@ special methods -vmResume: languageProcess +vmResume "Magic method that is called by vm (cached in vm)" Processor yield. - ^ self primResume: languageProcess \ No newline at end of file + ^ self primResume \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json new file mode 100644 index 00000000..4050a554 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json @@ -0,0 +1,16 @@ +{ + "class" : { + }, + "instance" : { + "checkForException" : "fn 5/6/2017 16:38", + "debuggerTitle:" : "fn 5/6/2017 16:42", + "findResumeFrame:" : "fn 5/6/2017 16:44", + "getForeignFrames:" : "fn 5/6/2017 16:48", + "newForeignContextFor:" : "fn 5/6/2017 16:47", + "openDebuggerOn:" : "fn 5/6/2017 16:40", + "prependContexts:" : "fn 5/6/2017 16:47", + "primLastError" : "fn 5/6/2017 14:14", + "primResume" : "fn 5/6/2017 14:14", + "primTopFrame" : "fn 5/6/2017 14:14", + "vmEval" : "fn 5/6/2017 14:12", + "vmResume" : "fn 5/6/2017 14:11" } } diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/properties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/properties.json new file mode 100644 index 00000000..2ee11e58 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "ForeignLanguageProcess", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/version b/repository/ForeignLanguage-Core.package/monticello.meta/version index 9c31db4d..37b7fd67 100644 --- a/repository/ForeignLanguage-Core.package/monticello.meta/version +++ b/repository/ForeignLanguage-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Core-fn.5' message 'Updates' id '1b83a434-c31d-45ae-a79c-00e02f2f7d0d' date '28 April 2017' time '4:43:06.982288 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Core-fn.6' message 'Move methods to new ForeignLanguageProcess class' id 'dd3b75bb-a218-40ab-b5f6-2f0c98f5d9c9' date '6 May 2017' time '8:41:15.238039 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.5' message 'Updates' id '1b83a434-c31d-45ae-a79c-00e02f2f7d0d' date '28 April 2017' time '4:43:06.982288 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/fieldList.st b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/fieldList.st index 52cb3b45..bc7e03ea 100644 --- a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/fieldList.st +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/fieldList.st @@ -1,4 +1,4 @@ overrides fieldList self object isForeign ifFalse: [ ^ super fieldList ]. - ^fieldList ifNil:[fieldList := (Array with: 'thisContext' with: 'foreign frame' with: 'filename') , object tempNames] \ No newline at end of file + ^fieldList ifNil:[fieldList := #('- thisContext -' '- filename -'), object tempNames] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/selection.st b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/selection.st index e87e67aa..22c92a14 100644 --- a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/selection.st +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/selection.st @@ -2,9 +2,8 @@ overrides selection self object isForeign ifFalse: [ ^ super selection ]. selectionIndex = 0 ifTrue: [^ '']. - selectionIndex = 1 ifTrue: [^ object ]. - selectionIndex = 2 ifTrue: [^ object foreignFrame ]. + selectionIndex = 1 ifTrue: [^ object foreignFrame ]. Smalltalk at: object languageSymbol ifPresent: [ :cls | - selectionIndex = 3 ifTrue: [^ cls getFilename: object foreignFrame ]. - ^ cls tempVariableAt: selectionIndex - 3 in: object foreignFrame ]. + selectionIndex = 2 ifTrue: [^ cls getFilename: object foreignFrame ]. + ^ cls tempVariableAt: selectionIndex - 2 in: object foreignFrame ]. ^ 'Unexpected selection' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json index 806c1384..161ae7e7 100644 --- a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json @@ -2,5 +2,5 @@ "class" : { }, "instance" : { - "fieldList" : "fn 4/2/2017 19:30", - "selection" : "fn 4/2/2017 19:33" } } + "fieldList" : "fn 5/6/2017 17:00", + "selection" : "fn 5/6/2017 17:01" } } diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st index 0e08d8db..18d7c1e8 100644 --- a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st @@ -2,7 +2,7 @@ overrides process: aProcess controller: aController context: aContext | ctx | (aContext method selector = #vmResume: and: [ - aContext receiver inheritsFrom: ForeignLanguage ]) + aContext receiver inheritsFrom: ForeignLanguageProcess ]) ifFalse: [ ^ super process: aProcess controller: aController context: aContext]. - ctx := aContext receiver prependContexts: aContext languageProcess: (aContext at: 1). + ctx := aContext receiver prependContexts: aContext. super process: aProcess controller: aController context: ctx \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json index dfdd7da5..8ebf3203 100644 --- a/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json @@ -13,5 +13,5 @@ "languageSymbol" : "fn 3/14/2017 01:32", "messageIconAt:" : "fn 3/16/2017 22:18", "pcRange" : "fn 3/16/2017 22:18", - "process:controller:context:" : "fn 4/2/2017 13:17", + "process:controller:context:" : "fn 5/6/2017 16:41", "selectedMessage" : "fn 3/16/2017 21:49" } } diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/version b/repository/ForeignLanguage-Tools.package/monticello.meta/version index 88b3ba59..676d28e4 100644 --- a/repository/ForeignLanguage-Tools.package/monticello.meta/version +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Tools-fn.5' message 'Use FL namespace instead' id '996f4850-069f-46b0-95f0-e26ed5627893' date '28 April 2017' time '4:43:38.939853 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.4' message 'Update in-image code' id 'b7af137b-818c-4196-9439-01a40952f2ba' date '31 March 2017' time '12:39:05.754067 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Tools-fn.6' message 'Minor tool improvements and updates' id '5c5d251f-b118-4ff1-9b8e-0935768648c2' date '6 May 2017' time '8:41:34.05681 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.5' message 'Use FL namespace instead' id '996f4850-069f-46b0-95f0-e26ed5627893' date '28 April 2017' time '4:43:38.939853 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.4' message 'Update in-image code' id 'b7af137b-818c-4196-9439-01a40952f2ba' date '31 March 2017' time '12:39:05.754067 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primGetTopFrame..st b/repository/Python-Core.package/Python.class/class/primGetTopFrame..st deleted file mode 100644 index 82042ab2..00000000 --- a/repository/Python-Core.package/Python.class/class/primGetTopFrame..st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primGetTopFrame: pyProcess - - self primitiveFailed. \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json index 62235a35..a020e7e5 100644 --- a/repository/Python-Core.package/Python.class/methodProperties.json +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -7,7 +7,6 @@ "builtins" : "fn 2/23/2017 18:34", "cmdFor:" : "fn 3/16/2017 21:57", "debuggerPrintItem:on:" : "fn 3/16/2017 21:58", - "debuggerTitle:" : "fn 3/16/2017 15:12", "eval:" : "fn 3/21/2017 23:14", "eval:breakOnExceptions:" : "fn 3/11/2017 18:47", "evaluateExpression:" : "fn 3/27/2017 21:55", @@ -22,7 +21,6 @@ "from:load:" : "fn 1/9/2017 20:55", "fromObjectCache:" : "fn 2/23/2017 18:40", "getFilename:" : "fn 4/2/2017 19:33", - "getForeignFrames:" : "fn 3/16/2017 21:58", "getSignature:" : "fn 3/28/2017 01:38", "getSource:" : "fn 3/28/2017 12:02", "globals" : "fn 2/26/2017 21:46", @@ -39,10 +37,7 @@ "locals" : "fn 2/26/2017 21:46", "pcRange:" : "fn 3/16/2017 22:21", "primEval:filename:cmd:breakOnExceptions:" : "fn 3/11/2017 14:45", - "primGetTopFrame:" : "fn 3/22/2017 15:12", - "primLastError:" : "fn 3/22/2017 15:12", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", - "primResume:" : "fn 3/22/2017 15:12", "pyFormatter" : "fn 3/6/2017 07:20", "pyLexerPython" : "fn 3/6/2017 19:05", "pyLexerRuby" : "fn 3/28/2017 12:22", diff --git a/repository/Python-Core.package/PythonProcess.class/README.md b/repository/Python-Core.package/PythonProcess.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Core.package/Python.class/class/debuggerTitle..st b/repository/Python-Core.package/PythonProcess.class/instance/debuggerTitle..st similarity index 90% rename from repository/Python-Core.package/Python.class/class/debuggerTitle..st rename to repository/Python-Core.package/PythonProcess.class/instance/debuggerTitle..st index bdce6308..cc4e8b87 100644 --- a/repository/Python-Core.package/Python.class/class/debuggerTitle..st +++ b/repository/Python-Core.package/PythonProcess.class/instance/debuggerTitle..st @@ -1,4 +1,4 @@ -debugging +helpers debuggerTitle: pyError | error | error := pyError asSmalltalk. diff --git a/repository/Python-Core.package/Python.class/class/getForeignFrames..st b/repository/Python-Core.package/PythonProcess.class/instance/getForeignFrames..st similarity index 96% rename from repository/Python-Core.package/Python.class/class/getForeignFrames..st rename to repository/Python-Core.package/PythonProcess.class/instance/getForeignFrames..st index c3780ee3..de2cfb7e 100644 --- a/repository/Python-Core.package/Python.class/class/getForeignFrames..st +++ b/repository/Python-Core.package/PythonProcess.class/instance/getForeignFrames..st @@ -1,4 +1,4 @@ -debugging +helpers getForeignFrames: topPyFrame | currentPyFrame newFrames | currentPyFrame := topPyFrame. diff --git a/repository/Python-Core.package/Python.class/class/primLastError..st b/repository/Python-Core.package/PythonProcess.class/instance/primLastError.st similarity index 74% rename from repository/Python-Core.package/Python.class/class/primLastError..st rename to repository/Python-Core.package/PythonProcess.class/instance/primLastError.st index dca57b5f..5f036a85 100644 --- a/repository/Python-Core.package/Python.class/class/primLastError..st +++ b/repository/Python-Core.package/PythonProcess.class/instance/primLastError.st @@ -1,4 +1,4 @@ system primitives -primLastError: pyProcess +primLastError ^ nil \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primResume..st b/repository/Python-Core.package/PythonProcess.class/instance/primResume.st similarity index 79% rename from repository/Python-Core.package/Python.class/class/primResume..st rename to repository/Python-Core.package/PythonProcess.class/instance/primResume.st index 435b7a8c..22ebc7cf 100644 --- a/repository/Python-Core.package/Python.class/class/primResume..st +++ b/repository/Python-Core.package/PythonProcess.class/instance/primResume.st @@ -1,4 +1,4 @@ system primitives -primResume: pyProcess +primResume self primitiveFailed \ No newline at end of file diff --git a/repository/Python-Core.package/PythonProcess.class/instance/primTopFrame.st b/repository/Python-Core.package/PythonProcess.class/instance/primTopFrame.st new file mode 100644 index 00000000..c6d54ad1 --- /dev/null +++ b/repository/Python-Core.package/PythonProcess.class/instance/primTopFrame.st @@ -0,0 +1,4 @@ +system primitives +primTopFrame + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Python-Core.package/PythonProcess.class/methodProperties.json b/repository/Python-Core.package/PythonProcess.class/methodProperties.json new file mode 100644 index 00000000..cf6ee42e --- /dev/null +++ b/repository/Python-Core.package/PythonProcess.class/methodProperties.json @@ -0,0 +1,9 @@ +{ + "class" : { + }, + "instance" : { + "debuggerTitle:" : "fn 5/6/2017 16:42", + "getForeignFrames:" : "fn 5/6/2017 16:48", + "primLastError" : "fn 5/6/2017 14:05", + "primResume" : "fn 5/6/2017 14:05", + "primTopFrame" : "fn 5/6/2017 14:14" } } diff --git a/repository/Python-Core.package/PythonProcess.class/properties.json b/repository/Python-Core.package/PythonProcess.class/properties.json new file mode 100644 index 00000000..18a528c9 --- /dev/null +++ b/repository/Python-Core.package/PythonProcess.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonProcess", + "pools" : [ + ], + "super" : "ForeignLanguageProcess", + "type" : "normal" } diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index b4f5d37b..00698067 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.9' message 'Updates' id '1a2fafe2-19a7-4de3-b2e9-e47ca2977965' date '28 April 2017' time '4:43:57.571228 pm' author 'fn' ancestors ((name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.10' message 'Introduce PythonProcess class' id '422e4a4a-4424-4282-8442-23b6d1e55c8f' date '6 May 2017' time '8:41:59.105519 pm' author 'fn' ancestors ((name 'Python-Core-fn.9' message 'Updates' id '1a2fafe2-19a7-4de3-b2e9-e47ca2977965' date '28 April 2017' time '4:43:57.571228 pm' author 'fn' ancestors ((name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame..st b/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame..st deleted file mode 100644 index 6c14fc5b..00000000 --- a/repository/Ruby-Core.package/Ruby.class/class/primGetTopFrame..st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primGetTopFrame: rbProcess - - self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json index 345c2949..1c6417d9 100644 --- a/repository/Ruby-Core.package/Ruby.class/methodProperties.json +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -1,7 +1,6 @@ { "class" : { "debuggerPrintItem:on:" : "fn 4/2/2017 19:58", - "debuggerTitle:" : "fn 3/16/2017 22:47", "eval:" : "fn 3/16/2017 13:41", "eval:breakOnExceptions:" : "fn 3/23/2017 08:59", "eval:filePath:" : "fn 3/23/2017 08:59", @@ -10,7 +9,6 @@ "evaluateExpression:breakOnExceptions:" : "fn 3/27/2017 23:53", "fileExtension" : "fn 3/17/2017 10:20", "getFilename:" : "fn 4/2/2017 19:33", - "getForeignFrames:" : "fn 3/16/2017 22:22", "getSource:" : "fn 3/27/2017 23:54", "highlight:" : "fn 4/28/2017 16:08", "kernel" : "tfel 8/16/2016 07:04", @@ -19,9 +17,6 @@ "pcRange:" : "fn 4/2/2017 19:58", "primEval:" : "tfel 8/16/2016 07:03", "primEval:filePath:breakOnExceptions:" : "fn 3/16/2017 13:40", - "primGetTopFrame:" : "fn 3/22/2017 15:12", - "primLastError:" : "fn 3/22/2017 15:13", - "primResume:" : "fn 3/22/2017 15:13", "primSend:to:with:" : "tfel 8/16/2016 07:03", "restartFrame:with:" : "fn 3/16/2017 22:22", "sourceCodeTemplate" : "fn 3/14/2017 11:22", diff --git a/repository/Ruby-Core.package/RubyProcess.class/README.md b/repository/Ruby-Core.package/RubyProcess.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Ruby-Core.package/Ruby.class/class/debuggerTitle..st b/repository/Ruby-Core.package/RubyProcess.class/instance/debuggerTitle..st similarity index 87% rename from repository/Ruby-Core.package/Ruby.class/class/debuggerTitle..st rename to repository/Ruby-Core.package/RubyProcess.class/instance/debuggerTitle..st index 91986ba1..14228fdd 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/debuggerTitle..st +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/debuggerTitle..st @@ -1,3 +1,3 @@ -debugging +helpers debuggerTitle: rbError ^ rbError class asString, ': ', rbError asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/getForeignFrames..st b/repository/Ruby-Core.package/RubyProcess.class/instance/getForeignFrames..st similarity index 96% rename from repository/Ruby-Core.package/Ruby.class/class/getForeignFrames..st rename to repository/Ruby-Core.package/RubyProcess.class/instance/getForeignFrames..st index cffd487a..ae1be222 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/getForeignFrames..st +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/getForeignFrames..st @@ -1,4 +1,4 @@ -debugging +helpers getForeignFrames: topRbFrame | currentRbFrame newFrames | currentRbFrame := topRbFrame. diff --git a/repository/Ruby-Core.package/Ruby.class/class/primLastError..st b/repository/Ruby-Core.package/RubyProcess.class/instance/primLastError.st similarity index 73% rename from repository/Ruby-Core.package/Ruby.class/class/primLastError..st rename to repository/Ruby-Core.package/RubyProcess.class/instance/primLastError.st index 1795ac69..98ccca06 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/primLastError..st +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/primLastError.st @@ -1,4 +1,4 @@ system primitives -primLastError: rbProcess +primLastError ^ nil \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primResume..st b/repository/Ruby-Core.package/RubyProcess.class/instance/primResume.st similarity index 79% rename from repository/Ruby-Core.package/Ruby.class/class/primResume..st rename to repository/Ruby-Core.package/RubyProcess.class/instance/primResume.st index 42849ec0..17831ac0 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/primResume..st +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/primResume.st @@ -1,4 +1,4 @@ system primitives -primResume: rbProcess +primResume self primitiveFailed \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyProcess.class/instance/primTopFrame.st b/repository/Ruby-Core.package/RubyProcess.class/instance/primTopFrame.st new file mode 100644 index 00000000..919b685f --- /dev/null +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/primTopFrame.st @@ -0,0 +1,4 @@ +system primitives +primTopFrame + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyProcess.class/methodProperties.json b/repository/Ruby-Core.package/RubyProcess.class/methodProperties.json new file mode 100644 index 00000000..86ba744b --- /dev/null +++ b/repository/Ruby-Core.package/RubyProcess.class/methodProperties.json @@ -0,0 +1,9 @@ +{ + "class" : { + }, + "instance" : { + "debuggerTitle:" : "fn 5/6/2017 16:42", + "getForeignFrames:" : "fn 5/6/2017 16:48", + "primLastError" : "fn 5/6/2017 14:06", + "primResume" : "fn 5/6/2017 14:06", + "primTopFrame" : "fn 5/6/2017 14:15" } } diff --git a/repository/Ruby-Core.package/RubyProcess.class/properties.json b/repository/Ruby-Core.package/RubyProcess.class/properties.json new file mode 100644 index 00000000..90bae4e9 --- /dev/null +++ b/repository/Ruby-Core.package/RubyProcess.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Ruby-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "RubyProcess", + "pools" : [ + ], + "super" : "ForeignLanguageProcess", + "type" : "normal" } diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version index 58fb7399..84154518 100644 --- a/repository/Ruby-Core.package/monticello.meta/version +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 75d726ffc375c68591308ebd6e405e12137946a6 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 19 May 2017 12:14:07 +0200 Subject: [PATCH 187/193] Change or disable check interval in Topaz --- rsqueakvm/plugins/ruby/__init__.py | 2 ++ rsqueakvm/plugins/ruby/switching.py | 29 +++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 2722fc80..461735c8 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -1,6 +1,7 @@ from rsqueakvm.error import PrimitiveFailedError from rsqueakvm.model.variable import W_BytesObject from rsqueakvm.plugins.foreign_language import ForeignLanguagePlugin +from rsqueakvm.plugins.ruby.switching import interrupt_counter from rsqueakvm.util import system try: @@ -47,6 +48,7 @@ def startup(space, argv): ForeignLanguagePlugin.load_special_objects( space, RubyPlugin.language_name, W_RubyProcess, RubyClassShadow) ruby_space.setup(argv[0]) + interrupt_counter.setup() @staticmethod def new_eval_process(space, args_w): diff --git a/rsqueakvm/plugins/ruby/switching.py b/rsqueakvm/plugins/ruby/switching.py index 881666b2..ebabd0c6 100644 --- a/rsqueakvm/plugins/ruby/switching.py +++ b/rsqueakvm/plugins/ruby/switching.py @@ -1,16 +1,37 @@ -class InterruptCounter: - counter_size = 10000 +import os + +from rsqueakvm.util.cells import QuasiConstant +from rsqueakvm.plugins.foreign_language.utils import log + +class InterruptCounter: def __init__(self): + self.counter_size = QuasiConstant(10000) + self.interrupts_disabled = QuasiConstant(False) self.reset() + def setup(self): + try: + self.counter_size.set(int( + os.environ.get('TOPAZ_CHECK_INTERVAL') or '10000')) + self.interrupts_disabled.set(bool( + os.environ.get('TOPAZ_DISABLE_INTERRUPTS'))) + except: + pass + if self.interrupts_disabled.get(): + log('TOPAZ_DISABLE_INTERRUPTS set.') + else: + log('TOPAZ_CHECK_INTERVAL set to %s.' % self.counter_size.get()) + def reset(self): - self._counter = self.counter_size + self._counter = self.counter_size.get() def triggers(self, decr_by=1): + if self.interrupts_disabled.get(): + return False self._counter -= decr_by if self._counter <= 0: - self._counter = self.counter_size + self._counter = self.counter_size.get() return True return False From 57b60b20054541e2ead755400d39857ff30e1cf4 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 23 May 2017 16:42:28 +0200 Subject: [PATCH 188/193] Cleanup in-image code; add WikipediaTool example [ci skip] --- .../ForeignLanguage.class/class/primGetTopFrame.st | 4 ---- .../ForeignLanguage.class/class/primLastError.st | 4 ---- .../ForeignLanguage.class/class/primResume.st | 4 ---- .../class/{highlight..st => pygmentsLexer.st} | 2 +- .../ForeignLanguage.class/methodProperties.json | 5 +---- .../{findResumeFrame..st => findResumeContext..st} | 4 ++-- .../instance/openDebuggerOn..st | 4 +--- .../methodProperties.json | 4 ++-- .../monticello.meta/version | 2 +- .../FLMethodContext.class/instance/sourceCode.st | 3 +++ .../FLMethodContext.class/methodProperties.json | 1 + .../{highlightRuby..st => highlight.lexer..st} | 6 +++--- .../FLTextStyler.class/class/highlightPython..st | 6 ------ .../instance/style.foreignClass..st | 2 +- .../FLTextStyler.class/methodProperties.json | 5 ++--- .../monticello.meta/version | 2 +- .../instance/process.controller.context..st | 5 ++--- .../FLDebugger.class/instance/selectedMessage.st | 4 +--- .../FLDebugger.class/methodProperties.json | 4 ++-- .../instance/evaluateExpression..st | 2 +- .../FLInspector.class/instance/fieldList.st | 8 ++------ .../FLInspector.class/instance/isForeign.st | 3 +++ .../FLInspector.class/instance/selection.st | 4 +++- .../FLInspector.class/methodProperties.json | 7 ++++--- .../monticello.meta/version | 2 +- .../Python.class/class/highlight..st | 3 --- .../class/{pyFormatter.st => htmlFormatter.st} | 2 +- .../Python.class/class/pygmentsLexer.st | 3 +++ .../Python.class/methodProperties.json | 4 ++-- .../Python-Core.package/monticello.meta/version | 2 +- repository/Python-Examples.package/.filetree | 4 ++++ .../WikipediaTool.class/README.md | 0 .../WikipediaTool.class/class/open.st | 3 +++ .../instance/buildSearchBar..st | 10 ++++++++++ .../instance/buildSearchClearButton..st | 8 ++++++++ .../instance/buildSearchPanel..st | 9 +++++++++ .../WikipediaTool.class/instance/buildSummary..st | 12 ++++++++++++ .../WikipediaTool.class/instance/buildWith..st | 9 +++++++++ .../WikipediaTool.class/instance/contents.st | 5 +++++ .../WikipediaTool.class/instance/label.st | 3 +++ .../WikipediaTool.class/instance/searchTerm..st | 4 ++++ .../WikipediaTool.class/instance/searchTerm.st | 3 +++ .../WikipediaTool.class/methodProperties.json | 13 +++++++++++++ .../WikipediaTool.class/properties.json | 14 ++++++++++++++ .../WikipediaToolFFI.class/README.md | 0 .../WikipediaToolFFI.class/instance/contents.st | 11 +++++++++++ .../WikipediaToolFFI.class/methodProperties.json | 5 +++++ .../WikipediaToolFFI.class/properties.json | 14 ++++++++++++++ .../monticello.meta/categories.st | 1 + .../monticello.meta/initializers.st | 0 .../monticello.meta/package | 1 + .../monticello.meta/version | 1 + repository/Python-Examples.package/properties.json | 2 ++ .../Ruby.class/class/highlight..st | 3 --- .../Ruby.class/class/pygmentsLexer.st | 3 +++ .../Ruby.class/methodProperties.json | 2 +- .../Ruby-Core.package/monticello.meta/version | 2 +- 57 files changed, 182 insertions(+), 71 deletions(-) delete mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame.st delete mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError.st delete mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume.st rename repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/{highlight..st => pygmentsLexer.st} (67%) rename repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/{findResumeFrame..st => findResumeContext..st} (72%) create mode 100644 repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sourceCode.st rename repository/ForeignLanguage-Support.package/FLTextStyler.class/class/{highlightRuby..st => highlight.lexer..st} (52%) delete mode 100644 repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightPython..st create mode 100644 repository/ForeignLanguage-Tools.package/FLInspector.class/instance/isForeign.st delete mode 100644 repository/Python-Core.package/Python.class/class/highlight..st rename repository/Python-Core.package/Python.class/class/{pyFormatter.st => htmlFormatter.st} (81%) create mode 100644 repository/Python-Core.package/Python.class/class/pygmentsLexer.st create mode 100644 repository/Python-Examples.package/.filetree create mode 100644 repository/Python-Examples.package/WikipediaTool.class/README.md create mode 100644 repository/Python-Examples.package/WikipediaTool.class/class/open.st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchBar..st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchClearButton..st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchPanel..st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/buildSummary..st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/buildWith..st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/contents.st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/label.st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/searchTerm..st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/instance/searchTerm.st create mode 100644 repository/Python-Examples.package/WikipediaTool.class/methodProperties.json create mode 100644 repository/Python-Examples.package/WikipediaTool.class/properties.json create mode 100644 repository/Python-Examples.package/WikipediaToolFFI.class/README.md create mode 100644 repository/Python-Examples.package/WikipediaToolFFI.class/instance/contents.st create mode 100644 repository/Python-Examples.package/WikipediaToolFFI.class/methodProperties.json create mode 100644 repository/Python-Examples.package/WikipediaToolFFI.class/properties.json create mode 100644 repository/Python-Examples.package/monticello.meta/categories.st create mode 100644 repository/Python-Examples.package/monticello.meta/initializers.st create mode 100644 repository/Python-Examples.package/monticello.meta/package create mode 100644 repository/Python-Examples.package/monticello.meta/version create mode 100644 repository/Python-Examples.package/properties.json delete mode 100644 repository/Ruby-Core.package/Ruby.class/class/highlight..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/pygmentsLexer.st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame.st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame.st deleted file mode 100644 index 86b19800..00000000 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primGetTopFrame.st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primGetTopFrame - - self primitiveFailed. \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError.st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError.st deleted file mode 100644 index d8c5ffed..00000000 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primLastError.st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primLastError - - ^ nil \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume.st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume.st deleted file mode 100644 index 971dddb5..00000000 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primResume.st +++ /dev/null @@ -1,4 +0,0 @@ -system primitives -primResume - - ^ nil \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/highlight..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pygmentsLexer.st similarity index 67% rename from repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/highlight..st rename to repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pygmentsLexer.st index 0a80b394..c23b35a9 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/highlight..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pygmentsLexer.st @@ -1,3 +1,3 @@ styling -highlight: aText +pygmentsLexer self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json index 97bdfc19..a1c955fe 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json @@ -8,14 +8,11 @@ "getContentsOf:" : "fn 3/27/2017 21:54", "getFilename:" : "fn 4/2/2017 19:32", "getSource:" : "fn 3/16/2017 21:57", - "highlight:" : "fn 3/14/2017 11:27", "pcRange:" : "fn 3/16/2017 22:03", "persistEvalCode:" : "fn 3/17/2017 10:23", "primEval:" : "fn 4/28/2017 15:30", - "primGetTopFrame" : "fn 5/2/2017 13:13", - "primLastError" : "fn 5/2/2017 13:11", "primRestartSpecificFrame:" : "fn 4/28/2017 15:31", - "primResume" : "fn 5/2/2017 13:10", + "pygmentsLexer" : "fn 5/16/2017 17:47", "restartFrame:with:" : "fn 3/16/2017 21:57", "sourceCodeTemplate" : "fn 3/14/2017 11:23", "stylerFormat:" : "fn 3/14/2017 11:21", diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeFrame..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeContext..st similarity index 72% rename from repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeFrame..st rename to repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeContext..st index a75a794c..409d07a7 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeFrame..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeContext..st @@ -1,9 +1,9 @@ helpers -findResumeFrame: aContext +findResumeContext: aContext | currentCtx | currentCtx := aContext. [ currentCtx notNil ] whileTrue: [ - (currentCtx method selector = #vmEval "special selector" + (currentCtx method selector = #vmResume "special selector" and: [ currentCtx closure isNil ]) ifTrue: [ ^ currentCtx ]. currentCtx := currentCtx sender ]. diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st index e0064678..9d74ca14 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st @@ -1,10 +1,8 @@ helpers openDebuggerOn: foreignError - | resumeCtx | - resumeCtx := self findResumeFrame: thisContext sender. FLDebugger openOn: Processor activeProcess - context: (self prependContexts: resumeCtx) + context: (self findResumeContext: thisContext sender) label: (self debuggerTitle: foreignError) contents: nil fullView: true \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json index 4050a554..9903234e 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json @@ -4,10 +4,10 @@ "instance" : { "checkForException" : "fn 5/6/2017 16:38", "debuggerTitle:" : "fn 5/6/2017 16:42", - "findResumeFrame:" : "fn 5/6/2017 16:44", + "findResumeContext:" : "fn 5/14/2017 19:30", "getForeignFrames:" : "fn 5/6/2017 16:48", "newForeignContextFor:" : "fn 5/6/2017 16:47", - "openDebuggerOn:" : "fn 5/6/2017 16:40", + "openDebuggerOn:" : "fn 5/14/2017 19:31", "prependContexts:" : "fn 5/6/2017 16:47", "primLastError" : "fn 5/6/2017 14:14", "primResume" : "fn 5/6/2017 14:14", diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/version b/repository/ForeignLanguage-Core.package/monticello.meta/version index 37b7fd67..0e3acf00 100644 --- a/repository/ForeignLanguage-Core.package/monticello.meta/version +++ b/repository/ForeignLanguage-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Core-fn.6' message 'Move methods to new ForeignLanguageProcess class' id 'dd3b75bb-a218-40ab-b5f6-2f0c98f5d9c9' date '6 May 2017' time '8:41:15.238039 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.5' message 'Updates' id '1b83a434-c31d-45ae-a79c-00e02f2f7d0d' date '28 April 2017' time '4:43:06.982288 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Core-fn.7' message 'Cleanups' id 'b569fbc7-72c1-4832-b1b3-405a68bc4dd1' date '23 May 2017' time '4:39:54.781972 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.6' message 'Move methods to new ForeignLanguageProcess class' id 'dd3b75bb-a218-40ab-b5f6-2f0c98f5d9c9' date '6 May 2017' time '8:41:15.238039 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.5' message 'Updates' id '1b83a434-c31d-45ae-a79c-00e02f2f7d0d' date '28 April 2017' time '4:43:06.982288 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sourceCode.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sourceCode.st new file mode 100644 index 00000000..2a26bac4 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sourceCode.st @@ -0,0 +1,3 @@ +overrides +sourceCode + ^self languageClass getSource: self foreignFrame \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/methodProperties.json b/repository/ForeignLanguage-Support.package/FLMethodContext.class/methodProperties.json index 620e86ab..a295bf7a 100644 --- a/repository/ForeignLanguage-Support.package/FLMethodContext.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/methodProperties.json @@ -10,4 +10,5 @@ "printOn:" : "fn 3/16/2017 22:40", "sender:" : "fn 1/16/2017 21:54", "setSender:receiver:method:arguments:" : "fn 1/18/2017 17:38", + "sourceCode" : "fn 5/14/2017 21:49", "tempNames" : "fn 3/16/2017 22:44" } } diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightRuby..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlight.lexer..st similarity index 52% rename from repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightRuby..st rename to repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlight.lexer..st index 457567f1..53727456 100644 --- a/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightRuby..st +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlight.lexer..st @@ -1,7 +1,7 @@ as yet unclassified -highlightRuby: aText +highlight: aText lexer: aLexer Python vmSpeaksLanguage ifFalse: [ ^ aText ]. ^ (Python pygmentsHighlight __call__: aText string - lexer: Python pyLexerRuby - formatter: Python pyFormatter) asSmalltalk asTextFromHtml \ No newline at end of file + lexer: aLexer + formatter: Python htmlFormatter) asSmalltalk asTextFromHtml \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightPython..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightPython..st deleted file mode 100644 index efb66509..00000000 --- a/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlightPython..st +++ /dev/null @@ -1,6 +0,0 @@ -as yet unclassified -highlightPython: aText - ^ (Python pygmentsHighlight - __call__: aText string - lexer: Python pyLexerPython - formatter: Python pyFormatter) asSmalltalk asTextFromHtml \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style.foreignClass..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style.foreignClass..st index 169f74b5..9f3047ee 100644 --- a/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style.foreignClass..st +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style.foreignClass..st @@ -3,7 +3,7 @@ style: aText foreignClass: foreignClass | styledText | stylingEnabled ifFalse: [ ^ self ]. foreignClass vmSpeaksLanguage ifFalse: [^ super style: aText]. - styledText := (foreignClass highlight: aText) first: aText size. + styledText := (self class highlight: aText lexer: foreignClass pygmentsLexer) first: aText size. "Strings must be of same size, otherwise image might crash" self assert: styledText string size = aText string size. view ifNotNil: [ view stylerStyled: styledText ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/methodProperties.json b/repository/ForeignLanguage-Support.package/FLTextStyler.class/methodProperties.json index 18382ec0..30f3d9bd 100644 --- a/repository/ForeignLanguage-Support.package/FLTextStyler.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/methodProperties.json @@ -1,7 +1,6 @@ { "class" : { - "highlightPython:" : "fn 3/30/2017 22:17", - "highlightRuby:" : "fn 3/30/2017 22:17" }, + "highlight:lexer:" : "fn 5/17/2017 10:13" }, "instance" : { "isForeign" : "fn 3/14/2017 18:28", "languageClass" : "fn 3/16/2017 22:41", @@ -9,5 +8,5 @@ "languageSymbol:" : "fn 3/13/2017 17:13", "privateFormat:" : "fn 3/16/2017 22:42", "style:" : "fn 3/16/2017 22:42", - "style:foreignClass:" : "fn 3/14/2017 11:30", + "style:foreignClass:" : "fn 5/16/2017 17:49", "styleInBackgroundProcess:" : "fn 3/21/2017 11:25" } } diff --git a/repository/ForeignLanguage-Support.package/monticello.meta/version b/repository/ForeignLanguage-Support.package/monticello.meta/version index 0feaec89..35e1be15 100644 --- a/repository/ForeignLanguage-Support.package/monticello.meta/version +++ b/repository/ForeignLanguage-Support.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Support-fn.5' message 'Use FL namespace instead' id '46ee84e8-2aa7-45cd-9999-c54679d0ab08' date '28 April 2017' time '4:43:26.93281 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.4' message 'Update in-image code' id 'aac05489-0e6a-4f54-8ba1-7a72a08123d5' date '31 March 2017' time '12:38:59.949445 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Support-fn.6' message 'Cleanups' id '41a6f7d6-af0a-4985-b568-ab31a7735c3a' date '23 May 2017' time '4:40:03.613355 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.5' message 'Use FL namespace instead' id '46ee84e8-2aa7-45cd-9999-c54679d0ab08' date '28 April 2017' time '4:43:26.93281 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.4' message 'Update in-image code' id 'aac05489-0e6a-4f54-8ba1-7a72a08123d5' date '31 March 2017' time '12:38:59.949445 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st index 18d7c1e8..d79507ed 100644 --- a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st @@ -1,8 +1,7 @@ overrides process: aProcess controller: aController context: aContext | ctx | - (aContext method selector = #vmResume: and: [ - aContext receiver inheritsFrom: ForeignLanguageProcess ]) + (aContext method selector = #vmResume) ifFalse: [ ^ super process: aProcess controller: aController context: aContext]. ctx := aContext receiver prependContexts: aContext. - super process: aProcess controller: aController context: ctx \ No newline at end of file + ^ super process: aProcess controller: aController context: ctx \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st index 0ac16570..116d4b35 100644 --- a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st @@ -1,8 +1,6 @@ overrides selectedMessage - "Answer the source code of the currently selected context." | aContext | aContext := self selectedContext. aContext isForeign ifFalse: [ ^ super selectedMessage ]. - Smalltalk at: aContext languageSymbol ifPresent: [ :cls | - ^ cls getSource: aContext foreignFrame ] \ No newline at end of file + ^ aContext sourceCode \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json index 8ebf3203..01ffb5d3 100644 --- a/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json @@ -13,5 +13,5 @@ "languageSymbol" : "fn 3/14/2017 01:32", "messageIconAt:" : "fn 3/16/2017 22:18", "pcRange" : "fn 3/16/2017 22:18", - "process:controller:context:" : "fn 5/6/2017 16:41", - "selectedMessage" : "fn 3/16/2017 21:49" } } + "process:controller:context:" : "fn 5/14/2017 19:34", + "selectedMessage" : "fn 5/14/2017 21:50" } } diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st index d10c3b81..18f9c498 100644 --- a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st @@ -1,4 +1,4 @@ overrides evaluateExpression: selection - object languageSymbol = #Smalltalk ifTrue: [ ^ Compiler evaluate: selection asString ]. + self isForeign ifFalse: [self error: 'Smalltalk objects should be opened in original Inspector']. ^ self languageClass evaluateExpression: selection in: self doItContext to: self doItReceiver \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/fieldList.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/fieldList.st index baa9233f..cdd1aa49 100644 --- a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/fieldList.st +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/fieldList.st @@ -1,8 +1,4 @@ overrides fieldList - "Answer the base field list plus an abbreviated list of indices." - | keys | - keys := OrderedCollection new. - keys add: 'self'. - object isForeign ifTrue: [ keys addAll: object allInstVarNames ]. - ^ keys \ No newline at end of file + self isForeign ifFalse: [^ super fieldList]. + ^ #('self' 'all elements'), object allInstVarNames \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/isForeign.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/isForeign.st new file mode 100644 index 00000000..31439077 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/isForeign.st @@ -0,0 +1,3 @@ +overrides +isForeign + ^ object languageSymbol ~~ #Smalltalk \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/selection.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/selection.st index 623ab4fe..5196af04 100644 --- a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/selection.st +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/selection.st @@ -2,8 +2,10 @@ overrides selection "The receiver has a list of variables of its inspected object. One of these is selected. Answer the value of the selected variable." + self isForeign ifFalse: [^ super selection]. selectionIndex = 0 ifTrue: [^ '']. selectionIndex = 1 ifTrue: [^ object]. + selectionIndex = 2 ifTrue: [^ 'tbd']. object isForeign ifTrue: [ - ^ object instVarAt: selectionIndex - 1 ]. + ^ object instVarAt: selectionIndex - 2 ]. ^ super selection \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLInspector.class/methodProperties.json index bbaad200..1448645f 100644 --- a/repository/ForeignLanguage-Tools.package/FLInspector.class/methodProperties.json +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/methodProperties.json @@ -5,7 +5,8 @@ "aboutToStyle:" : "fn 3/13/2017 17:35", "buildCodePaneWith:" : "fn 4/28/2017 16:07", "contentsIsString" : "fn 12/23/2016 11:11", - "evaluateExpression:" : "fn 3/21/2017 11:39", - "fieldList" : "fn 3/14/2017 12:01", + "evaluateExpression:" : "fn 5/14/2017 21:29", + "fieldList" : "fn 5/13/2017 16:34", + "isForeign" : "fn 5/13/2017 15:57", "languageClass" : "fn 3/21/2017 11:40", - "selection" : "fn 3/14/2017 12:08" } } + "selection" : "fn 5/13/2017 16:28" } } diff --git a/repository/ForeignLanguage-Tools.package/monticello.meta/version b/repository/ForeignLanguage-Tools.package/monticello.meta/version index 676d28e4..d381dc93 100644 --- a/repository/ForeignLanguage-Tools.package/monticello.meta/version +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Tools-fn.6' message 'Minor tool improvements and updates' id '5c5d251f-b118-4ff1-9b8e-0935768648c2' date '6 May 2017' time '8:41:34.05681 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.5' message 'Use FL namespace instead' id '996f4850-069f-46b0-95f0-e26ed5627893' date '28 April 2017' time '4:43:38.939853 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.4' message 'Update in-image code' id 'b7af137b-818c-4196-9439-01a40952f2ba' date '31 March 2017' time '12:39:05.754067 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Tools-fn.7' message 'Cleanups' id '800069e1-93bd-4fbc-8b7e-745cb31b5bd0' date '23 May 2017' time '4:40:28.349965 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.6' message 'Minor tool improvements and updates' id '5c5d251f-b118-4ff1-9b8e-0935768648c2' date '6 May 2017' time '8:41:34.05681 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.5' message 'Use FL namespace instead' id '996f4850-069f-46b0-95f0-e26ed5627893' date '28 April 2017' time '4:43:38.939853 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.4' message 'Update in-image code' id 'b7af137b-818c-4196-9439-01a40952f2ba' date '31 March 2017' time '12:39:05.754067 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.3' message 'Update in-image code' id '1c17c4ca-d57f-4168-ac51-ba0ac0808194' date '22 March 2017' time '9:44:35.164554 pm' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.2' message 'Improve tools' id '2d98ac44-1177-4984-ba65-a70d28d40537' date '15 March 2017' time '10:22:57.330984 am' author 'fn' ancestors ((name 'ForeignLanguage-Tools-fn.1' message 'Generalize Python tools and introduce them as ForeignLanguage tools' id '2450ddb1-71fa-4393-9f9d-bcd4e9f62c15' date '14 March 2017' time '10:56:35.402467 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/highlight..st b/repository/Python-Core.package/Python.class/class/highlight..st deleted file mode 100644 index 6d317bf7..00000000 --- a/repository/Python-Core.package/Python.class/class/highlight..st +++ /dev/null @@ -1,3 +0,0 @@ -styling -highlight: aText - ^ FLTextStyler highlightPython: aText \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pyFormatter.st b/repository/Python-Core.package/Python.class/class/htmlFormatter.st similarity index 81% rename from repository/Python-Core.package/Python.class/class/pyFormatter.st rename to repository/Python-Core.package/Python.class/class/htmlFormatter.st index 250e7f44..25fbe28f 100644 --- a/repository/Python-Core.package/Python.class/class/pyFormatter.st +++ b/repository/Python-Core.package/Python.class/class/htmlFormatter.st @@ -1,3 +1,3 @@ special objects -pyFormatter +htmlFormatter ^ self fromObjectCache: '_pygments_formatter' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/pygmentsLexer.st b/repository/Python-Core.package/Python.class/class/pygmentsLexer.st new file mode 100644 index 00000000..3cf830b6 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/pygmentsLexer.st @@ -0,0 +1,3 @@ +styling +pygmentsLexer + ^ Python pyLexerPython \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json index a020e7e5..365017b1 100644 --- a/repository/Python-Core.package/Python.class/methodProperties.json +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -24,7 +24,7 @@ "getSignature:" : "fn 3/28/2017 01:38", "getSource:" : "fn 3/28/2017 12:02", "globals" : "fn 2/26/2017 21:46", - "highlight:" : "fn 4/28/2017 16:08", + "htmlFormatter" : "fn 5/17/2017 10:13", "import:" : "fn 3/21/2017 23:14", "import:breakOnExceptions:" : "fn 3/12/2017 02:47", "indent:by:" : "fn 3/16/2017 21:38", @@ -38,11 +38,11 @@ "pcRange:" : "fn 3/16/2017 22:21", "primEval:filename:cmd:breakOnExceptions:" : "fn 3/11/2017 14:45", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", - "pyFormatter" : "fn 3/6/2017 07:20", "pyLexerPython" : "fn 3/6/2017 19:05", "pyLexerRuby" : "fn 3/28/2017 12:22", "pyLexerSmalltalk" : "fn 3/6/2017 19:05", "pygmentsHighlight" : "fn 3/30/2017 22:17", + "pygmentsLexer" : "fn 5/16/2017 17:48", "re" : "fn 3/9/2017 17:53", "replaceInPySource:content:lineno:" : "fn 3/16/2017 21:37", "reset" : "fn 2/23/2017 21:13", diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index 00698067..be1fbcb5 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.10' message 'Introduce PythonProcess class' id '422e4a4a-4424-4282-8442-23b6d1e55c8f' date '6 May 2017' time '8:41:59.105519 pm' author 'fn' ancestors ((name 'Python-Core-fn.9' message 'Updates' id '1a2fafe2-19a7-4de3-b2e9-e47ca2977965' date '28 April 2017' time '4:43:57.571228 pm' author 'fn' ancestors ((name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.11' message 'Cleanups' id 'ccaf04b0-f5a2-4611-9253-21909e0c8626' date '23 May 2017' time '4:40:36.616426 pm' author 'fn' ancestors ((name 'Python-Core-fn.10' message 'Introduce PythonProcess class' id '422e4a4a-4424-4282-8442-23b6d1e55c8f' date '6 May 2017' time '8:41:59.105519 pm' author 'fn' ancestors ((name 'Python-Core-fn.9' message 'Updates' id '1a2fafe2-19a7-4de3-b2e9-e47ca2977965' date '28 April 2017' time '4:43:57.571228 pm' author 'fn' ancestors ((name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Examples.package/.filetree b/repository/Python-Examples.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/Python-Examples.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/Python-Examples.package/WikipediaTool.class/README.md b/repository/Python-Examples.package/WikipediaTool.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Examples.package/WikipediaTool.class/class/open.st b/repository/Python-Examples.package/WikipediaTool.class/class/open.st new file mode 100644 index 00000000..24733a0f --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/class/open.st @@ -0,0 +1,3 @@ +as yet unclassified +open + ^ToolBuilder open: self new \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchBar..st b/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchBar..st new file mode 100644 index 00000000..bde16a5b --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchBar..st @@ -0,0 +1,10 @@ +as yet unclassified +buildSearchBar: builder + ^ builder pluggableInputFieldSpec new + minimumHeight: 0; + model: self; + getText: #searchTerm; + setText: #searchTerm:; + indicateUnacceptedChanges: false; + help: 'Search wikipedia...'; + frame: (0@0 corner: 0.9@1) \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchClearButton..st b/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchClearButton..st new file mode 100644 index 00000000..ee6413a3 --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchClearButton..st @@ -0,0 +1,8 @@ +as yet unclassified +buildSearchClearButton: builder + ^ builder pluggableActionButtonSpec new + model: self; + label: 'Search'; + action: #actionSearch; + help: 'Clear your search.'; + frame: (0.9@0 corner: 1@1) \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchPanel..st b/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchPanel..st new file mode 100644 index 00000000..c6164430 --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/buildSearchPanel..st @@ -0,0 +1,9 @@ +as yet unclassified +buildSearchPanel: builder + ^ builder pluggablePanelSpec new + model: self; + children: {self buildSearchBar: builder.self buildSearchClearButton: builder}; + frame: (LayoutFrame new leftFraction: 0 offset: 0; + topFraction: 0 offset: 0; + rightFraction: 1 offset: 0; + bottomFraction: 0 offset: 25) \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/buildSummary..st b/repository/Python-Examples.package/WikipediaTool.class/instance/buildSummary..st new file mode 100644 index 00000000..b4216522 --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/buildSummary..st @@ -0,0 +1,12 @@ +as yet unclassified +buildSummary: builder + ^ builder pluggableTextSpec new + model: self; + getText: #contents; + readOnly: true; + indicateUnacceptedChanges: false; + menu: #codePaneMenu:shifted:; + frame: (LayoutFrame new leftFraction: 0 offset: 0; + topFraction: 0 offset: 25; + rightFraction: 1 offset: 0; + bottomFraction: 1 offset: 0) \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/buildWith..st b/repository/Python-Examples.package/WikipediaTool.class/instance/buildWith..st new file mode 100644 index 00000000..1cc5e61d --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/buildWith..st @@ -0,0 +1,9 @@ +as yet unclassified +buildWith: builder + ^ builder build: (builder pluggableWindowSpec new + model: self; + children: { + self buildSummary: builder. + self buildSearchPanel: builder. + }; + label: #label) \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/contents.st b/repository/Python-Examples.package/WikipediaTool.class/instance/contents.st new file mode 100644 index 00000000..7418ea3d --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/contents.st @@ -0,0 +1,5 @@ +as yet unclassified +contents + self searchTerm ifNil: [^'']. + Python exec: 'import wikipedia'. + ^ ((Python eval: 'wikipedia.summary') __call__: self searchTerm asString) asSmalltalk \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/label.st b/repository/Python-Examples.package/WikipediaTool.class/instance/label.st new file mode 100644 index 00000000..db6deaf7 --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/label.st @@ -0,0 +1,3 @@ +as yet unclassified +label + ^ 'Wikipedia Tool' \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/searchTerm..st b/repository/Python-Examples.package/WikipediaTool.class/instance/searchTerm..st new file mode 100644 index 00000000..6688fc55 --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/searchTerm..st @@ -0,0 +1,4 @@ +accessing +searchTerm: anObject + searchTerm := anObject. + self changed: #contents \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/instance/searchTerm.st b/repository/Python-Examples.package/WikipediaTool.class/instance/searchTerm.st new file mode 100644 index 00000000..d9a30784 --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/instance/searchTerm.st @@ -0,0 +1,3 @@ +accessing +searchTerm + ^ searchTerm \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaTool.class/methodProperties.json b/repository/Python-Examples.package/WikipediaTool.class/methodProperties.json new file mode 100644 index 00000000..6a09e98b --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/methodProperties.json @@ -0,0 +1,13 @@ +{ + "class" : { + "open" : "fn 5/5/2017 23:09" }, + "instance" : { + "buildSearchBar:" : "fn 5/6/2017 11:55", + "buildSearchClearButton:" : "fn 5/5/2017 23:15", + "buildSearchPanel:" : "fn 5/6/2017 11:54", + "buildSummary:" : "fn 5/5/2017 23:14", + "buildWith:" : "fn 5/5/2017 23:15", + "contents" : "fn 5/5/2017 23:22", + "label" : "fn 5/5/2017 23:09", + "searchTerm" : "fn 5/5/2017 23:17", + "searchTerm:" : "fn 5/5/2017 23:16" } } diff --git a/repository/Python-Examples.package/WikipediaTool.class/properties.json b/repository/Python-Examples.package/WikipediaTool.class/properties.json new file mode 100644 index 00000000..0cde03aa --- /dev/null +++ b/repository/Python-Examples.package/WikipediaTool.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Examples", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "searchTerm" ], + "name" : "WikipediaTool", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/Python-Examples.package/WikipediaToolFFI.class/README.md b/repository/Python-Examples.package/WikipediaToolFFI.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Examples.package/WikipediaToolFFI.class/instance/contents.st b/repository/Python-Examples.package/WikipediaToolFFI.class/instance/contents.st new file mode 100644 index 00000000..5d34e2e4 --- /dev/null +++ b/repository/Python-Examples.package/WikipediaToolFFI.class/instance/contents.st @@ -0,0 +1,11 @@ +as yet unclassified +contents + | command result | + command := '/usr/bin/python ', + (FileDirectory default / 'wiki.py') fullName, + ' "', self searchTerm asString, '"'. + result := (PipeableOSProcess command: command) + outputAndError. + result second + ifEmpty: [ ^ result first ] + ifNotEmpty: [ :stderr | self error: stderr ] \ No newline at end of file diff --git a/repository/Python-Examples.package/WikipediaToolFFI.class/methodProperties.json b/repository/Python-Examples.package/WikipediaToolFFI.class/methodProperties.json new file mode 100644 index 00000000..a21d4d5a --- /dev/null +++ b/repository/Python-Examples.package/WikipediaToolFFI.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "contents" : "fn 5/9/2017 14:49" } } diff --git a/repository/Python-Examples.package/WikipediaToolFFI.class/properties.json b/repository/Python-Examples.package/WikipediaToolFFI.class/properties.json new file mode 100644 index 00000000..df2bb861 --- /dev/null +++ b/repository/Python-Examples.package/WikipediaToolFFI.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Examples", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "WikipediaToolFFI", + "pools" : [ + ], + "super" : "WikipediaTool", + "type" : "normal" } diff --git a/repository/Python-Examples.package/monticello.meta/categories.st b/repository/Python-Examples.package/monticello.meta/categories.st new file mode 100644 index 00000000..26b32fd3 --- /dev/null +++ b/repository/Python-Examples.package/monticello.meta/categories.st @@ -0,0 +1 @@ +SystemOrganization addCategory: #'Python-Examples'! diff --git a/repository/Python-Examples.package/monticello.meta/initializers.st b/repository/Python-Examples.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b diff --git a/repository/Python-Examples.package/monticello.meta/package b/repository/Python-Examples.package/monticello.meta/package new file mode 100644 index 00000000..d98cc361 --- /dev/null +++ b/repository/Python-Examples.package/monticello.meta/package @@ -0,0 +1 @@ +(name 'Python-Examples') \ No newline at end of file diff --git a/repository/Python-Examples.package/monticello.meta/version b/repository/Python-Examples.package/monticello.meta/version new file mode 100644 index 00000000..ae788f91 --- /dev/null +++ b/repository/Python-Examples.package/monticello.meta/version @@ -0,0 +1 @@ +(name 'Python-Examples-fn.2' message 'Add subclass using FFI' id 'e39dbc14-d5be-4073-b4b7-619e189a9fee' date '23 May 2017' time '4:41:37.20124 pm' author 'fn' ancestors ((name 'Python-Examples-fn.1' message 'Add WikipediaTool' id '7728d858-2c1d-407a-94c5-6fb1f293ac62' date '6 May 2017' time '5:03:26.633442 pm' author 'fn' ancestors () stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Examples.package/properties.json b/repository/Python-Examples.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/Python-Examples.package/properties.json @@ -0,0 +1,2 @@ +{ + } diff --git a/repository/Ruby-Core.package/Ruby.class/class/highlight..st b/repository/Ruby-Core.package/Ruby.class/class/highlight..st deleted file mode 100644 index 5e696c23..00000000 --- a/repository/Ruby-Core.package/Ruby.class/class/highlight..st +++ /dev/null @@ -1,3 +0,0 @@ -styling -highlight: aText - ^ FLTextStyler highlightRuby: aText \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/pygmentsLexer.st b/repository/Ruby-Core.package/Ruby.class/class/pygmentsLexer.st new file mode 100644 index 00000000..b2fd1f4e --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/pygmentsLexer.st @@ -0,0 +1,3 @@ +styling +pygmentsLexer + ^ Python pyLexerRuby \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json index 1c6417d9..7903535d 100644 --- a/repository/Ruby-Core.package/Ruby.class/methodProperties.json +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -10,7 +10,6 @@ "fileExtension" : "fn 3/17/2017 10:20", "getFilename:" : "fn 4/2/2017 19:33", "getSource:" : "fn 3/27/2017 23:54", - "highlight:" : "fn 4/28/2017 16:08", "kernel" : "tfel 8/16/2016 07:04", "nil" : "fn 3/16/2017 13:37", "object" : "tfel 8/16/2016 07:04", @@ -18,6 +17,7 @@ "primEval:" : "tfel 8/16/2016 07:03", "primEval:filePath:breakOnExceptions:" : "fn 3/16/2017 13:40", "primSend:to:with:" : "tfel 8/16/2016 07:03", + "pygmentsLexer" : "fn 5/16/2017 17:48", "restartFrame:with:" : "fn 3/16/2017 22:22", "sourceCodeTemplate" : "fn 3/14/2017 11:22", "tempNamesIn:" : "fn 3/16/2017 22:45", diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version index 84154518..43f269cd 100644 --- a/repository/Ruby-Core.package/monticello.meta/version +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Ruby-Core-fn.7' message 'Cleanups' id '0d0a21be-1f5d-4c8a-a41d-540112bd0e3b' date '23 May 2017' time '4:40:47.799452 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 0796975207b25d6624671a9af8fba598ce1b078d Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 23 May 2017 16:43:25 +0200 Subject: [PATCH 189/193] Error returned as a Python tuple --- rsqueakvm/plugins/python/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsqueakvm/plugins/python/utils.py b/rsqueakvm/plugins/python/utils.py index 16d6edbe..6f81abe2 100644 --- a/rsqueakvm/plugins/python/utils.py +++ b/rsqueakvm/plugins/python/utils.py @@ -138,7 +138,7 @@ def operr_to_w_object(operr): wp_exception = py_space.newtext(operr.w_type.getname(py_space)) wp_value = operr.get_w_value(py_space) # wp_traceback = operr.get_traceback() or py_space.w_None - return W_PythonObject(py_space.newlist([wp_exception, wp_value])) + return W_PythonObject(py_space.newtuple([wp_exception, wp_value])) def entry_point(argv): From 500c0f2913173b616a31ef40865a6ef89209d22c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Mon, 13 Nov 2017 15:20:17 +0100 Subject: [PATCH 190/193] Add support for Ruby Bindings --- .../Ruby.class/class/evaluateExpression.in.to..st | 7 +++++++ .../Ruby-Core.package/Ruby.class/class/initialize.st | 5 +++++ repository/Ruby-Core.package/Ruby.class/class/startUp..st | 4 ++++ .../Ruby-Core.package/Ruby.class/methodProperties.json | 3 +++ repository/Ruby-Core.package/monticello.meta/version | 2 +- 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/initialize.st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/startUp..st diff --git a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st new file mode 100644 index 00000000..b7a64d96 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st @@ -0,0 +1,7 @@ +execution +evaluateExpression: aSelection in: aContext to: receiver + | rbCode rbBinding | + rbCode := aSelection asString copyReplaceAll: 'self' with: 'that'. + rbBinding := Ruby eval: 'blank_binding'. + rbBinding local_variable_set: 'that' to: receiver. + ^ rbBinding eval: rbCode \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/initialize.st b/repository/Ruby-Core.package/Ruby.class/class/initialize.st new file mode 100644 index 00000000..6a255633 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/initialize.st @@ -0,0 +1,5 @@ +overrides +initialize + super initialize. + Smalltalk addToStartUpList: Ruby + "Smalltalk removeFromStartUpList: Ruby" \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/startUp..st b/repository/Ruby-Core.package/Ruby.class/class/startUp..st new file mode 100644 index 00000000..d18e5006 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/startUp..st @@ -0,0 +1,4 @@ +overrides +startUp: resuming + (resuming and: [ self vmSpeaksLanguage ]) + ifTrue: [ Ruby eval: 'def blank_binding; binding; end' ] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json index 7903535d..8b8cf2f9 100644 --- a/repository/Ruby-Core.package/Ruby.class/methodProperties.json +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -7,9 +7,11 @@ "eval:filePath:breakOnExceptions:" : "fn 3/23/2017 08:59", "evaluateExpression:" : "fn 3/27/2017 23:53", "evaluateExpression:breakOnExceptions:" : "fn 3/27/2017 23:53", + "evaluateExpression:in:to:" : "fn 11/13/2017 14:26", "fileExtension" : "fn 3/17/2017 10:20", "getFilename:" : "fn 4/2/2017 19:33", "getSource:" : "fn 3/27/2017 23:54", + "initialize" : "fn 11/13/2017 14:28", "kernel" : "tfel 8/16/2016 07:04", "nil" : "fn 3/16/2017 13:37", "object" : "tfel 8/16/2016 07:04", @@ -20,6 +22,7 @@ "pygmentsLexer" : "fn 5/16/2017 17:48", "restartFrame:with:" : "fn 3/16/2017 22:22", "sourceCodeTemplate" : "fn 3/14/2017 11:22", + "startUp:" : "fn 11/13/2017 14:29", "tempNamesIn:" : "fn 3/16/2017 22:45", "tempVariableAt:in:" : "fn 3/16/2017 22:44", "vmSpeaksLanguage" : "fn 3/14/2017 11:33" }, diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version index 43f269cd..75b9edbb 100644 --- a/repository/Ruby-Core.package/monticello.meta/version +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Ruby-Core-fn.7' message 'Cleanups' id '0d0a21be-1f5d-4c8a-a41d-540112bd0e3b' date '23 May 2017' time '4:40:47.799452 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Ruby-Core-fn.8' message 'Add support for Ruby Bindings.' id 'bb1f89c6-a47b-4123-b5dd-8549b170736f' date '13 November 2017' time '3:18:05.11033 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.7' message 'Cleanups' id '0d0a21be-1f5d-4c8a-a41d-540112bd0e3b' date '23 May 2017' time '4:40:47.799452 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 70c6ea08405594c93b6f0bb5b5f8a27d356cf98d Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 14 Nov 2017 10:02:46 +0100 Subject: [PATCH 191/193] Add prim to toggle breakOnEx during sends Also, adjust exception handling --- rsqueakvm/plugins/foreign_language/__init__.py | 14 ++++++++++++-- rsqueakvm/plugins/python/__init__.py | 6 ++++-- rsqueakvm/plugins/python/process.py | 5 ++++- rsqueakvm/plugins/ruby/__init__.py | 5 +++-- rsqueakvm/plugins/ruby/process.py | 4 +++- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/rsqueakvm/plugins/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py index 5243902c..6d7b81d5 100644 --- a/rsqueakvm/plugins/foreign_language/__init__.py +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -3,13 +3,16 @@ from rsqueakvm.plugins.foreign_language.model import W_ForeignLanguageObject from rsqueakvm.plugins.foreign_language.process import W_ForeignLanguageProcess from rsqueakvm.plugins.plugin import Plugin +from rsqueakvm.util.cells import Cell class ForeignLanguagePlugin(Plugin): + _attrs_ = ['_break_on_exceptions_during_sends'] def __init__(self): Plugin.__init__(self) self.register_default_primitives() + self._break_on_exceptions_during_sends = Cell(False) @staticmethod def load_special_objects(space, language_name, process_cls, shadow_cls): @@ -26,7 +29,8 @@ def new_eval_process(space, args_w): raise NotImplementedError @staticmethod - def new_send_process(space, w_rcvr, method_name, args_w): + def new_send_process(space, w_rcvr, method_name, args_w, + break_on_exceptions): raise NotImplementedError @staticmethod @@ -84,7 +88,8 @@ def send(interp, s_frame, argcount, w_method): if idx > 0: method_name = method_name[0:idx] language_process = self.new_send_process( - interp.space, w_rcvr, method_name, args_w) + interp.space, w_rcvr, method_name, args_w, + self._break_on_exceptions_during_sends.get()) frame = language_process.switch_to_smalltalk( interp, s_frame, first_call=True) s_frame.pop_n(argcount + 1) @@ -128,3 +133,8 @@ def registerSpecificClass(interp, s_frame, w_rcvr, language_obj): if not isinstance(language_obj, W_ForeignLanguageObject): raise PrimitiveFailedError language_obj.class_shadow(interp.space).set_specific_class(w_rcvr) + + @self.expose_primitive(unwrap_spec=[object, bool]) + def setBreakOnExceptionsDuringSends(interp, s_frame, w_rcvr, value): + self._break_on_exceptions_during_sends.set(value) + return interp.space.wrap_bool(value) diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py index ae0109fb..3585dacf 100644 --- a/rsqueakvm/plugins/python/__init__.py +++ b/rsqueakvm/plugins/python/__init__.py @@ -75,10 +75,12 @@ def new_eval_process(space, args_w): break_on_exceptions=break_on_exceptions) @staticmethod - def new_send_process(space, w_rcvr, method_name, args_w): + def new_send_process(space, w_rcvr, method_name, args_w, + break_on_exceptions): return W_PythonProcess( space, is_send=True, - w_rcvr=w_rcvr, method_name=method_name, args_w=args_w) + w_rcvr=w_rcvr, method_name=method_name, args_w=args_w, + break_on_exceptions=break_on_exceptions) @staticmethod def w_object_class(): diff --git a/rsqueakvm/plugins/python/process.py b/rsqueakvm/plugins/python/process.py index 4f657ac2..8804d771 100644 --- a/rsqueakvm/plugins/python/process.py +++ b/rsqueakvm/plugins/python/process.py @@ -56,7 +56,10 @@ def send(self): self.set_result(W_PythonObject( py_space.getattr(wp_rcvr, wp_attrname))) except OperationError as operr: - self.set_result(utils.operr_to_w_object(operr)) + print 'Python error caught: %s' % operr + error = utils.operr_to_w_object(operr) + self.set_error(error) + self.set_result(error) except Exception as e: self.fail('Unable to call %s on %s: %s' % ( self.method_name, wp_rcvr, e)) diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py index 461735c8..b8cbfe83 100644 --- a/rsqueakvm/plugins/ruby/__init__.py +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -67,10 +67,11 @@ def new_eval_process(space, args_w): break_on_exceptions=break_on_exceptions) @staticmethod - def new_send_process(space, w_rcvr, method_name, args_w): + def new_send_process(space, w_rcvr, method_name, args_w, + break_on_exceptions): return W_RubyProcess( space, w_rcvr=w_rcvr, method_name=method_name, args_w=args_w, - is_send=True) + is_send=True, break_on_exceptions=break_on_exceptions) @staticmethod def w_object_class(): diff --git a/rsqueakvm/plugins/ruby/process.py b/rsqueakvm/plugins/ruby/process.py index b8947ba5..5a287710 100644 --- a/rsqueakvm/plugins/ruby/process.py +++ b/rsqueakvm/plugins/ruby/process.py @@ -42,7 +42,9 @@ def send(self): self.set_result(W_RubyObject(wr_result)) except RubyError as e: print_traceback(ruby_space, e.w_value) - self.set_result(W_RubyObject(e.w_value)) + error = W_RubyObject(e.w_value) + self.set_error(error) + self.set_result(error) except Exception as e: # import pdb; pdb.set_trace() self.fail( From bf81837a7d9da31d4d198afb8cf5a01cf144d06c Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 14 Nov 2017 10:03:08 +0100 Subject: [PATCH 192/193] In-image code updates --- .../class/primBreakOnExceptionsDuringSends..st | 4 ++++ .../ForeignLanguage.class/methodProperties.json | 1 + .../instance/checkForException.st | 5 +++-- .../ForeignLanguageProcess.class/methodProperties.json | 2 +- .../ForeignLanguage-Core.package/monticello.meta/version | 2 +- .../FLException.class/instance/action..st | 3 --- .../FLException.class/instance/action.st | 3 --- .../FLException.class/instance/defaultAction.st | 2 +- .../FLException.class/instance/foreignError..st | 3 +++ .../FLException.class/instance/foreignError.st | 3 +++ .../FLException.class/instance/languageProcess..st | 3 +++ .../FLException.class/instance/languageProcess.st | 3 +++ .../FLException.class/methodProperties.json | 8 +++++--- .../FLException.class/properties.json | 3 ++- .../monticello.meta/version | 2 +- .../Python-Core.package/Python.class/class/compile.st | 3 +++ .../Python.class/class/isExpression..st | 3 ++- .../class/primBreakOnExceptionsDuringSends..st | 5 +++++ .../Python.class/methodProperties.json | 4 +++- repository/Python-Core.package/monticello.meta/version | 2 +- .../Ruby.class/class/primBreakOnExceptionsDuringSends..st | 4 ++++ .../Ruby-Core.package/Ruby.class/methodProperties.json | 1 + repository/Ruby-Core.package/monticello.meta/version | 2 +- 23 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primBreakOnExceptionsDuringSends..st delete mode 100644 repository/ForeignLanguage-Support.package/FLException.class/instance/action..st delete mode 100644 repository/ForeignLanguage-Support.package/FLException.class/instance/action.st create mode 100644 repository/ForeignLanguage-Support.package/FLException.class/instance/foreignError..st create mode 100644 repository/ForeignLanguage-Support.package/FLException.class/instance/foreignError.st create mode 100644 repository/ForeignLanguage-Support.package/FLException.class/instance/languageProcess..st create mode 100644 repository/ForeignLanguage-Support.package/FLException.class/instance/languageProcess.st create mode 100644 repository/Python-Core.package/Python.class/class/compile.st create mode 100644 repository/Python-Core.package/Python.class/class/primBreakOnExceptionsDuringSends..st create mode 100644 repository/Ruby-Core.package/Ruby.class/class/primBreakOnExceptionsDuringSends..st diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primBreakOnExceptionsDuringSends..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primBreakOnExceptionsDuringSends..st new file mode 100644 index 00000000..4a0f3dd3 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/primBreakOnExceptionsDuringSends..st @@ -0,0 +1,4 @@ +system primitives +primBreakOnExceptionsDuringSends: aBool + + self primitiveFailed. \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json index a1c955fe..23ce1a67 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json @@ -10,6 +10,7 @@ "getSource:" : "fn 3/16/2017 21:57", "pcRange:" : "fn 3/16/2017 22:03", "persistEvalCode:" : "fn 3/17/2017 10:23", + "primBreakOnExceptionsDuringSends:" : "fn 11/13/2017 18:09", "primEval:" : "fn 4/28/2017 15:30", "primRestartSpecificFrame:" : "fn 4/28/2017 15:31", "pygmentsLexer" : "fn 5/16/2017 17:47", diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st index e5df627c..27921023 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st @@ -1,7 +1,8 @@ helpers checkForException Smalltalk isHeadless ifTrue: [ ^ self ]. - (self primLastError) ifNotNil: [ :e | + (self primLastError) ifNotNil: [ :error | FLException new - action: [ self openDebuggerOn: e ]; + languageProcess: self; + foreignError: error; signal ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json index 9903234e..2c73b553 100644 --- a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "checkForException" : "fn 5/6/2017 16:38", + "checkForException" : "fn 5/24/2017 08:07", "debuggerTitle:" : "fn 5/6/2017 16:42", "findResumeContext:" : "fn 5/14/2017 19:30", "getForeignFrames:" : "fn 5/6/2017 16:48", diff --git a/repository/ForeignLanguage-Core.package/monticello.meta/version b/repository/ForeignLanguage-Core.package/monticello.meta/version index 0e3acf00..f29b01d7 100644 --- a/repository/ForeignLanguage-Core.package/monticello.meta/version +++ b/repository/ForeignLanguage-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Core-fn.7' message 'Cleanups' id 'b569fbc7-72c1-4832-b1b3-405a68bc4dd1' date '23 May 2017' time '4:39:54.781972 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.6' message 'Move methods to new ForeignLanguageProcess class' id 'dd3b75bb-a218-40ab-b5f6-2f0c98f5d9c9' date '6 May 2017' time '8:41:15.238039 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.5' message 'Updates' id '1b83a434-c31d-45ae-a79c-00e02f2f7d0d' date '28 April 2017' time '4:43:06.982288 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Core-fn.9' message 'Minor change' id '3300a148-3fa9-4d01-a90b-c9cfcec19845' date '14 November 2017' time '10:00:03.329509 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.8' message 'Add ForeignLanguage class>>primBreakOnExceptionsDuringSends: template' id '770b492e-d446-4d06-a4cc-40fd3b1a07d0' date '14 November 2017' time '9:56:41.018247 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.7' message 'Cleanups' id 'b569fbc7-72c1-4832-b1b3-405a68bc4dd1' date '23 May 2017' time '4:39:54.781972 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.6' message 'Move methods to new ForeignLanguageProcess class' id 'dd3b75bb-a218-40ab-b5f6-2f0c98f5d9c9' date '6 May 2017' time '8:41:15.238039 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.5' message 'Updates' id '1b83a434-c31d-45ae-a79c-00e02f2f7d0d' date '28 April 2017' time '4:43:06.982288 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.4' message 'Update in-image code' id '118a2e5c-d348-4ed2-a450-4de5888e437b' date '31 March 2017' time '12:38:53.664933 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.3' message 'Update in-image code' id '6289a2de-c0f5-4f40-b57d-beaf06a8a817' date '22 March 2017' time '9:44:20.969974 pm' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.2' message 'Add more abstractions' id 'fd73f835-1dcc-4562-a66a-31bfc76fd426' date '15 March 2017' time '10:22:18.795088 am' author 'fn' ancestors ((name 'ForeignLanguage-Core-fn.1' message 'Introduce ForeignLanguage classes' id 'b49e9411-f7fa-476f-b460-6c11ceb8ad59' date '14 March 2017' time '10:55:27.811915 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLException.class/instance/action..st b/repository/ForeignLanguage-Support.package/FLException.class/instance/action..st deleted file mode 100644 index 1f24f374..00000000 --- a/repository/ForeignLanguage-Support.package/FLException.class/instance/action..st +++ /dev/null @@ -1,3 +0,0 @@ -accessing -action: anObject - action := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLException.class/instance/action.st b/repository/ForeignLanguage-Support.package/FLException.class/instance/action.st deleted file mode 100644 index e1deac0d..00000000 --- a/repository/ForeignLanguage-Support.package/FLException.class/instance/action.st +++ /dev/null @@ -1,3 +0,0 @@ -accessing -action - ^ action \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st b/repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st index 7c4499c4..257ea3c9 100644 --- a/repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st +++ b/repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st @@ -1,3 +1,3 @@ accessing defaultAction - self action value \ No newline at end of file + self languageProcess openDebuggerOn: self foreignError \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLException.class/instance/foreignError..st b/repository/ForeignLanguage-Support.package/FLException.class/instance/foreignError..st new file mode 100644 index 00000000..e2d78c04 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLException.class/instance/foreignError..st @@ -0,0 +1,3 @@ +accessing +foreignError: anObject + foreignError := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLException.class/instance/foreignError.st b/repository/ForeignLanguage-Support.package/FLException.class/instance/foreignError.st new file mode 100644 index 00000000..e1f74df6 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLException.class/instance/foreignError.st @@ -0,0 +1,3 @@ +accessing +foreignError + ^ foreignError \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLException.class/instance/languageProcess..st b/repository/ForeignLanguage-Support.package/FLException.class/instance/languageProcess..st new file mode 100644 index 00000000..70ba9389 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLException.class/instance/languageProcess..st @@ -0,0 +1,3 @@ +accessing +languageProcess: anObject + languageProcess := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLException.class/instance/languageProcess.st b/repository/ForeignLanguage-Support.package/FLException.class/instance/languageProcess.st new file mode 100644 index 00000000..3c6ea82c --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLException.class/instance/languageProcess.st @@ -0,0 +1,3 @@ +accessing +languageProcess + ^ languageProcess \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLException.class/methodProperties.json b/repository/ForeignLanguage-Support.package/FLException.class/methodProperties.json index 6959dc31..a7c6cdb6 100644 --- a/repository/ForeignLanguage-Support.package/FLException.class/methodProperties.json +++ b/repository/ForeignLanguage-Support.package/FLException.class/methodProperties.json @@ -2,6 +2,8 @@ "class" : { }, "instance" : { - "action" : "fn 3/9/2017 16:43", - "action:" : "fn 3/9/2017 16:43", - "defaultAction" : "fn 3/9/2017 16:45" } } + "defaultAction" : "fn 5/24/2017 08:07", + "foreignError" : "fn 5/24/2017 08:05", + "foreignError:" : "fn 5/24/2017 08:05", + "languageProcess" : "fn 5/24/2017 08:06", + "languageProcess:" : "fn 5/24/2017 08:06" } } diff --git a/repository/ForeignLanguage-Support.package/FLException.class/properties.json b/repository/ForeignLanguage-Support.package/FLException.class/properties.json index c7480061..ebf8720f 100644 --- a/repository/ForeignLanguage-Support.package/FLException.class/properties.json +++ b/repository/ForeignLanguage-Support.package/FLException.class/properties.json @@ -6,7 +6,8 @@ ], "commentStamp" : "", "instvars" : [ - "action" ], + "languageProcess", + "foreignError" ], "name" : "FLException", "pools" : [ ], diff --git a/repository/ForeignLanguage-Support.package/monticello.meta/version b/repository/ForeignLanguage-Support.package/monticello.meta/version index 35e1be15..378648c5 100644 --- a/repository/ForeignLanguage-Support.package/monticello.meta/version +++ b/repository/ForeignLanguage-Support.package/monticello.meta/version @@ -1 +1 @@ -(name 'ForeignLanguage-Support-fn.6' message 'Cleanups' id '41a6f7d6-af0a-4985-b568-ab31a7735c3a' date '23 May 2017' time '4:40:03.613355 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.5' message 'Use FL namespace instead' id '46ee84e8-2aa7-45cd-9999-c54679d0ab08' date '28 April 2017' time '4:43:26.93281 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.4' message 'Update in-image code' id 'aac05489-0e6a-4f54-8ba1-7a72a08123d5' date '31 March 2017' time '12:38:59.949445 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'ForeignLanguage-Support-fn.7' message 'Update FLException' id 'ffa65b33-ae25-4814-b1c9-ef0f2d657718' date '14 November 2017' time '9:58:24.012393 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.6' message 'Cleanups' id '41a6f7d6-af0a-4985-b568-ab31a7735c3a' date '23 May 2017' time '4:40:03.613355 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.5' message 'Use FL namespace instead' id '46ee84e8-2aa7-45cd-9999-c54679d0ab08' date '28 April 2017' time '4:43:26.93281 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.4' message 'Update in-image code' id 'aac05489-0e6a-4f54-8ba1-7a72a08123d5' date '31 March 2017' time '12:38:59.949445 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.3' message 'Update in-image code' id '8b460da4-268a-439b-af31-057a663cff2a' date '22 March 2017' time '9:44:28.421791 pm' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.2' message 'Improve styler' id '95baab77-ea4d-4433-8ecd-c67f7d96eed5' date '15 March 2017' time '10:22:40.529743 am' author 'fn' ancestors ((name 'ForeignLanguage-Support-fn.1' message 'Generalize Python support classes and introduce them as foreign language support classes' id '6e1e5414-31b2-4b58-9945-c67d9a4f5cae' date '14 March 2017' time '11:00:50.809931 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/compile.st b/repository/Python-Core.package/Python.class/class/compile.st new file mode 100644 index 00000000..4a49c541 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/compile.st @@ -0,0 +1,3 @@ +special objects +compile + ^ self fromObjectCache: 'compile' \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/isExpression..st b/repository/Python-Core.package/Python.class/class/isExpression..st index 512677f4..21d7261a 100644 --- a/repository/Python-Core.package/Python.class/class/isExpression..st +++ b/repository/Python-Core.package/Python.class/class/isExpression..st @@ -1,3 +1,4 @@ helpers isExpression: aPySource - ^ ((Python globals __getitem__ __call__: '_is_expression') __call__: aPySource) asSmalltalk \ No newline at end of file + ^ [ self compile __call__: aPySource filename: '' cmd: 'eval'. true ] + on: FLException do: [:ex | (ex foreignError at: 0) asSmalltalk ~= 'SyntaxError' ] \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/class/primBreakOnExceptionsDuringSends..st b/repository/Python-Core.package/Python.class/class/primBreakOnExceptionsDuringSends..st new file mode 100644 index 00000000..8c6af2e9 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primBreakOnExceptionsDuringSends..st @@ -0,0 +1,5 @@ +system primitives +primBreakOnExceptionsDuringSends: aBool + + self primitiveFailed. + \ No newline at end of file diff --git a/repository/Python-Core.package/Python.class/methodProperties.json b/repository/Python-Core.package/Python.class/methodProperties.json index 365017b1..a013832d 100644 --- a/repository/Python-Core.package/Python.class/methodProperties.json +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -6,6 +6,7 @@ "basicVmSpeaksPython" : "fn 2/23/2017 20:59", "builtins" : "fn 2/23/2017 18:34", "cmdFor:" : "fn 3/16/2017 21:57", + "compile" : "fn 5/24/2017 10:34", "debuggerPrintItem:on:" : "fn 3/16/2017 21:58", "eval:" : "fn 3/21/2017 23:14", "eval:breakOnExceptions:" : "fn 3/11/2017 18:47", @@ -31,11 +32,12 @@ "indentSize:" : "fn 3/16/2017 21:37", "initialize" : "fn 3/6/2017 22:13", "isCallable:" : "fn 2/26/2017 21:45", - "isExpression:" : "fn 3/30/2017 00:00", + "isExpression:" : "fn 5/24/2017 14:41", "load:" : "fn 3/21/2017 23:14", "load:breakOnExceptions:" : "fn 3/12/2017 02:46", "locals" : "fn 2/26/2017 21:46", "pcRange:" : "fn 3/16/2017 22:21", + "primBreakOnExceptionsDuringSends:" : "fn 11/13/2017 18:08", "primEval:filename:cmd:breakOnExceptions:" : "fn 3/11/2017 14:45", "primRestartSpecificFrame:source:filename:cmd:" : "fn 2/1/2017 10:57", "pyLexerPython" : "fn 3/6/2017 19:05", diff --git a/repository/Python-Core.package/monticello.meta/version b/repository/Python-Core.package/monticello.meta/version index be1fbcb5..1760c3e6 100644 --- a/repository/Python-Core.package/monticello.meta/version +++ b/repository/Python-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Python-Core-fn.11' message 'Cleanups' id 'ccaf04b0-f5a2-4611-9253-21909e0c8626' date '23 May 2017' time '4:40:36.616426 pm' author 'fn' ancestors ((name 'Python-Core-fn.10' message 'Introduce PythonProcess class' id '422e4a4a-4424-4282-8442-23b6d1e55c8f' date '6 May 2017' time '8:41:59.105519 pm' author 'fn' ancestors ((name 'Python-Core-fn.9' message 'Updates' id '1a2fafe2-19a7-4de3-b2e9-e47ca2977965' date '28 April 2017' time '4:43:57.571228 pm' author 'fn' ancestors ((name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Python-Core-fn.13' message 'Add Python class>>primBreakOnExceptionsDuringSends:' id 'a4c53efd-79af-4363-9dcc-4c5ab54332ae' date '14 November 2017' time '10:01:18.61623 am' author 'fn' ancestors ((name 'Python-Core-fn.12' message 'Updates' id '36a34a10-78ea-4ac0-a540-e2f1f08c1f81' date '14 November 2017' time '9:58:00.795781 am' author 'fn' ancestors ((name 'Python-Core-fn.11' message 'Cleanups' id 'ccaf04b0-f5a2-4611-9253-21909e0c8626' date '23 May 2017' time '4:40:36.616426 pm' author 'fn' ancestors ((name 'Python-Core-fn.10' message 'Introduce PythonProcess class' id '422e4a4a-4424-4282-8442-23b6d1e55c8f' date '6 May 2017' time '8:41:59.105519 pm' author 'fn' ancestors ((name 'Python-Core-fn.9' message 'Updates' id '1a2fafe2-19a7-4de3-b2e9-e47ca2977965' date '28 April 2017' time '4:43:57.571228 pm' author 'fn' ancestors ((name 'Python-Core-fn.8' message 'Update in-image code' id '3dca9213-a5b0-4e31-b1fb-fc8719145684' date '31 March 2017' time '12:39:21.929581 am' author 'fn' ancestors ((name 'Python-Core-fn.7' message 'Update in-image code' id 'c206af22-c3de-4e29-b383-006acbb6a258' date '22 March 2017' time '9:44:42.916 pm' author 'fn' ancestors ((name 'Python-Core-fn.6' message 'Improve Python integration' id 'f5bd9c1f-e3ce-446a-bf2c-b6b4344f77da' date '15 March 2017' time '10:23:13.354535 am' author 'fn' ancestors ((name 'Python-Core-fn.5' message 'Update Python and PythonObject after recent VM changes and inherit from ForeignLanguage; move theme into core package' id 'c10fd400-d328-4594-990b-d97f725dbf02' date '14 March 2017' time '10:54:58.327714 am' author 'fn' ancestors ((name 'Python-Core-fn.4' message 'Introduce ForeignLanguage and ForeignLanguageException classes and adjust to new VM API.' id 'e8ad2c89-6936-45c3-9908-7f262f517bf8' date '9 March 2017' time '5:31:37.758664 pm' author 'fn' ancestors ((name 'Python-Core-fn.3' message 'Move sourceCodeTemplate' id 'ab4370c8-5360-405c-b704-7e7947bec6af' date '8 March 2017' time '2:29:02.288528 pm' author 'fn' ancestors ((name 'Python-Core-fn.2' message 'Cleanups' id '22159441-5de1-40de-b8b7-6e599217cd07' date '7 March 2017' time '12:45:52.421601 pm' author 'fn' ancestors ((name 'Python-Core-fn.1' message 'Initial commit' id '39dd0b67-e83b-4a8f-a281-5fe76a83af93' date '6 March 2017' time '9:43:20.544691 pm' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/primBreakOnExceptionsDuringSends..st b/repository/Ruby-Core.package/Ruby.class/class/primBreakOnExceptionsDuringSends..st new file mode 100644 index 00000000..d838cb6e --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primBreakOnExceptionsDuringSends..st @@ -0,0 +1,4 @@ +system primitives +primBreakOnExceptionsDuringSends: aBool + + self primitiveFailed. \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json index 8b8cf2f9..1eef3695 100644 --- a/repository/Ruby-Core.package/Ruby.class/methodProperties.json +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -16,6 +16,7 @@ "nil" : "fn 3/16/2017 13:37", "object" : "tfel 8/16/2016 07:04", "pcRange:" : "fn 4/2/2017 19:58", + "primBreakOnExceptionsDuringSends:" : "fn 11/13/2017 18:09", "primEval:" : "tfel 8/16/2016 07:03", "primEval:filePath:breakOnExceptions:" : "fn 3/16/2017 13:40", "primSend:to:with:" : "tfel 8/16/2016 07:03", diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version index 75b9edbb..0c1a801d 100644 --- a/repository/Ruby-Core.package/monticello.meta/version +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Ruby-Core-fn.8' message 'Add support for Ruby Bindings.' id 'bb1f89c6-a47b-4123-b5dd-8549b170736f' date '13 November 2017' time '3:18:05.11033 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.7' message 'Cleanups' id '0d0a21be-1f5d-4c8a-a41d-540112bd0e3b' date '23 May 2017' time '4:40:47.799452 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Ruby-Core-fn.9' message 'Add Ruby class>>primBreakOnExceptionsDuringSends:' id 'a3dd00e0-2f31-4398-9f3b-778541a9ea60' date '14 November 2017' time '10:01:04.784037 am' author 'fn' ancestors ((name 'Ruby-Core-fn.8' message 'Add support for Ruby Bindings.' id 'bb1f89c6-a47b-4123-b5dd-8549b170736f' date '13 November 2017' time '3:18:05.11033 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.7' message 'Cleanups' id '0d0a21be-1f5d-4c8a-a41d-540112bd0e3b' date '23 May 2017' time '4:40:47.799452 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 7464de4219897b796cc9c1679d0e4780205f94a3 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 14 Nov 2017 17:08:11 +0100 Subject: [PATCH 193/193] Use instance_eval instead of binding magic [ci skip] --- .../Ruby.class/class/evaluateExpression.in.to..st | 6 +----- repository/Ruby-Core.package/Ruby.class/class/startUp..st | 4 ---- .../Ruby-Core.package/Ruby.class/methodProperties.json | 3 +-- repository/Ruby-Core.package/monticello.meta/version | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 repository/Ruby-Core.package/Ruby.class/class/startUp..st diff --git a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st index b7a64d96..a8bc710d 100644 --- a/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st @@ -1,7 +1,3 @@ execution evaluateExpression: aSelection in: aContext to: receiver - | rbCode rbBinding | - rbCode := aSelection asString copyReplaceAll: 'self' with: 'that'. - rbBinding := Ruby eval: 'blank_binding'. - rbBinding local_variable_set: 'that' to: receiver. - ^ rbBinding eval: rbCode \ No newline at end of file + ^ receiver instance_eval: aSelection asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/class/startUp..st b/repository/Ruby-Core.package/Ruby.class/class/startUp..st deleted file mode 100644 index d18e5006..00000000 --- a/repository/Ruby-Core.package/Ruby.class/class/startUp..st +++ /dev/null @@ -1,4 +0,0 @@ -overrides -startUp: resuming - (resuming and: [ self vmSpeaksLanguage ]) - ifTrue: [ Ruby eval: 'def blank_binding; binding; end' ] \ No newline at end of file diff --git a/repository/Ruby-Core.package/Ruby.class/methodProperties.json b/repository/Ruby-Core.package/Ruby.class/methodProperties.json index 1eef3695..6252688d 100644 --- a/repository/Ruby-Core.package/Ruby.class/methodProperties.json +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -7,7 +7,7 @@ "eval:filePath:breakOnExceptions:" : "fn 3/23/2017 08:59", "evaluateExpression:" : "fn 3/27/2017 23:53", "evaluateExpression:breakOnExceptions:" : "fn 3/27/2017 23:53", - "evaluateExpression:in:to:" : "fn 11/13/2017 14:26", + "evaluateExpression:in:to:" : "fn 11/14/2017 17:06", "fileExtension" : "fn 3/17/2017 10:20", "getFilename:" : "fn 4/2/2017 19:33", "getSource:" : "fn 3/27/2017 23:54", @@ -23,7 +23,6 @@ "pygmentsLexer" : "fn 5/16/2017 17:48", "restartFrame:with:" : "fn 3/16/2017 22:22", "sourceCodeTemplate" : "fn 3/14/2017 11:22", - "startUp:" : "fn 11/13/2017 14:29", "tempNamesIn:" : "fn 3/16/2017 22:45", "tempVariableAt:in:" : "fn 3/16/2017 22:44", "vmSpeaksLanguage" : "fn 3/14/2017 11:33" }, diff --git a/repository/Ruby-Core.package/monticello.meta/version b/repository/Ruby-Core.package/monticello.meta/version index 0c1a801d..6cdb9403 100644 --- a/repository/Ruby-Core.package/monticello.meta/version +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -1 +1 @@ -(name 'Ruby-Core-fn.9' message 'Add Ruby class>>primBreakOnExceptionsDuringSends:' id 'a3dd00e0-2f31-4398-9f3b-778541a9ea60' date '14 November 2017' time '10:01:04.784037 am' author 'fn' ancestors ((name 'Ruby-Core-fn.8' message 'Add support for Ruby Bindings.' id 'bb1f89c6-a47b-4123-b5dd-8549b170736f' date '13 November 2017' time '3:18:05.11033 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.7' message 'Cleanups' id '0d0a21be-1f5d-4c8a-a41d-540112bd0e3b' date '23 May 2017' time '4:40:47.799452 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Ruby-Core-fn.10' message 'Use instance_eval instead of binding magic' id '5549780c-b724-4761-855e-789fa3fbcb69' date '14 November 2017' time '5:07:40.370652 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.9' message 'Add Ruby class>>primBreakOnExceptionsDuringSends:' id 'a3dd00e0-2f31-4398-9f3b-778541a9ea60' date '14 November 2017' time '10:01:04.784037 am' author 'fn' ancestors ((name 'Ruby-Core-fn.8' message 'Add support for Ruby Bindings.' id 'bb1f89c6-a47b-4123-b5dd-8549b170736f' date '13 November 2017' time '3:18:05.11033 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.7' message 'Cleanups' id '0d0a21be-1f5d-4c8a-a41d-540112bd0e3b' date '23 May 2017' time '4:40:47.799452 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.6' message 'Introduce RubyProcess class' id '6e29ec50-ce7a-42ad-9912-ec799a11c3b3' date '6 May 2017' time '8:42:11.610918 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.5' message 'Updates' id '405326bf-5725-48cf-8895-d51382c8cb38' date '28 April 2017' time '4:44:08.446987 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.4' message 'Update in-image code' id '132afc61-6eed-4cbc-97ae-952bbd94abcf' date '31 March 2017' time '12:39:12.106118 am' author 'fn' ancestors ((name 'Ruby-Core-fn.3' message 'Update in-image code' id '0c2297bb-784e-4022-a5d7-0b9c0d54bb7f' date '22 March 2017' time '9:44:58.947694 pm' author 'fn' ancestors ((name 'Ruby-Core-fn.2' message 'Improve Ruby integration' id '7a70298b-51b4-4e22-baa7-0caf3578d63b' date '15 March 2017' time '10:23:26.351199 am' author 'fn' ancestors ((name 'Ruby-Core-fn.1' message 'Introduce Ruby and RubyObject classes' id '8afbeb30-0e54-4ea1-8841-350120813f0d' date '14 March 2017' time '10:53:52.189423 am' author 'fn' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file