diff options
author | Rich Hickey <richhickey@gmail.com> | 2006-05-08 14:14:30 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2006-05-08 14:14:30 +0000 |
commit | 80d8f14c9f0d5604075de76c32a580dd2cb92dd9 (patch) | |
tree | c5c9de8e9dba674c524603863663c061dc366992 /src | |
parent | 854ba93bc662517ef4a4bfb683b20bdfc35a2c96 (diff) |
added box and cast fns
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/runtime/RT.cs | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/src/cli/runtime/RT.cs b/src/cli/runtime/RT.cs index d6b4ee35..44cc0bfb 100644 --- a/src/cli/runtime/RT.cs +++ b/src/cli/runtime/RT.cs @@ -72,11 +72,84 @@ public class RT }
-static public Object ch(char c)
+ static public Object box(Object x)
+ {
+ return x;
+ }
+
+ static public Object box(char x)
+ {
+ return x;
+ }
+
+ static public Object box(bool x)
+ {
+ return x;
+ }
+
+ static public Object box(byte x)
+ {
+ return x;
+ }
+
+ static public Object box(short x)
+ {
+ return x;
+ }
+
+ static public Object box(int x)
+ {
+ return x;
+ }
+
+ static public Object box(long x)
+ {
+ return x;
+ }
+
+ static public Object box(float x)
+ {
+ return x;
+ }
+
+ static public Object box(double x)
+ {
+ return x;
+ }
+
+ static public char charCast(Object x)
{
return Convert.ToChar(x);
}
+
+ static public bool booleanCast(Object x)
{
if(x is Boolean)
+ return (bool)x; ;
return x != null;
}
+
+ static public byte byteCast(Object x)
+ {
+ return Convert.ToByte(x);
+ }
+
+ static public short shortCast(Object x)
+ {
+ return Convert.ToInt16(x);
}
+
+ static public int intCast(Object x)
+ {
+ return Convert.ToInt32(x);
+ }
+
+ static public long longCast(Object x)
{
- return c;
+ return Convert.ToInt64(x);
}
+ static public float floatCast(Object x)
+ {
+ return Convert.ToSingle(x);
+ }
+
+ static public double doubleCast(Object x)
+ {
+ return Convert.ToDouble(x);
+ }
static public Cons cons(Object x, Cons y)
{
return new Cons(x, y);
|