Browse Source

Convert spaces to tabs.

pull/1/head
Zoltan Varga 15 years ago committed by Andreia Gaita
parent
commit
c6c8291b41
  1. 11
      src/Mono.VisualC.Interop/ABI/CppAbi.cs
  2. 1
      src/Mono.VisualC.Interop/ABI/Impl/MsvcAbi.cs
  3. 2
      src/Mono.VisualC.Interop/ABI/VTable.cs
  4. 1
      src/Mono.VisualC.Interop/ABI/VTableManaged.cs
  5. 1
      src/Mono.VisualC.Interop/CppInstancePtr.cs
  6. 5
      src/Mono.VisualC.Interop/CppLibrary.cs
  7. 1
      src/Mono.VisualC.Interop/Util/DelegateTypeCache.cs
  8. 1
      src/Mono.VisualC.Interop/Util/MethodSignature.cs
  9. 1
      src/Mono.VisualC.Interop/Util/ReflectionHelper.cs

11
src/Mono.VisualC.Interop/ABI/CppAbi.cs

@ -22,7 +22,6 @@ namespace Mono.VisualC.Interop.ABI {
//FIXME: Exception handling, operator overloading etc. //FIXME: Exception handling, operator overloading etc.
//FIXME: Allow interface to override default calling convention //FIXME: Allow interface to override default calling convention
public abstract partial class CppAbi { public abstract partial class CppAbi {
protected ModuleBuilder impl_module; protected ModuleBuilder impl_module;
protected TypeBuilder impl_type; protected TypeBuilder impl_type;
@ -90,7 +89,6 @@ namespace Mono.VisualC.Interop.ABI {
var methods = GetMethods (); var methods = GetMethods ();
CppTypeInfo typeInfo = MakeTypeInfo (methods.Where (m => IsVirtual (m))); CppTypeInfo typeInfo = MakeTypeInfo (methods.Where (m => IsVirtual (m)));
// Implement all methods // Implement all methods
int vtableIndex = 0; int vtableIndex = 0;
foreach (var method in methods) foreach (var method in methods)
@ -102,7 +100,6 @@ namespace Mono.VisualC.Interop.ABI {
ctor_il.Emit (OpCodes.Ret); ctor_il.Emit (OpCodes.Ret);
return (Iface)Activator.CreateInstance (impl_type.CreateType (), typeInfo); return (Iface)Activator.CreateInstance (impl_type.CreateType (), typeInfo);
} }
@ -225,15 +222,12 @@ namespace Mono.VisualC.Interop.ABI {
case MethodType.NativeCtor: case MethodType.NativeCtor:
EmitConstruct (il, nativeMethod, parameterTypes, nativePtr); EmitConstruct (il, nativeMethod, parameterTypes, nativePtr);
break; break;
case MethodType.NativeDtor: case MethodType.NativeDtor:
EmitDestruct (il, nativeMethod, parameterTypes, cppInstancePtr, nativePtr); EmitDestruct (il, nativeMethod, parameterTypes, cppInstancePtr, nativePtr);
break; break;
default: default:
EmitCallNative (il, nativeMethod, isStatic, parameterTypes, nativePtr); EmitCallNative (il, nativeMethod, isStatic, parameterTypes, nativePtr);
break; break;
} }
il.Emit (OpCodes.Ret); il.Emit (OpCodes.Ret);
@ -253,7 +247,6 @@ namespace Mono.VisualC.Interop.ABI {
// C++ interface properties are either to return the CppTypeInfo or to access C++ fields // C++ interface properties are either to return the CppTypeInfo or to access C++ fields
if (retType.IsGenericType && retType.GetGenericTypeDefinition ().Equals (typeof (CppField<>))) { if (retType.IsGenericType && retType.GetGenericTypeDefinition ().Equals (typeof (CppField<>))) {
// define a new field for the property // define a new field for the property
// fieldData = impl_type.DefineField ("__" + propName + "_Data", retType, FieldAttributes.InitOnly | FieldAttributes.Private); // fieldData = impl_type.DefineField ("__" + propName + "_Data", retType, FieldAttributes.InitOnly | FieldAttributes.Private);
@ -366,7 +359,6 @@ namespace Mono.VisualC.Interop.ABI {
*/ */
protected virtual MethodBuilder GetMethodBuilder (MethodInfo interfaceMethod) protected virtual MethodBuilder GetMethodBuilder (MethodInfo interfaceMethod)
{ {
Type [] parameterTypes = ReflectionHelper.GetMethodParameterTypes (interfaceMethod); Type [] parameterTypes = ReflectionHelper.GetMethodParameterTypes (interfaceMethod);
MethodBuilder methodBuilder = impl_type.DefineMethod (interfaceMethod.Name, MethodAttributes.Public | MethodAttributes.Virtual, MethodBuilder methodBuilder = impl_type.DefineMethod (interfaceMethod.Name, MethodAttributes.Public | MethodAttributes.Virtual,
interfaceMethod.ReturnType, parameterTypes); interfaceMethod.ReturnType, parameterTypes);
@ -643,9 +635,6 @@ namespace Mono.VisualC.Interop.ABI {
il.MarkLabel (validRef); il.MarkLabel (validRef);
} }
} }
} }
} }

1
src/Mono.VisualC.Interop/ABI/Impl/MsvcAbi.cs

@ -190,7 +190,6 @@ namespace Mono.VisualC.Interop.ABI {
code.Append(mangleType.ElementTypeName); code.Append(mangleType.ElementTypeName);
code.Append ("@@"); code.Append ("@@");
break; break;
} }
return code.ToString (); return code.ToString ();

2
src/Mono.VisualC.Interop/ABI/VTable.cs

@ -19,7 +19,6 @@ namespace Mono.VisualC.Interop.ABI {
// TODO: RTTI .. support virtual inheritance // TODO: RTTI .. support virtual inheritance
public abstract class VTable : IDisposable { public abstract class VTable : IDisposable {
public static MakeVTableDelegate DefaultImplementation = VTableManaged.Implementation; public static MakeVTableDelegate DefaultImplementation = VTableManaged.Implementation;
protected CppTypeInfo typeInfo; protected CppTypeInfo typeInfo;
@ -69,7 +68,6 @@ namespace Mono.VisualC.Interop.ABI {
int currentOffset = typeInfo.VTableTopPadding; int currentOffset = typeInfo.VTableTopPadding;
for (int i = 0; i < EntryCount; i++) { for (int i = 0; i < EntryCount; i++) {
if (Marshal.ReadIntPtr (vtPtr, currentOffset) == IntPtr.Zero) if (Marshal.ReadIntPtr (vtPtr, currentOffset) == IntPtr.Zero)
Marshal.WriteIntPtr (vtPtr, currentOffset, Marshal.ReadIntPtr (basePtr, currentOffset)); Marshal.WriteIntPtr (vtPtr, currentOffset, Marshal.ReadIntPtr (basePtr, currentOffset));

1
src/Mono.VisualC.Interop/ABI/VTableManaged.cs

@ -51,5 +51,4 @@ namespace Mono.VisualC.Interop.ABI {
return nativeLayoutType; return nativeLayoutType;
} }
*/ */
} }

1
src/Mono.VisualC.Interop/CppInstancePtr.cs

@ -129,7 +129,6 @@ namespace Mono.VisualC.Interop {
// if we do not KNOW that this instance is managed. // if we do not KNOW that this instance is managed.
internal static T GetManaged<T> (IntPtr native, int nativeSize) where T : class internal static T GetManaged<T> (IntPtr native, int nativeSize) where T : class
{ {
IntPtr handlePtr = Marshal.ReadIntPtr (native, nativeSize); IntPtr handlePtr = Marshal.ReadIntPtr (native, nativeSize);
GCHandle handle = GCHandle.FromIntPtr (handlePtr); GCHandle handle = GCHandle.FromIntPtr (handlePtr);

5
src/Mono.VisualC.Interop/CppLibrary.cs

@ -37,7 +37,6 @@ namespace Mono.VisualC.Interop {
public CppLibrary (string name) public CppLibrary (string name)
{ {
if (name == null) if (name == null)
throw new ArgumentNullException ("Name cannot be NULL."); throw new ArgumentNullException ("Name cannot be NULL.");
@ -49,7 +48,6 @@ namespace Mono.VisualC.Interop {
public CppLibrary (string name, CppAbi abi) public CppLibrary (string name, CppAbi abi)
{ {
if (name == null) if (name == null)
throw new ArgumentNullException ("Name cannot be NULL."); throw new ArgumentNullException ("Name cannot be NULL.");
if (abi == null) if (abi == null)
@ -70,7 +68,6 @@ namespace Mono.VisualC.Interop {
public Iface GetClass<Iface> (string className) public Iface GetClass<Iface> (string className)
where Iface : ICppClass where Iface : ICppClass
{ {
return Abi.ImplementClass<Iface> (null, Name, className); return Abi.ImplementClass<Iface> (null, Name, className);
} }
@ -80,7 +77,6 @@ namespace Mono.VisualC.Interop {
where Iface : ICppClassInstantiatable where Iface : ICppClassInstantiatable
where NativeLayout : struct where NativeLayout : struct
{ {
return Abi.ImplementClass<Iface, NativeLayout> (null, Name, className); return Abi.ImplementClass<Iface, NativeLayout> (null, Name, className);
} }
@ -94,7 +90,6 @@ namespace Mono.VisualC.Interop {
where NativeLayout : struct where NativeLayout : struct
where Managed : ICppObject where Managed : ICppObject
{ {
return Abi.ImplementClass<Iface, NativeLayout> (typeof (Managed), Name, className); return Abi.ImplementClass<Iface, NativeLayout> (typeof (Managed), Name, className);
} }

1
src/Mono.VisualC.Interop/Util/DelegateTypeCache.cs

@ -20,7 +20,6 @@ namespace Mono.VisualC.Interop.Util {
private static Dictionary<DelegateSignature, Type> type_cache; private static Dictionary<DelegateSignature, Type> type_cache;
public static Type GetDelegateType (MethodInfo signature, CallingConvention? callingConvention) public static Type GetDelegateType (MethodInfo signature, CallingConvention? callingConvention)
{ {
return GetDelegateType (ReflectionHelper.GetMethodParameterTypes (signature), signature.ReturnType, callingConvention); return GetDelegateType (ReflectionHelper.GetMethodParameterTypes (signature), signature.ReturnType, callingConvention);

1
src/Mono.VisualC.Interop/Util/MethodSignature.cs

@ -59,7 +59,6 @@ namespace Mono.VisualC.Interop.Util {
ReturnType.Equals (other.ReturnType); ReturnType.Equals (other.ReturnType);
} }
public override int GetHashCode () public override int GetHashCode ()
{ {
unchecked { unchecked {

1
src/Mono.VisualC.Interop/Util/ReflectionHelper.cs

@ -76,7 +76,6 @@ namespace Mono.VisualC.Interop.Util {
marshalAsAttr = new CustomAttributeBuilder (ctor, args, fields, values); marshalAsAttr = new CustomAttributeBuilder (ctor, args, fields, values);
attr = attr | ParameterAttributes.HasFieldMarshal; attr = attr | ParameterAttributes.HasFieldMarshal;
} else */ if (forPInvoke && existingMarshalAs != null) { } else */ if (forPInvoke && existingMarshalAs != null) {
// FIXME: This still doesn't feel like it's working right.. especially for virtual functions // FIXME: This still doesn't feel like it's working right.. especially for virtual functions
ConstructorInfo ctor = typeof (MarshalAsAttribute).GetConstructor (new Type[] { typeof (UnmanagedType) }); ConstructorInfo ctor = typeof (MarshalAsAttribute).GetConstructor (new Type[] { typeof (UnmanagedType) });

Loading…
Cancel
Save