From c9305ff74fc9e23d2a8f4c6a27a25e5562c048cc Mon Sep 17 00:00:00 2001 From: mihaylov Date: Tue, 4 Oct 2005 16:15:01 +0000 Subject: *** empty log message *** --- sources/msil/scala/runtime/compat/Math.scala | 36 +++++++++++++ sources/msil/scala/runtime/compat/Platform.scala | 3 ++ sources/scala/runtime/compat/Math.scala | 9 ++-- test/files/jvm/bug281.check | 0 test/files/jvm/bug281.scala | 14 ++++++ test/files/run/Course-2002-06.scala | 6 --- test/files/run/runtime-msil.check | 64 ++++++++++++++++++++++++ 7 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 sources/msil/scala/runtime/compat/Math.scala create mode 100644 test/files/jvm/bug281.check create mode 100644 test/files/jvm/bug281.scala create mode 100644 test/files/run/runtime-msil.check diff --git a/sources/msil/scala/runtime/compat/Math.scala b/sources/msil/scala/runtime/compat/Math.scala new file mode 100644 index 0000000000..5b9853e953 --- /dev/null +++ b/sources/msil/scala/runtime/compat/Math.scala @@ -0,0 +1,36 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2005, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + + +package scala.runtime.compat; + +object Math { + val MIN_BYTE = System.SByte.MinValue; + val MAX_BYTE = System.SByte.MaxValue; + val MIN_SHORT = System.Int16.MinValue; + val MAX_SHORT = System.Int16.MaxValue; + val MIN_CHAR = System.Char.MinValue; + val MAX_CHAR = System.Char.MaxValue; + val MIN_INT = System.Int32.MinValue; + val MAX_INT = System.Int32.MaxValue; + val MIN_LONG = System.Int64.MinValue; + val MAX_LONG = System.Int64.MaxValue; + val MIN_FLOAT = System.Single.MinValue; + val MAX_FLOAT = System.Single.MaxValue; + val MIN_DOUBLE = System.Double.MinValue; + val MAX_DOUBLE = System.Double.MaxValue; + + def max(x: Int, y: Int): Int = System.Math.Max(x, y); + + def ceil (x: Double): Double = System.Math.Ceiling(x); + def floor(x: Double): Double = System.Math.Floor(x); + def log (x: Double): Double = System.Math.Log(x); + def sqrt (x: Double): Double = System.Math.Sqrt(x); +} diff --git a/sources/msil/scala/runtime/compat/Platform.scala b/sources/msil/scala/runtime/compat/Platform.scala index d47b7f9297..fcdaa54e22 100644 --- a/sources/msil/scala/runtime/compat/Platform.scala +++ b/sources/msil/scala/runtime/compat/Platform.scala @@ -24,6 +24,9 @@ object Platform { sep(0) = separator; str.Split(sep); } + + def currentThread = System.Threading.Thread.CurrentThread; + def parseByte(s: String) : Byte = System.Byte.Parse(s); def parseShort(s: String) : Short = System.Int16.Parse(s); def parseInt(s: String) : Int = System.Int32.Parse(s); diff --git a/sources/scala/runtime/compat/Math.scala b/sources/scala/runtime/compat/Math.scala index ea83e7b6f1..147ffeb0f9 100644 --- a/sources/scala/runtime/compat/Math.scala +++ b/sources/scala/runtime/compat/Math.scala @@ -27,9 +27,10 @@ object Math { val MIN_DOUBLE = java.lang.Double.MIN_VALUE; val MAX_DOUBLE = java.lang.Double.MAX_VALUE; - def ceil(x: Double): Double = java.lang.Math.ceil(x); - def floor(x: Double): Double = java.lang.Math.floor(x); - def log(x: Double): Double = java.lang.Math.log(x); def max(x: Int, y: Int): Int = java.lang.Math.max(x, y); - def sqrt(x: Double): Double = java.lang.Math.sqrt(x); + + def ceil (x: Double): Double = java.lang.Math.ceil(x); + def floor(x: Double): Double = java.lang.Math.floor(x); + def log (x: Double): Double = java.lang.Math.log(x); + def sqrt (x: Double): Double = java.lang.Math.sqrt(x); } diff --git a/test/files/jvm/bug281.check b/test/files/jvm/bug281.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/jvm/bug281.scala b/test/files/jvm/bug281.scala new file mode 100644 index 0000000000..5f8c15b6ae --- /dev/null +++ b/test/files/jvm/bug281.scala @@ -0,0 +1,14 @@ +//############################################################################ +// Bug 281 + +class Bug281A extends java.util.Hashtable { + class B { def f = rehash() }; +} + +object Test { + def main(args: Array[String]): Unit = { + val a = new Bug281A; + val b = new a.B; + b.f + } +} diff --git a/test/files/run/Course-2002-06.scala b/test/files/run/Course-2002-06.scala index ca816eda06..8ce003333f 100644 --- a/test/files/run/Course-2002-06.scala +++ b/test/files/run/Course-2002-06.scala @@ -122,12 +122,6 @@ class PostScript (filename: String, _width: Double, _height: Double) scaleAndCenter(new Frame(origin, edgeX, edgeY), width / height) } -// /** File where to print.*/ -// import java.io._; -// val out : PrintStream = new PrintStream( -// if (filename == "-") java.lang.System.out -// else new FileOutputStream(filename)); - def plotLine(x1: Double, y1: Double, x2: Double, y2: Double): Unit = { Console.println(round(x1) + " " + round(y1) + " m " + round(x2) + " " + round(y2) + " l"); diff --git a/test/files/run/runtime-msil.check b/test/files/run/runtime-msil.check new file mode 100644 index 0000000000..70e7608a11 --- /dev/null +++ b/test/files/run/runtime-msil.check @@ -0,0 +1,64 @@ +<<< Test0 +[False,True] +[0,1,2] +[3,4,5] +[a,b,c] +[6,7,8] +[9,10,11] +[12,13] +[14,15] +[string] +>>> Test0 + +<<< Test1 +10 +14 +15 +16 +20 +23 +24 +25 +26 +>>> Test1 + +<<< Test2 +A +M0 +N0 + +A +N0 +M0 + +A +M0 +M1 +N0 + +A +N0 +N1 +M0 + +>>> Test2 + +<<< Test3 +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +Ok +>>> Test3 + -- cgit v1.2.3