From 12f1f20a6d4637a0332faf820d80ab0ef4aab12e Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 19 Feb 2009 19:24:01 +0000 Subject: [PATCH] Extend library classes --- Robust/src/ClassLibrary/Integer.java | 5 +++++ Robust/src/ClassLibrary/Math.java | 7 +++++++ Robust/src/ClassLibrary/System.java | 4 ++++ Robust/src/Runtime/math.c | 4 ++++ Robust/src/Tests/TertiaryTest.java | 6 +++--- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Robust/src/ClassLibrary/Integer.java b/Robust/src/ClassLibrary/Integer.java index ae9b7e35..0cc1bd90 100644 --- a/Robust/src/ClassLibrary/Integer.java +++ b/Robust/src/ClassLibrary/Integer.java @@ -58,6 +58,11 @@ public class Integer { return String.valueOf(value); } + public static String toString( int i ) { + Integer I = new Integer( i ); + return I.toString(); + } + public int hashCode() { return value; } diff --git a/Robust/src/ClassLibrary/Math.java b/Robust/src/ClassLibrary/Math.java index 63147285..95cfcc96 100644 --- a/Robust/src/ClassLibrary/Math.java +++ b/Robust/src/ClassLibrary/Math.java @@ -5,6 +5,12 @@ public class Math { return PI; } + // an alias for setPI() + public static double PI() { + double PI = 3.14159265358979323846; + return PI; + } + public static double fabs(double x) { if (x < 0) { return -x; @@ -93,6 +99,7 @@ public class Math { public static native double acos(double a); public static native double tan(double a); public static native double atan(double a); + public static native double atan2(double a, double b); public static native double exp(double a); public static native double sqrt(double a); public static native double log(double a); diff --git a/Robust/src/ClassLibrary/System.java b/Robust/src/ClassLibrary/System.java index dc6c9a9b..1b6cf9e9 100644 --- a/Robust/src/ClassLibrary/System.java +++ b/Robust/src/ClassLibrary/System.java @@ -13,6 +13,10 @@ public class System { System.printString("\n"); } + public static void print(String s) { + System.printString(s); + } + public static void error() { System.printString("Error (Use Breakpoint on ___System______error method for more information!)\n"); } diff --git a/Robust/src/Runtime/math.c b/Robust/src/Runtime/math.c index 516cd1d4..183fb6b8 100644 --- a/Robust/src/Runtime/math.c +++ b/Robust/src/Runtime/math.c @@ -26,6 +26,10 @@ double CALL11(___Math______atan____D, double ___a___, double ___a___) { return atan(___a___); } +double CALL22(___Math______atan2____D_D, double ___a___, double ___b___, double ___a___, double ___b___) { + return atan2(___a___,___b___); +} + double CALL11(___Math______log____D, double ___a___, double ___a___) { return log(___a___); } diff --git a/Robust/src/Tests/TertiaryTest.java b/Robust/src/Tests/TertiaryTest.java index 83bd6074..c60ef627 100644 --- a/Robust/src/Tests/TertiaryTest.java +++ b/Robust/src/Tests/TertiaryTest.java @@ -3,8 +3,8 @@ public class TertiaryTest { int x = 3; int y = x<5 ? 6 : 1000; int z = x>1 ? y>7 ? 2000 : 8 : 3000; - System.printString( "x should be 3: "+x+"\n" ); - System.printString( "y should be 6: "+y+"\n" ); - System.printString( "z should be 8: "+z+"\n" ); + System.out.println( "x should be 3: "+x ); + System.out.print ( "y should be 6: "+y+"\n" ); + System.out.println( "z should be 8: "+z ); } } \ No newline at end of file -- 2.34.1