[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/Basic/CompilerServices BooleanType.c
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/Basic/CompilerServices BooleanType.cs,1.3,1.4 ByteType.cs,1.4,1.5 CharArrayType.cs,1.3,1.4 CharType.cs,1.3,1.4 DateType.cs,1.3,1.4 DecimalType.cs,1.4,1.5 DoubleType.cs,1.4,1.5 FlowControl.cs,1.3,1.4 IntegerType.cs,1.4,1.5 LongType.cs,1.4,1.5 ObjectType.cs,1.4,1.5 ShortType.cs,1.4,1.5 SingleType.cs,1.4,1.5 StringType.cs,1.3,1.4 Utils.cs,1.3,1.4 |
Date: |
Thu, 29 May 2003 04:07:03 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices
In directory subversions:/tmp/cvs-serv20651/Basic/CompilerServices
Modified Files:
BooleanType.cs ByteType.cs CharArrayType.cs CharType.cs
DateType.cs DecimalType.cs DoubleType.cs FlowControl.cs
IntegerType.cs LongType.cs ObjectType.cs ShortType.cs
SingleType.cs StringType.cs Utils.cs
Log Message:
Modifications to build the VB library in ECMA_COMPAT modes.
Index: BooleanType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/BooleanType.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** BooleanType.cs 29 May 2003 05:38:17 -0000 1.3
--- BooleanType.cs 29 May 2003 08:07:00 -0000 1.4
***************
*** 35,38 ****
--- 35,40 ----
private BooleanType() {}
+ #if !ECMA_COMPAT
+
// Convert a decimal value into boolean.
public static bool DecimalToBoolean(IConvertible ValueInterface)
***************
*** 41,47 ****
--- 43,52 ----
}
+ #endif
+
// Convert an object into a boolean value.
public static bool FromObject(Object Value)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 70,73 ****
--- 75,150 ----
return false;
}
+ #else
+ if(Value == null)
+ {
+ return false;
+ }
+ Type type = Value.GetType();
+ if(type == typeof(byte))
+ {
+ return Convert.ToBoolean((byte)Value);
+ }
+ else if(type == typeof(sbyte))
+ {
+ return Convert.ToBoolean((sbyte)Value);
+ }
+ else if(type == typeof(short))
+ {
+ return Convert.ToBoolean((short)Value);
+ }
+ else if(type == typeof(ushort))
+ {
+ return Convert.ToBoolean((ushort)Value);
+ }
+ else if(type == typeof(char))
+ {
+ return Convert.ToBoolean((char)Value);
+ }
+ else if(type == typeof(int))
+ {
+ return Convert.ToBoolean((int)Value);
+ }
+ else if(type == typeof(uint))
+ {
+ return Convert.ToBoolean((uint)Value);
+ }
+ else if(type == typeof(long))
+ {
+ return Convert.ToBoolean((long)Value);
+ }
+ else if(type == typeof(ulong))
+ {
+ return Convert.ToBoolean((ulong)Value);
+ }
+ #if CONFIG_EXTENDED_NUMERICS
+ else if(type == typeof(float))
+ {
+ return Convert.ToBoolean((float)Value);
+ }
+ else if(type == typeof(double))
+ {
+ return Convert.ToBoolean((double)Value);
+ }
+ else if(type == typeof(Decimal))
+ {
+ return
Convert.ToBoolean((Decimal)Value);
+ }
+ #endif
+ else if(type == typeof(String))
+ {
+ return Convert.ToBoolean((String)Value);
+ }
+ else if(type == typeof(bool))
+ {
+ return (bool)Value;
+ }
+ else
+ {
+ throw new InvalidCastException
+ (String.Format
+ (S._("VB_InvalidCast"),
+ Value.GetType(),
"System.Boolean"));
+ }
+ #endif
}
Index: ByteType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/ByteType.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** ByteType.cs 29 May 2003 05:38:17 -0000 1.4
--- ByteType.cs 29 May 2003 08:07:00 -0000 1.5
***************
*** 35,38 ****
--- 35,40 ----
private ByteType() {}
+ #if !ECMA_COMPAT
+
// Convert a decimal value into a byte.
public static byte DecimalToByte(IConvertible ValueInterface)
***************
*** 41,47 ****
--- 43,52 ----
}
+ #endif
+
// Convert an object into a byte value.
public static byte FromObject(Object Value)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 70,73 ****
--- 75,81 ----
return 0;
}
+ #else
+ return
checked((byte)(LongType.FromObject(Value)));
+ #endif
}
Index: CharArrayType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/CharArrayType.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** CharArrayType.cs 29 May 2003 05:38:17 -0000 1.3
--- CharArrayType.cs 29 May 2003 08:07:00 -0000 1.4
***************
*** 44,47 ****
--- 44,48 ----
return (char[])Value;
}
+ #if !ECMA_COMPAT
IConvertible ic = (Value as
IConvertible);
if(ic != null && ic.GetTypeCode() ==
TypeCode.String)
***************
*** 49,52 ****
--- 50,59 ----
return
ic.ToString(null).ToCharArray();
}
+ #else
+ if(Value is String)
+ {
+ return
((String)Value).ToCharArray();
+ }
+ #endif
else
{
Index: CharType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/CharType.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** CharType.cs 29 May 2003 05:38:17 -0000 1.3
--- CharType.cs 29 May 2003 08:07:00 -0000 1.4
***************
*** 38,41 ****
--- 38,42 ----
public static char FromObject(Object Value)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 64,67 ****
--- 65,122 ----
return '\0';
}
+ #else
+ if(Value == null)
+ {
+ return '\u0000';
+ }
+ Type type = Value.GetType();
+ if(type == typeof(byte))
+ {
+ return Convert.ToChar((byte)Value);
+ }
+ else if(type == typeof(sbyte))
+ {
+ return Convert.ToChar((sbyte)Value);
+ }
+ else if(type == typeof(short))
+ {
+ return Convert.ToChar((short)Value);
+ }
+ else if(type == typeof(ushort))
+ {
+ return Convert.ToChar((ushort)Value);
+ }
+ else if(type == typeof(char))
+ {
+ return (char)Value;
+ }
+ else if(type == typeof(int))
+ {
+ return Convert.ToChar((int)Value);
+ }
+ else if(type == typeof(uint))
+ {
+ return Convert.ToChar((uint)Value);
+ }
+ else if(type == typeof(long))
+ {
+ return Convert.ToChar((long)Value);
+ }
+ else if(type == typeof(ulong))
+ {
+ return Convert.ToChar((ulong)Value);
+ }
+ else if(type == typeof(String))
+ {
+ return Convert.ToChar((String)Value);
+ }
+ else
+ {
+ throw new InvalidCastException
+ (String.Format
+ (S._("VB_InvalidCast"),
+ Value.GetType(),
"System.Char"));
+ }
+ #endif
}
Index: DateType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/DateType.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** DateType.cs 29 May 2003 05:38:17 -0000 1.3
--- DateType.cs 29 May 2003 08:07:00 -0000 1.4
***************
*** 39,42 ****
--- 39,43 ----
public static DateTime FromObject(Object Value)
{
+ #if !ECMA_COMPAT
IConvertible ic = (Value as IConvertible);
if(ic != null)
***************
*** 51,54 ****
--- 52,61 ----
}
}
+ #else
+ if(Value is DateTime)
+ {
+ return (DateTime)Value;
+ }
+ #endif
throw new InvalidCastException
(String.Format
Index: DecimalType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/DecimalType.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** DecimalType.cs 29 May 2003 05:38:17 -0000 1.4
--- DecimalType.cs 29 May 2003 08:07:00 -0000 1.5
***************
*** 50,53 ****
--- 50,54 ----
(Object Value, NumberFormatInfo NumberFormat)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 76,79 ****
--- 77,150 ----
return 0.0m;
}
+ #else
+ if(Value == null)
+ {
+ return 0;
+ }
+ Type type = Value.GetType();
+ if(type == typeof(byte))
+ {
+ return Convert.ToDecimal((byte)Value);
+ }
+ else if(type == typeof(sbyte))
+ {
+ return Convert.ToDecimal((sbyte)Value);
+ }
+ else if(type == typeof(short))
+ {
+ return Convert.ToDecimal((short)Value);
+ }
+ else if(type == typeof(ushort))
+ {
+ return Convert.ToDecimal((ushort)Value);
+ }
+ else if(type == typeof(char))
+ {
+ return Convert.ToDecimal((char)Value);
+ }
+ else if(type == typeof(int))
+ {
+ return Convert.ToDecimal((int)Value);
+ }
+ else if(type == typeof(uint))
+ {
+ return Convert.ToDecimal((uint)Value);
+ }
+ else if(type == typeof(long))
+ {
+ return Convert.ToDecimal((long)Value);
+ }
+ else if(type == typeof(ulong))
+ {
+ return Convert.ToDecimal((ulong)Value);
+ }
+ else if(type == typeof(float))
+ {
+ return Convert.ToDecimal((float)Value);
+ }
+ else if(type == typeof(double))
+ {
+ return Convert.ToDecimal((double)Value);
+ }
+ else if(type == typeof(Decimal))
+ {
+ return (Decimal)Value;
+ }
+ else if(type == typeof(String))
+ {
+ return Convert.ToDecimal((String)Value);
+ }
+ else if(type == typeof(bool))
+ {
+ return Convert.ToDecimal((bool)Value);
+ }
+ else
+ {
+ throw new InvalidCastException
+ (String.Format
+ (S._("VB_InvalidCast"),
+ Value.GetType(),
"System.Decimal"));
+ }
+ #endif
}
Index: DoubleType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/DoubleType.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** DoubleType.cs 29 May 2003 05:38:17 -0000 1.4
--- DoubleType.cs 29 May 2003 08:07:00 -0000 1.5
***************
*** 36,39 ****
--- 36,41 ----
private DoubleType() {}
+ #if !ECMA_COMPAT
+
// Convert a decimal value into a double value.
public static double DecimalToDouble(IConvertible ValueInterface)
***************
*** 42,45 ****
--- 44,49 ----
}
+ #endif
+
// Convert an object into a double value.
public static double FromObject(Object Value)
***************
*** 50,53 ****
--- 54,58 ----
(Object Value, NumberFormatInfo NumberFormat)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 76,79 ****
--- 81,154 ----
return 0.0;
}
+ #else
+ if(Value == null)
+ {
+ return 0;
+ }
+ Type type = Value.GetType();
+ if(type == typeof(byte))
+ {
+ return Convert.ToDouble((byte)Value);
+ }
+ else if(type == typeof(sbyte))
+ {
+ return Convert.ToDouble((sbyte)Value);
+ }
+ else if(type == typeof(short))
+ {
+ return Convert.ToDouble((short)Value);
+ }
+ else if(type == typeof(ushort))
+ {
+ return Convert.ToDouble((ushort)Value);
+ }
+ else if(type == typeof(char))
+ {
+ return Convert.ToDouble((char)Value);
+ }
+ else if(type == typeof(int))
+ {
+ return Convert.ToDouble((int)Value);
+ }
+ else if(type == typeof(uint))
+ {
+ return Convert.ToDouble((uint)Value);
+ }
+ else if(type == typeof(long))
+ {
+ return Convert.ToDouble((long)Value);
+ }
+ else if(type == typeof(ulong))
+ {
+ return Convert.ToDouble((ulong)Value);
+ }
+ else if(type == typeof(float))
+ {
+ return (double)(float)Value;
+ }
+ else if(type == typeof(double))
+ {
+ return (double)Value;
+ }
+ else if(type == typeof(Decimal))
+ {
+ return Convert.ToDouble((Decimal)Value);
+ }
+ else if(type == typeof(String))
+ {
+ return Convert.ToDouble((String)Value);
+ }
+ else if(type == typeof(bool))
+ {
+ return Convert.ToDouble((bool)Value);
+ }
+ else
+ {
+ throw new InvalidCastException
+ (String.Format
+ (S._("VB_InvalidCast"),
+ Value.GetType(),
"System.Double"));
+ }
+ #endif
}
Index: FlowControl.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/FlowControl.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** FlowControl.cs 29 May 2003 05:38:17 -0000 1.3
--- FlowControl.cs 29 May 2003 08:07:00 -0000 1.4
***************
*** 88,91 ****
--- 88,92 ----
private static Object CastToType(Object obj, TypeCode type)
{
+ #if !ECMA_COMPAT
switch(type)
{
***************
*** 115,118 ****
--- 116,122 ----
}
return obj;
+ #else
+ return obj;
+ #endif
}
Index: IntegerType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/IntegerType.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** IntegerType.cs 29 May 2003 05:38:17 -0000 1.4
--- IntegerType.cs 29 May 2003 08:07:00 -0000 1.5
***************
*** 35,38 ****
--- 35,40 ----
private IntegerType() {}
+ #if !ECMA_COMPAT
+
// Convert a decimal value into an integer.
public static int DecimalToInteger(IConvertible ValueInterface)
***************
*** 41,47 ****
--- 43,52 ----
}
+ #endif
+
// Convert an object into an integer value.
public static int FromObject(Object Value)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 70,73 ****
--- 75,81 ----
return 0;
}
+ #else
+ return
checked((int)(LongType.FromObject(Value)));
+ #endif
}
Index: LongType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/LongType.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** LongType.cs 29 May 2003 05:38:17 -0000 1.4
--- LongType.cs 29 May 2003 08:07:00 -0000 1.5
***************
*** 35,38 ****
--- 35,40 ----
private LongType() {}
+ #if !ECMA_COMPAT
+
// Convert a decimal value into a long.
public static long DecimalToLong(IConvertible ValueInterface)
***************
*** 41,47 ****
--- 43,52 ----
}
+ #endif
+
// Convert an object into a long value.
public static long FromObject(Object Value)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 70,73 ****
--- 75,150 ----
return 0;
}
+ #else
+ if(Value == null)
+ {
+ return 0;
+ }
+ Type type = Value.GetType();
+ if(type == typeof(byte))
+ {
+ return Convert.ToInt64((byte)Value);
+ }
+ else if(type == typeof(sbyte))
+ {
+ return Convert.ToInt64((sbyte)Value);
+ }
+ else if(type == typeof(short))
+ {
+ return Convert.ToInt64((short)Value);
+ }
+ else if(type == typeof(ushort))
+ {
+ return Convert.ToInt64((ushort)Value);
+ }
+ else if(type == typeof(char))
+ {
+ return Convert.ToInt64((char)Value);
+ }
+ else if(type == typeof(int))
+ {
+ return Convert.ToInt64((int)Value);
+ }
+ else if(type == typeof(uint))
+ {
+ return Convert.ToInt64((uint)Value);
+ }
+ else if(type == typeof(long))
+ {
+ return (long)Value;
+ }
+ else if(type == typeof(ulong))
+ {
+ return Convert.ToInt64((ulong)Value);
+ }
+ #if CONFIG_EXTENDED_NUMERICS
+ else if(type == typeof(float))
+ {
+ return Convert.ToInt64((float)Value);
+ }
+ else if(type == typeof(double))
+ {
+ return Convert.ToInt64((double)Value);
+ }
+ else if(type == typeof(Decimal))
+ {
+ return Convert.ToInt64((Decimal)Value);
+ }
+ #endif
+ else if(type == typeof(String))
+ {
+ return Convert.ToInt64((String)Value);
+ }
+ else if(type == typeof(bool))
+ {
+ return Convert.ToInt64((bool)Value);
+ }
+ else
+ {
+ throw new InvalidCastException
+ (String.Format
+ (S._("VB_InvalidCast"),
+ Value.GetType(),
"System.Int64"));
+ }
+ #endif
}
***************
*** 103,106 ****
--- 180,185 ----
str = Utils.FixDigits(str);
ch = str[posn];
+ #if !ECMA_COMPAT
+ // TODO: handle hex and octal in non-ECMA modes
if(ch == 'h' || ch == 'H')
{
***************
*** 116,119 ****
--- 195,199 ----
}
else
+ #endif
{
// Not a legitimate number format.
Index: ObjectType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/ObjectType.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** ObjectType.cs 29 May 2003 05:38:17 -0000 1.4
--- ObjectType.cs 29 May 2003 08:07:00 -0000 1.5
***************
*** 50,53 ****
--- 50,54 ----
o2 = o1;
}
+ #if !ECMA_COMPAT
if(o1 is IConvertible)
{
***************
*** 77,80 ****
--- 78,102 ----
}
}
+ #else
+ if(o1 is char[])
+ {
+ tc1 = TypeCode.String;
+ }
+ else
+ {
+ tc1 = GetTypeCode(o1);
+ }
+ if(tc2 == (TypeCode)(-1))
+ {
+ if(o2 is char[])
+ {
+ tc2 = TypeCode.String;
+ }
+ else
+ {
+ tc2 = GetTypeCode(o2);
+ }
+ }
+ #endif
// Handle the special case of string
comparisons.
***************
*** 257,260 ****
--- 279,283 ----
internal static TypeCode GetTypeCode(Object obj)
{
+ #if !ECMA_COMPAT
IConvertible ic = (obj as IConvertible);
if(ic != null)
***************
*** 266,269 ****
--- 289,362 ----
return TypeCode.Empty;
}
+ #else
+ if(obj == null)
+ {
+ return TypeCode.Empty;
+ }
+ if(obj is Boolean)
+ {
+ return TypeCode.Boolean;
+ }
+ else if(obj is Char)
+ {
+ return TypeCode.Char;
+ }
+ else if(obj is SByte)
+ {
+ return TypeCode.SByte;
+ }
+ else if(obj is Byte)
+ {
+ return TypeCode.Byte;
+ }
+ else if(obj is Int16)
+ {
+ return TypeCode.Int16;
+ }
+ else if(obj is UInt16)
+ {
+ return TypeCode.UInt16;
+ }
+ else if(obj is Int32)
+ {
+ return TypeCode.Int32;
+ }
+ else if(obj is UInt32)
+ {
+ return TypeCode.UInt32;
+ }
+ else if(obj is Int64)
+ {
+ return TypeCode.Int64;
+ }
+ else if(obj is UInt64)
+ {
+ return TypeCode.UInt64;
+ }
+ else if(obj is Single)
+ {
+ return TypeCode.Single;
+ }
+ else if(obj is Double)
+ {
+ return TypeCode.Double;
+ }
+ else if(obj is Decimal)
+ {
+ return TypeCode.Decimal;
+ }
+ else if(obj is DateTime)
+ {
+ return TypeCode.DateTime;
+ }
+ else if(obj is String)
+ {
+ return TypeCode.String;
+ }
+ else
+ {
+ return TypeCode.Empty;
+ }
+ #endif
}
***************
*** 637,640 ****
--- 730,734 ----
public static Object GetObjectValuePrimitive(Object o)
{
+ #if !ECMA_COMPAT
if(o == null)
{
***************
*** 688,691 ****
--- 782,786 ----
return
((IConvertible)o).ToDateTime(null);
}
+ #endif // !ECMA_COMPAT
return o;
}
***************
*** 1392,1395 ****
--- 1487,1491 ----
public static Object StrCatObj(Object o1, Object o2)
{
+ #if !ECMA_COMPAT
if(o1 is DBNull)
{
***************
*** 1400,1403 ****
--- 1496,1500 ----
o2 = String.Empty;
}
+ #endif
return StringType.FromObject(o1) +
StringType.FromObject(o2);
}
Index: ShortType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/ShortType.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** ShortType.cs 29 May 2003 05:38:17 -0000 1.4
--- ShortType.cs 29 May 2003 08:07:00 -0000 1.5
***************
*** 35,38 ****
--- 35,40 ----
private ShortType() {}
+ #if !ECMA_COMPAT
+
// Convert a decimal value into a short.
public static short DecimalToShort(IConvertible ValueInterface)
***************
*** 41,47 ****
--- 43,52 ----
}
+ #endif
+
// Convert an object into a short value.
public static short FromObject(Object Value)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 70,73 ****
--- 75,81 ----
return 0;
}
+ #else
+ return
checked((short)(LongType.FromObject(Value)));
+ #endif
}
Index: SingleType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/SingleType.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** SingleType.cs 29 May 2003 05:38:17 -0000 1.4
--- SingleType.cs 29 May 2003 08:07:00 -0000 1.5
***************
*** 36,39 ****
--- 36,41 ----
private SingleType() {}
+ #if !ECMA_COMPAT
+
// Convert a decimal value into a float value.
public static float DecimalToSingle(IConvertible ValueInterface)
***************
*** 42,45 ****
--- 44,49 ----
}
+ #endif
+
// Convert an object into a float value.
public static float FromObject(Object Value)
***************
*** 50,53 ****
--- 54,58 ----
(Object Value, NumberFormatInfo NumberFormat)
{
+ #if !ECMA_COMPAT
if(Value != null)
{
***************
*** 76,79 ****
--- 81,87 ----
return 0.0f;
}
+ #else
+ return (float)(DoubleType.FromObject(Value,
NumberFormat));
+ #endif
}
Index: StringType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/StringType.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** StringType.cs 29 May 2003 05:38:17 -0000 1.3
--- StringType.cs 29 May 2003 08:07:00 -0000 1.4
***************
*** 132,135 ****
--- 132,136 ----
return (String)Value;
}
+ #if !ECMA_COMPAT
else if(Value is IConvertible)
{
***************
*** 146,149 ****
--- 147,156 ----
Value.GetType(), "String"));
}
+ #else
+ else
+ {
+ return Value.ToString();
+ }
+ #endif
}
else
Index: Utils.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Basic/CompilerServices/Utils.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Utils.cs 29 May 2003 05:38:17 -0000 1.3
--- Utils.cs 29 May 2003 08:07:00 -0000 1.4
***************
*** 167,171 ****
// Create a string builder and output the
access level.
StringBuilder builder = new StringBuilder();
! if(Method.IsVirtual)
{
if(Method.DeclaringType.IsInterface)
--- 167,171 ----
// Create a string builder and output the
access level.
StringBuilder builder = new StringBuilder();
! if((Method.Attributes &
MethodAttributes.Virtual) != 0)
{
if(Method.DeclaringType.IsInterface)
***************
*** 221,225 ****
}
type = parameters[index].ParameterType;
! if(parameters[index].IsOptional)
{
builder.Append("Optional ");
--- 221,226 ----
}
type = parameters[index].ParameterType;
! if((parameters[index].Attributes
! &
ParameterAttributes.Optional) != 0)
{
builder.Append("Optional ");
***************
*** 233,236 ****
--- 234,238 ----
builder.Append("ByVal ");
}
+ #if !ECMA_COMPAT
if(type.IsArray &&
parameters[index].IsDefined
(typeof(ParamArrayAttribute), false))
***************
*** 238,241 ****
--- 240,244 ----
builder.Append("ParamArray ");
}
+ #endif
name = parameters[index].Name;
if(name != null)
***************
*** 249,252 ****
--- 252,256 ----
builder.Append(" As ");
AppendType(builder, returnType);
+ #if !ECMA_COMPAT
if(parameters[index].IsOptional)
{
***************
*** 271,274 ****
--- 275,279 ----
}
}
+ #endif
}
builder.Append(")");
***************
*** 289,293 ****
--- 294,300 ----
{
CultureInfo prev = CultureInfo.CurrentCulture;
+ #if !ECMA_COMPAT
Thread.CurrentThread.CurrentCulture = Culture;
+ #endif
return prev;
}
***************
*** 349,352 ****
--- 356,402 ----
}
return builder.ToString();
+ }
+
+ // Base time for OLE Automation values (Midnight, Dec 30, 1899).
+ private static readonly DateTime OLEBaseTime = new DateTime(1899, 12,
30);
+
+ // Convert an OLE Automation date into a DateTime value.
+ internal static DateTime FromOADate(double d)
+ {
+ // Convert the value into ticks, while checking
for overflow.
+ long ticks;
+ checked
+ {
+ try
+ {
+ ticks = ((long)(d *
(double)TimeSpan.TicksPerDay)) +
+
OLEBaseTime.Ticks;
+ }
+ catch(OverflowException)
+ {
+ throw new
ArgumentOutOfRangeException
+ ("d",
S._("ArgRange_DateTimeRange"));
+ }
+ }
+
+ // Convert the ticks into a DateTime value,
which will
+ // perform additional range checking.
+ return new DateTime(ticks);
+ }
+
+ // Convert this DateTime value into an OLE Automation date.
+ internal static double ToOADate(DateTime d)
+ {
+ long value_ = d.Ticks;
+ if(value_ == 0)
+ {
+ // Special case for uninitialized
DateTime values.
+ return 0.0;
+ }
+ else
+ {
+ return (((double)value_) /
((double)TimeSpan.TicksPerDay))
+ -
((double)OLEBaseTime.Ticks);
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/Basic/CompilerServices BooleanType.cs,1.3,1.4 ByteType.cs,1.4,1.5 CharArrayType.cs,1.3,1.4 CharType.cs,1.3,1.4 DateType.cs,1.3,1.4 DecimalType.cs,1.4,1.5 DoubleType.cs,1.4,1.5 FlowControl.cs,1.3,1.4 IntegerType.cs,1.4,1.5 LongType.cs,1.4,1.5 ObjectType.cs,1.4,1.5 ShortType.cs,1.4,1.5 SingleType.cs,1.4,1.5 StringType.cs,1.3,1.4 Utils.cs,1.3,1.4,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/Basic Basic.build,1.1,1.2 ErrObject.cs,1.4,1.5 FileSystem.cs,1.2,1.3 Information.cs,1.2,1.3
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/Basic/Ecma BinaryReader.cs,NONE,1.1 BinaryWriter.cs,NONE,1.1 BitConverter.cs,NONE,1.1 OptionalAttribute.cs,NONE,1.1 README,NONE,1.1 TypeCode.cs,NONE,1.1
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/Basic Basic.build,1.1,1.2 ErrObject.cs,1.4,1.5 FileSystem.cs,1.2,1.3 Information.cs,1.2,1.3
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/Basic/Ecma BinaryReader.cs,NONE,1.1 BinaryWriter.cs,NONE,1.1 BitConverter.cs,NONE,1.1 OptionalAttribute.cs,NONE,1.1 README,NONE,1.1 TypeCode.cs,NONE,1.1
- Index(es):