diff --git a/.build/plugintests.py b/.build/plugintests.py new file mode 100755 index 00000000..e13c31e7 --- /dev/null +++ b/.build/plugintests.py @@ -0,0 +1,34 @@ +#! /usr/bin/env python + +import sys +from os import path +from environment import cp, config # import with side effects + +from rsqueakvm.util import system + +if __name__ == "__main__": + try: + 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-dir=" + sys.exit(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_dir)) + + import pytest + exit(pytest.main(args=sys.argv[1:])) diff --git a/.gitignore b/.gitignore index 8d8ccdfe..52b3c1f8 100644 --- a/.gitignore +++ b/.gitignore @@ -275,3 +275,4 @@ images/ .build/rply .build/topaz docs/_build +rsqueakvm/test/images/pypy.image diff --git a/.travis/build.sh b/.travis/build.sh index 732f406b..e8de7063 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=110 + + 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,8 +72,8 @@ 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" -fi \ No newline at end of file +fi diff --git a/.travis/install_requirements.sh b/.travis/install_requirements.sh index cc7cc2e4..61e1fffa 100755 --- a/.travis/install_requirements.sh +++ b/.travis/install_requirements.sh @@ -2,6 +2,9 @@ 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" export OPTIONS="" @@ -95,6 +98,21 @@ setup_linux() { fi } +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 @@ -103,6 +121,8 @@ fi setup_$TRAVIS_OS_NAME python .build/download_dependencies.py $OPTIONS +load_test_images + if [[ -d ".build/sqpyte" ]]; then # Make sqlite/sqpyte for DatabasePlugin pushd ".build/sqpyte" > /dev/null diff --git a/.travis/test.sh b/.travis/test.sh index d2bec013..286824a3 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="--plugins=${PLUGINS} --plugin-dir=${PLUGIN_DIR}" + ;; *) echo "Wrong TEST_TYPE value (${TEST_TYPE}), not executing tests" exit 0 @@ -17,4 +23,4 @@ case "${BUILD_ARCH}" in *) ;; esac -pypy ".build/unittests.py" -s ${testflag} +pypy ".build/${testscript}" -s ${testflag} diff --git a/repository/ForeignLanguage-Core.package/.filetree b/repository/ForeignLanguage-Core.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/ForeignLanguage-Core.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/README.md b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/README.md new file mode 100644 index 00000000..e69de29b 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/compilePrimitivesIn..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st new file mode 100644 index 00000000..620a3a7d --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/compilePrimitivesIn..st @@ -0,0 +1,9 @@ +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. + 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/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/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/getContentsOf..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st new file mode 100644 index 00000000..e7b31be9 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/getContentsOf..st @@ -0,0 +1,8 @@ +helpers +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/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/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/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/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/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/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/pygmentsLexer.st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pygmentsLexer.st new file mode 100644 index 00000000..c23b35a9 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/pygmentsLexer.st @@ -0,0 +1,3 @@ +styling +pygmentsLexer + 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/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/stylerFormat..st b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/stylerFormat..st new file mode 100644 index 00000000..c7edd271 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/class/stylerFormat..st @@ -0,0 +1,10 @@ +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 sourceCodeTemplate asText]. + ^aText \ 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/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/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..23ce1a67 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/methodProperties.json @@ -0,0 +1,25 @@ +{ + "class" : { + "availableLanguages" : "fn 3/14/2017 11:15", + "compilePrimitivesIn:" : "fn 5/6/2017 13:20", + "debuggerPrintItem:on:" : "fn 3/16/2017 22:31", + "evaluateExpression:in:to:" : "fn 3/21/2017 11:32", + "fileExtension" : "fn 3/17/2017 10:20", + "getContentsOf:" : "fn 3/27/2017 21:54", + "getFilename:" : "fn 4/2/2017 19:32", + "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", + "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", + "vmSpeaksLanguage" : "fn 3/14/2017 11:31" }, + "instance" : { + } } diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguage.class/properties.json b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/properties.json new file mode 100644 index 00000000..4d6b3b1e --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguage.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "ForeignLanguage", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/README.md b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/README.md new file mode 100644 index 00000000..e69de29b 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/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..9422159c --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/defaultLabelForInspector.st @@ -0,0 +1,3 @@ +overrides +defaultLabelForInspector + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/environment.st b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/environment.st new file mode 100644 index 00000000..d6270da0 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/environment.st @@ -0,0 +1,3 @@ +overrides +environment + ^ nil \ No newline at end of file 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..b819e2cc --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/explore.st @@ -0,0 +1,3 @@ +overrides +explore + ^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 new file mode 100644 index 00000000..72a1d8d1 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspect.st @@ -0,0 +1,4 @@ +overrides +inspect + "Create and schedule an Inspector in which the user can examine the receiver's variables." + ^ 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 new file mode 100644 index 00000000..2ffb6333 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/instance/inspectorClass.st @@ -0,0 +1,3 @@ +overrides +inspectorClass + ^ FLInspector \ 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/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/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..d5533685 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageObject.class/methodProperties.json @@ -0,0 +1,19 @@ +{ + "class" : { + "isVariable" : "fn 4/28/2017 17:09" }, + "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/28/2017 15:00", + "environment" : "fn 3/12/2017 19:21", + "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", + "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/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..27921023 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/checkForException.st @@ -0,0 +1,8 @@ +helpers +checkForException + Smalltalk isHeadless ifTrue: [ ^ self ]. + (self primLastError) ifNotNil: [ :error | + FLException new + languageProcess: self; + foreignError: error; + signal ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/debuggerTitle..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/debuggerTitle..st new file mode 100644 index 00000000..f11375bc --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/debuggerTitle..st @@ -0,0 +1,3 @@ +helpers +debuggerTitle: foreignError + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeContext..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeContext..st new file mode 100644 index 00000000..409d07a7 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/findResumeContext..st @@ -0,0 +1,10 @@ +helpers +findResumeContext: aContext + | currentCtx | + currentCtx := aContext. + [ currentCtx notNil ] whileTrue: [ + (currentCtx method selector = #vmResume "special selector" + 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-Core.package/ForeignLanguageProcess.class/instance/getForeignFrames..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/getForeignFrames..st new file mode 100644 index 00000000..83f93a95 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/getForeignFrames..st @@ -0,0 +1,3 @@ +helpers +getForeignFrames: topForeignFrame + self subclassResponsibility \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/newForeignContextFor..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/newForeignContextFor..st new file mode 100644 index 00000000..33cd8f89 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/newForeignContextFor..st @@ -0,0 +1,3 @@ +helpers +newForeignContextFor: foreignFrame + ^ FLMethodContext newFor: foreignFrame \ No newline at end of file diff --git a/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st new file mode 100644 index 00000000..9d74ca14 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/openDebuggerOn..st @@ -0,0 +1,8 @@ +helpers +openDebuggerOn: foreignError + FLDebugger + openOn: Processor activeProcess + 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/instance/prependContexts..st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/prependContexts..st new file mode 100644 index 00000000..c92b13a0 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/prependContexts..st @@ -0,0 +1,10 @@ +helpers +prependContexts: resumeContext + | topForeignFrame newFrames | + [ topForeignFrame := self primTopFrame ] + 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/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/ForeignLanguageProcess.class/instance/vmResume.st b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmResume.st new file mode 100644 index 00000000..e5f2661f --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/instance/vmResume.st @@ -0,0 +1,5 @@ +special methods +vmResume + "Magic method that is called by vm (cached in vm)" + Processor yield. + ^ 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..2c73b553 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/ForeignLanguageProcess.class/methodProperties.json @@ -0,0 +1,16 @@ +{ + "class" : { + }, + "instance" : { + "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", + "newForeignContextFor:" : "fn 5/6/2017 16:47", + "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", + "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/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/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 new file mode 100644 index 00000000..2eb087fe --- /dev/null +++ b/repository/ForeignLanguage-Core.package/Object.extension/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "isForeign" : "fn 3/12/2017 19:24", + "languageSymbol" : "fn 3/21/2017 11:39" } } 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/ForeignLanguage-Core.package/monticello.meta/initializers.st b/repository/ForeignLanguage-Core.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b 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..f29b01d7 --- /dev/null +++ b/repository/ForeignLanguage-Core.package/monticello.meta/version @@ -0,0 +1 @@ +(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-Core.package/properties.json b/repository/ForeignLanguage-Core.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/ForeignLanguage-Core.package/properties.json @@ -0,0 +1,2 @@ +{ + } diff --git a/repository/ForeignLanguage-Support.package/.filetree b/repository/ForeignLanguage-Support.package/.filetree new file mode 100644 index 00000000..8998102c --- /dev/null +++ b/repository/ForeignLanguage-Support.package/.filetree @@ -0,0 +1,4 @@ +{ + "noMethodMetaData" : true, + "separateMethodMetaAndSource" : false, + "useCypressPropertiesFile" : true } diff --git a/repository/ForeignLanguage-Support.package/FLException.class/README.md b/repository/ForeignLanguage-Support.package/FLException.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st b/repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st new file mode 100644 index 00000000..257ea3c9 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLException.class/instance/defaultAction.st @@ -0,0 +1,3 @@ +accessing +defaultAction + 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 new file mode 100644 index 00000000..a7c6cdb6 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLException.class/methodProperties.json @@ -0,0 +1,9 @@ +{ + "class" : { + }, + "instance" : { + "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 new file mode 100644 index 00000000..ebf8720f --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLException.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "ForeignLanguage-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "languageProcess", + "foreignError" ], + "name" : "FLException", + "pools" : [ + ], + "super" : "Exception", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/README.md b/repository/ForeignLanguage-Support.package/FLMethodContext.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/class/newFor..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/class/newFor..st new file mode 100644 index 00000000..d25e0b18 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/class/newFor..st @@ -0,0 +1,10 @@ +as yet unclassified +newFor: foreignFrame + | frame | + frame := FLMethodContext + 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/ForeignLanguage-Support.package/FLMethodContext.class/instance/foreignFrame..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/foreignFrame..st new file mode 100644 index 00000000..6fb8966f --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.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/FLMethodContext.class/instance/foreignFrame.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/foreignFrame.st new file mode 100644 index 00000000..1255f0c5 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/foreignFrame.st @@ -0,0 +1,4 @@ +accessing +foreignFrame + + ^ foreignFrame \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/isForeign.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/isForeign.st new file mode 100644 index 00000000..6aab77f8 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/isForeign.st @@ -0,0 +1,3 @@ +overrides +isForeign + ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/languageClass.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/languageClass.st new file mode 100644 index 00000000..5851945e --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.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/FLMethodContext.class/instance/languageSymbol.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/languageSymbol.st new file mode 100644 index 00000000..d13c4229 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/languageSymbol.st @@ -0,0 +1,3 @@ +accessing +languageSymbol + ^ self foreignFrame languageSymbol \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/printOn..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/printOn..st new file mode 100644 index 00000000..fff08bd3 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/printOn..st @@ -0,0 +1,3 @@ +overrides +printOn: aStream + ^ self languageClass debuggerPrintItem: self foreignFrame on: aStream \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sender..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sender..st new file mode 100644 index 00000000..955558b9 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/sender..st @@ -0,0 +1,4 @@ +accessing +sender: anObject + + sender := anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/setSender.receiver.method.arguments..st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/setSender.receiver.method.arguments..st new file mode 100644 index 00000000..e9a494c4 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/setSender.receiver.method.arguments..st @@ -0,0 +1,11 @@ +overrides +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/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/instance/tempNames.st b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/tempNames.st new file mode 100644 index 00000000..c4d39f71 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/instance/tempNames.st @@ -0,0 +1,4 @@ +overrides +tempNames + self isForeign ifFalse: [ ^ super tempNames ]. + ^ self languageClass tempNamesIn: 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 new file mode 100644 index 00000000..a295bf7a --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/methodProperties.json @@ -0,0 +1,14 @@ +{ + "class" : { + "newFor:" : "fn 4/28/2017 16:07" }, + "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/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/FLMethodContext.class/properties.json b/repository/ForeignLanguage-Support.package/FLMethodContext.class/properties.json new file mode 100644 index 00000000..af753aaa --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLMethodContext.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "foreignFrame" ], + "name" : "FLMethodContext", + "pools" : [ + ], + "super" : "MethodContext", + "type" : "variable" } diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/README.md b/repository/ForeignLanguage-Support.package/FLTextStyler.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlight.lexer..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlight.lexer..st new file mode 100644 index 00000000..53727456 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/class/highlight.lexer..st @@ -0,0 +1,7 @@ +as yet unclassified +highlight: aText lexer: aLexer + Python vmSpeaksLanguage ifFalse: [ ^ aText ]. + ^ (Python pygmentsHighlight + __call__: aText string + lexer: aLexer + formatter: Python htmlFormatter) asSmalltalk asTextFromHtml \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/isForeign.st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/isForeign.st new file mode 100644 index 00000000..d5507e24 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.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/FLTextStyler.class/instance/languageClass.st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageClass.st new file mode 100644 index 00000000..5851945e --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.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/FLTextStyler.class/instance/languageSymbol..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageSymbol..st new file mode 100644 index 00000000..42a2cf87 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.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/FLTextStyler.class/instance/languageSymbol.st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/languageSymbol.st new file mode 100644 index 00000000..556e7f19 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.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/FLTextStyler.class/instance/privateFormat..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/privateFormat..st new file mode 100644 index 00000000..8d106173 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/privateFormat..st @@ -0,0 +1,4 @@ +overrides +privateFormat: aText + self isForeign ifFalse: [ ^ super privateFormat: aText ]. + ^ self languageClass stylerFormat: aText \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style..st new file mode 100644 index 00000000..6b9a322c --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/style..st @@ -0,0 +1,4 @@ +overrides +style: aText + self isForeign ifFalse: [ ^ super style: aText ]. + ^ self style: aText foreignClass: self languageClass \ 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 new file mode 100644 index 00000000..9f3047ee --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.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 := (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/instance/styleInBackgroundProcess..st b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/styleInBackgroundProcess..st new file mode 100644 index 00000000..bae55997 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/instance/styleInBackgroundProcess..st @@ -0,0 +1,5 @@ +overrides +styleInBackgroundProcess: aText + self isForeign ifFalse: [ ^ super styleInBackgroundProcess: aText ]. + ^ Project current addDeferredUIMessage: [ + self style: aText foreignClass: self languageClass ] \ 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 new file mode 100644 index 00000000..30f3d9bd --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/methodProperties.json @@ -0,0 +1,12 @@ +{ + "class" : { + "highlight:lexer:" : "fn 5/17/2017 10:13" }, + "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/16/2017 22:42", + "style:" : "fn 3/16/2017 22:42", + "style:foreignClass:" : "fn 5/16/2017 17:49", + "styleInBackgroundProcess:" : "fn 3/21/2017 11:25" } } diff --git a/repository/ForeignLanguage-Support.package/FLTextStyler.class/properties.json b/repository/ForeignLanguage-Support.package/FLTextStyler.class/properties.json new file mode 100644 index 00000000..4518dd56 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLTextStyler.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "languageSymbol" ], + "name" : "FLTextStyler", + "pools" : [ + ], + "super" : "SHTextStylerST80", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/README.md b/repository/ForeignLanguage-Support.package/FLToolSet.class/README.md new file mode 100644 index 00000000..e69de29b 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/FLToolSet.class/class/browseClass.category..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass.category..st new file mode 100644 index 00000000..5aea6063 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseClass.category..st @@ -0,0 +1,5 @@ +browsing +browseClass: aClass category: aCategory + ^ FLBrowser default + fullOnClass: aClass + category: aCategory \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseMessageCategory.inClass..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseMessageCategory.inClass..st new file mode 100644 index 00000000..42ce06ff --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/browseMessageCategory.inClass..st @@ -0,0 +1,4 @@ +browsing +browseMessageCategory: aCategory inClass: aClass + ^ FLBrowser default + newOnMessageCategory: aCategory inClass: aClass. \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debug.context.label.contents.fullView..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debug.context.label.contents.fullView..st new file mode 100644 index 00000000..b3c7ec84 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debug.context.label.contents.fullView..st @@ -0,0 +1,4 @@ +debugging +debug: aProcess context: aContext label: aString contents: contents fullView: aBool + "Open a debugger on the given process and context." + ^ FLDebugger openOn: aProcess context: aContext label: aString contents: contents fullView: aBool \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debugContext.label.contents..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debugContext.label.contents..st new file mode 100644 index 00000000..aeb916c3 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/debugContext.label.contents..st @@ -0,0 +1,4 @@ +debugging +debugContext: aContext label: aString contents: contents + "Open a debugger on the given process and context." + ^ 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/FLToolSet.class/class/initialize.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/initialize.st new file mode 100644 index 00000000..8b15285f --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/initialize.st @@ -0,0 +1,3 @@ +overrides +initialize + ToolSet register: self. \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/inspectorClassOf..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/inspectorClassOf..st new file mode 100644 index 00000000..4c9322c5 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/inspectorClassOf..st @@ -0,0 +1,4 @@ +inspecting +inspectorClassOf: anObject + anObject isForeign ifTrue: [ ^ FLInspector ]. + ^ super inspectorClassOf: anObject \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/interrupt.label..st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/interrupt.label..st new file mode 100644 index 00000000..44e07e50 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/interrupt.label..st @@ -0,0 +1,5 @@ +debugging +interrupt: aProcess label: aString + FLDebugger + openInterrupt: aString + onProcess: aProcess \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/menuItems.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/menuItems.st new file mode 100644 index 00000000..8bf3b412 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/menuItems.st @@ -0,0 +1,18 @@ +overrides +menuItems + "Answer the menu items available for this tool set" + ^#( + ('ForeignLanguage browser' #openForeignLanguageBrowser) + ('ForeignLanguage workspace' #openForeignLanguageWorkspace) + ('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/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/FLToolSet.class/class/openForeignLanguageBrowser.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageBrowser.st new file mode 100644 index 00000000..e0d66869 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageBrowser.st @@ -0,0 +1,3 @@ +inspecting +openForeignLanguageBrowser + FLBrowser open \ No newline at end of file diff --git a/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageWorkspace.st b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageWorkspace.st new file mode 100644 index 00000000..2f8d3222 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/class/openForeignLanguageWorkspace.st @@ -0,0 +1,3 @@ +inspecting +openForeignLanguageWorkspace + 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/FLToolSet.class/properties.json b/repository/ForeignLanguage-Support.package/FLToolSet.class/properties.json new file mode 100644 index 00000000..01e3fde0 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/FLToolSet.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Support", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "FLToolSet", + "pools" : [ + ], + "super" : "StandardToolSet", + "type" : "normal" } 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/ForeignLanguage-Support.package/monticello.meta/initializers.st b/repository/ForeignLanguage-Support.package/monticello.meta/initializers.st new file mode 100644 index 00000000..e69de29b 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..378648c5 --- /dev/null +++ b/repository/ForeignLanguage-Support.package/monticello.meta/version @@ -0,0 +1 @@ +(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/ForeignLanguage-Support.package/properties.json b/repository/ForeignLanguage-Support.package/properties.json new file mode 100644 index 00000000..f037444a --- /dev/null +++ b/repository/ForeignLanguage-Support.package/properties.json @@ -0,0 +1,2 @@ +{ + } 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/ForeignLanguage-Tools.package/FLBrowser.class/README.md b/repository/ForeignLanguage-Tools.package/FLBrowser.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/aboutToStyle..st new file mode 100644 index 00000000..45f08745 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/aboutToStyle..st @@ -0,0 +1,5 @@ +overrides +aboutToStyle: aStyler + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler languageSymbol: self languageSymbol. + ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/addModelItemsToWindowMenu..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/addModelItemsToWindowMenu..st new file mode 100644 index 00000000..3b5f792d --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/ForeignLanguage-Tools.package/FLBrowser.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/buildCodePaneWith..st new file mode 100644 index 00000000..0d531c2c --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/buildCodePaneWith..st @@ -0,0 +1,28 @@ +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 := builder pluggableCodePaneSpec new. + textSpec + model: self; + getText: #contents; + setText: #contents:notifying:; + selection: #contentsSelection; + menu: #codePaneMenu:shifted:; + stylerClass: FLTextStyler. + 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/ForeignLanguage-Tools.package/FLBrowser.class/instance/currentLanguageSymbol.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/currentLanguageSymbol.st new file mode 100644 index 00000000..1b57c2ba --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultBrowserTitle.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultBrowserTitle.st new file mode 100644 index 00000000..155b9bc7 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultBrowserTitle.st @@ -0,0 +1,3 @@ +overrides +defaultBrowserTitle + ^ 'Browser' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultStylerClass.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultStylerClass.st new file mode 100644 index 00000000..378a6867 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defaultStylerClass.st @@ -0,0 +1,3 @@ +overrides +defaultStylerClass + ^ FLTextStyler \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defineMessageFrom.notifying..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/defineMessageFrom.notifying..st new file mode 100644 index 00000000..b4f52b0f --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/ForeignLanguage-Tools.package/FLBrowser.class/instance/doItReceiver.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/doItReceiver.st new file mode 100644 index 00000000..db97da75 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/ForeignLanguage-Tools.package/FLBrowser.class/instance/isForeign.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isForeign.st new file mode 100644 index 00000000..5dc39512 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/ForeignLanguage-Tools.package/FLBrowser.class/instance/isPython.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isPython.st new file mode 100644 index 00000000..5305c816 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isPython.st @@ -0,0 +1,8 @@ +helpers +isPython + | class selector | + 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/ForeignLanguage-Tools.package/FLBrowser.class/instance/isRuby.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isRuby.st new file mode 100644 index 00000000..fd9e9c4b --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/FLBrowser.class/instance/isSmalltalk.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/isSmalltalk.st new file mode 100644 index 00000000..f2d264bf --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/FLBrowser.class/instance/labelString.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/labelString.st new file mode 100644 index 00000000..4e7c3c4e --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/FLBrowser.class/instance/languageSymbol..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/languageSymbol..st new file mode 100644 index 00000000..42a2cf87 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/FLBrowser.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/languageSymbol.st new file mode 100644 index 00000000..556e7f19 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/FLBrowser.class/instance/selectLanguage..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/selectLanguage..st new file mode 100644 index 00000000..aeb700c6 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/ForeignLanguage-Tools.package/FLBrowser.class/instance/selectedMessage.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/selectedMessage.st new file mode 100644 index 00000000..318c5b2e --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/ForeignLanguage-Tools.package/FLBrowser.class/instance/systemCategoryList.st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/systemCategoryList.st new file mode 100644 index 00000000..3942e734 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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/ForeignLanguage-Tools.package/FLBrowser.class/instance/validateMessageSource.forSelector.inClass..st b/repository/ForeignLanguage-Tools.package/FLBrowser.class/instance/validateMessageSource.forSelector.inClass..st new file mode 100644 index 00000000..0bcbf702 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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 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/FLBrowser.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLBrowser.class/methodProperties.json new file mode 100644 index 00000000..f5fcc119 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.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 4/28/2017 16:07", + "currentLanguageSymbol" : "fn 3/14/2017 00:51", + "defaultBrowserTitle" : "fn 3/14/2017 11:16", + "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", + "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/ForeignLanguage-Tools.package/FLBrowser.class/properties.json b/repository/ForeignLanguage-Tools.package/FLBrowser.class/properties.json new file mode 100644 index 00000000..fd08481e --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLBrowser.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "languageSymbol" ], + "name" : "FLBrowser", + "pools" : [ + ], + "super" : "Browser", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/README.md b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/README.md new file mode 100644 index 00000000..e69de29b 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..bc7e03ea --- /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 := #('- 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 new file mode 100644 index 00000000..22c92a14 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/instance/selection.st @@ -0,0 +1,9 @@ +overrides +selection + self object isForeign ifFalse: [ ^ super selection ]. + selectionIndex = 0 ifTrue: [^ '']. + selectionIndex = 1 ifTrue: [^ object foreignFrame ]. + Smalltalk at: object languageSymbol ifPresent: [ :cls | + 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 new file mode 100644 index 00000000..161ae7e7 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "fieldList" : "fn 5/6/2017 17:00", + "selection" : "fn 5/6/2017 17:01" } } diff --git a/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/properties.json b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/properties.json new file mode 100644 index 00000000..f12cb6bd --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLContextVariablesInspector.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "FLContextVariablesInspector", + "pools" : [ + ], + "super" : "ContextVariablesInspector", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/README.md b/repository/ForeignLanguage-Tools.package/FLDebugger.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/aboutToStyle..st new file mode 100644 index 00000000..48bc51ab --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/aboutToStyle..st @@ -0,0 +1,8 @@ +overrides +aboutToStyle: aStyler + self isModeStyleable ifFalse: [^false]. + self selectedContext isForeign ifFalse: [^ super aboutToStyle: aStyler]. + aStyler + classOrMetaClass: self selectedClassOrMetaClass; + languageSymbol: self languageSymbol. + ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/buildCodePaneWith..st new file mode 100644 index 00000000..826e0384 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/buildCodePaneWith..st @@ -0,0 +1,33 @@ +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 := builder pluggableCodePaneSpec new. + textSpec + model: self; + getText: #contents; + setText: #contents:notifying:; + selection: #contentsSelection; + menu: #codePaneMenu:shifted:; + frame: self textFrame; + stylerClass: FLTextStyler. + 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/ForeignLanguage-Tools.package/FLDebugger.class/instance/contents.notifying..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/contents.notifying..st new file mode 100644 index 00000000..dceecafa --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/contents.notifying..st @@ -0,0 +1,10 @@ +overrides +contents: aText notifying: aController + | ctx | + 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 restartFrame: ctx foreignFrame with: aText asString withUnixLineEndings ]. + contents := aText. + ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/defaultStylerClass.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/defaultStylerClass.st new file mode 100644 index 00000000..378a6867 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/defaultStylerClass.st @@ -0,0 +1,3 @@ +overrides +defaultStylerClass + ^ 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/FLDebugger.class/instance/guessTypeForName..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/guessTypeForName..st new file mode 100644 index 00000000..ef40aa9c --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.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/FLDebugger.class/instance/isPython.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/isPython.st new file mode 100644 index 00000000..ca5546ab --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.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/FLDebugger.class/instance/isRuby.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/isRuby.st new file mode 100644 index 00000000..f010f863 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.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/FLDebugger.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/languageSymbol.st new file mode 100644 index 00000000..90eee1f4 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.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/ForeignLanguage-Tools.package/FLDebugger.class/instance/messageIconAt..st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/messageIconAt..st new file mode 100644 index 00000000..f420536c --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/messageIconAt..st @@ -0,0 +1,9 @@ +overrides +messageIconAt: anIndex + | context | + 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 diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/pcRange.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/pcRange.st new file mode 100644 index 00000000..b438eb9b --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/pcRange.st @@ -0,0 +1,7 @@ +overrides +pcRange + | 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/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..d79507ed --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/process.controller.context..st @@ -0,0 +1,7 @@ +overrides +process: aProcess controller: aController context: aContext + | ctx | + (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 diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st new file mode 100644 index 00000000..116d4b35 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/instance/selectedMessage.st @@ -0,0 +1,6 @@ +overrides +selectedMessage + | aContext | + aContext := self selectedContext. + aContext isForeign ifFalse: [ ^ super selectedMessage ]. + ^ 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 new file mode 100644 index 00000000..01ffb5d3 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/methodProperties.json @@ -0,0 +1,17 @@ +{ + "class" : { + }, + "instance" : { + "aboutToStyle:" : "fn 3/14/2017 01:31", + "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 5/14/2017 19:34", + "selectedMessage" : "fn 5/14/2017 21:50" } } diff --git a/repository/ForeignLanguage-Tools.package/FLDebugger.class/properties.json b/repository/ForeignLanguage-Tools.package/FLDebugger.class/properties.json new file mode 100644 index 00000000..2e8883fa --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLDebugger.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "FLDebugger", + "pools" : [ + ], + "super" : "Debugger", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/README.md b/repository/ForeignLanguage-Tools.package/FLInspector.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/aboutToStyle..st new file mode 100644 index 00000000..c72354ef --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/aboutToStyle..st @@ -0,0 +1,5 @@ +overrides +aboutToStyle: aStyler + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler languageSymbol: object languageSymbol. + ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/buildCodePaneWith..st new file mode 100644 index 00000000..5272156e --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/buildCodePaneWith..st @@ -0,0 +1,14 @@ +overrides +buildCodePaneWith: builder + | textSpec | + textSpec := builder pluggableCodePaneSpec new. + textSpec + model: self; + getText: #expression; + editText: #expression:; + help: #helpText; + selection: #contentsSelection; + menu: #codePaneMenu:shifted:; + askBeforeDiscardingEdits: false; + stylerClass: FLTextStyler. + ^textSpec \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/contentsIsString.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/contentsIsString.st new file mode 100644 index 00000000..12b6460e --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.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/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st new file mode 100644 index 00000000..18f9c498 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/evaluateExpression..st @@ -0,0 +1,4 @@ +overrides +evaluateExpression: selection + 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 new file mode 100644 index 00000000..cdd1aa49 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/fieldList.st @@ -0,0 +1,4 @@ +overrides +fieldList + 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/languageClass.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/languageClass.st new file mode 100644 index 00000000..e3b06087 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.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/FLInspector.class/instance/selection.st b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/selection.st new file mode 100644 index 00000000..5196af04 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/instance/selection.st @@ -0,0 +1,11 @@ +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 - 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 new file mode 100644 index 00000000..1448645f --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/methodProperties.json @@ -0,0 +1,12 @@ +{ + "class" : { + }, + "instance" : { + "aboutToStyle:" : "fn 3/13/2017 17:35", + "buildCodePaneWith:" : "fn 4/28/2017 16:07", + "contentsIsString" : "fn 12/23/2016 11:11", + "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 5/13/2017 16:28" } } diff --git a/repository/ForeignLanguage-Tools.package/FLInspector.class/properties.json b/repository/ForeignLanguage-Tools.package/FLInspector.class/properties.json new file mode 100644 index 00000000..06196822 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLInspector.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "FLInspector", + "pools" : [ + ], + "super" : "Inspector", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/README.md b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/aboutToStyle..st new file mode 100644 index 00000000..3635f9aa --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/aboutToStyle..st @@ -0,0 +1,5 @@ +as yet unclassified +aboutToStyle: aStyler + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler languageSymbol: self object languageSymbol. + ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/buildWith..st b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/instance/buildWith..st new file mode 100644 index 00000000..d1986c35 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.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: FLTextStyler. + 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/ForeignLanguage-Tools.package/FLObjectExplorer.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/methodProperties.json new file mode 100644 index 00000000..023149d0 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/methodProperties.json @@ -0,0 +1,6 @@ +{ + "class" : { + }, + "instance" : { + "aboutToStyle:" : "fn 3/13/2017 17:42", + "buildWith:" : "fn 4/28/2017 16:07" } } diff --git a/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/properties.json b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/properties.json new file mode 100644 index 00000000..b163f924 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLObjectExplorer.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "ForeignLanguage-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "FLObjectExplorer", + "pools" : [ + ], + "super" : "ObjectExplorer", + "type" : "normal" } diff --git a/repository/ForeignLanguage-Tools.package/FLWorkspace.class/README.md b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/README.md new file mode 100644 index 00000000..e69de29b diff --git a/repository/ForeignLanguage-Tools.package/FLWorkspace.class/class/open.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/class/open.st new file mode 100644 index 00000000..3227c1ce --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/class/windowTitlePrefix.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/class/windowTitlePrefix.st new file mode 100644 index 00000000..321afdfe --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/class/windowTitlePrefix.st @@ -0,0 +1,3 @@ +as yet unclassified +windowTitlePrefix + ^ 'Workspace' \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/aboutToStyle..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/aboutToStyle..st new file mode 100644 index 00000000..45f08745 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/aboutToStyle..st @@ -0,0 +1,5 @@ +overrides +aboutToStyle: aStyler + (super aboutToStyle: aStyler) ifFalse: [ ^ false ]. + aStyler languageSymbol: self languageSymbol. + ^ true \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/addModelItemsToWindowMenu..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/addModelItemsToWindowMenu..st new file mode 100644 index 00000000..1cea3aa4 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/addModelItemsToWindowMenu..st @@ -0,0 +1,14 @@ +overrides +addModelItemsToWindowMenu: aMenu + aMenu addLine. + ForeignLanguage availableLanguages do: [:ea | + aMenu + add: 'select ', ea asString ,'...' + target: self + 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/FLWorkspace.class/instance/breakOnExceptions..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptions..st new file mode 100644 index 00000000..51bc2ff5 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/instance/breakOnExceptions.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptions.st new file mode 100644 index 00000000..51feff7d --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptions.st @@ -0,0 +1,3 @@ +accessing +breakOnExceptions + ^ breakOnExceptions ifNil: [ breakOnExceptions := false ] \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptionsText.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/breakOnExceptionsText.st new file mode 100644 index 00000000..6f39844b --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/instance/buildCodePaneWith..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/buildCodePaneWith..st new file mode 100644 index 00000000..392ac195 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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: FLTextStyler. + ^textSpec \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/evaluateExpression..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/evaluateExpression..st new file mode 100644 index 00000000..9aa8e55d --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/evaluateExpression..st @@ -0,0 +1,4 @@ +execution +evaluateExpression: selection + self isForeign ifFalse: [ ^ Compiler evaluate: selection asString ]. + ^ self languageClass evaluateExpression: selection breakOnExceptions: self breakOnExceptions \ No newline at end of file diff --git a/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/isForeign.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/isForeign.st new file mode 100644 index 00000000..14435f59 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/instance/labelString.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/labelString.st new file mode 100644 index 00000000..3666d1b9 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/labelString.st @@ -0,0 +1,7 @@ +foreign-language-support +labelString + | 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/FLWorkspace.class/instance/languageClass.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageClass.st new file mode 100644 index 00000000..5851945e --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/instance/languageSymbol..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageSymbol..st new file mode 100644 index 00000000..42a2cf87 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/instance/languageSymbol.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/languageSymbol.st new file mode 100644 index 00000000..556e7f19 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/instance/selectLanguage..st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/selectLanguage..st new file mode 100644 index 00000000..077e6cdd --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/instance/toggleBreakOnExceptions.st b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/instance/toggleBreakOnExceptions.st new file mode 100644 index 00000000..bc7af061 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.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/FLWorkspace.class/methodProperties.json b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/methodProperties.json new file mode 100644 index 00000000..f16b8b1d --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/methodProperties.json @@ -0,0 +1,19 @@ +{ + "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/21/2017 23:10", + "breakOnExceptions" : "fn 3/23/2017 00:36", + "breakOnExceptions:" : "fn 3/21/2017 23:06", + "breakOnExceptionsText" : "fn 3/21/2017 23:11", + "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", + "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", + "toggleBreakOnExceptions" : "fn 3/22/2017 09:47" } } diff --git a/repository/ForeignLanguage-Tools.package/FLWorkspace.class/properties.json b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/properties.json new file mode 100644 index 00000000..ff48237f --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/FLWorkspace.class/properties.json @@ -0,0 +1,15 @@ +{ + "category" : "ForeignLanguage-Tools", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "breakOnExceptions", + "languageSymbol" ], + "name" : "FLWorkspace", + "pools" : [ + ], + "super" : "Workspace", + "type" : "normal" } 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..d381dc93 --- /dev/null +++ b/repository/ForeignLanguage-Tools.package/monticello.meta/version @@ -0,0 +1 @@ +(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/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/.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..65979c5c --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/cmdFor..st @@ -0,0 +1,5 @@ +helpers +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/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/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/eval..st b/repository/Python-Core.package/Python.class/class/eval..st new file mode 100644 index 00000000..9fcfc706 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/eval..st @@ -0,0 +1,3 @@ +execution +eval: aString + ^ self eval: aString breakOnExceptions: false \ 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..7458bff5 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression..st @@ -0,0 +1,3 @@ +execution +evaluateExpression: selection + ^ 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 new file mode 100644 index 00000000..7606e85a --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression.breakOnExceptions..st @@ -0,0 +1,4 @@ +execution +evaluateExpression: selection 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 new file mode 100644 index 00000000..5ce6eead --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/evaluateExpression.in.to..st @@ -0,0 +1,19 @@ +execution +evaluateExpression: aSelection in: aContext to: receiver + | pyCode | + pyCode := aSelection asString. + + Python exec: 'rcvr_locals = dict()'. + (Python eval: 'rcvr_locals') setdefault __call__: 'self' to: receiver. + + (Python isExpression: pyCode) + ifTrue: [ + ^ Python builtins eval + __call__: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] + ifFalse: [ + ^ Python builtins exec + __call__: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] \ 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..94aaa55b --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/exec..st @@ -0,0 +1,3 @@ +execution +exec: aString + ^ self exec: aString breakOnExceptions: false \ 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/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/Python-Core.package/Python.class/class/filterPySource.lineno..st b/repository/Python-Core.package/Python.class/class/filterPySource.lineno..st new file mode 100644 index 00000000..4090ad04 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/filterPySource.lineno..st @@ -0,0 +1,10 @@ +source code +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-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/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/getSignature..st b/repository/Python-Core.package/Python.class/class/getSignature..st new file mode 100644 index 00000000..ac97030b --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/getSignature..st @@ -0,0 +1,10 @@ +debugging +getSignature: pyCode + | filename content | + filename := pyCode co_filename asSmalltalk. + (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 new file mode 100644 index 00000000..9fdf13bb --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/getSource..st @@ -0,0 +1,9 @@ +source code +getSource: pyFrame + | pyCode filename contents | + pyCode := pyFrame f_code. + filename := pyCode co_filename asSmalltalk. + 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/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/htmlFormatter.st b/repository/Python-Core.package/Python.class/class/htmlFormatter.st new file mode 100644 index 00000000..25fbe28f --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/htmlFormatter.st @@ -0,0 +1,3 @@ +special objects +htmlFormatter + ^ self fromObjectCache: '_pygments_formatter' \ 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..5a57c83f --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/import..st @@ -0,0 +1,3 @@ +helpers +import: aModuleName + Python exec: 'import ', aModuleName breakOnExceptions: false \ 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/indent.by..st b/repository/Python-Core.package/Python.class/class/indent.by..st new file mode 100644 index 00000000..e89bd824 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/indent.by..st @@ -0,0 +1,5 @@ +source code +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-Core.package/Python.class/class/indentSize..st b/repository/Python-Core.package/Python.class/class/indentSize..st new file mode 100644 index 00000000..558128a1 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/indentSize..st @@ -0,0 +1,3 @@ +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/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..21d7261a --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/isExpression..st @@ -0,0 +1,4 @@ +helpers +isExpression: aPySource + ^ [ 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/load..st b/repository/Python-Core.package/Python.class/class/load..st new file mode 100644 index 00000000..8edc8fb3 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/load..st @@ -0,0 +1,3 @@ +helpers +load: aModuleName + ^ self load: aModuleName breakOnExceptions: false \ 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/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/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/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/class/primEval.filename.cmd.breakOnExceptions..st b/repository/Python-Core.package/Python.class/class/primEval.filename.cmd.breakOnExceptions..st new file mode 100644 index 00000000..8e61c432 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primEval.filename.cmd.breakOnExceptions..st @@ -0,0 +1,4 @@ +system primitives +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/primRestartSpecificFrame.source.filename.cmd..st b/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st new file mode 100644 index 00000000..78ee2451 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/primRestartSpecificFrame.source.filename.cmd..st @@ -0,0 +1,5 @@ +system primitives +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/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/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/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/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/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/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/replaceInPySource.content.lineno..st b/repository/Python-Core.package/Python.class/class/replaceInPySource.content.lineno..st new file mode 100644 index 00000000..e41f402f --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/replaceInPySource.content.lineno..st @@ -0,0 +1,10 @@ +source code +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-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.with..st b/repository/Python-Core.package/Python.class/class/restartFrame.with..st new file mode 100644 index 00000000..6d82617c --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/restartFrame.with..st @@ -0,0 +1,7 @@ +debugging +restartFrame: pyFrame with: aSource + self + primRestartSpecificFrame: pyFrame + source: aSource + 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/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/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/scopeEndIn.startingAt..st b/repository/Python-Core.package/Python.class/class/scopeEndIn.startingAt..st new file mode 100644 index 00000000..4d6e5285 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/scopeEndIn.startingAt..st @@ -0,0 +1,8 @@ +source code +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-Core.package/Python.class/class/setSource.to..st b/repository/Python-Core.package/Python.class/class/setSource.to..st new file mode 100644 index 00000000..62ed7f48 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/setSource.to..st @@ -0,0 +1,13 @@ +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. + 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 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..eac3faf2 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/setUpPygments.st @@ -0,0 +1,18 @@ +overrides +setUpPygments + self exec: ' +try: + 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_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="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/class/setUpPythonEnvironment.st b/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st new file mode 100644 index 00000000..4b2570f1 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/setUpPythonEnvironment.st @@ -0,0 +1,22 @@ +overrides +setUpPythonEnvironment + self load: 'sys'. + 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 _is_expression(x): + try: + compile(x, "", "eval") + 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 new file mode 100644 index 00000000..ae06f637 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/single..st @@ -0,0 +1,7 @@ +helpers +single: aString + ^ self + primEval: aString + filename: '' + cmd: 'single' + breakOnExceptions: false \ 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 new file mode 100644 index 00000000..576d352b --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/startUp..st @@ -0,0 +1,7 @@ +overrides +startUp: resuming + self reset. + (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/tempNamesIn..st b/repository/Python-Core.package/Python.class/class/tempNamesIn..st new file mode 100644 index 00000000..4e020c68 --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/tempNamesIn..st @@ -0,0 +1,3 @@ +debugging +tempNamesIn: pyFrame + ^ 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 new file mode 100644 index 00000000..d200dafc --- /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 __call__ at: anIndex \ 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/vmSpeaksLanguage.st b/repository/Python-Core.package/Python.class/class/vmSpeaksLanguage.st new file mode 100644 index 00000000..b105f92e --- /dev/null +++ b/repository/Python-Core.package/Python.class/class/vmSpeaksLanguage.st @@ -0,0 +1,3 @@ +helpers +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 new file mode 100644 index 00000000..a013832d --- /dev/null +++ b/repository/Python-Core.package/Python.class/methodProperties.json @@ -0,0 +1,67 @@ +{ + "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 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", + "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", + "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", + "getFilename:" : "fn 4/2/2017 19:33", + "getSignature:" : "fn 3/28/2017 01:38", + "getSource:" : "fn 3/28/2017 12:02", + "globals" : "fn 2/26/2017 21:46", + "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", + "indentSize:" : "fn 3/16/2017 21:37", + "initialize" : "fn 3/6/2017 22:13", + "isCallable:" : "fn 2/26/2017 21:45", + "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", + "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", + "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 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", + "startUp:" : "fn 3/14/2017 11:32", + "sys" : "fn 3/9/2017 17:54", + "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/Python.class/properties.json b/repository/Python-Core.package/Python.class/properties.json new file mode 100644 index 00000000..0d26c810 --- /dev/null +++ b/repository/Python-Core.package/Python.class/properties.json @@ -0,0 +1,16 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + "BreakOnExceptions", + "ObjectCache", + "VMSpeaksPython" ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "Python", + "pools" : [ + ], + "super" : "ForeignLanguage", + "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..b9883124 --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/class/parserClass.st @@ -0,0 +1,5 @@ +as yet unclassified +parserClass + 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 new file mode 100644 index 00000000..7038688b --- /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 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/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..74890295 --- /dev/null +++ b/repository/Python-Core.package/PythonCompiler.class/instance/evaluate.in.to.notifying.ifFail.logged..st @@ -0,0 +1,19 @@ +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 __call__: 'self' to: receiver. + + (Python isExpression: pyCode) + ifTrue: [ + ^ Python builtins eval + __call__: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] + ifFalse: [ + ^ Python builtins exec + __call__: pyCode + globals: (Python eval: 'globals()') + locals: (Python eval: 'rcvr_locals')] \ 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..13311480 --- /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 3/14/2017 11:32" }, + "instance" : { + "compile:in:notifying:ifFail:" : "fn 3/14/2017 11:32", + "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/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..699634a5 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/class/average..st @@ -0,0 +1,6 @@ +debugging +average: anIterableDef + 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 new file mode 100644 index 00000000..ea1c0bb3 --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/class/average.st @@ -0,0 +1,6 @@ +debugging +average + 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 new file mode 100644 index 00000000..e76666ac --- /dev/null +++ b/repository/Python-Core.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/Python-Core.package/PythonExamples.class/class/fibonacci9.st b/repository/Python-Core.package/PythonExamples.class/class/fibonacci9.st new file mode 100644 index 00000000..72efe856 --- /dev/null +++ b/repository/Python-Core.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/Python-Core.package/PythonExamples.class/class/miniexample.st b/repository/Python-Core.package/PythonExamples.class/class/miniexample.st new file mode 100644 index 00000000..7b413a62 --- /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 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/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..c5c3147d --- /dev/null +++ b/repository/Python-Core.package/PythonExamples.class/methodProperties.json @@ -0,0 +1,10 @@ +{ + "class" : { + "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/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..7f5d5748 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/allInstances.st @@ -0,0 +1,4 @@ +overrides +allInstances + ^ super 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..c22bd4d7 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/class/new.st @@ -0,0 +1,5 @@ +overrides +new + Python vmSpeaksLanguage ifFalse: [ ^ super new ]. + ^ self withAll: #() + \ 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..70fbabe5 --- /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 = ForeignLanguageObject + 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/sourceCodeTemplate.st b/repository/Python-Core.package/PythonObject.class/class/sourceCodeTemplate.st new file mode 100644 index 00000000..1c9c9b4a --- /dev/null +++ b/repository/Python-Core.package/PythonObject.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/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..a261a652 --- /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 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 new file mode 100644 index 00000000..cee29824 --- /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/instance/allAttributes.st b/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st new file mode 100644 index 00000000..405674c9 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/allAttributes.st @@ -0,0 +1,3 @@ +helpers +allAttributes + ^ (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 new file mode 100644 index 00000000..53dc5826 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/allInstVarNames.st @@ -0,0 +1,3 @@ +overrides +allInstVarNames + ^ (Python builtins dir __call__: self) asSmalltalk \ 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..f7f9a347 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/at..st @@ -0,0 +1,3 @@ +overrides +at: aKeyOrIndex + ^ 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 new file mode 100644 index 00000000..3c4a09a7 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/at.put..st @@ -0,0 +1,3 @@ +overrides +at: aKeyOrIndex put: aValue + ^ 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 new file mode 100644 index 00000000..4f9a1b4b --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/class.st @@ -0,0 +1,3 @@ +overrides +class + ^ Python builtins type __call__: 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..ed320bef --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/defaultLabelForInspector.st @@ -0,0 +1,4 @@ +overrides +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 new file mode 100644 index 00000000..cb023dde --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/explorerContents.st @@ -0,0 +1,8 @@ +explorer +explorerContents + ^ self allInstVarNames asOrderedCollection collect: [ :attrName | | value | + value := Python builtins getattr __call__: 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..0906d056 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/hasAttribute..st @@ -0,0 +1,3 @@ +helpers +hasAttribute: anAttribute + ^ (Python builtins hasattr __call__: 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..21040471 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/hasContentsInExplorer.st @@ -0,0 +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 new file mode 100644 index 00000000..5df62a7b --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/instVarNamed..st @@ -0,0 +1,3 @@ +overrides +instVarNamed: aName + ^ Python builtins getattr __call__: self attrName: aName \ 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..a91db106 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/isClass.st @@ -0,0 +1,3 @@ +helpers +isClass + ^ (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/isKindOf..st b/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st new file mode 100644 index 00000000..cf7e262a --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/isKindOf..st @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..e0196449 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/isNone.st @@ -0,0 +1,3 @@ +helpers +isNone + ^ self == Python None \ 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/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 new file mode 100644 index 00000000..72feedc3 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/notNone.st @@ -0,0 +1,3 @@ +helpers +notNone + ^ self isNone not \ 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..7d1ba1bd --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/printOn..st @@ -0,0 +1,3 @@ +overrides +printOn: aStream + 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/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..6dffa013 --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/instance/variablesAndOffsetsDo..st @@ -0,0 +1,3 @@ +overrides +variablesAndOffsetsDo: aBinaryBlock + ^ 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..4fc2b71b --- /dev/null +++ b/repository/Python-Core.package/PythonObject.class/methodProperties.json @@ -0,0 +1,39 @@ +{ + "class" : { + "allInstances" : "fn 3/12/2017 19:20", + "isPython" : "fn 3/7/2017 11:56", + "new" : "fn 3/14/2017 11:32", + "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 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", + "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:" : "fn 3/14/2017 11:32", + "toolIconSelector:" : "fn 3/14/2017 01:35", + "withAll:" : "fn 12/22/2016 15:19" }, + "instance" : { + "allAttributes" : "fn 3/29/2017 23:36", + "allInstVarNames" : "fn 3/29/2017 23:37", + "asSmalltalk" : "fn 2/26/2017 21:04", + "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", + "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/29/2017 23:42", + "instVarNamed:" : "fn 3/29/2017 23:37", + "instVarNamesAndOffsetsDo:" : "fn 12/22/2016 23:58", + "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/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/PythonObject.class/properties.json b/repository/Python-Core.package/PythonObject.class/properties.json new file mode 100644 index 00000000..da309938 --- /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" : "ForeignLanguageObject", + "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/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/PythonProcess.class/instance/debuggerTitle..st b/repository/Python-Core.package/PythonProcess.class/instance/debuggerTitle..st new file mode 100644 index 00000000..cc4e8b87 --- /dev/null +++ b/repository/Python-Core.package/PythonProcess.class/instance/debuggerTitle..st @@ -0,0 +1,5 @@ +helpers +debuggerTitle: pyError + | error | + error := pyError asSmalltalk. + ^ error first, ': ', error second \ No newline at end of file diff --git a/repository/Python-Core.package/PythonProcess.class/instance/getForeignFrames..st b/repository/Python-Core.package/PythonProcess.class/instance/getForeignFrames..st new file mode 100644 index 00000000..de2cfb7e --- /dev/null +++ b/repository/Python-Core.package/PythonProcess.class/instance/getForeignFrames..st @@ -0,0 +1,10 @@ +helpers +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/Python-Core.package/PythonProcess.class/instance/primLastError.st b/repository/Python-Core.package/PythonProcess.class/instance/primLastError.st new file mode 100644 index 00000000..5f036a85 --- /dev/null +++ b/repository/Python-Core.package/PythonProcess.class/instance/primLastError.st @@ -0,0 +1,4 @@ +system primitives +primLastError + + ^ nil \ No newline at end of file diff --git a/repository/Python-Core.package/PythonProcess.class/instance/primResume.st b/repository/Python-Core.package/PythonProcess.class/instance/primResume.st new file mode 100644 index 00000000..22ebc7cf --- /dev/null +++ b/repository/Python-Core.package/PythonProcess.class/instance/primResume.st @@ -0,0 +1,4 @@ +system primitives +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/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/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-Core.package/PythonTheme.class/class/addButtons..st b/repository/Python-Core.package/PythonTheme.class/class/addButtons..st new file mode 100644 index 00000000..457311a9 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/addDialogs..st b/repository/Python-Core.package/PythonTheme.class/class/addDialogs..st new file mode 100644 index 00000000..9f20eda6 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/addFonts..st b/repository/Python-Core.package/PythonTheme.class/class/addFonts..st new file mode 100644 index 00000000..10b1accd --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/addMenusAndDockingBars..st b/repository/Python-Core.package/PythonTheme.class/class/addMenusAndDockingBars..st new file mode 100644 index 00000000..7e248501 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/addScrollables..st b/repository/Python-Core.package/PythonTheme.class/class/addScrollables..st new file mode 100644 index 00000000..d4e76e72 --- /dev/null +++ b/repository/Python-Core.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: 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/class/addSyntaxHighlighting..st b/repository/Python-Core.package/PythonTheme.class/class/addSyntaxHighlighting..st new file mode 100644 index 00000000..fae0387d --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/addToolColors..st b/repository/Python-Core.package/PythonTheme.class/class/addToolColors..st new file mode 100644 index 00000000..4f2a299c --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/addWindowColors..st b/repository/Python-Core.package/PythonTheme.class/class/addWindowColors..st new file mode 100644 index 00000000..a2546d93 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/argumentColor.st b/repository/Python-Core.package/PythonTheme.class/class/argumentColor.st new file mode 100644 index 00000000..d27e34d2 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/backgroundColor.st b/repository/Python-Core.package/PythonTheme.class/class/backgroundColor.st new file mode 100644 index 00000000..1816569b --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/backgroundForm.st b/repository/Python-Core.package/PythonTheme.class/class/backgroundForm.st new file mode 100644 index 00000000..c74e0cab --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/blue.st b/repository/Python-Core.package/PythonTheme.class/class/blue.st new file mode 100644 index 00000000..06beb404 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/builtinConstColor.st b/repository/Python-Core.package/PythonTheme.class/class/builtinConstColor.st new file mode 100644 index 00000000..b0e68d70 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/commentColor.st b/repository/Python-Core.package/PythonTheme.class/class/commentColor.st new file mode 100644 index 00000000..f9d496e9 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/create.st b/repository/Python-Core.package/PythonTheme.class/class/create.st new file mode 100644 index 00000000..4fa1a566 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/focusedLabelColor.st b/repository/Python-Core.package/PythonTheme.class/class/focusedLabelColor.st new file mode 100644 index 00000000..2d805d08 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/foregroundColor.st b/repository/Python-Core.package/PythonTheme.class/class/foregroundColor.st new file mode 100644 index 00000000..d47441d4 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/globalColor.st b/repository/Python-Core.package/PythonTheme.class/class/globalColor.st new file mode 100644 index 00000000..273d0edc --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/green.st b/repository/Python-Core.package/PythonTheme.class/class/green.st new file mode 100644 index 00000000..0e0f4d71 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/highlightColor.st b/repository/Python-Core.package/PythonTheme.class/class/highlightColor.st new file mode 100644 index 00000000..1470de49 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/initialize.st b/repository/Python-Core.package/PythonTheme.class/class/initialize.st new file mode 100644 index 00000000..7094e078 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/keywordColor.st b/repository/Python-Core.package/PythonTheme.class/class/keywordColor.st new file mode 100644 index 00000000..701ac7db --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/magenta.st b/repository/Python-Core.package/PythonTheme.class/class/magenta.st new file mode 100644 index 00000000..acf0463e --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/numberColor.st b/repository/Python-Core.package/PythonTheme.class/class/numberColor.st new file mode 100644 index 00000000..01455b39 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/orange.st b/repository/Python-Core.package/PythonTheme.class/class/orange.st new file mode 100644 index 00000000..fba82a04 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/red.st b/repository/Python-Core.package/PythonTheme.class/class/red.st new file mode 100644 index 00000000..5d595521 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/stringColor.st b/repository/Python-Core.package/PythonTheme.class/class/stringColor.st new file mode 100644 index 00000000..5607b46a --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/textColor.st b/repository/Python-Core.package/PythonTheme.class/class/textColor.st new file mode 100644 index 00000000..3b3c57d4 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/textSelectionColor.st b/repository/Python-Core.package/PythonTheme.class/class/textSelectionColor.st new file mode 100644 index 00000000..aad60f29 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/unfocusedLabelColor.st b/repository/Python-Core.package/PythonTheme.class/class/unfocusedLabelColor.st new file mode 100644 index 00000000..3f05d9a6 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/variableColor.st b/repository/Python-Core.package/PythonTheme.class/class/variableColor.st new file mode 100644 index 00000000..f360681d --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/windowColor.st b/repository/Python-Core.package/PythonTheme.class/class/windowColor.st new file mode 100644 index 00000000..244d2d1f --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/class/yellow.st b/repository/Python-Core.package/PythonTheme.class/class/yellow.st new file mode 100644 index 00000000..154f2107 --- /dev/null +++ b/repository/Python-Core.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-Core.package/PythonTheme.class/instance/stylerClass.st b/repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st new file mode 100644 index 00000000..9fac2f50 --- /dev/null +++ b/repository/Python-Core.package/PythonTheme.class/instance/stylerClass.st @@ -0,0 +1,3 @@ +as yet unclassified +stylerClass + ^ 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 new file mode 100644 index 00000000..9461731f --- /dev/null +++ b/repository/Python-Core.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 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", + "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 4/28/2017 16:08" } } diff --git a/repository/Python-Core.package/PythonTheme.class/properties.json b/repository/Python-Core.package/PythonTheme.class/properties.json new file mode 100644 index 00000000..a72b10dd --- /dev/null +++ b/repository/Python-Core.package/PythonTheme.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "Python-Core", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PythonTheme", + "pools" : [ + ], + "super" : "UserInterfaceTheme", + "type" : "normal" } 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-Core.package/ToolIcons.extension/methodProperties.json b/repository/Python-Core.package/ToolIcons.extension/methodProperties.json new file mode 100644 index 00000000..453949cd --- /dev/null +++ b/repository/Python-Core.package/ToolIcons.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + "Python" : "fn 3/14/2017 01:41" }, + "instance" : { + } } diff --git a/repository/Python-Core.package/ToolIcons.extension/properties.json b/repository/Python-Core.package/ToolIcons.extension/properties.json new file mode 100644 index 00000000..09fddafd --- /dev/null +++ b/repository/Python-Core.package/ToolIcons.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "ToolIcons" } 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..1760c3e6 --- /dev/null +++ b/repository/Python-Core.package/monticello.meta/version @@ -0,0 +1 @@ +(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/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-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/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..0a0c8ce0 --- /dev/null +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/instance/testScopeEndInStartingAt.st @@ -0,0 +1,20 @@ +as yet unclassified +testScopeEndInStartingAt + | d input | + d := Python. + 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..94b52f05 --- /dev/null +++ b/repository/Python-Tests.package/PythonDebuggerTest.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "testScopeEndInStartingAt" : "fn 3/16/2017 21:38" } } 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..1bef2237 --- /dev/null +++ b/repository/Python-Tests.package/monticello.meta/version @@ -0,0 +1 @@ +(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/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/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/debuggerPrintItem.on..st b/repository/Ruby-Core.package/Ruby.class/class/debuggerPrintItem.on..st new file mode 100644 index 00000000..cc4da1fa --- /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 := 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/eval..st b/repository/Ruby-Core.package/Ruby.class/class/eval..st new file mode 100644 index 00000000..b6241609 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/eval..st @@ -0,0 +1,3 @@ +execution +eval: aString + ^ self eval: aString filePath: '-e' \ 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 new file mode 100644 index 00000000..aa7f09d0 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/eval.filePath..st @@ -0,0 +1,3 @@ +execution +eval: aString filePath: aFilePath + ^ 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 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/evaluateExpression.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st new file mode 100644 index 00000000..1957bdcf --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.breakOnExceptions..st @@ -0,0 +1,3 @@ +execution +evaluateExpression: selection breakOnExceptions: aBool + ^ Ruby eval: selection asString breakOnExceptions: aBool \ No newline at end of file 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..a8bc710d --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/evaluateExpression.in.to..st @@ -0,0 +1,3 @@ +execution +evaluateExpression: aSelection in: aContext to: receiver + ^ receiver instance_eval: aSelection asString \ 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/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/getSource..st b/repository/Ruby-Core.package/Ruby.class/class/getSource..st new file mode 100644 index 00000000..2bbbc619 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/getSource..st @@ -0,0 +1,8 @@ +source code +getSource: rbFrame + | filename | + rbFrame has_contents asSmalltalk ifFalse: [ ^ 'no contents' ]. + filename := rbFrame get_filename asSmalltalk. + ^ (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/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/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/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/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/pcRange..st b/repository/Ruby-Core.package/Ruby.class/class/pcRange..st new file mode 100644 index 00000000..67fa6333 --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/pcRange..st @@ -0,0 +1,9 @@ +debugging +pcRange: rbFrame + | 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/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/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.filePath.breakOnExceptions..st b/repository/Ruby-Core.package/Ruby.class/class/primEval.filePath.breakOnExceptions..st new file mode 100644 index 00000000..e3aef03b --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/class/primEval.filePath.breakOnExceptions..st @@ -0,0 +1,4 @@ +system primitives +primEval: aString filePath: aFilePath breakOnExceptions: aBool + + 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/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/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/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/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/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..6252688d --- /dev/null +++ b/repository/Ruby-Core.package/Ruby.class/methodProperties.json @@ -0,0 +1,30 @@ +{ + "class" : { + "debuggerPrintItem:on:" : "fn 4/2/2017 19:58", + "eval:" : "fn 3/16/2017 13:41", + "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", + "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", + "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", + "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", + "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", + "tempVariableAt:in:" : "fn 3/16/2017 22:44", + "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/defaultLabelForInspector.st b/repository/Ruby-Core.package/RubyObject.class/instance/defaultLabelForInspector.st new file mode 100644 index 00000000..2196b192 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/defaultLabelForInspector.st @@ -0,0 +1,3 @@ +overrides +defaultLabelForInspector + ^ 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/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/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/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/instance/printOn..st b/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st new file mode 100644 index 00000000..692bef45 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/instance/printOn..st @@ -0,0 +1,3 @@ +overrides +printOn: aStream + aStream nextPutAll: 'Ruby ', 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..2036b300 --- /dev/null +++ b/repository/Ruby-Core.package/RubyObject.class/methodProperties.json @@ -0,0 +1,17 @@ +{ + "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", + "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/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/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/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/RubyProcess.class/instance/debuggerTitle..st b/repository/Ruby-Core.package/RubyProcess.class/instance/debuggerTitle..st new file mode 100644 index 00000000..14228fdd --- /dev/null +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/debuggerTitle..st @@ -0,0 +1,3 @@ +helpers +debuggerTitle: rbError + ^ rbError class asString, ': ', rbError asString \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyProcess.class/instance/getForeignFrames..st b/repository/Ruby-Core.package/RubyProcess.class/instance/getForeignFrames..st new file mode 100644 index 00000000..ae1be222 --- /dev/null +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/getForeignFrames..st @@ -0,0 +1,10 @@ +helpers +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/RubyProcess.class/instance/primLastError.st b/repository/Ruby-Core.package/RubyProcess.class/instance/primLastError.st new file mode 100644 index 00000000..98ccca06 --- /dev/null +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/primLastError.st @@ -0,0 +1,4 @@ +system primitives +primLastError + + ^ nil \ No newline at end of file diff --git a/repository/Ruby-Core.package/RubyProcess.class/instance/primResume.st b/repository/Ruby-Core.package/RubyProcess.class/instance/primResume.st new file mode 100644 index 00000000..17831ac0 --- /dev/null +++ b/repository/Ruby-Core.package/RubyProcess.class/instance/primResume.st @@ -0,0 +1,4 @@ +system primitives +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/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/Ruby-Core.package/ToolIcons.extension/methodProperties.json b/repository/Ruby-Core.package/ToolIcons.extension/methodProperties.json new file mode 100644 index 00000000..3591f2b7 --- /dev/null +++ b/repository/Ruby-Core.package/ToolIcons.extension/methodProperties.json @@ -0,0 +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..6cdb9403 --- /dev/null +++ b/repository/Ruby-Core.package/monticello.meta/version @@ -0,0 +1 @@ +(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 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 @@ +{ + } diff --git a/rsqueakvm/interpreter.py b/rsqueakvm/interpreter.py index 2bb95ad2..42929f0c 100644 --- a/rsqueakvm/interpreter.py +++ b/rsqueakvm/interpreter.py @@ -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/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/numeric.py b/rsqueakvm/model/numeric.py index 6c110212..bb0b8ccb 100644 --- a/rsqueakvm/model/numeric.py +++ b/rsqueakvm/model/numeric.py @@ -219,7 +219,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: @@ -250,7 +250,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: @@ -315,7 +315,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) @@ -408,7 +408,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/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/model/variable.py b/rsqueakvm/model/variable.py index 05fa1ae9..d682f4b0 100644 --- a/rsqueakvm/model/variable.py +++ b/rsqueakvm/model/variable.py @@ -148,7 +148,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._bytes(), 'little', False) + return rbigint.frombytes(''.join(self._bytes()), 'little', False) def selector_string(self): return "#" + self.unwrap_string(None) diff --git a/rsqueakvm/objspace.py b/rsqueakvm/objspace.py index eda79788..f83de4c3 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/foreign_language/__init__.py b/rsqueakvm/plugins/foreign_language/__init__.py new file mode 100644 index 00000000..6d7b81d5 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/__init__.py @@ -0,0 +1,140 @@ +from rsqueakvm.error import PrimitiveFailedError +from rsqueakvm.model.variable import W_BytesObject +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): + process_cls.load_special_objects(process_cls, language_name, space) + shadow_cls.load_special_objects(shadow_cls, language_name, space) + + # Abstract methods + + def is_operational(self): + raise NotImplementedError + + @staticmethod + def new_eval_process(space, args_w): + raise NotImplementedError + + @staticmethod + def new_send_process(space, w_rcvr, method_name, args_w, + break_on_exceptions): + raise NotImplementedError + + @staticmethod + def w_object_class(): + raise NotImplementedError + + @staticmethod + 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): + @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_process = self.new_eval_process(interp.space, args_w) + # when we are here, the foreign language process has yielded + 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], + result_is_new_frame=True) + def resume(interp, s_frame, 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(): + 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, + 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) + return frame + + @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() + if w_error is None: + print 'w_error was None in lastError' + raise PrimitiveFailedError + return w_error + + @self.expose_primitive(unwrap_spec=[object]) + def topFrame(interp, s_frame, language_process): + if not isinstance(language_process, W_ForeignLanguageProcess): + raise PrimitiveFailedError + 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): + if not isinstance(w_rcvr, self.w_object_class()): + 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): + 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/foreign_language/model.py b/rsqueakvm/plugins/foreign_language/model.py new file mode 100644 index 00000000..4ca3d309 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/model.py @@ -0,0 +1,180 @@ +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.primitives.constants import EXTERNAL_CALL +from rsqueakvm.storage_classes import AbstractCachingShadow, ClassShadow +from rsqueakvm.util.cells import QuasiConstant + +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() + 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) + + +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_ = ['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): + 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 + + def trace_pointers(self, space): + "allInstances not supported" + return [] + + def getclass(self, space): + 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 initialize_w_class(self): + raise NotImplementedError + + 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): + # 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_ = ['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): + 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: + 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: + print '%sObject class not found.' % language_name + cls.w_foreign_object_class.set(foreign_object_class) + + # Overrides + + 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 + 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 + 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, method_name): + 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) + 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/process.py b/rsqueakvm/plugins/foreign_language/process.py new file mode 100644 index 00000000..c7ccc712 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/process.py @@ -0,0 +1,266 @@ +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) +from rsqueakvm.model.pointers import W_PointersObject +from rsqueakvm.util.cells import QuasiConstant + +from rpython.rlib import objectmodel + + +class ForeignLanguageProcessMeta(type): + def __new__(cls, name, bases, attrs): + # import pdb; pdb.set_trace() + + if name != 'W_ForeignLanguageProcess': + w_foreign_process_class = QuasiConstant(None, cls=W_PointersObject) + + def foreign_process_class(self): + return w_foreign_process_class.get() + + attrs['w_foreign_process_class'] = w_foreign_process_class + attrs['foreign_process_class'] = foreign_process_class + + return type.__new__(cls, name, bases, attrs) + + +class W_ForeignLanguageProcess(W_AbstractObjectWithIdentityHash): + __metaclass__ = ForeignLanguageProcessMeta + _attrs_ = [ + '_runner', '_done', 'w_result', 'w_error', + '_space', 'w_rcvr', 'method_name', 'args_w', + '_is_send', '_break_on_exceptions'] + repr_classname = 'W_ForeignLanguageProcess' + + 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 + self.args_w = args_w or [] + self._done = False + self.w_result = 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: + self._runner = runner.GreenletLanguageRunner(self) + + def space(self): + return self._space + + @staticmethod + def load_special_objects(cls, language_name, space): + 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_process_class.set(language_process_class) + + # this part is called twice -> make better + foreign_class = space.smalltalk_at('ForeignLanguageProcess') + + if foreign_class is None: + print 'ForeignLanguage class not found.' + return + + 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 'ForeignLanguageProcess>>vmEval method not found.' + W_ForeignLanguageProcess.eval_method.set(eval_method) + + resume_method_symbol = space.wrap_symbol('vmResume') + resume_method = language_process_class_s.lookup( + resume_method_symbol) + if resume_method is None: + print 'ForeignLanguageProcess>>vmResume: method not found.' + W_ForeignLanguageProcess.resume_method.set(resume_method) + + # 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 self.foreign_process_class() + + # Abstract methods + + def eval(self): + raise NotImplementedError + + def send(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 + + # Helpers + + def safe_run(self): + try: + 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 == ''): + 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 resume(self): + if self.is_done(): + # import pdb; pdb.set_trace() + print 'The runner is done and cannot be resumed' + return + self.runner().resume() + + def error_detected(self): + if not self.break_on_exceptions(): + return False # pretend everything is ok and move on + return self.get_error() is not None + + def runner(self): + return self._runner + + 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 + + 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 + + def break_on_exceptions(self): + return self._break_on_exceptions + + # Switching + + 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) + + # 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.get(): + s_resume_frame = self._build_resume_method(interp.space) + eval_frame = s_frame.s_sender() + # Ensure #resume: method with closure = nil + 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(eval_frame) + else: + 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 = 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) + + def _create_return_frame(self, space): + from rsqueakvm.storage_contexts import ContextPartShadow + 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. + # 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.foreign_process_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/runner.py b/rsqueakvm/plugins/foreign_language/runner.py new file mode 100644 index 00000000..50376e58 --- /dev/null +++ b/rsqueakvm/plugins/foreign_language/runner.py @@ -0,0 +1,119 @@ +from rsqueakvm.plugins.foreign_language.utils import log + +from rpython.rlib.rstacklet import StackletThread + + +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 resume(self): + log('Resuming %s...' % self.language_process()) + self.language_process().pre_resume() + self._resume_thread() + + def return_to_smalltalk(self): + self._yield_thread() + + def resumable(self): + raise NotImplementedError + + def _resume_thread(self): + raise NotImplementedError + + def _yield_thread(self): + raise NotImplementedError + + +class StackletLanguageRunner(AbstractLanguageRunner): + sthread = None + + 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.new(self.__class__.new_stacklet_callback) + + 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 _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(): + log('language_process thread has finished (handle is null)') + if self.sthread.is_empty_handle(self.handle): + log('language_process thread has finished (handle is empty)') + + 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): + log('new_stacklet_callback: %s' % h) + 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 __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()) + + def resumable(self): + return not self.greenlet.dead + + def _resume_thread(self): + self.greenlet.switch() + + 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_process().safe_run + + +class GlobalState: + def clear(self): + self.origin = None +global_execution_state = GlobalState() +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/plugin.py b/rsqueakvm/plugins/plugin.py index c523b5b6..5a7d068d 100644 --- a/rsqueakvm/plugins/plugin.py +++ b/rsqueakvm/plugins/plugin.py @@ -65,6 +65,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 f9855c2f..6bf12048 100644 --- a/rsqueakvm/plugins/profiler_plugin.py +++ b/rsqueakvm/plugins/profiler_plugin.py @@ -8,163 +8,146 @@ VM_CLEAR_PROFILE, VM_DUMP_PROFILE, VM_START_PROFILING, VM_STOP_PROFILING) from rsqueakvm.util import system -from rpython.rlib import jit - - -from rpython.rlib import rvmprof +from rpython.rlib import rvmprof, jit from rpython.rlib.rjitlog import rjitlog -class ProfilerPlugin(Plugin): - pass +def patch_interpreter(): + from rsqueakvm.interpreter import Interpreter -plugin = ProfilerPlugin() + 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) + Interpreter.stack_frame = _my_stack_frame + print "Interpreter was patched for vmprof" -if plugin.is_enabled(): - from rpython.rlib import rvmprof - from rpython.rlib.rjitlog import rjitlog - - -# ____________________________________________________________ - def patch(self): - patch_interpreter() - patch_compiled_method() +def _safe(s): + if len(s) > 200: + s = s[:197] + '...' + return s.replace(':', ';') - ProfilerPlugin.patch = patch - 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) - _my_stack_frame = _decorator(Interpreter.stack_frame) - Interpreter.stack_frame = _my_stack_frame - print "Interpreter was patched for vmprof" +def _get_full_name(w_cm): + # must not be longer than 255 chars + return "st:%s:0:/img" % _safe(w_cm.safe_identifier_string()) - def _safe(s): - if len(s) > 200: - s = s[:197] + '...' - return s.replace(':', ';') +def patch_compiled_method(): + def _my_post_init(self): + rvmprof.register_code(self, _get_full_name) + W_CompiledMethod.post_init = _my_post_init +# ____________________________________________________________ - def _get_full_name(w_cm): - # must not be longer than 255 chars - return "st:%s:0:/img" % _safe(w_cm.safe_identifier_string()) - if plugin.is_enabled(): - try: - rvmprof.register_code_object_class(W_CompiledMethod, _get_full_name) - except rvmprof.VMProfPlatformUnsupported: - pass +class ProfilerPlugin(Plugin): + def is_optional(self): + return True - 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 - -# ____________________________________________________________ + def setup(self): + rvmprof.register_code_object_class(W_CompiledMethod, _get_full_name) + def patch(self): + patch_interpreter() + patch_compiled_method() - @plugin.expose_primitive(unwrap_spec=[object, int, float]) - @jit.dont_look_inside - def enableProfiler(interp, s_frame, w_rcvr, fileno, period): - try: - rvmprof.enable(fileno, period) - except rvmprof.VMProfError as e: - print e.msg - raise PrimitiveFailedError - return w_rcvr +plugin = ProfilerPlugin() - @plugin.expose_primitive(unwrap_spec=[object]) - @jit.dont_look_inside - def disableProfiler(interp, s_frame, w_rcvr): +@plugin.expose_primitive(unwrap_spec=[object, int, float]) +@jit.dont_look_inside +def enableProfiler(interp, s_frame, w_rcvr, fileno, period): + try: + rvmprof.enable(fileno, period) + except rvmprof.VMProfError as e: + print e.msg + raise PrimitiveFailedError + return w_rcvr + + +@plugin.expose_primitive(unwrap_spec=[object]) +@jit.dont_look_inside +def disableProfiler(interp, s_frame, w_rcvr): + try: + rvmprof.disable() + except rvmprof.VMProfError as e: + print e.msg + raise PrimitiveFailedError + return w_rcvr + + +@plugin.expose_primitive(unwrap_spec=[object, int]) +@jit.dont_look_inside +def enableJitlog(interp, s_frame, w_rcvr, fileno): + try: + rjitlog.enable_jitlog(fileno) + except rjitlog.JitlogError as e: + print e.msg + raise PrimitiveFailedError + return w_rcvr + + +@plugin.expose_primitive(unwrap_spec=[object]) +@jit.dont_look_inside +def disableJitlog(interp, s_frame, w_rcvr): + rjitlog.disable_jitlog() + return w_rcvr + + +O_BINARY = 0 +if system.IS_WINDOWS: + O_BINARY = os.O_BINARY +class LogFile(object): + _attrs_ = ["fd"] + def __init__(self): self.fd = -1 + def fileno(self): return self.fd + def isopen(self): return self.fd > 0 + def open(self, name): + self.fd = os.open(name, os.O_RDWR | os.O_CREAT | O_BINARY, 0666) + def close(self): + if not self.isopen(): return + os.close(self.fd) + self.fd = -1 +jitlogfile = LogFile() +vmproflogfile = LogFile() + + +@expose_also_as(VM_DUMP_PROFILE, VM_CLEAR_PROFILE) +@expose_primitive(VM_STOP_PROFILING, unwrap_spec=[object]) +@jit.dont_look_inside +def func(interp, s_frame, w_rcvr): + from rsqueakvm.plugins.profiler_plugin import vmproflogfile, jitlogfile + if vmproflogfile.isopen(): try: rvmprof.disable() except rvmprof.VMProfError as e: - print e.msg - raise PrimitiveFailedError - return w_rcvr - - - @plugin.expose_primitive(unwrap_spec=[object, int]) - @jit.dont_look_inside - def enableJitlog(interp, s_frame, w_rcvr, fileno): + print "Failure disabling vmprof: %s" % e.msg + if jitlogfile.isopen(): + rjitlog.disable_jitlog() + vmproflogfile.close() + jitlogfile.close() + return w_rcvr + +DEFAULT_PERIOD = 0.001 +@expose_primitive(VM_START_PROFILING, unwrap_spec=[object]) +@jit.dont_look_inside +def func(interp, s_frame, w_rcvr): + from rsqueakvm.plugins.profiler_plugin import vmproflogfile, jitlogfile + if not vmproflogfile.isopen(): + vmproflogfile.open("SqueakProfile") try: - rjitlog.enable_jitlog(fileno) - except rjitlog.JitlogError as e: - print e.msg - raise PrimitiveFailedError - return w_rcvr - - - @plugin.expose_primitive(unwrap_spec=[object]) - @jit.dont_look_inside - def disableJitlog(interp, s_frame, w_rcvr): + rvmprof.enable(vmproflogfile.fileno(), DEFAULT_PERIOD) + except rvmprof.VMProfError as e: + print "Failed to start vmprof: %s" % e.msg + vmproflogfile.close() + if not jitlogfile.isopen(): + jitlogfile.open("SqueakProfile.jitlog") try: - rjitlog.disable_jitlog() + rjitlog.enable_jitlog(jitlogfile.fileno()) except rjitlog.JitlogError as e: - print e.msg - raise PrimitiveFailedError - return w_rcvr - - - O_BINARY = 0 - if system.IS_WINDOWS: - O_BINARY = os.O_BINARY - class LogFile(object): - _attrs_ = ["fd"] - def __init__(self): self.fd = -1 - def fileno(self): return self.fd - def isopen(self): return self.fd > 0 - def open(self, name): - self.fd = os.open(name, os.O_RDWR | os.O_CREAT | O_BINARY, 0666) - def close(self): - if not self.isopen(): return - os.close(self.fd) - self.fd = -1 - jitlogfile = LogFile() - vmproflogfile = LogFile() - - - @expose_also_as(VM_DUMP_PROFILE, VM_CLEAR_PROFILE) - @expose_primitive(VM_STOP_PROFILING, unwrap_spec=[object]) - @jit.dont_look_inside - def func(interp, s_frame, w_rcvr): - from rsqueakvm.plugins.profiler_plugin import vmproflogfile, jitlogfile - if vmproflogfile.isopen(): - try: - rvmprof.disable() - except rvmprof.VMProfError as e: - print "Failure disabling vmprof: %s" % e.msg - if jitlogfile.isopen(): - rjitlog.disable_jitlog() - vmproflogfile.close() - jitlogfile.close() - return w_rcvr - - DEFAULT_PERIOD = 0.001 - @expose_primitive(VM_START_PROFILING, unwrap_spec=[object]) - @jit.dont_look_inside - def func(interp, s_frame, w_rcvr): - from rsqueakvm.plugins.profiler_plugin import vmproflogfile, jitlogfile - if not vmproflogfile.isopen(): - vmproflogfile.open("SqueakProfile") - try: - rvmprof.enable(vmproflogfile.fileno(), DEFAULT_PERIOD) - except rvmprof.VMProfError as e: - print "Failed to start vmprof: %s" % e.msg - vmproflogfile.close() - if not jitlogfile.isopen(): - jitlogfile.open("SqueakProfile.jitlog") - try: - rjitlog.enable_jitlog(jitlogfile.fileno()) - except rjitlog.JitlogError as e: - print "Failed to start jitlog: %s" % e.msg - jitlogfile.close() - return w_rcvr + print "Failed to start jitlog: %s" % e.msg + jitlogfile.close() + return w_rcvr diff --git a/rsqueakvm/plugins/python/__init__.py b/rsqueakvm/plugins/python/__init__.py new file mode 100644 index 00000000..3585dacf --- /dev/null +++ b/rsqueakvm/plugins/python/__init__.py @@ -0,0 +1,121 @@ +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 + +try: + from rsqueakvm.plugins.python import utils + from rsqueakvm.plugins.python.model import ( + W_PythonObject, PythonClassShadow) + 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 + + 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 Exception as e: + print e + IMPORT_FAILED = True + + +class PythonPlugin(ForeignLanguagePlugin): + language_name = 'Python' + + py_frame_restart_info = Cell(None, type=PyFrameRestartInfo) + + def is_optional(self): + return True + + def is_enabled(self): + if IMPORT_FAILED: + return False + return ForeignLanguagePlugin.is_enabled(self) + + def is_operational(self): + return (W_PythonProcess.w_foreign_process_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) + patch_pypy() + + @staticmethod + def startup(space, argv): + ForeignLanguagePlugin.load_special_objects( + space, PythonPlugin.language_name, + W_PythonProcess, PythonClassShadow) + initialize_py_space(space, argv) + py_space.startup() + + @staticmethod + def new_eval_process(space, args_w): + if len(args_w) != 4: + raise PrimitiveFailedError + 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_PythonProcess( + space, source=source, filename=filename, cmd=cmd, + break_on_exceptions=break_on_exceptions) + + @staticmethod + 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, + break_on_exceptions=break_on_exceptions) + + @staticmethod + def w_object_class(): + return W_PythonObject + + @staticmethod + def to_w_object(space, foreign_object): + return utils.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)) + + @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/model.py b/rsqueakvm/plugins/python/model.py new file mode 100644 index 00000000..04e26328 --- /dev/null +++ b/rsqueakvm/plugins/python/model.py @@ -0,0 +1,55 @@ +from rsqueakvm.plugins.foreign_language.model import ( + W_ForeignLanguageObject, ForeignLanguageClassShadow) +from rsqueakvm.plugins.python.objspace import py_space + +from pypy.interpreter.error import OperationError + + +class W_PythonObject(W_ForeignLanguageObject): + _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 + + 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) + + 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.wp_object) + + +class PythonClassShadow(ForeignLanguageClassShadow): + _attrs_ = ['wp_object'] + _immutable_fields_ = ['wp_object'] + + def __init__(self, space, wp_object): + self.wp_object = wp_object + ForeignLanguageClassShadow.__init__(self, space) + + def method_exists(self, method_name): + # import pdb; pdb.set_trace() + wp_method_name = py_space.newtext(method_name) + try: + 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' % (method_name, e) + return False diff --git a/rsqueakvm/plugins/python/objspace.py b/rsqueakvm/plugins/python/objspace.py new file mode 100644 index 00000000..720bab4d --- /dev/null +++ b/rsqueakvm/plugins/python/objspace.py @@ -0,0 +1,103 @@ +import os +import sys + +from rsqueakvm.plugins.python.switching import SwitchToSmalltalkAction +from rsqueakvm.util import system + + +def new_pypy_objspace(): + # 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, set_pypy_opt_level + translating = sys.argv[0] == '.build/build.py' # make better + pypy_config = get_pypy_config(translating=translating) + + # 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 + + # 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) + + # 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._continuation = True + pypy_config.objspace.usemodules.thread = True + + # 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: + 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) + + +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') + 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.newtext('path')) + py_space.call_method(w_sys_path, 'append', py_space.newtext('.')) + + # 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(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() +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 new file mode 100644 index 00000000..9650e51d --- /dev/null +++ b/rsqueakvm/plugins/python/patching.py @@ -0,0 +1,193 @@ +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 +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 + +opcodedesc = bytecode_spec.opcodedesc + +old_init_frame = PyFrame.__init__ +old_execute_frame = PyFrame.execute_frame +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'] + + +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 + + +def new_execute_frame(self, w_inputvalue=None, operr=None): + try: + return old_execute_frame(self, w_inputvalue, operr) + except RestartException as e: + frame = e.py_frame_restart_info.frame + if frame is not None and frame is not self: + raise RestartException(e.py_frame_restart_info) + # Generate and execute new frame + 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) + + +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 + 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 + elif current_opcode != opcodedesc.DUP_TOP.index: + 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]) + if next_opcode == opcodedesc.LOAD_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 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: + # 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 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): + "Returns True if this frame or one of its parents are able to handle operr" + 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: + 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 & SApplicationException.kind) != 0 and + frame.block_handles_exception(block, operr.w_type)): + 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, RestartException): + print 'Re-raising RestartException' + raise operr + 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() + 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) + + +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 + self.co_source = None + old_init_pycode(self, space, argcount, nlocals, stacksize, flags, + code, consts, names, varnames, filename, + name, firstlineno, lnotab, freevars, cellvars, + hidden_applevel, magic) + + +def new_getexecutioncontext(self): + current_python_process = self.current_python_process.get() + if current_python_process is not None: + return current_python_process.ec + 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: + # TODO: what if first delattr fails? + delattr(PyFrame, '_virtualizable_') + delattr(PyPyJitDriver, 'virtualizables') + 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 + PyFrame.has_exception_handler = has_exception_handler + PyFrame.handle_operation_error = new_handle_operation_error + + PyCode.__init__ = __init__pycode + PyCode._immutable_fields_.extend(['_co_names[*]', 'co_source']) + + # 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/python/process.py b/rsqueakvm/plugins/python/process.py new file mode 100644 index 00000000..8804d771 --- /dev/null +++ b/rsqueakvm/plugins/python/process.py @@ -0,0 +1,86 @@ +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 import utils + +from pypy.interpreter.argument import Arguments +from pypy.interpreter.error import OperationError + + +class W_PythonProcess(W_ForeignLanguageProcess): + _attrs_ = ['source', 'filename', 'cmd', 'ec'] + repr_classname = 'W_PythonProcess' + + 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 + 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 == '': + return self.fail('Invalid Python eval') + try: + 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(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: + 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)) + + 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 + topframe = self.ec.gettopframe() + if topframe is None: + return None + return W_PythonObject(topframe) + + def guess_classname(self): + return self.repr_classname + + def str_content(self): + return '%s: "%s"' % (self.cmd, self.source) diff --git a/rsqueakvm/plugins/python/switching.py b/rsqueakvm/plugins/python/switching.py new file mode 100644 index 00000000..70eaf51f --- /dev/null +++ b/rsqueakvm/plugins/python/switching.py @@ -0,0 +1,53 @@ +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 PythonPlugin + + # 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' + runner.return_to_smalltalk() + # print 'Python continue' + + # operror has been in Smalltalk land, clear it now to allow resuming + process.reset_error() + + # handle py_frame_restart_info if set + restart_info = PythonPlugin.py_frame_restart_info.get() + if restart_info is not None: + PythonPlugin.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 new file mode 100644 index 00000000..6f81abe2 --- /dev/null +++ b/rsqueakvm/plugins/python/utils.py @@ -0,0 +1,156 @@ +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 + +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 +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_AbstractTupleObject as WP_AbstractTupleObject) +from pypy.objspace.std.unicodeobject import W_UnicodeObject as WP_UnicodeObject + +from rpython.rlib import objectmodel + + +def _run_eval_string(source, filename, cmd): + # Adopted from PyPy's main.py + try: + ws = py_space.newtext + + pycode = compilecode(py_space, source, filename or '', cmd) + + mainmodule = ensure__main__(py_space) + 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) + if filename is not None: + py_space.setitem(w_globals, ws('__file__'), ws(filename)) + + retval = pycode.exec_code(py_space, w_globals, w_globals) + if eval: + return retval + else: + return + + except OperationError as operationerr: + operationerr.record_interpreter_traceback() + raise + + +@objectmodel.specialize.argtype(0) +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) 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( + [python_to_smalltalk(space, x) for x in wp_object.getitems()]) + 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 py_space.w_None: + return space.w_nil + elif isinstance(wp_object, WP_IntObject): + # WP_BoolObject inherits from WP_IntObject + if wp_object is py_space.w_False: + return space.w_false + 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 + return space.w_nil + + +@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 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): + 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.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 + + +def get_restart_pycode(source, filename='', cmd='exec'): + log('Trying to patch:\n%s' % source) + try: + py_code = py_compiling.compile(py_space, py_space.newtext(source), + filename, cmd) + 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) + if co_consts_w_len >= 1: + if co_consts_w_len > 1: + 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): + log('First const is not a PyCode') + return py_code + return first_consts_w + except OperationError as e: + # import pdb; pdb.set_trace() + print 'Failed to compile new frame: %s' % e.errorstr(py_space) + + +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 W_PythonObject(py_space.newtuple([wp_exception, wp_value])) + + +def entry_point(argv): + from rsqueakvm.main import safe_entry_point + 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, filename, 'exec') + return 0 + return safe_entry_point(argv) diff --git a/rsqueakvm/plugins/python_plugin.py b/rsqueakvm/plugins/python_plugin.py new file mode 100644 index 00000000..27fd6d8c --- /dev/null +++ b/rsqueakvm/plugins/python_plugin.py @@ -0,0 +1,3 @@ +from rsqueakvm.plugins.python import PythonPlugin + +plugin = PythonPlugin() diff --git a/rsqueakvm/plugins/ruby/__init__.py b/rsqueakvm/plugins/ruby/__init__.py new file mode 100644 index 00000000..b8cbfe83 --- /dev/null +++ b/rsqueakvm/plugins/ruby/__init__.py @@ -0,0 +1,87 @@ +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: + from rsqueakvm.plugins.ruby import utils + 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 + + 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 Exception as e: + print e + IMPORT_FAILED = True + + +class RubyPlugin(ForeignLanguagePlugin): + language_name = 'Ruby' + + def is_optional(self): + return True + + def is_enabled(self): + if IMPORT_FAILED: + return False + return ForeignLanguagePlugin.is_enabled(self) + + def is_operational(self): + return (W_RubyProcess.w_foreign_process_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) + patch_topaz() + + @staticmethod + 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): + 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(source_w) + filepath = space.unwrap_string(filepath_w) + break_on_exceptions = args_w[2] is space.w_true + return W_RubyProcess( + space, source=source, filepath=filepath, + break_on_exceptions=break_on_exceptions) + + @staticmethod + 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, break_on_exceptions=break_on_exceptions) + + @staticmethod + def w_object_class(): + return W_RubyObject + + @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 diff --git a/rsqueakvm/plugins/ruby/frame.py b/rsqueakvm/plugins/ruby/frame.py new file mode 100644 index 00000000..dc7cba0f --- /dev/null +++ b/rsqueakvm/plugins/ruby/frame.py @@ -0,0 +1,50 @@ +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('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() + 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_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): + 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/model.py b/rsqueakvm/plugins/ruby/model.py new file mode 100644 index 00000000..99063d91 --- /dev/null +++ b/rsqueakvm/plugins/ruby/model.py @@ -0,0 +1,45 @@ +from rsqueakvm.plugins.foreign_language.model import ( + W_ForeignLanguageObject, ForeignLanguageClassShadow) +from rsqueakvm.plugins.ruby.objspace import ruby_space + + +class W_RubyObject(W_ForeignLanguageObject): + _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 + + 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 + + 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()) + + +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 + ForeignLanguageClassShadow.__init__(self, space) + + def method_exists(self, method_name): + return self.wr_class.find_method(ruby_space, method_name) is not None diff --git a/rsqueakvm/plugins/ruby/objspace.py b/rsqueakvm/plugins/ruby/objspace.py new file mode 100644 index 00000000..af32e29d --- /dev/null +++ b/rsqueakvm/plugins/ruby/objspace.py @@ -0,0 +1,16 @@ +import sys + +from topaz.main import get_topaz_config_options +from topaz.objspace import ObjectSpace + +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() diff --git a/rsqueakvm/plugins/ruby/patching.py b/rsqueakvm/plugins/ruby/patching.py new file mode 100644 index 00000000..6292aeb8 --- /dev/null +++ b/rsqueakvm/plugins/ruby/patching.py @@ -0,0 +1,122 @@ +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 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 + +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 + + +def base_frame_get_code_source(self): + raise NotImplementedError + + +def frame_get_code_source(self): + return self.bytecode.source + + +def builtin_frame_get_code_source(self): + return self.name + + +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 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 + 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 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) + + +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(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) + + +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 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: + return current_ruby_process.ec + return old_getexecutioncontext(self) + + +def patch_topaz(): + # Patch-out virtualizables from Topaz so that translation works + try: + delattr(topaz_frame.Frame, "_virtualizable_") + delattr(TopazInterpreter.jitdriver, "virtualizables") + except AttributeError: + pass # this is fine + + 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/process.py b/rsqueakvm/plugins/ruby/process.py new file mode 100644 index 00000000..5a287710 --- /dev/null +++ b/rsqueakvm/plugins/ruby/process.py @@ -0,0 +1,70 @@ +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, print_traceback +from topaz.executioncontext import ExecutionContext + + +class W_RubyProcess(W_ForeignLanguageProcess): + _attrs_ = ['source', 'filepath', 'ec'] + repr_classname = 'W_RubyProcess' + + 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 + self.filepath = filepath + self.ec = ExecutionContext() + self.init_runner() + + def eval(self): + if self.source == '': + return self.fail('Invalid Ruby eval') + try: + retval = ruby_space.execute(self.source, filepath=self.filepath) + self.set_result(W_RubyObject(retval)) + except RubyError as e: + self.set_result(W_RubyObject(e.w_value)) + + def send(self): + 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) + self.set_result(W_RubyObject(wr_result)) + except RubyError as e: + print_traceback(ruby_space, 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( + '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) + + 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 + topframe = self.ec.gettoprubyframe() + if topframe is None: + return None + return W_RubyObject(WR_FrameObject(topframe)) + + def guess_classname(self): + return self.repr_classname diff --git a/rsqueakvm/plugins/ruby/switching.py b/rsqueakvm/plugins/ruby/switching.py new file mode 100644 index 00000000..ebabd0c6 --- /dev/null +++ b/rsqueakvm/plugins/ruby/switching.py @@ -0,0 +1,55 @@ +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.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.get() + 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() diff --git a/rsqueakvm/plugins/ruby/utils.py b/rsqueakvm/plugins/ruby/utils.py new file mode 100644 index 00000000..bc55279e --- /dev/null +++ b/rsqueakvm/plugins/ruby/utils.py @@ -0,0 +1,61 @@ +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 +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 +from topaz.objects.symbolobject import W_SymbolObject as WR_SymbolObject + +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)) + 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 wr_object is ruby_space.w_nil: + return space.w_nil + elif wr_object is ruby_space.w_false: + return space.w_false + 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)) + 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 + return space.w_nil + + +@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 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): + 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 + return ruby_space.w_nil diff --git a/rsqueakvm/plugins/ruby_plugin.py b/rsqueakvm/plugins/ruby_plugin.py index f5fe6e8b..d65f973d 100644 --- a/rsqueakvm/plugins/ruby_plugin.py +++ b/rsqueakvm/plugins/ruby_plugin.py @@ -1,223 +1,3 @@ -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 - -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 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, cls=W_AbstractObjectWithIdentityHash) - self.w_ruby_plugin_send = QuasiConstant(None, cls=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) +from rsqueakvm.plugins.ruby import RubyPlugin 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(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): - 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: - raise PrimitiveFailedError - 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)) - except RubyError as e: - print_traceback(ruby_space, e.w_value) - raise PrimitiveFailedError diff --git a/rsqueakvm/plugins/tailcall_plugin.py b/rsqueakvm/plugins/tailcall_plugin.py index 13d52f97..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, may_context_switch=True): + 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(): 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): diff --git a/rsqueakvm/squeakimage.py b/rsqueakvm/squeakimage.py index 6496e75c..c43d1124 100644 --- a/rsqueakvm/squeakimage.py +++ b/rsqueakvm/squeakimage.py @@ -371,7 +371,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/test/plugins/python/test_end_to_end.py b/rsqueakvm/test/plugins/python/test_end_to_end.py new file mode 100644 index 00000000..52ee1b7d --- /dev/null +++ b/rsqueakvm/test/plugins/python/test_end_to_end.py @@ -0,0 +1,93 @@ +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 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.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() + PythonPlugin.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 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 + + +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 new file mode 100644 index 00000000..0137d150 --- /dev/null +++ b/rsqueakvm/test/plugins/python/test_pyframe_exceptions.py @@ -0,0 +1,159 @@ +from rsqueakvm.plugins.python.objspace 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 has_exception_handler(code): + 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, + py_space.getexecutioncontext()) + except OperationError as operr: + 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) + try: + py_frame.run() + return True + except: + return False + + +def test_simple_exception(): + assert has_exception_handler(""" +try: + 1/0 +except ZeroDivisionError: + pass +""") + + +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""") + + +def test_raised_exception(): + assert has_exception_handler(""" +try: + raise Exception +except Exception: + pass +""") + + +def test_multiple_exceptions(): + assert has_exception_handler(""" +try: + list()[1] +except (ValueError, IndexError) as e: + pass +""") + + +def test_multiple_exceptions_fail(): + assert not has_exception_handler(""" +try: + list()[1] +except (ValueError, ZeroDivisionError): + pass +""") + + +def test_catch_all_exceptions(): + assert has_exception_handler(""" +try: + 1/0 +except: + pass +""") + + +def test_catch_variable_exception(): + assert has_exception_handler(""" +ex = IndexError +if True: + ex = ZeroDivisionError +try: + 1/0 +except ex: + pass +""") + + +def test_catch_variable_exception_fail(): + assert not has_exception_handler(""" +ex = ZeroDivisionError +if True: + ex = IndexError +try: + 1/0 +except ex: + pass +""") + + +def test_catch_multiple_variable_exceptions(): + assert has_exception_handler(""" +ex = (ValueError, ZeroDivisionError) +try: + 1/0 +except ex: + pass +""") + + +def test_catch_nested_exceptions(): + assert has_exception_handler(""" +try: + try: + 1/0 + except ValueError: + pass +except ZeroDivisionError: + pass +""") + + +def test_catch_nested_exceptions_fail(): + assert not has_exception_handler(""" +try: + try: + 1/0 + except ValueError: + pass +except IndexError: + pass +""") + + +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') + + +def test_next_exception(): + assert no_error_caught('next(iter([]), 42)', 'eval') 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 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. diff --git a/rsqueakvm/util/shell.py b/rsqueakvm/util/shell.py index 57f16f9d..fc5be970 100644 --- a/rsqueakvm/util/shell.py +++ b/rsqueakvm/util/shell.py @@ -162,7 +162,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 @objectmodel.not_rpython @@ -228,11 +228,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 = [] @@ -240,7 +242,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() @@ -254,11 +256,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 !! @@ -271,7 +268,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: diff --git a/targetrsqueak.py b/targetrsqueak.py index 4e6dd626..a925445a 100755 --- a/targetrsqueak.py +++ b/targetrsqueak.py @@ -12,7 +12,6 @@ sys.setrecursionlimit(15000) - def target(driver, args): driver.exe_name = "rsqueak" config = driver.config @@ -30,12 +29,26 @@ 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 - return safe_entry_point, None + if 'PythonPlugin' in system.optional_plugins: + from rsqueakvm.plugins.python.utils import entry_point + from pypy.tool.ann_override import PyPyAnnotatorPolicy + ann_policy = PyPyAnnotatorPolicy() + return entry_point, None, ann_policy + return safe_entry_point, None, None def jitpolicy(self): - if "JitHooks" in system.optional_plugins: + 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: @@ -65,7 +78,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: