summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-12-13 21:22:46 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-12-13 21:22:46 -0800
commit5249416895eb1c0309997d8be7ca91007b18cda5 (patch)
treedee7a943935e05912a4490aabf6ead0cb05902b7
parent1d3da7ed9803fd0fe671da627458514bd0503b05 (diff)
parent30b389a9b0dede4363a5e67b13debf280f536832 (diff)
downloadscala-5249416895eb1c0309997d8be7ca91007b18cda5.tar.gz
scala-5249416895eb1c0309997d8be7ca91007b18cda5.tar.bz2
scala-5249416895eb1c0309997d8be7ca91007b18cda5.zip
Merge pull request #3221 from adriaanm/modularize-cps
Final library modularization for 2.11
-rw-r--r--build-ant-macros.xml4
-rwxr-xr-xbuild.xml176
-rw-r--r--dbuild-meta.json30
-rw-r--r--src/build/bnd/continuations.bnd5
-rw-r--r--src/build/bnd/scala-continuations-library.bnd5
-rw-r--r--src/build/bnd/scala-continuations-plugin.bnd5
-rw-r--r--src/build/bnd/scala-swing.bnd2
-rw-r--r--src/build/dbuild-meta-json-gen.scala7
-rw-r--r--src/build/maven/maven-deploy.xml2
-rw-r--r--src/build/maven/plugins/continuations-pom.xml59
-rw-r--r--src/build/maven/scala-swing-pom.xml62
-rw-r--r--src/continuations/library/scala/util/continuations/ControlContext.scala249
-rw-r--r--src/continuations/library/scala/util/continuations/package.scala187
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala520
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala137
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala545
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala56
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala383
-rw-r--r--src/continuations/plugin/scalac-plugin.xml5
-rw-r--r--src/eclipse/continuations-library/.classpath8
-rw-r--r--src/eclipse/continuations-library/.project30
-rw-r--r--src/eclipse/continuations-library/.settings/org.scala-ide.sdt.core.prefs2
-rw-r--r--src/eclipse/reflect/.classpath1
-rw-r--r--src/eclipse/scala-compiler/.classpath1
-rw-r--r--src/eclipse/test-junit/.classpath1
-rw-r--r--src/intellij/continuations-library.iml.SAMPLE23
-rw-r--r--src/intellij/continuations-plugin.iml.SAMPLE25
-rw-r--r--src/intellij/parser-combinators.iml.SAMPLE22
-rw-r--r--src/intellij/partest.iml.SAMPLE24
-rw-r--r--src/intellij/scala-lang.ipr.SAMPLE6
-rw-r--r--src/intellij/swing.iml.SAMPLE24
-rw-r--r--src/intellij/xml.iml.SAMPLE22
-rw-r--r--src/swing/doc/README39
-rw-r--r--src/swing/doc/build.xml83
-rw-r--r--src/swing/scala/swing/AbstractButton.scala87
-rw-r--r--src/swing/scala/swing/Action.scala162
-rw-r--r--src/swing/scala/swing/Adjustable.scala53
-rw-r--r--src/swing/scala/swing/Alignment.scala32
-rw-r--r--src/swing/scala/swing/Applet.scala46
-rw-r--r--src/swing/scala/swing/BorderPanel.scala60
-rw-r--r--src/swing/scala/swing/BoxPanel.scala26
-rw-r--r--src/swing/scala/swing/BufferWrapper.scala34
-rw-r--r--src/swing/scala/swing/Button.scala34
-rw-r--r--src/swing/scala/swing/ButtonGroup.scala38
-rw-r--r--src/swing/scala/swing/CheckBox.scala26
-rw-r--r--src/swing/scala/swing/ColorChooser.scala45
-rw-r--r--src/swing/scala/swing/ComboBox.scala209
-rw-r--r--src/swing/scala/swing/Component.scala295
-rw-r--r--src/swing/scala/swing/Container.scala64
-rw-r--r--src/swing/scala/swing/EditorPane.scala28
-rw-r--r--src/swing/scala/swing/FileChooser.scala111
-rw-r--r--src/swing/scala/swing/FlowPanel.scala46
-rw-r--r--src/swing/scala/swing/FormattedTextField.scala40
-rw-r--r--src/swing/scala/swing/GridBagPanel.scala114
-rw-r--r--src/swing/scala/swing/GridPanel.scala51
-rw-r--r--src/swing/scala/swing/Label.scala62
-rw-r--r--src/swing/scala/swing/LayoutContainer.scala73
-rw-r--r--src/swing/scala/swing/ListView.scala246
-rw-r--r--src/swing/scala/swing/MainFrame.scala17
-rw-r--r--src/swing/scala/swing/Menu.scala70
-rw-r--r--src/swing/scala/swing/Orientable.scala27
-rw-r--r--src/swing/scala/swing/Orientation.scala19
-rw-r--r--src/swing/scala/swing/Oriented.scala35
-rw-r--r--src/swing/scala/swing/Panel.scala20
-rw-r--r--src/swing/scala/swing/PasswordField.scala34
-rw-r--r--src/swing/scala/swing/PopupMenu.scala65
-rw-r--r--src/swing/scala/swing/ProgressBar.scala40
-rw-r--r--src/swing/scala/swing/RadioButton.scala25
-rw-r--r--src/swing/scala/swing/Reactions.scala54
-rw-r--r--src/swing/scala/swing/Reactor.scala30
-rw-r--r--src/swing/scala/swing/RichWindow.scala195
-rw-r--r--src/swing/scala/swing/RootPanel.scala38
-rw-r--r--src/swing/scala/swing/ScrollBar.scala39
-rw-r--r--src/swing/scala/swing/ScrollPane.scala88
-rw-r--r--src/swing/scala/swing/Scrollable.scala43
-rw-r--r--src/swing/scala/swing/Separator.scala23
-rw-r--r--src/swing/scala/swing/SequentialContainer.scala36
-rw-r--r--src/swing/scala/swing/SimpleSwingApplication.scala36
-rw-r--r--src/swing/scala/swing/Slider.scala71
-rw-r--r--src/swing/scala/swing/SplitPane.scala63
-rw-r--r--src/swing/scala/swing/Swing.scala141
-rw-r--r--src/swing/scala/swing/SwingApplication.scala17
-rw-r--r--src/swing/scala/swing/TabbedPane.scala131
-rw-r--r--src/swing/scala/swing/Table.scala320
-rw-r--r--src/swing/scala/swing/TextArea.scala43
-rw-r--r--src/swing/scala/swing/TextComponent.scala75
-rw-r--r--src/swing/scala/swing/TextField.scala79
-rw-r--r--src/swing/scala/swing/ToggleButton.scala22
-rw-r--r--src/swing/scala/swing/UIElement.scala133
-rw-r--r--src/swing/scala/swing/Window.scala78
-rw-r--r--src/swing/scala/swing/event/ActionEvent.scala18
-rw-r--r--src/swing/scala/swing/event/AdjustingEvent.scala24
-rw-r--r--src/swing/scala/swing/event/BackgroundChanged.scala14
-rw-r--r--src/swing/scala/swing/event/ButtonClicked.scala15
-rw-r--r--src/swing/scala/swing/event/CaretUpdate.scala14
-rw-r--r--src/swing/scala/swing/event/ColorChanged.scala14
-rw-r--r--src/swing/scala/swing/event/ComponentEvent.scala16
-rw-r--r--src/swing/scala/swing/event/ContainerEvent.scala17
-rw-r--r--src/swing/scala/swing/event/EditDone.scala14
-rw-r--r--src/swing/scala/swing/event/Event.scala14
-rw-r--r--src/swing/scala/swing/event/FocusEvent.scala23
-rw-r--r--src/swing/scala/swing/event/FontChanged.scala14
-rw-r--r--src/swing/scala/swing/event/ForegroundChanged.scala14
-rw-r--r--src/swing/scala/swing/event/InputEvent.scala20
-rw-r--r--src/swing/scala/swing/event/Key.scala232
-rw-r--r--src/swing/scala/swing/event/KeyEvent.scala43
-rw-r--r--src/swing/scala/swing/event/ListEvent.scala43
-rw-r--r--src/swing/scala/swing/event/MouseEvent.scala79
-rw-r--r--src/swing/scala/swing/event/PopupMenuEvent.scala18
-rw-r--r--src/swing/scala/swing/event/SelectionEvent.scala34
-rw-r--r--src/swing/scala/swing/event/TableEvent.scala46
-rw-r--r--src/swing/scala/swing/event/UIEvent.scala21
-rw-r--r--src/swing/scala/swing/event/ValueChanged.scala18
-rw-r--r--src/swing/scala/swing/event/WindowActivated.scala14
-rw-r--r--src/swing/scala/swing/event/WindowClosed.scala4
-rw-r--r--src/swing/scala/swing/event/WindowClosing.scala14
-rw-r--r--src/swing/scala/swing/event/WindowDeactivated.scala14
-rw-r--r--src/swing/scala/swing/event/WindowDeiconified.scala14
-rw-r--r--src/swing/scala/swing/event/WindowEvent.scala14
-rw-r--r--src/swing/scala/swing/event/WindowIconified.scala14
-rw-r--r--src/swing/scala/swing/event/WindowOpened.scala14
-rw-r--r--src/swing/scala/swing/model/Matrix.scala121
-rw-r--r--src/swing/scala/swing/package.scala20
-rw-r--r--src/swing/swing.version.properties2
-rw-r--r--test/disabled/continuations-neg/infer0.check4
-rw-r--r--test/disabled/continuations-neg/infer0.scala12
-rw-r--r--test/files/continuations-neg/function0.check6
-rw-r--r--test/files/continuations-neg/function0.scala16
-rw-r--r--test/files/continuations-neg/function2.check6
-rw-r--r--test/files/continuations-neg/function2.scala16
-rw-r--r--test/files/continuations-neg/function3.check6
-rw-r--r--test/files/continuations-neg/function3.scala15
-rw-r--r--test/files/continuations-neg/infer2.check4
-rw-r--r--test/files/continuations-neg/infer2.scala19
-rw-r--r--test/files/continuations-neg/lazy.check4
-rw-r--r--test/files/continuations-neg/lazy.scala16
-rw-r--r--test/files/continuations-neg/t1929.check6
-rw-r--r--test/files/continuations-neg/t1929.scala17
-rw-r--r--test/files/continuations-neg/t2285.check6
-rw-r--r--test/files/continuations-neg/t2285.scala11
-rw-r--r--test/files/continuations-neg/t2949.check6
-rw-r--r--test/files/continuations-neg/t2949.scala15
-rw-r--r--test/files/continuations-neg/t3628.check4
-rw-r--r--test/files/continuations-neg/t3628.scala11
-rw-r--r--test/files/continuations-neg/t3718.check4
-rw-r--r--test/files/continuations-neg/t3718.scala3
-rw-r--r--test/files/continuations-neg/t5314-missing-result-type.check4
-rw-r--r--test/files/continuations-neg/t5314-missing-result-type.scala13
-rw-r--r--test/files/continuations-neg/t5314-npe.check4
-rw-r--r--test/files/continuations-neg/t5314-npe.scala3
-rw-r--r--test/files/continuations-neg/t5314-return-reset.check4
-rw-r--r--test/files/continuations-neg/t5314-return-reset.scala21
-rw-r--r--test/files/continuations-neg/t5314-type-error.check6
-rw-r--r--test/files/continuations-neg/t5314-type-error.scala17
-rw-r--r--test/files/continuations-neg/t5445.check4
-rw-r--r--test/files/continuations-neg/t5445.scala5
-rw-r--r--test/files/continuations-neg/trycatch2.check7
-rw-r--r--test/files/continuations-neg/trycatch2.scala33
-rwxr-xr-xtest/files/continuations-run/basics.check2
-rwxr-xr-xtest/files/continuations-run/basics.scala23
-rw-r--r--test/files/continuations-run/function1.check1
-rw-r--r--test/files/continuations-run/function1.scala16
-rw-r--r--test/files/continuations-run/function4.check1
-rw-r--r--test/files/continuations-run/function4.scala15
-rw-r--r--test/files/continuations-run/function5.check1
-rw-r--r--test/files/continuations-run/function5.scala15
-rw-r--r--test/files/continuations-run/function6.check1
-rw-r--r--test/files/continuations-run/function6.scala16
-rw-r--r--test/files/continuations-run/ifelse0.check2
-rw-r--r--test/files/continuations-run/ifelse0.scala18
-rw-r--r--test/files/continuations-run/ifelse1.check4
-rw-r--r--test/files/continuations-run/ifelse1.scala25
-rw-r--r--test/files/continuations-run/ifelse2.check4
-rw-r--r--test/files/continuations-run/ifelse2.scala16
-rw-r--r--test/files/continuations-run/ifelse3.check2
-rw-r--r--test/files/continuations-run/ifelse3.scala21
-rw-r--r--test/files/continuations-run/ifelse4.check4
-rw-r--r--test/files/continuations-run/ifelse4.scala31
-rw-r--r--test/files/continuations-run/implicit-infer-annotations.check5
-rw-r--r--test/files/continuations-run/implicit-infer-annotations.scala59
-rw-r--r--test/files/continuations-run/infer1.scala33
-rw-r--r--test/files/continuations-run/match0.check2
-rw-r--r--test/files/continuations-run/match0.scala18
-rw-r--r--test/files/continuations-run/match1.check2
-rw-r--r--test/files/continuations-run/match1.scala18
-rw-r--r--test/files/continuations-run/match2.check2
-rw-r--r--test/files/continuations-run/match2.scala26
-rw-r--r--test/files/continuations-run/patvirt.check2
-rw-r--r--test/files/continuations-run/patvirt.scala32
-rw-r--r--test/files/continuations-run/shift-pct.check25
-rw-r--r--test/files/continuations-run/shift-pct.scala30
-rw-r--r--test/files/continuations-run/t1807.check1
-rw-r--r--test/files/continuations-run/t1807.scala14
-rw-r--r--test/files/continuations-run/t1808.scala10
-rw-r--r--test/files/continuations-run/t1820.scala14
-rw-r--r--test/files/continuations-run/t1821.check4
-rw-r--r--test/files/continuations-run/t1821.scala20
-rw-r--r--test/files/continuations-run/t2864.check1
-rw-r--r--test/files/continuations-run/t2864.scala30
-rw-r--r--test/files/continuations-run/t2934.check1
-rw-r--r--test/files/continuations-run/t2934.scala10
-rw-r--r--test/files/continuations-run/t3199.check1
-rw-r--r--test/files/continuations-run/t3199.scala20
-rw-r--r--test/files/continuations-run/t3223.check1
-rw-r--r--test/files/continuations-run/t3223.scala19
-rw-r--r--test/files/continuations-run/t3225.check12
-rw-r--r--test/files/continuations-run/t3225.scala56
-rw-r--r--test/files/continuations-run/t3501.check5
-rw-r--r--test/files/continuations-run/t3501.scala15
-rw-r--r--test/files/continuations-run/t5314-2.check5
-rw-r--r--test/files/continuations-run/t5314-2.scala44
-rw-r--r--test/files/continuations-run/t5314-3.check4
-rw-r--r--test/files/continuations-run/t5314-3.scala27
-rw-r--r--test/files/continuations-run/t5314-with-if.check1
-rw-r--r--test/files/continuations-run/t5314-with-if.scala17
-rw-r--r--test/files/continuations-run/t5314.check14
-rw-r--r--test/files/continuations-run/t5314.scala52
-rw-r--r--test/files/continuations-run/t5472.check25
-rw-r--r--test/files/continuations-run/t5472.scala91
-rw-r--r--test/files/continuations-run/t5506.check7
-rw-r--r--test/files/continuations-run/t5506.scala58
-rw-r--r--test/files/continuations-run/t5538.check2
-rw-r--r--test/files/continuations-run/t5538.scala52
-rw-r--r--test/files/continuations-run/trycatch0.check2
-rw-r--r--test/files/continuations-run/trycatch0.scala25
-rw-r--r--test/files/continuations-run/trycatch1.check10
-rw-r--r--test/files/continuations-run/trycatch1.scala48
-rw-r--r--test/files/continuations-run/while0.check1
-rw-r--r--test/files/continuations-run/while0.scala22
-rw-r--r--test/files/continuations-run/while1.check11
-rw-r--r--test/files/continuations-run/while1.scala22
-rw-r--r--test/files/continuations-run/while2.check19
-rw-r--r--test/files/continuations-run/while2.scala23
-rw-r--r--test/files/continuations-run/z1673.scala31
-rw-r--r--test/files/run/t3199b.check (renamed from test/files/continuations-run/t3199b.check)0
-rw-r--r--test/files/run/t3199b.scala (renamed from test/files/continuations-run/t3199b.scala)0
-rw-r--r--test/pending/continuations-pos/t3620.scala73
-rw-r--r--test/pending/continuations-run/example0.scala9
-rw-r--r--test/pending/continuations-run/example1.scala9
-rw-r--r--test/pending/continuations-run/example16.scala9
-rw-r--r--test/pending/continuations-run/example2.scala9
-rw-r--r--test/pending/continuations-run/example3.scala9
-rw-r--r--test/pending/continuations-run/example4.scala9
-rw-r--r--test/pending/continuations-run/example5.scala9
-rw-r--r--test/pending/continuations-run/example6.scala9
-rw-r--r--test/pending/continuations-run/example7.scala9
-rw-r--r--test/pending/continuations-run/example8.scala9
-rw-r--r--test/pending/continuations-run/example9.scala9
-rw-r--r--test/pending/continuations-run/foreach.check4
-rw-r--r--test/pending/continuations-run/foreach.scala33
-rw-r--r--versions.properties9
251 files changed, 71 insertions, 9643 deletions
diff --git a/build-ant-macros.xml b/build-ant-macros.xml
index 735e91ba7b..593f93b784 100644
--- a/build-ant-macros.xml
+++ b/build-ant-macros.xml
@@ -190,10 +190,6 @@
<and>
<available file="tools/zinc"/>
<equals arg1="@{stage}" arg2="quick"/>
- <not>
- <equals arg1="@{project}" arg2="continuations-plugins"/>
- </not>
- <!-- doesn't work in zinc because it requires the quick compiler, which isn't jarred up-->
</and>
<then>
<zinc taskname="Z.@{stage}.@{project}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" srcpath="@{srcpath}" buildpathref="@{stage}.@{project}.build.path" params="${scalac.args.@{stage}} @{args}" java-excludes="@{java-excludes}"/>
diff --git a/build.xml b/build.xml
index c83ad41f1e..c274b970b6 100755
--- a/build.xml
+++ b/build.xml
@@ -107,6 +107,10 @@ TODO:
<target name="distclean" depends="dist.clean" description="Removes all distributions. Binaries and documentation are untouched."/>
+ <target name="test.continuations.suite">
+ <echo message="DEPRECATED: the continuations have moved to https://github.com/scala/scala-continuations"/>
+ </target>
+
<!-- ===========================================================================
PROPERTIES
============================================================================ -->
@@ -303,6 +307,9 @@ TODO:
<artifact:remoteRepository refid="extra-repo"/>
<dependency groupId="org.scala-lang.modules" artifactId="scala-xml_${scala.binary.version}" version="${scala-xml.version.number}"/>
<dependency groupId="org.scala-lang.modules" artifactId="scala-parser-combinators_${scala.binary.version}" version="${scala-parser-combinators.version.number}"/>
+ <dependency groupId="org.scala-lang.plugins" artifactId="scala-continuations-plugin_${scala.binary.version}" version="${scala-continuations-plugin.version.number}"/>
+ <dependency groupId="org.scala-lang.plugins" artifactId="scala-continuations-library_${scala.binary.version}" version="${scala-continuations-library.version.number}"/>
+ <dependency groupId="org.scala-lang.modules" artifactId="scala-swing_${scala.binary.version}" version="${scala-swing.version.number}"/>
</artifact:dependencies>
<!-- External modules, excluding the core -->
@@ -320,6 +327,9 @@ TODO:
<propertyForCrossedArtifact name="scala-parser-combinators" jar="org.scala-lang.modules:scala-parser-combinators"/>
<propertyForCrossedArtifact name="scala-xml" jar="org.scala-lang.modules:scala-xml"/>
+ <propertyForCrossedArtifact name="scala-continuations-plugin" jar="org.scala-lang.plugins:scala-continuations-plugin"/>
+ <propertyForCrossedArtifact name="scala-continuations-library" jar="org.scala-lang.plugins:scala-continuations-library"/>
+ <propertyForCrossedArtifact name="scala-swing" jar="org.scala-lang.modules:scala-swing"/>
<!-- BND support -->
<typedef resource="aQute/bnd/ant/taskdef.properties" classpathref="extra.tasks.classpath" />
@@ -406,13 +416,6 @@ TODO:
<fail if="has.unsupported.jdk" message="JDK ${ant.java.version} is not supported by this build!"/>
- <if><isset property="has.java7"/><then>
- <echo level="warning"> You are using JDK7 for this build.
- While this will be able to build most of Scala, it will not build the Swing project.
- You will be unable to create a distribution.
- </echo>
- </then></if>
-
<!-- Allow this to be overridden simply -->
<property name="sbt.latest.version" value="0.12.4"/>
@@ -560,17 +563,23 @@ TODO:
<property name="actors.description" value="Scala Actors Library"/>
- <property name="continuations-plugin.description" value="Scala Delimited Continuations Compiler Plugin"/>
- <property name="continuations-plugin.package" value="plugins." />
- <property name="continuations-plugin.dir" value="plugins/"/>
- <property name="continuations-plugin.name" value="continuations"/>
- <property name="continuations-plugin.targetdir" value="misc/scala-devel/plugins"/>
- <property name="continuations-plugin.srcdir" value="continuations/plugin"/>
+ <property name="swing.description" value="Scala Swing Library"/>
+ <property name="swing.package" value="modules."/>
+ <property name="swing.jar" value="${scala-swing}"/>
+ <property name="swing.src" value="false"/>
+ <property name="swing.srcjar" value="${scala-swing-sources}"/>
- <property name="continuations-library.description" value="Scala Delimited Continuations Library"/>
- <property name="continuations-library.srcdir" value="continuations/library"/>
+ <property name="continuations-plugin.description" value="Scala Delimited Continuations Compiler Plugin"/>
+ <property name="continuations-plugin.package" value="plugins." />
+ <property name="continuations-plugin.jar" value="${scala-continuations-plugin}"/>
+ <property name="continuations-plugin.src" value="false"/>
+ <property name="continuations-plugin.srcjar" value="${scala-continuations-plugin-sources}"/>
- <property name="swing.description" value="Scala Swing Library"/>
+ <property name="continuations-library.description" value="Scala Delimited Continuations Library"/>
+ <property name="continuations-library.package" value="plugins." />
+ <property name="continuations-library.jar" value="${scala-continuations-library}"/>
+ <property name="continuations-library.src" value="false"/>
+ <property name="continuations-library.srcjar" value="${scala-continuations-library-sources}"/>
<property name="parser-combinators.description" value="Scala Parser Combinators Library"/>
<property name="parser-combinators.package" value="modules."/>
@@ -592,12 +601,12 @@ TODO:
<property name="partest-javaagent.description" value="Scala Compiler Testing Tool (compiler-specific java agent)"/>
<!-- projects without project-specific options: asm, forkjoin, manual, bin, repl -->
- <for list="actors,compiler,interactive,scaladoc,continuations-library,continuations-plugin,library,parser-combinators,partest,partest-extras,partest-javaagent,reflect,scalap,swing,xml" param="project">
+ <for list="actors,compiler,interactive,scaladoc,library,parser-combinators,partest,partest-extras,partest-javaagent,reflect,scalap,swing,xml,continuations-plugin,continuations-library" param="project">
<sequential>
<!-- description is mandatory -->
- <init-project-prop project="@{project}" name="package" default=""/>
- <init-project-prop project="@{project}" name="dir" default=""/>
- <init-project-prop project="@{project}" name="name" default="scala-@{project}"/>
+ <init-project-prop project="@{project}" name="package" default=""/> <!-- used by mvn-package, copy-bundle, make-bundle -->
+ <init-project-prop project="@{project}" name="dir" default=""/> <!-- used by mvn-package -->
+ <init-project-prop project="@{project}" name="name" default="scala-@{project}"/> <!-- used for defaults in this block and by mvn-package, copy-bundle, make-bundle -->
<init-project-prop project="@{project}" name="namesuffix" default=""/>
<init-project-prop project="@{project}" name="version" default="${osgi.version.number}"/>
<init-project-prop project="@{project}" name="targetdir" default="lib"/>
@@ -641,7 +650,7 @@ TODO:
There must be a variable of the shape @{stage}.@{project}.build.path
for all @{stage} in locker, quick, strap
and all @{project} in library, reflect, compiler
- when stage is quick, @{project} also includes: actors, repl, swing, continuations-plugin, continuations-library, scalap
+ when stage is quick, @{project} also includes: actors, repl, scalap
NOTE: interactive, scaladoc, are only used upto quick; they are still packed into the compiler jar
-->
@@ -696,19 +705,6 @@ TODO:
<path refid="repl.deps.classpath"/>
</path>
- <path id="quick.swing.build.path">
- <path refid="quick.library.build.path"/>
- <pathelement location="${build-quick.dir}/classes/swing"/>
- </path>
-
- <path id="quick.continuations-plugin.build.path">
- <!-- plugins are run by locker compiler during quick stage,
- so must compile against the same classes the locker was compiled to
- -->
- <path refid="locker.compiler.build.path"/>
- <pathelement location="${build-quick.dir}/classes/continuations-plugin"/>
- </path>
-
<path id="quick.scalap.build.path">
<path refid="quick.compiler.build.path"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
@@ -743,7 +739,6 @@ TODO:
<path refid="quick.repl.build.path"/>
<path refid="quick.actors.build.path"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
- <pathelement location="${build-quick.dir}/classes/continuations-library"/>
<path refid="external-modules-nocore"/>
</path>
@@ -772,7 +767,6 @@ TODO:
<path id="pack.library.files">
<fileset dir="${build-quick.dir}/classes/library"/>
- <fileset dir="${build-quick.dir}/classes/continuations-library"/>
<fileset dir="${forkjoin-classes}"/>
</path>
@@ -795,9 +789,7 @@ TODO:
<path id="pack.interactive.files"><fileset dir="${build-quick.dir}/classes/interactive"/> </path>
-->
- <path id="pack.swing.files"> <fileset dir="${build-quick.dir}/classes/swing"/> </path>
<path id="pack.reflect.files"> <fileset dir="${build-quick.dir}/classes/reflect"/> </path>
- <path id="pack.continuations-plugin.files"> <fileset dir="${build-quick.dir}/classes/continuations-plugin"/> </path>
<path id="pack.scalap.files"> <fileset dir="${build-quick.dir}/classes/scalap"/>
<fileset file="${src.dir}/scalap/decoder.properties"/> </path>
@@ -829,10 +821,7 @@ TODO:
<path id="docs.scaladoc.build.path"> <path refid="quick.scaladoc.build.path"/> </path>
<path id="docs.interactive.build.path"> <path refid="quick.interactive.build.path"/> </path>
<path id="docs.scalap.build.path"> <path refid="quick.scalap.build.path"/> </path>
- <path id="docs.continuations-plugin.build.path"> <path refid="quick.continuations-plugin.build.path"/> </path>
- <path id="docs.continuations-library.build.path"> <path refid="quick.continuations-plugin.build.path"/> </path>
<path id="docs.actors.build.path"> <path refid="quick.actors.build.path"/> </path>
- <path id="docs.swing.build.path"> <path refid="quick.swing.build.path"/> </path>
<!-- run-time classpath for scaladoc TODO: resolve through maven -->
<path id="scaladoc.classpath">
@@ -905,6 +894,7 @@ TODO:
</restrict>
<pathelement location="${scala-xml}"/>
<pathelement location="${scala-parser-combinators}"/>
+ <!-- <pathelement location="${scala-swing}"/> -->
<restrict>
<path refid="scalacheck.classpath"/>
@@ -1071,38 +1061,9 @@ TODO:
<target name="quick.actors" depends="quick.lib">
<staged-build with="locker" stage="quick" project="actors"/> </target>
- <target name="quick.swing" depends="quick.actors, quick.lib" if="has.java6">
- <staged-build with="locker" stage="quick" project="swing"/> </target>
-
-
- <target name="quick.plugins" depends="quick.comp">
- <staged-uptodate stage="quick" project="continuations-plugin">
- <check><srcfiles dir="${src.dir}/continuations"/></check>
- <do>
- <stopwatch name="quick.continuations-plugin.timer"/>
-
- <mkdir dir="${build-quick.dir}/classes/continuations-plugin"/>
- <staged-scalac with="locker" stage="quick" project="continuations-plugin" srcdir="${continuations-plugin.srcdir}"/>
- <copy
- file="${src.dir}/${continuations-plugin.srcdir}/scalac-plugin.xml"
- todir="${build-quick.dir}/classes/continuations-plugin"/>
-
- <!-- not very nice to create jar here but needed to load plugin -->
- <mkdir dir="${build-quick.dir}/${continuations-plugin.targetdir}"/>
- <jar whenmanifestonly="fail" destfile="${build-quick.dir}/${continuations-plugin.targetdir}/continuations.jar" basedir="${build-quick.dir}/classes/continuations-plugin"/>
- <!-- might split off library part into its own ant target -->
- <mkdir dir="${build-quick.dir}/classes/continuations-library"/>
- <staged-scalac with="locker" stage="quick" project="continuations-plugin"
- srcdir="continuations/library" destproject="continuations-library"
- args="-Xplugin-require:continuations -P:continuations:enable -Xpluginsdir ${build-quick.dir}/${continuations-plugin.targetdir}"/>
- <stopwatch name="quick.continuations-plugin.timer" action="total"/>
- </do>
- </staged-uptodate>
- </target>
-
- <target name="quick.modules" depends="quick.repl, quick.scaladoc, quick.interactive, quick.scalap, quick.swing, quick.plugins"/>
+ <target name="quick.modules" depends="quick.repl, quick.scaladoc, quick.interactive, quick.scalap"/>
<target name="quick.bin" depends="quick.lib, quick.reflect, quick.comp, quick.modules">
<staged-bin stage="quick" classpathref="quick.bin.tool.path"/>
@@ -1115,7 +1076,7 @@ TODO:
<!-- ===========================================================================
PACKED QUICK BUILD (PACK)
============================================================================ -->
- <target name="pack.lib" depends="quick.lib, quick.plugins, forkjoin.done"> <staged-pack project="library"/></target>
+ <target name="pack.lib" depends="quick.lib, forkjoin.done"> <staged-pack project="library"/></target>
<target name="pack.reflect" depends="quick.reflect"> <staged-pack project="reflect"/> </target>
@@ -1152,16 +1113,13 @@ TODO:
-->
<target name="pack.actors" depends="quick.actors"> <staged-pack project="actors"/> </target>
- <target name="pack.swing" if="has.java6" depends="quick.swing"> <staged-pack project="swing"/> </target>
-
- <target name="pack.plugins" depends="quick.plugins"> <staged-pack project="continuations-plugin"/> </target>
<target name="pack.scalap" depends="quick.scalap"> <staged-pack project="scalap"/> </target>
<target name="pack.core" depends="pack.reflect, pack.comp, pack.lib"/>
<!-- TODO modularize compiler: pack.scaladoc, pack.interactive, -->
- <target name="pack.modules" depends="pack.actors, pack.swing, pack.plugins, pack.scalap">
+ <target name="pack.modules" depends="pack.actors, pack.scalap">
<copy todir="${build-pack.dir}/lib">
<path refid="external-modules-nocore" />
<mapper type="flatten" />
@@ -1230,7 +1188,6 @@ TODO:
<stopwatch name="osgi.core.timer"/>
<make-bundle project="library">
<fileset dir="${src.dir}/library"/>
- <fileset dir="${src.dir}/continuations/library"/>
</make-bundle>
<make-bundle project="reflect">
@@ -1262,10 +1219,12 @@ TODO:
-->
<include name="${actors.jar}"/>
+
<include name="${continuations-plugin.jar}"/>
- <include name="${swing.jar}"/>
+ <include name="${continuations-library.jar}"/>
<include name="${parser-combinators.jar}"/>
<include name="${xml.jar}"/>
+ <include name="${swing.jar}"/>
</srcfiles>
</uptodate>
@@ -1290,18 +1249,12 @@ TODO:
<fileset dir="${src.dir}/actors"/>
</make-bundle>
- <make-bundle project="continuations-plugin">
- <fileset dir="${src.dir}/${continuations-plugin.srcdir}"/>
- </make-bundle>
-
- <if><isset property="has.java6"/><then>
- <make-bundle project="swing">
- <fileset dir="${src.dir}/swing"/>
- </make-bundle>
- </then></if>
+ <make-bundle project="continuations-plugin"/>
+ <make-bundle project="continuations-library"/>
<make-bundle project="parser-combinators"/>
<make-bundle project="xml"/>
+ <make-bundle project="swing"/>
<touch file="${build-osgi.dir}/bundles.all.complete" verbose="no"/>
<stopwatch name="osgi.all.timer" action="total"/>
@@ -1477,12 +1430,6 @@ TODO:
<testSuite kinds="run jvm"/>
</target>
- <target name="test.continuations.suite" depends="test.suite.init">
- <testSuite kinds="continuations-neg continuations-run"
- scalacOpts="${scalac.args.optimise} -Xpluginsdir ${build-quick.dir}/${continuations-plugin.targetdir} -Xplugin-require:continuations -P:continuations:enable"
- />
- </target>
-
<target name="test.scaladoc" depends="test.suite.init">
<testSuite kinds="run scalacheck" srcdir="scaladoc"/>
</target>
@@ -1493,7 +1440,7 @@ TODO:
<!-- for use in PR validation, where stability is rarely broken, so we're going to use starr for locker,
and skip test.stability (which requires locker == quick) -->
- <target name="test.core" depends="test.osgi, test.sbt, test.bc, test.junit, test.interactive, test.continuations.suite, test.scaladoc, test.suite"/>
+ <target name="test.core" depends="test.osgi, test.sbt, test.bc, test.junit, test.interactive, test.scaladoc, test.suite"/>
<target name="test.done" depends="test.core, test.stability"/>
<!-- ===========================================================================
@@ -1510,7 +1457,6 @@ TODO:
<dependency groupId="com.typesafe" artifactId="mima-reporter_2.9.2" version="0.1.5"/>
</artifact:dependencies>
<artifact:dependencies pathId="old.bc.classpath">
- <dependency groupId="org.scala-lang" artifactId="scala-swing" version="${bc-reference-version}"/>
<dependency groupId="org.scala-lang" artifactId="scala-library" version="${bc-reference-version}"/>
<dependency groupId="org.scala-lang" artifactId="scala-reflect" version="${bc-reference-version}"/>
</artifact:dependencies>
@@ -1523,10 +1469,9 @@ TODO:
<!-- Enable after the release of the 2.11.0 or a prior RC that estabilishes the new baseline. -->
<target name="test.bc"></target>
- <target name="test.bc.disabled" depends="bc.init, pack.lib, pack.reflect, pack.swing">
+ <target name="test.bc.disabled" depends="bc.init, pack.lib, pack.reflect">
<bc.check project="library"/>
<bc.check project="reflect"/>
- <bc.check project="swing"/>
</target>
<!-- ===========================================================================
@@ -1599,30 +1544,12 @@ TODO:
</staged-docs>
</target>
- <target name="docs.swing" depends="docs.start" unless="docs.skip">
- <staged-docs project="swing">
- <include name="**/*.scala"/>
- </staged-docs>
- </target>
-
<target name="docs.scalap" depends="docs.start" unless="docs.skip">
<staged-docs project="scalap">
<include name="**/*.scala"/>
</staged-docs>
</target>
- <target name="docs.continuations-plugin" depends="docs.start" unless="docs.skip">
- <staged-docs project="continuations-plugin">
- <include name="**/*.scala"/>
- </staged-docs>
- </target>
-
- <target name="docs.continuations-library" depends="docs.start" unless="docs.skip">
- <staged-docs project="continuations-library">
- <include name="**/*.scala"/>
- </staged-docs>
- </target>
-
<target name="docs.man" depends="docs.start">
<staged-uptodate stage="docs" project="manual">
<check><srcfiles dir="${src.dir}/manual"/></check>
@@ -1662,7 +1589,7 @@ TODO:
<target name="docs.core" depends="docs.lib, docs.reflect, docs.comp" unless="docs.skip"/>
<!-- TODO modularize compiler: docs.scaladoc, docs.interactive, -->
- <target name="docs.done" depends="docs.core, docs.actors, docs.swing, docs.scalap, docs.continuations-plugin, docs.continuations-library" unless="docs.skip"/>
+ <target name="docs.done" depends="docs.core, docs.actors, docs.scalap" unless="docs.skip"/>
<!-- ===========================================================================
DISTRIBUTION
@@ -1673,7 +1600,6 @@ TODO:
<mkdir dir="${dist.dir}/lib"/>
- <mkdir dir="${dist.dir}/${continuations-plugin.targetdir}"/>
<mkdir dir="${dist.dir}/src"/>
<copy todir="${dist.dir}/lib" overwrite="true">
@@ -1687,12 +1613,13 @@ TODO:
<copy-bundle project="reflect"/>
<copy-bundle project="compiler"/>
- <copy-bundle project="swing"/>
<copy-bundle project="actors"/>
- <copy-bundle project="xml"/>
- <copy-bundle project="parser-combinators"/>
<copy-bundle project="continuations-plugin"/>
+ <copy-bundle project="continuations-library"/>
+ <copy-bundle project="parser-combinators"/>
+ <copy-bundle project="xml"/>
+ <copy-bundle project="swing"/>
<!-- scalap -->
<copy toDir="${dist.dir}/lib" overwrite="true">
@@ -1728,13 +1655,14 @@ TODO:
<copy toDir="${dist.dir}/api" overwrite="true">
<fileset dir="${build-docs.dir}/library"/>
</copy>
- <copy file="${src.dir}/swing/doc/README"
- toFile="${dist.dir}/api/README.scala-swing" overwrite="true"/>
+
<copy toDir="${dist.dir}/doc/api" overwrite="true" flatten="true">
<file file="${scala-xml-javadoc}"/>
<file file="${scala-parser-combinators-javadoc}"/>
+ <file file="${scala-continuations-plugin-javadoc}"/>
+ <file file="${scala-continuations-library-javadoc}"/>
+ <file file="${scala-swing-javadoc}"/>
</copy>
-
</target>
@@ -1846,9 +1774,7 @@ MAIN DISTRIBUTION PACKAGING
<mvn-package project="scaladoc"/>
-->
- <mvn-package project="swing"/>
<mvn-package project="actors"/>
- <mvn-package project="continuations-plugin"/>
<!-- don't bother fitting scalap into the mould: it will move out soon -->
<copy tofile="${maven-base}/scalap/scalap-pom.xml" file="${src.dir}/build/maven/scalap-pom.xml" overwrite="true"/>
diff --git a/dbuild-meta.json b/dbuild-meta.json
index 8d3b65afd0..90d0104ec1 100644
--- a/dbuild-meta.json
+++ b/dbuild-meta.json
@@ -64,24 +64,6 @@
"artifacts": [
{
"extension": "jar",
- "name": "scala-swing",
- "organization": "org.scala-lang"
- }
- ],
- "dependencies": [
- {
- "extension": "jar",
- "name": "scala-library",
- "organization": "org.scala-lang"
- }
- ],
- "name": "scala-swing",
- "organization": "org.scala-lang"
- },
- {
- "artifacts": [
- {
- "extension": "jar",
"name": "scala-actors",
"organization": "org.scala-lang"
}
@@ -113,18 +95,6 @@
],
"name": "scalap",
"organization": "org.scala-lang"
- },
- {
- "artifacts": [
- {
- "extension": "jar",
- "name": "continuations",
- "organization": "org.scala-lang.plugins"
- }
- ],
- "dependencies": [],
- "name": "continuations",
- "organization": "org.scala-lang.plugins"
}
]
}
diff --git a/src/build/bnd/continuations.bnd b/src/build/bnd/continuations.bnd
deleted file mode 100644
index 748502f653..0000000000
--- a/src/build/bnd/continuations.bnd
+++ /dev/null
@@ -1,5 +0,0 @@
-Bundle-Name: Scala Continuations Plugin
-Bundle-SymbolicName: org.scala-lang.plugins.continuations
-ver: @VERSION@
-Bundle-Version: ${ver}
-Export-Package: *;version=${ver}
diff --git a/src/build/bnd/scala-continuations-library.bnd b/src/build/bnd/scala-continuations-library.bnd
new file mode 100644
index 0000000000..66022d473a
--- /dev/null
+++ b/src/build/bnd/scala-continuations-library.bnd
@@ -0,0 +1,5 @@
+Bundle-Name: Scala Delimited Continuations Library
+Bundle-SymbolicName: org.scala-lang.plugins.continuations-library
+ver: @VERSION@
+Bundle-Version: ${ver}
+Export-Package: *;version=${ver}
diff --git a/src/build/bnd/scala-continuations-plugin.bnd b/src/build/bnd/scala-continuations-plugin.bnd
new file mode 100644
index 0000000000..94bd3ccc8f
--- /dev/null
+++ b/src/build/bnd/scala-continuations-plugin.bnd
@@ -0,0 +1,5 @@
+Bundle-Name: Scala Delimited Continuations Compiler Plugin
+Bundle-SymbolicName: org.scala-lang.plugins.continuations-plugin
+ver: @VERSION@
+Bundle-Version: ${ver}
+Export-Package: *;version=${ver}
diff --git a/src/build/bnd/scala-swing.bnd b/src/build/bnd/scala-swing.bnd
index eeacb9bd3f..7cccb1343b 100644
--- a/src/build/bnd/scala-swing.bnd
+++ b/src/build/bnd/scala-swing.bnd
@@ -1,5 +1,5 @@
Bundle-Name: Scala Swing
-Bundle-SymbolicName: org.scala-lang.scala-swing
+Bundle-SymbolicName: org.scala-lang.modules.scala-swing
ver: @VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
diff --git a/src/build/dbuild-meta-json-gen.scala b/src/build/dbuild-meta-json-gen.scala
index ee1976ffa4..d1d4c12b3f 100644
--- a/src/build/dbuild-meta-json-gen.scala
+++ b/src/build/dbuild-meta-json-gen.scala
@@ -30,10 +30,6 @@ val meta =
// Seq(ProjectRef("scala-interactive", "org.scala-lang")),
// Seq(ProjectRef("scala-compiler", "org.scala-lang"), ProjectRef("scaladoc", "org.scala-lang"))),
- Project("scala-swing", "org.scala-lang",
- Seq(ProjectRef("scala-swing", "org.scala-lang")),
- Seq(ProjectRef("scala-library", "org.scala-lang"))),
-
Project("scala-actors", "org.scala-lang",
Seq(ProjectRef("scala-actors", "org.scala-lang")),
Seq(ProjectRef("scala-library", "org.scala-lang"))),
@@ -44,9 +40,8 @@ val meta =
Project("scalap", "org.scala-lang",
Seq(ProjectRef("scalap", "org.scala-lang")),
- Seq(ProjectRef("scala-compiler", "org.scala-lang"))),
+ Seq(ProjectRef("scala-compiler", "org.scala-lang")))
- Project("continuations", "org.scala-lang.plugins", Seq(ProjectRef("continuations", "org.scala-lang.plugins")), Seq.empty)
))
println(Utils.writeValue(meta))
diff --git a/src/build/maven/maven-deploy.xml b/src/build/maven/maven-deploy.xml
index 822cc1a25f..412d7caab6 100644
--- a/src/build/maven/maven-deploy.xml
+++ b/src/build/maven/maven-deploy.xml
@@ -124,9 +124,7 @@
-->
<deploy-one dir="@{dir}" name="scala-actors" local="@{local}" signed="@{signed}"/>
- <deploy-one dir="@{dir}" name="scala-swing" local="@{local}" signed="@{signed}"/>
<deploy-one dir="@{dir}" name="scalap" local="@{local}" signed="@{signed}"/>
- <deploy-one dir="@{dir}plugins/" name="continuations" local="@{local}" signed="@{signed}"/>
</sequential>
</macrodef>
diff --git a/src/build/maven/plugins/continuations-pom.xml b/src/build/maven/plugins/continuations-pom.xml
deleted file mode 100644
index 8dc79c8664..0000000000
--- a/src/build/maven/plugins/continuations-pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.scala-lang.plugins</groupId>
- <artifactId>continuations</artifactId>
- <packaging>jar</packaging>
- <version>@VERSION@</version>
- <name>Scala Continuations Plugin</name>
- <description>Delimited continuations compilation for Scala</description>
- <url>http://www.scala-lang.org/</url>
- <inceptionYear>2010</inceptionYear>
- <organization>
- <name>LAMP/EPFL</name>
- <url>http://lamp.epfl.ch/</url>
- </organization>
- <licenses>
- <license>
- <name>BSD 3-Clause</name>
- <url>http://www.scala-lang.org/license.html</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <connection>scm:git:git://github.com/scala/scala.git</connection>
- <url>https://github.com/scala/scala.git</url>
- </scm>
- <issueManagement>
- <system>JIRA</system>
- <url>https://issues.scala-lang.org/</url>
- </issueManagement>
- <dependencies>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-compiler</artifactId>
- <version>@VERSION@</version>
- </dependency>
- </dependencies>
- <distributionManagement>
- <repository>
- <id>scala-tools.org</id>
- <url>@RELEASE_REPOSITORY@</url>
- </repository>
- <snapshotRepository>
- <id>scala-tools.org</id>
- <url>@SNAPSHOT_REPOSITORY@</url>
- <uniqueVersion>false</uniqueVersion>
- </snapshotRepository>
- </distributionManagement>
- <developers>
- <developer>
- <id>lamp</id>
- <name>EPFL LAMP</name>
- </developer>
- <developer>
- <id>Typesafe</id>
- <name>Typesafe, Inc.</name>
- </developer>
- </developers>
-</project>
diff --git a/src/build/maven/scala-swing-pom.xml b/src/build/maven/scala-swing-pom.xml
deleted file mode 100644
index 01c89f9bea..0000000000
--- a/src/build/maven/scala-swing-pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?>
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-swing</artifactId>
- <packaging>jar</packaging>
- <version>@VERSION@</version>
- <name>Scala Swing library</name>
- <description>Swing for Scala</description>
- <url>http://www.scala-lang.org/</url>
- <inceptionYear>2002</inceptionYear>
- <organization>
- <name>LAMP/EPFL</name>
- <url>http://lamp.epfl.ch/</url>
- </organization>
- <licenses>
- <license>
- <name>BSD 3-Clause</name>
- <url>http://www.scala-lang.org/license.html</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <connection>scm:git:git://github.com/scala/scala.git</connection>
- <url>https://github.com/scala/scala.git</url>
- </scm>
- <issueManagement>
- <system>JIRA</system>
- <url>https://issues.scala-lang.org/</url>
- </issueManagement>
- <properties>
- <info.apiURL>http://www.scala-lang.org/api/@VERSION@/</info.apiURL>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- <version>@VERSION@</version>
- </dependency>
- </dependencies>
- <distributionManagement>
- <repository>
- <id>scala-tools.org</id>
- <url>@RELEASE_REPOSITORY@</url>
- </repository>
- <snapshotRepository>
- <id>scala-tools.org</id>
- <url>@SNAPSHOT_REPOSITORY@</url>
- <uniqueVersion>false</uniqueVersion>
- </snapshotRepository>
- </distributionManagement>
- <developers>
- <developer>
- <id>lamp</id>
- <name>EPFL LAMP</name>
- </developer>
- <developer>
- <id>Typesafe</id>
- <name>Typesafe, Inc.</name>
- </developer>
- </developers>
-</project>
diff --git a/src/continuations/library/scala/util/continuations/ControlContext.scala b/src/continuations/library/scala/util/continuations/ControlContext.scala
deleted file mode 100644
index c196809da9..0000000000
--- a/src/continuations/library/scala/util/continuations/ControlContext.scala
+++ /dev/null
@@ -1,249 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2010-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.util.continuations
-
-import scala.annotation.{ Annotation, StaticAnnotation, TypeConstraint }
-
-/** This annotation is used to mark a parameter as part of a continuation
- * context.
- *
- * The type `A @cpsParam[B,C]` is desugared to `ControlContext[A,B,C]` at compile
- * time.
- *
- * @tparam B The type of computation state after computation has executed, and
- * before control is returned to the shift.
- * @tparam C The eventual return type of this delimited compuation.
- * @see scala.util.continuations.ControlContext
- */
-class cpsParam[-B,+C] extends StaticAnnotation with TypeConstraint
-
-private class cpsSym[B] extends Annotation // implementation detail
-
-private class cpsSynth extends Annotation // implementation detail
-
-private class cpsPlus extends StaticAnnotation with TypeConstraint // implementation detail
-private class cpsMinus extends Annotation // implementation detail
-
-
-/**
- * This class represent a portion of computation that has a 'hole' in it. The
- * class has the ability to compute state up until a certain point where the
- * state has the `A` type. If this context is given a function of type
- * `A => B` to move the state to the `B` type, then the entire computation can
- * be completed resulting in a value of type `C`.
- *
- * An Example: {{{
- * val cc = new ControlContext[String, String, String](
- * fun = { (f: String=>String, err: Exception => String) =>
- * val updatedState =
- * try f("State")
- * catch {
- * case e: Exception => err(e)
- * }
- * updatedState + "-Complete!"
- * },
- * x = null.asIntanceOf[String]
- * }
- * cc.foreach(_ + "-Continued") // Results in "State-Continued-Complete!"
- * }}}
- *
- * This class is used to transform calls to `shift` in the `continuations`
- * package. Direct use and instantiation is possible, but usually reserved
- * for advanced cases.
- *
- *
- * A context may either be ''trivial'' or ''non-trivial''. A ''trivial''
- * context '''just''' has a state of type `A`. When completing the computation,
- * it's only necessary to use the function of type `A => B` directly against
- * the trivial value. A ''non-trivial'' value stores a computation '''around'''
- * the state transformation of type `A => B` and cannot be short-circuited.
- *
- * @param fun The captured computation so far. The type
- * `(A => B, Exception => B) => C` is a function where:
- * - The first parameter `A=>B` represents the computation defined against
- * the current state held in the ControlContext.
- * - The second parameter `Exception => B` represents a computation to
- * perform if an exception is thrown from the first parameter's computation.
- * - The return value is the result of the entire computation contained in this
- * `ControlContext`.
- * @param x The current state stored in this context. Allowed to be null if
- * the context is non-trivial.
- * @tparam A The type of the state currently held in the context.
- * @tparam B The type of the transformed state needed to complete this computation.
- * @tparam C The return type of the entire computation stored in this context.
- * @note `fun` and `x` are allowed to be `null`.
- * @see scala.util.continutations.shiftR
- */
-final class ControlContext[+A,-B,+C](val fun: (A => B, Exception => B) => C, val x: A) extends Serializable {
-
- /*
- final def map[A1](f: A => A1): ControlContext[A1,B,C] = {
- new ControlContext((k:(A1 => B)) => fun((x:A) => k(f(x))), null.asInstanceOf[A1])
- }
-
- final def flatMap[A1,B1<:B](f: (A => ControlContext[A1,B1,B])): ControlContext[A1,B1,C] = {
- new ControlContext((k:(A1 => B1)) => fun((x:A) => f(x).fun(k)))
- }
- */
-
- /**
- * Modifies the currently captured state in this `ControlContext`.
- * @tparam A1 The new type of state in this context.
- * @param f A transformation function on the current state of the `ControlContext`.
- * @return The new `ControlContext`.
- */
- @noinline final def map[A1](f: A => A1): ControlContext[A1,B,C] = {
- if (fun eq null)
- try {
- new ControlContext[A1,B,C](null, f(x)) // TODO: only alloc if f(x) != x
- } catch {
- case ex: Exception =>
- new ControlContext((k: A1 => B, thr: Exception => B) => thr(ex).asInstanceOf[C], null.asInstanceOf[A1])
- }
- else
- new ControlContext({ (k: A1 => B, thr: Exception => B) =>
- fun( { (x:A) =>
- var done = false
- try {
- val res = f(x)
- done = true
- k(res)
- } catch {
- case ex: Exception if !done =>
- thr(ex)
- }
- }, thr)
- }, null.asInstanceOf[A1])
- }
-
-
- // it would be nice if @inline would turn the trivial path into a tail call.
- // unfortunately it doesn't, so we do it ourselves in SelectiveCPSTransform
-
- /**
- * Maps and flattens this `ControlContext` with another `ControlContext` generated from the current state.
- * @note The resulting comuptation is still the type `C`.
- * @tparam A1 The new type of the contained state.
- * @tparam B1 The new type of the state after the stored continuation has executed.
- * @tparam C1 The result type of the nested `ControlContext`. Because the nested `ControlContext` is executed within
- * the outer `ControlContext`, this type must `>: B` so that the resulting nested computation can be fed through
- * the current continuation.
- * @param f A transformation function from the current state to a nested `ControlContext`.
- * @return The transformed `ControlContext`.
- */
- @noinline final def flatMap[A1,B1,C1<:B](f: (A => ControlContext[A1,B1,C1])): ControlContext[A1,B1,C] = {
- if (fun eq null)
- try {
- f(x).asInstanceOf[ControlContext[A1,B1,C]]
- } catch {
- case ex: Exception =>
- new ControlContext((k: A1 => B1, thr: Exception => B1) => thr(ex).asInstanceOf[C], null.asInstanceOf[A1])
- }
- else
- new ControlContext({ (k: A1 => B1, thr: Exception => B1) =>
- fun( { (x:A) =>
- var done = false
- try {
- val ctxR = f(x)
- done = true
- val res: C1 = ctxR.foreachFull(k, thr) // => B1
- res
- } catch {
- case ex: Exception if !done =>
- thr(ex).asInstanceOf[B] // => B NOTE: in general this is unsafe!
- } // However, the plugin will not generate offending code
- }, thr.asInstanceOf[Exception=>B]) // => B
- }, null.asInstanceOf[A1])
- }
-
- /**
- * Runs the computation against the state stored in this `ControlContext`.
- * @param f the computation that modifies the current state of the context.
- * @note This method could throw exceptions from the computations.
- */
- final def foreach(f: A => B) = foreachFull(f, throw _)
-
- def foreachFull(f: A => B, g: Exception => B): C = {
- if (fun eq null)
- f(x).asInstanceOf[C]
- else
- fun(f, g)
- }
-
- /** @return true if this context only stores a state value and not any deferred computation. */
- final def isTrivial = fun eq null
- /** @return The current state value. */
- final def getTrivialValue = x.asInstanceOf[A]
-
- // need filter or other functions?
-
- final def flatMapCatch[A1>:A,B1<:B,C1>:C<:B1](pf: PartialFunction[Exception, ControlContext[A1,B1,C1]]): ControlContext[A1,B1,C1] = { // called by codegen from SelectiveCPSTransform
- if (fun eq null)
- this
- else {
- val fun1 = (ret1: A1 => B1, thr1: Exception => B1) => {
- val thr: Exception => B1 = { t: Exception =>
- var captureExceptions = true
- try {
- if (pf.isDefinedAt(t)) {
- val cc1 = pf(t)
- captureExceptions = false
- cc1.foreachFull(ret1, thr1) // Throw => B
- } else {
- captureExceptions = false
- thr1(t) // Throw => B1
- }
- } catch {
- case t1: Exception if captureExceptions => thr1(t1) // => E2
- }
- }
- fun(ret1, thr)// fun(ret1, thr) // => B
- }
- new ControlContext(fun1, null.asInstanceOf[A1])
- }
- }
-
- final def mapFinally(f: () => Unit): ControlContext[A,B,C] = { // called in code generated by SelectiveCPSTransform
- if (fun eq null) {
- try {
- f()
- this
- } catch {
- case ex: Exception =>
- new ControlContext((k: A => B, thr: Exception => B) => thr(ex).asInstanceOf[C], null.asInstanceOf[A])
- }
- } else {
- val fun1 = (ret1: A => B, thr1: Exception => B) => {
- val ret: A => B = { x: A =>
- var captureExceptions = true
- try {
- f()
- captureExceptions = false
- ret1(x)
- } catch {
- case t1: Exception if captureExceptions => thr1(t1)
- }
- }
- val thr: Exception => B = { t: Exception =>
- var captureExceptions = true
- try {
- f()
- captureExceptions = false
- thr1(t)
- } catch {
- case t1: Exception if captureExceptions => thr1(t1)
- }
- }
- fun(ret, thr1)
- }
- new ControlContext(fun1, null.asInstanceOf[A])
- }
- }
-
-}
diff --git a/src/continuations/library/scala/util/continuations/package.scala b/src/continuations/library/scala/util/continuations/package.scala
deleted file mode 100644
index 573fae85e7..0000000000
--- a/src/continuations/library/scala/util/continuations/package.scala
+++ /dev/null
@@ -1,187 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2010-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.util
-
-/* TODO: better documentation of return-type modification.
- * (Especially what means "Illegal answer type modification: ... andThen ...")
- */
-
-/**
- * Delimited continuations are a feature for modifying the usual control flow
- * of a program. To use continuations, provide the option `-P:continuations:enable`
- * to the Scala compiler or REPL to activate the compiler plugin.
- *
- * Below is an example of using continuations to suspend execution while awaiting
- * user input. Similar facilities are used in so-called continuation-based web frameworks.
- *
- * {{{
- * def go =
- * reset {
- * println("Welcome!")
- * val first = ask("Please give me a number")
- * val second = ask("Please enter another number")
- * printf("The sum of your numbers is: %d\n", first + second)
- * }
- * }}}
- *
- * The `reset` is provided by this package and delimits the extent of the
- * transformation. The `ask` is a function that will be defined below. Its
- * effect is to issue a prompt and then suspend execution awaiting user input.
- * Once the user provides an input value, execution of the suspended block
- * resumes.
- *
- * {{{
- * val sessions = new HashMap[UUID, Int=>Unit]
- * def ask(prompt: String): Int @cps[Unit] =
- * shift {
- * k: (Int => Unit) => {
- * val id = uuidGen
- * printf("%s\nrespond with: submit(0x%x, ...)\n", prompt, id)
- * sessions += id -> k
- * }
- * }
- * }}}
- *
- * The type of `ask` includes a `@cps` annotation which drives the transformation.
- * The type signature `Int @cps[Unit]` means that `ask` should be used in a
- * context requiring an `Int`, but actually it will suspend and return `Unit`.
- *
- * The computation leading up to the first `ask` is executed normally. The
- * remainder of the reset block is wrapped into a closure that is passed as
- * the parameter `k` to the `shift` function, which can then decide whether
- * and how to execute the continuation. In this example, the continuation is
- * stored in a sessions map for later execution. This continuation includes a
- * second call to `ask`, which is treated likewise once the execution resumes.
- *
- * <h2>CPS Annotation</h2>
- *
- * The aforementioned `@cps[A]` annotation is an alias for the more general
- * `@cpsParam[B,C]` where `B=C`. The type `A @cpsParam[B,C]` describes a term
- * which yields a value of type `A` within an evaluation context producing a
- * value of type `B`. After the CPS transformation, this return type is
- * modified to `C`.
- *
- * The `@cpsParam` annotations are introduced by `shift` blocks, and propagate
- * via the return types to the dynamically enclosing context. The propagation
- * stops upon reaching a `reset` block.
- */
-
-package object continuations {
-
- /** An annotation that denotes a type is part of a continuation context.
- * `@cps[A]` is shorthand for `cpsParam[A,A]`.
- * @tparam A The return type of the continuation context.
- */
- type cps[A] = cpsParam[A,A]
-
- /** An annotation that denotes a type is part of a side effecting continuation context.
- * `@suspendable` is shorthand notation for `@cpsParam[Unit,Unit]` or `@cps[Unit]`.
- */
- type suspendable = cps[Unit]
-
- /**
- * The `shift` function captures the remaining computation in a `reset` block
- * and passes it to a closure provided by the user.
- *
- * For example:
- * {{{
- * reset {
- * shift { (k: Int => Int) => k(5) } + 1
- * }
- * }}}
- *
- * In this example, `shift` is used in the expression `shift ... + 1`.
- * The compiler will alter this expression so that the call
- * to `shift` becomes a parameter to a function, creating something like:
- * {{{
- * { (k: Int => Int) => k(5) } apply { _ + 1 }
- * }}}
- * The result of this expression is 6.
- *
- * There can be more than one `shift` call in a `reset` block. Each call
- * to `shift` can alter the return type of expression within the reset block,
- * but will not change the return type of the entire `reset { block }`
- * expression.
- *
- * @param fun A function where
- * - The parameter is the remainder of computation within the current
- * `reset` block. This is passed as a function `A => B`.
- * - The return is the return value of the `ControlContext` which is
- * generated from this inversion.
- * @note Must be invoked in the context of a call to `reset` This context
- * may not be far up the stack, but a call to reset is needed to
- * eventually remove the `@cps` annotations from types.
- */
- def shift[A,B,C](fun: (A => B) => C): A @cpsParam[B,C] = {
- throw new NoSuchMethodException("this code has to be compiled with the Scala continuations plugin enabled")
- }
- /** Creates a context for continuations captured within the argument closure
- * of this `reset` call and returns the result of the entire transformed
- * computation. Within an expression of the form `reset { block }`,
- * the closure expression (`block`) will be modified such that at each
- * call to `shift` the remainder of the expression is transformed into a
- * function to be passed into the shift.
- * @return The result of a block of code that uses `shift` to capture continuations.
- */
- def reset[A,C](ctx: =>(A @cpsParam[A,C])): C = {
- val ctxR = reify[A,A,C](ctx)
- if (ctxR.isTrivial)
- ctxR.getTrivialValue.asInstanceOf[C]
- else
- ctxR.foreach((x:A) => x)
- }
-
- def reset0[A](ctx: =>(A @cpsParam[A,A])): A = reset(ctx)
-
- def run[A](ctx: =>(Any @cpsParam[Unit,A])): A = {
- val ctxR = reify[Any,Unit,A](ctx)
- if (ctxR.isTrivial)
- ctxR.getTrivialValue.asInstanceOf[A]
- else
- ctxR.foreach((x:Any) => ())
- }
-
-
- // methods below are primarily implementation details and are not
- // needed frequently in client code
-
- def shiftUnit0[A,B](x: A): A @cpsParam[B,B] = {
- shiftUnit[A,B,B](x)
- }
-
- def shiftUnit[A,B,C>:B](x: A): A @cpsParam[B,C] = {
- throw new NoSuchMethodException("this code has to be compiled with the Scala continuations plugin enabled")
- }
-
- /** This method converts from the sugared `A @cpsParam[B,C]` type to the desugared
- * `ControlContext[A,B,C]` type. The underlying data is not changed.
- */
- def reify[A,B,C](ctx: =>(A @cpsParam[B,C])): ControlContext[A,B,C] = {
- throw new NoSuchMethodException("this code has to be compiled with the Scala continuations plugin enabled")
- }
-
- def shiftUnitR[A,B](x: A): ControlContext[A,B,B] = { // called in code generated by SelectiveCPSTransform
- new ControlContext[A, B, B](null, x)
- }
-
- /**
- * Captures a computation into a `ControlContext`.
- * @param fun The function which accepts the inverted computation and returns
- * a final result.
- * @see shift
- */
- def shiftR[A,B,C](fun: (A => B) => C): ControlContext[A,B,C] = { // called in code generated by SelectiveCPSTransform
- new ControlContext((f:A=>B,g:Exception=>B) => fun(f), null.asInstanceOf[A])
- }
-
- def reifyR[A,B,C](ctx: => ControlContext[A,B,C]): ControlContext[A,B,C] = { // called in code generated by SelectiveCPSTransform
- ctx
- }
-
-}
diff --git a/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala b/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala
deleted file mode 100644
index 3963447de3..0000000000
--- a/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala
+++ /dev/null
@@ -1,520 +0,0 @@
-// $Id$
-
-package scala.tools.selectivecps
-
-import scala.tools.nsc.{ Global, Mode }
-import scala.tools.nsc.MissingRequirementError
-
-abstract class CPSAnnotationChecker extends CPSUtils {
- val global: Global
- import global._
- import analyzer.{AnalyzerPlugin, Typer}
- import definitions._
-
- //override val verbose = true
- @inline override final def vprintln(x: =>Any): Unit = if (verbose) println(x)
-
- /**
- * Checks whether @cps annotations conform
- */
- object checker extends AnnotationChecker {
- private[CPSAnnotationChecker] def addPlusMarker(tp: Type) = tp withAnnotation newPlusMarker()
- private[CPSAnnotationChecker] def addMinusMarker(tp: Type) = tp withAnnotation newMinusMarker()
-
- private[CPSAnnotationChecker] def cleanPlus(tp: Type) =
- removeAttribs(tp, MarkerCPSAdaptPlus, MarkerCPSTypes)
- private[CPSAnnotationChecker] def cleanPlusWith(tp: Type)(newAnnots: AnnotationInfo*) =
- cleanPlus(tp) withAnnotations newAnnots.toList
-
- /** Check annotations to decide whether tpe1 <:< tpe2 */
- def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
- if (!cpsEnabled) return true
-
- vprintln("check annotations: " + tpe1 + " <:< " + tpe2)
-
- // Nothing is least element, but Any is not the greatest
- if (tpe1.typeSymbol eq NothingClass)
- return true
-
- val annots1 = cpsParamAnnotation(tpe1)
- val annots2 = cpsParamAnnotation(tpe2)
-
- // @plus and @minus should only occur at the left, and never together
- // TODO: insert check
-
- // @minus @cps is the same as no annotations
- if (hasMinusMarker(tpe1))
- return annots2.isEmpty
-
- // to handle answer type modification, we must make @plus <:< @cps
- if (hasPlusMarker(tpe1) && annots1.isEmpty)
- return true
-
- // @plus @cps will fall through and compare the @cps type args
- // @cps parameters must match exactly
- if ((annots1 corresponds annots2)(_.atp <:< _.atp))
- return true
-
- // Need to handle uninstantiated type vars specially:
-
- // g map (x => x) with expected type List[Int] @cps
- // results in comparison ?That <:< List[Int] @cps
-
- // Instantiating ?That to an annotated type would fail during
- // transformation.
-
- // Instead we force-compare tpe1 <:< tpe2.withoutAnnotations
- // to trigger instantiation of the TypeVar to the base type
-
- // This is a bit unorthodox (we're only supposed to look at
- // annotations here) but seems to work.
-
- if (!annots2.isEmpty && !tpe1.isGround)
- return tpe1 <:< tpe2.withoutAnnotations
-
- false
- }
-
- /** Refine the computed least upper bound of a list of types.
- * All this should do is add annotations. */
- override def annotationsLub(tpe: Type, ts: List[Type]): Type = {
- if (!cpsEnabled) return tpe
-
- val annots1 = cpsParamAnnotation(tpe)
- val annots2 = ts flatMap cpsParamAnnotation
-
- if (annots2.nonEmpty) {
- val cpsLub = newMarker(global.lub(annots1:::annots2 map (_.atp)))
- val tpe1 = if (annots1.nonEmpty) removeAttribs(tpe, MarkerCPSTypes) else tpe
- tpe1.withAnnotation(cpsLub)
- }
- else tpe
- }
-
- /** Refine the bounds on type parameters to the given type arguments. */
- override def adaptBoundsToAnnotations(bounds: List[TypeBounds], tparams: List[Symbol], targs: List[Type]): List[TypeBounds] = {
- if (!cpsEnabled) return bounds
-
- val anyAtCPS = newCpsParamsMarker(NothingTpe, AnyTpe)
- if (isFunctionType(tparams.head.owner.tpe_*) || isPartialFunctionType(tparams.head.owner.tpe_*)) {
- vprintln("function bound: " + tparams.head.owner.tpe + "/"+bounds+"/"+targs)
- if (hasCpsParamTypes(targs.last))
- bounds.reverse match {
- case res::b if !hasCpsParamTypes(res.hi) =>
- (TypeBounds(res.lo, res.hi.withAnnotation(anyAtCPS))::b).reverse
- case _ => bounds
- }
- else
- bounds
- }
- else if (tparams.head.owner == ByNameParamClass) {
- vprintln("byname bound: " + tparams.head.owner.tpe + "/"+bounds+"/"+targs)
- val TypeBounds(lo, hi) = bounds.head
- if (hasCpsParamTypes(targs.head) && !hasCpsParamTypes(hi))
- TypeBounds(lo, hi withAnnotation anyAtCPS) :: Nil
- else bounds
- } else
- bounds
- }
- }
-
- object plugin extends AnalyzerPlugin {
-
- import checker._
-
- override def canAdaptAnnotations(tree: Tree, typer: Typer, mode: Mode, pt: Type): Boolean = {
- if (!cpsEnabled) return false
- vprintln("can adapt annotations? " + tree + " / " + tree.tpe + " / " + mode + " / " + pt)
-
- val annots1 = cpsParamAnnotation(tree.tpe)
- val annots2 = cpsParamAnnotation(pt)
-
- if (mode.inPatternMode) {
- //println("can adapt pattern annotations? " + tree + " / " + tree.tpe + " / " + Integer.toHexString(mode) + " / " + pt)
- if (!annots1.isEmpty) {
- return true
- }
- }
-
-/*
- // not precise enough -- still relying on addAnnotations to remove things from ValDef symbols
- if (mode.inAllModes(TYPEmode | BYVALmode)) {
- if (!annots1.isEmpty) {
- return true
- }
- }
-*/
-
-/*
- this interferes with overloading resolution
- if (mode.inByValMode && tree.tpe <:< pt) {
- vprintln("already compatible, can't adapt further")
- return false
- }
-*/
- if (mode.inExprMode) {
- if ((annots1 corresponds annots2)(_.atp <:< _.atp)) {
- vprintln("already same, can't adapt further")
- false
- } else if (annots1.isEmpty && !annots2.isEmpty && !mode.inByValMode) {
- //println("can adapt annotations? " + tree + " / " + tree.tpe + " / " + Integer.toHexString(mode) + " / " + pt)
- if (!hasPlusMarker(tree.tpe)) {
- // val base = tree.tpe <:< removeAllCPSAnnotations(pt)
- // val known = global.analyzer.isFullyDefined(pt)
- // println(same + "/" + base + "/" + known)
- //val same = annots2 forall { case AnnotationInfo(atp: TypeRef, _, _) => atp.typeArgs(0) =:= atp.typeArgs(1) }
- // TBD: use same or not?
- //if (same) {
- vprintln("yes we can!! (unit)")
- true
- //}
- } else false
- } else if (!hasPlusMarker(tree.tpe) && annots1.isEmpty && !annots2.isEmpty && typer.context.inReturnExpr) {
- vprintln("checking enclosing method's result type without annotations")
- tree.tpe <:< pt.withoutAnnotations
- } else if (!hasMinusMarker(tree.tpe) && !annots1.isEmpty && mode.inByValMode) {
- val optCpsTypes: Option[(Type, Type)] = cpsParamTypes(tree.tpe)
- val optExpectedCpsTypes: Option[(Type, Type)] = cpsParamTypes(pt)
- if (optCpsTypes.isEmpty || optExpectedCpsTypes.isEmpty) {
- vprintln("yes we can!! (byval)")
- true
- } else { // check cps param types
- val cpsTpes = optCpsTypes.get
- val cpsPts = optExpectedCpsTypes.get
- // class cpsParam[-B,+C], therefore:
- cpsPts._1 <:< cpsTpes._1 && cpsTpes._2 <:< cpsPts._2
- }
- } else false
- } else false
- }
-
- override def adaptAnnotations(tree: Tree, typer: Typer, mode: Mode, pt: Type): Tree = {
- if (!cpsEnabled) return tree
-
- vprintln("adapt annotations " + tree + " / " + tree.tpe + " / " + mode + " / " + pt)
-
- val annotsTree = cpsParamAnnotation(tree.tpe)
- val annotsExpected = cpsParamAnnotation(pt)
- def isMissingExpectedAnnots = annotsTree.isEmpty && annotsExpected.nonEmpty
-
- // not sure I rephrased this comment correctly:
- // replacing `mode.inPatternMode` in the condition below by `mode.inPatternMode || mode.inAllModes(TYPEmode | BYVALmode)`
- // doesn't work correctly -- still relying on addAnnotations to remove things from ValDef symbols
- if (mode.inPatternMode && annotsTree.nonEmpty) tree modifyType removeAllCPSAnnotations
- else if (mode.typingExprNotValue && !hasPlusMarker(tree.tpe) && isMissingExpectedAnnots) { // shiftUnit
- // add a marker annotation that will make tree.tpe behave as pt, subtyping wise
- // tree will look like having any possible annotation
- //println("adapt annotations " + tree + " / " + tree.tpe + " / " + Integer.toHexString(mode) + " / " + pt)
-
- // CAVEAT:
- // for monomorphic answer types we want to have @plus @cps (for better checking)
- // for answer type modification we want to have only @plus (because actual answer type may differ from pt)
-
- val res = tree modifyType (_ withAnnotations newPlusMarker() :: annotsExpected) // needed for #1807
- vprintln("adapted annotations (not by val) of " + tree + " to " + res.tpe)
- res
- } else if (mode.typingExprByValue && !hasMinusMarker(tree.tpe) && annotsTree.nonEmpty) { // dropping annotation
- // add a marker annotation that will make tree.tpe behave as pt, subtyping wise
- // tree will look like having no annotation
- val res = tree modifyType addMinusMarker
- vprintln("adapted annotations (by val) of " + tree + " to " + res.tpe)
- res
- } else if (typer.context.inReturnExpr && !hasPlusMarker(tree.tpe) && isMissingExpectedAnnots) {
- // add a marker annotation that will make tree.tpe behave as pt, subtyping wise
- // tree will look like having any possible annotation
-
- // note 1: we are only adding a plus marker if the method's result type is a cps type
- // (annotsExpected.nonEmpty == cpsParamAnnotation(pt).nonEmpty)
- // note 2: we are not adding the expected cps annotations, since they will be added
- // by adaptTypeOfReturn (see below).
- val res = tree modifyType (_ withAnnotation newPlusMarker())
- vprintln("adapted annotations (return) of " + tree + " to " + res.tpe)
- res
- } else tree
- }
-
- /** Returns an adapted type for a return expression if the method's result type (pt) is a CPS type.
- * Otherwise, it returns the `default` type (`typedReturn` passes `NothingTpe`).
- *
- * A return expression in a method that has a CPS result type is an error unless the return
- * is in tail position. Therefore, we are making sure that only the types of return expressions
- * are adapted which will either be removed, or lead to an error.
- */
- override def pluginsTypedReturn(default: Type, typer: Typer, tree: Return, pt: Type): Type = {
- val expr = tree.expr
- // only adapt if method's result type (pt) is cps type
- val annots = cpsParamAnnotation(pt)
- if (annots.nonEmpty) {
- // return type of `expr` without plus marker, but only if it doesn't have other cps annots
- if (hasPlusMarker(expr.tpe) && !hasCpsParamTypes(expr.tpe))
- expr.setType(removeAttribs(expr.tpe, MarkerCPSAdaptPlus))
- expr.tpe
- } else default
- }
-
- def updateAttributesFromChildren(tpe: Type, childAnnots: List[AnnotationInfo], byName: List[Tree]): Type = {
- tpe match {
- // Would need to push annots into each alternative of overloaded type
- // But we can't, since alternatives aren't types but symbols, which we
- // can't change (we'd be affecting symbols globally)
- /*
- case OverloadedType(pre, alts) =>
- OverloadedType(pre, alts.map((sym: Symbol) => updateAttributes(pre.memberType(sym), annots)))
- */
- case OverloadedType(pre, alts) => tpe //reconstruct correct annotations later
- case MethodType(params, restpe) => tpe
- case PolyType(params, restpe) => tpe
- case _ =>
- assert(childAnnots forall (_ matches MarkerCPSTypes), childAnnots)
- /*
- [] + [] = []
- plus + [] = plus
- cps + [] = cps
- plus cps + [] = plus cps
- minus cps + [] = minus cps
- synth cps + [] = synth cps // <- synth on left - does it happen?
-
- [] + cps = cps
- plus + cps = synth cps
- cps + cps = cps! <- lin
- plus cps + cps = synth cps! <- unify
- minus cps + cps = minus cps! <- lin
- synth cps + cps = synth cps! <- unify
- */
-
- val plus = hasPlusMarker(tpe) || (
- hasCpsParamTypes(tpe)
- && byName.nonEmpty
- && (byName forall (t => hasPlusMarker(t.tpe)))
- )
-
- // move @plus annotations outward from by-name children
- if (childAnnots.isEmpty) return {
- if (plus) { // @plus or @plus @cps
- byName foreach (_ modifyType cleanPlus)
- addPlusMarker(tpe)
- }
- else tpe
- }
-
- val annots1 = cpsParamAnnotation(tpe)
-
- if (annots1.isEmpty) { // nothing or @plus
- cleanPlusWith(tpe)(newSynthMarker(), linearize(childAnnots))
- }
- else {
- val annot1 = single(annots1)
- if (plus) { // @plus @cps
- val annot2 = linearize(childAnnots)
-
- if (annot2.atp <:< annot1.atp) {
- try cleanPlusWith(tpe)(newSynthMarker(), annot2)
- finally byName foreach (_ modifyType cleanPlus)
- }
- else throw new TypeError(annot2 + " is not a subtype of " + annot1)
- }
- else if (hasSynthMarker(tpe)) { // @synth @cps
- val annot2 = linearize(childAnnots)
- if (annot2.atp <:< annot1.atp)
- cleanPlusWith(tpe)(annot2)
- else
- throw new TypeError(annot2 + " is not a subtype of " + annot1)
- }
- else // @cps
- cleanPlusWith(tpe)(linearize(childAnnots:::annots1))
- }
- }
- }
-
- def transArgList(fun: Tree, args: List[Tree]): List[List[Tree]] = {
- val formals = fun.tpe.paramTypes
- val overshoot = args.length - formals.length
-
- for ((a,tp) <- args.zip(formals ::: List.fill(overshoot)(NoType))) yield {
- tp match {
- case TypeRef(_, ByNameParamClass, List(elemtp)) =>
- Nil // TODO: check conformance??
- case _ =>
- List(a)
- }
- }
- }
-
-
- def transStms(stms: List[Tree]): List[Tree] = stms match {
- case ValDef(mods, name, tpt, rhs)::xs =>
- rhs::transStms(xs)
- case Assign(lhs, rhs)::xs =>
- rhs::transStms(xs)
- case x::xs =>
- x::transStms(xs)
- case Nil =>
- Nil
- }
-
- def single(xs: List[AnnotationInfo]) = xs match {
- case List(x) => x
- case _ =>
- global.globalError("not a single cps annotation: " + xs)
- xs(0)
- }
-
- def emptyOrSingleList(xs: List[AnnotationInfo]) = if (xs.isEmpty) Nil else List(single(xs))
-
- def transChildrenInOrder(tree: Tree, tpe: Type, childTrees: List[Tree], byName: List[Tree]) = {
- def inspect(t: Tree): List[AnnotationInfo] = {
- if (t.tpe eq null) Nil else {
- val extra: List[AnnotationInfo] = t.tpe match {
- case _: MethodType | _: PolyType | _: OverloadedType =>
- // method types, poly types and overloaded types do not obtain cps annotions by propagation
- // need to reconstruct transitively from their children.
- t match {
- case Select(qual, name) => inspect(qual)
- case Apply(fun, args) => (fun::(transArgList(fun,args).flatten)) flatMap inspect
- case TypeApply(fun, args) => (fun::(transArgList(fun,args).flatten)) flatMap inspect
- case _ => Nil
- }
- case _ => Nil
- }
-
- val types = cpsParamAnnotation(t.tpe)
- // TODO: check that it has been adapted and if so correctly
- extra ++ emptyOrSingleList(types)
- }
- }
- val children = childTrees flatMap inspect
-
- val newtpe = updateAttributesFromChildren(tpe, children, byName)
-
- if (!newtpe.annotations.isEmpty)
- vprintln("[checker] inferred " + tree + " / " + tpe + " ===> "+ newtpe)
-
- newtpe
- }
-
- /** Modify the type that has thus far been inferred
- * for a tree. All this should do is add annotations. */
-
- override def pluginsTyped(tpe: Type, typer: Typer, tree: Tree, mode: Mode, pt: Type): Type = {
- if (!cpsEnabled) {
- val report = try hasCpsParamTypes(tpe) catch { case _: MissingRequirementError => false }
- if (report)
- global.reporter.error(tree.pos, "this code must be compiled with the Scala continuations plugin enabled")
-
- return tpe
- }
-
-// if (tree.tpe.hasAnnotation(MarkerCPSAdaptPlus))
-// println("addAnnotation " + tree + "/" + tpe)
-
- tree match {
-
- case Apply(fun @ Select(qual, name), args) if fun.isTyped =>
-
- // HACK: With overloaded methods, fun will never get annotated. This is because
- // the 'overloaded' type gets annotated, but not the alternatives (among which
- // fun's type is chosen)
-
- vprintln("[checker] checking select apply " + tree + "/" + tpe)
-
- transChildrenInOrder(tree, tpe, qual::(transArgList(fun, args).flatten), Nil)
-
- case Apply(TypeApply(fun @ Select(qual, name), targs), args) if fun.isTyped => // not trigge
-
- vprintln("[checker] checking select apply type-apply " + tree + "/" + tpe)
-
- transChildrenInOrder(tree, tpe, qual::(transArgList(fun, args).flatten), Nil)
-
- case TypeApply(fun @ Select(qual, name), args) if fun.isTyped =>
- def stripNullaryMethodType(tp: Type) = tp match { case NullaryMethodType(restpe) => restpe case tp => tp }
- vprintln("[checker] checking select type-apply " + tree + "/" + tpe)
-
- transChildrenInOrder(tree, stripNullaryMethodType(tpe), List(qual, fun), Nil)
-
- case Apply(fun, args) if fun.isTyped =>
-
- vprintln("[checker] checking unknown apply " + tree + "/" + tpe)
-
- transChildrenInOrder(tree, tpe, fun::(transArgList(fun, args).flatten), Nil)
-
- case TypeApply(fun, args) =>
-
- vprintln("[checker] checking unknown type apply " + tree + "/" + tpe)
-
- transChildrenInOrder(tree, tpe, List(fun), Nil)
-
- case Select(qual, name) if qual.isTyped =>
-
- vprintln("[checker] checking select " + tree + "/" + tpe)
-
- // straightforward way is problematic (see select.scala and Test2.scala)
- // transChildrenInOrder(tree, tpe, List(qual), Nil)
-
- // the problem is that qual may be of type OverloadedType (or MethodType) and
- // we cannot safely annotate these. so we just ignore these cases and
- // clean up later in the Apply/TypeApply trees.
-
- if (hasCpsParamTypes(qual.tpe)) {
- // however there is one special case:
- // if it's a method without parameters, just apply it. normally done in adapt, but
- // we have to do it here so we don't lose the cps information (wouldn't trigger our
- // adapt and there is no Apply/TypeApply created)
- tpe match {
- case NullaryMethodType(restpe) =>
- //println("yep: " + restpe + "," + restpe.getClass)
- transChildrenInOrder(tree, restpe, List(qual), Nil)
- case _ : PolyType => tpe
- case _ : MethodType => tpe
- case _ : OverloadedType => tpe
- case _ =>
- transChildrenInOrder(tree, tpe, List(qual), Nil)
- }
- } else
- tpe
-
- case If(cond, thenp, elsep) =>
- transChildrenInOrder(tree, tpe, List(cond), List(thenp, elsep))
-
- case Match(select, cases) =>
- transChildrenInOrder(tree, tpe, List(select), cases:::(cases map { case CaseDef(_, _, body) => body }))
-
- case Try(block, catches, finalizer) =>
- val tpe1 = transChildrenInOrder(tree, tpe, Nil, block::catches:::(catches map { case CaseDef(_, _, body) => body }))
-
- val annots = cpsParamAnnotation(tpe1)
- if (annots.nonEmpty) {
- val ann = single(annots)
- val (atp0, atp1) = annTypes(ann)
- if (!(atp0 =:= atp1))
- throw new TypeError("only simple cps types allowed in try/catch blocks (found: " + tpe1 + ")")
- if (!finalizer.isEmpty) // no finalizers allowed. see explanation in SelectiveCPSTransform
- reporter.error(tree.pos, "try/catch blocks that use continuations cannot have finalizers")
- }
- tpe1
-
- case Block(stms, expr) =>
- // if any stm has annotation, so does block
- transChildrenInOrder(tree, tpe, transStms(stms), List(expr))
-
- case ValDef(mods, name, tpt, rhs) =>
- vprintln("[checker] checking valdef " + name + "/"+tpe+"/"+tpt+"/"+tree.symbol.tpe)
- // ValDef symbols must *not* have annotations!
- // lazy vals are currently not supported
- // but if we erase here all annotations, compiler will complain only
- // when generating bytecode.
- // This way lazy vals will be reported as unsupported feature later rather than weird type error.
- if (hasAnswerTypeAnn(tree.symbol.info) && !mods.isLazy) { // is it okay to modify sym here?
- vprintln("removing annotation from sym " + tree.symbol + "/" + tree.symbol.tpe + "/" + tpt)
- tpt modifyType removeAllCPSAnnotations
- tree.symbol modifyInfo removeAllCPSAnnotations
- }
- tpe
-
- case _ =>
- tpe
- }
-
-
- }
- }
-}
diff --git a/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala b/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
deleted file mode 100644
index 98d0695865..0000000000
--- a/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
+++ /dev/null
@@ -1,137 +0,0 @@
-// $Id$
-
-package scala.tools.selectivecps
-
-import scala.tools.nsc.Global
-
-trait CPSUtils {
- val global: Global
- import global._
-
- val cpsEnabled: Boolean
- val verbose: Boolean = System.getProperty("cpsVerbose", "false") == "true"
- def vprintln(x: =>Any): Unit = if (verbose) println(x)
-
- object cpsNames {
- val catches = newTermName("$catches")
- val ex = newTermName("$ex")
- val flatMapCatch = newTermName("flatMapCatch")
- val getTrivialValue = newTermName("getTrivialValue")
- val isTrivial = newTermName("isTrivial")
- val reify = newTermName("reify")
- val reifyR = newTermName("reifyR")
- val shift = newTermName("shift")
- val shiftR = newTermName("shiftR")
- val shiftSuffix = newTermName("$shift")
- val shiftUnit0 = newTermName("shiftUnit0")
- val shiftUnit = newTermName("shiftUnit")
- val shiftUnitR = newTermName("shiftUnitR")
- }
-
- lazy val MarkerCPSSym = rootMirror.getRequiredClass("scala.util.continuations.cpsSym")
- lazy val MarkerCPSTypes = rootMirror.getRequiredClass("scala.util.continuations.cpsParam")
- lazy val MarkerCPSSynth = rootMirror.getRequiredClass("scala.util.continuations.cpsSynth")
- lazy val MarkerCPSAdaptPlus = rootMirror.getRequiredClass("scala.util.continuations.cpsPlus")
- lazy val MarkerCPSAdaptMinus = rootMirror.getRequiredClass("scala.util.continuations.cpsMinus")
-
- lazy val Context = rootMirror.getRequiredClass("scala.util.continuations.ControlContext")
- lazy val ModCPS = rootMirror.getPackage("scala.util.continuations")
-
- lazy val MethShiftUnit = definitions.getMember(ModCPS, cpsNames.shiftUnit)
- lazy val MethShiftUnit0 = definitions.getMember(ModCPS, cpsNames.shiftUnit0)
- lazy val MethShiftUnitR = definitions.getMember(ModCPS, cpsNames.shiftUnitR)
- lazy val MethShift = definitions.getMember(ModCPS, cpsNames.shift)
- lazy val MethShiftR = definitions.getMember(ModCPS, cpsNames.shiftR)
- lazy val MethReify = definitions.getMember(ModCPS, cpsNames.reify)
- lazy val MethReifyR = definitions.getMember(ModCPS, cpsNames.reifyR)
-
- lazy val allCPSAnnotations = List(MarkerCPSSym, MarkerCPSTypes, MarkerCPSSynth,
- MarkerCPSAdaptPlus, MarkerCPSAdaptMinus)
-
- // TODO - needed? Can these all use the same annotation info?
- protected def newSynthMarker() = newMarker(MarkerCPSSynth)
- protected def newPlusMarker() = newMarker(MarkerCPSAdaptPlus)
- protected def newMinusMarker() = newMarker(MarkerCPSAdaptMinus)
- protected def newMarker(tpe: Type): AnnotationInfo = AnnotationInfo marker tpe
- protected def newMarker(sym: Symbol): AnnotationInfo = AnnotationInfo marker sym.tpe
-
- protected def newCpsParamsMarker(tp1: Type, tp2: Type) =
- newMarker(appliedType(MarkerCPSTypes, tp1, tp2))
-
- // annotation checker
-
- protected def annTypes(ann: AnnotationInfo): (Type, Type) = {
- val tp0 :: tp1 :: Nil = ann.atp.dealiasWiden.typeArgs
- ((tp0, tp1))
- }
- protected def hasMinusMarker(tpe: Type) = tpe hasAnnotation MarkerCPSAdaptMinus
- protected def hasPlusMarker(tpe: Type) = tpe hasAnnotation MarkerCPSAdaptPlus
- protected def hasSynthMarker(tpe: Type) = tpe hasAnnotation MarkerCPSSynth
- protected def hasCpsParamTypes(tpe: Type) = tpe hasAnnotation MarkerCPSTypes
- protected def cpsParamTypes(tpe: Type) = tpe getAnnotation MarkerCPSTypes map annTypes
-
- def filterAttribs(tpe:Type, cls:Symbol) =
- tpe.annotations filter (_ matches cls)
-
- def removeAttribs(tpe: Type, classes: Symbol*) =
- tpe filterAnnotations (ann => !(classes exists (ann matches _)))
-
- def removeAllCPSAnnotations(tpe: Type) = removeAttribs(tpe, allCPSAnnotations:_*)
-
- def cpsParamAnnotation(tpe: Type) = filterAttribs(tpe, MarkerCPSTypes)
-
- def linearize(ann: List[AnnotationInfo]): AnnotationInfo = {
- ann reduceLeft { (a, b) =>
- val (u0,v0) = annTypes(a)
- val (u1,v1) = annTypes(b)
- // vprintln("check lin " + a + " andThen " + b)
-
- if (v1 <:< u0)
- newCpsParamsMarker(u1, v0)
- else
- throw new TypeError("illegal answer type modification: " + a + " andThen " + b)
- }
- }
-
- // anf transform
-
- def getExternalAnswerTypeAnn(tp: Type) = {
- cpsParamTypes(tp) orElse {
- if (hasPlusMarker(tp))
- global.warning("trying to instantiate type " + tp + " to unknown cps type")
- None
- }
- }
-
- def getAnswerTypeAnn(tp: Type): Option[(Type, Type)] =
- cpsParamTypes(tp) filterNot (_ => hasPlusMarker(tp))
-
- def hasAnswerTypeAnn(tp: Type) =
- hasCpsParamTypes(tp) && !hasPlusMarker(tp)
-
- def updateSynthFlag(tree: Tree) = { // remove annotations if *we* added them (@synth present)
- if (hasSynthMarker(tree.tpe)) {
- log("removing annotation from " + tree)
- tree modifyType removeAllCPSAnnotations
- } else
- tree
- }
-
- type CPSInfo = Option[(Type,Type)]
-
- def linearize(a: CPSInfo, b: CPSInfo)(implicit unit: CompilationUnit, pos: Position): CPSInfo = {
- (a,b) match {
- case (Some((u0,v0)), Some((u1,v1))) =>
- vprintln("check lin " + a + " andThen " + b)
- if (!(v1 <:< u0)) {
- unit.error(pos,"cannot change answer type in composition of cps expressions " +
- "from " + u1 + " to " + v0 + " because " + v1 + " is not a subtype of " + u0 + ".")
- throw new Exception("check lin " + a + " andThen " + b)
- }
- Some((u1,v0))
- case (Some(_), _) => a
- case (_, Some(_)) => b
- case _ => None
- }
- }
-}
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
deleted file mode 100644
index ae95a1bdac..0000000000
--- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
+++ /dev/null
@@ -1,545 +0,0 @@
-// $Id$
-
-package scala.tools.selectivecps
-
-import scala.tools.nsc.transform._
-import scala.tools.nsc.symtab._
-import scala.tools.nsc.plugins._
-
-/**
- * In methods marked @cps, explicitly name results of calls to other @cps methods
- */
-abstract class SelectiveANFTransform extends PluginComponent with Transform with
- TypingTransformers with CPSUtils {
- // inherits abstract value `global` and class `Phase` from Transform
-
- import global._ // the global environment
- import definitions._ // standard classes and methods
- import typer.atOwner // methods to type trees
-
- override def description = "ANF pre-transform for @cps"
-
- /** the following two members override abstract members in Transform */
- val phaseName: String = "selectiveanf"
-
- protected def newTransformer(unit: CompilationUnit): Transformer =
- new ANFTransformer(unit)
-
- class ANFTransformer(unit: CompilationUnit) extends TypingTransformer(unit) {
-
- implicit val _unit = unit // allow code in CPSUtils.scala to report errors
- var cpsAllowed: Boolean = false // detect cps code in places we do not handle (yet)
-
- object RemoveTailReturnsTransformer extends Transformer {
- override def transform(tree: Tree): Tree = tree match {
- case Block(stms, r @ Return(expr)) =>
- treeCopy.Block(tree, stms, expr)
-
- case Block(stms, expr) =>
- treeCopy.Block(tree, stms, transform(expr))
-
- case If(cond, r1 @ Return(thenExpr), r2 @ Return(elseExpr)) =>
- treeCopy.If(tree, cond, transform(thenExpr), transform(elseExpr))
-
- case If(cond, r1 @ Return(thenExpr), elseExpr) =>
- treeCopy.If(tree, cond, transform(thenExpr), transform(elseExpr))
-
- case If(cond, thenExpr, r2 @ Return(elseExpr)) =>
- treeCopy.If(tree, cond, transform(thenExpr), transform(elseExpr))
-
- case If(cond, thenExpr, elseExpr) =>
- treeCopy.If(tree, cond, transform(thenExpr), transform(elseExpr))
-
- case Try(block, catches, finalizer) =>
- treeCopy.Try(tree,
- transform(block),
- (catches map (t => transform(t))).asInstanceOf[List[CaseDef]],
- transform(finalizer))
-
- case CaseDef(pat, guard, r @ Return(expr)) =>
- treeCopy.CaseDef(tree, pat, guard, expr)
-
- case CaseDef(pat, guard, body) =>
- treeCopy.CaseDef(tree, pat, guard, transform(body))
-
- case Return(_) =>
- unit.error(tree.pos, "return expressions in CPS code must be in tail position")
- tree
-
- case _ =>
- super.transform(tree)
- }
- }
-
- def removeTailReturns(body: Tree): Tree = {
- // support body with single return expression
- body match {
- case Return(expr) => expr
- case _ => RemoveTailReturnsTransformer.transform(body)
- }
- }
-
- override def transform(tree: Tree): Tree = {
- if (!cpsEnabled) return tree
-
- tree match {
-
- // Maybe we should further generalize the transform and move it over
- // to the regular Transformer facility. But then, actual and required cps
- // state would need more complicated (stateful!) tracking.
-
- // Making the default case use transExpr(tree, None, None) instead of
- // calling super.transform() would be a start, but at the moment,
- // this would cause infinite recursion. But we could remove the
- // ValDef case here.
-
- case dd @ DefDef(mods, name, tparams, vparamss, tpt, rhs0) =>
- debuglog("transforming " + dd.symbol)
-
- atOwner(dd.symbol) {
- val rhs =
- if (cpsParamTypes(tpt.tpe).nonEmpty) removeTailReturns(rhs0)
- else rhs0
- val rhs1 = transExpr(rhs, None, getExternalAnswerTypeAnn(tpt.tpe))(getExternalAnswerTypeAnn(tpt.tpe).isDefined)
-
- debuglog("result "+rhs1)
- debuglog("result is of type "+rhs1.tpe)
-
- treeCopy.DefDef(dd, mods, name, transformTypeDefs(tparams), transformValDefss(vparamss),
- transform(tpt), rhs1)
- }
-
- case ff @ Function(vparams, body) =>
- debuglog("transforming anon function " + ff.symbol)
-
- atOwner(ff.symbol) {
-
- //val body1 = transExpr(body, None, getExternalAnswerTypeAnn(body.tpe))
-
- // need to special case partial functions: if expected type is @cps
- // but all cases are pure, then we would transform
- // { x => x match { case A => ... }} to
- // { x => shiftUnit(x match { case A => ... })}
- // which Uncurry cannot handle (see function6.scala)
- // thus, we push down the shiftUnit to each of the case bodies
-
- val ext = getExternalAnswerTypeAnn(body.tpe)
- val pureBody = getAnswerTypeAnn(body.tpe).isEmpty
- implicit val isParentImpure = ext.isDefined
-
- def transformPureMatch(tree: Tree, selector: Tree, cases: List[CaseDef]) = {
- val caseVals = cases map { case cd @ CaseDef(pat, guard, body) =>
- // if (!hasPlusMarker(body.tpe)) body modifyType (_ withAnnotation newPlusMarker()) // TODO: to avoid warning
- val bodyVal = transExpr(body, None, ext) // ??? triggers "cps-transformed unexpectedly" warning in transTailValue
- treeCopy.CaseDef(cd, transform(pat), transform(guard), bodyVal)
- }
- treeCopy.Match(tree, transform(selector), caseVals)
- }
-
- def transformPureVirtMatch(body: Block, selDef: ValDef, cases: List[Tree], matchEnd: Tree) = {
- val stats = transform(selDef) :: (cases map (transExpr(_, None, ext)))
- treeCopy.Block(body, stats, transExpr(matchEnd, None, ext))
- }
-
- val body1 = body match {
- case Match(selector, cases) if ext.isDefined && pureBody =>
- transformPureMatch(body, selector, cases)
-
- // virtpatmat switch
- case Block(List(selDef: ValDef), mat@Match(selector, cases)) if ext.isDefined && pureBody =>
- treeCopy.Block(body, List(transform(selDef)), transformPureMatch(mat, selector, cases))
-
- // virtpatmat
- case b@Block(matchStats@((selDef: ValDef) :: cases), matchEnd) if ext.isDefined && pureBody && (matchStats forall treeInfo.hasSynthCaseSymbol) =>
- transformPureVirtMatch(b, selDef, cases, matchEnd)
-
- // virtpatmat that stores the scrut separately -- TODO: can we eliminate this case??
- case Block(List(selDef0: ValDef), mat@Block(matchStats@((selDef: ValDef) :: cases), matchEnd)) if ext.isDefined && pureBody && (matchStats forall treeInfo.hasSynthCaseSymbol)=>
- treeCopy.Block(body, List(transform(selDef0)), transformPureVirtMatch(mat, selDef, cases, matchEnd))
-
- case _ =>
- transExpr(body, None, ext)
- }
-
- debuglog("anf result "+body1+"\nresult is of type "+body1.tpe)
-
- treeCopy.Function(ff, transformValDefs(vparams), body1)
- }
-
- case vd @ ValDef(mods, name, tpt, rhs) => // object-level valdefs
- debuglog("transforming valdef " + vd.symbol)
-
- if (getExternalAnswerTypeAnn(tpt.tpe).isEmpty) {
-
- atOwner(vd.symbol) {
-
- val rhs1 = transExpr(rhs, None, None)
-
- treeCopy.ValDef(vd, mods, name, transform(tpt), rhs1)
- }
- } else {
- unit.error(tree.pos, "cps annotations not allowed on by-value parameters or value definitions")
- super.transform(tree)
- }
-
- case TypeTree() =>
- // circumvent cpsAllowed here
- super.transform(tree)
-
- case Apply(_,_) =>
- // this allows reset { ... } in object constructors
- // it's kind of a hack to put it here (see note above)
- transExpr(tree, None, None)
-
- case _ =>
- if (hasAnswerTypeAnn(tree.tpe)) {
- if (!cpsAllowed) {
- if (tree.symbol.isLazy)
- unit.error(tree.pos, "implementation restriction: cps annotations not allowed on lazy value definitions")
- else
- unit.error(tree.pos, "cps code not allowed here / " + tree.getClass + " / " + tree)
- }
- log(tree)
- }
-
- cpsAllowed = false
- super.transform(tree)
- }
- }
-
-
- def transExpr(tree: Tree, cpsA: CPSInfo, cpsR: CPSInfo)(implicit isAnyParentImpure: Boolean = false): Tree = {
- transTailValue(tree, cpsA, cpsR)(cpsR.isDefined || isAnyParentImpure) match {
- case (Nil, b) => b
- case (a, b) =>
- treeCopy.Block(tree, a,b)
- }
- }
-
-
- def transArgList(fun: Tree, args: List[Tree], cpsA: CPSInfo)(implicit isAnyParentImpure: Boolean): (List[List[Tree]], List[Tree], CPSInfo) = {
- val formals = fun.tpe.paramTypes
- val overshoot = args.length - formals.length
-
- var spc: CPSInfo = cpsA
-
- val (stm,expr) = (for ((a,tp) <- args.zip(formals ::: List.fill(overshoot)(NoType))) yield {
- tp match {
- case TypeRef(_, ByNameParamClass, List(elemtp)) =>
- // note that we're not passing just isAnyParentImpure
- (Nil, transExpr(a, None, getAnswerTypeAnn(elemtp))(getAnswerTypeAnn(elemtp).isDefined || isAnyParentImpure))
- case _ =>
- val (valStm, valExpr, valSpc) = transInlineValue(a, spc)
- spc = valSpc
- (valStm, valExpr)
- }
- }).unzip
-
- (stm,expr,spc)
- }
-
-
- // precondition: cpsR.isDefined "implies" isAnyParentImpure
- def transValue(tree: Tree, cpsA: CPSInfo, cpsR: CPSInfo)(implicit isAnyParentImpure: Boolean): (List[Tree], Tree, CPSInfo) = {
- // return value: (stms, expr, spc), where spc is CPSInfo after stms but *before* expr
- implicit val pos = tree.pos
- tree match {
- case Block(stms, expr) =>
- val (cpsA2, cpsR2) = (cpsA, linearize(cpsA, getAnswerTypeAnn(tree.tpe))) // tbd
- // val (cpsA2, cpsR2) = (None, getAnswerTypeAnn(tree.tpe))
-
- val (a, b) = transBlock(stms, expr, cpsA2, cpsR2)(cpsR2.isDefined || isAnyParentImpure)
- val tree1 = (treeCopy.Block(tree, a, b)) // no updateSynthFlag here!!!
-
- (Nil, tree1, cpsA)
-
- case If(cond, thenp, elsep) =>
- /* possible situations:
- cps before (cpsA)
- cps in condition (spc) <-- synth flag set if *only* here!
- cps in (one or both) branches */
- val (condStats, condVal, spc) = transInlineValue(cond, cpsA)
- val (cpsA2, cpsR2) = if (hasSynthMarker(tree.tpe))
- (spc, linearize(spc, getAnswerTypeAnn(tree.tpe))) else
- (None, getAnswerTypeAnn(tree.tpe)) // if no cps in condition, branches must conform to tree.tpe directly
- val thenVal = transExpr(thenp, cpsA2, cpsR2)(cpsR2.isDefined || isAnyParentImpure)
- val elseVal = transExpr(elsep, cpsA2, cpsR2)(cpsR2.isDefined || isAnyParentImpure)
-
- // check that then and else parts agree (not necessary any more, but left as sanity check)
- if (cpsR.isDefined) {
- if (elsep == EmptyTree)
- unit.error(tree.pos, "always need else part in cps code")
- }
- if (hasAnswerTypeAnn(thenVal.tpe) != hasAnswerTypeAnn(elseVal.tpe)) {
- unit.error(tree.pos, "then and else parts must both be cps code or neither of them")
- }
-
- (condStats, updateSynthFlag(treeCopy.If(tree, condVal, thenVal, elseVal)), spc)
-
- case Match(selector, cases) =>
- val (selStats, selVal, spc) = transInlineValue(selector, cpsA)
- val (cpsA2, cpsR2) =
- if (hasSynthMarker(tree.tpe)) (spc, linearize(spc, getAnswerTypeAnn(tree.tpe)))
- else (None, getAnswerTypeAnn(tree.tpe))
-
- val caseVals = cases map { case cd @ CaseDef(pat, guard, body) =>
- val bodyVal = transExpr(body, cpsA2, cpsR2)(cpsR2.isDefined || isAnyParentImpure)
- treeCopy.CaseDef(cd, transform(pat), transform(guard), bodyVal)
- }
-
- (selStats, updateSynthFlag(treeCopy.Match(tree, selVal, caseVals)), spc)
-
- // this is utterly broken: LabelDefs need to be considered together when transforming them to DefDefs:
- // suppose a Block {L1; ... ; LN}
- // this should become {D1def ; ... ; DNdef ; D1()}
- // where D$idef = def L$i(..) = {L$i.body; L${i+1}(..)}
-
- case ldef @ LabelDef(name, params, rhs) =>
- // println("trans LABELDEF "+(name, params, tree.tpe, hasAnswerTypeAnn(tree.tpe)))
- // TODO why does the labeldef's type have a cpsMinus annotation, whereas the rhs does not? (BYVALmode missing/too much somewhere?)
- if (hasAnswerTypeAnn(tree.tpe)) {
- // currentOwner.newMethod(name, tree.pos, Flags.SYNTHETIC) setInfo ldef.symbol.info
- val sym = ldef.symbol resetFlag Flags.LABEL
- val rhs1 = rhs //new TreeSymSubstituter(List(ldef.symbol), List(sym)).transform(rhs)
- val rhsVal = transExpr(rhs1, None, getAnswerTypeAnn(tree.tpe))(getAnswerTypeAnn(tree.tpe).isDefined || isAnyParentImpure) changeOwner (currentOwner -> sym)
-
- val stm1 = localTyper.typed(DefDef(sym, rhsVal))
- // since virtpatmat does not rely on fall-through, don't call the labels it emits
- // transBlock will take care of calling the first label
- // calling each labeldef is wrong, since some labels may be jumped over
- // we can get away with this for now since the only other labels we emit are for tailcalls/while loops,
- // which do not have consecutive labeldefs (and thus fall-through is irrelevant)
- if (treeInfo.hasSynthCaseSymbol(ldef)) (List(stm1), localTyper.typed{Literal(Constant(()))}, cpsA)
- else {
- assert(params.isEmpty, "problem in ANF transforming label with non-empty params "+ ldef)
- (List(stm1), localTyper.typed{Apply(Ident(sym), List())}, cpsA)
- }
- } else {
- val rhsVal = transExpr(rhs, None, None)
- (Nil, updateSynthFlag(treeCopy.LabelDef(tree, name, params, rhsVal)), cpsA)
- }
-
-
- case Try(block, catches, finalizer) =>
- val blockVal = transExpr(block, cpsA, cpsR)
-
- val catchVals = for {
- cd @ CaseDef(pat, guard, body) <- catches
- bodyVal = transExpr(body, cpsA, cpsR)
- } yield {
- treeCopy.CaseDef(cd, transform(pat), transform(guard), bodyVal)
- }
-
- val finallyVal = transExpr(finalizer, None, None) // for now, no cps in finally
-
- (Nil, updateSynthFlag(treeCopy.Try(tree, blockVal, catchVals, finallyVal)), cpsA)
-
- case Assign(lhs, rhs) =>
- // allow cps code in rhs only
- val (stms, expr, spc) = transInlineValue(rhs, cpsA)
- (stms, updateSynthFlag(treeCopy.Assign(tree, transform(lhs), expr)), spc)
-
- case Return(expr0) =>
- if (isAnyParentImpure)
- unit.error(tree.pos, "return expression not allowed, since method calls CPS method")
- val (stms, expr, spc) = transInlineValue(expr0, cpsA)
- (stms, updateSynthFlag(treeCopy.Return(tree, expr)), spc)
-
- case Throw(expr0) =>
- val (stms, expr, spc) = transInlineValue(expr0, cpsA)
- (stms, updateSynthFlag(treeCopy.Throw(tree, expr)), spc)
-
- case Typed(expr0, tpt) =>
- // TODO: should x: A @cps[B,C] have a special meaning?
- // type casts used in different ways (see match2.scala, #3199)
- val (stms, expr, spc) = transInlineValue(expr0, cpsA)
- val tpt1 = if (treeInfo.isWildcardStarArg(tree)) tpt else
- treeCopy.TypeTree(tpt).setType(removeAllCPSAnnotations(tpt.tpe))
-// (stms, updateSynthFlag(treeCopy.Typed(tree, expr, tpt1)), spc)
- (stms, treeCopy.Typed(tree, expr, tpt1).setType(removeAllCPSAnnotations(tree.tpe)), spc)
-
- case TypeApply(fun, args) =>
- val (stms, expr, spc) = transInlineValue(fun, cpsA)
- (stms, updateSynthFlag(treeCopy.TypeApply(tree, expr, args)), spc)
-
- case Select(qual, name) =>
- val (stms, expr, spc) = transInlineValue(qual, cpsA)
- (stms, updateSynthFlag(treeCopy.Select(tree, expr, name)), spc)
-
- case Apply(fun, args) =>
- val (funStm, funExpr, funSpc) = transInlineValue(fun, cpsA)
- val (argStm, argExpr, argSpc) = transArgList(fun, args, funSpc)
-
- (funStm ::: (argStm.flatten), updateSynthFlag(treeCopy.Apply(tree, funExpr, argExpr)),
- argSpc)
-
- case _ =>
- cpsAllowed = true
- (Nil, transform(tree), cpsA)
- }
- }
-
- // precondition: cpsR.isDefined "implies" isAnyParentImpure
- def transTailValue(tree: Tree, cpsA: CPSInfo, cpsR: CPSInfo)(implicit isAnyParentImpure: Boolean): (List[Tree], Tree) = {
-
- val (stms, expr, spc) = transValue(tree, cpsA, cpsR)
-
- val bot = linearize(spc, getAnswerTypeAnn(expr.tpe))(unit, tree.pos)
-
- val plainTpe = removeAllCPSAnnotations(expr.tpe)
-
- if (cpsR.isDefined && !bot.isDefined) {
-
- if (!expr.isEmpty && (expr.tpe.typeSymbol ne NothingClass)) {
- // must convert!
- debuglog("cps type conversion (has: " + cpsA + "/" + spc + "/" + expr.tpe + ")")
- debuglog("cps type conversion (expected: " + cpsR.get + "): " + expr)
-
- if (!hasPlusMarker(expr.tpe))
- unit.warning(tree.pos, "expression " + tree + " is cps-transformed unexpectedly")
-
- try {
- val Some((a, b)) = cpsR
- /* Since shiftUnit is bounded [A,B,C>:B] this may not typecheck
- * if C is overly specific. So if !(B <:< C), call shiftUnit0
- * instead, which takes only two type arguments.
- */
- val conforms = a <:< b
- val call = localTyper.typedPos(tree.pos)(
- Apply(
- TypeApply(
- gen.mkAttributedRef( if (conforms) MethShiftUnit else MethShiftUnit0 ),
- List(TypeTree(plainTpe), TypeTree(a)) ++ ( if (conforms) List(TypeTree(b)) else Nil )
- ),
- List(expr)
- )
- )
- // This is today's sick/meaningless heuristic for spotting breakdown so
- // we don't proceed until stack traces start draping themselves over everything.
- // If there are wildcard types in the tree and B == Nothing, something went wrong.
- // (I thought WildcardTypes would be enough, but nope. 'reset0 { 0 }' has them.)
- //
- // Code as simple as reset((_: String).length)
- // will crash meaninglessly without this check. See SI-3718.
- //
- // TODO - obviously this should be done earlier, differently, or with
- // a more skilled hand. Most likely, all three.
- if ((b.typeSymbol eq NothingClass) && call.tpe.exists(_ eq WildcardType))
- unit.error(tree.pos, "cannot cps-transform malformed (possibly in shift/reset placement) expression")
- else
- return ((stms, call))
- }
- catch {
- case ex:TypeError =>
- unit.error(ex.pos, "cannot cps-transform expression " + tree + ": " + ex.msg)
- }
- }
-
- } else if (!cpsR.isDefined && bot.isDefined) {
- // error!
- debuglog("cps type error: " + expr)
- //println("cps type error: " + expr + "/" + expr.tpe + "/" + getAnswerTypeAnn(expr.tpe))
-
- //println(cpsR + "/" + spc + "/" + bot)
-
- unit.error(tree.pos, "found cps expression in non-cps position")
- } else {
- // all is well
-
- if (hasPlusMarker(expr.tpe)) {
- unit.warning(tree.pos, "expression " + expr + " of type " + expr.tpe + " is not expected to have a cps type")
- expr modifyType removeAllCPSAnnotations
- }
-
- // TODO: sanity check that types agree
- }
-
- (stms, expr)
- }
-
- def transInlineValue(tree: Tree, cpsA: CPSInfo)(implicit isAnyParentImpure: Boolean): (List[Tree], Tree, CPSInfo) = {
-
- val (stms, expr, spc) = transValue(tree, cpsA, None) // never required to be cps
-
- getAnswerTypeAnn(expr.tpe) match {
- case spcVal @ Some(_) =>
-
- val valueTpe = removeAllCPSAnnotations(expr.tpe)
-
- val sym: Symbol = (
- currentOwner.newValue(newTermName(unit.fresh.newName("tmp")), tree.pos, Flags.SYNTHETIC)
- setInfo valueTpe
- setAnnotations List(AnnotationInfo(MarkerCPSSym.tpe_*, Nil, Nil))
- )
- expr.changeOwner(currentOwner -> sym)
-
- (stms ::: List(ValDef(sym, expr) setType(NoType)),
- Ident(sym) setType(valueTpe) setPos(tree.pos), linearize(spc, spcVal)(unit, tree.pos))
-
- case _ =>
- (stms, expr, spc)
- }
-
- }
-
-
-
- def transInlineStm(stm: Tree, cpsA: CPSInfo)(implicit isAnyParentImpure: Boolean): (List[Tree], CPSInfo) = {
- stm match {
-
- // TODO: what about DefDefs?
- // TODO: relation to top-level val def?
- // TODO: what about lazy vals?
-
- case tree @ ValDef(mods, name, tpt, rhs) =>
- val (stms, anfRhs, spc) = atOwner(tree.symbol) { transValue(rhs, cpsA, None) }
-
- val tv = new ChangeOwnerTraverser(tree.symbol, currentOwner)
- stms.foreach(tv.traverse(_))
-
- // TODO: symbol might already have annotation. Should check conformance
- // TODO: better yet: do without annotations on symbols
-
- val spcVal = getAnswerTypeAnn(anfRhs.tpe)
- spcVal foreach (_ => tree.symbol setAnnotations List(AnnotationInfo(MarkerCPSSym.tpe_*, Nil, Nil)))
-
- (stms:::List(treeCopy.ValDef(tree, mods, name, tpt, anfRhs)), linearize(spc, spcVal)(unit, tree.pos))
-
- case _ =>
- val (headStms, headExpr, headSpc) = transInlineValue(stm, cpsA)
- val valSpc = getAnswerTypeAnn(headExpr.tpe)
- (headStms:::List(headExpr), linearize(headSpc, valSpc)(unit, stm.pos))
- }
- }
-
- // precondition: cpsR.isDefined "implies" isAnyParentImpure
- def transBlock(stms: List[Tree], expr: Tree, cpsA: CPSInfo, cpsR: CPSInfo)(implicit isAnyParentImpure: Boolean): (List[Tree], Tree) = {
- def rec(currStats: List[Tree], currAns: CPSInfo, accum: List[Tree]): (List[Tree], Tree) =
- currStats match {
- case Nil =>
- val (anfStats, anfExpr) = transTailValue(expr, currAns, cpsR)
- (accum ++ anfStats, anfExpr)
-
- case stat :: rest =>
- val (stats, nextAns) = transInlineStm(stat, currAns)
- rec(rest, nextAns, accum ++ stats)
- }
-
- val (anfStats, anfExpr) = rec(stms, cpsA, List())
- // println("\nanf-block:\n"+ ((stms :+ expr) mkString ("{", "\n", "}")) +"\nBECAME\n"+ ((anfStats :+ anfExpr) mkString ("{", "\n", "}")))
- // println("synth case? "+ (anfStats map (t => (t, t.isDef, treeInfo.hasSynthCaseSymbol(t)))))
- // SUPER UGLY HACK: handle virtpatmat-style matches, whose labels have already been turned into DefDefs
- if (anfStats.nonEmpty && (anfStats forall (t => !t.isDef || treeInfo.hasSynthCaseSymbol(t)))) {
- val (prologue, rest) = (anfStats :+ anfExpr) span (s => !s.isInstanceOf[DefDef]) // find first case
- // println("rest: "+ rest)
- // val (defs, calls) = rest partition (_.isInstanceOf[DefDef])
- if (rest.nonEmpty) {
- // the filter drops the ()'s emitted when transValue encountered a LabelDef
- val stats = prologue ++ (rest filter (_.isInstanceOf[DefDef])).reverse // ++ calls
- // println("REVERSED "+ (stats mkString ("{", "\n", "}")))
- (stats, localTyper.typed{Apply(Ident(rest.head.symbol), List())}) // call first label to kick-start the match
- } else (anfStats, anfExpr)
- } else (anfStats, anfExpr)
- }
- }
-}
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala
deleted file mode 100644
index a7e82e949b..0000000000
--- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala
+++ /dev/null
@@ -1,56 +0,0 @@
-// $Id$
-
-package scala.tools.selectivecps
-
-import scala.tools.nsc
-import nsc.Global
-import nsc.plugins.Plugin
-import nsc.plugins.PluginComponent
-
-class SelectiveCPSPlugin(val global: Global) extends Plugin {
- val name = "continuations"
- val description = "applies selective cps conversion"
-
- val pluginEnabled = options contains "enable"
-
- val anfPhase = new {
- val global = SelectiveCPSPlugin.this.global
- val cpsEnabled = pluginEnabled
- override val enabled = cpsEnabled
- } with SelectiveANFTransform {
- val runsAfter = List("pickler")
- }
-
- val cpsPhase = new {
- val global = SelectiveCPSPlugin.this.global
- val cpsEnabled = pluginEnabled
- override val enabled = cpsEnabled
- } with SelectiveCPSTransform {
- val runsAfter = List("selectiveanf")
- override val runsBefore = List("uncurry")
- }
-
- val components = List[PluginComponent](anfPhase, cpsPhase)
-
- val checker = new {
- val global: SelectiveCPSPlugin.this.global.type = SelectiveCPSPlugin.this.global
- val cpsEnabled = pluginEnabled
- } with CPSAnnotationChecker
-
- // TODO don't muck up global with unused checkers
- global.addAnnotationChecker(checker.checker)
- global.analyzer.addAnalyzerPlugin(checker.plugin)
-
- global.log("instantiated cps plugin: " + this)
-
- override def init(options: List[String], error: String => Unit) = {
- options foreach {
- case "enable" => // in initializer
- case arg => error(s"Bad argument: $arg")
- }
- pluginEnabled
- }
-
- override val optionsHelp: Option[String] =
- Some(" -P:continuations:enable Enable continuations")
-}
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala
deleted file mode 100644
index 0210ad3459..0000000000
--- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala
+++ /dev/null
@@ -1,383 +0,0 @@
-// $Id$
-
-package scala.tools.selectivecps
-
-import scala.tools.nsc.transform._
-import scala.tools.nsc.plugins._
-import scala.tools.nsc.ast._
-
-/**
- * In methods marked @cps, CPS-transform assignments introduced by ANF-transform phase.
- */
-abstract class SelectiveCPSTransform extends PluginComponent with
- InfoTransform with TypingTransformers with CPSUtils with TreeDSL {
- // inherits abstract value `global` and class `Phase` from Transform
-
- import global._ // the global environment
- import definitions._ // standard classes and methods
- import typer.atOwner // methods to type trees
-
- override def description = "@cps-driven transform of selectiveanf assignments"
-
- /** the following two members override abstract members in Transform */
- val phaseName: String = "selectivecps"
-
- protected def newTransformer(unit: CompilationUnit): Transformer =
- new CPSTransformer(unit)
-
- /** This class does not change linearization */
- override def changesBaseClasses = false
-
- /** - return symbol's transformed type,
- */
- def transformInfo(sym: Symbol, tp: Type): Type = {
- if (!cpsEnabled) return tp
-
- val newtp = transformCPSType(tp)
-
- if (newtp != tp)
- debuglog("transformInfo changed type for " + sym + " to " + newtp);
-
- if (sym == MethReifyR)
- debuglog("transformInfo (not)changed type for " + sym + " to " + newtp);
-
- newtp
- }
-
- def transformCPSType(tp: Type): Type = { // TODO: use a TypeMap? need to handle more cases?
- tp match {
- case PolyType(params,res) => PolyType(params, transformCPSType(res))
- case NullaryMethodType(res) => NullaryMethodType(transformCPSType(res))
- case MethodType(params,res) => MethodType(params, transformCPSType(res))
- case TypeRef(pre, sym, args) => TypeRef(pre, sym, args.map(transformCPSType(_)))
- case _ =>
- getExternalAnswerTypeAnn(tp) match {
- case Some((res, outer)) =>
- appliedType(Context.tpeHK, List(removeAllCPSAnnotations(tp), res, outer))
- case _ =>
- removeAllCPSAnnotations(tp)
- }
- }
- }
-
-
- class CPSTransformer(unit: CompilationUnit) extends TypingTransformer(unit) {
- private val patmatTransformer = patmat.newTransformer(unit)
-
- override def transform(tree: Tree): Tree = {
- if (!cpsEnabled) return tree
- postTransform(mainTransform(tree))
- }
-
- def postTransform(tree: Tree): Tree = {
- tree.setType(transformCPSType(tree.tpe))
- }
-
-
- def mainTransform(tree: Tree): Tree = {
- tree match {
-
- // TODO: can we generalize this?
-
- case Apply(TypeApply(fun, targs), args)
- if (fun.symbol == MethShift) =>
- debuglog("found shift: " + tree)
- atPos(tree.pos) {
- val funR = gen.mkAttributedRef(MethShiftR) // TODO: correct?
- //gen.mkAttributedSelect(gen.mkAttributedSelect(gen.mkAttributedSelect(gen.mkAttributedIdent(ScalaPackage),
- //ScalaPackage.tpe.member("util")), ScalaPackage.tpe.member("util").tpe.member("continuations")), MethShiftR)
- //gen.mkAttributedRef(ModCPS.tpe, MethShiftR) // TODO: correct?
- debuglog("funR.tpe: " + funR.tpe)
- Apply(
- TypeApply(funR, targs).setType(appliedType(funR.tpe, targs.map((t:Tree) => t.tpe))),
- args.map(transform(_))
- ).setType(transformCPSType(tree.tpe))
- }
-
- case Apply(TypeApply(fun, targs), args)
- if (fun.symbol == MethShiftUnit) =>
- debuglog("found shiftUnit: " + tree)
- atPos(tree.pos) {
- val funR = gen.mkAttributedRef(MethShiftUnitR) // TODO: correct?
- debuglog("funR.tpe: " + funR.tpe)
- Apply(
- TypeApply(funR, List(targs(0), targs(1))).setType(appliedType(funR.tpe,
- List(targs(0).tpe, targs(1).tpe))),
- args.map(transform(_))
- ).setType(appliedType(Context.tpeHK, List(targs(0).tpe,targs(1).tpe,targs(1).tpe)))
- }
-
- case Apply(TypeApply(fun, targs), args)
- if (fun.symbol == MethReify) =>
- log("found reify: " + tree)
- atPos(tree.pos) {
- val funR = gen.mkAttributedRef(MethReifyR) // TODO: correct?
- debuglog("funR.tpe: " + funR.tpe)
- Apply(
- TypeApply(funR, targs).setType(appliedType(funR.tpe, targs.map((t:Tree) => t.tpe))),
- args.map(transform(_))
- ).setType(transformCPSType(tree.tpe))
- }
-
- case Try(block, catches, finalizer) =>
- // currently duplicates the catch block into a partial function.
- // this is kinda risky, but we don't expect there will be lots
- // of try/catches inside catch blocks (exp. blowup unlikely).
-
- // CAVEAT: finalizers are surprisingly tricky!
- // the problem is that they cannot easily be removed
- // from the regular control path and hence will
- // also be invoked after creating the Context object.
-
- /*
- object Test {
- def foo1 = {
- throw new Exception("in sub")
- shift((k:Int=>Int) => k(1))
- 10
- }
- def foo2 = {
- shift((k:Int=>Int) => k(2))
- 20
- }
- def foo3 = {
- shift((k:Int=>Int) => k(3))
- throw new Exception("in sub")
- 30
- }
- def foo4 = {
- shift((k:Int=>Int) => 4)
- throw new Exception("in sub")
- 40
- }
- def bar(x: Int) = try {
- if (x == 1)
- foo1
- else if (x == 2)
- foo2
- else if (x == 3)
- foo3
- else //if (x == 4)
- foo4
- } catch {
- case _ =>
- println("exception")
- 0
- } finally {
- println("done")
- }
- }
-
- reset(Test.bar(1)) // should print: exception,done,0
- reset(Test.bar(2)) // should print: done,20 <-- but prints: done,done,20
- reset(Test.bar(3)) // should print: exception,done,0 <-- but prints: done,exception,done,0
- reset(Test.bar(4)) // should print: 4 <-- but prints: done,4
- */
-
- val block1 = transform(block)
- val catches1 = transformCaseDefs(catches)
- val finalizer1 = transform(finalizer)
-
- if (hasAnswerTypeAnn(tree.tpe)) {
- //vprintln("CPS Transform: " + tree + "/" + tree.tpe + "/" + block1.tpe)
-
- val (stms, expr1) = block1 match {
- case Block(stms, expr) => (stms, expr)
- case expr => (Nil, expr)
- }
-
- val targettp = transformCPSType(tree.tpe)
-
- val pos = catches.head.pos
- val funSym = currentOwner.newValueParameter(cpsNames.catches, pos).setInfo(appliedType(PartialFunctionClass, ThrowableTpe, targettp))
- val funDef = localTyper.typedPos(pos) {
- ValDef(funSym, Match(EmptyTree, catches1))
- }
- val expr2 = localTyper.typedPos(pos) {
- Apply(Select(expr1, expr1.tpe.member(cpsNames.flatMapCatch)), List(Ident(funSym)))
- }
-
- val exSym = currentOwner.newValueParameter(cpsNames.ex, pos).setInfo(ThrowableTpe)
-
- import CODE._
- // generate a case that is supported directly by the back-end
- val catchIfDefined = CaseDef(
- Bind(exSym, Ident(nme.WILDCARD)),
- EmptyTree,
- IF ((REF(funSym) DOT nme.isDefinedAt)(REF(exSym))) THEN (REF(funSym) APPLY (REF(exSym))) ELSE Throw(REF(exSym))
- )
-
- val catch2 = localTyper.typedCases(List(catchIfDefined), ThrowableTpe, targettp)
- //typedCases(tree, catches, ThrowableTpe, pt)
-
- patmatTransformer.transform(localTyper.typed(Block(List(funDef), treeCopy.Try(tree, treeCopy.Block(block1, stms, expr2), catch2, finalizer1))))
-
-
-/*
- disabled for now - see notes above
-
- val expr3 = if (!finalizer.isEmpty) {
- val pos = finalizer.pos
- val finalizer2 = duplicateTree(finalizer1)
- val fun = Function(List(), finalizer2)
- val expr3 = localTyper.typedPos(pos) { Apply(Select(expr2, expr2.tpe.member("mapFinally")), List(fun)) }
-
- val chown = new ChangeOwnerTraverser(currentOwner, fun.symbol)
- chown.traverse(finalizer2)
-
- expr3
- } else
- expr2
-*/
- } else {
- treeCopy.Try(tree, block1, catches1, finalizer1)
- }
-
- case Block(stms, expr) =>
-
- val (stms1, expr1) = transBlock(stms, expr)
- treeCopy.Block(tree, stms1, expr1)
-
- case _ =>
- super.transform(tree)
- }
- }
-
-
-
- def transBlock(stms: List[Tree], expr: Tree): (List[Tree], Tree) = {
-
- stms match {
- case Nil =>
- (Nil, transform(expr))
-
- case stm::rest =>
-
- stm match {
- case vd @ ValDef(mods, name, tpt, rhs)
- if (vd.symbol.hasAnnotation(MarkerCPSSym)) =>
-
- debuglog("found marked ValDef "+name+" of type " + vd.symbol.tpe)
-
- val tpe = vd.symbol.tpe
- val rhs1 = atOwner(vd.symbol) { transform(rhs) }
- rhs1.changeOwner(vd.symbol -> currentOwner) // TODO: don't traverse twice
-
- debuglog("valdef symbol " + vd.symbol + " has type " + tpe)
- debuglog("right hand side " + rhs1 + " has type " + rhs1.tpe)
-
- debuglog("currentOwner: " + currentOwner)
- debuglog("currentMethod: " + currentMethod)
-
- val (bodyStms, bodyExpr) = transBlock(rest, expr)
- // FIXME: result will later be traversed again by TreeSymSubstituter and
- // ChangeOwnerTraverser => exp. running time.
- // Should be changed to fuse traversals into one.
-
- val specialCaseTrivial = bodyExpr match {
- case Apply(fun, args) =>
- // for now, look for explicit tail calls only.
- // are there other cases that could profit from specializing on
- // trivial contexts as well?
- (bodyExpr.tpe.typeSymbol == Context) && (currentMethod == fun.symbol)
- case _ => false
- }
-
- def applyTrivial(ctxValSym: Symbol, body: Tree) = {
-
- val body1 = (new TreeSymSubstituter(List(vd.symbol), List(ctxValSym)))(body)
-
- val body2 = localTyper.typedPos(vd.symbol.pos) { body1 }
-
- // in theory it would be nicer to look for an @cps annotation instead
- // of testing for Context
- if ((body2.tpe == null) || !(body2.tpe.typeSymbol == Context)) {
- //println(body2 + "/" + body2.tpe)
- unit.error(rhs.pos, "cannot compute type for CPS-transformed function result")
- }
- body2
- }
-
- def applyCombinatorFun(ctxR: Tree, body: Tree) = {
- val arg = currentOwner.newValueParameter(name, ctxR.pos).setInfo(tpe)
- val body1 = (new TreeSymSubstituter(List(vd.symbol), List(arg)))(body)
- val fun = localTyper.typedPos(vd.symbol.pos) { Function(List(ValDef(arg)), body1) } // types body as well
- arg.owner = fun.symbol
- body1.changeOwner(currentOwner -> fun.symbol)
-
- // see note about multiple traversals above
-
- debuglog("fun.symbol: "+fun.symbol)
- debuglog("fun.symbol.owner: "+fun.symbol.owner)
- debuglog("arg.owner: "+arg.owner)
-
- debuglog("fun.tpe:"+fun.tpe)
- debuglog("return type of fun:"+body1.tpe)
-
- var methodName = nme.map
-
- if (body1.tpe != null) {
- if (body1.tpe.typeSymbol == Context)
- methodName = nme.flatMap
- }
- else
- unit.error(rhs.pos, "cannot compute type for CPS-transformed function result")
-
- debuglog("will use method:"+methodName)
-
- localTyper.typedPos(vd.symbol.pos) {
- Apply(Select(ctxR, ctxR.tpe.member(methodName)), List(fun))
- }
- }
-
- // TODO use gen.mkBlock after 2.11.0-M6. Why wait? It allows us to still build in development
- // mode with `ant -DskipLocker=1`
- def mkBlock(stms: List[Tree], expr: Tree) = if (stms.nonEmpty) Block(stms, expr) else expr
-
- try {
- if (specialCaseTrivial) {
- debuglog("will optimize possible tail call: " + bodyExpr)
-
- // FIXME: flatMap impl has become more complicated due to
- // exceptions. do we need to put a try/catch in the then part??
-
- // val ctx = <rhs>
- // if (ctx.isTrivial)
- // val <lhs> = ctx.getTrivialValue; ... <--- TODO: try/catch ??? don't bother for the moment...
- // else
- // ctx.flatMap { <lhs> => ... }
- val ctxSym = currentOwner.newValue(newTermName("" + vd.symbol.name + cpsNames.shiftSuffix)).setInfo(rhs1.tpe)
- val ctxDef = localTyper.typed(ValDef(ctxSym, rhs1))
- def ctxRef = localTyper.typed(Ident(ctxSym))
- val argSym = currentOwner.newValue(vd.symbol.name.toTermName).setInfo(tpe)
- val argDef = localTyper.typed(ValDef(argSym, Select(ctxRef, ctxRef.tpe.member(cpsNames.getTrivialValue))))
- val switchExpr = localTyper.typedPos(vd.symbol.pos) {
- val body2 = mkBlock(bodyStms, bodyExpr).duplicate // dup before typing!
- If(Select(ctxRef, ctxSym.tpe.member(cpsNames.isTrivial)),
- applyTrivial(argSym, mkBlock(argDef::bodyStms, bodyExpr)),
- applyCombinatorFun(ctxRef, body2))
- }
- (List(ctxDef), switchExpr)
- } else {
- // ctx.flatMap { <lhs> => ... }
- // or
- // ctx.map { <lhs> => ... }
- (Nil, applyCombinatorFun(rhs1, mkBlock(bodyStms, bodyExpr)))
- }
- } catch {
- case ex:TypeError =>
- unit.error(ex.pos, ex.msg)
- (bodyStms, bodyExpr)
- }
-
- case _ =>
- val stm1 = transform(stm)
- val (a, b) = transBlock(rest, expr)
- (stm1::a, b)
- }
- }
- }
-
-
- }
-}
diff --git a/src/continuations/plugin/scalac-plugin.xml b/src/continuations/plugin/scalac-plugin.xml
deleted file mode 100644
index 04d42655c5..0000000000
--- a/src/continuations/plugin/scalac-plugin.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<!-- $Id$ -->
-<plugin>
- <name>continuations</name>
- <classname>scala.tools.selectivecps.SelectiveCPSPlugin</classname>
-</plugin>
diff --git a/src/eclipse/continuations-library/.classpath b/src/eclipse/continuations-library/.classpath
deleted file mode 100644
index 61cb3f060e..0000000000
--- a/src/eclipse/continuations-library/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="continuations-library"/>
- <classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
- <classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="build-quick-continuations-library"/>
-</classpath>
diff --git a/src/eclipse/continuations-library/.project b/src/eclipse/continuations-library/.project
deleted file mode 100644
index 33cc57d667..0000000000
--- a/src/eclipse/continuations-library/.project
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>continuations-library</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.scala-ide.sdt.core.scalabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.scala-ide.sdt.core.scalanature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
- <linkedResources>
- <link>
- <name>build-quick-continuations-library</name>
- <type>2</type>
- <locationURI>SCALA_BASEDIR/build/quick/classes/continuations/library</locationURI>
- </link>
- <link>
- <name>continuations-library</name>
- <type>2</type>
- <locationURI>SCALA_BASEDIR/src/continuations/library</locationURI>
- </link>
- </linkedResources>
-</projectDescription>
diff --git a/src/eclipse/continuations-library/.settings/org.scala-ide.sdt.core.prefs b/src/eclipse/continuations-library/.settings/org.scala-ide.sdt.core.prefs
deleted file mode 100644
index 63e1df247f..0000000000
--- a/src/eclipse/continuations-library/.settings/org.scala-ide.sdt.core.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-P=continuations\:enable
-scala.compiler.useProjectSettings=true
diff --git a/src/eclipse/reflect/.classpath b/src/eclipse/reflect/.classpath
index 1eb37e3f5f..3f14621da7 100644
--- a/src/eclipse/reflect/.classpath
+++ b/src/eclipse/reflect/.classpath
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="reflect"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
- <classpathentry combineaccessrules="false" kind="src" path="/continuations-library"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build-quick-reflect"/>
</classpath>
diff --git a/src/eclipse/scala-compiler/.classpath b/src/eclipse/scala-compiler/.classpath
index c185bc5391..e81cacca26 100644
--- a/src/eclipse/scala-compiler/.classpath
+++ b/src/eclipse/scala-compiler/.classpath
@@ -4,7 +4,6 @@
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/asm"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/reflect"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/scala-library"/>
- <classpathentry combineaccessrules="false" exported="true" kind="src" path="/continuations-library"/>
<classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build-quick-compiler"/>
diff --git a/src/eclipse/test-junit/.classpath b/src/eclipse/test-junit/.classpath
index fe3c3e4f18..d028dcc21e 100644
--- a/src/eclipse/test-junit/.classpath
+++ b/src/eclipse/test-junit/.classpath
@@ -5,7 +5,6 @@
<classpathentry kind="var" path="M2_REPO/junit/junit/4.10/junit-4.10.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/reflect"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
- <classpathentry combineaccessrules="false" kind="src" path="/continuations-library"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
<classpathentry kind="output" path="build-test-junit"/>
diff --git a/src/intellij/continuations-library.iml.SAMPLE b/src/intellij/continuations-library.iml.SAMPLE
deleted file mode 100644
index 364cc3dcdb..0000000000
--- a/src/intellij/continuations-library.iml.SAMPLE
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="scala" name="Scala">
- <configuration>
- <option name="compilerLibraryLevel" value="Project" />
- <option name="compilerLibraryName" value="compiler-locker" />
- <option name="maximumHeapSize" value="1536" />
- <option name="vmOptions" value="-Xms1536m -Xss1m -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops -XX:+UseParallelGC" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$/../continuations/library">
- <sourceFolder url="file://$MODULE_DIR$/../continuations/library" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="library" />
- </component>
-</module>
-
diff --git a/src/intellij/continuations-plugin.iml.SAMPLE b/src/intellij/continuations-plugin.iml.SAMPLE
deleted file mode 100644
index 27213374b3..0000000000
--- a/src/intellij/continuations-plugin.iml.SAMPLE
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="scala" name="Scala">
- <configuration>
- <option name="compilerLibraryLevel" value="Project" />
- <option name="compilerLibraryName" value="compiler-locker" />
- <option name="maximumHeapSize" value="1536" />
- <option name="vmOptions" value="-Xms1536m -Xss1m -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops -XX:+UseParallelGC" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$/../continuations/plugin">
- <sourceFolder url="file://$MODULE_DIR$/../continuations/plugin" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="library" />
- <orderEntry type="module" module-name="compiler" />
- <orderEntry type="module" module-name="reflect" />
- </component>
-</module>
-
diff --git a/src/intellij/parser-combinators.iml.SAMPLE b/src/intellij/parser-combinators.iml.SAMPLE
deleted file mode 100644
index 1ef913dbe4..0000000000
--- a/src/intellij/parser-combinators.iml.SAMPLE
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="scala" name="Scala">
- <configuration>
- <option name="compilerLibraryLevel" value="Project" />
- <option name="compilerLibraryName" value="compiler-locker" />
- <option name="maximumHeapSize" value="1536" />
- <option name="vmOptions" value="-Xms1536m -Xss1m -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops -XX:+UseParallelGC" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$/../parser-combinators">
- <sourceFolder url="file://$MODULE_DIR$/../parser-combinators" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="library" />
- </component>
-</module>
diff --git a/src/intellij/partest.iml.SAMPLE b/src/intellij/partest.iml.SAMPLE
deleted file mode 100644
index 893236b621..0000000000
--- a/src/intellij/partest.iml.SAMPLE
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="scala" name="Scala">
- <configuration>
- <option name="compilerLibraryLevel" value="Project" />
- <option name="compilerLibraryName" value="compiler-locker" />
- <option name="maximumHeapSize" value="1536" />
- <option name="vmOptions" value="-Xms1536m -Xss1m -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops -XX:+UseParallelGC" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$/../partest-extras">
- <sourceFolder url="file://$MODULE_DIR$/../partest-extras" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="partest-deps" level="project" />
- <orderEntry type="module" module-name="repl" />
- </component>
-</module>
-
diff --git a/src/intellij/scala-lang.ipr.SAMPLE b/src/intellij/scala-lang.ipr.SAMPLE
index f91a346b75..a0765b3e99 100644
--- a/src/intellij/scala-lang.ipr.SAMPLE
+++ b/src/intellij/scala-lang.ipr.SAMPLE
@@ -201,22 +201,16 @@
<module fileurl="file://$PROJECT_DIR$/actors.iml" filepath="$PROJECT_DIR$/actors.iml" />
<module fileurl="file://$PROJECT_DIR$/asm.iml" filepath="$PROJECT_DIR$/asm.iml" />
<module fileurl="file://$PROJECT_DIR$/compiler.iml" filepath="$PROJECT_DIR$/compiler.iml" />
- <module fileurl="file://$PROJECT_DIR$/continuations-library.iml" filepath="$PROJECT_DIR$/continuations-library.iml" />
- <module fileurl="file://$PROJECT_DIR$/continuations-plugin.iml" filepath="$PROJECT_DIR$/continuations-plugin.iml" />
<module fileurl="file://$PROJECT_DIR$/forkjoin.iml" filepath="$PROJECT_DIR$/forkjoin.iml" />
<module fileurl="file://$PROJECT_DIR$/interactive.iml" filepath="$PROJECT_DIR$/interactive.iml" />
<module fileurl="file://$PROJECT_DIR$/library.iml" filepath="$PROJECT_DIR$/library.iml" />
<module fileurl="file://$PROJECT_DIR$/manual.iml" filepath="$PROJECT_DIR$/manual.iml" />
- <module fileurl="file://$PROJECT_DIR$/parser-combinators.iml" filepath="$PROJECT_DIR$/parser-combinators.iml" />
- <module fileurl="file://$PROJECT_DIR$/partest.iml" filepath="$PROJECT_DIR$/partest.iml" />
<module fileurl="file://$PROJECT_DIR$/reflect.iml" filepath="$PROJECT_DIR$/reflect.iml" />
<module fileurl="file://$PROJECT_DIR$/repl.iml" filepath="$PROJECT_DIR$/repl.iml" />
<module fileurl="file://$PROJECT_DIR$/scala.iml" filepath="$PROJECT_DIR$/scala.iml" />
<module fileurl="file://$PROJECT_DIR$/scaladoc.iml" filepath="$PROJECT_DIR$/scaladoc.iml" />
<module fileurl="file://$PROJECT_DIR$/scalap.iml" filepath="$PROJECT_DIR$/scalap.iml" />
- <module fileurl="file://$PROJECT_DIR$/swing.iml" filepath="$PROJECT_DIR$/swing.iml" />
<module fileurl="file://$PROJECT_DIR$/test.iml" filepath="$PROJECT_DIR$/test.iml" />
- <module fileurl="file://$PROJECT_DIR$/xml.iml" filepath="$PROJECT_DIR$/xml.iml" />
</modules>
</component>
<component name="ProjectResources">
diff --git a/src/intellij/swing.iml.SAMPLE b/src/intellij/swing.iml.SAMPLE
deleted file mode 100644
index c97bfdf91f..0000000000
--- a/src/intellij/swing.iml.SAMPLE
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="scala" name="Scala">
- <configuration>
- <option name="compilerLibraryLevel" value="Project" />
- <option name="compilerLibraryName" value="compiler-locker" />
- <option name="maximumHeapSize" value="1536" />
- <option name="vmOptions" value="-Xms1536m -Xss1m -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops -XX:+UseParallelGC" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$/../swing">
- <sourceFolder url="file://$MODULE_DIR$/../swing" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="library" />
- <orderEntry type="module" module-name="actors" />
- </component>
-</module>
-
diff --git a/src/intellij/xml.iml.SAMPLE b/src/intellij/xml.iml.SAMPLE
deleted file mode 100644
index b721f4e7f2..0000000000
--- a/src/intellij/xml.iml.SAMPLE
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="scala" name="Scala">
- <configuration>
- <option name="compilerLibraryLevel" value="Project" />
- <option name="compilerLibraryName" value="compiler-locker" />
- <option name="maximumHeapSize" value="1536" />
- <option name="vmOptions" value="-Xms1536m -Xss1m -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops -XX:+UseParallelGC" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$/../xml">
- <sourceFolder url="file://$MODULE_DIR$/../xml" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="library" />
- </component>
-</module>
diff --git a/src/swing/doc/README b/src/swing/doc/README
deleted file mode 100644
index cdfee01f82..0000000000
--- a/src/swing/doc/README
+++ /dev/null
@@ -1,39 +0,0 @@
-scala.swing BETA
-
-This is a UI library that will wrap most of Java Swing for Scala in a straightforward manner.
-The widget class hierarchy loosely resembles that of Java Swing. The main differences are:
-
- In Java Swing all components are containers per default. This doesn't make much sense for
- a number of components, like TextField, CheckBox, RadioButton, and so on. Our guess is that
- this architecture was chosen because Java lacks multiple inheritance.
- In scala.swing, components that can have child components extend the Container trait.
-
- Layout managers and panels are coupled. There is no way to exchange the layout manager
- of a panel. As a result, the layout constraints for widgets can be typed.
- (Note that you gain more type-safety and don't loose much flexibility here. Besides
- being not a common operation, exchanging the layout manager of a panel in Java
- Swing almost always leads to exchanging the layout constraints for every of the panel's
- child component. In the end, it is not more work to move all children to a newly created
- panel.)
-
- The event system. TODO
-
-
-The library comprises three main packages:
-
- scala.swing
- All widget classes and traits.
-
- scala.swing.event
- The event hierarchy.
-
- scala.swing.test
- A set of demos.
-
-
-Notes:
-
-Visual appearance of combo boxes using the GTK LaF is broken on JDKs < 1.7b30.
-This is a Java Swing problem.
-
-To download the latest version, go to http://lamp.epfl.ch/~imaier or use sbaz.
diff --git a/src/swing/doc/build.xml b/src/swing/doc/build.xml
deleted file mode 100644
index 20e141152b..0000000000
--- a/src/swing/doc/build.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="swing" default="build">
-
- <property name="scala.home" value="${user.home}/apps/scala-recent"/>
-
- <property file="swing/swing.version.properties"/>
- <property name="version" value="${version.major}.${version.minor}"/>
-
- <taskdef
- resource="scala/tools/ant/antlib.xml">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
- <pathelement location="${scala.home}/lib/scala-library.jar"/>
- <pathelement location="${scala.home}/lib/junit.jar"/>
- </classpath>
- </taskdef>
-
-
- <target name="build">
- <mkdir dir="build/build.main"/>
- <scalac srcdir="swing"
- destdir="build/build.main">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-library.jar"/>
- <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
- </classpath>
- <include name="**/*.scala"/>
- </scalac>
-
- <jar destfile="build/scala-swing.jar">
- <fileset dir="build/build.main"/>
- <fileset file="swing.version.properties"/>
- </jar>
- <jar destfile="build/scala-swing-src.jar"
- basedir="swing"
- includes="**/*.scala"
- />
- </target>
-
- <!--<target name="build.tests" depends="build">
- <mkdir dir="build/build.tests"/>
- <scalac srcdir="tests" destdir="build/build.tests">
- <classpath>
- <pathelement location="${scala.home}/lib/scala-library.jar"/>
- <pathelement location="${scala.home}/lib/scala-compiler.jar"/>
- <pathelement location="${scala.home}/lib/junit.jar"/>
- <pathelement location="build/swing.jar"/>
- </classpath>
- </scalac>
-
- <jar destfile="build/swing-tests.jar" basedir="build/build.tests"/>
- </target>-->
-
- <target name="dist" depends="build">
- <mkdir dir="build"/>
- <sbaz file="build/scala-swing-${version}.sbp"
- adfile="build/scala-swing-${version}.advert"
- name="scala-swing"
- version="${version}"
- depends="scala"
- desc="A Scala Swing library"
- link="http://scala.epfl.ch/downloads/packages/scala-swing-${version}.sbp">
- <libset dir="build" includes="scala-swing.jar"/>
- <libset dir="build" includes="scala-swing-tests.jar"/>
- <srcset dir="build" includes="scala-swing-src.jar"/>
- <docset dir="swing/doc" includes="Manual.txt"/>
- </sbaz>
- </target>
-
- <target name="install" depends="dist">
- <exec executable="sbaz">
- <arg line="-v install -f build/scala-swing-${version}.sbp"/>
- </exec>
- </target>
-
- <target name="clean">
- <delete dir="build"
- includeemptydirs="yes"
- quiet="yes"
- failonerror="no"/>
- </target>
-</project>
diff --git a/src/swing/scala/swing/AbstractButton.scala b/src/swing/scala/swing/AbstractButton.scala
deleted file mode 100644
index fd84d6f151..0000000000
--- a/src/swing/scala/swing/AbstractButton.scala
+++ /dev/null
@@ -1,87 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import event._
-import javax.swing.{AbstractButton => JAbstractButton, Icon}
-
-/**
- * Base class of all button-like widgets, such as push buttons,
- * check boxes, and radio buttons.
- *
- * @see javax.swing.AbstractButton
- */
-abstract class AbstractButton extends Component with Action.Trigger.Wrapper with Publisher {
- override lazy val peer: JAbstractButton = new JAbstractButton with SuperMixin {}
-
- def text: String = peer.getText
- def text_=(s: String) = peer.setText(s)
-
- def icon: Icon = peer.getIcon
- def icon_=(i: Icon) = peer.setIcon(i)
- def pressedIcon: Icon = peer.getPressedIcon
- def pressedIcon_=(i: Icon) = peer.setPressedIcon(i)
- def selectedIcon: Icon = peer.getSelectedIcon
- def selectedIcon_=(i: Icon) = peer.setSelectedIcon(i)
- def disabledIcon: Icon = peer.getDisabledIcon
- def disabledIcon_=(i: Icon) = peer.setDisabledIcon(i)
- def disabledSelectedIcon: Icon = peer.getDisabledSelectedIcon
- def disabledSelectedIcon_=(i: Icon) = peer.setDisabledSelectedIcon(i)
- def rolloverIcon: Icon = peer.getRolloverIcon
- def rolloverIcon_=(b: Icon) = peer.setRolloverIcon(b)
- def rolloverSelectedIcon: Icon = peer.getRolloverSelectedIcon
- def rolloverSelectedIcon_=(b: Icon) = peer.setRolloverSelectedIcon(b)
-
- peer.addActionListener(Swing.ActionListener { e =>
- publish(ButtonClicked(AbstractButton.this))
- })
-
- def selected: Boolean = peer.isSelected
- def selected_=(b: Boolean) = peer.setSelected(b)
-
- def contentAreaFilled: Boolean = peer.isContentAreaFilled
- def contentAreaFilled_=(b: Boolean) { peer.setContentAreaFilled(b) }
-
- def borderPainted: Boolean = peer.isBorderPainted
- def borderPainted_=(b: Boolean) { peer.setBorderPainted(b) }
- def focusPainted: Boolean = peer.isFocusPainted
- def focusPainted_=(b: Boolean) { peer.setFocusPainted(b) }
-
- def rolloverEnabled: Boolean = peer.isRolloverEnabled
- def rolloverEnabled_=(b: Boolean) = peer.setRolloverEnabled(b)
-
- def verticalTextPosition: Alignment.Value = Alignment(peer.getVerticalTextPosition)
- def verticalTextPosition_=(a: Alignment.Value) { peer.setVerticalTextPosition(a.id) }
- def verticalAlignment: Alignment.Value = Alignment(peer.getVerticalAlignment)
- def verticalAlignment_=(a: Alignment.Value) { peer.setVerticalAlignment(a.id) }
-
- def horizontalTextPosition: Alignment.Value = Alignment(peer.getHorizontalTextPosition)
- def horizontalTextPosition_=(a: Alignment.Value) { peer.setHorizontalTextPosition(a.id) }
- def horizontalAlignment: Alignment.Value = Alignment(peer.getHorizontalAlignment)
- def horizontalAlignment_=(a: Alignment.Value) { peer.setHorizontalAlignment(a.id) }
-
- def iconTextGap: Int = peer.getIconTextGap
- def iconTextGap_=(x: Int) { peer.setIconTextGap(x) }
-
- def mnemonic: Key.Value = Key(peer.getMnemonic)
- def mnemonic_=(k: Key.Value) { peer.setMnemonic(k.id) }
- def displayedMnemonicIndex: Int = peer.getDisplayedMnemonicIndex
- def displayedMnemonicIndex_=(n: Int) { peer.setDisplayedMnemonicIndex(n) }
-
- def multiClickThreshold: Long = peer.getMultiClickThreshhold
- def multiClickThreshold_=(n: Long) { peer.setMultiClickThreshhold(n) }
-
- def doClick() { peer.doClick() }
- def doClick(times: Int) { peer.doClick(times) }
-
- def margin: Insets = peer.getMargin
- def margin_=(i: Insets) { peer.setMargin(i) }
-}
diff --git a/src/swing/scala/swing/Action.scala b/src/swing/scala/swing/Action.scala
deleted file mode 100644
index 98b9fee2ee..0000000000
--- a/src/swing/scala/swing/Action.scala
+++ /dev/null
@@ -1,162 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.{KeyStroke, Icon}
-import java.awt.event.ActionListener
-
-object Action {
- /**
- * Special action that has an empty title and all default properties and does nothing.
- * Use this as a "null action", i.e., to tell components that they do not have any
- * associated action. A component may then obtain its properties from its direct members
- * instead of from its action.
- * In Java Swing, one would use `null` instead of a designated action.
- */
- case object NoAction extends Action("") { def apply() {} }
-
- object Trigger {
- trait Wrapper extends Action.Trigger {
- def peer: javax.swing.JComponent {
- def addActionListener(a: ActionListener)
- def removeActionListener(a: ActionListener)
- def setAction(a: javax.swing.Action)
- def getAction(): javax.swing.Action
- }
-
- // TODO: we need an action cache
- private var _action: Action = Action.NoAction
- def action: Action = _action
- def action_=(a: Action) {
- _action = a;
-
- import scala.language.reflectiveCalls
- peer.setAction(a.peer)
- }
-
- //1.6: def hideActionText: Boolean = peer.getHideActionText
- //def hideActionText_=(b: Boolean) = peer.setHideActionText(b)
- }
- }
-
- /**
- * Something that triggers an action.
- */
- trait Trigger {
- def action: Action
- def action_=(a: Action)
-
- //1.6: def hideActionText: Boolean
- //def hideActionText_=(b: Boolean)
- }
-
- /**
- * Convenience method to create an action with a given title and body to run.
- */
- def apply(title: String)(body: =>Unit) = new Action(title) {
- def apply() { body }
- }
-}
-
-/**
- * An abstract action to be performed in reaction to user input.
- *
- * Not every action component will honor every property of its action.
- * An action itself can generally be configured so that certain properties
- * should be ignored and instead taken from the component directly. In the
- * end, it is up to a component which property it uses in which way.
- *
- * @see javax.swing.Action
- */
-abstract class Action(title0: String) {
- import Swing._
-
- lazy val peer: javax.swing.Action = new javax.swing.AbstractAction(title0) {
- def actionPerformed(a: java.awt.event.ActionEvent) = apply()
- }
-
- /**
- * Title is not optional.
- */
- def title: String = ifNull(peer.getValue(javax.swing.Action.NAME),"")
- def title_=(t: String) { peer.putValue(javax.swing.Action.NAME, t) }
-
- /**
- * None if large icon and small icon are not equal.
- */
- def icon: Icon = smallIcon //if(largeIcon == smallIcon) largeIcon else None
- def icon_=(i: Icon) { /*largeIcon = i;*/ smallIcon = i }
- // 1.6: def largeIcon: Icon = toNoIcon(peer.getValue(javax.swing.Action.LARGE_ICON_KEY).asInstanceOf[Icon])
- // def largeIcon_=(i: Icon) { peer.putValue(javax.swing.Action.LARGE_ICON_KEY, toNullIcon(i)) }
- def smallIcon: Icon = toNoIcon(peer.getValue(javax.swing.Action.SMALL_ICON).asInstanceOf[Icon])
- def smallIcon_=(i: Icon) { peer.putValue(javax.swing.Action.SMALL_ICON, toNullIcon(i)) }
-
- /**
- * For all components.
- */
- def toolTip: String =
- ifNull(peer.getValue(javax.swing.Action.SHORT_DESCRIPTION), "")
- def toolTip_=(t: String) {
- peer.putValue(javax.swing.Action.SHORT_DESCRIPTION, t)
- }
- /**
- * Can be used for status bars, for example.
- */
- def longDescription: String =
- ifNull(peer.getValue(javax.swing.Action.LONG_DESCRIPTION), "")
- def longDescription_=(t: String) {
- peer.putValue(javax.swing.Action.LONG_DESCRIPTION, t)
- }
-
- /**
- * Default: java.awt.event.KeyEvent.VK_UNDEFINED, i.e., no mnemonic key.
- * For all buttons and thus menu items.
- */
- def mnemonic: Int = ifNull(peer.getValue(javax.swing.Action.MNEMONIC_KEY),
- java.awt.event.KeyEvent.VK_UNDEFINED)
- def mnemonic_=(m: Int) { peer.putValue(javax.swing.Action.MNEMONIC_KEY, m) }
-
- /*/**
- * Indicates which character of the title should be underlined to indicate the mnemonic key.
- * Ignored if out of bounds of the title string. Default: -1, i.e., ignored.
- * For all buttons and thus menu items.
- */
- 1.6: def mnemonicIndex: Int =
- ifNull(peer.getValue(javax.swing.Action.DISPLAYED_MNEMONIC_INDEX_KEY), -1)
- def mnemonicIndex_=(n: Int) { peer.putValue(javax.swing.Action.DISPLAYED_MNEMONIC_INDEX_KEY, n) }
- */
-
- /**
- * For menus.
- */
- def accelerator: Option[KeyStroke] =
- toOption(peer.getValue(javax.swing.Action.ACCELERATOR_KEY))
- def accelerator_=(k: Option[KeyStroke]) {
- peer.putValue(javax.swing.Action.ACCELERATOR_KEY, k.orNull)
- }
-
- /**
- * For all components.
- */
- def enabled: Boolean = peer.isEnabled
- def enabled_=(b: Boolean) { peer.setEnabled(b) }
-
- /*/**
- * Only honored if not <code>None</code>. For various buttons.
- */
- 1.6: def selected: Option[Boolean] = Option(peer.getValue(javax.swing.Action.SELECTED_KEY))
- def selected_=(b: Option[Boolean]) {
- peer.putValue(javax.swing.Action.SELECTED_KEY,
- if (b == None) null else new java.lang.Boolean(b.get))
- }*/
-
- def apply()
-}
diff --git a/src/swing/scala/swing/Adjustable.scala b/src/swing/scala/swing/Adjustable.scala
deleted file mode 100644
index 590153fb33..0000000000
--- a/src/swing/scala/swing/Adjustable.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-package scala.swing
-
-import java.awt.{Adjustable => JAdjustable}
-
-object Adjustable {
- trait Wrapper extends Oriented.Wrapper with Adjustable {
- def peer: JAdjustable with OrientedMixin
-
- def unitIncrement = peer.getUnitIncrement
- def unitIncrement_=(i: Int) = peer.setUnitIncrement(i)
- def blockIncrement = peer.getBlockIncrement
- def blockIncrement_=(i: Int) = peer.setBlockIncrement(i)
-
- def value = peer.getValue
- def value_=(v: Int) = peer.setValue(v)
-
- def visibleAmount = peer.getVisibleAmount
- def visibleAmount_=(v: Int) = peer.setVisibleAmount(v)
-
- def minimum = peer.getMinimum
- def minimum_=(m: Int) = peer.setMinimum(m)
- def maximum = peer.getMaximum
- def maximum_=(m: Int) = peer.setMaximum(m)
- }
-}
-
-trait Adjustable extends Oriented {
- def unitIncrement: Int
- def unitIncrement_=(i: Int)
- def blockIncrement: Int
- def blockIncrement_=(i: Int)
-
- def value: Int
- def value_=(v : Int)
-
- def visibleAmount: Int
- def visibleAmount_=(v: Int)
-
- def minimum: Int
- def minimum_=(m: Int)
- def maximum: Int
- def maximum_=(m: Int)
-
-// Needs implementation of AdjustmentEvent
-//
-// val adjustments: Publisher = new Publisher {
-// peer.addAdjustmentListener(new AdjustmentListener {
-// def adjustmentValueChanged(e: java.awt.event.AdjustmentEvent) {
-// publish(new AdjustmentEvent(e))
-// }
-// })
-// }
-}
diff --git a/src/swing/scala/swing/Alignment.scala b/src/swing/scala/swing/Alignment.scala
deleted file mode 100644
index b49e89dbd9..0000000000
--- a/src/swing/scala/swing/Alignment.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.SwingConstants._
-
-/**
- * Horizontal and vertical alignments. We sacrifice a bit of type-safety
- * for simplicity here.
- *
- * @see javax.swing.SwingConstants
- */
-object Alignment extends Enumeration {
- val Left = Value(LEFT)
- val Right = Value(RIGHT)
- val Center = Value(CENTER)
- val Top = Value(TOP)
- val Bottom = Value(BOTTOM)
- //1.6: val Baseline = Value(BASELINE)
-
- val Leading = Value(LEADING)
- val Trailing = Value(TRAILING)
-}
-
diff --git a/src/swing/scala/swing/Applet.scala b/src/swing/scala/swing/Applet.scala
deleted file mode 100644
index b8ba4eabc0..0000000000
--- a/src/swing/scala/swing/Applet.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.JApplet
-
-/** <p>
- * Clients should implement the ui field. See the <code>SimpleApplet</code>
- * demo for an example.
- * </p>
- * <p>
- * <b>Note</b>: <code>Applet</code> extends <code>javax.swing.JApplet</code>
- * to satisfy Java's applet loading mechanism. The usual component wrapping
- * scheme doesn't work here.
- * </p>
- *
- * @see javax.swing.JApplet
- */
-abstract class Applet extends JApplet { outer =>
- val ui: UI
-
- override def init() { ui.init() }
- override def start() { ui.start() }
- override def stop() { ui.stop() }
-
- abstract class UI extends RootPanel {
- def peer = outer
- override def contents_=(c: Component) {
- super.contents_=(c)
- peer.validate()
- }
-
- def init()
- def start() {}
- def stop() {}
- }
-}
-
diff --git a/src/swing/scala/swing/BorderPanel.scala b/src/swing/scala/swing/BorderPanel.scala
deleted file mode 100644
index 75bb721ffc..0000000000
--- a/src/swing/scala/swing/BorderPanel.scala
+++ /dev/null
@@ -1,60 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import java.awt.BorderLayout
-
-object BorderPanel {
- /**
- * The position of a component in a <code>BorderPanel</code>
- */
- object Position extends Enumeration {
- val North = Value(BorderLayout.NORTH)
- val South = Value(BorderLayout.SOUTH)
- val West = Value(BorderLayout.WEST)
- val East = Value(BorderLayout.EAST)
- val Center = Value(BorderLayout.CENTER)
- }
- private[swing] def wrapPosition(s: String): Position.Value = s match {
- case BorderLayout.NORTH => Position.North
- case BorderLayout.SOUTH => Position.South
- case BorderLayout.WEST => Position.West
- case BorderLayout.EAST => Position.East
- case BorderLayout.CENTER => Position.Center
- }
-}
-
-/**
- * A container that arranges its children around a central component that
- * takes most of the space. The other children are placed on one of four
- * borders: north, east, south, west.
- *
- * @see javax.swing.BorderLayout
- */
-class BorderPanel extends Panel with LayoutContainer {
- import BorderPanel._
- def layoutManager = peer.getLayout.asInstanceOf[BorderLayout]
- override lazy val peer = new javax.swing.JPanel(new BorderLayout) with SuperMixin
-
- type Constraints = Position.Value
-
- protected def constraintsFor(comp: Component) =
- wrapPosition(layoutManager.getConstraints(comp.peer).asInstanceOf[String])
-
- protected def areValid(c: Constraints): (Boolean, String) = (true, "")
- protected def add(c: Component, l: Constraints) {
- // we need to remove previous components with the same constraints as the new one,
- // otherwise the layout manager loses track of the old one
- val old = layoutManager.getLayoutComponent(l.toString)
- if(old != null) peer.remove(old)
- peer.add(c.peer, l.toString)
- }
-}
diff --git a/src/swing/scala/swing/BoxPanel.scala b/src/swing/scala/swing/BoxPanel.scala
deleted file mode 100644
index f5859a8bb1..0000000000
--- a/src/swing/scala/swing/BoxPanel.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-/**
- * A panel that lays out its contents one after the other,
- * either horizontally or vertically.
- *
- * @see javax.swing.BoxLayout
- */
-class BoxPanel(orientation: Orientation.Value) extends Panel with SequentialContainer.Wrapper {
- override lazy val peer = {
- val p = new javax.swing.JPanel with SuperMixin
- val l = new javax.swing.BoxLayout(p, orientation.id)
- p.setLayout(l)
- p
- }
-}
diff --git a/src/swing/scala/swing/BufferWrapper.scala b/src/swing/scala/swing/BufferWrapper.scala
deleted file mode 100644
index 38230ba6eb..0000000000
--- a/src/swing/scala/swing/BufferWrapper.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import scala.collection.mutable.Buffer
-import scala.collection.Iterator
-
-/**
- * Default partial implementation for buffer adapters.
- */
-protected[swing] abstract class BufferWrapper[A] extends Buffer[A] { outer =>
- def clear() { for (i <- 0 until length) remove(0) }
- def update(n: Int, a: A) {
- remove(n)
- insertAt(n, a)
- }
- def insertAll(n: Int, elems: Traversable[A]) {
- var i = n
- for (el <- elems) {
- insertAt(i, el)
- i += 1
- }
- }
- protected def insertAt(n: Int, a: A)
-
- def +=:(a: A): this.type = { insertAt(0, a); this }
- def iterator = Iterator.range(0,length).map(apply(_))
-}
diff --git a/src/swing/scala/swing/Button.scala b/src/swing/scala/swing/Button.scala
deleted file mode 100644
index 0170727e3b..0000000000
--- a/src/swing/scala/swing/Button.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import javax.swing._
-
-object Button {
- def apply(text0: String)(op: => Unit) = new Button(Action(text0)(op))
-}
-
-/**
- * A button that can be clicked, usually to perform some action.
- *
- * @see javax.swing.JButton
- */
-class Button(text0: String) extends AbstractButton with Publisher {
- override lazy val peer: JButton = new JButton(text0) with SuperMixin
- def this() = this("")
- def this(a: Action) = {
- this("")
- action = a
- }
-
- def defaultButton: Boolean = peer.isDefaultButton
-
- def defaultCapable: Boolean = peer.isDefaultCapable
- def defaultCapable_=(capable: Boolean) { peer.setDefaultCapable(capable) }
-}
diff --git a/src/swing/scala/swing/ButtonGroup.scala b/src/swing/scala/swing/ButtonGroup.scala
deleted file mode 100644
index 0b04d20837..0000000000
--- a/src/swing/scala/swing/ButtonGroup.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import scala.collection.mutable
-
-/**
- * A button mutex. At most one of its associated buttons is selected
- * at a time.
- *
- * @see javax.swing.ButtonGroup
- */
-class ButtonGroup(initialButtons: AbstractButton*) {
- val peer: javax.swing.ButtonGroup = new javax.swing.ButtonGroup
-
- val buttons: mutable.Set[AbstractButton] = new mutable.Set[AbstractButton] {
- def -=(b: AbstractButton): this.type = { peer.remove(b.peer); this }
- def +=(b: AbstractButton): this.type = { peer.add(b.peer); this }
- def contains(b: AbstractButton) = this.iterator.contains(b)
- override def size = peer.getButtonCount
- def iterator: Iterator[AbstractButton] = new Iterator[AbstractButton] {
- val enum = peer.getElements
- def next = UIElement.cachedWrapper[AbstractButton](enum.nextElement)
- def hasNext = enum.hasMoreElements
- }
- }
- buttons ++= initialButtons
-
- //1.6: def deselectAll() { peer.clearSelection }
- def selected: Option[AbstractButton] = buttons.find(_.selected)
- def select(b: AbstractButton) { peer.setSelected(b.peer.getModel, true) }
-}
diff --git a/src/swing/scala/swing/CheckBox.scala b/src/swing/scala/swing/CheckBox.scala
deleted file mode 100644
index 7287c95a5d..0000000000
--- a/src/swing/scala/swing/CheckBox.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing._
-
-/**
- * Two state button that can either be checked or unchecked.
- *
- * @see javax.swing.JCheckBox
- */
-class CheckBox(text: String) extends ToggleButton {
- override lazy val peer: JCheckBox = new JCheckBox(text) with SuperMixin
- def this() = this("")
-
- def borderPaintedFlat: Boolean = peer.isBorderPaintedFlat
- def borderPaintedFlat_=(flat: Boolean) { peer.setBorderPaintedFlat(flat) }
-}
diff --git a/src/swing/scala/swing/ColorChooser.scala b/src/swing/scala/swing/ColorChooser.scala
deleted file mode 100644
index 591e652f1c..0000000000
--- a/src/swing/scala/swing/ColorChooser.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.JColorChooser
-import event._
-
-/**
- * Wrapper for JColorChooser. Publishes `ColorChanged` events, when the color selection changes.
- *
- * @author andy@hicks.net
- * @author Ingo Maier
- * @see javax.swing.JColorChooser
- */
-object ColorChooser {
- def showDialog(parent: Component, title: String, color: Color): scala.Option[Color] = {
- toOption[Color](javax.swing.JColorChooser.showDialog(parent.peer, title, color))
- }
-}
-
-class ColorChooser(color0: Color) extends Component {
- def this() = this(java.awt.Color.white)
-
- override lazy val peer: JColorChooser = new JColorChooser(color0) with SuperMixin
-
- peer.getSelectionModel.addChangeListener(new javax.swing.event.ChangeListener {
- def stateChanged(e: javax.swing.event.ChangeEvent) {
- publish(ColorChanged(ColorChooser.this, peer.getColor))
- }
- })
-
- def color: Color = peer.getColor
- def color_=(c: Color) = peer.setColor(c)
-
- def dragEnabled: Boolean = peer.getDragEnabled
- def dragEnabled_=(b: Boolean) = peer.setDragEnabled(b)
-} \ No newline at end of file
diff --git a/src/swing/scala/swing/ComboBox.scala b/src/swing/scala/swing/ComboBox.scala
deleted file mode 100644
index a075d22a7e..0000000000
--- a/src/swing/scala/swing/ComboBox.scala
+++ /dev/null
@@ -1,209 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import event._
-import javax.swing.{JList, JComponent, JComboBox, JTextField, ComboBoxModel, AbstractListModel, ListCellRenderer}
-import java.awt.event.ActionListener
-import scala.language.implicitConversions
-
-object ComboBox {
- /**
- * An editor for a combo box. Let's you edit the currently selected item.
- * It is highly recommended to use the BuiltInEditor class. For anything
- * else, one cannot guarantee that it integrates nicely with the current
- * LookAndFeel.
- *
- * Publishes action events.
- */
- trait Editor[A] extends Publisher {
- lazy val comboBoxPeer: javax.swing.ComboBoxEditor = new javax.swing.ComboBoxEditor with Publisher {
- def addActionListener(l: ActionListener) {
- this match {
- // TODO case w: Action.Trigger.Wrapper =>
- // w.peer.addActionListener(l)
- case _ =>
- this.subscribe(new Reactions.Wrapper(l) ({
- case ActionEvent(c) => l.actionPerformed(new java.awt.event.ActionEvent(c.peer, 0, ""))
- }))
- }
- }
- def removeActionListener(l: ActionListener) {
- this match {
- // TODO case w: Action.Trigger.Wrapper =>
- // w.peer.removeActionListener(l)
- case _ =>
- this.unsubscribe(new Reactions.Wrapper(l)({ case _ => }))
- }
- }
- def getEditorComponent: JComponent = Editor.this.component.peer
- def getItem(): AnyRef = item.asInstanceOf[AnyRef]
- def selectAll() { startEditing() }
- def setItem(a: Any) { item = a.asInstanceOf[A] }
- }
- def component: Component
- def item: A
- def item_=(a: A)
- def startEditing()
- }
-
- /**
- * Use this editor, if you want to reuse the builtin editor supplied by the current
- * Look and Feel. This is restricted to a text field as the editor widget. The
- * conversion from and to a string is done by the supplied functions.
- *
- * It's okay if string2A throws exceptions. They are caught by an input verifier.
- */
- class BuiltInEditor[A](comboBox: ComboBox[A])(string2A: String => A,
- a2String: A => String) extends ComboBox.Editor[A] {
- protected[swing] class DelegatedEditor(editor: javax.swing.ComboBoxEditor) extends javax.swing.ComboBoxEditor {
- var value: A = {
- val v = comboBox.peer.getSelectedItem
- try {
- v match {
- case s: String => string2A(s)
- case _ => v.asInstanceOf[A]
- }
- } catch {
- case _: Exception =>
- throw new IllegalArgumentException("ComboBox not initialized with a proper value, was '" + v + "'.")
- }
- }
- def addActionListener(l: ActionListener) {
- editor.addActionListener(l)
- }
- def removeActionListener(l: ActionListener) {
- editor.removeActionListener(l)
- }
-
- def getEditorComponent: JComponent = editor.getEditorComponent.asInstanceOf[JComponent]
- def selectAll() { editor.selectAll() }
- def getItem(): AnyRef = { verifier.verify(getEditorComponent); value.asInstanceOf[AnyRef] }
- def setItem(a: Any) { editor.setItem(a) }
-
- val verifier = new javax.swing.InputVerifier {
- // TODO: should chain with potentially existing verifier in editor
- def verify(c: JComponent) = try {
- value = string2A(c.asInstanceOf[JTextField].getText)
- true
- }
- catch {
- case e: Exception => false
- }
- }
-
- def textEditor = getEditorComponent.asInstanceOf[JTextField]
- textEditor.setInputVerifier(verifier)
- textEditor.addActionListener(Swing.ActionListener{ a =>
- getItem() // make sure our value is updated
- textEditor.setText(a2String(value))
- })
- }
-
- override lazy val comboBoxPeer: javax.swing.ComboBoxEditor = new DelegatedEditor(comboBox.peer.getEditor)
-
- def component = Component.wrap(comboBoxPeer.getEditorComponent.asInstanceOf[JComponent])
- def item: A = { comboBoxPeer.asInstanceOf[DelegatedEditor].value }
- def item_=(a: A) { comboBoxPeer.setItem(a2String(a)) }
- def startEditing() { comboBoxPeer.selectAll() }
- }
-
- implicit def stringEditor(c: ComboBox[String]): Editor[String] = new BuiltInEditor(c)(s => s, s => s)
- implicit def intEditor(c: ComboBox[Int]): Editor[Int] = new BuiltInEditor(c)(s => s.toInt, s => s.toString)
- implicit def floatEditor(c: ComboBox[Float]): Editor[Float] = new BuiltInEditor(c)(s => s.toFloat, s => s.toString)
- implicit def doubleEditor(c: ComboBox[Double]): Editor[Double] = new BuiltInEditor(c)(s => s.toDouble, s => s.toString)
-
- def newConstantModel[A](items: Seq[A]): ComboBoxModel = {
- new AbstractListModel with ComboBoxModel {
- private var selected: A = if (items.isEmpty) null.asInstanceOf[A] else items(0)
- def getSelectedItem: AnyRef = selected.asInstanceOf[AnyRef]
- def setSelectedItem(a: Any) {
- if ((selected != null && selected != a) ||
- selected == null && a != null) {
- selected = a.asInstanceOf[A]
- fireContentsChanged(this, -1, -1)
- }
- }
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
- def getSize = items.size
- }
- }
-
- /*def newMutableModel[A, Self](items: Seq[A] with scala.collection.mutable.Publisher[scala.collection.mutable.Message[A], Self]): ComboBoxModel = {
- new AbstractListModel with ComboBoxModel {
- private var selected = items(0)
- def getSelectedItem: AnyRef = selected.asInstanceOf[AnyRef]
- def setSelectedItem(a: Any) { selected = a.asInstanceOf[A] }
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
- def getSize = items.size
- }
- }
-
- def newConstantModel[A](items: Seq[A]): ComboBoxModel = items match {
- case items: Seq[A] with scala.collection.mutable.Publisher[scala.collection.mutable.Message[A], Self] => newMutableModel
- case _ => newConstantModel(items)
- }*/
-}
-
-/**
- * Let's the user make a selection from a list of predefined items. Visually,
- * this is implemented as a button-like component with a pull-down menu.
- *
- * @see javax.swing.JComboBox
- */
-class ComboBox[A](items: Seq[A]) extends Component with Publisher {
- override lazy val peer: JComboBox = new JComboBox(ComboBox.newConstantModel(items)) with SuperMixin
-
- object selection extends Publisher {
- def index: Int = peer.getSelectedIndex
- def index_=(n: Int) { peer.setSelectedIndex(n) }
- def item: A = peer.getSelectedItem.asInstanceOf[A]
- def item_=(a: A) { peer.setSelectedItem(a) }
-
- peer.addActionListener(Swing.ActionListener { e =>
- publish(event.SelectionChanged(ComboBox.this))
- })
- }
-
- /**
- * Sets the renderer for this combo box's items. Index -1 is
- * passed to the renderer for the selected item (not in the pull-down menu).
- *
- * The underlying combo box renders all items in a <code>ListView</code>
- * (both, in the pull-down menu as well as in the box itself), hence the
- * <code>ListView.Renderer</code>.
- *
- * Note that the UI peer of a combo box usually changes the colors
- * of the component to its own defaults _after_ the renderer has been
- * configured. That's Swing's principle of most suprise.
- */
- def renderer: ListView.Renderer[A] = ListView.Renderer.wrap[A](peer.getRenderer)
- def renderer_=(r: ListView.Renderer[A]) { peer.setRenderer(r.peer) }
-
- /* XXX: currently not safe to expose:
- def editor: ComboBox.Editor[A] =
- def editor_=(r: ComboBox.Editor[A]) { peer.setEditor(r.comboBoxPeer) }
- */
- def editable: Boolean = peer.isEditable
-
- /**
- * Makes this combo box editable. In order to do so, this combo needs an
- * editor which is supplied by the implicit argument. For default
- * editors, see ComboBox companion object.
- */
- def makeEditable()(implicit editor: ComboBox[A] => ComboBox.Editor[A]) {
- peer.setEditable(true)
- peer.setEditor(editor(this).comboBoxPeer)
- }
-
- def prototypeDisplayValue: Option[A] = toOption[A](peer.getPrototypeDisplayValue)
- def prototypeDisplayValue_=(v: Option[A]) {
- peer.setPrototypeDisplayValue((v map toAnyRef).orNull)
- }
-}
diff --git a/src/swing/scala/swing/Component.scala b/src/swing/scala/swing/Component.scala
deleted file mode 100644
index 3a47784562..0000000000
--- a/src/swing/scala/swing/Component.scala
+++ /dev/null
@@ -1,295 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import event._
-
-import java.awt.Graphics
-import java.awt.event._
-import javax.swing.JComponent
-import javax.swing.border.Border
-
-/**
- * Utility methods, mostly for wrapping components.
- */
-object Component {
- /**
- * Wraps a given Java Swing Component into a new wrapper.
- */
- def wrap(c: JComponent): Component = {
- val w = UIElement.cachedWrapper[Component](c)
- if (w != null) w
- else new Component { override lazy val peer = c }
- }
-}
-
-/**
- * Base class for all UI elements that can be displayed in a window.
- * Components are publishers that fire the following event classes:
- * ComponentEvent, FocusEvent, FontChanged, ForegroundChanged, BackgroundChanged.
- *
- * @note [Java Swing] Unlike in Java Swing, not all components are also containers.
- *
- * @see javax.swing.JComponent
- * @see http://java.sun.com/products/jfc/tsc/articles/painting/ for the component
- * painting mechanism
- */
-abstract class Component extends UIElement {
- override lazy val peer: javax.swing.JComponent = new javax.swing.JComponent with SuperMixin {}
- var initP: JComponent = null
-
- /**
- * This trait is used to redirect certain calls from the peer to the wrapper
- * and back. Useful to expose methods that can be customized by overriding.
- */
- protected trait SuperMixin extends JComponent {
- override def paintComponent(g: Graphics) {
- Component.this.paintComponent(g.asInstanceOf[Graphics2D])
- }
- def __super__paintComponent(g: Graphics) {
- super.paintComponent(g)
- }
- override def paintBorder(g: Graphics) {
- Component.this.paintBorder(g.asInstanceOf[Graphics2D])
- }
- def __super__paintBorder(g: Graphics) {
- super.paintBorder(g)
- }
- override def paintChildren(g: Graphics) {
- Component.this.paintChildren(g.asInstanceOf[Graphics2D])
- }
- def __super__paintChildren(g: Graphics) {
- super.paintChildren(g)
- }
-
- override def paint(g: Graphics) {
- Component.this.paint(g.asInstanceOf[Graphics2D])
- }
- def __super__paint(g: Graphics) {
- super.paint(g)
- }
- }
-
- def name: String = peer.getName
- def name_=(s: String) = peer.setName(s)
-
- /**
- * Used by certain layout managers, e.g., BoxLayout or OverlayLayout to
- * align components relative to each other.
- */
- def xLayoutAlignment: Double = peer.getAlignmentX.toDouble
- def xLayoutAlignment_=(x: Double) = peer.setAlignmentX(x.toFloat)
- def yLayoutAlignment: Double = peer.getAlignmentY.toDouble
- def yLayoutAlignment_=(y: Double) = peer.setAlignmentY(y.toFloat)
-
- def border: Border = peer.getBorder
- def border_=(b: Border) { peer.setBorder(b) }
-
- def opaque: Boolean = peer.isOpaque
- def opaque_=(b: Boolean) = peer.setOpaque(b)
-
- def enabled: Boolean = peer.isEnabled
- def enabled_=(b: Boolean) = peer.setEnabled(b)
-
- def tooltip: String = peer.getToolTipText
- def tooltip_=(t: String) = peer.setToolTipText(t)
-
- def inputVerifier: Component => Boolean = { a =>
- Option(peer.getInputVerifier) forall (_ verify a.peer)
- }
- def inputVerifier_=(v: Component => Boolean) {
- peer.setInputVerifier(new javax.swing.InputVerifier {
- def verify(c: javax.swing.JComponent) = v(UIElement.cachedWrapper[Component](c))
- })
- }
-
- /*def verifyOnTraversal: (Component, Component) => Boolean = { a =>
- peer.getInputVerifier().verify(a.peer)
- }
- def verifyOnTraversal_=(v: (Component, Component) => Boolean) {
- peer.setInputVerifier(new javax.swing.InputVerifier {
- def verify(c: javax.swing.JComponent) = v(UIElement.cachedWrapper[Component](c))
- })
- }*/
- /**
- * Contains publishers for various mouse events. They are separated for
- * efficiency reasons.
- */
- object mouse {
- /**
- * Publishes clicks, presses and releases.
- */
- val clicks: Publisher = new LazyPublisher {
- lazy val l = new MouseListener {
- def mouseEntered(e: java.awt.event.MouseEvent) {}
- def mouseExited(e: java.awt.event.MouseEvent) {}
- def mouseClicked(e: java.awt.event.MouseEvent) {
- publish(new MouseClicked(e))
- }
- def mousePressed(e: java.awt.event.MouseEvent) {
- publish(new MousePressed(e))
- }
- def mouseReleased(e: java.awt.event.MouseEvent) {
- publish(new MouseReleased(e))
- }
- }
-
- def onFirstSubscribe() = peer.addMouseListener(l)
- def onLastUnsubscribe() = peer.removeMouseListener(l)
- }
- /**
- * Publishes enters, exits, moves, and drags.
- */
- val moves: Publisher = new LazyPublisher {
- lazy val mouseListener = new MouseListener {
- def mouseEntered(e: java.awt.event.MouseEvent) {
- publish(new MouseEntered(e))
- }
- def mouseExited(e: java.awt.event.MouseEvent) {
- publish(new MouseExited(e))
- }
- def mouseClicked(e: java.awt.event.MouseEvent) {}
- def mousePressed(e: java.awt.event.MouseEvent) {}
- def mouseReleased(e: java.awt.event.MouseEvent) {}
- }
-
- lazy val mouseMotionListener = new MouseMotionListener {
- def mouseMoved(e: java.awt.event.MouseEvent) {
- publish(new MouseMoved(e))
- }
- def mouseDragged(e: java.awt.event.MouseEvent) {
- publish(new MouseDragged(e))
- }
- }
- def onFirstSubscribe() {
- peer.addMouseListener(mouseListener)
- peer.addMouseMotionListener(mouseMotionListener)
- }
- def onLastUnsubscribe() {
- peer.removeMouseListener(mouseListener)
- peer.removeMouseMotionListener(mouseMotionListener)
- }
- }
- /**
- * Publishes mouse wheel moves.
- */
- val wheel: Publisher = new LazyPublisher {
- // We need to subscribe lazily and unsubscribe, since components in scroll panes capture
- // mouse wheel events if there is a listener installed. See ticket #1442.
- lazy val l = new MouseWheelListener {
- def mouseWheelMoved(e: java.awt.event.MouseWheelEvent) {
- publish(new MouseWheelMoved(e))
- }
- }
- def onFirstSubscribe() = peer.addMouseWheelListener(l)
- def onLastUnsubscribe() = peer.removeMouseWheelListener(l)
- }
- }
-
- object keys extends Publisher {
- peer.addKeyListener(new KeyListener {
- def keyPressed(e: java.awt.event.KeyEvent) { publish(new KeyPressed(e)) }
- def keyReleased(e: java.awt.event.KeyEvent) { publish(new KeyReleased(e)) }
- def keyTyped(e: java.awt.event.KeyEvent) { publish(new KeyTyped(e)) }
- })
- }
-
- def focusable: Boolean = peer.isFocusable
- def focusable_=(b: Boolean) = peer.setFocusable(b)
- def requestFocus() = peer.requestFocus()
- def requestFocusInWindow() = peer.requestFocusInWindow()
- def hasFocus: Boolean = peer.isFocusOwner
-
- protected override def onFirstSubscribe() {
- super.onFirstSubscribe
- // TODO: deprecated, remove after 2.8
- peer.addComponentListener(new java.awt.event.ComponentListener {
- def componentHidden(e: java.awt.event.ComponentEvent) {
- publish(UIElementHidden(Component.this))
- }
- def componentShown(e: java.awt.event.ComponentEvent) {
- publish(UIElementShown(Component.this))
- }
- def componentMoved(e: java.awt.event.ComponentEvent) {
- publish(UIElementMoved(Component.this))
- }
- def componentResized(e: java.awt.event.ComponentEvent) {
- publish(UIElementResized(Component.this))
- }
- })
-
- peer.addFocusListener(new java.awt.event.FocusListener {
- def other(e: java.awt.event.FocusEvent) = e.getOppositeComponent match {
- case c: JComponent => Some(UIElement.cachedWrapper[Component](c))
- case _ => None
- }
-
- def focusGained(e: java.awt.event.FocusEvent) {
- publish(FocusGained(Component.this, other(e), e.isTemporary))
- }
- def focusLost(e: java.awt.event.FocusEvent) {
- publish(FocusLost(Component.this, other(e), e.isTemporary))
- }
- })
-
- peer.addPropertyChangeListener(new java.beans.PropertyChangeListener {
- def propertyChange(e: java.beans.PropertyChangeEvent) {
- e.getPropertyName match {
- case "font" => publish(FontChanged(Component.this))
- case "background" => publish(BackgroundChanged(Component.this))
- case "foreground" => publish(ForegroundChanged(Component.this))
- case _ =>
- /*case "focusable" =>
- case "focusTraversalKeysEnabled" =>
- case "forwardFocusTraversalKeys" =>
- case "backwardFocusTraversalKeys" =>
- case "upCycleFocusTraversalKeys" =>
- case "downCycleFocusTraversalKeys" =>
- case "focusTraversalPolicy" =>
- case "focusCycleRoot" =>*/
- }
- }
- })
- }
-
- def revalidate() { peer.revalidate() }
-
- /**
- * For custom painting, users should usually override this method.
- */
- protected def paintComponent(g: Graphics2D) {
- peer match {
- case peer: SuperMixin => peer.__super__paintComponent(g)
- case _ =>
- }
- }
-
- protected def paintBorder(g: Graphics2D) {
- peer match {
- case peer: SuperMixin => peer.__super__paintBorder(g)
- case _ =>
- }
- }
-
- protected def paintChildren(g: Graphics2D) {
- peer match {
- case peer: SuperMixin => peer.__super__paintChildren(g)
- case _ =>
- }
- }
-
- def paint(g: Graphics2D) {
- peer match {
- case peer: SuperMixin => peer.__super__paint(g)
- case _ => peer.paint(g)
- }
- }
-
- override def toString = "scala.swing wrapper " + peer.toString
-}
diff --git a/src/swing/scala/swing/Container.scala b/src/swing/scala/swing/Container.scala
deleted file mode 100644
index 24889f0ceb..0000000000
--- a/src/swing/scala/swing/Container.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import event._
-import scala.collection.mutable.Buffer
-
-object Container {
- /**
- * Utility trait for wrapping containers. Provides an immutable
- * implementation of the contents member.
- */
- trait Wrapper extends Container with Publisher {
- override def peer: javax.swing.JComponent
-
- protected val _contents = new Content
- def contents: Seq[Component] = _contents
-
- protected class Content extends BufferWrapper[Component] {
- override def clear() { peer.removeAll() }
- override def remove(n: Int): Component = {
- val c = peer.getComponent(n)
- peer.remove(n)
- UIElement.cachedWrapper[Component](c)
- }
- protected def insertAt(n: Int, c: Component) { peer.add(c.peer, n) }
- def +=(c: Component): this.type = { peer.add(c.peer) ; this }
- def length = peer.getComponentCount
- def apply(n: Int) = UIElement.cachedWrapper[Component](peer.getComponent(n))
- }
-
- peer.addContainerListener(new java.awt.event.ContainerListener {
- def componentAdded(e: java.awt.event.ContainerEvent) {
- publish(ComponentAdded(Wrapper.this,
- UIElement.cachedWrapper[Component](e.getChild.asInstanceOf[javax.swing.JComponent])))
- }
- def componentRemoved(e: java.awt.event.ContainerEvent) {
- publish(ComponentRemoved(Wrapper.this,
- UIElement.cachedWrapper[Component](e.getChild.asInstanceOf[javax.swing.JComponent])))
- }
- })
- }
-}
-
-/**
- * The base traits for UI elements that can contain <code>Component</code>s.
- *
- * @note [Java Swing] This is not the wrapper for java.awt.Container but a trait
- * that extracts a common interface for components, menus, and windows.
- */
-trait Container extends UIElement {
- /**
- * The child components of this container.
- */
- def contents: Seq[Component]
-}
diff --git a/src/swing/scala/swing/EditorPane.scala b/src/swing/scala/swing/EditorPane.scala
deleted file mode 100644
index 9b1aab7874..0000000000
--- a/src/swing/scala/swing/EditorPane.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import javax.swing._
-import javax.swing.text._
-
-/**
- * A text component that allows multiline text input and display.
- *
- * @see javax.swing.JEditorPane
- */
-class EditorPane(contentType0: String, text0: String) extends TextComponent {
- override lazy val peer: JEditorPane = new JEditorPane(contentType0, text0) with SuperMixin
- def this() = this("text/plain", "")
-
- def contentType: String = peer.getContentType
- def contentType_=(t: String) = peer.setContentType(t)
-
- def editorKit: EditorKit = peer.getEditorKit
- def editorKit_=(k: EditorKit) = peer.setEditorKit(k)
-}
diff --git a/src/swing/scala/swing/FileChooser.scala b/src/swing/scala/swing/FileChooser.scala
deleted file mode 100644
index e731c676c2..0000000000
--- a/src/swing/scala/swing/FileChooser.scala
+++ /dev/null
@@ -1,111 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import java.io.File
-import javax.swing._
-import javax.swing.filechooser._
-
-object FileChooser {
- /**
- * The result of a file dialog. The precise meaning of the `Approve`
- * result depends on the specific dialog type. Could be `"save"` or
- * `"open"` for instance.
- */
- object Result extends Enumeration {
- val Cancel = Value(JFileChooser.CANCEL_OPTION)
- val Approve = Value(JFileChooser.APPROVE_OPTION)
- val Error = Value(JFileChooser.ERROR_OPTION)
- }
-
- /**
- * The kind of elements a user can select in a file dialog.
- */
- object SelectionMode extends Enumeration {
- val FilesOnly = Value(JFileChooser.FILES_ONLY)
- val DirectoriesOnly = Value(JFileChooser.DIRECTORIES_ONLY)
- val FilesAndDirectories = Value(JFileChooser.FILES_AND_DIRECTORIES)
- }
-}
-
-/**
- * Used to open file dialogs.
- *
- * @see [[javax.swing.JFileChooser]]
- */
-class FileChooser(dir: File) {
- import FileChooser._
- lazy val peer: JFileChooser = new JFileChooser(dir)
-
- def this() = this(null)
-
- import Swing._
- def showOpenDialog(over: Component): Result.Value = Result(peer.showOpenDialog(nullPeer(over)))
- def showSaveDialog(over: Component): Result.Value = Result(peer.showSaveDialog(nullPeer(over)))
- def showDialog(over: Component, approveText: String): Result.Value = Result(peer.showDialog(nullPeer(over), approveText))
-
- def controlButtonsAreShown: Boolean = peer.getControlButtonsAreShown
- def controlButtonsAreShown_=(b: Boolean) { peer.setControlButtonsAreShown(b) }
-
- def title: String = peer.getDialogTitle
- def title_=(t: String) { peer.setDialogTitle(t) }
-
- def accessory: Component = UIElement.cachedWrapper[Component](peer.getAccessory)
- def accessory_=(c: Component) { peer.setAccessory(c.peer) }
-
- def fileHidingEnabled: Boolean = peer.isFileHidingEnabled
- def fileHidingEnabled_=(b: Boolean) { peer.setFileHidingEnabled(b) }
- def fileSelectionMode: SelectionMode.Value = SelectionMode(peer.getFileSelectionMode)
- def fileSelectionMode_=(s: SelectionMode.Value) { peer.setFileSelectionMode(s.id) }
- def fileFilter: FileFilter = peer.getFileFilter
- def fileFilter_=(f: FileFilter) { peer setFileFilter f }
-
- def selectedFile: File = peer.getSelectedFile
- def selectedFile_=(file: File) { peer.setSelectedFile(file) }
- def selectedFiles: Seq[File] = peer.getSelectedFiles
- def selectedFiles_=(files: File*) { peer.setSelectedFiles(files.toArray) }
-
- def multiSelectionEnabled: Boolean = peer.isMultiSelectionEnabled
- def multiSelectionEnabled_=(b: Boolean) { peer.setMultiSelectionEnabled(b) }
-
- def iconFor(f: File) = peer.getIcon(f)
- def descriptionFor(f: File) = peer.getDescription(f)
- def nameFor(f: File) = peer.getName(f)
- def typeDescriptionFor(f: File) = peer.getTypeDescription(f)
- def traversable(f: File) = peer.isTraversable(f)
-
- def acceptAllFileFilter = peer.getAcceptAllFileFilter
-
- /*peer.addPropertyChangeListener(new java.beans.PropertyChangeListener {
- def propertyChange(e: java.beans.PropertyChangeEvent) {
- import JFileChooser._
- e.getPropertyName match {
- case APPROVE_BUTTON_TEXT_CHANGED_PROPERTY =>
- case ACCESSORY_CHANGED_PROPERTY =>
- case APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY =>
- case APPROVE_BUTTON_TEXT_CHANGED_PROPERTY =>
- case APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY =>
- case CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY =>
- case CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY =>
- case DIALOG_TITLE_CHANGED_PROPERTY =>
- case DIALOG_TYPE_CHANGED_PROPERTY =>
- case DIRECTORY_CHANGED_PROPERTY =>
- case FILE_FILTER_CHANGED_PROPERTY =>
- case FILE_HIDING_CHANGED_PROPERTY =>
- case FILE_SELECTION_MODE_CHANGED_PROPERTY =>
- case FILE_SYSTEM_VIEW_CHANGED_PROPERTY =>
- case FILE_VIEW_CHANGED_PROPERTY =>
- case MULTI_SELECTION_ENABLED_CHANGED_PROPERTY =>
- case SELECTED_FILE_CHANGED_PROPERTY =>
- case SELECTED_FILES_CHANGED_PROPERTY =>
- case _ =>
- }
- }
- })*/
-}
diff --git a/src/swing/scala/swing/FlowPanel.scala b/src/swing/scala/swing/FlowPanel.scala
deleted file mode 100644
index feeb3d4742..0000000000
--- a/src/swing/scala/swing/FlowPanel.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import java.awt.FlowLayout
-import javax.swing.JPanel
-
-object FlowPanel {
- object Alignment extends Enumeration {
- val Leading = Value(FlowLayout.LEADING)
- val Trailing = Value(FlowLayout.TRAILING)
- val Left = Value(FlowLayout.LEFT)
- val Right = Value(FlowLayout.RIGHT)
- val Center = Value(FlowLayout.CENTER)
- }
-}
-
-/**
- * A panel that arranges its contents horizontally, one after the other.
- * If they don't fit, this panel will try to insert line breaks.
- *
- * @see java.awt.FlowLayout
- */
-class FlowPanel(alignment: FlowPanel.Alignment.Value)(contents0: Component*) extends Panel with SequentialContainer.Wrapper {
- override lazy val peer: JPanel =
- new JPanel(new java.awt.FlowLayout(alignment.id)) with SuperMixin
- def this(contents0: Component*) = this(FlowPanel.Alignment.Center)(contents0: _*)
- def this() = this(FlowPanel.Alignment.Center)()
-
- contents ++= contents0
-
- private def layoutManager = peer.getLayout.asInstanceOf[java.awt.FlowLayout]
-
- def vGap: Int = layoutManager.getVgap
- def vGap_=(n: Int) { layoutManager.setVgap(n) }
- def hGap: Int = layoutManager.getHgap
- def hGap_=(n: Int) { layoutManager.setHgap(n) }
-}
diff --git a/src/swing/scala/swing/FormattedTextField.scala b/src/swing/scala/swing/FormattedTextField.scala
deleted file mode 100644
index b08075850c..0000000000
--- a/src/swing/scala/swing/FormattedTextField.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import javax.swing._
-
-object FormattedTextField {
- /**
- * The behavior of a formatted text field when it loses its focus.
- */
- object FocusLostBehavior extends Enumeration {
- val Commit = Value(JFormattedTextField.COMMIT)
- val CommitOrRevert = Value(JFormattedTextField.COMMIT_OR_REVERT)
- val Persist = Value(JFormattedTextField.PERSIST)
- val Revert = Value(JFormattedTextField.REVERT)
- }
-}
-
-/**
- * A text field with formatted input.
- *
- * @see javax.swing.JFormattedTextField
- */
-class FormattedTextField(format: java.text.Format) extends TextComponent {
- override lazy val peer: JFormattedTextField = new JFormattedTextField(format) with SuperMixin
-
- import FormattedTextField._
-
- def commitEdit() { peer.commitEdit() }
- def editValid: Boolean = peer.isEditValid
-
- def focusLostBehavior: FocusLostBehavior.Value = FocusLostBehavior(peer.getFocusLostBehavior)
- def focusLostBehavior_=(b: FocusLostBehavior.Value) { peer.setFocusLostBehavior(b.id) }
-}
diff --git a/src/swing/scala/swing/GridBagPanel.scala b/src/swing/scala/swing/GridBagPanel.scala
deleted file mode 100644
index c58d398737..0000000000
--- a/src/swing/scala/swing/GridBagPanel.scala
+++ /dev/null
@@ -1,114 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import java.awt.{GridBagConstraints, GridBagLayout}
-import scala.language.implicitConversions
-
-object GridBagPanel {
- object Fill extends Enumeration {
- val None = Value(GridBagConstraints.NONE)
- val Horizontal = Value(GridBagConstraints.HORIZONTAL)
- val Vertical = Value(GridBagConstraints.VERTICAL)
- val Both = Value(GridBagConstraints.BOTH)
- }
- object Anchor extends Enumeration {
- val North = Value(GridBagConstraints.NORTH)
- val NorthEast = Value(GridBagConstraints.NORTHEAST)
- val East = Value(GridBagConstraints.EAST)
- val SouthEast = Value(GridBagConstraints.SOUTHEAST)
- val South = Value(GridBagConstraints.SOUTH)
- val SouthWest = Value(GridBagConstraints.SOUTHWEST)
- val West = Value(GridBagConstraints.WEST)
- val NorthWest = Value(GridBagConstraints.NORTHWEST)
- val Center = Value(GridBagConstraints.CENTER)
-
- val PageStart = Value(GridBagConstraints.PAGE_START)
- val PageEnd = Value(GridBagConstraints.PAGE_END)
- val LineStart = Value(GridBagConstraints.LINE_START)
- val LineEnd = Value(GridBagConstraints.LINE_END)
- val FirstLineStart = Value(GridBagConstraints.FIRST_LINE_START)
- val FirstLineEnd = Value(GridBagConstraints.FIRST_LINE_END)
- val LastLineStart = Value(GridBagConstraints.LAST_LINE_START)
- val LastLineEnd = Value(GridBagConstraints.LAST_LINE_END)
- }
-}
-
-/**
- * A panel that arranges its children in a grid. Layout details can be
- * given for each cell of the grid.
- *
- * @see java.awt.GridBagLayout
- */
-class GridBagPanel extends Panel with LayoutContainer {
- override lazy val peer = new javax.swing.JPanel(new GridBagLayout) with SuperMixin
- import GridBagPanel._
-
- private def layoutManager = peer.getLayout.asInstanceOf[GridBagLayout]
-
- /**
- * Convenient conversion from xy-coords given as pairs to
- * grid bag constraints.
- */
- implicit def pair2Constraints(p: (Int, Int)): Constraints = {
- val c = new Constraints
- c.gridx = p._1
- c.gridy = p._2
- c
- }
-
- class Constraints(val peer: GridBagConstraints) extends Proxy {
- def self = peer
- def this(gridx: Int, gridy: Int,
- gridwidth: Int, gridheight: Int,
- weightx: Double, weighty: Double,
- anchor: Int, fill: Int, insets: Insets,
- ipadx: Int, ipady: Int) =
- this(new GridBagConstraints(gridx, gridy,
- gridwidth, gridheight,
- weightx, weighty,
- anchor, fill, insets,
- ipadx, ipady))
- def this() = this(new GridBagConstraints())
- def gridx: Int = peer.gridx
- def gridx_=(x: Int) { peer.gridx = x }
- def gridy: Int = peer.gridy
- def gridy_=(y: Int) { peer.gridy = y }
- def grid: (Int, Int) = (gridx, gridy)
- def grid_=(c: (Int, Int)) = {
- gridx = c._1
- gridy = c._2
- }
-
- def gridwidth: Int = peer.gridwidth
- def gridwidth_=(w: Int) { peer.gridwidth = w }
- def gridheight: Int = peer.gridheight
- def gridheight_=(h: Int) { peer.gridheight = h }
- def weightx: Double = peer.weightx
- def weightx_=(x: Double) { peer.weightx = x }
- def weighty: Double = peer.weighty
- def weighty_=(y: Double) { peer.weighty = y }
- def anchor: Anchor.Value = Anchor(peer.anchor)
- def anchor_=(a: Anchor.Value) { peer.anchor = a.id }
- def fill: Fill.Value = Fill(peer.fill)
- def fill_=(f: Fill.Value) { peer.fill = f.id }
- def insets: Insets = peer.insets
- def insets_=(i: Insets) { peer.insets = i }
- def ipadx: Int = peer.ipadx
- def ipadx_=(x: Int) { peer.ipadx = x }
- def ipady: Int = peer.ipady
- def ipady_=(y: Int) { peer.ipady = y }
- }
-
- protected def constraintsFor(comp: Component) =
- new Constraints(layoutManager.getConstraints(comp.peer))
-
- protected def areValid(c: Constraints): (Boolean, String) = (true, "")
- protected def add(c: Component, l: Constraints) { peer.add(c.peer, l.peer) }
-}
diff --git a/src/swing/scala/swing/GridPanel.scala b/src/swing/scala/swing/GridPanel.scala
deleted file mode 100644
index d41f9e1c13..0000000000
--- a/src/swing/scala/swing/GridPanel.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-object GridPanel {
- val Adapt = 0
-}
-
-/**
- * A panel that lays out its contents in a uniform grid.
- *
- * @see java.awt.GridLayout
- */
-class GridPanel(rows0: Int, cols0: Int) extends Panel with SequentialContainer.Wrapper {
- override lazy val peer =
- new javax.swing.JPanel(new java.awt.GridLayout(rows0, cols0)) with SuperMixin
-
- /*type Constraints = (Int, Int)
-
- protected def constraintsFor(comp: Component) = {
- assert(peer.getComponentOrientation.isHorizontal)
- val idx = contents.indexOf(comp)
- val (r, c) = (((idx-1)/columns)+1, ((idx-1)%columns)+1)
- if (peer.getComponentOrientation.isLeftToRight) (r, c)
- else (r, columns-c+1)
- }
-
- protected def add(c: Component, l: Constraints) { peer.add(c.peer, (l._1-1)*columns+l._2) }
- protected def areValid(c: Constraints): (Boolean, String) =
- ((c._1 > 0 && c._2 > 0), "Grid coordinates (row,col) must be >= 1 but where " + c)*/
-
- private def layoutManager = peer.getLayout.asInstanceOf[java.awt.GridLayout]
-
- def rows: Int = layoutManager.getRows
- def rows_=(n: Int) { layoutManager.setRows(n) }
- def columns: Int = layoutManager.getColumns
- def columns_=(n: Int) { layoutManager.setColumns(n) }
-
- def vGap: Int = layoutManager.getVgap
- def vGap_=(n: Int) { layoutManager.setVgap(n) }
- def hGap: Int = layoutManager.getHgap
- def hGap_=(n: Int) { layoutManager.setHgap(n) }
-}
diff --git a/src/swing/scala/swing/Label.scala b/src/swing/scala/swing/Label.scala
deleted file mode 100644
index 65d43cbe19..0000000000
--- a/src/swing/scala/swing/Label.scala
+++ /dev/null
@@ -1,62 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing._
-import scala.swing.Swing._
-
-/**
- * A label component that display either a text, an icon, or both.
- *
- * @see javax.swing.JLabel
- */
-class Label(text0: String, icon0: Icon, align: Alignment.Value) extends Component {
- override lazy val peer: JLabel =
- new JLabel(text0, toNullIcon(icon0), align.id) with SuperMixin
-
- def this() = this("", EmptyIcon, Alignment.Center)
- def this(s: String) = this(s, EmptyIcon, Alignment.Center)
- def text: String = peer.getText
- def text_=(s: String) = peer.setText(s)
- def icon: Icon = peer.getIcon
- def icon_=(i: Icon) = peer.setIcon(i)
-
- /**
- * The alignment of the label's contents relative to its bounding box.
- */
- def xAlignment: Alignment.Value = Alignment(peer.getHorizontalAlignment)
- def xAlignment_=(x: Alignment.Value) { peer.setHorizontalAlignment(x.id) }
- def yAlignment: Alignment.Value = Alignment(peer.getVerticalAlignment)
- def yAlignment_=(x: Alignment.Value) { peer.setVerticalAlignment(x.id) }
-
- /** @see javax.swing.JLabel#getHorizontalAlignment() */
- def horizontalAlignment: Alignment.Value = Alignment(peer.getHorizontalAlignment)
- /** @see javax.swing.JLabel#setHorizontalAlignment() */
- def horizontalAlignment_=(x: Alignment.Value) { peer.setHorizontalAlignment(x.id) }
-
- def verticalAlignment: Alignment.Value = Alignment(peer.getVerticalAlignment)
- def verticalAlignment_=(x: Alignment.Value) { peer.setVerticalAlignment(x.id) }
-
- def horizontalTextPosition: Alignment.Value = Alignment(peer.getHorizontalTextPosition)
- def horizontalTextPosition_=(x: Alignment.Value) { peer.setHorizontalTextPosition(x.id) }
-
- def verticalTextPosition: Alignment.Value = Alignment(peer.getVerticalTextPosition)
- def verticalTextPosition_=(x: Alignment.Value) { peer.setVerticalTextPosition(x.id) }
-
- def disabledIcon: Icon = peer.getDisabledIcon
- def disabledIcon_=(icon: Icon) { peer.setDisabledIcon(icon) }
-
- def iconTextGap: Int = peer.getIconTextGap
- def iconTextGap_=(gap: Int) { peer.setIconTextGap(gap) }
-
- def displayedMnemonicIndex: Int = peer.getDisplayedMnemonicIndex
- def displayedMnemonicIndex_=(index: Int) { peer.setDisplayedMnemonicIndex(index) }
-}
diff --git a/src/swing/scala/swing/LayoutContainer.scala b/src/swing/scala/swing/LayoutContainer.scala
deleted file mode 100644
index 37d351459e..0000000000
--- a/src/swing/scala/swing/LayoutContainer.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import javax.swing.JComponent
-import scala.collection.mutable
-
-/** A container that associates layout constraints of member type
- * `Constraints` with its children.
- *
- * See `GridBagPanel` for an example container with custom constraints.
- *
- * @note [Java Swing] In scala.swing, panels and layout managers are
- * combined into subclasses of this base class. This approach allows for
- * typed component constraints.
- */
-trait LayoutContainer extends Container.Wrapper {
- /**
- * The type of component constraints for this container.
- */
- type Constraints <: AnyRef
-
- /**
- * Obtains the constraints for the given component from the underlying
- * Swing layout manager.
- */
- protected def constraintsFor(c: Component): Constraints
- /**
- * Checks whether the given constraints are valid. Additionally returns
- * an error string that is only fetched if the constraints aren't valid.
- */
- protected def areValid(c: Constraints): (Boolean, String)
- /**
- * Adds a component with the given constraints to the underlying layout
- * manager and the component peer. This method needs to interact properly
- * with method `constraintsFor`, i.e., it might need to remove previously
- * held components in order to maintain layout consistency. See `BorderPanel`
- * for an example.
- */
- protected def add(comp: Component, c: Constraints)
-
- /**
- * A map of components to the associated layout constraints.
- * Any element in this map is automatically added to the contents of this
- * panel. Therefore, specifying the layout of a component via
- *
- * layout(myComponent) = myConstraints
- *
- * also ensures that myComponent is properly added to this container.
- */
- def layout: mutable.Map[Component, Constraints] = new mutable.Map[Component, Constraints] {
- def -= (c: Component): this.type = { _contents -= c; this }
- def += (cl: (Component, Constraints)): this.type = { update(cl._1, cl._2); this }
- override def update (c: Component, l: Constraints) {
- val (v, msg) = areValid(l)
- if (!v) throw new IllegalArgumentException(msg)
- add(c, l)
- }
- def get(c: Component) = Option(constraintsFor(c))
- override def size = peer.getComponentCount
- def iterator: Iterator[(Component, Constraints)] =
- peer.getComponents.iterator.map { c =>
- val comp = UIElement.cachedWrapper[Component](c.asInstanceOf[JComponent])
- (comp, constraintsFor(comp))
- }
- }
-}
diff --git a/src/swing/scala/swing/ListView.scala b/src/swing/scala/swing/ListView.scala
deleted file mode 100644
index 6904afd78a..0000000000
--- a/src/swing/scala/swing/ListView.scala
+++ /dev/null
@@ -1,246 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import event._
-import javax.swing._
-import javax.swing.event._
-
-object ListView {
- /**
- * The supported modes of user selections.
- */
- object IntervalMode extends Enumeration {
- val Single = Value(ListSelectionModel.SINGLE_SELECTION)
- val SingleInterval = Value(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
- val MultiInterval = Value(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
- }
-
- def wrap[A](c: JList) = new ListView[A] {
- override lazy val peer = c
- }
-
- object Renderer {
- def wrap[A](r: ListCellRenderer): Renderer[A] = new Wrapped[A](r)
-
- /**
- * Wrapper for <code>javax.swing.ListCellRenderer<code>s
- */
- class Wrapped[A](override val peer: ListCellRenderer) extends Renderer[A] {
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int) = {
- Component.wrap(peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused).asInstanceOf[JComponent])
- }
- }
-
- /**
- * Returns a renderer for items of type <code>A</code>. The given function
- * converts items of type <code>A</code> to items of type <code>B</code>
- * for which a renderer is implicitly given. This allows chaining of
- * renderers, e.g.:
- *
- * <code>
- * case class Person(name: String, email: String)
- * val persons = List(Person("John", "j.doe@a.com"), Person("Mary", "m.jane@b.com"))
- * new ListView(persons) {
- * renderer = ListView.Renderer(_.name)
- * }
- * </code>
- */
- def apply[A,B](f: A => B)(implicit renderer: Renderer[B]): Renderer[A] = new Renderer[A] {
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component =
- renderer.componentFor(list, isSelected, focused, f(a), index)
- }
- }
-
- /**
- * Item renderer for a list view. This is contravariant on the type of the
- * items, so a more general renderer can be used in place of a more specific
- * one. For instance, an <code>Any</code> renderer can be used for a list view
- * of strings.
- *
- * @see javax.swing.ListCellRenderer
- */
- abstract class Renderer[-A] {
- def peer: ListCellRenderer = new ListCellRenderer {
- def getListCellRendererComponent(list: JList, a: Any, index: Int, isSelected: Boolean, focused: Boolean) =
- componentFor(ListView.wrap[A](list), isSelected, focused, a.asInstanceOf[A], index).peer
- }
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component
- }
-
- /**
- * A default renderer that maintains a single component for item rendering
- * and preconfigures it to sensible defaults. It is polymorphic on the
- * component's type so clients can easily use component specific attributes
- * during configuration.
- */
- abstract class AbstractRenderer[-A, C<:Component](protected val component: C) extends Renderer[A] {
- // The renderer component is responsible for painting selection
- // backgrounds. Hence, make sure it is opaque to let it draw
- // the background.
- component.opaque = true
-
- /**
- * Standard preconfiguration that is commonly done for any component.
- * This includes foreground and background colors, as well as colors
- * of item selections.
- */
- def preConfigure(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int) {
- if (isSelected) {
- component.background = list.selectionBackground
- component.foreground = list.selectionForeground
- } else {
- component.background = list.background
- component.foreground = list.foreground
- }
- }
- /**
- * Configuration that is specific to the component and this renderer.
- */
- def configure(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int)
-
- /**
- * Configures the component before returning it.
- */
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: A, index: Int): Component = {
- preConfigure(list, isSelected, focused, a, index)
- configure(list, isSelected, focused, a, index)
- component
- }
- }
-
- /**
- * A generic renderer that uses Swing's built-in renderers. If there is no
- * specific renderer for a type, this renderer falls back to a renderer
- * that renders the string returned from an item's <code>toString</code>.
- */
- implicit object GenericRenderer extends Renderer[Any] {
- override lazy val peer: ListCellRenderer = new DefaultListCellRenderer
- def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, a: Any, index: Int): Component = {
- val c = peer.getListCellRendererComponent(list.peer, a, index, isSelected, focused).asInstanceOf[JComponent]
- Component.wrap(c)
- }
- }
-}
-
-/**
- * A component that displays a number of elements in a list. A list view does
- * not support inline editing of items. If you need it, use a table view instead.
- *
- * Named <code>ListView</code> to avoid a clash with the frequently used
- * <code>scala.List</code>
- *
- * @see javax.swing.JList
- */
-class ListView[A] extends Component {
- import ListView._
- override lazy val peer: JList = new JList with SuperMixin
-
- def this(items: Seq[A]) = {
- this()
- listData = items
- }
-
- protected class ModelWrapper(val items: Seq[A]) extends AbstractListModel {
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
- def getSize = items.size
- }
-
- def listData: Seq[A] = peer.getModel match {
- case model: ModelWrapper => model.items
- case model @ _ => new Seq[A] { selfSeq =>
- def length = model.getSize
- def iterator = new Iterator[A] {
- var idx = 0
- def next = { idx += 1; apply(idx-1) }
- def hasNext = idx < selfSeq.length
- }
- def apply(n: Int) = model.getElementAt(n).asInstanceOf[A]
- }
- }
-
- def listData_=(items: Seq[A]) {
- peer.setModel(new AbstractListModel {
- def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
- def getSize = items.size
- })
- }
-
- /**
- * The current item selection.
- */
- object selection extends Publisher {
- protected abstract class Indices[A](a: =>Seq[A]) extends scala.collection.mutable.Set[A] {
- def -=(n: A): this.type
- def +=(n: A): this.type
- def contains(n: A) = a.contains(n)
- override def size = a.length
- def iterator = a.iterator
- }
-
- def leadIndex: Int = peer.getSelectionModel.getLeadSelectionIndex
- def anchorIndex: Int = peer.getSelectionModel.getAnchorSelectionIndex
-
- /**
- * The indices of the currently selected items.
- */
- object indices extends Indices(peer.getSelectedIndices) {
- def -=(n: Int): this.type = { peer.removeSelectionInterval(n,n); this }
- def +=(n: Int): this.type = { peer.addSelectionInterval(n,n); this }
- }
-
- /**
- * The currently selected items.
- */
- lazy val items = peer.getSelectedValues.map(_.asInstanceOf[A])
-
- def intervalMode: IntervalMode.Value = IntervalMode(peer.getSelectionModel.getSelectionMode)
- def intervalMode_=(m: IntervalMode.Value) { peer.getSelectionModel.setSelectionMode(m.id) }
-
- peer.getSelectionModel.addListSelectionListener(new ListSelectionListener {
- def valueChanged(e: javax.swing.event.ListSelectionEvent) {
- publish(new ListSelectionChanged(ListView.this, e.getFirstIndex to e.getLastIndex, e.getValueIsAdjusting))
- }
- })
-
- def adjusting = peer.getSelectionModel.getValueIsAdjusting
- }
-
- def renderer: ListView.Renderer[A] = ListView.Renderer.wrap[A](peer.getCellRenderer)
- def renderer_=(r: ListView.Renderer[A]) { peer.setCellRenderer(r.peer) }
-
- def fixedCellWidth = peer.getFixedCellWidth
- def fixedCellWidth_=(x: Int) = peer.setFixedCellWidth(x)
-
- def fixedCellHeight = peer.getFixedCellHeight
- def fixedCellHeight_=(x: Int) = peer.setFixedCellHeight(x)
-
- def prototypeCellValue: A = peer.getPrototypeCellValue.asInstanceOf[A]
- def prototypeCellValue_=(a: A) { peer.setPrototypeCellValue(a) }
-
- def visibleRowCount = peer.getVisibleRowCount
- def visibleRowCount_=(n: Int) = peer.setVisibleRowCount(n)
-
- def ensureIndexIsVisible(idx: Int) = peer.ensureIndexIsVisible(idx)
-
- def selectionForeground: Color = peer.getSelectionForeground
- def selectionForeground_=(c: Color) = peer.setSelectionForeground(c)
- def selectionBackground: Color = peer.getSelectionBackground
- def selectionBackground_=(c: Color) = peer.setSelectionBackground(c)
-
- def selectIndices(ind: Int*) = peer.setSelectedIndices(ind.toArray)
-
- peer.getModel.addListDataListener(new ListDataListener {
- def contentsChanged(e: ListDataEvent) { publish(ListChanged(ListView.this)) }
- def intervalRemoved(e: ListDataEvent) { publish(ListElementsRemoved(ListView.this, e.getIndex0 to e.getIndex1)) }
- def intervalAdded(e: ListDataEvent) { publish(ListElementsAdded(ListView.this, e.getIndex0 to e.getIndex1)) }
- })
-}
diff --git a/src/swing/scala/swing/MainFrame.scala b/src/swing/scala/swing/MainFrame.scala
deleted file mode 100644
index 1dfc155f9c..0000000000
--- a/src/swing/scala/swing/MainFrame.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-/**
- * A frame that can be used for main application windows. Shuts down the
- * framework and quits the application when closed.
- */
-class MainFrame(gc: java.awt.GraphicsConfiguration = null) extends Frame(gc) {
- override def closeOperation() { sys.exit(0) }
-}
diff --git a/src/swing/scala/swing/Menu.scala b/src/swing/scala/swing/Menu.scala
deleted file mode 100644
index 38b1787cfc..0000000000
--- a/src/swing/scala/swing/Menu.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import scala.collection.mutable
-import javax.swing._
-
-object MenuBar {
- case object NoMenuBar extends MenuBar
-}
-
-/**
- * A menu bar. Each window can contain at most one. Contains a number of menus.
- *
- * @see javax.swing.JMenuBar
- */
-class MenuBar extends Component with SequentialContainer.Wrapper {
- override lazy val peer: JMenuBar = new JMenuBar with SuperMixin
-
- def menus: mutable.Seq[Menu] = contents.filter(_.isInstanceOf[Menu]).map(_.asInstanceOf[Menu])
-
- // Not implemented by Swing
- //def helpMenu: Menu = UIElement.cachedWrapper(peer.getHelpMenu)
- //def helpMenu_=(m: Menu) { peer.setHelpMenu(m.peer) }
-}
-
-/**
- * A menu item that can be used in a menu.
- *
- * @see javax.swing.JMenuItem
- */
-class MenuItem(title0: String) extends AbstractButton {
- override lazy val peer: JMenuItem = new JMenuItem(title0)
- def this(a: Action) = {
- this("")
- action = a
- }
-}
-
-/**
- * A menu. Contains menu items. Being a menu item itself, menus can be nested.
- *
- * @see javax.swing.JMenu
- */
-class Menu(title0: String) extends MenuItem(title0) with SequentialContainer.Wrapper { self: Menu =>
- override lazy val peer: JMenu = new JMenu(title0)
-}
-
-/**
- * A menu item with a radio button.
- *
- * @see javax.swing.JRadioButtonMenuItem
- */
-class RadioMenuItem(title0: String) extends MenuItem(title0) {
- override lazy val peer: JRadioButtonMenuItem = new JRadioButtonMenuItem(title0)
-}
-/**
- * A menu item with a check box.
- *
- * @see javax.swing.JCheckBoxMenuItem
- */
-class CheckMenuItem(title0: String) extends MenuItem(title0) {
- override lazy val peer: JCheckBoxMenuItem = new JCheckBoxMenuItem(title0)
-}
diff --git a/src/swing/scala/swing/Orientable.scala b/src/swing/scala/swing/Orientable.scala
deleted file mode 100644
index db7cf09f27..0000000000
--- a/src/swing/scala/swing/Orientable.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-object Orientable {
- trait Wrapper extends Oriented.Wrapper with Orientable {
- def orientation_=(o: Orientation.Value) {
- import scala.language.reflectiveCalls
- peer.setOrientation(o.id)
- }
- }
-}
-
-/**
- * An <code>Oriented</code> whose orientation can be changed.
- */
-trait Orientable extends Oriented {
- def orientation_=(o: Orientation.Value)
-}
diff --git a/src/swing/scala/swing/Orientation.scala b/src/swing/scala/swing/Orientation.scala
deleted file mode 100644
index ad616ec690..0000000000
--- a/src/swing/scala/swing/Orientation.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import java.awt.Adjustable._
-
-object Orientation extends Enumeration {
- val Horizontal = Value(HORIZONTAL)
- val Vertical = Value(VERTICAL)
- val NoOrientation = Value(NO_ORIENTATION)
-}
diff --git a/src/swing/scala/swing/Oriented.scala b/src/swing/scala/swing/Oriented.scala
deleted file mode 100644
index 72d7d574e2..0000000000
--- a/src/swing/scala/swing/Oriented.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-object Oriented {
- trait Wrapper extends Oriented {
- def peer: OrientedMixin
-
- /*
- * Need to revert to structural type, since scroll bars are oriented
- * and these are created by scroll panes. Shouldn't be a bootleneck.
- */
- protected type OrientedMixin = {
- def getOrientation(): Int
- def setOrientation(n: Int)
- }
- import scala.language.reflectiveCalls
- def orientation: Orientation.Value = Orientation(peer.getOrientation)
- }
-}
-
-/**
- * Something that can have an orientation.
- */
-trait Oriented {
- def orientation: Orientation.Value
-}
diff --git a/src/swing/scala/swing/Panel.scala b/src/swing/scala/swing/Panel.scala
deleted file mode 100644
index 89ad4d3d66..0000000000
--- a/src/swing/scala/swing/Panel.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-/**
- * A component that can contain other components.
- *
- * @see javax.swing.JPanel
- */
-abstract class Panel extends Component with Container.Wrapper {
- override lazy val peer: javax.swing.JPanel = new javax.swing.JPanel with SuperMixin
-}
diff --git a/src/swing/scala/swing/PasswordField.scala b/src/swing/scala/swing/PasswordField.scala
deleted file mode 100644
index fd0b586a0f..0000000000
--- a/src/swing/scala/swing/PasswordField.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import javax.swing._
-
-/**
- * A password field, that displays a replacement character for each character in the password.
- *
- * @see javax.swing.JPasswordField
- */
-class PasswordField(text0: String, columns0: Int) extends TextField(text0, columns0) {
- override lazy val peer: JPasswordField = new JPasswordField(text0, columns0) with SuperMixin
- def this(text: String) = this(text, 0)
- def this(columns: Int) = this("", columns)
- def this() = this("")
-
- def echoChar: Char = peer.getEchoChar
- def echoChar_=(c: Char) = peer.setEchoChar(c)
-
- /**
- * The text property should not be used on a password field for
- * security reasons.
- */
- override def text: String = ""
- override def text_=(s: String) {}
- def password: Array[Char] = peer.getPassword
-}
diff --git a/src/swing/scala/swing/PopupMenu.scala b/src/swing/scala/swing/PopupMenu.scala
deleted file mode 100644
index e82c3a1b28..0000000000
--- a/src/swing/scala/swing/PopupMenu.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.JPopupMenu
-import javax.swing.event.{PopupMenuListener, PopupMenuEvent}
-import event._
-
-/**
- * A popup menu.
- *
- * Example usage:
- *
- * {{{
- * val popupMenu = new PopupMenu {
- * contents += new Menu("menu 1") {
- * contents += new RadioMenuItem("radio 1.1")
- * contents += new RadioMenuItem("radio 1.2")
- * }
- * contents += new Menu("menu 2") {
- * contents += new RadioMenuItem("radio 2.1")
- * contents += new RadioMenuItem("radio 2.2")
- * }
- * }
- * val button = new Button("Show Popup Menu")
- * reactions += {
- * case e: ButtonClicked => popupMenu.show(button, 0, button.bounds.height)
- * }
- * listenTo(button)
- * }}}
- *
- * @author John Sullivan
- * @author Ingo Maier
- * @see javax.swing.JPopupMenu
- */
-class PopupMenu extends Component with SequentialContainer.Wrapper with Publisher {
- override lazy val peer: JPopupMenu = new JPopupMenu with SuperMixin
-
- peer.addPopupMenuListener(new PopupMenuListener {
- def popupMenuCanceled(e: PopupMenuEvent) {
- publish(PopupMenuCanceled(PopupMenu.this))
- }
- def popupMenuWillBecomeInvisible(e: PopupMenuEvent) {
- publish(PopupMenuWillBecomeInvisible(PopupMenu.this))
- }
- def popupMenuWillBecomeVisible(e: PopupMenuEvent) {
- publish(PopupMenuWillBecomeVisible(PopupMenu.this))
- }
- })
-
- def show(invoker: Component, x: Int, y: Int): Unit = peer.show(invoker.peer, x, y)
-
- def margin: Insets = peer.getMargin
- def label: String = peer.getLabel
- def label_=(s: String) { peer.setLabel(s) }
-}
-
diff --git a/src/swing/scala/swing/ProgressBar.scala b/src/swing/scala/swing/ProgressBar.scala
deleted file mode 100644
index 81e2989c3e..0000000000
--- a/src/swing/scala/swing/ProgressBar.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-/**
- * A bar indicating progress of some action. Can be in indeterminate mode,
- * in which it indicates that the action is in progress (usually by some
- * animation) but does not indicate the amount of work done or to be done.
- *
- * @see javax.swing.JProgressBar
- */
-class ProgressBar extends Component with Orientable.Wrapper {
- override lazy val peer: javax.swing.JProgressBar =
- new javax.swing.JProgressBar with SuperMixin
-
- def min: Int = peer.getMinimum
- def min_=(v: Int) { peer.setMinimum(v) }
- def max: Int = peer.getMaximum
- def max_=(v: Int) { peer.setMaximum(v) }
- def value: Int = peer.getValue
- def value_=(v: Int) { peer.setValue(v) }
-
- def labelPainted: Boolean = peer.isStringPainted
- def labelPainted_=(v: Boolean) { peer.setStringPainted(v) }
-
- def label: String = peer.getString
- def label_=(v: String) = peer.setString(v)
-
- def indeterminate: Boolean = peer.isIndeterminate
- def indeterminate_=(v: Boolean) { peer.setIndeterminate(v) }
-
- def paintBorder: Boolean = peer.isBorderPainted
- def paintBorder(v: Boolean) { peer.setBorderPainted(v) }
-}
diff --git a/src/swing/scala/swing/RadioButton.scala b/src/swing/scala/swing/RadioButton.scala
deleted file mode 100644
index 64f8b23756..0000000000
--- a/src/swing/scala/swing/RadioButton.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing._
-
-/**
- * A two state button that is usually used in a <code>ButtonGroup</code>
- * together with other <code>RadioButton</code>s, in order to indicate
- * that at most one of them can be selected.
- *
- * @see javax.swing.JRadioButton
- */
-class RadioButton(text0: String) extends ToggleButton {
- override lazy val peer: JRadioButton = new JRadioButton(text0) with SuperMixin
- def this() = this("")
-}
diff --git a/src/swing/scala/swing/Reactions.scala b/src/swing/scala/swing/Reactions.scala
deleted file mode 100644
index c32212cf3a..0000000000
--- a/src/swing/scala/swing/Reactions.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import event.Event
-import scala.collection.mutable.{Buffer, ListBuffer}
-
-object Reactions {
- class Impl extends Reactions {
- private val parts: Buffer[Reaction] = new ListBuffer[Reaction]
- def isDefinedAt(e: Event) = parts.exists(_ isDefinedAt e)
- def += (r: Reaction): this.type = { parts += r; this }
- def -= (r: Reaction): this.type = { parts -= r; this }
- def apply(e: Event) {
- for (p <- parts) if (p isDefinedAt e) p(e)
- }
- }
-
- type Reaction = PartialFunction[Event, Unit]
-
- /**
- * A Reaction implementing this trait is strongly referenced in the reaction list
- */
- trait StronglyReferenced
-
- class Wrapper(listener: Any)(r: Reaction) extends Reaction with StronglyReferenced with Proxy {
- def self = listener
- def isDefinedAt(e: Event) = r.isDefinedAt(e)
- def apply(e: Event) { r(e) }
- }
-}
-
-/**
- * Used by reactors to let clients register custom event reactions.
- */
-abstract class Reactions extends Reactions.Reaction {
- /**
- * Add a reaction.
- */
- def += (r: Reactions.Reaction): this.type
-
- /**
- * Remove the given reaction.
- */
- def -= (r: Reactions.Reaction): this.type
-}
diff --git a/src/swing/scala/swing/Reactor.scala b/src/swing/scala/swing/Reactor.scala
deleted file mode 100644
index 8f74831a5d..0000000000
--- a/src/swing/scala/swing/Reactor.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-/**
- * The counterpart to publishers. Listens to events from registered publishers.
- */
-trait Reactor {
- /**
- * All reactions of this reactor.
- */
- val reactions: Reactions = new Reactions.Impl
- /**
- * Listen to the given publisher as long as <code>deafTo</code> isn't called for
- * them.
- */
- def listenTo(ps: Publisher*) = for (p <- ps) p.subscribe(reactions)
- /**
- * Installed reaction won't receive events from the given publisher anylonger.
- */
- def deafTo(ps: Publisher*) = for (p <- ps) p.unsubscribe(reactions)
-}
diff --git a/src/swing/scala/swing/RichWindow.scala b/src/swing/scala/swing/RichWindow.scala
deleted file mode 100644
index a60cdd339e..0000000000
--- a/src/swing/scala/swing/RichWindow.scala
+++ /dev/null
@@ -1,195 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import java.awt.{ Window => AWTWindow, Frame => AWTFrame }
-import javax.swing._
-import Swing._
-
-object RichWindow {
- /**
- * Mixin this trait if you want an undecorated window.
- */
- trait Undecorated extends RichWindow {
- // we do a mixin here, since setUndecorated is only allowed to be called
- // when the component is not displayable.
- peer.setUndecorated(true)
- }
-}
-
-/**
- * A window that adds some functionality to the plain Window class and serves as
- * the common base class for frames and dialogs.
- *
- * Implementation note: this class is sealed since we need to know that a rich
- * window is either a dialog or a frame at some point.
- */
-sealed trait RichWindow extends Window {
- def peer: AWTWindow with InterfaceMixin
-
- trait InterfaceMixin extends super.InterfaceMixin {
- def getJMenuBar(): JMenuBar
- def setJMenuBar(b: JMenuBar)
- def setUndecorated(b: Boolean)
- def setTitle(s: String)
- def getTitle(): String
- def setResizable(b: Boolean)
- def isResizable(): Boolean
- }
-
- def title: String = peer.getTitle
- def title_=(s: String) = peer.setTitle(s)
-
- /**
- * The menu bar of this frame or `NoMenuBar` if no menu bar is set.
- */
- def menuBar: MenuBar = {
- val m = UIElement.cachedWrapper[MenuBar](peer.getJMenuBar)
- if (m != null) m else MenuBar.NoMenuBar
- }
- /**
- * Set the current menu bar of this frame. Pass `NoMenuBar` if this frame
- * should not show a menu bar.
- */
- def menuBar_=(m: MenuBar) =
- peer.setJMenuBar(if (m == MenuBar.NoMenuBar) null else m.peer)
-
- def resizable_=(b: Boolean) { peer.setResizable(b) }
- def resizable = peer.isResizable
-}
-
-/**
- * A window with decoration such as a title, border, and action buttons.
- *
- * An AWT window cannot be wrapped dynamically with this class, i.e., you cannot
- * write something like new Window { def peer = myAWTWindow }
- *
- * @see javax.swing.JFrame
- */
-class Frame(gc: java.awt.GraphicsConfiguration = null) extends RichWindow {
- override lazy val peer: JFrame with InterfaceMixin = new JFrame(gc) with InterfaceMixin with SuperMixin
-
- def iconify() { peer.setExtendedState(peer.getExtendedState | AWTFrame.ICONIFIED) }
- def uniconify() { peer.setExtendedState(peer.getExtendedState & ~AWTFrame.ICONIFIED) }
- def iconified: Boolean = (peer.getExtendedState & AWTFrame.ICONIFIED) != 0
- def maximize() { peer.setExtendedState(peer.getExtendedState | AWTFrame.MAXIMIZED_BOTH) }
- def unmaximize() { peer.setExtendedState(peer.getExtendedState & ~AWTFrame.MAXIMIZED_BOTH) }
- def maximized: Boolean = (peer.getExtendedState & AWTFrame.MAXIMIZED_BOTH) != 0
-
- def iconImage: Image = peer.getIconImage
- def iconImage_=(i: Image) { peer.setIconImage(i) }
-}
-
-/**
- * Simple predefined dialogs.
- *
- * @see javax.swing.JOptionPane
- */
-object Dialog {
- /**
- * The message type of a dialog.
- */
- object Message extends Enumeration {
- val Error = Value(JOptionPane.ERROR_MESSAGE)
- val Info = Value(JOptionPane.INFORMATION_MESSAGE)
- val Warning = Value(JOptionPane.WARNING_MESSAGE)
- val Question = Value(JOptionPane.QUESTION_MESSAGE)
- val Plain = Value(JOptionPane.PLAIN_MESSAGE)
- }
-
- /**
- * The possible answers a user can select.
- */
- object Options extends Enumeration {
- val Default = Value(JOptionPane.DEFAULT_OPTION)
- val YesNo = Value(JOptionPane.YES_NO_OPTION)
- val YesNoCancel = Value(JOptionPane.YES_NO_CANCEL_OPTION)
- val OkCancel = Value(JOptionPane.OK_CANCEL_OPTION)
- }
-
- /**
- * The selected result of dialog.
- */
- object Result extends Enumeration {
- val Yes = Value(JOptionPane.YES_OPTION)
- val Ok = Yes
- val No = Value(JOptionPane.NO_OPTION)
- val Cancel = Value(JOptionPane.CANCEL_OPTION)
- val Closed = Value(JOptionPane.CLOSED_OPTION)
- }
-
- private def uiString(txt: String) = UIManager.getString(txt)
-
- def showConfirmation(parent: Component = null,
- message: Any,
- title: String = uiString("OptionPane.titleText"),
- optionType: Options.Value = Options.YesNo,
- messageType: Message.Value = Message.Question,
- icon: Icon = EmptyIcon): Result.Value =
- Result(JOptionPane.showConfirmDialog(nullPeer(parent), message, title,
- optionType.id, messageType.id, Swing.wrapIcon(icon)))
-
- def showOptions(parent: Component = null,
- message: Any,
- title: String = uiString("OptionPane.titleText"),
- optionType: Options.Value = Options.YesNo,
- messageType: Message.Value = Message.Question,
- icon: Icon = EmptyIcon,
- entries: Seq[Any],
- initial: Int): Result.Value = {
- val r = JOptionPane.showOptionDialog(nullPeer(parent), message, title,
- optionType.id, messageType.id, Swing.wrapIcon(icon),
- (entries map toAnyRef).toArray, entries(initial))
- Result(r)
- }
-
- def showInput[A](parent: Component = null,
- message: Any,
- title: String = uiString("OptionPane.inputDialogTitle"),
- messageType: Message.Value = Message.Question,
- icon: Icon = EmptyIcon,
- entries: Seq[A] = Nil,
- initial: A): Option[A] = {
- val e = if (entries.isEmpty) null
- else (entries map toAnyRef).toArray
- val r = JOptionPane.showInputDialog(nullPeer(parent), message, title,
- messageType.id, Swing.wrapIcon(icon),
- e, initial)
-
- toOption[A](r)
- }
- def showMessage(parent: Component = null,
- message: Any,
- title: String = uiString("OptionPane.messageDialogTitle"),
- messageType: Message.Value = Message.Info,
- icon: Icon = EmptyIcon) {
- JOptionPane.showMessageDialog(nullPeer(parent), message, title,
- messageType.id, Swing.wrapIcon(icon))
- }
-}
-
-/**
- * A dialog window.
- *
- * @see javax.swing.JDialog
- */
-class Dialog(owner: Window, gc: java.awt.GraphicsConfiguration = null) extends RichWindow {
- override lazy val peer: JDialog with InterfaceMixin =
- if (owner == null) new JDialog with InterfaceMixin with SuperMixin
- else owner match {
- case f: Frame => new JDialog(f.peer, "", false, gc) with InterfaceMixin with SuperMixin
- case d: Dialog => new JDialog(d.peer, "", false, gc) with InterfaceMixin with SuperMixin
- }
-
- def this() = this(null)
-
- def modal_=(b: Boolean) { peer.setModal(b) }
- def modal = peer.isModal
-}
-
diff --git a/src/swing/scala/swing/RootPanel.scala b/src/swing/scala/swing/RootPanel.scala
deleted file mode 100644
index 7e4882d7da..0000000000
--- a/src/swing/scala/swing/RootPanel.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-/**
- * The root of a component hierarchy. Contains at most one component.
- *
- * @see javax.swing.RootPaneContainer
- */
-trait RootPanel extends Container {
- def peer: java.awt.Component with javax.swing.RootPaneContainer
-
- /**
- * At most one component.
- */
- def contents: Seq[Component] =
- if (peer.getContentPane.getComponentCount == 0) Nil
- else {
- val c = peer.getContentPane.getComponent(0).asInstanceOf[javax.swing.JComponent]
- List(UIElement.cachedWrapper[Component](c))
- }
-
- def contents_=(c: Component) {
- if (peer.getContentPane.getComponentCount > 0) {
- val old = peer.getContentPane.getComponent(0)
- peer.getContentPane.remove(old)
- }
- peer.getContentPane.add(c.peer)
- }
-}
diff --git a/src/swing/scala/swing/ScrollBar.scala b/src/swing/scala/swing/ScrollBar.scala
deleted file mode 100644
index 6a1acdca04..0000000000
--- a/src/swing/scala/swing/ScrollBar.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.{JScrollBar, BoundedRangeModel}
-import java.awt.event.{AdjustmentListener}
-
-object ScrollBar {
- def wrap(c: JScrollBar): ScrollBar = {
- val w = UIElement.cachedWrapper[ScrollBar](c)
- if (w != null) w
- else new ScrollBar { override lazy val peer = c }
- }
-}
-
-class ScrollBar extends Component with Orientable.Wrapper with Adjustable.Wrapper {
- override lazy val peer: JScrollBar = new JScrollBar with SuperMixin
-
- def valueIsAjusting = peer.getValueIsAdjusting
- def valueIsAjusting_=(b : Boolean) = peer.setValueIsAdjusting(b)
-
- // TODO: can we find a better interface?
- //def setValues(value: Int = this.value, visible: Int = visibleAmount,
- // min: Int = minimum, max: Int = maximum) =
- // peer.setValues(value, visible, min, max)
-
-// Not currently needed, requires wrapper for BoundedRangeModel
-//
-// def model = peer.getModel
-// def model_=(m : BoundedRangeModel) = peer.setModel(m)
-}
diff --git a/src/swing/scala/swing/ScrollPane.scala b/src/swing/scala/swing/ScrollPane.scala
deleted file mode 100644
index afd6cf27fb..0000000000
--- a/src/swing/scala/swing/ScrollPane.scala
+++ /dev/null
@@ -1,88 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.{JScrollPane, ScrollPaneConstants}
-
-object ScrollPane {
- object BarPolicy extends Enumeration {
- import ScrollPaneConstants._
- val AsNeeded = new Value(HORIZONTAL_SCROLLBAR_AS_NEEDED,
- VERTICAL_SCROLLBAR_AS_NEEDED)
- val Never = new Value(HORIZONTAL_SCROLLBAR_NEVER,
- VERTICAL_SCROLLBAR_NEVER)
- val Always = new Value(HORIZONTAL_SCROLLBAR_ALWAYS,
- VERTICAL_SCROLLBAR_ALWAYS)
-
- def wrap(id: Int) = id match {
- case HORIZONTAL_SCROLLBAR_AS_NEEDED | VERTICAL_SCROLLBAR_AS_NEEDED => AsNeeded
- case HORIZONTAL_SCROLLBAR_NEVER | VERTICAL_SCROLLBAR_NEVER => Never
- case HORIZONTAL_SCROLLBAR_ALWAYS | VERTICAL_SCROLLBAR_ALWAYS => Always
- }
- class Value(val horizontalPeer: Int, val verticalPeer: Int) extends super.Val {
- override def id = horizontalPeer
- }
- }
-}
-
-/**
- * Can have at most a single child component, which will be put inside a canvas (the viewport)
- * that can be scrolled.
- *
- * @see javax.swing.JScrollPane
- */
-class ScrollPane extends Component with Container {
- import ScrollPane._
-
- override lazy val peer: JScrollPane = new JScrollPane with SuperMixin
- def this(c: Component) = {
- this()
- contents = c
- }
- def contents: Seq[Component] =
- List(UIElement.cachedWrapper[Component](peer.getViewport.getView.asInstanceOf[javax.swing.JComponent]))
-
- /**
- * Sets the single child.
- */
- def contents_=(c: Component) { peer.setViewportView(c.peer) }
-
- /**
- * The component being displayed in this pane's row header.
- *
- * If you want to create a row header for lists or tables, you probably
- * want to let the row header be a list view with the same row height as
- * the viewport component.
- */
- def rowHeaderView: Option[Component] =
- Option(peer.getRowHeader.getView) map UIElement.cachedWrapper[Component]
- def rowHeaderView_=(c: Component) = peer.setRowHeaderView(c.peer)
- def rowHeaderView_=(c: Option[Component]) = peer.setRowHeaderView(c.map(_.peer).orNull)
-
- def columnHeaderView: Option[Component] =
- Option(peer.getColumnHeader.getView) map UIElement.cachedWrapper[Component]
- def columnHeaderView_=(c: Component) = peer.setColumnHeaderView(c.peer)
- def columnHeaderView_=(c: Option[Component]) = peer.setColumnHeaderView(c.map(_.peer).orNull)
-
- def viewportView: Option[Component] =
- Option(peer.getViewport.getView) map UIElement.cachedWrapper[Component]
- def viewportView_=(c: Component) = peer.setViewportView(c.peer)
- def viewportView_=(c: Option[Component]) = peer.setViewportView(c.map(_.peer).orNull)
-
- def verticalScrollBarPolicy = BarPolicy.wrap(peer.getVerticalScrollBarPolicy)
- def verticalScrollBarPolicy_=(p: BarPolicy.Value) = peer.setVerticalScrollBarPolicy(p.verticalPeer)
-
- def horizontalScrollBarPolicy = BarPolicy.wrap(peer.getHorizontalScrollBarPolicy)
- def horizontalScrollBarPolicy_=(p: BarPolicy.Value) = peer.setHorizontalScrollBarPolicy(p.horizontalPeer)
-
- def horizontalScrollBar = ScrollBar.wrap(peer.getHorizontalScrollBar)
- def verticalScrollBar = ScrollBar.wrap(peer.getVerticalScrollBar)
-}
diff --git a/src/swing/scala/swing/Scrollable.scala b/src/swing/scala/swing/Scrollable.scala
deleted file mode 100644
index 1253ac8df0..0000000000
--- a/src/swing/scala/swing/Scrollable.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-object Scrollable {
- trait Wrapper extends Scrollable {
- protected def scrollablePeer: javax.swing.Scrollable
- def preferredViewportSize = scrollablePeer.getPreferredScrollableViewportSize
-
- def tracksViewportHeight: Boolean = scrollablePeer.getScrollableTracksViewportHeight
- def tracksViewportWidth: Boolean = scrollablePeer.getScrollableTracksViewportWidth
-
- def blockIncrement(visibleRect: Rectangle, orientation: Orientation.Value, direction: Int): Int =
- scrollablePeer.getScrollableBlockIncrement(visibleRect, orientation.id, direction)
-
- def unitIncrement(visibleRect: Rectangle, orientation: Orientation.Value, direction: Int): Int =
- scrollablePeer.getScrollableUnitIncrement(visibleRect, orientation.id, direction)
- }
-}
-
-/**
- * A component that is specially suitable for being placed inside a
- * <code>ScrollPane</code>.
- *
- * @see javax.swing.Scrollable
- */
-trait Scrollable extends Component {
- def preferredViewportSize: Dimension
-
- def tracksViewportHeight: Boolean
- def tracksViewportWidth: Boolean
-
- def blockIncrement(visibleRect: Rectangle, orientation: Orientation.Value, direction: Int): Int
- def unitIncrement(visibleRect: Rectangle, orientation: Orientation.Value, direction: Int): Int
-}
diff --git a/src/swing/scala/swing/Separator.scala b/src/swing/scala/swing/Separator.scala
deleted file mode 100644
index 32d209d579..0000000000
--- a/src/swing/scala/swing/Separator.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing._
-
-/**
- * A bar that can be used a separator, most commonly in menus.
- *
- * @see javax.swing.JSeparator
- */
-class Separator(o: Orientation.Value) extends Component with Oriented.Wrapper {
- override lazy val peer: JSeparator = new JSeparator(o.id) with SuperMixin
- def this() = this(Orientation.Horizontal)
-}
diff --git a/src/swing/scala/swing/SequentialContainer.scala b/src/swing/scala/swing/SequentialContainer.scala
deleted file mode 100644
index 5f32b08d25..0000000000
--- a/src/swing/scala/swing/SequentialContainer.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import scala.collection.mutable.Buffer
-
-object SequentialContainer {
- /**
- * Utility trait for wrapping sequential containers.
- */
- trait Wrapper extends SequentialContainer with Container.Wrapper {
- override val contents: Buffer[Component] = new Content
- //def contents_=(c: Component*) { contents.clear(); contents ++= c }
- }
-}
-
-/**
- * A container for which a sequential order of children makes sense, such as
- * flow panels, or menus. Its contents are mutable.
- */
-trait SequentialContainer extends Container {
- /**
- * The mutable child components of this container. The order matters and
- * usually indicates the layout of the children.
- */
- override def contents: Buffer[Component]
- //def contents_=(c: Component*)
-}
diff --git a/src/swing/scala/swing/SimpleSwingApplication.scala b/src/swing/scala/swing/SimpleSwingApplication.scala
deleted file mode 100644
index cd0f2be874..0000000000
--- a/src/swing/scala/swing/SimpleSwingApplication.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-package scala.swing
-
-/**
- * Extend this class for most simple UI applications. Clients need to
- * implement the `top` method. Framework initialization is done by this class.
- *
- * In order to conform to Swing's threading policy, never implement top or any
- * additional member that created Swing components as a value unless component
- * creation happens on the EDT (see `Swing.onEDT` and `Swing.onEDTWait`).
- * Lazy values are okay for the same reason if they are initialized on the EDT
- * always.
- */
-abstract class SimpleSwingApplication extends SwingApplication {
-
- /**
- * A GUI application's version of the main method. Called by the default
- * main method implementation provided by this class.
- * Implement to return the top-level frame of this application.
- */
- def top: Frame
-
- /**
- * Calls `top`, packs the frame, and displays it.
- */
- override def startup(args: Array[String]) {
- val t = top
- if (t.size == new Dimension(0,0)) t.pack()
- t.visible = true
- }
-
- def resourceFromClassloader(path: String): java.net.URL =
- this.getClass.getResource(path)
-
- def resourceFromUserDirectory(path: String): java.io.File =
- new java.io.File(util.Properties.userDir, path)
-}
diff --git a/src/swing/scala/swing/Slider.scala b/src/swing/scala/swing/Slider.scala
deleted file mode 100644
index 241876587b..0000000000
--- a/src/swing/scala/swing/Slider.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.{JSlider, JLabel}
-import event._
-
-/**
- * Lets users select a value from a given range. Visually, this is represented
- * as a draggable knob on a horizontal or vertical bar.
- *
- * Fires a ValueChanged event whenever the slider's value changes and
- * when the knob is released.
- *
- * @see javax.swing.JSlider
- */
-class Slider extends Component with Orientable.Wrapper with Publisher {
- override lazy val peer: JSlider = new JSlider with SuperMixin
-
- def min: Int = peer.getMinimum
- def min_=(v: Int) { peer.setMinimum(v) }
- def max: Int = peer.getMaximum
- def max_=(v: Int) { peer.setMaximum(v) }
- def value: Int = peer.getValue
- def value_=(v: Int) { peer.setValue(v) }
- def extent: Int = peer.getExtent
- def extent_=(v: Int) { peer.setExtent(v) }
-
- def paintLabels: Boolean = peer.getPaintLabels
- def paintLabels_=(v: Boolean) { peer.setPaintLabels(v) }
- def paintTicks: Boolean = peer.getPaintTicks
- def paintTicks_=(v: Boolean) { peer.setPaintTicks(v) }
- def paintTrack: Boolean = peer.getPaintTrack
- def paintTrack_=(v: Boolean) { peer.setPaintTrack(v) }
-
- def snapToTicks: Boolean = peer.getSnapToTicks
- def snapToTicks_=(v: Boolean) { peer.setSnapToTicks(v) }
-
- def minorTickSpacing: Int = peer.getMinorTickSpacing
- def minorTickSpacing_=(v: Int) { peer.setMinorTickSpacing(v) }
- def majorTickSpacing: Int = peer.getMajorTickSpacing
- def majorTickSpacing_=(v: Int) { peer.setMajorTickSpacing(v) }
-
- def adjusting = peer.getValueIsAdjusting
-
- def labels: scala.collection.Map[Int, Label] = {
- val labelTable = peer.getLabelTable.asInstanceOf[java.util.Hashtable[Int, JLabel]]
- new scala.collection.convert.Wrappers.JMapWrapper(labelTable)
- .mapValues(v => UIElement.cachedWrapper[Label](v))
- }
- def labels_=(l: scala.collection.Map[Int, Label]) {
- // TODO: do some lazy wrapping
- val table = new java.util.Hashtable[Any, Any]
- for ((k,v) <- l) table.put(k, v.peer)
- peer.setLabelTable(table)
- }
-
- peer.addChangeListener(new javax.swing.event.ChangeListener {
- def stateChanged(e: javax.swing.event.ChangeEvent) {
- publish(new ValueChanged(Slider.this))
- }
- })
-}
diff --git a/src/swing/scala/swing/SplitPane.scala b/src/swing/scala/swing/SplitPane.scala
deleted file mode 100644
index f61dfedbf4..0000000000
--- a/src/swing/scala/swing/SplitPane.scala
+++ /dev/null
@@ -1,63 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import Swing._
-
-/**
- * A container with exactly two children. Arranges them side by side, either
- * horizontally or vertically. Displays a draggable divider component between
- * them that lets the user adjust the size ratio of the children.
- *
- * @see javax.swing.JSplitPane
- */
-class SplitPane(o: Orientation.Value, left: Component, right: Component) extends Component with Container with Orientable.Wrapper {
- override lazy val peer: javax.swing.JSplitPane =
- new javax.swing.JSplitPane(o.id, left.peer, right.peer) with SuperMixin
- def this(o: Orientation.Value) = this(o, new Component {}, new Component {})
- def this() = this(Orientation.Horizontal)
-
- def contents: Seq[Component] = List(leftComponent, rightComponent)
- def contents_=(left: Component, right: Component) {
- peer.setLeftComponent(nullPeer(left))
- peer.setRightComponent(nullPeer(right))
- }
-
- def topComponent: Component =
- UIElement.cachedWrapper[Component](peer.getTopComponent.asInstanceOf[javax.swing.JComponent])
- def topComponent_=(c: Component) { peer.setTopComponent(nullPeer(c)) }
- def bottomComponent: Component =
- UIElement.cachedWrapper[Component](peer.getBottomComponent.asInstanceOf[javax.swing.JComponent])
- def bottomComponent_=(c: Component) { peer.setBottomComponent(nullPeer(c)) }
-
- def leftComponent: Component = topComponent
- def leftComponent_=(c: Component) { topComponent = c }
- def rightComponent: Component = bottomComponent
- def rightComponent_=(c: Component) { bottomComponent = c }
-
- def dividerLocation: Int = peer.getDividerLocation
- def dividerLocation_=(n: Int) { peer.setDividerLocation(n) }
-
- /*def proportionalDividerLocation: Double =
- if (orientation == Orientation.Vertical) dividerLocation / (size.height - dividerSize)
- else dividerLocation / (size.width - dividerSize)*/
- def dividerLocation_=(f: Double) { peer.setDividerLocation(f) }
-
- def dividerSize: Int = peer.getDividerSize
- def dividerSize_=(n: Int) { peer.setDividerSize(n) }
- def resizeWeight: Double = peer.getResizeWeight
- def resizeWeight_=(n: Double) { peer.setResizeWeight(n) }
-
- def resetToPreferredSizes() { peer.resetToPreferredSizes() }
-
- def oneTouchExpandable: Boolean = peer.isOneTouchExpandable
- def oneTouchExpandable_=(b: Boolean) { peer.setOneTouchExpandable(b) }
- def continuousLayout: Boolean = peer.isContinuousLayout
- def continuousLayout_=(b: Boolean) { peer.setContinuousLayout(b) }
-}
diff --git a/src/swing/scala/swing/Swing.scala b/src/swing/scala/swing/Swing.scala
deleted file mode 100644
index e2c8479354..0000000000
--- a/src/swing/scala/swing/Swing.scala
+++ /dev/null
@@ -1,141 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import java.awt.event._
-import javax.swing.event._
-import javax.swing.border._
-import javax.swing.{JComponent, Icon, BorderFactory, SwingUtilities}
-import scala.language.implicitConversions
-
-
-/**
- * Helpers for this package.
- */
-object Swing {
- protected[swing] def toNoIcon(i: Icon): Icon = if(i == null) EmptyIcon else i
- protected[swing] def toNullIcon(i: Icon): Icon = if(i == EmptyIcon) null else i
- protected[swing] def nullPeer(c: Component) = if (c != null) c.peer else null
-
- implicit def pair2Dimension(p: (Int, Int)): Dimension = new Dimension(p._1, p._2)
- implicit def pair2Point(p: (Int, Int)): Point = new Point(p._1, p._2)
- implicit def pair2Point(p: (Int, Int, Int, Int)): Rectangle = new Rectangle(p._1, p._2, p._3, p._4)
-
- @inline final def Runnable(@inline block: =>Unit) = new Runnable {
- def run = block
- }
- final def ChangeListener(f: ChangeEvent => Unit) = new ChangeListener {
- def stateChanged(e: ChangeEvent) { f(e) }
- }
- final def ActionListener(f: ActionEvent => Unit) = new ActionListener {
- def actionPerformed(e: ActionEvent) { f(e) }
- }
-
- def Box(min: Dimension, pref: Dimension, max: Dimension) = new Component {
- override lazy val peer = new javax.swing.Box.Filler(min, pref, max)
- }
- def HGlue = new Component {
- override lazy val peer = javax.swing.Box.createHorizontalGlue.asInstanceOf[JComponent]
- }
- def VGlue = new Component {
- override lazy val peer = javax.swing.Box.createVerticalGlue.asInstanceOf[JComponent]
- }
- def Glue = new Component {
- override lazy val peer = javax.swing.Box.createGlue.asInstanceOf[JComponent]
- }
- def RigidBox(dim: Dimension) = new Component {
- override lazy val peer = javax.swing.Box.createRigidArea(dim).asInstanceOf[JComponent]
- }
- def HStrut(width: Int) = new Component {
- override lazy val peer = javax.swing.Box.createHorizontalStrut(width).asInstanceOf[JComponent]
- }
- def VStrut(height: Int) = new Component {
- override lazy val peer = javax.swing.Box.createVerticalStrut(height).asInstanceOf[JComponent]
- }
-
- def Icon(image: java.awt.Image) = new javax.swing.ImageIcon(image)
- def Icon(filename: String) = new javax.swing.ImageIcon(filename)
- def Icon(url: java.net.URL) = new javax.swing.ImageIcon(url)
-
- /**
- * The empty icon. Use this icon instead of <code>null</code> to indicate
- * that you don't want an icon.
- */
- case object EmptyIcon extends Icon {
- def getIconHeight: Int = 0
- def getIconWidth: Int = 0
- def paintIcon(c: java.awt.Component, g: java.awt.Graphics, x: Int, y: Int) {}
- }
-
- def unwrapIcon(icon: Icon): Icon = if (icon == null) EmptyIcon else icon
- def wrapIcon(icon: Icon): Icon = if (icon == EmptyIcon) null else icon
-
- def EmptyBorder = BorderFactory.createEmptyBorder()
- def EmptyBorder(weight: Int) =
- BorderFactory.createEmptyBorder(weight, weight, weight, weight)
- def EmptyBorder(top: Int, left: Int, bottom: Int, right: Int) =
- BorderFactory.createEmptyBorder(top, left, bottom, right)
-
- def LineBorder(c: Color) = BorderFactory.createLineBorder(c)
- def LineBorder(c: Color, weight: Int) = BorderFactory.createLineBorder(c, weight)
-
- def BeveledBorder(kind: Embossing) = BorderFactory.createBevelBorder(kind.bevelPeer)
- def BeveledBorder(kind: Embossing, highlight: Color, shadow: Color) =
- BorderFactory.createBevelBorder(kind.bevelPeer, highlight, shadow)
- def BeveledBorder(kind: Embossing,
- highlightOuter: Color, highlightInner: Color,
- shadowOuter: Color, shadowInner: Color) =
- BorderFactory.createBevelBorder(kind.bevelPeer,
- highlightOuter, highlightInner,
- shadowOuter, shadowInner)
-
- sealed abstract class Embossing {
- def bevelPeer: Int
- def etchPeer: Int
- }
- case object Lowered extends Embossing {
- def bevelPeer = BevelBorder.LOWERED
- def etchPeer = javax.swing.border.EtchedBorder.LOWERED
- }
- case object Raised extends Embossing {
- def bevelPeer = BevelBorder.RAISED
- def etchPeer = javax.swing.border.EtchedBorder.RAISED
- }
-
- def EtchedBorder = BorderFactory.createEtchedBorder()
- def EtchedBorder(kind: Embossing) =
- BorderFactory.createEtchedBorder(kind.etchPeer)
- def EtchedBorder(kind: Embossing, highlight: Color, shadow: Color) =
- BorderFactory.createEtchedBorder(kind.etchPeer, highlight, shadow)
-
- def MatteBorder(top: Int, left: Int, bottom: Int, right: Int, color: Color) =
- BorderFactory.createMatteBorder(top, left, bottom, right, color)
- def MatteBorder(top: Int, left: Int, bottom: Int, right: Int, icon: Icon) =
- BorderFactory.createMatteBorder(top, left, bottom, right, icon)
-
- def CompoundBorder(outside: Border, inside: Border) =
- BorderFactory.createCompoundBorder(outside, inside)
-
- def TitledBorder(border: Border, title: String) =
- BorderFactory.createTitledBorder(border, title)
-
- /**
- * Schedule the given code to be executed on the Swing event dispatching
- * thread (EDT). Returns immediately.
- */
- @inline final def onEDT(op: =>Unit) = SwingUtilities invokeLater Runnable(op)
-
- /**
- * Schedule the given code to be executed on the Swing event dispatching
- * thread (EDT). Blocks until after the code has been run.
- */
- @inline final def onEDTWait(op: =>Unit) = SwingUtilities invokeAndWait Runnable(op)
-}
diff --git a/src/swing/scala/swing/SwingApplication.scala b/src/swing/scala/swing/SwingApplication.scala
deleted file mode 100644
index 214001f72a..0000000000
--- a/src/swing/scala/swing/SwingApplication.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-package scala.swing
-
-/** Convenience class with utility methods for GUI applications. */
-abstract class SwingApplication extends Reactor {
-
- /** Initializes the application and runs the given program. */
- def main(args: Array[String]) = Swing.onEDT { startup(args) }
-
- /** Called before the GUI is created. Override to customize. */
- def startup(args: Array[String])
-
- /** Finalizes the application by calling `shutdown` and exits.*/
- def quit() { shutdown(); sys.exit(0) }
-
- /** Called before the application is exited. Override to customize. */
- def shutdown() {}
-}
diff --git a/src/swing/scala/swing/TabbedPane.scala b/src/swing/scala/swing/TabbedPane.scala
deleted file mode 100644
index 6e46256f86..0000000000
--- a/src/swing/scala/swing/TabbedPane.scala
+++ /dev/null
@@ -1,131 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import event._
-import scala.collection.mutable.Buffer
-import javax.swing.{JTabbedPane, JComponent}
-
-
-object TabbedPane {
- object Layout extends Enumeration {
- val Wrap = Value(JTabbedPane.WRAP_TAB_LAYOUT)
- val Scroll = Value(JTabbedPane.SCROLL_TAB_LAYOUT)
- }
-
- class Page protected[TabbedPane](parent0: TabbedPane, title0: String, content0: Component, tip0: String) extends Proxy {
- def self = content0
-
- def this(title0: String, content0: Component, tip0: String) =
- this(null, title0, content0, tip0)
- def this(title0: String, content0: Component) =
- this(title0, content0, "")
- content = content0 // first add component, *then* set other things
- title = title0
- tip = tip0
-
- protected[TabbedPane] var parent: TabbedPane = parent0
-
- protected var _title = title0
- def title: String = _title
- def title_=(t: String) {
- // beware to keep this order since, index depends on the _old_ title
- if (parent != null) parent.peer.setTitleAt(index, t)
- _title = t
- }
- protected var _content = content0
- def content: Component = _content//UIElement.cachedWrapper(peer.getComponentAt(index).asInstanceOf[JComponent])
- def content_=(c: Component) { _content = c; if (parent != null) parent.peer.setComponentAt(index, c.peer) }
- protected var _tip = tip0
- def tip: String = _tip//peer.getToolTipTextAt(index)
- def tip_=(t: String) { _tip = t; if (parent != null) parent.peer.setToolTipTextAt(index, t) }
- protected var _enabled = true
- def enabled: Boolean = _enabled//peer.isEnabledAt(index)
- def enabled_=(b: Boolean) { _enabled = b; if (parent != null) parent.peer.setEnabledAt(index, b) }
- protected var _mnemonic = -1
- def mnemonic: Int = _mnemonic//peer.getMnemonicAt(index)
- def mnemonic_=(k: Int) { _mnemonic = k; if (parent != null) parent.peer.setMnemonicAt(index, k)}
- protected var _foreground: Color = null
- def foreground: Color = _foreground//peer.getForegroundAt(index)
- def foreground_=(c: Color) { _foreground = c; if (parent != null) parent.peer.setForegroundAt(index, c)}
- protected var _background: Color = null
- def background: Color = _background //peer.getBackgroundAt(index)
- def background_=(c: Color) { _background = c; if (parent != null) parent.peer.setBackgroundAt(index, c)}
- def bounds: Rectangle = parent.peer.getBoundsAt(index)
-
- // TODO: icon, disabledIcon
-
- def index = if(parent != null) parent.peer.indexOfTab(title) else 0//_index
- //protected[TabbedPane] var _index: Int = index0
- }
-}
-
-/**
- * Displays the contents of one of several pages at a time. For each page a tab is
- * visible at all times. The user can click on one of these tabs to move the
- * corresponding page to the front.
- *
- * @see javax.swing.JTabbedPane
- */
-class TabbedPane extends Component with Publisher {
- override lazy val peer: JTabbedPane = new JTabbedPane with SuperMixin
- import TabbedPane._
-
- object pages extends BufferWrapper[Page] {
- def runCount: Int = peer.getTabRunCount
-
- def remove(n: Int): Page = {
- val t = apply(n)
- peer.removeTabAt(n)
- t.parent = null
- //for(i <- n to length) apply(i)._index -= 1
- t
- }
- protected def insertAt(n: Int, t: Page) {
- //for(i <- n to length) apply(i)._index += 1
- t.parent = TabbedPane.this
- peer.insertTab(t.title, null, t.content.peer, t.tip, n)
- }
-
- def +=(t: Page): this.type = { t.parent = TabbedPane.this; peer.addTab(t.title, null, t.content.peer, t.tip); this }
- def length = peer.getTabCount
- def apply(n: Int) = new Page(TabbedPane.this, peer.getTitleAt(n),
- UIElement.cachedWrapper[Component](peer.getComponentAt(n).asInstanceOf[javax.swing.JComponent]),
- peer.getToolTipTextAt(n))
- }
-
- def tabLayoutPolicy: Layout.Value = Layout(peer.getTabLayoutPolicy)
- def tabLayoutPolicy_=(p: Layout.Value) { peer.setTabLayoutPolicy(p.id) }
-
-
- def tabPlacement: Alignment.Value = Alignment(peer.getTabPlacement)
- /**
- * Possible values are Left, Right, Top, Bottom.
- */
- def tabPlacement_=(b: Alignment.Value) { peer.setTabPlacement(b.id) }
-
- /**
- * The current page selection
- */
- object selection extends Publisher {
- def page: Page = pages(index)
- def page_=(p: Page) { index = p.index }
-
- def index: Int = peer.getSelectedIndex
- def index_=(n: Int) { peer.setSelectedIndex(n) }
-
- peer.addChangeListener(new javax.swing.event.ChangeListener {
- def stateChanged(e: javax.swing.event.ChangeEvent) {
- publish(SelectionChanged(TabbedPane.this))
- }
- })
- }
-}
diff --git a/src/swing/scala/swing/Table.scala b/src/swing/scala/swing/Table.scala
deleted file mode 100644
index 45053f0411..0000000000
--- a/src/swing/scala/swing/Table.scala
+++ /dev/null
@@ -1,320 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import event._
-import javax.swing._
-import javax.swing.table._
-import javax.swing.event._
-import scala.collection.mutable
-
-object Table {
- object AutoResizeMode extends Enumeration {
- import JTable._
- val Off = Value(AUTO_RESIZE_OFF, "Off")
- val NextColumn = Value(AUTO_RESIZE_NEXT_COLUMN, "NextColumn")
- val SubsequentColumns = Value(AUTO_RESIZE_SUBSEQUENT_COLUMNS, "SubsequentColumns")
- val LastColumn = Value(AUTO_RESIZE_LAST_COLUMN, "LastColumn")
- val AllColumns = Value(AUTO_RESIZE_ALL_COLUMNS, "AllColumns")
- }
-
- object IntervalMode extends Enumeration {
- val Single = Value(ListSelectionModel.SINGLE_SELECTION)
- val SingleInterval = Value(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
- val MultiInterval = Value(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
- }
- object ElementMode extends Enumeration {
- val Row, Column, Cell, None = Value
- }
-
- /**
- * A table item renderer.
- *
- * @see javax.swing.table.TableCellRenderer
- */
- abstract class Renderer[-A] {
- def peer: TableCellRenderer = new TableCellRenderer {
- def getTableCellRendererComponent(table: JTable, value: AnyRef, isSelected: Boolean, hasFocus: Boolean, row: Int, column: Int) = {
- componentFor(table match {
- case t: JTableMixin => t.tableWrapper
- case _ => assert(false); null
- }, isSelected, hasFocus, value.asInstanceOf[A], row, column).peer
- }
- }
- def componentFor(table: Table, isSelected: Boolean, hasFocus: Boolean, a: A, row: Int, column: Int): Component
- }
-
- abstract class AbstractRenderer[-A, C<:Component](val component: C) extends Renderer[A] {
- // The renderer component is responsible for painting selection
- // backgrounds. Hence, make sure it is opaque to let it draw
- // the background.
- component.opaque = true
-
- /**
- * Standard preconfiguration that is commonly done for any component.
- */
- def preConfigure(table: Table, isSelected: Boolean, hasFocus: Boolean, a: A, row: Int, column: Int) {
- if (isSelected) {
- component.background = table.selectionBackground
- component.foreground = table.selectionForeground
- } else {
- component.background = table.background
- component.foreground = table.foreground
- }
- }
- /**
- * Configuration that is specific to the component and this renderer.
- */
- def configure(table: Table, isSelected: Boolean, hasFocus: Boolean, a: A, row: Int, column: Int)
-
- /**
- * Configures the component before returning it.
- */
- def componentFor(table: Table, isSelected: Boolean, hasFocus: Boolean, a: A, row: Int, column: Int): Component = {
- preConfigure(table, isSelected, hasFocus, a, row, column)
- configure(table, isSelected, hasFocus, a, row, column)
- component
- }
- }
-
- class LabelRenderer[A](convert: A => (Icon, String)) extends AbstractRenderer[A, Label](new Label) {
- def this() {
- this{ a => (null, a.toString) }
- }
-
- def configure(table: Table, isSelected: Boolean, hasFocus: Boolean, a: A, row: Int, column: Int) {
- val (icon, text) = convert(a)
- component.icon = icon
- component.text = text
- }
- }
-
- private[swing] trait JTableMixin { def tableWrapper: Table }
-}
-
-/**
- * Displays a matrix of items.
- *
- * To obtain a scrollable table or row and columns headers,
- * wrap the table in a scroll pane.
- *
- * @see javax.swing.JTable
- */
-class Table extends Component with Scrollable.Wrapper {
- override lazy val peer: JTable = new JTable with Table.JTableMixin with SuperMixin {
- def tableWrapper = Table.this
- override def getCellRenderer(r: Int, c: Int) = new TableCellRenderer {
- def getTableCellRendererComponent(table: JTable, value: AnyRef, isSelected: Boolean, hasFocus: Boolean, row: Int, column: Int) =
- Table.this.rendererComponent(isSelected, hasFocus, row, column).peer
- }
- override def getCellEditor(r: Int, c: Int) = editor(r, c)
- override def getValueAt(r: Int, c: Int) = Table.this.apply(r,c).asInstanceOf[AnyRef]
- }
- import Table._
-
- // TODO: use IndexedSeq[_ <: IndexedSeq[Any]], see ticket #2005
- def this(rowData: Array[Array[Any]], columnNames: Seq[_]) = {
- this()
- model = new AbstractTableModel {
- override def getColumnName(column: Int) = columnNames(column).toString
- def getRowCount() = rowData.length
- def getColumnCount() = columnNames.length
- def getValueAt(row: Int, col: Int): AnyRef = rowData(row)(col).asInstanceOf[AnyRef]
- override def isCellEditable(row: Int, column: Int) = true
- override def setValueAt(value: Any, row: Int, col: Int) {
- rowData(row)(col) = value
- fireTableCellUpdated(row, col)
- }
- }
- }
- def this(rows: Int, columns: Int) = {
- this()
- model = new DefaultTableModel(rows, columns) {
- override def setValueAt(value: Any, row: Int, col: Int) {
- super.setValueAt(value, row, col)
- }
- }
- }
-
- protected def scrollablePeer = peer
-
- def rowHeight = peer.getRowHeight
- def rowHeight_=(x: Int) = peer.setRowHeight(x)
-
- def rowCount = peer.getRowCount
-
- def model = peer.getModel()
- def model_=(x: TableModel) = {
- peer.setModel(x)
- model.removeTableModelListener(modelListener)
- model.addTableModelListener(modelListener)
- }
-
- def autoResizeMode: AutoResizeMode.Value = AutoResizeMode(peer.getAutoResizeMode)
- def autoResizeMode_=(x: Table.AutoResizeMode.Value) = peer.setAutoResizeMode(x.id)
-
- def showGrid = peer.getShowHorizontalLines && peer.getShowVerticalLines
- def showGrid_=(grid: Boolean) = peer.setShowGrid(grid)
-
- def gridColor = peer.getGridColor
- def gridColor_=(color: Color) = peer.setGridColor(color)
-
- def preferredViewportSize_=(dim: Dimension) = peer.setPreferredScrollableViewportSize(dim)
- //1.6: def fillsViewportHeight: Boolean = peer.getFillsViewportHeight
- //def fillsViewportHeight_=(b: Boolean) = peer.setFillsViewportHeight(b)
-
- object selection extends Publisher {
- // TODO: could be a sorted set
- protected abstract class SelectionSet[A](a: =>Seq[A]) extends mutable.Set[A] {
- def -=(n: A): this.type
- def +=(n: A): this.type
- def contains(n: A) = a.contains(n)
- override def size = a.length
- def iterator = a.iterator
- }
-
- object rows extends SelectionSet(peer.getSelectedRows) {
- def -=(n: Int) = { peer.removeRowSelectionInterval(n,n); this }
- def +=(n: Int) = { peer.addRowSelectionInterval(n,n); this }
-
- def leadIndex: Int = peer.getSelectionModel.getLeadSelectionIndex
- def anchorIndex: Int = peer.getSelectionModel.getAnchorSelectionIndex
- }
-
- object columns extends SelectionSet(peer.getSelectedColumns) {
- def -=(n: Int) = { peer.removeColumnSelectionInterval(n,n); this }
- def +=(n: Int) = { peer.addColumnSelectionInterval(n,n); this }
-
- def leadIndex: Int = peer.getColumnModel.getSelectionModel.getLeadSelectionIndex
- def anchorIndex: Int = peer.getColumnModel.getSelectionModel.getAnchorSelectionIndex
- }
-
- def cells: mutable.Set[(Int, Int)] =
- new SelectionSet[(Int, Int)]((for(r <- selection.rows; c <- selection.columns) yield (r,c)).toSeq) { outer =>
- def -=(n: (Int, Int)) = {
- peer.removeRowSelectionInterval(n._1,n._1)
- peer.removeColumnSelectionInterval(n._2,n._2)
- this
- }
- def +=(n: (Int, Int)) = {
- peer.addRowSelectionInterval(n._1,n._1)
- peer.addColumnSelectionInterval(n._2,n._2)
- this
- }
- override def size = peer.getSelectedRowCount * peer.getSelectedColumnCount
- }
-
- /**
- * From the JTable Swing tutorial:
- * You can specify selection by cell in multiple interval selection mode,
- * but the result is a table that does not produce useful selections.
- */
- def intervalMode: IntervalMode.Value = IntervalMode(peer.getSelectionModel.getSelectionMode)
- def intervalMode_=(m: IntervalMode.Value) { peer.setSelectionMode(m.id) }
- def elementMode: ElementMode.Value =
- if(peer.getColumnSelectionAllowed && peer.getRowSelectionAllowed) ElementMode.Cell
- else if(peer.getColumnSelectionAllowed) ElementMode.Column
- else if(peer.getRowSelectionAllowed) ElementMode.Row
- else ElementMode.None
- def elementMode_=(m: ElementMode.Value) {
- m match {
- case ElementMode.Cell => peer.setCellSelectionEnabled(true)
- case ElementMode.Column => peer.setRowSelectionAllowed(false); peer.setColumnSelectionAllowed(true)
- case ElementMode.Row => peer.setRowSelectionAllowed(true); peer.setColumnSelectionAllowed(false)
- case ElementMode.None => peer.setRowSelectionAllowed(false); peer.setColumnSelectionAllowed(false)
- }
- }
-
- peer.getColumnModel.getSelectionModel.addListSelectionListener(new ListSelectionListener {
- def valueChanged(e: javax.swing.event.ListSelectionEvent) {
- publish(TableColumnsSelected(Table.this, e.getFirstIndex to e.getLastIndex, e.getValueIsAdjusting))
- }
- })
- peer.getSelectionModel.addListSelectionListener(new ListSelectionListener {
- def valueChanged(e: javax.swing.event.ListSelectionEvent) {
- publish(TableRowsSelected(Table.this, e.getFirstIndex to e.getLastIndex, e.getValueIsAdjusting))
- }
- })
- }
-
- /**
- * Supplies a renderer component for a given cell.
- */
- protected def rendererComponent(isSelected: Boolean, focused: Boolean, row: Int, column: Int): Component =
- new Component {
- override lazy val peer = {
- val v = apply(row, column).asInstanceOf[AnyRef]
- if (v != null)
- Table.this.peer.getDefaultRenderer(v.getClass).getTableCellRendererComponent(Table.this.peer,
- v, isSelected, focused, row, column).asInstanceOf[JComponent]
- else Table.this.peer.getDefaultRenderer(classOf[Object]).getTableCellRendererComponent(Table.this.peer,
- v, isSelected, focused, row, column).asInstanceOf[JComponent]
- }
- }
-
- // TODO: a public API for setting editors
- protected def editor(row: Int, column: Int) = {
- val v = apply(row, column).asInstanceOf[AnyRef]
- if (v != null)
- Table.this.peer.getDefaultEditor(v.getClass)
- else
- Table.this.peer.getDefaultEditor(classOf[Object])
- }
-
- /**
- * Get the current value of the given cell.
- * The given cell coordinates are in view coordinates and thus not
- * necessarily the same as for the model.
- */
- def apply(row: Int, column: Int): Any = model.getValueAt(row, viewToModelColumn(column))
-
- // TODO: this is Java 6 stuff
- // def apply(row: Int, column: Int): Any = model.getValueAt(viewToModelRow(row), viewToModelColumn(column))
- //def viewToModelRow(idx: Int) = peer.convertRowIndexToModel(idx)
- //def modelToViewRow(idx: Int) = peer.convertRowIndexToView(idx)
-
- def viewToModelColumn(idx: Int) = peer.convertColumnIndexToModel(idx)
- def modelToViewColumn(idx: Int) = peer.convertColumnIndexToView(idx)
-
-
- /**
- * Change the value of the given cell.
- */
- def update(row: Int, column: Int, value: Any) { model.setValueAt(value, row, viewToModelColumn(column)) }
-
- /**
- * Visually update the given cell.
- */
- def updateCell(row: Int, column: Int) = update(row, column, apply(row, column))
-
- def selectionForeground: Color = peer.getSelectionForeground
- def selectionForeground_=(c: Color) = peer.setSelectionForeground(c)
- def selectionBackground: Color = peer.getSelectionBackground
- def selectionBackground_=(c: Color) = peer.setSelectionBackground(c)
-
- protected val modelListener = new TableModelListener {
- def tableChanged(e: TableModelEvent) = publish(
- e.getType match {
- case TableModelEvent.UPDATE =>
- if (e.getFirstRow == 0 && e.getLastRow == Int.MaxValue && e.getColumn == TableModelEvent.ALL_COLUMNS)
- TableChanged(Table.this)
- else if (e.getFirstRow == TableModelEvent.HEADER_ROW)
- TableStructureChanged(Table.this)
- else
- TableUpdated(Table.this, e.getFirstRow to e.getLastRow, e.getColumn)
- case TableModelEvent.INSERT =>
- TableRowsAdded(Table.this, e.getFirstRow to e.getLastRow)
- case TableModelEvent.DELETE =>
- TableRowsRemoved(Table.this, e.getFirstRow to e.getLastRow)
- }
- )
- }
-}
diff --git a/src/swing/scala/swing/TextArea.scala b/src/swing/scala/swing/TextArea.scala
deleted file mode 100644
index 2f6bdca119..0000000000
--- a/src/swing/scala/swing/TextArea.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import javax.swing._
-
-/**
- * A text component that allows multiline text input and display.
- *
- * @see javax.swing.JTextArea
- */
-class TextArea(text0: String, rows0: Int, columns0: Int) extends TextComponent
- with TextComponent.HasColumns with TextComponent.HasRows {
- override lazy val peer: JTextArea = new JTextArea(text0, rows0, columns0) with SuperMixin
- def this(text: String) = this(text, 0, 0)
- def this(rows: Int, columns: Int) = this("", rows, columns)
- def this() = this("", 0, 0)
-
- // TODO: we could make contents StringBuilder-like
- def append(t: String) { peer.append(t) }
-
- def rows: Int = peer.getRows
- def rows_=(n: Int) = peer.setRows(n)
- def columns: Int = peer.getColumns
- def columns_=(n: Int) = peer.setColumns(n)
-
- def tabSize: Int = peer.getTabSize
- def tabSize_=(n: Int) = peer.setTabSize(n)
- def lineCount: Int = peer.getLineCount
-
- def lineWrap: Boolean = peer.getLineWrap
- def lineWrap_=(w: Boolean) = peer.setLineWrap(w)
- def wordWrap: Boolean = peer.getWrapStyleWord
- def wordWrap_=(w: Boolean) = peer.setWrapStyleWord(w)
- def charWrap: Boolean = !peer.getWrapStyleWord
- def charWrap_=(w: Boolean) = peer.setWrapStyleWord(!w)
-}
diff --git a/src/swing/scala/swing/TextComponent.scala b/src/swing/scala/swing/TextComponent.scala
deleted file mode 100644
index 4d23399737..0000000000
--- a/src/swing/scala/swing/TextComponent.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import event._
-import javax.swing.text._
-import javax.swing.event._
-
-object TextComponent {
- trait HasColumns extends TextComponent {
- def columns: Int
- def columns_=(n: Int)
- }
- trait HasRows extends TextComponent {
- def rows: Int
- def rows_=(n: Int)
- }
-}
-
-/**
- * A component that allows some kind of text input and display.
- *
- * @see javax.swing.JTextComponent
- */
-class TextComponent extends Component with Publisher {
- override lazy val peer: JTextComponent = new JTextComponent with SuperMixin {}
- def text: String = peer.getText
- def text_=(t: String) = peer.setText(t)
-
- class Caret extends Publisher {
- def dot: Int = peer.getCaret.getDot
- def dot_=(n: Int) { peer.getCaret.setDot(n) }
- def mark: Int = peer.getCaret.getMark
- def moveDot(n: Int) { peer.getCaret.moveDot(n) }
- def visible: Boolean = peer.getCaret.isVisible
- def visible_=(b: Boolean) { peer.getCaret.setVisible(b) }
- def selectionVisible: Boolean = peer.getCaret.isSelectionVisible
- def selectionVisible_=(b: Boolean) { peer.getCaret.setSelectionVisible(b) }
- def blinkRate: Int = peer.getCaret.getBlinkRate
- def blinkRate_=(n: Int) { peer.getCaret.setBlinkRate(n) }
- def color: Color = peer.getCaretColor
- def color_=(c: Color) = peer.setCaretColor(c)
- def position: Int = peer.getCaretPosition
- def position_=(p: Int) = peer.setCaretPosition(p)
-
- peer.addCaretListener {
- new CaretListener {
- def caretUpdate(e: CaretEvent) { publish(CaretUpdate(TextComponent.this)) }
- }
- }
- }
-
- object caret extends Caret
-
- def editable: Boolean = peer.isEditable
- def editable_=(x: Boolean) = peer.setEditable(x)
- def cut() { peer.cut() }
- def copy() { peer.copy() }
- def paste() { peer.paste() }
- def selected: String = peer.getSelectedText
-
- def selectAll() { peer.selectAll() }
-
- peer.getDocument.addDocumentListener(new DocumentListener {
- def changedUpdate(e:DocumentEvent) { publish(new ValueChanged(TextComponent.this)) }
- def insertUpdate(e:DocumentEvent) { publish(new ValueChanged(TextComponent.this)) }
- def removeUpdate(e:DocumentEvent) { publish(new ValueChanged(TextComponent.this)) }
- })
-}
diff --git a/src/swing/scala/swing/TextField.scala b/src/swing/scala/swing/TextField.scala
deleted file mode 100644
index a28e8f84e6..0000000000
--- a/src/swing/scala/swing/TextField.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import event._
-import javax.swing._
-import java.awt.event._
-
-
-/*object TextField {
- object FocusLostBehavior extends Enumeration {
- val Revert = Value(JFormattedTextField.REVERT)
- val Commit = Value(JFormattedTextField.REVERT)
- val CommitOrRevert = Value(JFormattedTextField.REVERT)
- val Persist = Value(JFormattedTextField.REVERT)
- }
-}*/
-
-/**
- * A text component that allows single line text input and display.
- *
- * @see javax.swing.JTextField
- */
-class TextField(text0: String, columns0: Int) extends TextComponent with TextComponent.HasColumns with Action.Trigger.Wrapper {
- override lazy val peer: JTextField = new JTextField(text0, columns0) with SuperMixin
- def this(text: String) = this(text, 0)
- def this(columns: Int) = this("", columns)
- def this() = this("")
-
- def columns: Int = peer.getColumns
- def columns_=(n: Int) = peer.setColumns(n)
-
- /** @see javax.swing.JTextField#getHorizontalAlignment() */
- def horizontalAlignment: Alignment.Value = Alignment(peer.getHorizontalAlignment)
- /** @see javax.swing.JTextField#setHorizontalAlignment() */
- def horizontalAlignment_=(x: Alignment.Value) { peer.setHorizontalAlignment(x.id) }
-
- private lazy val actionListener = Swing.ActionListener { e =>
- publish(EditDone(TextField.this))
- }
-
- protected override def onFirstSubscribe() {
- super.onFirstSubscribe
- peer.addActionListener(actionListener)
- peer.addFocusListener(new FocusAdapter {
- override def focusLost(e: java.awt.event.FocusEvent) { publish(EditDone(TextField.this)) }
- })
- }
-
- protected override def onLastUnsubscribe() {
- super.onLastUnsubscribe
- peer.removeActionListener(actionListener)
- }
-
- def verifier: String => Boolean = s => Option(peer.getInputVerifier) forall (_ verify peer)
- def verifier_=(v: String => Boolean) {
- peer.setInputVerifier(new InputVerifier {
- private val old = Option(peer.getInputVerifier)
- def verify(c: JComponent) = v(text)
- override def shouldYieldFocus(c: JComponent) = old forall (_ shouldYieldFocus c)
- })
- }
- def shouldYieldFocus: String => Boolean = s => Option(peer.getInputVerifier) forall (_ shouldYieldFocus peer)
- def shouldYieldFocus_=(y: String=>Boolean) {
- peer.setInputVerifier(new InputVerifier {
- private val old = peer.getInputVerifier
- def verify(c: JComponent) = old.verify(c)
- override def shouldYieldFocus(c: JComponent) = y(text)
- })
- }
-}
diff --git a/src/swing/scala/swing/ToggleButton.scala b/src/swing/scala/swing/ToggleButton.scala
deleted file mode 100644
index 8f210d00d8..0000000000
--- a/src/swing/scala/swing/ToggleButton.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import javax.swing._
-
-/**
- * A two state button with a push button like user interface.
- * Usually used in tool bars.
- *
- * @see javax.swing.JToggleButton
- */
-class ToggleButton(text0: String) extends AbstractButton {
- override lazy val peer: JToggleButton = new JToggleButton(text0) with SuperMixin
- def this() = this("")
-}
diff --git a/src/swing/scala/swing/UIElement.scala b/src/swing/scala/swing/UIElement.scala
deleted file mode 100644
index 16b8738392..0000000000
--- a/src/swing/scala/swing/UIElement.scala
+++ /dev/null
@@ -1,133 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import java.awt.Cursor
-import event._
-import scala.ref._
-import java.util.WeakHashMap
-
-object UIElement {
- private val ClientKey = "scala.swingWrapper"
- private[this] val wrapperCache = new WeakHashMap[java.awt.Component, WeakReference[UIElement]]
-
- private def cache(e: UIElement) = e.peer match {
- case p: javax.swing.JComponent => p.putClientProperty(ClientKey, e)
- case _ => wrapperCache.put(e.peer, new WeakReference(e))
- }
-
- /**
- * Looks up the internal component cache for a wrapper of the given
- * Java Swing peer. If this method finds one of the given type `C`,
- * it will return that wrapper. Otherwise it returns `null`. This
- * method never throws an exception.
- *
- * Clients should be extremely careful with type parameter `C` and
- * its interaction with type inference. Better err on the side of caution
- * and explicitly specify `C`.
- */
- private[swing] def cachedWrapper[C>:Null<:UIElement](c: java.awt.Component): C = {
- val w = c match {
- case c: javax.swing.JComponent => c.getClientProperty(ClientKey)
- case _ => wrapperCache.get(c)
- }
- try { w.asInstanceOf[C] } catch { case _: Exception => null }
- }
-
- /**
- * Returns a wrapper for a given Java Swing peer. If there is a
- * compatible wrapper in use, this method will return it.
- *
- * `wrap` methods in companion objects of subclasses of `UIElement` have
- * the same behavior, except that they return more specific wrappers.
- */
- def wrap(c: java.awt.Component): UIElement = {
- val w = cachedWrapper[UIElement](c)
- if (w != null) w
- else new UIElement { def peer = c }
- }
-}
-
-/**
- * The base trait of all user interface elements. Subclasses belong to one
- * of two groups: top-level elements such as windows and dialogs, or
- * `Component`s.
- *
- * @note [Java Swing] This trait does not have an exact counterpart in
- * Java Swing. The peer is of type java.awt.Component since this is the
- * least common upper bound of possible underlying peers.
- *
- * @note [Implementation] A UIElement automatically adds itself to the
- * component cache on creation.
- *
- * @see java.awt.Component
- */
-trait UIElement extends Proxy with LazyPublisher {
- /**
- * The underlying Swing peer.
- */
- def peer: java.awt.Component
- def self = peer
-
- UIElement.cache(this)
-
- def foreground: Color = peer.getForeground
- def foreground_=(c: Color) = peer setForeground c
- def background: Color = peer.getBackground
- def background_=(c: Color) = peer setBackground c
-
- def minimumSize = peer.getMinimumSize
- def minimumSize_=(x: Dimension) = peer setMinimumSize x
- def maximumSize = peer.getMaximumSize
- def maximumSize_=(x: Dimension) = peer setMaximumSize x
- def preferredSize = peer.getPreferredSize
- def preferredSize_=(x: Dimension) = peer setPreferredSize x
-
- def font: Font = peer.getFont
- def font_=(f: Font) = peer setFont f
-
- def locationOnScreen = peer.getLocationOnScreen
- def location = peer.getLocation
- def bounds = peer.getBounds
- def size = peer.getSize
-
- def locale = peer.getLocale
- def toolkit = peer.getToolkit
-
- def cursor: Cursor = peer.getCursor
- def cursor_=(c: Cursor) { peer.setCursor(c) }
-
- def visible: Boolean = peer.isVisible
- def visible_=(b: Boolean) { peer.setVisible(b) }
- def showing: Boolean = peer.isShowing
- def displayable: Boolean = peer.isDisplayable
-
- def repaint() { peer.repaint }
- def repaint(rect: Rectangle) { peer.repaint(rect.x, rect.y, rect.width, rect.height) }
- def ignoreRepaint: Boolean = peer.getIgnoreRepaint
- def ignoreRepaint_=(b: Boolean) { peer.setIgnoreRepaint(b) }
-
- protected def onFirstSubscribe() {
- peer.addComponentListener(new java.awt.event.ComponentListener {
- def componentHidden(e: java.awt.event.ComponentEvent) {
- publish(UIElementHidden(UIElement.this))
- }
- def componentShown(e: java.awt.event.ComponentEvent) {
- publish(UIElementShown(UIElement.this))
- }
- def componentMoved(e: java.awt.event.ComponentEvent) {
- publish(UIElementMoved(UIElement.this))
- }
- def componentResized(e: java.awt.event.ComponentEvent) {
- publish(UIElementResized(UIElement.this))
- }
- })
- }
- protected def onLastUnsubscribe() {}
-}
diff --git a/src/swing/scala/swing/Window.scala b/src/swing/scala/swing/Window.scala
deleted file mode 100644
index a9f4ae7538..0000000000
--- a/src/swing/scala/swing/Window.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.swing
-
-import java.awt.{Window => AWTWindow}
-import event._
-
-/**
- * A window with decoration such as a title, border, and action buttons.
- *
- * An AWT window cannot be wrapped dynamically with this class, i.e., you cannot
- * write something like new Window { def peer = myAWTWindow }
- *
- * @see javax.swing.JFrame
- */
-abstract class Window extends UIElement with RootPanel with Publisher { outer =>
- def peer: AWTWindow with InterfaceMixin
-
- protected trait InterfaceMixin extends javax.swing.RootPaneContainer
-
- protected trait SuperMixin extends AWTWindow {
- override protected def processWindowEvent(e: java.awt.event.WindowEvent) {
- super.processWindowEvent(e)
- if (e.getID() == java.awt.event.WindowEvent.WINDOW_CLOSING)
- closeOperation()
- }
- }
-
- /**
- * This method is called when the window is closing, after all other window
- * event listeners have been processed.
- */
- def closeOperation() {}
-
- override def contents_=(c: Component) {
- super.contents_=(c)
- peer.pack() // pack also validates, which is generally required after an add
- }
- def defaultButton: Option[Button] =
- toOption(peer.getRootPane.getDefaultButton) map UIElement.cachedWrapper[Button]
- def defaultButton_=(b: Button) {
- peer.getRootPane.setDefaultButton(b.peer)
- }
- def defaultButton_=(b: Option[Button]) {
- peer.getRootPane.setDefaultButton(b.map(_.peer).orNull)
- }
-
- def dispose() { peer.dispose() }
-
- def pack(): this.type = { peer.pack(); this }
-
- def setLocationRelativeTo(c: UIElement) { peer.setLocationRelativeTo(c.peer) }
- def centerOnScreen() { peer.setLocationRelativeTo(null) }
- def location_=(p: Point) { peer.setLocation(p) }
- def size_=(size: Dimension) { peer.setSize(size) }
- def bounds_=(rect: Rectangle) { peer.setBounds(rect) }
-
- def owner: Window = UIElement.cachedWrapper[Window](peer.getOwner)
-
- def open() { peer setVisible true }
- def close() { peer setVisible false }
-
- peer.addWindowListener(new java.awt.event.WindowListener {
- def windowActivated(e: java.awt.event.WindowEvent) { publish(WindowActivated(outer)) }
- def windowClosed(e: java.awt.event.WindowEvent) { publish(WindowClosed(outer)) }
- def windowClosing(e: java.awt.event.WindowEvent) { publish(WindowClosing(outer)) }
- def windowDeactivated(e: java.awt.event.WindowEvent) { publish(WindowDeactivated(outer)) }
- def windowDeiconified(e: java.awt.event.WindowEvent) { publish(WindowDeiconified(outer)) }
- def windowIconified(e: java.awt.event.WindowEvent) { publish(WindowIconified(outer)) }
- def windowOpened(e: java.awt.event.WindowEvent) { publish(WindowOpened(outer)) }
- })
-}
diff --git a/src/swing/scala/swing/event/ActionEvent.scala b/src/swing/scala/swing/event/ActionEvent.scala
deleted file mode 100644
index 7b2de43dc8..0000000000
--- a/src/swing/scala/swing/event/ActionEvent.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-object ActionEvent {
- def unapply(a: ActionEvent): Option[Component] = Some(a.source)
-}
-
-class ActionEvent(override val source: Component) extends ComponentEvent
diff --git a/src/swing/scala/swing/event/AdjustingEvent.scala b/src/swing/scala/swing/event/AdjustingEvent.scala
deleted file mode 100644
index a4b7d29c7d..0000000000
--- a/src/swing/scala/swing/event/AdjustingEvent.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-/** An event that indicates some editing operation that can be still
- * in progress.
- *
- * Example: dragging a slider creates a number of `AdjustmentEvents`
- * with `adjusting == '''true'''` until the user finally releases the
- * mouse button.
- */
-trait AdjustingEvent extends ComponentEvent {
- def adjusting: Boolean
- def committed: Boolean = !adjusting
-}
diff --git a/src/swing/scala/swing/event/BackgroundChanged.scala b/src/swing/scala/swing/event/BackgroundChanged.scala
deleted file mode 100644
index bdd67f9525..0000000000
--- a/src/swing/scala/swing/event/BackgroundChanged.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class BackgroundChanged(override val source: Component) extends ComponentEvent
diff --git a/src/swing/scala/swing/event/ButtonClicked.scala b/src/swing/scala/swing/event/ButtonClicked.scala
deleted file mode 100644
index d02201909e..0000000000
--- a/src/swing/scala/swing/event/ButtonClicked.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class ButtonClicked(override val source: AbstractButton) extends ActionEvent(source)
-
diff --git a/src/swing/scala/swing/event/CaretUpdate.scala b/src/swing/scala/swing/event/CaretUpdate.scala
deleted file mode 100644
index 2821175ec0..0000000000
--- a/src/swing/scala/swing/event/CaretUpdate.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class CaretUpdate(override val source: TextComponent) extends ComponentEvent
diff --git a/src/swing/scala/swing/event/ColorChanged.scala b/src/swing/scala/swing/event/ColorChanged.scala
deleted file mode 100644
index 6cb35e7755..0000000000
--- a/src/swing/scala/swing/event/ColorChanged.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class ColorChanged(source: Component, c: Color) extends ComponentEvent with SelectionEvent
diff --git a/src/swing/scala/swing/event/ComponentEvent.scala b/src/swing/scala/swing/event/ComponentEvent.scala
deleted file mode 100644
index 701b962934..0000000000
--- a/src/swing/scala/swing/event/ComponentEvent.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-trait ComponentEvent extends UIEvent {
- val source: Component
-}
diff --git a/src/swing/scala/swing/event/ContainerEvent.scala b/src/swing/scala/swing/event/ContainerEvent.scala
deleted file mode 100644
index 46f3768e97..0000000000
--- a/src/swing/scala/swing/event/ContainerEvent.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-abstract class ContainerEvent(override val source: Container) extends UIEvent
-
-case class ComponentAdded(override val source: Container, child: Component) extends ContainerEvent(source)
-case class ComponentRemoved(override val source: Container, child: Component) extends ContainerEvent(source)
diff --git a/src/swing/scala/swing/event/EditDone.scala b/src/swing/scala/swing/event/EditDone.scala
deleted file mode 100644
index 9d38234757..0000000000
--- a/src/swing/scala/swing/event/EditDone.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class EditDone(override val source: TextField) extends ValueChanged(source)
diff --git a/src/swing/scala/swing/event/Event.scala b/src/swing/scala/swing/event/Event.scala
deleted file mode 100644
index fd1135601d..0000000000
--- a/src/swing/scala/swing/event/Event.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-trait Event
diff --git a/src/swing/scala/swing/event/FocusEvent.scala b/src/swing/scala/swing/event/FocusEvent.scala
deleted file mode 100644
index 5c29d8f6d2..0000000000
--- a/src/swing/scala/swing/event/FocusEvent.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-/**
- * The other component is None if it is a non Swing, i.e., AWT or native, component.
- */
-abstract class FocusEvent(override val source: Component, val other: Option[Component], val temporary: Boolean) extends ComponentEvent
-
-case class FocusGained(override val source: Component, override val other: Option[Component], override val temporary: Boolean)
- extends FocusEvent(source, other, temporary)
-
-case class FocusLost(override val source: Component, override val other: Option[Component], override val temporary: Boolean)
- extends FocusEvent(source, other, temporary)
diff --git a/src/swing/scala/swing/event/FontChanged.scala b/src/swing/scala/swing/event/FontChanged.scala
deleted file mode 100644
index ca936e1924..0000000000
--- a/src/swing/scala/swing/event/FontChanged.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class FontChanged(override val source: Component) extends ComponentEvent
diff --git a/src/swing/scala/swing/event/ForegroundChanged.scala b/src/swing/scala/swing/event/ForegroundChanged.scala
deleted file mode 100644
index 42b45aae54..0000000000
--- a/src/swing/scala/swing/event/ForegroundChanged.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class ForegroundChanged(override val source: Component) extends ComponentEvent
diff --git a/src/swing/scala/swing/event/InputEvent.scala b/src/swing/scala/swing/event/InputEvent.scala
deleted file mode 100644
index b515b01525..0000000000
--- a/src/swing/scala/swing/event/InputEvent.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-trait InputEvent extends ComponentEvent {
- def peer: java.awt.event.InputEvent
- def when: Long = peer.getWhen
- def modifiers: Key.Modifiers
- def consume() { peer.consume() }
- def consumed: Boolean = peer.isConsumed
-}
diff --git a/src/swing/scala/swing/event/Key.scala b/src/swing/scala/swing/event/Key.scala
deleted file mode 100644
index 5e9e0cbecd..0000000000
--- a/src/swing/scala/swing/event/Key.scala
+++ /dev/null
@@ -1,232 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-/**
- * Enumeration of key codes used by key events.
- */
-object Key extends Enumeration {
- import java.awt.event.KeyEvent._
-
- object Location extends Enumeration {
- val Left = Value(java.awt.event.KeyEvent.KEY_LOCATION_LEFT)
- val Right = Value(java.awt.event.KeyEvent.KEY_LOCATION_RIGHT)
- val Numpad = Value(java.awt.event.KeyEvent.KEY_LOCATION_NUMPAD)
- val Standard = Value(java.awt.event.KeyEvent.KEY_LOCATION_STANDARD)
- val Unknown = Value(java.awt.event.KeyEvent.KEY_LOCATION_UNKNOWN)
- }
-
- type Modifiers = Int
-
- object Modifier {
- import java.awt.event.InputEvent._
- val Shift = SHIFT_DOWN_MASK
- val Control = CTRL_DOWN_MASK
- val Alt = ALT_DOWN_MASK
- val AltGraph = ALT_GRAPH_DOWN_MASK
- val Meta = META_DOWN_MASK
- def text(mods: Int) = java.awt.event.KeyEvent.getKeyModifiersText(mods)
- }
-
- //def text(k: Value) = java.awt.event.KeyEvent.getKeyText(k.id)
-
- val Shift = Value(VK_SHIFT, getKeyText(VK_SHIFT))
- val Control = Value(VK_CONTROL, getKeyText(VK_CONTROL))
- val Alt = Value(VK_ALT, getKeyText(VK_ALT))
- val AltGraph = Value(VK_ALT_GRAPH, getKeyText(VK_ALT_GRAPH))
- val Meta = Value(VK_META, getKeyText(VK_META))
-
- val Enter = Value(VK_ENTER, getKeyText(VK_ENTER))
- val BackSpace = Value(VK_BACK_SPACE, getKeyText(VK_BACK_SPACE))
- val Tab = Value(VK_TAB, getKeyText(VK_TAB))
- val Cancel = Value(VK_CANCEL, getKeyText(VK_CANCEL))
- val Clear = Value(VK_CLEAR, getKeyText(VK_CLEAR))
-
- val Pause = Value(VK_PAUSE, getKeyText(VK_PAUSE))
- val CapsLock = Value(VK_CAPS_LOCK, getKeyText(VK_CAPS_LOCK))
- val Escape = Value(VK_ESCAPE, getKeyText(VK_ESCAPE))
- val Space = Value(VK_SPACE, getKeyText(VK_SPACE))
- val PageUp = Value(VK_PAGE_UP, getKeyText(VK_PAGE_UP))
- val PageDown = Value(VK_PAGE_DOWN, getKeyText(VK_PAGE_DOWN))
- val End = Value(VK_END, getKeyText(VK_END))
- val Home = Value(VK_HOME, getKeyText(VK_HOME))
- val Left = Value(VK_LEFT, getKeyText(VK_LEFT))
- val Up = Value(VK_UP, getKeyText(VK_UP))
- val Right = Value(VK_RIGHT, getKeyText(VK_RIGHT))
- val Down = Value(VK_DOWN, getKeyText(VK_DOWN))
- val Comma = Value(VK_COMMA, getKeyText(VK_COMMA))
- val Minus = Value(VK_MINUS, getKeyText(VK_MINUS))
- val Period = Value(VK_PERIOD, getKeyText(VK_PERIOD))
- val Slash = Value(VK_SLASH, getKeyText(VK_SLASH))
- val Key0 = Value(VK_0, getKeyText(VK_0))
- val Key1 = Value(VK_1, getKeyText(VK_1))
- val Key2 = Value(VK_2, getKeyText(VK_2))
- val Key3 = Value(VK_3, getKeyText(VK_3))
- val Key4 = Value(VK_4, getKeyText(VK_4))
- val Key5 = Value(VK_5, getKeyText(VK_5))
- val Key6 = Value(VK_6, getKeyText(VK_6))
- val Key7 = Value(VK_7, getKeyText(VK_7))
- val Key8 = Value(VK_8, getKeyText(VK_8))
- val Key9 = Value(VK_9, getKeyText(VK_9))
- val Semicolon = Value(VK_SEMICOLON, getKeyText(VK_SEMICOLON))
- val Equals = Value(VK_EQUALS, getKeyText(VK_EQUALS))
- val A = Value(VK_A, getKeyText(VK_A))
- val B = Value(VK_B, getKeyText(VK_B))
- val C = Value(VK_C, getKeyText(VK_C))
- val D = Value(VK_D, getKeyText(VK_D))
- val E = Value(VK_E, getKeyText(VK_E))
- val F = Value(VK_F, getKeyText(VK_F))
- val G = Value(VK_G, getKeyText(VK_G))
- val H = Value(VK_H, getKeyText(VK_H))
- val I = Value(VK_I, getKeyText(VK_I))
- val J = Value(VK_J, getKeyText(VK_J))
- val K = Value(VK_K, getKeyText(VK_K))
- val L = Value(VK_L, getKeyText(VK_L))
- val M = Value(VK_M, getKeyText(VK_M))
- val N = Value(VK_N, getKeyText(VK_N))
- val O = Value(VK_O, getKeyText(VK_O))
- val P = Value(VK_P, getKeyText(VK_P))
- val Q = Value(VK_Q, getKeyText(VK_Q))
- val R = Value(VK_R, getKeyText(VK_R))
- val S = Value(VK_S, getKeyText(VK_S))
- val T = Value(VK_T, getKeyText(VK_T))
- val U = Value(VK_U, getKeyText(VK_U))
- val V = Value(VK_V, getKeyText(VK_V))
- val W = Value(VK_W, getKeyText(VK_W))
- val X = Value(VK_X, getKeyText(VK_X))
- val Y = Value(VK_Y, getKeyText(VK_Y))
- val Z = Value(VK_Z, getKeyText(VK_Z))
- val OpenBracket = Value(VK_OPEN_BRACKET, getKeyText(VK_OPEN_BRACKET))
- val BackSlash = Value(VK_BACK_SLASH, getKeyText(VK_BACK_SLASH))
- val CloseBracket = Value(VK_CLOSE_BRACKET, getKeyText(VK_CLOSE_BRACKET))
- val Numpad0 = Value(VK_NUMPAD0, getKeyText(VK_NUMPAD0))
- val Numpad1 = Value(VK_NUMPAD1, getKeyText(VK_NUMPAD1))
- val Numpad2 = Value(VK_NUMPAD2, getKeyText(VK_NUMPAD2))
- val Numpad3 = Value(VK_NUMPAD3, getKeyText(VK_NUMPAD3))
- val Numpad4 = Value(VK_NUMPAD4, getKeyText(VK_NUMPAD4))
- val Numpad5 = Value(VK_NUMPAD5, getKeyText(VK_NUMPAD5))
- val Numpad6 = Value(VK_NUMPAD6, getKeyText(VK_NUMPAD6))
- val Numpad7 = Value(VK_NUMPAD7, getKeyText(VK_NUMPAD7))
- val Numpad8 = Value(VK_NUMPAD8, getKeyText(VK_NUMPAD8))
- val Numpad9 = Value(VK_NUMPAD9, getKeyText(VK_NUMPAD9))
- val Multiply = Value(VK_MULTIPLY, getKeyText(VK_MULTIPLY))
- val Add = Value(VK_ADD, getKeyText(VK_ADD))
- val Separator = Value(VK_SEPARATOR, getKeyText(VK_SEPARATOR))
- val Subtract = Value(VK_SUBTRACT, getKeyText(VK_SUBTRACT))
- val Decimal = Value(VK_DECIMAL, getKeyText(VK_DECIMAL))
- val Divide = Value(VK_DIVIDE, getKeyText(VK_DIVIDE))
- val Delete = Value(VK_DELETE, getKeyText(VK_DELETE))
- val NumLock = Value(VK_NUM_LOCK, getKeyText(VK_NUM_LOCK))
- val ScrollLock = Value(VK_SCROLL_LOCK, getKeyText(VK_SCROLL_LOCK))
- val F1 = Value(VK_F1, getKeyText(VK_F1))
- val F2 = Value(VK_F2, getKeyText(VK_F2))
- val F3 = Value(VK_F3, getKeyText(VK_F3))
- val F4 = Value(VK_F4, getKeyText(VK_F4))
- val F5 = Value(VK_F5, getKeyText(VK_F5))
- val F6 = Value(VK_F6, getKeyText(VK_F6))
- val F7 = Value(VK_F7, getKeyText(VK_F7))
- val F8 = Value(VK_F8, getKeyText(VK_F8))
- val F9 = Value(VK_F9, getKeyText(VK_F9))
- val F10 = Value(VK_F10, getKeyText(VK_F10))
- val F11 = Value(VK_F11, getKeyText(VK_F11))
- val F12 = Value(VK_F12, getKeyText(VK_F12))
- val F13 = Value(VK_F13, getKeyText(VK_F13))
- val F14 = Value(VK_F14, getKeyText(VK_F14))
- val F15 = Value(VK_F15, getKeyText(VK_F15))
- val F16 = Value(VK_F16, getKeyText(VK_F16))
- val F17 = Value(VK_F17, getKeyText(VK_F17))
- val F18 = Value(VK_F18, getKeyText(VK_F18))
- val F19 = Value(VK_F19, getKeyText(VK_F19))
- val F20 = Value(VK_F20, getKeyText(VK_F20))
- val F21 = Value(VK_F21, getKeyText(VK_F21))
- val F22 = Value(VK_F22, getKeyText(VK_F22))
- val F23 = Value(VK_F23, getKeyText(VK_F23))
- val F24 = Value(VK_F24, getKeyText(VK_F24))
- val Printscreen = Value(VK_PRINTSCREEN, getKeyText(VK_PRINTSCREEN))
- val Insert = Value(VK_INSERT, getKeyText(VK_INSERT))
- val Help = Value(VK_HELP, getKeyText(VK_HELP))
- val BackQuote = Value(VK_BACK_QUOTE, getKeyText(VK_BACK_QUOTE))
- val Quote = Value(VK_QUOTE, getKeyText(VK_QUOTE))
- val KpUp = Value(VK_KP_UP, getKeyText(VK_KP_UP))
- val KpDown = Value(VK_KP_DOWN, getKeyText(VK_KP_DOWN))
- val KpLeft = Value(VK_KP_LEFT, getKeyText(VK_KP_LEFT))
- val KpRight = Value(VK_KP_RIGHT, getKeyText(VK_KP_RIGHT))
- val DeadGrave = Value(VK_DEAD_GRAVE, getKeyText(VK_DEAD_GRAVE))
- val DeadAcute = Value(VK_DEAD_ACUTE, getKeyText(VK_DEAD_ACUTE))
- val DeadCircumflex = Value(VK_DEAD_CIRCUMFLEX, getKeyText(VK_DEAD_CIRCUMFLEX))
- val DeadTilde = Value(VK_DEAD_TILDE, getKeyText(VK_DEAD_TILDE))
- val DeadMacron = Value(VK_DEAD_MACRON, getKeyText(VK_DEAD_MACRON))
- val DeadBreve = Value(VK_DEAD_BREVE, getKeyText(VK_DEAD_BREVE))
- val DeadAbovedot = Value(VK_DEAD_ABOVEDOT, getKeyText(VK_DEAD_ABOVEDOT))
- val DeadDiaeresis = Value(VK_DEAD_DIAERESIS, getKeyText(VK_DEAD_DIAERESIS))
- val DeadAbovering = Value(VK_DEAD_ABOVERING, getKeyText(VK_DEAD_ABOVERING))
- val DeadDoubleacute = Value(VK_DEAD_DOUBLEACUTE, getKeyText(VK_DEAD_DOUBLEACUTE))
- val DeadCaron = Value(VK_DEAD_CARON, getKeyText(VK_DEAD_CARON))
- val DeadCedilla = Value(VK_DEAD_CEDILLA, getKeyText(VK_DEAD_CEDILLA))
- val DeadOgonek = Value(VK_DEAD_OGONEK, getKeyText(VK_DEAD_OGONEK))
- val DeadIota = Value(VK_DEAD_IOTA, getKeyText(VK_DEAD_IOTA))
- val DeadVoicedSound = Value(VK_DEAD_VOICED_SOUND, getKeyText(VK_DEAD_VOICED_SOUND))
- val DeadSemivoicedSound = Value(VK_DEAD_SEMIVOICED_SOUND, getKeyText(VK_DEAD_SEMIVOICED_SOUND))
- val Ampersand = Value(VK_AMPERSAND, getKeyText(VK_AMPERSAND))
- val Asterisk = Value(VK_ASTERISK, getKeyText(VK_ASTERISK))
- val Quotedbl = Value(VK_QUOTEDBL, getKeyText(VK_QUOTEDBL))
- val Less = Value(VK_LESS, getKeyText(VK_LESS))
- val Greater = Value(VK_GREATER, getKeyText(VK_GREATER))
- val Braceleft = Value(VK_BRACELEFT, getKeyText(VK_BRACELEFT))
- val Braceright = Value(VK_BRACERIGHT, getKeyText(VK_BRACERIGHT))
- val At = Value(VK_AT, getKeyText(VK_AT))
- val Colon = Value(VK_COLON, getKeyText(VK_COLON))
- val Circumflex = Value(VK_CIRCUMFLEX, getKeyText(VK_CIRCUMFLEX))
- val Dollar = Value(VK_DOLLAR, getKeyText(VK_DOLLAR))
- val EuroSign = Value(VK_EURO_SIGN, getKeyText(VK_EURO_SIGN))
- val ExclamationMark = Value(VK_EXCLAMATION_MARK, getKeyText(VK_EXCLAMATION_MARK))
- val InvertedExclamationMark = Value(VK_INVERTED_EXCLAMATION_MARK, getKeyText(VK_INVERTED_EXCLAMATION_MARK))
- val LeftParenthesis = Value(VK_LEFT_PARENTHESIS, getKeyText(VK_LEFT_PARENTHESIS))
- val NumberSign = Value(VK_NUMBER_SIGN, getKeyText(VK_NUMBER_SIGN))
- val Plus = Value(VK_PLUS, getKeyText(VK_PLUS))
- val RightParenthesis = Value(VK_RIGHT_PARENTHESIS, getKeyText(VK_RIGHT_PARENTHESIS))
- val Underscore = Value(VK_UNDERSCORE, getKeyText(VK_UNDERSCORE))
- val Windows = Value(VK_WINDOWS, getKeyText(VK_WINDOWS))
- val ContextMenu = Value(VK_CONTEXT_MENU, getKeyText(VK_CONTEXT_MENU))
- val Final = Value(VK_FINAL, getKeyText(VK_FINAL))
- val Convert = Value(VK_CONVERT, getKeyText(VK_CONVERT))
- val Nonconvert = Value(VK_NONCONVERT, getKeyText(VK_NONCONVERT))
- val Accept = Value(VK_ACCEPT, getKeyText(VK_ACCEPT))
- val Modechange = Value(VK_MODECHANGE, getKeyText(VK_MODECHANGE))
- val Kana = Value(VK_KANA, getKeyText(VK_KANA))
- val Kanji = Value(VK_KANJI, getKeyText(VK_KANJI))
- val Alphanumeric = Value(VK_ALPHANUMERIC, getKeyText(VK_ALPHANUMERIC))
- val Katakana = Value(VK_KATAKANA, getKeyText(VK_KATAKANA))
- val Hiragana = Value(VK_HIRAGANA, getKeyText(VK_HIRAGANA))
- val FullWidth = Value(VK_FULL_WIDTH, getKeyText(VK_FULL_WIDTH))
- val HalfWidth = Value(VK_HALF_WIDTH, getKeyText(VK_HALF_WIDTH))
- val RomanCharacters = Value(VK_ROMAN_CHARACTERS, getKeyText(VK_ROMAN_CHARACTERS))
- val AllCandidates = Value(VK_ALL_CANDIDATES, getKeyText(VK_ALL_CANDIDATES))
- val PreviousCandidate = Value(VK_PREVIOUS_CANDIDATE, getKeyText(VK_PREVIOUS_CANDIDATE))
- val CodeInput = Value(VK_CODE_INPUT, getKeyText(VK_CODE_INPUT))
- val JapaneseKatakana = Value(VK_JAPANESE_KATAKANA, getKeyText(VK_JAPANESE_KATAKANA))
- val JapaneseHiragana = Value(VK_JAPANESE_HIRAGANA, getKeyText(VK_JAPANESE_HIRAGANA))
- val JapaneseRoman = Value(VK_JAPANESE_ROMAN, getKeyText(VK_JAPANESE_ROMAN))
- val KanaLock = Value(VK_KANA_LOCK, getKeyText(VK_KANA_LOCK))
- val InputMethodOnOff = Value(VK_INPUT_METHOD_ON_OFF, getKeyText(VK_INPUT_METHOD_ON_OFF))
- val Cut = Value(VK_CUT, getKeyText(VK_CUT))
- val Copy = Value(VK_COPY, getKeyText(VK_COPY))
- val Paste = Value(VK_PASTE, getKeyText(VK_PASTE))
- val Undo = Value(VK_UNDO, getKeyText(VK_UNDO))
- val Again = Value(VK_AGAIN, getKeyText(VK_AGAIN))
- val Find = Value(VK_FIND, getKeyText(VK_FIND))
- val Props = Value(VK_PROPS, getKeyText(VK_PROPS))
- val Stop = Value(VK_STOP, getKeyText(VK_STOP))
- val Compose = Value(VK_COMPOSE, getKeyText(VK_COMPOSE))
- val Begin = Value(VK_BEGIN, getKeyText(VK_BEGIN))
- val Undefined = Value(VK_UNDEFINED, getKeyText(VK_UNDEFINED))
-}
diff --git a/src/swing/scala/swing/event/KeyEvent.scala b/src/swing/scala/swing/event/KeyEvent.scala
deleted file mode 100644
index 1345c77479..0000000000
--- a/src/swing/scala/swing/event/KeyEvent.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-import javax.swing.JComponent
-
-sealed abstract class KeyEvent extends InputEvent {
- def peer: java.awt.event.KeyEvent
-}
-
-case class KeyTyped(val source: Component, char: Char, val modifiers: Key.Modifiers,
- location: Key.Location.Value)
- (val peer: java.awt.event.KeyEvent) extends KeyEvent {
- def this(e: java.awt.event.KeyEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getKeyChar, e.getModifiersEx,
- Key.Location(e.getKeyLocation))(e)
-}
-
-case class KeyPressed(val source: Component, key: Key.Value, val modifiers: Key.Modifiers,
- location: Key.Location.Value)
- (val peer: java.awt.event.KeyEvent) extends KeyEvent {
- def this(e: java.awt.event.KeyEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- Key(e.getKeyCode), e.getModifiersEx, Key.Location(e.getKeyLocation))(e)
-}
-
-case class KeyReleased(val source: Component, key: Key.Value, val modifiers: Key.Modifiers,
- location: Key.Location.Value)
- (val peer: java.awt.event.KeyEvent) extends KeyEvent {
- def this(e: java.awt.event.KeyEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- Key(e.getKeyCode), e.getModifiersEx, Key.Location(e.getKeyLocation))(e)
-}
diff --git a/src/swing/scala/swing/event/ListEvent.scala b/src/swing/scala/swing/event/ListEvent.scala
deleted file mode 100644
index bdb769d45b..0000000000
--- a/src/swing/scala/swing/event/ListEvent.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-trait ListEvent[A] extends ComponentEvent {
- override val source: ListView[A]
-}
-
-//case class ElementSelected[A](override val source: ListView[A], range: Range, live: Boolean)
-// extends ListEvent[A] with AdjustingEvent with ListSelectionEvent
-
-abstract class ListChange[A](override val source: ListView[A]) extends ListEvent[A]
-
-object ListChanged {
- def unapply[A](e: ListChanged[A]) = Some(e.source)
- def apply[A](source: ListView[A]) = new ListChanged(source)
-}
-
-class ListChanged[A](override val source: ListView[A]) extends ListChange(source)
-
-object ListElementsAdded {
- def unapply[A](e: ListElementsAdded[A]) = Some((e.source, e.range))
- def apply[A](source: ListView[A], range: Range) = new ListElementsAdded(source, range)
-}
-
-class ListElementsAdded[A](override val source: ListView[A], val range: Range)
- extends ListChange(source)
-
-object ListElementsRemoved {
- def unapply[A](e: ListElementsRemoved[A]) = Some((e.source, e.range))
- def apply[A](source: ListView[A], range: Range) = new ListElementsRemoved(source, range)
-}
-class ListElementsRemoved[A](override val source: ListView[A], val range: Range)
- extends ListChange(source)
diff --git a/src/swing/scala/swing/event/MouseEvent.scala b/src/swing/scala/swing/event/MouseEvent.scala
deleted file mode 100644
index 8629d71db2..0000000000
--- a/src/swing/scala/swing/event/MouseEvent.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-import java.awt.Point
-import javax.swing.JComponent
-
-sealed abstract class MouseEvent extends InputEvent {
- def peer: java.awt.event.MouseEvent
- def point: Point
-}
-
-sealed abstract class MouseButtonEvent extends MouseEvent {
- def clicks: Int
- def triggersPopup: Boolean
-}
-case class MouseClicked(val source: Component, point: Point, val modifiers: Key.Modifiers,
- clicks: Int, triggersPopup: Boolean)(val peer: java.awt.event.MouseEvent)
- extends MouseButtonEvent {
- def this(e: java.awt.event.MouseEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getPoint, e.getModifiersEx, e.getClickCount, e.isPopupTrigger)(e)
-}
-case class MousePressed(val source: Component, point: Point, val modifiers: Key.Modifiers,
- clicks: Int, triggersPopup: Boolean)(val peer: java.awt.event.MouseEvent)
- extends MouseButtonEvent {
- def this(e: java.awt.event.MouseEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getPoint, e.getModifiersEx, e.getClickCount, e.isPopupTrigger)(e)
-}
-case class MouseReleased(val source: Component, point: Point, val modifiers: Key.Modifiers,
- clicks: Int, triggersPopup: Boolean)(val peer: java.awt.event.MouseEvent)
- extends MouseButtonEvent {
- def this(e: java.awt.event.MouseEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getPoint, e.getModifiersEx, e.getClickCount, e.isPopupTrigger)(e)
-}
-
-sealed abstract class MouseMotionEvent extends MouseEvent
-case class MouseMoved(val source: Component, point: Point, val modifiers: Key.Modifiers)(val peer: java.awt.event.MouseEvent)
- extends MouseMotionEvent {
- def this(e: java.awt.event.MouseEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getPoint, e.getModifiersEx)(e)
-}
-case class MouseDragged(val source: Component, point: Point, val modifiers: Key.Modifiers)(val peer: java.awt.event.MouseEvent)
- extends MouseMotionEvent {
- def this(e: java.awt.event.MouseEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getPoint, e.getModifiersEx)(e)
-}
-case class MouseEntered(val source: Component, point: Point, val modifiers: Key.Modifiers)(val peer: java.awt.event.MouseEvent)
- extends MouseMotionEvent {
- def this(e: java.awt.event.MouseEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getPoint, e.getModifiersEx)(e)
-}
-case class MouseExited(val source: Component, point: Point, val modifiers: Key.Modifiers)(val peer: java.awt.event.MouseEvent)
- extends MouseMotionEvent {
- def this(e: java.awt.event.MouseEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getPoint, e.getModifiersEx)(e)
-}
-
-case class MouseWheelMoved(val source: Component, point: Point, val modifiers: Key.Modifiers, rotation: Int)(val peer: java.awt.event.MouseEvent)
- extends MouseEvent {
- def this(e: java.awt.event.MouseWheelEvent) =
- this(UIElement.cachedWrapper[Component](e.getSource.asInstanceOf[JComponent]),
- e.getPoint, e.getModifiersEx, e.getWheelRotation)(e)
-}
diff --git a/src/swing/scala/swing/event/PopupMenuEvent.scala b/src/swing/scala/swing/event/PopupMenuEvent.scala
deleted file mode 100644
index ad39eb351a..0000000000
--- a/src/swing/scala/swing/event/PopupMenuEvent.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-abstract class PopupMenuEvent extends ComponentEvent
-
-case class PopupMenuCanceled(source: PopupMenu) extends PopupMenuEvent
-case class PopupMenuWillBecomeInvisible(source: PopupMenu) extends PopupMenuEvent
-case class PopupMenuWillBecomeVisible(source: PopupMenu) extends PopupMenuEvent \ No newline at end of file
diff --git a/src/swing/scala/swing/event/SelectionEvent.scala b/src/swing/scala/swing/event/SelectionEvent.scala
deleted file mode 100644
index 39d6a13bc2..0000000000
--- a/src/swing/scala/swing/event/SelectionEvent.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-/**
- * An event that indicates a change in a selection such as in a list view or a table.
- */
-trait SelectionEvent
-
-/**
- * An event that indicates a selection of a range of indices.
- */
-trait ListSelectionEvent extends SelectionEvent {
- def range: Range
-}
-
-case class SelectionChanged(override val source: Component) extends ComponentEvent with SelectionEvent
-
-object ListSelectionChanged {
- def unapply[A](e: ListSelectionChanged[A]): Option[(ListView[A], Range, Boolean)] =
- Some((e.source, e.range, e.live))
-}
-
-class ListSelectionChanged[A](override val source: ListView[A], val range: Range, val live: Boolean)
- extends SelectionChanged(source) with ListEvent[A]
diff --git a/src/swing/scala/swing/event/TableEvent.scala b/src/swing/scala/swing/event/TableEvent.scala
deleted file mode 100644
index c420ea275d..0000000000
--- a/src/swing/scala/swing/event/TableEvent.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-abstract class TableEvent(override val source: Table) extends ComponentEvent
-
-abstract class TableChange(override val source: Table) extends TableEvent(source)
-
-/**
- * The most general table change. The table might have changed completely,
- * i.e., columns might have been reordered, rows added or removed, etc.
- * No other event indicates that the structure might have changed.
- */
-case class TableStructureChanged(override val source: Table) extends TableChange(source)
-/**
- * The table structure, i.e., the column order, names, and types stay the same,
- * but anything else might have changed.
- */
-case class TableChanged(override val source: Table) extends TableChange(source)
-/**
- * The size of the table stays the same, but the given range of rows might
- * have changed but only in the given column. A value of -1 for the column
- * denotes all columns.
- */
-case class TableUpdated(override val source: Table, range: Range, column: Int)
- extends TableChange(source)
-/**
- * Any change that caused the table to change it's size
- */
-class TableResized(override val source: Table) extends TableChange(source)
-case class TableRowsAdded(override val source: Table, range: Range) extends TableResized(source)
-case class TableRowsRemoved(override val source: Table, range: Range) extends TableResized(source)
-
-case class TableColumnsSelected(override val source: Table, range: Range, adjusting: Boolean)
- extends TableEvent(source) with AdjustingEvent with ListSelectionEvent
-case class TableRowsSelected(override val source: Table, range: Range, adjusting: Boolean)
- extends TableEvent(source) with AdjustingEvent with ListSelectionEvent
diff --git a/src/swing/scala/swing/event/UIEvent.scala b/src/swing/scala/swing/event/UIEvent.scala
deleted file mode 100644
index a4644b02b2..0000000000
--- a/src/swing/scala/swing/event/UIEvent.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-trait UIEvent extends Event {
- val source: UIElement
-}
-
-case class UIElementMoved(source: UIElement) extends UIEvent
-case class UIElementResized(source: UIElement) extends UIEvent
-case class UIElementShown(source: UIElement) extends UIEvent
-case class UIElementHidden(source: UIElement) extends UIEvent
diff --git a/src/swing/scala/swing/event/ValueChanged.scala b/src/swing/scala/swing/event/ValueChanged.scala
deleted file mode 100644
index ef08085705..0000000000
--- a/src/swing/scala/swing/event/ValueChanged.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-object ValueChanged {
- def unapply(a: ValueChanged): Option[Component] = Some(a.source)
-}
-
-class ValueChanged(override val source: Component) extends ComponentEvent
diff --git a/src/swing/scala/swing/event/WindowActivated.scala b/src/swing/scala/swing/event/WindowActivated.scala
deleted file mode 100644
index 1473242e5c..0000000000
--- a/src/swing/scala/swing/event/WindowActivated.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class WindowActivated(override val source: Window) extends WindowEvent(source)
diff --git a/src/swing/scala/swing/event/WindowClosed.scala b/src/swing/scala/swing/event/WindowClosed.scala
deleted file mode 100644
index 80afe1a99f..0000000000
--- a/src/swing/scala/swing/event/WindowClosed.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-package scala.swing
-package event
-
-case class WindowClosed(override val source: Window) extends WindowEvent(source)
diff --git a/src/swing/scala/swing/event/WindowClosing.scala b/src/swing/scala/swing/event/WindowClosing.scala
deleted file mode 100644
index 3c64aeb0f5..0000000000
--- a/src/swing/scala/swing/event/WindowClosing.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class WindowClosing(override val source: Window) extends WindowEvent(source)
diff --git a/src/swing/scala/swing/event/WindowDeactivated.scala b/src/swing/scala/swing/event/WindowDeactivated.scala
deleted file mode 100644
index f0eec57913..0000000000
--- a/src/swing/scala/swing/event/WindowDeactivated.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class WindowDeactivated(override val source: Window) extends WindowEvent(source)
diff --git a/src/swing/scala/swing/event/WindowDeiconified.scala b/src/swing/scala/swing/event/WindowDeiconified.scala
deleted file mode 100644
index 6e07f8534b..0000000000
--- a/src/swing/scala/swing/event/WindowDeiconified.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class WindowDeiconified(override val source: Window) extends WindowEvent(source)
diff --git a/src/swing/scala/swing/event/WindowEvent.scala b/src/swing/scala/swing/event/WindowEvent.scala
deleted file mode 100644
index b8ca329a2a..0000000000
--- a/src/swing/scala/swing/event/WindowEvent.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-abstract class WindowEvent(override val source: Window) extends UIEvent
diff --git a/src/swing/scala/swing/event/WindowIconified.scala b/src/swing/scala/swing/event/WindowIconified.scala
deleted file mode 100644
index 3b5139f740..0000000000
--- a/src/swing/scala/swing/event/WindowIconified.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class WindowIconified(override val source: Window) extends WindowEvent(source)
diff --git a/src/swing/scala/swing/event/WindowOpened.scala b/src/swing/scala/swing/event/WindowOpened.scala
deleted file mode 100644
index f5854edc32..0000000000
--- a/src/swing/scala/swing/event/WindowOpened.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class WindowOpened(override val source: Window) extends WindowEvent(source)
diff --git a/src/swing/scala/swing/model/Matrix.scala b/src/swing/scala/swing/model/Matrix.scala
deleted file mode 100644
index 664d44a962..0000000000
--- a/src/swing/scala/swing/model/Matrix.scala
+++ /dev/null
@@ -1,121 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-package scala.swing
-package model
-
-// Dummy to keep ant from recompiling on every run.
-trait Matrix { }
-
-/*trait Matrix[A] extends Function2[Int, Int, A] {
-
- val width: Int
- val height: Int
-
- assert(width > 0 && height > 0)
-
- private val delegate = new Array[A](width * height)
-
- override def apply(col: Int, row: Int): A =
- delegate(col * height + row)
-
- def apply(coord: (Int, Int)): A =
- apply(coord._1, coord._2)
-
- def col(index: Int): Matrix.FlatSeq[A] =
- new Matrix.SubArray[A](delegate, index * height, height)
-
- def row(index: Int): Matrix.FlatSeq[A] =
- new Matrix.SparseArray[A](delegate, index, height)
-
- def update(xpos: Int, ypos: Int, elem: A) {
- delegate(xpos % width * height + ypos % height) = elem
- }
-
- def update(coord: (Int, Int), elem: A) {
- update(coord._1, coord._2, elem)
- }
-
- def initializeWith(f: (Int, Int) => A): this.type = {
- for (index <- 0 until (width * height))
- delegate(index) = f(index / height, index % height)
- this
- }
-
- def initializeTo(v: => A): this.type = {
- for (index <- 0 until (width * height))
- delegate(index) = v
- this
- }
-
- def size: (Int, Int) = (width, height)
-
- /** A flattened view of the matrix. The flattening is done on columns i.e.
- * the first values of the flattened sequence are the cells of the first
- * column. As this is a view of the matrix, any change to the matrix will
- * also be visible in the flattened array, and vice-versa. */
- def flat: Array[A] = delegate
-
-}
-
-object Matrix {
-
- def apply[A](columns: Int, rows: Int) = new Matrix[A] {
- val width = columns
- val height = rows
- }
-
- def apply[A](default: (Int, Int) => A, columns: Int, rows: Int) = new Matrix[A] {
- val width = columns
- val height = rows
- initializeWith(default)
- }
-
- def apply[A](default: => A, columns: Int, rows: Int) = new Matrix[A] {
- val width = columns
- val height = rows
- initializeTo(default)
- }
-
- trait FlatSeq[A] extends RandomAccessSeq[A] {
- def update (index: Int, elem: A): Unit
- }
-
- private class SubArray[A](delegate: Array[A], start: Int, val length: Int) extends FlatSeq[A] {
- def apply(index: Int): A =
- if (index < length)
- delegate(index + start)
- else throw new IndexOutOfBoundsException
- def update(index: Int, elem: A): Unit =
- if (index < length)
- delegate(index + start) = elem
- else throw new IndexOutOfBoundsException
- }
-
- private class SparseArray[A](delegate: Array[A], start: Int, span: Int) extends FlatSeq[A] {
- def apply(index: Int): A = {
- if (index < length)
- delegate((index * span) + start)
- else throw new IndexOutOfBoundsException
- }
- def length: Int = delegate.length / span
- def update(index: Int, elem: A): Unit =
- if (index < length)
- delegate((index * span) + start) = elem
- else throw new IndexOutOfBoundsException
- }
-
- implicit def MatrixToSeqs[A](matrix: Matrix[A]): Seq[Seq[A]] = {
- val result = new Array[SubArray[A]](matrix.width)
- for (col <- 0 until matrix.width)
- result(col) = new SubArray[A](matrix.delegate, col * matrix.height, matrix.height)
- result
- }
-
-}*/
diff --git a/src/swing/scala/swing/package.scala b/src/swing/scala/swing/package.scala
deleted file mode 100644
index d5095f021b..0000000000
--- a/src/swing/scala/swing/package.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-package scala
-
-/**
- * Useful imports that don't have wrappers.
- */
-package object swing {
- type Point = java.awt.Point
- type Dimension = java.awt.Dimension
- type Rectangle = java.awt.Rectangle
- type Insets = java.awt.Insets
-
- type Graphics2D = java.awt.Graphics2D
- type Color = java.awt.Color
- type Image = java.awt.Image
- type Font = java.awt.Font
-
- private[swing] def ifNull[A](o: Object, a: A): A = if(o eq null) a else o.asInstanceOf[A]
- private[swing] def toOption[A](o: Object): Option[A] = if(o eq null) None else Some(o.asInstanceOf[A])
- private[swing] def toAnyRef(x: Any): AnyRef = x.asInstanceOf[AnyRef]
-}
diff --git a/src/swing/swing.version.properties b/src/swing/swing.version.properties
deleted file mode 100644
index ba3675fa05..0000000000
--- a/src/swing/swing.version.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-version.major=0
-version.minor=4
diff --git a/test/disabled/continuations-neg/infer0.check b/test/disabled/continuations-neg/infer0.check
deleted file mode 100644
index 1dd072ef09..0000000000
--- a/test/disabled/continuations-neg/infer0.check
+++ /dev/null
@@ -1,4 +0,0 @@
-infer0.scala:11: error: cannot cps-transform expression 8: type arguments [Int(8),String,Int] do not conform to method shiftUnit's type parameter bounds [A,B,C >: B]
- test(8)
- ^
-one error found
diff --git a/test/disabled/continuations-neg/infer0.scala b/test/disabled/continuations-neg/infer0.scala
deleted file mode 100644
index 6d97d7504d..0000000000
--- a/test/disabled/continuations-neg/infer0.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
- def test(x: => Int @cpsParam[String,Int]) = 7
-
- def main(args: Array[String]) {
- test(8)
- }
-}
diff --git a/test/files/continuations-neg/function0.check b/test/files/continuations-neg/function0.check
deleted file mode 100644
index 0a66763a0f..0000000000
--- a/test/files/continuations-neg/function0.check
+++ /dev/null
@@ -1,6 +0,0 @@
-function0.scala:11: error: type mismatch;
- found : () => Int @scala.util.continuations.cpsParam[Int,Int]
- required: () => Int
- val g: () => Int = f
- ^
-one error found
diff --git a/test/files/continuations-neg/function0.scala b/test/files/continuations-neg/function0.scala
deleted file mode 100644
index 4112ee3835..0000000000
--- a/test/files/continuations-neg/function0.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def main(args: Array[String]): Any = {
-
- val f = () => shift { k: (Int=>Int) => k(7) }
- val g: () => Int = f
-
- println(reset(g()))
- }
-
-} \ No newline at end of file
diff --git a/test/files/continuations-neg/function2.check b/test/files/continuations-neg/function2.check
deleted file mode 100644
index 4b1a6227bc..0000000000
--- a/test/files/continuations-neg/function2.check
+++ /dev/null
@@ -1,6 +0,0 @@
-function2.scala:11: error: type mismatch;
- found : () => Int
- required: () => Int @scala.util.continuations.cpsParam[Int,Int]
- val g: () => Int @cps[Int] = f
- ^
-one error found
diff --git a/test/files/continuations-neg/function2.scala b/test/files/continuations-neg/function2.scala
deleted file mode 100644
index ae0fda509d..0000000000
--- a/test/files/continuations-neg/function2.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def main(args: Array[String]): Any = {
-
- val f = () => 7
- val g: () => Int @cps[Int] = f
-
- println(reset(g()))
- }
-
-} \ No newline at end of file
diff --git a/test/files/continuations-neg/function3.check b/test/files/continuations-neg/function3.check
deleted file mode 100644
index 4705ad9ed9..0000000000
--- a/test/files/continuations-neg/function3.check
+++ /dev/null
@@ -1,6 +0,0 @@
-function3.scala:10: error: type mismatch;
- found : Int @scala.util.continuations.cpsParam[Int,Int]
- required: Int
- val g: () => Int = () => shift { k: (Int=>Int) => k(7) }
- ^
-one error found
diff --git a/test/files/continuations-neg/function3.scala b/test/files/continuations-neg/function3.scala
deleted file mode 100644
index 0c3f1667e5..0000000000
--- a/test/files/continuations-neg/function3.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def main(args: Array[String]): Any = {
-
- val g: () => Int = () => shift { k: (Int=>Int) => k(7) }
-
- println(reset(g()))
- }
-
-} \ No newline at end of file
diff --git a/test/files/continuations-neg/infer2.check b/test/files/continuations-neg/infer2.check
deleted file mode 100644
index d92bc9c572..0000000000
--- a/test/files/continuations-neg/infer2.check
+++ /dev/null
@@ -1,4 +0,0 @@
-infer2.scala:14: error: illegal answer type modification: scala.util.continuations.cpsParam[String,Int] andThen scala.util.continuations.cpsParam[String,Int]
- test { sym(); sym() }
- ^
-one error found
diff --git a/test/files/continuations-neg/infer2.scala b/test/files/continuations-neg/infer2.scala
deleted file mode 100644
index a890ac1fc4..0000000000
--- a/test/files/continuations-neg/infer2.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def test(x: => Int @cpsParam[String,Int]) = 7
-
- def sym() = shift { k: (Int => String) => 9 }
-
-
- def main(args: Array[String]): Any = {
- test { sym(); sym() }
- }
-
-}
-
-
diff --git a/test/files/continuations-neg/lazy.check b/test/files/continuations-neg/lazy.check
deleted file mode 100644
index 3c460546be..0000000000
--- a/test/files/continuations-neg/lazy.check
+++ /dev/null
@@ -1,4 +0,0 @@
-lazy.scala:6: error: implementation restriction: cps annotations not allowed on lazy value definitions
- lazy val x = shift((k:Unit=>Unit)=>k())
- ^
-one error found
diff --git a/test/files/continuations-neg/lazy.scala b/test/files/continuations-neg/lazy.scala
deleted file mode 100644
index 3c8169dd46..0000000000
--- a/test/files/continuations-neg/lazy.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-import scala.util.continuations._
-
-object Test {
-
- def foo() = {
- lazy val x = shift((k:Unit=>Unit)=>k())
- println(x)
- }
-
- def main(args: Array[String]) {
- reset {
- foo()
- }
- }
-
-} \ No newline at end of file
diff --git a/test/files/continuations-neg/t1929.check b/test/files/continuations-neg/t1929.check
deleted file mode 100644
index b04a5b977d..0000000000
--- a/test/files/continuations-neg/t1929.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t1929.scala:8: error: type mismatch;
- found : Int @scala.util.continuations.cpsParam[String,String] @scala.util.continuations.cpsSynth
- required: Int @scala.util.continuations.cpsParam[Int,String]
- reset {
- ^
-one error found
diff --git a/test/files/continuations-neg/t1929.scala b/test/files/continuations-neg/t1929.scala
deleted file mode 100644
index 02eda9170d..0000000000
--- a/test/files/continuations-neg/t1929.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
- def main(args : Array[String]) {
- reset {
- println("up")
- val x = shift((k:Int=>String) => k(8) + k(2))
- println("down " + x)
- val y = shift((k:Int=>String) => k(3))
- println("down2 " + y)
- y + x
- }
- }
-} \ No newline at end of file
diff --git a/test/files/continuations-neg/t2285.check b/test/files/continuations-neg/t2285.check
deleted file mode 100644
index d5dff6a4f2..0000000000
--- a/test/files/continuations-neg/t2285.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t2285.scala:9: error: type mismatch;
- found : Int @scala.util.continuations.cpsParam[String,String] @scala.util.continuations.cpsSynth
- required: Int @scala.util.continuations.cpsParam[Int,String]
- def foo() = reset { bar(); 7 }
- ^
-one error found
diff --git a/test/files/continuations-neg/t2285.scala b/test/files/continuations-neg/t2285.scala
deleted file mode 100644
index f3c7f4c89c..0000000000
--- a/test/files/continuations-neg/t2285.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-object Test {
-
- def bar() = shift { k: (String => String) => k("1") }
-
- def foo() = reset { bar(); 7 }
-
-}
diff --git a/test/files/continuations-neg/t2949.check b/test/files/continuations-neg/t2949.check
deleted file mode 100644
index dd9768807c..0000000000
--- a/test/files/continuations-neg/t2949.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t2949.scala:13: error: type mismatch;
- found : Int
- required: ? @scala.util.continuations.cpsParam[List[?],Any]
- x * y
- ^
-one error found
diff --git a/test/files/continuations-neg/t2949.scala b/test/files/continuations-neg/t2949.scala
deleted file mode 100644
index ce27c7c0e8..0000000000
--- a/test/files/continuations-neg/t2949.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-object Test {
-
- def reflect[A,B](xs : List[A]) = shift{ xs.flatMap[B, List[B]] }
- def reify[A, B](x : A @cpsParam[List[A], B]) = reset{ List(x) }
-
- def main(args: Array[String]): Unit = println(reify {
- val x = reflect[Int, Int](List(1,2,3))
- val y = reflect[Int, Int](List(2,4,8))
- x * y
- })
-}
diff --git a/test/files/continuations-neg/t3628.check b/test/files/continuations-neg/t3628.check
deleted file mode 100644
index 6e390558ef..0000000000
--- a/test/files/continuations-neg/t3628.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t3628.scala:4: error: not found: type Actor
- val impl: Actor = actor {
- ^
-one error found
diff --git a/test/files/continuations-neg/t3628.scala b/test/files/continuations-neg/t3628.scala
deleted file mode 100644
index c56e7752c4..0000000000
--- a/test/files/continuations-neg/t3628.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-import scala.actors.Actor._
-
-object Test {
- val impl: Actor = actor {
- loop {
- react {
- case 1 => impl ! 2
- }
- }
- }
-}
diff --git a/test/files/continuations-neg/t3718.check b/test/files/continuations-neg/t3718.check
deleted file mode 100644
index 659104c1c6..0000000000
--- a/test/files/continuations-neg/t3718.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t3718.scala:2: error: cannot cps-transform malformed (possibly in shift/reset placement) expression
- scala.util.continuations.reset((_: Any).##)
- ^
-one error found
diff --git a/test/files/continuations-neg/t3718.scala b/test/files/continuations-neg/t3718.scala
deleted file mode 100644
index a0fcb9d869..0000000000
--- a/test/files/continuations-neg/t3718.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test {
- scala.util.continuations.reset((_: Any).##)
-}
diff --git a/test/files/continuations-neg/t5314-missing-result-type.check b/test/files/continuations-neg/t5314-missing-result-type.check
deleted file mode 100644
index 341e580cf3..0000000000
--- a/test/files/continuations-neg/t5314-missing-result-type.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t5314-missing-result-type.scala:6: error: method bar has return statement; needs result type
- def bar(x:Int) = return foo(x)
- ^
-one error found
diff --git a/test/files/continuations-neg/t5314-missing-result-type.scala b/test/files/continuations-neg/t5314-missing-result-type.scala
deleted file mode 100644
index d7c5043a86..0000000000
--- a/test/files/continuations-neg/t5314-missing-result-type.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-import scala.util.continuations._
-
-object Test extends App {
- def foo(x:Int): Int @cps[Int] = x
-
- def bar(x:Int) = return foo(x)
-
- reset {
- val res = bar(8)
- println(res)
- res
- }
-}
diff --git a/test/files/continuations-neg/t5314-npe.check b/test/files/continuations-neg/t5314-npe.check
deleted file mode 100644
index b5f024aa89..0000000000
--- a/test/files/continuations-neg/t5314-npe.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t5314-npe.scala:2: error: method bar has return statement; needs result type
- def bar(x:Int) = { return x; x } // NPE
- ^
-one error found
diff --git a/test/files/continuations-neg/t5314-npe.scala b/test/files/continuations-neg/t5314-npe.scala
deleted file mode 100644
index 2b5966e07c..0000000000
--- a/test/files/continuations-neg/t5314-npe.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test extends App {
- def bar(x:Int) = { return x; x } // NPE
-}
diff --git a/test/files/continuations-neg/t5314-return-reset.check b/test/files/continuations-neg/t5314-return-reset.check
deleted file mode 100644
index 4c817ae14d..0000000000
--- a/test/files/continuations-neg/t5314-return-reset.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t5314-return-reset.scala:14: error: return expression not allowed, since method calls CPS method
- if (rnd.nextInt(100) > 50) return 5 // not allowed, since method is calling `reset`
- ^
-one error found
diff --git a/test/files/continuations-neg/t5314-return-reset.scala b/test/files/continuations-neg/t5314-return-reset.scala
deleted file mode 100644
index df9d58e4cb..0000000000
--- a/test/files/continuations-neg/t5314-return-reset.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-import scala.util.continuations._
-import scala.util.Random
-
-object Test extends App {
- val rnd = new Random
-
- def foo(x: Int): Int @cps[Int] = shift { k => k(x) }
-
- def bar(x: Int): Int @cps[Int] = return foo(x)
-
- def caller(): Int = {
- val v: Int = reset {
- val res: Int = bar(8)
- if (rnd.nextInt(100) > 50) return 5 // not allowed, since method is calling `reset`
- 42
- }
- v
- }
-
- caller()
-}
diff --git a/test/files/continuations-neg/t5314-type-error.check b/test/files/continuations-neg/t5314-type-error.check
deleted file mode 100644
index e66c9d833f..0000000000
--- a/test/files/continuations-neg/t5314-type-error.check
+++ /dev/null
@@ -1,6 +0,0 @@
-t5314-type-error.scala:7: error: type mismatch;
- found : Int @scala.util.continuations.cpsParam[Int,Int]
- required: Int @scala.util.continuations.cpsParam[String,String]
- def bar(x:Int): Int @cps[String] = return foo(x)
- ^
-one error found
diff --git a/test/files/continuations-neg/t5314-type-error.scala b/test/files/continuations-neg/t5314-type-error.scala
deleted file mode 100644
index e36ce6c203..0000000000
--- a/test/files/continuations-neg/t5314-type-error.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import scala.util.continuations._
-
-object Test extends App {
- def foo(x:Int): Int @cps[Int] = shift { k => k(x) }
-
- // should be a type error
- def bar(x:Int): Int @cps[String] = return foo(x)
-
- def caller(): Unit = {
- val v: String = reset {
- val res: Int = bar(8)
- "hello"
- }
- }
-
- caller()
-}
diff --git a/test/files/continuations-neg/t5445.check b/test/files/continuations-neg/t5445.check
deleted file mode 100644
index eb2943b6a6..0000000000
--- a/test/files/continuations-neg/t5445.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t5445.scala:4: error: cps annotations not allowed on by-value parameters or value definitions
- def foo(block: Unit @suspendable ): Unit @suspendable = {}
- ^
-one error found
diff --git a/test/files/continuations-neg/t5445.scala b/test/files/continuations-neg/t5445.scala
deleted file mode 100644
index cb6f8f686d..0000000000
--- a/test/files/continuations-neg/t5445.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-import scala.util.continuations._
-
-object Test {
- def foo(block: Unit @suspendable ): Unit @suspendable = {}
-}
diff --git a/test/files/continuations-neg/trycatch2.check b/test/files/continuations-neg/trycatch2.check
deleted file mode 100644
index 5ff2838bad..0000000000
--- a/test/files/continuations-neg/trycatch2.check
+++ /dev/null
@@ -1,7 +0,0 @@
-trycatch2.scala:11: error: only simple cps types allowed in try/catch blocks (found: Int @scala.util.continuations.cpsParam[String,Int])
- def foo1 = try {
- ^
-trycatch2.scala:19: error: only simple cps types allowed in try/catch blocks (found: Int @scala.util.continuations.cpsParam[String,Int])
- def foo2 = try {
- ^
-two errors found
diff --git a/test/files/continuations-neg/trycatch2.scala b/test/files/continuations-neg/trycatch2.scala
deleted file mode 100644
index ee0a180ed6..0000000000
--- a/test/files/continuations-neg/trycatch2.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-object Test {
-
- def fatal[T]: T = throw new Exception
- def cpsIntStringInt = shift { k:(Int=>String) => k(3); 7 }
- def cpsIntIntString = shift { k:(Int=>Int) => k(3); "7" }
-
- def foo1 = try {
- fatal[Int]
- cpsIntStringInt
- } catch {
- case ex: Throwable =>
- cpsIntStringInt
- }
-
- def foo2 = try {
- fatal[Int]
- cpsIntStringInt
- } catch {
- case ex: Throwable =>
- cpsIntStringInt
- }
-
-
- def main(args: Array[String]): Unit = {
- println(reset { foo1; "3" })
- println(reset { foo2; "3" })
- }
-
-}
diff --git a/test/files/continuations-run/basics.check b/test/files/continuations-run/basics.check
deleted file mode 100755
index 54c059fdcb..0000000000
--- a/test/files/continuations-run/basics.check
+++ /dev/null
@@ -1,2 +0,0 @@
-28
-28 \ No newline at end of file
diff --git a/test/files/continuations-run/basics.scala b/test/files/continuations-run/basics.scala
deleted file mode 100755
index 07b3de5194..0000000000
--- a/test/files/continuations-run/basics.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def m0() = {
- shift((k:Int => Int) => k(k(7))) * 2
- }
-
- def m1() = {
- 2 * shift((k:Int => Int) => k(k(7)))
- }
-
- def main(args: Array[String]) {
-
- println(reset(m0()))
- println(reset(m1()))
-
- }
-
-}
diff --git a/test/files/continuations-run/function1.check b/test/files/continuations-run/function1.check
deleted file mode 100644
index 7f8f011eb7..0000000000
--- a/test/files/continuations-run/function1.check
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/test/files/continuations-run/function1.scala b/test/files/continuations-run/function1.scala
deleted file mode 100644
index 82dfe46c08..0000000000
--- a/test/files/continuations-run/function1.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def main(args: Array[String]): Unit = {
-
- val f = () => shift { k: (Int=>Int) => k(7) }
- val g: () => Int @cps[Int] = f
-
- println(reset(g()))
- }
-
-}
diff --git a/test/files/continuations-run/function4.check b/test/files/continuations-run/function4.check
deleted file mode 100644
index c7930257df..0000000000
--- a/test/files/continuations-run/function4.check
+++ /dev/null
@@ -1 +0,0 @@
-7 \ No newline at end of file
diff --git a/test/files/continuations-run/function4.scala b/test/files/continuations-run/function4.scala
deleted file mode 100644
index ccb432fe93..0000000000
--- a/test/files/continuations-run/function4.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def main(args: Array[String]): Unit = {
-
- val g: () => Int @cps[Int] = () => shift { k: (Int=>Int) => k(7) }
-
- println(reset(g()))
- }
-
-}
diff --git a/test/files/continuations-run/function5.check b/test/files/continuations-run/function5.check
deleted file mode 100644
index c7930257df..0000000000
--- a/test/files/continuations-run/function5.check
+++ /dev/null
@@ -1 +0,0 @@
-7 \ No newline at end of file
diff --git a/test/files/continuations-run/function5.scala b/test/files/continuations-run/function5.scala
deleted file mode 100644
index a83eb80d08..0000000000
--- a/test/files/continuations-run/function5.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def main(args: Array[String]): Unit = {
-
- val g: () => Int @cps[Int] = () => 7
-
- println(reset(g()))
- }
-
-}
diff --git a/test/files/continuations-run/function6.check b/test/files/continuations-run/function6.check
deleted file mode 100644
index c7930257df..0000000000
--- a/test/files/continuations-run/function6.check
+++ /dev/null
@@ -1 +0,0 @@
-7 \ No newline at end of file
diff --git a/test/files/continuations-run/function6.scala b/test/files/continuations-run/function6.scala
deleted file mode 100644
index 13ef88bd9f..0000000000
--- a/test/files/continuations-run/function6.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def main(args: Array[String]): Unit = {
-
- val g: PartialFunction[Int, Int @cps[Int]] = { case x => 7 }
-
- println(reset(g(2)))
-
- }
-
-}
diff --git a/test/files/continuations-run/ifelse0.check b/test/files/continuations-run/ifelse0.check
deleted file mode 100644
index f8bc79860d..0000000000
--- a/test/files/continuations-run/ifelse0.check
+++ /dev/null
@@ -1,2 +0,0 @@
-10
-9 \ No newline at end of file
diff --git a/test/files/continuations-run/ifelse0.scala b/test/files/continuations-run/ifelse0.scala
deleted file mode 100644
index cbff72c77c..0000000000
--- a/test/files/continuations-run/ifelse0.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def test(x:Int) = if (x <= 7)
- shift { k: (Int=>Int) => k(k(k(x))) }
- else
- shift { k: (Int=>Int) => k(x) }
-
- def main(args: Array[String]): Unit = {
- println(reset(1 + test(7)))
- println(reset(1 + test(8)))
- }
-
-}
diff --git a/test/files/continuations-run/ifelse1.check b/test/files/continuations-run/ifelse1.check
deleted file mode 100644
index 86a3fbc0c1..0000000000
--- a/test/files/continuations-run/ifelse1.check
+++ /dev/null
@@ -1,4 +0,0 @@
-10
-9
-8
-11 \ No newline at end of file
diff --git a/test/files/continuations-run/ifelse1.scala b/test/files/continuations-run/ifelse1.scala
deleted file mode 100644
index f8e3cf2ca3..0000000000
--- a/test/files/continuations-run/ifelse1.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def test1(x:Int) = if (x <= 7)
- shift { k: (Int=>Int) => k(k(k(x))) }
- else
- x
-
- def test2(x:Int) = if (x <= 7)
- x
- else
- shift { k: (Int=>Int) => k(k(k(x))) }
-
- def main(args: Array[String]): Unit = {
- println(reset(1 + test1(7)))
- println(reset(1 + test1(8)))
- println(reset(1 + test2(7)))
- println(reset(1 + test2(8)))
- }
-
-}
diff --git a/test/files/continuations-run/ifelse2.check b/test/files/continuations-run/ifelse2.check
deleted file mode 100644
index f97a95b08d..0000000000
--- a/test/files/continuations-run/ifelse2.check
+++ /dev/null
@@ -1,4 +0,0 @@
-abort
-()
-alive
-()
diff --git a/test/files/continuations-run/ifelse2.scala b/test/files/continuations-run/ifelse2.scala
deleted file mode 100644
index f5ec864a06..0000000000
--- a/test/files/continuations-run/ifelse2.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def test(x:Int) = if (x <= 7)
- shift { k: (Unit=>Unit) => println("abort") }
-
- def main(args: Array[String]): Unit = {
- println(reset{ test(7); println("alive") })
- println(reset{ test(8); println("alive") })
- }
-
-}
diff --git a/test/files/continuations-run/ifelse3.check b/test/files/continuations-run/ifelse3.check
deleted file mode 100644
index 95b562c8e6..0000000000
--- a/test/files/continuations-run/ifelse3.check
+++ /dev/null
@@ -1,2 +0,0 @@
-6
-9
diff --git a/test/files/continuations-run/ifelse3.scala b/test/files/continuations-run/ifelse3.scala
deleted file mode 100644
index 2c5b5765db..0000000000
--- a/test/files/continuations-run/ifelse3.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def util(x: Boolean) = shift { k: (Boolean=>Int) => k(x) }
-
- def test(x:Int) = if (util(x <= 7))
- x - 1
- else
- x + 1
-
-
- def main(args: Array[String]): Unit = {
- println(reset(test(7)))
- println(reset(test(8)))
- }
-
-}
diff --git a/test/files/continuations-run/ifelse4.check b/test/files/continuations-run/ifelse4.check
deleted file mode 100644
index 2545dd49a0..0000000000
--- a/test/files/continuations-run/ifelse4.check
+++ /dev/null
@@ -1,4 +0,0 @@
-10
-10
-10
-10
diff --git a/test/files/continuations-run/ifelse4.scala b/test/files/continuations-run/ifelse4.scala
deleted file mode 100644
index 46ec15365e..0000000000
--- a/test/files/continuations-run/ifelse4.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-import scala.util.continuations._
-
-object Test {
- def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1))))
-
- def testA(x1: Int): Int @cps[Int] = {
- sh(x1)
- if (x1==42) x1 else sh(x1)
- }
-
- def testB(x1: Int): Int @cps[Int] = {
- if (sh(x1)==43) x1 else x1
- }
-
- def testC(x1: Int): Int @cps[Int] = {
- sh(x1)
- if (sh(x1)==44) x1 else x1
- }
-
- def testD(x1: Int): Int @cps[Int] = {
- sh(x1)
- if (sh(x1)==45) x1 else sh(x1)
- }
-
- def main(args: Array[String]): Unit = {
- println(reset(1 + testA(7)))
- println(reset(1 + testB(9)))
- println(reset(1 + testC(9)))
- println(reset(1 + testD(7)))
- }
-}
diff --git a/test/files/continuations-run/implicit-infer-annotations.check b/test/files/continuations-run/implicit-infer-annotations.check
deleted file mode 100644
index e8206c4319..0000000000
--- a/test/files/continuations-run/implicit-infer-annotations.check
+++ /dev/null
@@ -1,5 +0,0 @@
-Range(5, 6, 7, 8, 9, 10)
-Range(5, 6, 7, 8, 9, 10)
-15
-List(10, 1, 2, 3)
-Range(5, 6, 7, 8, 9, 10)
diff --git a/test/files/continuations-run/implicit-infer-annotations.scala b/test/files/continuations-run/implicit-infer-annotations.scala
deleted file mode 100644
index 3f0e959f60..0000000000
--- a/test/files/continuations-run/implicit-infer-annotations.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-import annotation._
-
-object A {
- class foo[-B,+C] extends StaticAnnotation with TypeConstraint
-
- def shift[A, B, C](fun: (A => B) => C): A @foo[B, C] = ???
- def reset[A, C](ctx: => (A @foo[A, C])): C = ???
-
- def m1 = reset { shift { f: (Int => Range) => f(5) }.to(10) }
-}
-
-object B {
- import scala.util.continuations._
-
- def m1 = reset { shift { f: (Int => Range) => f(5) }.to(10) }
- def m2 = reset { val a = shift { f: (Int => Range) => f(5) } ; a.to(10) }
-
- val x1 = reset{
- shift{ cont: (Int => Range) =>
- cont(5)
- }.to(10)
- }
-
- val x2 = reset{
- val a = shift{ cont: (Int => Range) =>
- cont(5)
- }
- a.to(10)
- } // x is now Range(5, 6, 7, 8, 9, 10)
-
- val x3 = reset{
- shift{ cont: (Int => Int) =>
- cont(5)
- } + 10
- } // x is now 15
-
- val x4 = reset{
- 10 :: shift{ cont: (List[Int] => List[Int]) =>
- cont(List(1, 2, 3))
- }
- } // x is List(10, 1, 2, 3)
-
- val x5 = reset{
- new scala.runtime.RichInt(shift{ cont: (Int => Range) =>
- cont(5)
- }) to 10
- }
-}
-
-object Test {
- def main(args: Array[String]): Unit = {
- import B._
- println(x1)
- println(x2)
- println(x3)
- println(x4)
- println(x5)
- }
-}
diff --git a/test/files/continuations-run/infer1.scala b/test/files/continuations-run/infer1.scala
deleted file mode 100644
index 76f746da57..0000000000
--- a/test/files/continuations-run/infer1.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def test(x: => Int @cpsParam[String,Int]) = 7
-
- def test2() = {
- val x = shift { k: (Int => String) => 9 }
- x
- }
-
- def test3(x: => Int @cpsParam[Int,Int]) = 7
-
-
- def util() = shift { k: (String => String) => "7" }
-
- def main(args: Array[String]): Unit = {
- test { shift { k: (Int => String) => 9 } }
- test { shift { k: (Int => String) => 9 }; 2 }
-// test { shift { k: (Int => String) => 9 }; util() } <-- doesn't work
- test { shift { k: (Int => String) => 9 }; util(); 2 }
-
-
- test { shift { k: (Int => String) => 9 }; { test3(0); 2 } }
-
- test3 { { test3(0); 2 } }
-
- }
-
-}
diff --git a/test/files/continuations-run/match0.check b/test/files/continuations-run/match0.check
deleted file mode 100644
index f8bc79860d..0000000000
--- a/test/files/continuations-run/match0.check
+++ /dev/null
@@ -1,2 +0,0 @@
-10
-9 \ No newline at end of file
diff --git a/test/files/continuations-run/match0.scala b/test/files/continuations-run/match0.scala
deleted file mode 100644
index 8769ed9fcb..0000000000
--- a/test/files/continuations-run/match0.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def test(x:Int) = x match {
- case 7 => shift { k: (Int=>Int) => k(k(k(x))) }
- case 8 => shift { k: (Int=>Int) => k(x) }
- }
-
- def main(args: Array[String]): Unit = {
- println(reset(1 + test(7)))
- println(reset(1 + test(8)))
- }
-
-}
diff --git a/test/files/continuations-run/match1.check b/test/files/continuations-run/match1.check
deleted file mode 100644
index 73053d3f4f..0000000000
--- a/test/files/continuations-run/match1.check
+++ /dev/null
@@ -1,2 +0,0 @@
-10
-9
diff --git a/test/files/continuations-run/match1.scala b/test/files/continuations-run/match1.scala
deleted file mode 100644
index b89fb706b0..0000000000
--- a/test/files/continuations-run/match1.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def test(x:Int) = x match {
- case 7 => shift { k: (Int=>Int) => k(k(k(x))) }
- case _ => x
- }
-
- def main(args: Array[String]): Unit = {
- println(reset(1 + test(7)))
- println(reset(1 + test(8)))
- }
-
-}
diff --git a/test/files/continuations-run/match2.check b/test/files/continuations-run/match2.check
deleted file mode 100644
index cbf91349cc..0000000000
--- a/test/files/continuations-run/match2.check
+++ /dev/null
@@ -1,2 +0,0 @@
-B
-B
diff --git a/test/files/continuations-run/match2.scala b/test/files/continuations-run/match2.scala
deleted file mode 100644
index 002d9b52dd..0000000000
--- a/test/files/continuations-run/match2.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def test1() = {
- val (a, b) = shift { k: (((String,String)) => String) => k("A","B") }
- b
- }
-
- case class Elem[T,U](a: T, b: U)
-
- def test2() = {
- val Elem(a,b) = shift { k: (Elem[String,String] => String) => k(Elem("A","B")) }
- b
- }
-
-
- def main(args: Array[String]): Unit = {
- println(reset(test1()))
- println(reset(test2()))
- }
-
-} \ No newline at end of file
diff --git a/test/files/continuations-run/patvirt.check b/test/files/continuations-run/patvirt.check
deleted file mode 100644
index b5fa014ad3..0000000000
--- a/test/files/continuations-run/patvirt.check
+++ /dev/null
@@ -1,2 +0,0 @@
-10
-11
diff --git a/test/files/continuations-run/patvirt.scala b/test/files/continuations-run/patvirt.scala
deleted file mode 100644
index cfbdda538d..0000000000
--- a/test/files/continuations-run/patvirt.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-import scala.util.continuations._
-
-object Test {
- def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1))))
-
- def test(x1: Int) = {
- val o7 = {
- val o6 = {
- val o3 =
- if (7 == x1) Some(x1)
- else None
-
- if (o3.isEmpty) None
- else Some(sh(x1))
- }
- if (o6.isEmpty) {
- val o5 =
- if (8 == x1) Some(x1)
- else None
-
- if (o5.isEmpty) None
- else Some(sh(x1))
- } else o6
- }
- o7.get
- }
-
- def main(args: Array[String]): Unit = {
- println(reset(1 + test(7)))
- println(reset(1 + test(8)))
- }
-}
diff --git a/test/files/continuations-run/shift-pct.check b/test/files/continuations-run/shift-pct.check
deleted file mode 100644
index fb190e770a..0000000000
--- a/test/files/continuations-run/shift-pct.check
+++ /dev/null
@@ -1,25 +0,0 @@
-d = 1, d2 = 1.0, pct = 1.000
-d = 2, d2 = 4.0, pct = 0.500
-d = 3, d2 = 9.0, pct = 0.333
-d = 4, d2 = 16.0, pct = 0.250
-d = 5, d2 = 25.0, pct = 0.200
-d = 6, d2 = 36.0, pct = 0.167
-d = 7, d2 = 49.0, pct = 0.143
-d = 8, d2 = 64.0, pct = 0.125
-d = 9, d2 = 81.0, pct = 0.111
-d = 10, d2 = 100.0, pct = 0.100
-d = 11, d2 = 121.0, pct = 0.091
-d = 12, d2 = 144.0, pct = 0.083
-d = 13, d2 = 169.0, pct = 0.077
-d = 14, d2 = 196.0, pct = 0.071
-d = 15, d2 = 225.0, pct = 0.067
-d = 16, d2 = 256.0, pct = 0.063
-d = 17, d2 = 289.0, pct = 0.059
-d = 18, d2 = 324.0, pct = 0.056
-d = 19, d2 = 361.0, pct = 0.053
-d = 20, d2 = 400.0, pct = 0.050
-d = 21, d2 = 441.0, pct = 0.048
-d = 22, d2 = 484.0, pct = 0.045
-d = 23, d2 = 529.0, pct = 0.043
-d = 24, d2 = 576.0, pct = 0.042
-d = 25, d2 = 625.0, pct = 0.040
diff --git a/test/files/continuations-run/shift-pct.scala b/test/files/continuations-run/shift-pct.scala
deleted file mode 100644
index 7ef9922168..0000000000
--- a/test/files/continuations-run/shift-pct.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-import scala.util.continuations._
-
-object Test {
- abstract class IfReturnRepro {
- def s1: Double @cpsParam[Any, Unit]
- def s2: Double @cpsParam[Any, Unit]
-
- def p(i: Int): Double @cpsParam[Unit, Any] = {
- val px = s1
- val pct = if (px > 100) px else px / s2
- println("pct = %.3f".format(pct))
- pct
- }
- }
-
- def main(args: Array[String]) : Unit = {
- var d: Double = 0d
- def d2 = d * d
-
- val irr = new IfReturnRepro {
- def s1 = shift(f => f(d))
- def s2 = shift(f => f(d2))
- }
- 1 to 25 foreach { i =>
- d = i
- print("d = " + i + ", d2 = " + d2 + ", ")
- run(irr p i)
- }
- }
-}
diff --git a/test/files/continuations-run/t1807.check b/test/files/continuations-run/t1807.check
deleted file mode 100644
index 56a6051ca2..0000000000
--- a/test/files/continuations-run/t1807.check
+++ /dev/null
@@ -1 +0,0 @@
-1 \ No newline at end of file
diff --git a/test/files/continuations-run/t1807.scala b/test/files/continuations-run/t1807.scala
deleted file mode 100644
index 278b3a9936..0000000000
--- a/test/files/continuations-run/t1807.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
- def main(args: Array[String]): Unit = {
- val z = reset {
- val f: (() => Int @cps[Int]) = () => 1
- f()
- }
- println(z)
- }
-} \ No newline at end of file
diff --git a/test/files/continuations-run/t1808.scala b/test/files/continuations-run/t1808.scala
deleted file mode 100644
index 125c7c1cdf..0000000000
--- a/test/files/continuations-run/t1808.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
- def main(args: Array[String]): Unit = {
- reset0 { 0 }
- }
-} \ No newline at end of file
diff --git a/test/files/continuations-run/t1820.scala b/test/files/continuations-run/t1820.scala
deleted file mode 100644
index 7de6ccabef..0000000000
--- a/test/files/continuations-run/t1820.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
- def shifted: Unit @suspendable = shift { (k: Unit => Unit) => () }
- def test1(b: => Boolean) = {
- reset {
- if (b) shifted
- }
- }
- def main(args: Array[String]): Unit = test1(true)
-}
diff --git a/test/files/continuations-run/t1821.check b/test/files/continuations-run/t1821.check
deleted file mode 100644
index f7b76115db..0000000000
--- a/test/files/continuations-run/t1821.check
+++ /dev/null
@@ -1,4 +0,0 @@
-()
-()
-()
-() \ No newline at end of file
diff --git a/test/files/continuations-run/t1821.scala b/test/files/continuations-run/t1821.scala
deleted file mode 100644
index 55bf7b6f12..0000000000
--- a/test/files/continuations-run/t1821.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
- def suspended[A](x: A): A @suspendable = x
- def test1[A](x: A): A @suspendable = suspended(x) match { case x => x }
- def test2[A](x: List[A]): A @suspendable = suspended(x) match { case List(x) => x }
-
- def test3[A](x: A): A @suspendable = x match { case x => x }
- def test4[A](x: List[A]): A @suspendable = x match { case List(x) => x }
-
- def main(args: Array[String]) {
- println(reset(test1()))
- println(reset(test2(List(()))))
- println(reset(test3()))
- println(reset(test4(List(()))))
- }
-}
diff --git a/test/files/continuations-run/t2864.check b/test/files/continuations-run/t2864.check
deleted file mode 100644
index d411bb7c1a..0000000000
--- a/test/files/continuations-run/t2864.check
+++ /dev/null
@@ -1 +0,0 @@
-400
diff --git a/test/files/continuations-run/t2864.scala b/test/files/continuations-run/t2864.scala
deleted file mode 100644
index 7a2579e45c..0000000000
--- a/test/files/continuations-run/t2864.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-import scala.util.continuations._
-object Test {
-
- def double[B](n : Int)(k : Int => B) : B = k(n * 2)
-
- def main(args : Array[String]) {
- reset {
- val result1 = shift(double[Unit](100))
- val result2 = shift(double[Unit](result1))
- println(result2)
- }
- }
-
- def foo: Int @cps[Int] = {
- val a0 = shift((k:Int=>Int) => k(0))
- val x0 = 2
- val a1 = shift((k:Int=>Int) => x0)
- 0
- }
-
-/*
- def bar: ControlContext[Int,Int,Int] = {
- shiftR((k:Int=>Int) => k(0)).flatMap { a0 =>
- val x0 = 2
- shiftR((k:Int=>Int) => x0).map { a1 =>
- 0
- }}
- }
-*/
-} \ No newline at end of file
diff --git a/test/files/continuations-run/t2934.check b/test/files/continuations-run/t2934.check
deleted file mode 100644
index a92586538e..0000000000
--- a/test/files/continuations-run/t2934.check
+++ /dev/null
@@ -1 +0,0 @@
-List(3, 4, 5)
diff --git a/test/files/continuations-run/t2934.scala b/test/files/continuations-run/t2934.scala
deleted file mode 100644
index a1b8ca9e04..0000000000
--- a/test/files/continuations-run/t2934.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-import scala.util.continuations._
-
-object Test {
- def main(args : Array[String]) {
- println(reset {
- val x = shift(List(1,2,3).flatMap[Int, List[Int]])
- List(x + 2)
- })
- }
-}
diff --git a/test/files/continuations-run/t3199.check b/test/files/continuations-run/t3199.check
deleted file mode 100644
index a065247b8c..0000000000
--- a/test/files/continuations-run/t3199.check
+++ /dev/null
@@ -1 +0,0 @@
-Right(7)
diff --git a/test/files/continuations-run/t3199.scala b/test/files/continuations-run/t3199.scala
deleted file mode 100644
index 2cb73c005a..0000000000
--- a/test/files/continuations-run/t3199.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-import _root_.scala.collection.Seq
-import _root_.scala.util.control.Exception
-import _root_.scala.util.continuations._
-
-object Test {
-
- trait AbstractResource[+R <: AnyRef] {
- def reflect[B] : R @cpsParam[B,Either[Throwable, B]] = shift(acquireFor)
- def acquireFor[B](f : R => B) : Either[Throwable, B] = {
- import Exception._
- catching(List(classOf[Throwable]) : _*) either (f(null.asInstanceOf[R]))
- }
- }
-
- def main(args: Array[String]) : Unit = {
- val x = new AbstractResource[String] { }
- val result = x.acquireFor( x => 7 )
- println(result)
- }
- }
diff --git a/test/files/continuations-run/t3223.check b/test/files/continuations-run/t3223.check
deleted file mode 100644
index ec635144f6..0000000000
--- a/test/files/continuations-run/t3223.check
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/test/files/continuations-run/t3223.scala b/test/files/continuations-run/t3223.scala
deleted file mode 100644
index 75613fe5c7..0000000000
--- a/test/files/continuations-run/t3223.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-import scala.util.continuations._
-object Test {
-
- def foo(x:Int) = {
- try {
- throw new Exception
- shiftUnit0[Int,Int](7)
- } catch {
- case ex: Throwable =>
- val g = (a:Int)=>a
- 9
- }
- }
-
- def main(args: Array[String]) {
- println(reset(foo(0)))
- }
-
-}
diff --git a/test/files/continuations-run/t3225.check b/test/files/continuations-run/t3225.check
deleted file mode 100644
index df1a8a9ce4..0000000000
--- a/test/files/continuations-run/t3225.check
+++ /dev/null
@@ -1,12 +0,0 @@
-8
-8
-9
-9
-8
-9
-8
-8
-9
-9
-8
-9
diff --git a/test/files/continuations-run/t3225.scala b/test/files/continuations-run/t3225.scala
deleted file mode 100644
index a0c9c91985..0000000000
--- a/test/files/continuations-run/t3225.scala
+++ /dev/null
@@ -1,56 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- class Bla {
- val x = 8
- def y[T] = 9
- }
-
-/*
- def bla[A] = shift { k:(Bla=>A) => k(new Bla) }
-*/
-
- def bla1 = shift { k:(Bla=>Bla) => k(new Bla) }
- def bla2 = shift { k:(Bla=>Int) => k(new Bla) }
-
- def fooA = bla2.x
- def fooB[T] = bla2.y[T]
-
- def testMono() = {
- println(reset(bla1).x)
- println(reset(bla2.x))
- println(reset(bla2.y[Int]))
- println(reset(bla2.y))
- println(reset(fooA))
- println(reset(fooB))
- 0
- }
-
- def blaX[A] = shift { k:(Bla=>A) => k(new Bla) }
-
- def fooX[A] = blaX[A].x
- def fooY[A] = blaX[A].y[A]
-
- def testPoly() = {
- println(reset(blaX[Bla]).x)
- println(reset(blaX[Int].x))
- println(reset(blaX[Int].y[Int]))
- println(reset(blaX[Int].y))
- println(reset(fooX[Int]))
- println(reset(fooY[Int]))
- 0
- }
-
-
- // TODO: check whether this also applies to a::shift { k => ... }
-
- def main(args: Array[String]) {
- testMono()
- testPoly()
- }
-
-}
diff --git a/test/files/continuations-run/t3501.check b/test/files/continuations-run/t3501.check
deleted file mode 100644
index 08adcfe27a..0000000000
--- a/test/files/continuations-run/t3501.check
+++ /dev/null
@@ -1,5 +0,0 @@
-42
-42
-42
-42
-42
diff --git a/test/files/continuations-run/t3501.scala b/test/files/continuations-run/t3501.scala
deleted file mode 100644
index c43b3322be..0000000000
--- a/test/files/continuations-run/t3501.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-import scala.util.continuations._
-
-object Test {
- def capture(): Int @suspendable = 42
-
- def main(args: Array[String]): Unit = reset {
- var i = 0
- while (i < 5) {
- i += 1
- val y = capture()
- val s = y
- println(s)
- }
- }
-}
diff --git a/test/files/continuations-run/t5314-2.check b/test/files/continuations-run/t5314-2.check
deleted file mode 100644
index 35b3c93780..0000000000
--- a/test/files/continuations-run/t5314-2.check
+++ /dev/null
@@ -1,5 +0,0 @@
-8
-hi
-8
-from try
-8
diff --git a/test/files/continuations-run/t5314-2.scala b/test/files/continuations-run/t5314-2.scala
deleted file mode 100644
index e7e5d46f03..0000000000
--- a/test/files/continuations-run/t5314-2.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-import scala.util.continuations._
-
-class ReturnRepro {
- def s1: Int @cps[Any] = shift { k => k(5) }
- def caller = reset { println(p(3)) }
- def caller2 = reset { println(p2(3)) }
- def caller3 = reset { println(p3(3)) }
-
- def p(i: Int): Int @cps[Any] = {
- val v= s1 + 3
- return v
- }
-
- def p2(i: Int): Int @cps[Any] = {
- val v = s1 + 3
- if (v > 0) {
- println("hi")
- return v
- } else {
- println("hi")
- return 8
- }
- }
-
- def p3(i: Int): Int @cps[Any] = {
- val v = s1 + 3
- try {
- println("from try")
- return v
- } catch {
- case e: Exception =>
- println("from catch")
- return 7
- }
- }
-
-}
-
-object Test extends App {
- val repro = new ReturnRepro
- repro.caller
- repro.caller2
- repro.caller3
-}
diff --git a/test/files/continuations-run/t5314-3.check b/test/files/continuations-run/t5314-3.check
deleted file mode 100644
index 71489f097c..0000000000
--- a/test/files/continuations-run/t5314-3.check
+++ /dev/null
@@ -1,4 +0,0 @@
-enter return expr
-8
-hi
-8
diff --git a/test/files/continuations-run/t5314-3.scala b/test/files/continuations-run/t5314-3.scala
deleted file mode 100644
index c2fe8f6f87..0000000000
--- a/test/files/continuations-run/t5314-3.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-import scala.util.continuations._
-
-class ReturnRepro {
- def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) }
- def caller = reset { println(p(3)) }
- def caller2 = reset { println(p2(3)) }
-
- def p(i: Int): Int @cpsParam[Unit, Any] = {
- val v= s1 + 3
- return { println("enter return expr"); v }
- }
-
- def p2(i: Int): Int @cpsParam[Unit, Any] = {
- val v = s1 + 3
- if (v > 0) {
- return { println("hi"); v }
- } else {
- return { println("hi"); 8 }
- }
- }
-}
-
-object Test extends App {
- val repro = new ReturnRepro
- repro.caller
- repro.caller2
-}
diff --git a/test/files/continuations-run/t5314-with-if.check b/test/files/continuations-run/t5314-with-if.check
deleted file mode 100644
index 7f8f011eb7..0000000000
--- a/test/files/continuations-run/t5314-with-if.check
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/test/files/continuations-run/t5314-with-if.scala b/test/files/continuations-run/t5314-with-if.scala
deleted file mode 100644
index 5840199a3c..0000000000
--- a/test/files/continuations-run/t5314-with-if.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import scala.util.continuations._
-
-object Test extends App {
-
- def foo(x:Int): Int @cps[Int] = 7
-
- def bar(x:Int): Int @cps[Int] = {
- val v = foo(x)
- if (v > 0)
- return v
- else
- return 10
- }
-
- println(reset { bar(10) })
-
-}
diff --git a/test/files/continuations-run/t5314.check b/test/files/continuations-run/t5314.check
deleted file mode 100644
index 61f5b25dc7..0000000000
--- a/test/files/continuations-run/t5314.check
+++ /dev/null
@@ -1,14 +0,0 @@
-t5314.scala:34: warning: expression 7 is cps-transformed unexpectedly
- def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) }
- ^
-t5314.scala:35: warning: expression 7 is cps-transformed unexpectedly
- def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) }
- ^
-7
-7
-7
-8
-8
-hi
-8
-8
diff --git a/test/files/continuations-run/t5314.scala b/test/files/continuations-run/t5314.scala
deleted file mode 100644
index e448d8558d..0000000000
--- a/test/files/continuations-run/t5314.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-import scala.util.continuations._
-
-class ReturnRepro {
- def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) }
- def caller = reset { println(p(3)) }
- def caller2 = reset { println(p2(3)) }
-
- def p(i: Int): Int @cpsParam[Unit, Any] = {
- val v= s1 + 3
- return v
- }
-
- def p2(i: Int): Int @cpsParam[Unit, Any] = {
- val v = s1 + 3
- if (v > 0) {
- println("hi")
- return v
- } else {
- println("hi")
- return 8
- }
- }
-}
-
-object Test extends App {
- def foo(x:Int): Int @cps[Int] = shift { k => k(x) }
-
- def bar(x:Int): Int @cps[Int] = return foo(x)
-
- def nocps(x: Int): Int = { return x; x }
-
- def foo2(x:Int): Int @cps[Int] = 7
- def bar2(x:Int): Int @cps[Int] = { foo2(x); return 7 }
- def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) }
- def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) }
- def bar5(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else 8 }
- println(reset { bar2(10) })
- println(reset { bar3(10) })
- println(reset { bar4(10) })
- println(reset { bar5(10) })
-
- /* original test case */
- val repro = new ReturnRepro
- repro.caller
- repro.caller2
-
- reset {
- val res = bar(8)
- println(res)
- res
- }
-}
diff --git a/test/files/continuations-run/t5472.check b/test/files/continuations-run/t5472.check
deleted file mode 100644
index 2468b6b27d..0000000000
--- a/test/files/continuations-run/t5472.check
+++ /dev/null
@@ -1,25 +0,0 @@
-t5472.scala:12: warning: expression case4(){
- if (x1.ne(null))
- matchEnd3(true)
- else
- case5()
-} is cps-transformed unexpectedly
- (location, accessors) <- new ContinuationizedParallelIterable(map)
- ^
-t5472.scala:12: warning: expression case5(){
- matchEnd3(false)
-} is cps-transformed unexpectedly
- (location, accessors) <- new ContinuationizedParallelIterable(map)
- ^
-t5472.scala:12: warning: expression matchEnd3(x: Boolean){
- x
-} is cps-transformed unexpectedly
- (location, accessors) <- new ContinuationizedParallelIterable(map)
- ^
-t5472.scala:12: warning: expression matchEnd3(x: Int){
- x
-} is cps-transformed unexpectedly
- (location, accessors) <- new ContinuationizedParallelIterable(map)
- ^
-warning: there were 1 deprecation warning(s); re-run with -deprecation for details
-List(23, 23)
diff --git a/test/files/continuations-run/t5472.scala b/test/files/continuations-run/t5472.scala
deleted file mode 100644
index 060d267544..0000000000
--- a/test/files/continuations-run/t5472.scala
+++ /dev/null
@@ -1,91 +0,0 @@
-import scala.annotation._
-import scala.util.continuations._
-import java.util.concurrent.atomic._
-
-@deprecated("Suppress warnings", since="2.11")
-object Test {
- def main(args: Array[String]) {
- val map = Map("foo" -> 1, "bar" -> 2)
- reset {
- val mapped =
- for {
- (location, accessors) <- new ContinuationizedParallelIterable(map)
- } yield {
- shiftUnit0[Int, Unit](23)
- }
- println(mapped.toList)
- }
- }
-
-final class ContinuationizedParallelIterable[+A](protected val underline: Iterable[A]) {
- def toList = underline.toList.sortBy(_.toString)
-
- final def filter(p: A => Boolean @suspendable): ContinuationizedParallelIterable[A] @suspendable =
- shift(
- new AtomicInteger(1) with ((ContinuationizedParallelIterable[A] => Unit) => Unit) {
- private val results = new AtomicReference[List[A]](Nil)
-
- @tailrec
- private def add(element: A) {
- val old = results.get
- if (!results.compareAndSet(old, element :: old)) {
- add(element)
- }
- }
-
- override final def apply(continue: ContinuationizedParallelIterable[A] => Unit) {
- for (element <- underline) {
- super.incrementAndGet()
- reset {
- val pass = p(element)
- if (pass) {
- add(element)
- }
- if (super.decrementAndGet() == 0) {
- continue(new ContinuationizedParallelIterable(results.get))
- }
- }
- }
- if (super.decrementAndGet() == 0) {
- continue(new ContinuationizedParallelIterable(results.get))
- }
- }
- })
-
- final def foreach[U](f: A => U @suspendable): Unit @suspendable =
- shift(
- new AtomicInteger(1) with ((Unit => Unit) => Unit) {
- override final def apply(continue: Unit => Unit) {
- for (element <- underline) {
- super.incrementAndGet()
- reset {
- f(element)
- if (super.decrementAndGet() == 0) {
- continue()
- }
- }
- }
- if (super.decrementAndGet() == 0) {
- continue()
- }
- }
- })
-
- final def map[B: Manifest](f: A => B @suspendable): ContinuationizedParallelIterable[B] @suspendable =
- shift(
- new AtomicInteger(underline.size) with ((ContinuationizedParallelIterable[B] => Unit) => Unit) {
- override final def apply(continue: ContinuationizedParallelIterable[B] => Unit) {
- val results = new Array[B](super.get)
- for ((element, i) <- underline.view.zipWithIndex) {
- reset {
- val result = f(element)
- results(i) = result
- if (super.decrementAndGet() == 0) {
- continue(new ContinuationizedParallelIterable(results))
- }
- }
- }
- }
- })
-}
-}
diff --git a/test/files/continuations-run/t5506.check b/test/files/continuations-run/t5506.check
deleted file mode 100644
index 38b76c63f1..0000000000
--- a/test/files/continuations-run/t5506.check
+++ /dev/null
@@ -1,7 +0,0 @@
-List(1, 2, 3)
-List(1, 2, 3)
-List(1, 2, 3)
-List(1, 2, 3)
-List(1, 2, 3)
-List(1, 2, 3)
-List(1, 2, 3)
diff --git a/test/files/continuations-run/t5506.scala b/test/files/continuations-run/t5506.scala
deleted file mode 100644
index 08f64c9db1..0000000000
--- a/test/files/continuations-run/t5506.scala
+++ /dev/null
@@ -1,58 +0,0 @@
-import scala.util.continuations._
-
-object Test {
-
-def g: List[Int] @suspendable = List(1,2,3)
-
-def fp10: List[Int] @suspendable = {
-g.map(x => x)
-}
-
-def fp11: List[Int] @suspendable = {
-val z = g.map(x => x)
-z
-}
-
-
-def fp12: List[Int] @suspendable = {
-val z = List(1,2,3)
-z.map(x => x)
-}
-
-
-
-def fp20: List[Int] @suspendable = {
-g.map[Int,List[Int]](x => x)
-}
-
-
-def fp21: List[Int] @suspendable = {
-val z = g.map[Int,List[Int]](x => x)
-z
-}
-
-def fp22: List[Int] @suspendable = {
-val z = g.map[Int,List[Int]](x => x)(List.canBuildFrom[Int])
-z
-}
-
-def fp23: List[Int] @suspendable = {
-val z = g.map(x => x)(List.canBuildFrom[Int])
-z
-}
-
-
-def main(args: Array[String]) {
- reset {
- println(fp10)
- println(fp11)
- println(fp12)
-
- println(fp20)
- println(fp21)
- println(fp22)
- println(fp23)
- }
-}
-
-}
diff --git a/test/files/continuations-run/t5538.check b/test/files/continuations-run/t5538.check
deleted file mode 100644
index d9d873663d..0000000000
--- a/test/files/continuations-run/t5538.check
+++ /dev/null
@@ -1,2 +0,0 @@
-warning: there were 1 feature warning(s); re-run with -feature for details
-Future(Future(Future(Future(Future(List(1, 2, 3, 4, 5))))))
diff --git a/test/files/continuations-run/t5538.scala b/test/files/continuations-run/t5538.scala
deleted file mode 100644
index 9f01624da1..0000000000
--- a/test/files/continuations-run/t5538.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-import scala.util.continuations._
-import scala.collection.generic.CanBuildFrom
-
-import scala.language.{ implicitConversions }
-
-object Test {
-
- class ExecutionContext
-
- implicit def defaultExecutionContext = new ExecutionContext
-
- case class Future[+T](x:T) {
- final def map[A](f: T => A): Future[A] = new Future[A](f(x))
- final def flatMap[A](f: T => Future[A]): Future[A] = f(x)
- }
-
- class PromiseStream[A] {
- override def toString = xs.toString
-
- var xs: List[A] = Nil
-
- final def +=(elem: A): this.type = { xs :+= elem; this }
-
- final def ++=(elem: Traversable[A]): this.type = { xs ++= elem; this }
-
- final def <<(elem: Future[A]): PromiseStream[A] @cps[Future[Any]] =
- shift { cont: (PromiseStream[A] => Future[Any]) => elem map (a => cont(this += a)) }
-
- final def <<(elem1: Future[A], elem2: Future[A], elems: Future[A]*): PromiseStream[A] @cps[Future[Any]] =
- shift { cont: (PromiseStream[A] => Future[Any]) => Future.flow(this << elem1 << elem2 <<< Future.sequence(elems.toSeq)) map cont }
-
- final def <<<(elems: Traversable[A]): PromiseStream[A] @cps[Future[Any]] =
- shift { cont: (PromiseStream[A] => Future[Any]) => cont(this ++= elems) }
-
- final def <<<(elems: Future[Traversable[A]]): PromiseStream[A] @cps[Future[Any]] =
- shift { cont: (PromiseStream[A] => Future[Any]) => elems map (as => cont(this ++= as)) }
- }
-
- object Future {
-
- def sequence[A, M[_] <: Traversable[_]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]] =
- new Future(in.asInstanceOf[Traversable[Future[A]]].map((f:Future[A])=>f.x)(cbf.asInstanceOf[CanBuildFrom[Traversable[Future[A]], A, M[A]]]))
-
- def flow[A](body: => A @cps[Future[Any]])(implicit executor: ExecutionContext): Future[A] = reset(Future(body)).asInstanceOf[Future[A]]
-
- }
-
- def main(args: Array[String]) {
- val p = new PromiseStream[Int]
- println(Future.flow(p << (Future(1), Future(2), Future(3), Future(4), Future(5))))
- }
-}
diff --git a/test/files/continuations-run/trycatch0.check b/test/files/continuations-run/trycatch0.check
deleted file mode 100644
index 36806909d0..0000000000
--- a/test/files/continuations-run/trycatch0.check
+++ /dev/null
@@ -1,2 +0,0 @@
-10
-10 \ No newline at end of file
diff --git a/test/files/continuations-run/trycatch0.scala b/test/files/continuations-run/trycatch0.scala
deleted file mode 100644
index d0b4a52a30..0000000000
--- a/test/files/continuations-run/trycatch0.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-object Test {
-
- def foo = try {
- shift((k: Int=>Int) => k(7))
- } catch {
- case ex: Throwable =>
- 9
- }
-
- def bar = try {
- 7
- } catch {
- case ex: Throwable =>
- shiftUnit0[Int,Int](9)
- }
-
- def main(args: Array[String]): Unit = {
- println(reset { foo + 3 })
- println(reset { bar + 3 })
- }
-}
diff --git a/test/files/continuations-run/trycatch1.check b/test/files/continuations-run/trycatch1.check
deleted file mode 100644
index 061ecdcd54..0000000000
--- a/test/files/continuations-run/trycatch1.check
+++ /dev/null
@@ -1,10 +0,0 @@
-trycatch1.scala:34: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
- 7
- ^
-trycatch1.scala:18: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
- shift((k: Int=>Int) => k(7))
- ^
-12
-12
-12
-12
diff --git a/test/files/continuations-run/trycatch1.scala b/test/files/continuations-run/trycatch1.scala
deleted file mode 100644
index 2a8db72a8b..0000000000
--- a/test/files/continuations-run/trycatch1.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-object Test {
-
- def fatal: Int = throw new Exception()
-
- def foo1 = try {
- fatal
- shift((k: Int=>Int) => k(7))
- } catch {
- case ex: Throwable =>
- 9
- }
-
- def foo2 = try {
- shift((k: Int=>Int) => k(7))
- fatal
- } catch {
- case ex: Throwable =>
- 9
- }
-
- def bar1 = try {
- fatal
- 7
- } catch {
- case ex: Throwable =>
- shiftUnit0[Int,Int](9) // regular shift causes no-symbol doesn't have owner
- }
-
- def bar2 = try {
- 7
- fatal
- } catch {
- case ex: Throwable =>
- shiftUnit0[Int,Int](9) // regular shift causes no-symbol doesn't have owner
- }
-
- def main(args: Array[String]): Unit = {
- println(reset { foo1 + 3 })
- println(reset { foo2 + 3 })
- println(reset { bar1 + 3 })
- println(reset { bar2 + 3 })
- }
-
-}
diff --git a/test/files/continuations-run/while0.check b/test/files/continuations-run/while0.check
deleted file mode 100644
index d58c55a31d..0000000000
--- a/test/files/continuations-run/while0.check
+++ /dev/null
@@ -1 +0,0 @@
-9000
diff --git a/test/files/continuations-run/while0.scala b/test/files/continuations-run/while0.scala
deleted file mode 100644
index e21745374e..0000000000
--- a/test/files/continuations-run/while0.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def foo(): Int @cps[Unit] = 2
-
- def test(): Unit @cps[Unit] = {
- var x = 0
- while (x < 9000) { // pick number large enough to require tail-call opt
- x += foo()
- }
- println(x)
- }
-
- def main(args: Array[String]): Unit = {
- reset(test())
- }
-
-}
diff --git a/test/files/continuations-run/while1.check b/test/files/continuations-run/while1.check
deleted file mode 100644
index 3d5f0b9a46..0000000000
--- a/test/files/continuations-run/while1.check
+++ /dev/null
@@ -1,11 +0,0 @@
-up
-up
-up
-up
-up
-10
-down
-down
-down
-down
-down
diff --git a/test/files/continuations-run/while1.scala b/test/files/continuations-run/while1.scala
deleted file mode 100644
index 7ba9f94881..0000000000
--- a/test/files/continuations-run/while1.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def foo(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") }
-
- def test(): Unit @cps[Unit] = {
- var x = 0
- while (x < 9) {
- x += foo()
- }
- println(x)
- }
-
- def main(args: Array[String]): Unit = {
- reset(test())
- }
-
-}
diff --git a/test/files/continuations-run/while2.check b/test/files/continuations-run/while2.check
deleted file mode 100644
index 9fe515181b..0000000000
--- a/test/files/continuations-run/while2.check
+++ /dev/null
@@ -1,19 +0,0 @@
-up
-up
-up
-up
-up
-up
-up
-up
-up
-9000
-down
-down
-down
-down
-down
-down
-down
-down
-down
diff --git a/test/files/continuations-run/while2.scala b/test/files/continuations-run/while2.scala
deleted file mode 100644
index 3dbf2ad2fe..0000000000
--- a/test/files/continuations-run/while2.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-
-object Test {
-
- def foo1(): Int @cps[Unit] = 2
- def foo2(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") }
-
- def test(): Unit @cps[Unit] = {
- var x = 0
- while (x < 9000) { // pick number large enough to require tail-call opt
- x += (if (x % 1000 != 0) foo1() else foo2())
- }
- println(x)
- }
-
- def main(args: Array[String]): Unit = {
- reset(test())
- }
-
-}
diff --git a/test/files/continuations-run/z1673.scala b/test/files/continuations-run/z1673.scala
deleted file mode 100644
index 716b374860..0000000000
--- a/test/files/continuations-run/z1673.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-import scala.util.continuations._
-
-class MatchRepro {
- def s: String @cps[Any] = shift { k => k("foo") }
-
- def p = {
- val k = s
- s match { case lit0 => }
- }
-
- def q = {
- val k = s
- k match { case lit1 => }
- }
-
- def r = {
- s match { case "FOO" => }
- }
-
- def t = {
- val k = s
- k match { case "FOO" => }
- }
-}
-
-object Test {
- def main(args: Array[String]): Unit = {
- val m = new MatchRepro
- ()
- }
-}
diff --git a/test/files/continuations-run/t3199b.check b/test/files/run/t3199b.check
index b5d8bb58d9..b5d8bb58d9 100644
--- a/test/files/continuations-run/t3199b.check
+++ b/test/files/run/t3199b.check
diff --git a/test/files/continuations-run/t3199b.scala b/test/files/run/t3199b.scala
index 5010f2b085..5010f2b085 100644
--- a/test/files/continuations-run/t3199b.scala
+++ b/test/files/run/t3199b.scala
diff --git a/test/pending/continuations-pos/t3620.scala b/test/pending/continuations-pos/t3620.scala
deleted file mode 100644
index 8496ae2858..0000000000
--- a/test/pending/continuations-pos/t3620.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-import scala.collection.mutable.HashMap
-import scala.util.continuations._
-
-object Test extends Application {
-
- class Store[K,V] {
-
- trait Waiting {
- def key: K
- def inform(value: V): Unit
- }
-
- private val map = new HashMap[K, V]
- private var waiting: List[Waiting] = Nil
-
- def waitFor(k: K, f: (V => Unit)) {
- map.get(k) match {
- case Some(v) => f(v)
- case None => {
- val w = new Waiting {
- def key = k
- def inform(v: V) = f(v)
- }
- waiting = w :: waiting
- }
- }
- }
-
-
- def add(key: K, value: V) {
- map(key) = value
- val p = waiting.partition(_.key == key)
- waiting = p._2
- p._1.foreach(_.inform(value))
- }
-
- def required(key: K) = {
- shift {
- c: (V => Unit) => {
- waitFor(key, c)
- }
- }
- }
-
- def option(key: Option[K]) = {
- shift {
- c: (Option[V] => Unit) => {
- key match {
- case Some(key) => waitFor(key, (v: V) => c(Some(v)))
- case None => c(None)
- }
-
- }
- }
- }
-
- }
-
- val store = new Store[String, Int]
-
- def test(p: Option[String]): Unit = {
- reset {
- // uncommenting the following two lines makes the compiler happy!
-// val o = store.option(p)
-// println(o)
- val i = store.option(p).getOrElse(1)
- println(i)
- }
- }
-
- test(Some("a"))
-
-}
diff --git a/test/pending/continuations-run/example0.scala b/test/pending/continuations-run/example0.scala
deleted file mode 100644
index de5ea54e9d..0000000000
--- a/test/pending/continuations-run/example0.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test0.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example1.scala b/test/pending/continuations-run/example1.scala
deleted file mode 100644
index e31d6af88c..0000000000
--- a/test/pending/continuations-run/example1.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test1.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example16.scala b/test/pending/continuations-run/example16.scala
deleted file mode 100644
index 561f0ab0eb..0000000000
--- a/test/pending/continuations-run/example16.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test16Printf.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example2.scala b/test/pending/continuations-run/example2.scala
deleted file mode 100644
index 730f7cc63e..0000000000
--- a/test/pending/continuations-run/example2.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test2.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example3.scala b/test/pending/continuations-run/example3.scala
deleted file mode 100644
index 41cf1cce0c..0000000000
--- a/test/pending/continuations-run/example3.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test3.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example4.scala b/test/pending/continuations-run/example4.scala
deleted file mode 100644
index adcc7aa90e..0000000000
--- a/test/pending/continuations-run/example4.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test4.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example5.scala b/test/pending/continuations-run/example5.scala
deleted file mode 100644
index 241e8cd069..0000000000
--- a/test/pending/continuations-run/example5.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test5.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example6.scala b/test/pending/continuations-run/example6.scala
deleted file mode 100644
index 00f84fcd6c..0000000000
--- a/test/pending/continuations-run/example6.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test6.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example7.scala b/test/pending/continuations-run/example7.scala
deleted file mode 100644
index 64abc6d9a6..0000000000
--- a/test/pending/continuations-run/example7.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test7.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example8.scala b/test/pending/continuations-run/example8.scala
deleted file mode 100644
index a5f953d3fc..0000000000
--- a/test/pending/continuations-run/example8.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test8.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/example9.scala b/test/pending/continuations-run/example9.scala
deleted file mode 100644
index 09d792c427..0000000000
--- a/test/pending/continuations-run/example9.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-
-object Test {
-
- def main(args: Array[String]): Any = {
- examples.continuations.Test9Monads.main(args)
- }
-
-} \ No newline at end of file
diff --git a/test/pending/continuations-run/foreach.check b/test/pending/continuations-run/foreach.check
deleted file mode 100644
index 9bab7a2eed..0000000000
--- a/test/pending/continuations-run/foreach.check
+++ /dev/null
@@ -1,4 +0,0 @@
-1
-2
-3
-enough is enough \ No newline at end of file
diff --git a/test/pending/continuations-run/foreach.scala b/test/pending/continuations-run/foreach.scala
deleted file mode 100644
index 76823e7604..0000000000
--- a/test/pending/continuations-run/foreach.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-// $Id$
-
-import scala.util.continuations._
-
-import scala.util.continuations.Loops._
-
-object Test {
-
- def main(args: Array[String]): Any = {
-
-
- reset {
-
- val list = List(1,2,3,4,5)
-
- for (x <- list.suspendable) {
-
- shift { k: (Unit => Unit) =>
- println(x)
- if (x < 3)
- k()
- else
- println("enough is enough")
- }
-
- }
-
- }
-
-
- }
-
-} \ No newline at end of file
diff --git a/versions.properties b/versions.properties
index 76eea52681..90448dc49a 100644
--- a/versions.properties
+++ b/versions.properties
@@ -4,9 +4,16 @@ starr.use.released=1
# These are the versions of the modules that go with this release.
# These properties are used during PR validation and in dbuild builds.
scala.binary.version=2.11.0-M7
-partest.version.number=1.0.0-RC8
+
+# external modules shipped with distribution:
scala-xml.version.number=1.0.0-RC7
scala-parser-combinators.version.number=1.0.0-RC5
+scala-continuations-plugin.version.number=1.0.0-RC2
+scala-continuations-library.version.number=1.0.0-RC2
+scala-swing.version.number=1.0.0-RC2
+
+# external modules, used internally (not shipped)
+partest.version.number=1.0.0-RC8
scalacheck.version.number=1.11.1
# TODO: modularize the compiler