dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_coerce.c codegen/cg_l...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog codegen/cg_coerce.c codegen/cg_l...
Date: Tue, 18 Nov 2008 20:06:09 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      08/11/18 20:06:08

Modified files:
        .              : ChangeLog 
        codegen        : cg_coerce.c cg_library.c cg_lvalue.tc 
                         cg_resolve.c 
        cscc           : csdoc.c 
        cscc/c         : c_invoke.tc c_library.c c_lvalue.tc c_typeout.c 
                         c_types.c 
        cscc/csharp    : cs_attrs.c cs_gather.c cs_invoke.tc 
                         cs_lvalue.tc 
        cscc/java      : java_gather.c java_invoke.tc java_lvalue.tc 
        csdoc          : doc_valil.c il2doc.c 
        dumpasm        : dump_class.c 
        engine         : call.c heap.c jitc.c layout.c lib_array.c 
                         lib_emit.c lib_marshal.c lib_reflect.c 
                         lib_type.c pinvoke.c verify_branch.c 
        ilalink        : link_class.c link_create.c link_library.c 
                         link_main.c link_module.c link_type.c linker.h 
        ilasm          : ilasm_build.c ilasm_build.h ilasm_grammar.y 
        image          : class.c generic_class.c item.c java_loader.c 
                         java_writer.c lib_attrs.c member.c meta_build.c 
                         meta_types.c meta_writer.c misc_token.c 
                         program.h ser_parse.c synthetic.c 
        include        : il_program.h il_types.h 

Log message:
        Make parent of an ILClass an ILProgramItem to be able to hold TypeSpecs 
too.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3582&r2=1.3583
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_coerce.c?cvsroot=dotgnu-pnet&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_library.c?cvsroot=dotgnu-pnet&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_resolve.c?cvsroot=dotgnu-pnet&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csdoc.c?cvsroot=dotgnu-pnet&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_invoke.tc?cvsroot=dotgnu-pnet&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_library.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_typeout.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_types.c?cvsroot=dotgnu-pnet&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_attrs.c?cvsroot=dotgnu-pnet&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_gather.c?cvsroot=dotgnu-pnet&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_invoke.tc?cvsroot=dotgnu-pnet&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_gather.c?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_invoke.tc?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/csdoc/doc_valil.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/csdoc/il2doc.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/dumpasm/dump_class.c?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/call.c?cvsroot=dotgnu-pnet&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/heap.c?cvsroot=dotgnu-pnet&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc.c?cvsroot=dotgnu-pnet&r1=1.87&r2=1.88
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/layout.c?cvsroot=dotgnu-pnet&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_array.c?cvsroot=dotgnu-pnet&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_emit.c?cvsroot=dotgnu-pnet&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_marshal.c?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_reflect.c?cvsroot=dotgnu-pnet&r1=1.82&r2=1.83
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_type.c?cvsroot=dotgnu-pnet&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/pinvoke.c?cvsroot=dotgnu-pnet&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/verify_branch.c?cvsroot=dotgnu-pnet&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_class.c?cvsroot=dotgnu-pnet&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_create.c?cvsroot=dotgnu-pnet&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_library.c?cvsroot=dotgnu-pnet&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_main.c?cvsroot=dotgnu-pnet&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_module.c?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_type.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/linker.h?cvsroot=dotgnu-pnet&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_build.c?cvsroot=dotgnu-pnet&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_build.h?cvsroot=dotgnu-pnet&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_grammar.y?cvsroot=dotgnu-pnet&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/pnet/image/class.c?cvsroot=dotgnu-pnet&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/pnet/image/generic_class.c?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pnet/image/item.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/image/java_loader.c?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnet/image/java_writer.c?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnet/image/lib_attrs.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/image/member.c?cvsroot=dotgnu-pnet&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_build.c?cvsroot=dotgnu-pnet&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_types.c?cvsroot=dotgnu-pnet&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_writer.c?cvsroot=dotgnu-pnet&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pnet/image/misc_token.c?cvsroot=dotgnu-pnet&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pnet/image/program.h?cvsroot=dotgnu-pnet&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pnet/image/ser_parse.c?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnet/image/synthetic.c?cvsroot=dotgnu-pnet&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_program.h?cvsroot=dotgnu-pnet&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_types.h?cvsroot=dotgnu-pnet&r1=1.29&r2=1.30

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3582
retrieving revision 1.3583
diff -u -b -r1.3582 -r1.3583
--- ChangeLog   11 Nov 2008 08:41:40 -0000      1.3582
+++ ChangeLog   18 Nov 2008 20:06:03 -0000      1.3583
@@ -1,3 +1,77 @@
+2008-11-18  Klaus Treichel  <address@hidden>
+
+       * include/il_program.h (ILClassCreate, ILClassSetParent): Change 
parameter
+       parent from     ILClass * to ILProgramItem *.
+       (ILClassGetParent): Change return value from ILClass * to
+       ILProgramItem *.
+       (ILProgramItemToUnderlyingClass, ILClassGetParentClass, 
ILTypeSpecImport):
+       Add new support functions and the corresponding macros.
+
+       * include/il_types.c (ILTypeImport): Add new support function.
+
+       * codegen/cg_coerce.c, codegen/cg_library.c, codegen/cg_lvalue.tc,
+       codegen/cg_resolve.c, cscc/csdoc.c, cscc/c/c_invoke.tc,
+       cscc/c/c_library.c, cscc/c/c_lvalue.tc, cscc/c/c_typeout.c,
+       cscc/c/c_types.c, cscc/csharp/cs_attrs.c, cscc/csharp/cs_gather.c,
+       cscc/csharp/cs_invoke.tc, cscc/csharp/cs_lvalue.tc,
+       cscc/java/java_gather.c, cscc/java/java_invoke.tc,
+       cscc/java/java_lvalue.tc, csdoc/doc_valil.c, dumpasm/dump_class.c,
+       engine/call.c, engine/heap.c, engine/jitc.c, engine/layout.c,
+       engine/lib_array.c, engine/lib_emit.c, engine/lib_marshal.c,
+       engine/lib_reflect.c, engine/lib_type.c, engine/pinvoke.c,
+       engine/verify_branch.c, ilalink/link_module.c, ilasm/ilasm_build.c,
+       ilasm/ilasm_build.h, ilasm/ilasm_grammar.y, image/generic_class.c,
+       image/member.c, image/meta_build.c, image/meta_types.c,
+       image/java_loader.c, image/java_writer.c, image/misc_token.c,
+       image/ser_parse.c, image/synthetic.c: Replace invokation of
+       ILClass_Parent with ILClass_ParentClass. Adjust the parent parameter
+       types. Use ILClass_UnderlyingParentClass instead of ILClass_Parent
+       where appropriate.
+
+       * ilalink/link_create.c, ilalink/link_library.c, ilalink/link_main.c,
+       image/meta_build.c, image/member.c: Fix some formatting.
+
+       * csdoc/il2doc.c (PrintProgramItemWithFlags): Add function to print a
+       class' parent.
+
+       * ilalink/link_class.c: Replace ConvertClass by three functions to do
+       the import of TypeDefs into the new image in three steps for avoiding
+       to create temporary TypeRefs for parents and implemented interfaces
+       and for being able to process TypeSpecs correctly for parents and
+       implemented interfaces.
+
+       * image/program.h: Change member parend of an ILClass record from
+       ILClass to ILProgramItem to be able to reflect the generrics structure
+       better. Add some internal helprt macros for converting an ILProgramItem
+       to the real program item in a safe way without having to do function
+       calls.
+
+       * image/class.c (CreateClass, ILClassCreate, ILClassSetParent): Change
+       parameter type of parent from ILClass * to ILProgramItem *.
+       (ILClassGetParent): Change return type from ILClass to ILProgramItem.
+       (ILClassGetUnderlyingParentClass, ILClassGetParentClass): Add new
+       support functions.
+
+       * image/lib_attrs.c, image/member.c, image/meta_build.c: Use the new
+       internal conversion macros where appropriate.
+
+       * image/meta_types.c (ILTypeImport): Add support function for importing
+       a type from a foreign image.
+
+       * image/meta_writer.c (Format_TypeDef): Use the new function
+       ProgramItemToToken for retrieving the parent token.
+
+       * image/misc_token.c (ILTypeSpecImport): Add support function for
+       importing a TypeSpec from a foreign image.
+
+       * image/item.c (ILProgramItemToUnderlyingClass): Add support function
+       for retrieving the underlying parent class or implemented interface.
+
+       * ilalink/link_type.c (_ILLinkerConvertProgramItemRef): Add function
+       for converting parent classes and implemented interfaces 
+
+       * ilalink/linker.h (_ILLinkerConvertProgramItemRef): Add prototype.
+
 2008-11-11  Heiko Weiss <address@hidden>
 
        * engine/lib_string.c: small bugfix.

Index: codegen/cg_coerce.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_coerce.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- codegen/cg_coerce.c 8 Jun 2004 08:16:26 -0000       1.27
+++ codegen/cg_coerce.c 18 Nov 2008 20:06:03 -0000      1.28
@@ -1,7 +1,7 @@
 /*
  * cg_coerce.c - Coercions and casts.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -701,7 +701,7 @@
                                }
                        }
                }
-               arg1Class = ILClass_Parent(arg1Class);
+               arg1Class = ILClass_ParentClass(arg1Class);
        }
 
        while(arg2Class != 0)
@@ -744,7 +744,7 @@
                                }
                        }
                }
-               arg2Class = ILClass_Parent(arg2Class);
+               arg2Class = ILClass_ParentClass(arg2Class);
        }
        
        if(bestMember)
@@ -803,7 +803,7 @@
                                }
                        }
                }
-               arg1Class = ILClass_Parent(arg1Class);
+               arg1Class = ILClass_ParentClass(arg1Class);
        }
 
        while(arg2Class != 0)
@@ -844,7 +844,7 @@
                                }
                        }
                }
-               arg2Class = ILClass_Parent(arg2Class);
+               arg2Class = ILClass_ParentClass(arg2Class);
        }
 
        if(bestMember)

Index: codegen/cg_library.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_library.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- codegen/cg_library.c        22 Feb 2003 11:21:01 -0000      1.20
+++ codegen/cg_library.c        18 Nov 2008 20:06:03 -0000      1.21
@@ -1,7 +1,7 @@
 /*
  * cg_library.c - Routines for manipulating the builtin C# library.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -83,7 +83,7 @@
  * Make a value type.
  */
 static void MakeValueType(ILGenInfo *info, ILImage *image,
-                                                 const char *name, ILClass 
*parent,
+                                                 const char *name, 
ILProgramItem *parent,
                                                  ILClass *stringClass)
 {
        ILClass *newClass;
@@ -300,7 +300,8 @@
 
        /* Create the "System.String" class */
        ABORT_IF(stringClass,
-                        ILClassCreate(scope, 0, "String", "System", 
objectClass));
+                        ILClassCreate(scope, 0, "String", "System",
+                                                  
ILToProgramItem(objectClass)));
        ILClassSetAttrs(stringClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -309,7 +310,8 @@
 
        /* Create the "System.Type" class */
        ABORT_IF(typeClass,
-                        ILClassCreate(scope, 0, "Type", "System", 
objectClass));
+                        ILClassCreate(scope, 0, "Type", "System",
+                                                  
ILToProgramItem(objectClass)));
        ILClassSetAttrs(typeClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -349,7 +351,8 @@
 
        /* Create the "System.ValueType" class */
        ABORT_IF(valueTypeClass,
-                        ILClassCreate(scope, 0, "ValueType", "System", 
objectClass));
+                        ILClassCreate(scope, 0, "ValueType", "System",
+                                                  
ILToProgramItem(objectClass)));
        ILClassSetAttrs(valueTypeClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                        IL_META_TYPEDEF_BEFORE_FIELD_INIT |
@@ -358,7 +361,8 @@
 
        /* Create the "System.Enum" class */
        ABORT_IF(enumClass,
-                        ILClassCreate(scope, 0, "Enum", "System", 
valueTypeClass));
+                        ILClassCreate(scope, 0, "Enum", "System",
+                                                  
ILToProgramItem(valueTypeClass)));
        ILClassSetAttrs(enumClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                        IL_META_TYPEDEF_ABSTRACT |
@@ -368,7 +372,8 @@
 
        /* Create the "System.Void" class */
        ABORT_IF(voidClass,
-                        ILClassCreate(scope, 0, "Void", "System", 
valueTypeClass));
+                        ILClassCreate(scope, 0, "Void", "System",
+                                                  
ILToProgramItem(valueTypeClass)));
        ILClassSetAttrs(voidClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_VALUE_TYPE |
@@ -376,21 +381,33 @@
                                        IL_META_TYPEDEF_SEALED);
 
        /* Create the numeric value types */
-       MakeValueType(info, image, "SByte", valueTypeClass, stringClass);
-       MakeValueType(info, image, "Byte", valueTypeClass, stringClass);
-       MakeValueType(info, image, "Int16", valueTypeClass, stringClass);
-       MakeValueType(info, image, "UInt16", valueTypeClass, stringClass);
-       MakeValueType(info, image, "Int32", valueTypeClass, stringClass);
-       MakeValueType(info, image, "UInt32", valueTypeClass, stringClass);
-       MakeValueType(info, image, "Int64", valueTypeClass, stringClass);
-       MakeValueType(info, image, "UInt64", valueTypeClass, stringClass);
-       MakeValueType(info, image, "Single", valueTypeClass, stringClass);
-       MakeValueType(info, image, "Double", valueTypeClass, stringClass);
-       MakeValueType(info, image, "Decimal", valueTypeClass, stringClass);
+       MakeValueType(info, image, "SByte", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "Byte", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "Int16", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "UInt16", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "Int32", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "UInt32", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "Int64", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "UInt64", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "Single", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "Double", ILToProgramItem(valueTypeClass),
+                                 stringClass);
+       MakeValueType(info, image, "Decimal", ILToProgramItem(valueTypeClass),
+                                 stringClass);
 
        /* Create the "System.IntPtr" class */
        ABORT_IF(intPtrClass,
-                        ILClassCreate(scope, 0, "IntPtr", "System", 
valueTypeClass));
+                        ILClassCreate(scope, 0, "IntPtr", "System",
+                                                  
ILToProgramItem(valueTypeClass)));
        ILClassSetAttrs(intPtrClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_VALUE_TYPE |
@@ -400,7 +417,8 @@
 
        /* Create the "System.UIntPtr" class */
        ABORT_IF(uintPtrClass,
-                        ILClassCreate(scope, 0, "UIntPtr", "System", 
valueTypeClass));
+                        ILClassCreate(scope, 0, "UIntPtr", "System",
+                                                  
ILToProgramItem(valueTypeClass)));
        ILClassSetAttrs(uintPtrClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_VALUE_TYPE |
@@ -411,7 +429,7 @@
        /* Create the "System.TypedReference" class */
        ABORT_IF(typedRefClass,
                         ILClassCreate(scope, 0, "TypedReference", "System",
-                                                  valueTypeClass));
+                                                  
ILToProgramItem(valueTypeClass)));
        ILClassSetAttrs(typedRefClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_VALUE_TYPE |
@@ -422,7 +440,7 @@
        /* Create the "System.ArgIterator" class */
        ABORT_IF(argIterClass,
                         ILClassCreate(scope, 0, "ArgIterator", "System",
-                                                  valueTypeClass));
+                                                  
ILToProgramItem(valueTypeClass)));
        ILClassSetAttrs(argIterClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_VALUE_TYPE |
@@ -433,7 +451,7 @@
        /* Create the "System.RuntimeArgumentHandle" class */
        ABORT_IF(argHandleClass,
                         ILClassCreate(scope, 0, "RuntimeArgumentHandle", 
"System",
-                                                  valueTypeClass));
+                                                  
ILToProgramItem(valueTypeClass)));
        ILClassSetAttrs(argHandleClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_VALUE_TYPE |
@@ -444,7 +462,7 @@
        /* Create the "System.Attribute" class */
        ABORT_IF(attributeClass,
                         ILClassCreate(scope, 0, "Attribute", "System",
-                                                  objectClass));
+                                                  
ILToProgramItem(objectClass)));
        ILClassSetAttrs(attributeClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -454,7 +472,7 @@
        /* Create the "System.ParamArrayAttribute" class */
        ABORT_IF(paramAttributeClass,
                         ILClassCreate(scope, 0, "ParamArrayAttribute", 
"System",
-                                                  attributeClass));
+                                                  
ILToProgramItem(attributeClass)));
        ILClassSetAttrs(paramAttributeClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -465,7 +483,8 @@
        /* Create the "System.Reflection.DefaultMemberAttribute" class */
        ABORT_IF(defMemberAttributeClass,
                         ILClassCreate(scope, 0, "DefaultMemberAttribute",
-                                                  "System.Reflection", 
attributeClass));
+                                                  "System.Reflection",
+                                                  
ILToProgramItem(attributeClass)));
        ILClassSetAttrs(defMemberAttributeClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -479,7 +498,7 @@
        ABORT_IF(decimalConstantClass,
                         ILClassCreate(scope, 0, "DecimalConstantAttribute",
                                                   
"System.Runtime.CompilerServices",
-                                                  attributeClass));
+                                                  
ILToProgramItem(attributeClass)));
        ILClassSetAttrs(decimalConstantClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -490,7 +509,7 @@
        /* Create the "System.Exception" class */
        ABORT_IF(exceptionClass,
                         ILClassCreate(scope, 0, "Exception", "System",
-                                                  objectClass));
+                                                  
ILToProgramItem(objectClass)));
        ILClassSetAttrs(exceptionClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -559,7 +578,7 @@
        ABORT_IF(isVolatileClass,
                         ILClassCreate(scope, 0, "IsVolatile",
                                                   
"System.Runtime.CompilerServices",
-                                                  objectClass));
+                                                  
ILToProgramItem(objectClass)));
        ILClassSetAttrs(isVolatileClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                        IL_META_TYPEDEF_SEALED |
@@ -569,7 +588,8 @@
 
        /* Create the "System.Delegate" class */
        ABORT_IF(delegateClass,
-                        ILClassCreate(scope, 0, "Delegate", "System", 
objectClass));
+                        ILClassCreate(scope, 0, "Delegate", "System",
+                                                  
ILToProgramItem(objectClass)));
        ILClassSetAttrs(delegateClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -593,7 +613,7 @@
        /* Create the "System.MulticastDelegate" class */
        ABORT_IF(multicastDelegateClass,
                         ILClassCreate(scope, 0, "MulticastDelegate", "System",
-                                                  delegateClass));
+                                                  
ILToProgramItem(delegateClass)));
        ILClassSetAttrs(multicastDelegateClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |
@@ -617,7 +637,7 @@
        /* Create the "AsyncCallback" delegate class */
        ABORT_IF(asyncCallbackClass,
                         ILClassCreate(scope, 0, "AsyncCallback", "System",
-                                                  multicastDelegateClass));
+                                                  
ILToProgramItem(multicastDelegateClass)));
        ILClassSetAttrs(asyncCallbackClass, ~0,
                                        IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SERIALIZABLE |

Index: codegen/cg_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_lvalue.tc,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- codegen/cg_lvalue.tc        19 Oct 2008 16:45:17 -0000      1.28
+++ codegen/cg_lvalue.tc        18 Nov 2008 20:06:03 -0000      1.29
@@ -4,7 +4,7 @@
 /*
  * cg_lvalue.tc - Identifier and l-value nodes.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -234,7 +234,7 @@
 {
        ILClass *classInfo = ((ILNode_ClassDefn *)(info->currentClass))
                                                                        
->classInfo;
-       ILType *type =ILClassToType(ILClass_Parent(classInfo));
+       ILType *type =ILClassToType(ILClass_ParentClass(classInfo));
        ILMachineType machineType;
  
        /* Do we need to unpack a value type instance? */

Index: codegen/cg_resolve.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_resolve.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- codegen/cg_resolve.c        26 Feb 2003 06:44:31 -0000      1.15
+++ codegen/cg_resolve.c        18 Nov 2008 20:06:03 -0000      1.16
@@ -1,7 +1,7 @@
 /*
  * cg_resolve.c - Resolve methods, fields, operators, etc.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -163,7 +163,7 @@
                }
                else
                {
-                       classInfo = (dontInherit ? 0 : 
ILClass_Parent(classInfo));
+                       classInfo = (dontInherit ? 0 : 
ILClass_ParentClass(classInfo));
                }
        }
 
@@ -319,7 +319,7 @@
                }
                else
                {
-                       classInfo = (dontInherit ? 0 : 
ILClass_Parent(classInfo));
+                       classInfo = (dontInherit ? 0 : 
ILClass_ParentClass(classInfo));
                }
        }
 

Index: cscc/csdoc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csdoc.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- cscc/csdoc.c        1 Jun 2007 11:08:51 -0000       1.26
+++ cscc/csdoc.c        18 Nov 2008 20:06:04 -0000      1.27
@@ -1,7 +1,7 @@
 /*
  * csdoc.c - C# documentation extraction utility.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1313,7 +1313,7 @@
        fputs("<TypeSignature Language=\"ILASM\" Value=\".class ", stream);
        ILDumpFlags(stream, ILClass_Attrs(classInfo), ILTypeDefinitionFlags, 0);
        DumpString(defn->name, stream);
-       parent = ILClass_Parent(classInfo);
+       parent = ILClass_UnderlyingParentClass(classInfo);
        if(parent)
        {
                fputs(" extends ", stream);

Index: cscc/c/c_invoke.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_invoke.tc,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- cscc/c/c_invoke.tc  7 Mar 2004 04:26:19 -0000       1.15
+++ cscc/c/c_invoke.tc  18 Nov 2008 20:06:04 -0000      1.16
@@ -1,7 +1,7 @@
 /*
  * c_invoke.tc - Function invocation handling for C.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -643,7 +643,7 @@
                }
                else
                {
-                       classInfo = ILClass_Parent(classInfo);
+                       classInfo = ILClass_ParentClass(classInfo);
                }
        }
 

Index: cscc/c/c_library.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_library.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- cscc/c/c_library.c  6 Mar 2004 11:04:45 -0000       1.14
+++ cscc/c/c_library.c  18 Nov 2008 20:06:04 -0000      1.15
@@ -1,7 +1,7 @@
 /*
  * c_library.c - Register the builtin support library.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@
 {
        ILClass *classInfo;
        ABORT_IF(classInfo, ILClassCreate
-                               (scope, 0, name, "OpenSystem.C", parent));
+                               (scope, 0, name, "OpenSystem.C", 
ILToProgramItem(parent)));
        ILClassSetAttrs(classInfo, ~0,
                                    IL_META_TYPEDEF_PUBLIC |
                                    IL_META_TYPEDEF_SEALED |

Index: cscc/c/c_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_lvalue.tc,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- cscc/c/c_lvalue.tc  19 Oct 2008 16:45:17 -0000      1.26
+++ cscc/c/c_lvalue.tc  18 Nov 2008 20:06:04 -0000      1.27
@@ -1,7 +1,7 @@
 /*
  * c_lvalue.tc - L-value node handling for C.
  *
- * Copyright (C) 2002, 2004  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2004, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -634,7 +634,7 @@
                                        }
                                }
                        }
-                       tempClass = ILClass_Parent(tempClass);
+                       tempClass = ILClass_ParentClass(tempClass);
                }
        }
 
@@ -701,7 +701,7 @@
                                }
                        }
                }
-               tempClass = ILClass_Parent(tempClass);
+               tempClass = ILClass_ParentClass(tempClass);
        }
 
        /* If we get here, then we were unable to find anything */

Index: cscc/c/c_typeout.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_typeout.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- cscc/c/c_typeout.c  28 May 2007 14:40:35 -0000      1.8
+++ cscc/c/c_typeout.c  18 Nov 2008 20:06:04 -0000      1.9
@@ -1,7 +1,7 @@
 /*
  * c_typeout.c - Send types to an assembly output stream.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -218,7 +218,7 @@
                fputs("beforefieldinit ", stream);
        }
        ILDumpIdentifier(stream, ILClass_Name(classInfo), 0, 
IL_DUMP_QUOTE_NAMES);
-       parent = ILClass_Parent(classInfo);
+       parent = ILClass_UnderlyingParentClass(classInfo);
        if(parent)
        {
                fputs(" extends ", stream);

Index: cscc/c/c_types.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_types.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- cscc/c/c_types.c    19 Oct 2008 16:45:18 -0000      1.51
+++ cscc/c/c_types.c    18 Nov 2008 20:06:04 -0000      1.52
@@ -1,7 +1,7 @@
 /*
  * c_types.c - Type representation for the C programming language.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -292,7 +292,7 @@
        /* Create the class that corresponds to the array type */
        classInfo = ILType_ToClass(ILFindSystemType(info, "ValueType"));
        classInfo = ILClassCreate(ILClassGlobalScope(info->image), 0,
-                                                         name, 0, classInfo);
+                                                         name, 0, 
ILToProgramItem(classInfo));
        if(!classInfo)
        {
                ILGenOutOfMemory(info);
@@ -584,7 +584,7 @@
        classInfo = ILType_ToValueType(type);
        parent = ILType_ToClass(ILFindSystemType(info, "ValueType"));
        classInfo = ILClassCreate(ILClassGlobalScope(info->image), 0,
-                                                         
ILClass_Name(classInfo), 0, parent);
+                                                         
ILClass_Name(classInfo), 0, ILToProgramItem(parent));
        if(!classInfo)
        {
                ILGenOutOfMemory(info);
@@ -669,7 +669,7 @@
 
        /* Create the anonymous type */
        parentInfo = ILType_ToClass(ILFindSystemType(info, "ValueType"));
-       classInfo = ILClassCreate(scope, 0, newName, 0, parentInfo);
+       classInfo = ILClassCreate(scope, 0, newName, 0, 
ILToProgramItem(parentInfo));
        if(!classInfo)
        {
                ILGenOutOfMemory(info);
@@ -700,7 +700,7 @@
        classInfo = ILType_ToValueType(type);
        parent = ILType_ToClass(ILFindSystemType(info, "Enum"));
        classInfo = ILClassCreate(ILClassGlobalScope(info->image), 0,
-                                                         
ILClass_Name(classInfo), 0, parent);
+                                                         
ILClass_Name(classInfo), 0, ILToProgramItem(parent));
        if(!classInfo)
        {
                ILGenOutOfMemory(info);
@@ -767,7 +767,7 @@
        /* Create the anonymous type */
        parent = ILType_ToClass(ILFindSystemType(info, "Enum"));
        classInfo = ILClassCreate(ILClassGlobalScope(info->image), 0,
-                                                         newName, 0, parent);
+                                                         newName, 0, 
ILToProgramItem(parent));
        if(!classInfo)
        {
                ILGenOutOfMemory(info);
@@ -1487,7 +1487,7 @@
 
                /* Create a new type and clone the original structure into it */
                newClass = ILClassCreate(ILClassGlobalScope(info->image), 0,
-                                                            newName, 0, 
ILClass_ParentRef(classInfo));
+                                                            newName, 0, 
ILToProgramItem(ILClass_ParentRef(classInfo)));
                if(!newClass)
                {
                        ILGenOutOfMemory(info);
@@ -2914,7 +2914,7 @@
                /* Create the alignment measuring type for the first time */
                classInfo = ILType_ToClass(ILFindSystemType(info, "ValueType"));
                classInfo = ILClassCreate(ILClassGlobalScope(info->image), 0,
-                                                                 name, 0, 
classInfo);
+                                                                 name, 0, 
ILToProgramItem(classInfo));
                if(!classInfo)
                {
                        ILGenOutOfMemory(info);

Index: cscc/csharp/cs_attrs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_attrs.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- cscc/csharp/cs_attrs.c      19 Oct 2008 16:45:18 -0000      1.30
+++ cscc/csharp/cs_attrs.c      18 Nov 2008 20:06:04 -0000      1.31
@@ -1,7 +1,7 @@
 /*
  * cs_attrs.c - Attribute handling.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -188,7 +188,7 @@
                        /* Method, event, or something else that is not usable 
*/
                        return 0;
                }
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
        return 0;
 }

Index: cscc/csharp/cs_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_gather.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- cscc/csharp/cs_gather.c     19 Oct 2008 16:45:18 -0000      1.60
+++ cscc/csharp/cs_gather.c     18 Nov 2008 20:06:04 -0000      1.61
@@ -1,7 +1,7 @@
 /*
  * cs_gather.c - "Type gathering" support for the C# compiler.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -528,7 +528,7 @@
                        {
                                if(parent && !ILClass_IsInterface(classInfo))
                                {
-                                       ILClassSetParent(classInfo, parent);
+                                       ILClassSetParent(classInfo, 
ILToProgramItem(parent));
                                }
                        }
 
@@ -553,7 +553,7 @@
 
                        if(ILClassResolve(classInfo) != ILClassResolve(parent))
                        {
-                               ILClassSetParent(classInfo, parent);
+                               ILClassSetParent(classInfo, 
ILToProgramItem(parent));
                        }
                }
        }
@@ -871,7 +871,7 @@
                }
 
                /* Move up to the parent of this class */
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
        return 0;
 }
@@ -943,7 +943,7 @@
                }
 
                /* Move up to the parent of this class */
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
        return 0;
 }
@@ -1274,7 +1274,7 @@
  */
 static int IsRealFinalizer(ILClass *classInfo)
 {
-       ILClass *parent = ILClass_Parent(classInfo);
+       ILClass *parent = ILClass_UnderlyingParentClass(classInfo);
        ILMethod *method;
        ILType *signature;
        while(parent != 0)
@@ -1303,7 +1303,7 @@
                                }
                        }
                }
-               parent = ILClass_Parent(parent);
+               parent = ILClass_UnderlyingParentClass(parent);
        }
        return 0;
 }
@@ -2356,7 +2356,7 @@
        if(ILType_IsClass(type))
        {
                ILClass *classInfo = ILClassResolve(ILType_ToClass(type));
-               ILClass *parent = ILClass_Parent(classInfo);
+               ILClass *parent = ILClass_UnderlyingParentClass(classInfo);
                if(parent)
                {
                        const char *namespace = ILClass_Namespace(parent);
@@ -2600,7 +2600,7 @@
        ILMethod *method2;
 
        /* Scan up through the parents and look for all "abstract" methods */
-       parent = ILClass_Parent(classInfo);
+       parent = ILClass_ParentClass(classInfo);
        while(parent != 0)
        {
                method = 0;
@@ -2625,7 +2625,7 @@
                                {
                                        break;
                                }
-                               tempClass = ILClass_Parent(tempClass);
+                               tempClass = ILClass_ParentClass(tempClass);
                                method2 = 0;
                        }
 
@@ -2637,7 +2637,7 @@
                                                          
CSItemToName(ILToProgramItem(method)));
                        }
                }
-               parent = ILClass_Parent(parent);
+               parent = ILClass_ParentClass(parent);
        }
 }
 

Index: cscc/csharp/cs_invoke.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_invoke.tc,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- cscc/csharp/cs_invoke.tc    1 Jun 2007 11:08:51 -0000       1.32
+++ cscc/csharp/cs_invoke.tc    18 Nov 2008 20:06:04 -0000      1.33
@@ -1,7 +1,7 @@
 /*
  * cs_invoke.tc - Semantic analysis for method invocation.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1000,7 +1000,7 @@
           bail out with an empty method group.  This tells
           "InvocationExpression" to ignore the call */
        classInfo = ((ILNode_ClassDefn *)(info->currentClass))->classInfo;
-       parentInfo = (classInfo ? ILClass_Parent(classInfo) : 0);
+       parentInfo = (classInfo ? ILClass_ParentClass(classInfo) : 0);
        if(!parentInfo)
        {
                CSSemSetMethodGroup(value, 0);

Index: cscc/csharp/cs_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lvalue.tc,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- cscc/csharp/cs_lvalue.tc    19 Oct 2008 16:45:18 -0000      1.68
+++ cscc/csharp/cs_lvalue.tc    18 Nov 2008 20:06:04 -0000      1.69
@@ -1,7 +1,7 @@
 /*
  * cs_lvalue.tc - Semantic analysis for C# identifiers and l-values.
  *
- * Copyright (C) 2001, 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1523,7 +1523,7 @@
        }
 
        /* Find the parent class to start searching from */
-       classInfo = ILClass_Parent(ILMethod_Owner(caller->methodInfo));
+       classInfo = ILClass_ParentClass(ILMethod_Owner(caller->methodInfo));
        if(!classInfo)
        {
                CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
@@ -1578,7 +1578,7 @@
        }
 
        /* Find the parent class to start searching from */
-       classInfo = ILClass_Parent(ILMethod_Owner(caller->methodInfo));
+       classInfo = ILClass_ParentClass(ILMethod_Owner(caller->methodInfo));
        if(!classInfo)
        {
                CCErrorOnLine(yygetfilename(node), yygetlinenum(node),

Index: cscc/java/java_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_gather.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- cscc/java/java_gather.c     19 Oct 2008 16:45:18 -0000      1.4
+++ cscc/java/java_gather.c     18 Nov 2008 20:06:05 -0000      1.5
@@ -1,7 +1,7 @@
 /*
  * java_gather.c - Type gathering operations for Java
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  * Copyright (C) 2003  Gopal.V
  *
  * This program is free software; you can redistribute it and/or modify
@@ -578,7 +578,7 @@
        }
 
        /* Create the class information block */
-       classInfo = ILClassCreate(nestedScope, 0, name, package, parent);
+       classInfo = ILClassCreate(nestedScope, 0, name, package, 
ILToProgramItem(parent));
        if(!classInfo)
        {
                CCOutOfMemory();
@@ -682,7 +682,7 @@
                }
 
                /* Move up to the parent of this class */
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
        return 0;
 }
@@ -738,7 +738,7 @@
                }
 
                /* Move up to the parent of this class */
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
        return 0;
 }

Index: cscc/java/java_invoke.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_invoke.tc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- cscc/java/java_invoke.tc    5 May 2007 15:56:42 -0000       1.2
+++ cscc/java/java_invoke.tc    18 Nov 2008 20:06:05 -0000      1.3
@@ -1,7 +1,7 @@
 /*
  * java_invoke.tc - Semantic analysis for Java method invocations 
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  * Copyright (C) 2003  Gopal.V
  *
  * This program is free software; you can redistribute it and/or modify
@@ -857,7 +857,7 @@
           bail out with an empty method group.  This tells
           "InvocationExpression" to ignore the call */
        classInfo = ((ILNode_ClassDefn *)(info->currentClass))->classInfo;
-       parentInfo = (classInfo ? ILClass_Parent(classInfo) : 0);
+       parentInfo = (classInfo ? ILClass_ParentClass(classInfo) : 0);
        if(!parentInfo)
        {
                JavaSemSetMethodGroup(value, 0);

Index: cscc/java/java_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_lvalue.tc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- cscc/java/java_lvalue.tc    19 Oct 2008 16:45:18 -0000      1.3
+++ cscc/java/java_lvalue.tc    18 Nov 2008 20:06:05 -0000      1.4
@@ -1,7 +1,7 @@
 /*
  * java_lvalue.tc - Semantic analysis for Java Identifiers and other l-values 
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  * Copyright (C) 2003  Gopal.V
  *
  * This program is free software; you can redistribute it and/or modify
@@ -963,7 +963,7 @@
        }
 
        /* Find the parent class to start searching from */
-       classInfo = ILClass_Parent(ILMethod_Owner(caller->methodInfo));
+       classInfo = ILClass_ParentClass(ILMethod_Owner(caller->methodInfo));
        if(!classInfo)
        {
                CCErrorOnLine(yygetfilename(node), yygetlinenum(node),

Index: csdoc/doc_valil.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csdoc/doc_valil.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- csdoc/doc_valil.c   3 Feb 2008 09:52:48 -0000       1.14
+++ csdoc/doc_valil.c   18 Nov 2008 20:06:05 -0000      1.15
@@ -1,7 +1,7 @@
 /*
  * doc_valil.c - Validate that an IL program implements a csdoc specification.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -447,7 +447,7 @@
  */
 static int IsDelegateType(ILClass *classInfo)
 {
-       ILClass *parent = ILClass_Parent(classInfo);
+       ILClass *parent = ILClass_UnderlyingParentClass(classInfo);
        const char *name;
        while(parent != 0)
        {
@@ -460,7 +460,7 @@
                                return 1;
                        }
                }
-               parent = ILClass_Parent(parent);
+               parent = ILClass_UnderlyingParentClass(parent);
        }
        return 0;
 }
@@ -3151,7 +3151,7 @@
        }
 
        /* Validate the base type */
-       parent = ILClass_Parent(classInfo);
+       parent = ILClass_ParentClass(classInfo);
        if(!parent)
        {
                if(type->baseType)
@@ -3247,7 +3247,7 @@
                                }
                                ILFree(fullName);
                        }
-                       tempClass = ILClass_Parent(tempClass);
+                       tempClass = ILClass_ParentClass(tempClass);
                }
                if(!implemented)
                {

Index: csdoc/il2doc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csdoc/il2doc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- csdoc/il2doc.c      12 Nov 2007 19:06:47 -0000      1.8
+++ csdoc/il2doc.c      18 Nov 2008 20:06:05 -0000      1.9
@@ -1,7 +1,7 @@
 /*
  * il2doc.c - Convert an IL binary into XML documentation form.
  *
- * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2003, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1771,6 +1771,30 @@
 #define        PrintClassName(classInfo, scope)        
PrintClassNameWithFlags((classInfo), (scope), 0)
 
 /*
+ * Print a ProgramItem that can be an ILClass or ILTypeSpec as used for
+ * baseclasses, implemented interfaces or parents of members in generic 
classes.
+ */
+static void PrintProgramItemWithFlags(ILProgramItem *item, ILProgramItem 
*scope, int flags)
+{
+       ILClass *classInfo;
+       ILTypeSpec *spec;
+
+       if((classInfo = ILProgramItemToClass(item)) != 0)
+       {
+               PrintClassNameWithFlags(classInfo, scope, flags);
+       }
+#if IL_VERSION_MAJOR > 1
+       else if((spec = ILProgramItemToTypeSpec(item)) != 0)
+       {
+               ILType *type;
+
+               type = ILTypeSpec_Type(spec);
+               PrintWithType(type, scope, flags);
+       }
+#endif
+}
+
+/*
  * Dump attribute information for a program item.
  */
 static void DumpAttributes(ILProgramItem *item)
@@ -1801,17 +1825,17 @@
 /*
  * Dump base class information.
  */
-static void DumpBases(ILClass *classInfo, ILClass *baseClass,
+static void DumpBases(ILClass *classInfo, ILProgramItem *base,
                                          ILImplements *impl, const char 
*extends,
                                          const char *extendsNoBase,
                                          const char *implements,
                                          const char *implementsSeparator,
                                          int flags)
 {
-       if(baseClass)
+       if(base)
        {
                fputs(extends, stdout);
-               PrintClassNameWithFlags(baseClass, ILToProgramItem(classInfo), 
flags);
+               PrintProgramItemWithFlags(base, ILToProgramItem(classInfo), 
flags);
                if(!impl)
                {
                        return;
@@ -2731,7 +2755,7 @@
  */
 static int InheritsFrom(ILClass *classInfo, const char *name)
 {
-       classInfo = ILClass_Parent(classInfo);
+       classInfo = ILClass_UnderlyingParentClass(classInfo);
        while(classInfo != 0)
        {
                if(!strcmp(ILClass_Name(classInfo), name) &&
@@ -2740,7 +2764,7 @@
                {
                        return 1;
                }
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_UnderlyingParentClass(classInfo);
        }
        return 0;
 }
@@ -2762,7 +2786,7 @@
 static void DumpClass(ILClass *classInfo)
 {
        ILAssembly *assem;
-       ILClass *baseClass;
+       ILProgramItem *baseClass;
        ILImplements *impl;
        ILMember *member;
        int isDelegate;
@@ -2865,7 +2889,7 @@
        if(baseClass)
        {
                fputs("<Base><BaseTypeName>", stdout);
-               PrintClassNameWithFlags(baseClass, ILToProgramItem(classInfo), 
DUMP_STYLE_CSHARP);
+               PrintProgramItemWithFlags(baseClass, 
ILToProgramItem(classInfo), DUMP_STYLE_CSHARP);
                fputs("</BaseTypeName></Base>\n", stdout);
        }
        else

Index: dumpasm/dump_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/dumpasm/dump_class.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- dumpasm/dump_class.c        20 Sep 2007 20:04:17 -0000      1.5
+++ dumpasm/dump_class.c        18 Nov 2008 20:06:05 -0000      1.6
@@ -1,7 +1,7 @@
 /*
  * dump_class.c - Disassemble class information.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -447,7 +447,7 @@
                if(ILClass_Parent(info))
                {
                        fputs("\n    extends ", outstream);
-                       DumpClassName(outstream, image, ILClass_Parent(info), 
flags, 1);
+                       DumpClassName(outstream, image, 
ILClass_ParentClass(info), flags, 1);
                }
                first = 1;
                impl = 0;

Index: engine/call.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/call.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- engine/call.c       16 Sep 2006 20:30:50 -0000      1.44
+++ engine/call.c       18 Nov 2008 20:06:05 -0000      1.45
@@ -1,7 +1,7 @@
 /*
  * call.c - External interface for calling methods using the engine.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1291,7 +1291,7 @@
                        }
                        implements = implements->next;
                }
-               parent = ILClassGetParent(searchClass->classInfo);
+               parent = ILClass_ParentClass(searchClass->classInfo);
                if(!parent)
                {
                        break;

Index: engine/heap.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/heap.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- engine/heap.c       7 Jan 2007 16:28:53 -0000       1.28
+++ engine/heap.c       18 Nov 2008 20:06:05 -0000      1.29
@@ -1,7 +1,7 @@
 /*
  * heap.c - Heap routines for the runtime engine.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -94,7 +94,7 @@
                                }
                        }
                }
-               classInfo = ILClassGetParent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
 
        return 0;

Index: engine/jitc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -b -r1.87 -r1.88
--- engine/jitc.c       29 Sep 2008 10:53:06 -0000      1.87
+++ engine/jitc.c       18 Nov 2008 20:06:05 -0000      1.88
@@ -1,7 +1,7 @@
 /*
  * jitc.c - Coder implementation for JIT output.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1837,7 +1837,7 @@
                        }
                        implements = implements->next;
                }
-               parent = ILClassGetParent(searchClass->classInfo);
+               parent = ILClass_ParentClass(searchClass->classInfo);
                if(!parent)
                {
                        break;
@@ -1887,7 +1887,7 @@
                        }
                        implements = implements->next;
                }
-               parent = ILClassGetParent(searchClass->classInfo);
+               parent = ILClass_ParentClass(searchClass->classInfo);
                if(!parent)
                {
                        break;
@@ -4461,7 +4461,7 @@
                if(info->parent)
                {
                        /* The parent class must be laid out at this point */
-                       ILClass *parent = ILClassGetParent(info);
+                       ILClass *parent = ILClass_ParentClass(info);
 
                        if(parent && parent->userData)
                        {

Index: engine/layout.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/layout.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- engine/layout.c     21 Sep 2008 17:40:37 -0000      1.48
+++ engine/layout.c     18 Nov 2008 20:06:05 -0000      1.49
@@ -1,7 +1,7 @@
 /*
  * layout.c - Type and object layout algorithms.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -359,7 +359,7 @@
        if(classInfo->parent)
        {
                /* Use "ILClassGetParent" to resolve cross-image links */
-               ILClass *parent = ILClassGetParent(classInfo);
+               ILClass *parent = ILClass_ParentClass(classInfo);
 
                if(!_ILGCBuildTypeDescriptor(parent, bitmap, checkBitmap, 
classOffset))
                {
@@ -419,7 +419,7 @@
                if(classInfo->parent)
                {
                        /* Use "ILClassGetParent" to resolve cross-image links 
*/
-                       ILClass *parent = ILClassGetParent(classInfo);
+                       ILClass *parent = ILClass_ParentClass(classInfo);
 
                        if(!_ILGCBuildTypeDescriptor(parent, bitmap, 
checkBitmap, IL_OBJECT_HEADER_SIZE))
                        {
@@ -738,7 +738,7 @@
                                }
                        }
                }
-               info = ILClassGetParent(info);
+               info = ILClass_ParentClass(info);
        }
        return 0;
 }
@@ -789,7 +789,7 @@
        /* Determine if the parent class implements the interface */
        parent = info;
        impl2 = 0;
-       while(impl2 == 0 && (parent = ILClassGetParent(parent)) != 0)
+       while(impl2 == 0 && (parent = ILClass_ParentClass(parent)) != 0)
        {
                impl2 = ((ILClassPrivate *)(parent->userData))->implements;
                while(impl2 != 0)
@@ -880,7 +880,7 @@
                                {
                                        break;
                                }
-                               parent = ILClassGetParent(parent);
+                               parent = ILClass_ParentClass(parent);
                        }
                }
 
@@ -1041,7 +1041,7 @@
                {
                        break;
                }
-               parentPrivate = (ILClassPrivate*) 
(ILClassGetParent(parentPrivate->classInfo)->userData);
+               parentPrivate = (ILClassPrivate*) 
(ILClass_ParentClass(parentPrivate->classInfo)->userData);
        }
 
        /* Clear positions in the table that indicate conflicts */
@@ -1156,7 +1156,7 @@
        if(info->parent)
        {
                /* Use "ILClassGetParent" to resolve cross-image links */
-               parent = ILClassGetParent(info);
+               parent = ILClass_ParentClass(info);
                if(ILClassNeedsExpansion(parent))
                {
                        /* This can happen when a non-generic class inherits 
from a generic class */
@@ -1166,7 +1166,7 @@
                                info->userData = 0;
                                return 0;
                        }
-                       info->parent = parent;
+                       info->parent = ILToProgramItem(parent);
                }
                if(!LayoutClass(process, parent, layout))
                {

Index: engine/lib_array.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_array.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- engine/lib_array.c  21 Aug 2008 12:20:38 -0000      1.33
+++ engine/lib_array.c  18 Nov 2008 20:06:05 -0000      1.34
@@ -1,7 +1,7 @@
 /*
  * lib_array.c - Internalcall methods for "System.Array" and subclasses.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1762,7 +1762,7 @@
 static int IsMArrayClass(ILClass *classInfo)
 {
        const char *name;
-       classInfo = ILClass_Parent(classInfo);
+       classInfo = ILClass_ParentClass(classInfo);
        if(!classInfo)
        {
                return 0;
@@ -2538,7 +2538,7 @@
        {
                ILClass *classInfo;
                const char *name;
-               classInfo = ILClass_Parent(GetObjectClass(array));
+               classInfo = ILClass_ParentClass(GetObjectClass(array));
                if(!classInfo)
                {
                        return 0;

Index: engine/lib_emit.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_emit.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- engine/lib_emit.c   17 Dec 2006 10:31:32 -0000      1.30
+++ engine/lib_emit.c   18 Nov 2008 20:06:06 -0000      1.31
@@ -1,7 +1,7 @@
 /*
  * lib_emit.c - Internalcall methods for the "Reflection.Emit" classes.
  *
- * Copyright (C) 2002, 2003  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2003, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1122,7 +1122,8 @@
                return 0;
        }
 
-       if ((retval = ILClassCreate(scope, 0, typeName, nameSpace, baseClass)))
+       if ((retval = ILClassCreate(scope, 0, typeName, nameSpace,
+                                                               
ILToProgramItem(baseClass))))
        {
                ILClassSetAttrs(retval, (ILUInt32)-1, (ILUInt32)attr);
        }
@@ -1289,7 +1290,7 @@
                ILExecThreadThrowOutOfMemory(_thread);
                return;
        }
-       ILClassSetParent(class, parentClass);
+       ILClassSetParent(class, ILToProgramItem(parentClass));
 
        IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
 }

Index: engine/lib_marshal.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_marshal.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- engine/lib_marshal.c        17 Dec 2006 10:31:32 -0000      1.11
+++ engine/lib_marshal.c        18 Nov 2008 20:06:06 -0000      1.12
@@ -1,7 +1,7 @@
 /*
  * lib_marshal.c - Internalcall methods for the Marshal class.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -158,7 +158,7 @@
                                        return offset;
                                }
                        }
-                       classInfo = ILClass_Parent(classInfo);
+                       classInfo = ILClass_ParentClass(classInfo);
                }
                IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
        }

Index: engine/lib_reflect.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_reflect.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- engine/lib_reflect.c        10 Aug 2008 16:16:14 -0000      1.82
+++ engine/lib_reflect.c        18 Nov 2008 20:06:06 -0000      1.83
@@ -1,7 +1,7 @@
 /*
  * lib_reflect.c - Internalcall methods for the reflection classes.
  *
- * Copyright (C) 2001, 2002, 2003  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2002, 2003, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@
                                        ++num;
                                }
                        }
-                       classInfo = ILClassGetParent(classInfo);
+                       classInfo = ILClass_ParentClass(classInfo);
                }
        }
        else
@@ -463,7 +463,7 @@
                                                ++buffer;
                                        }
                                }
-                               classInfo = ILClassGetParent(classInfo);
+                               classInfo = ILClass_ParentClass(classInfo);
                        }
                }
                else

Index: engine/lib_type.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_type.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- engine/lib_type.c   14 Sep 2007 00:55:42 -0000      1.54
+++ engine/lib_type.c   18 Nov 2008 20:06:06 -0000      1.55
@@ -1,7 +1,7 @@
 /*
  * lib_type.c - Internalcall methods for "Type" and related classes.
  *
- * Copyright (C) 2001, 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -807,7 +807,7 @@
                        return _ILGetClrType(thread, interfaceClassInfo);
                }
                /* Move up to the parent of this class */
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
        return 0;
 #else
@@ -838,7 +838,7 @@
        }
 
        // Traverse up into the parent class as well
-       count += GetMaxInterfaces(ILClassGetParent(classInfo));
+       count += GetMaxInterfaces(ILClass_ParentClass(classInfo));
        return count;
 }
 
@@ -878,7 +878,7 @@
        }
 
        // Traverse up into the parent class as well
-       posn = FillWithInterfaces(thread, ILClassGetParent(classInfo), array, 
posn);
+       posn = FillWithInterfaces(thread, ILClass_ParentClass(classInfo), 
array, posn);
        return posn;
 }
 
@@ -1065,7 +1065,7 @@
        ILClass *classInfo = _ILGetClrClass(thread, _this);
        if(classInfo)
        {
-               ILClass *parent = ILClass_Parent(classInfo);
+               ILClass *parent = ILClass_ParentClass(classInfo);
                if(parent)
                {
                        return _ILGetClrType(thread, parent);
@@ -2319,7 +2319,7 @@
                }
 
                /* Move up the class hierarchy */
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
        while(classInfo != 0 &&
              (bindingAttrs & (ILInt32)BF_DeclaredOnly) == 0);
@@ -2562,7 +2562,7 @@
                }
 
                /* Move up the class hierarchy */
-               classInfo = ILClass_Parent(classInfo);
+               classInfo = ILClass_ParentClass(classInfo);
        }
        while(classInfo != 0 &&
              (bindingAttrs & (ILInt32)BF_DeclaredOnly) == 0);
@@ -2657,7 +2657,7 @@
                                ++size;
                        }
                }
-               info = ILClass_Parent(info);
+               info = ILClass_ParentClass(info);
        }
 
        /* Allocate an array to hold the serializable fields */
@@ -2685,7 +2685,7 @@
                                        (_thread, &(field->member.programItem));
                        }
                }
-               info = ILClass_Parent(info);
+               info = ILClass_ParentClass(info);
        }
 
        /* Return the final array to the caller */

Index: engine/pinvoke.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/pinvoke.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- engine/pinvoke.c    10 Oct 2005 20:03:15 -0000      1.30
+++ engine/pinvoke.c    18 Nov 2008 20:06:06 -0000      1.31
@@ -1,7 +1,7 @@
 /*
  * pinvoke.c - Handle PInvoke and "internalcall" methods within the engine.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -110,7 +110,7 @@
        ffi_type *ffi;
 
        /* Process the parent class first */
-       parent = ILClassGetParent(classInfo);
+       parent = ILClass_ParentClass(classInfo);
        if(parent)
        {
                if(!PopulateStructFFI(process, parent, fieldTypes, posn))
@@ -182,7 +182,7 @@
                                        ++numFields;
                                }
                        }
-                       current = ILClassGetParent(current);
+                       current = ILClass_ParentClass(current);
                }
                explicitSize = 0;
                explicitAlignment = 0;

Index: engine/verify_branch.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/verify_branch.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- engine/verify_branch.c      14 Jul 2008 18:32:19 -0000      1.18
+++ engine/verify_branch.c      18 Nov 2008 20:06:06 -0000      1.19
@@ -1,7 +1,7 @@
 /*
  * verify_branch.c - Verify instructions related to branching.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -154,7 +154,7 @@
 
        classInfo=ILClassFromType(image, 0, type2, 0);
        
-       if((classInfo=ILClassGetParent(classInfo))!=NULL)
+       if((classInfo = ILClass_ParentClass(classInfo)) != NULL)
        {
                return TryCommonType(image, type1, ILClassToType(classInfo));
        }

Index: ilalink/link_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_class.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- ilalink/link_class.c        4 Oct 2008 20:13:23 -0000       1.17
+++ ilalink/link_class.c        18 Nov 2008 20:06:06 -0000      1.18
@@ -1,7 +1,7 @@
 /*
  * link_class.c - Convert classes and copy them to the final image.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,37 +25,47 @@
 #endif
 
 /*
- * Convert a class and copy it to a destination image.
+ * Copy a class declaration to the destination image.
  */
-static int ConvertClass(ILLinker *linker, ILClass *classInfo,
+static int CreateClass(ILLinker *linker, ILClass *classInfo,
                                                ILClass *nestedParent)
 {
        ILProgramItem *scope;
+       ILProgramItem *parent;
        ILClass *newClass;
-       ILClass *parent;
        const char *name;
        const char *namespace;
        char *newName = 0;
        int isModule = 0;
-       ILClassLayout *layout;
-       ILImplements *implements;
-       ILImplements *newImplements;
-       ILNestedInfo *nested;
-       ILMember *member;
        ILLibraryFind find;
+       ILNestedInfo *nested;
 
-       /* Convert the parent class reference */
-       parent = ILClass_ParentRef(classInfo);
+       parent = ILClass_Parent(classInfo);
        if(parent)
        {
-               parent = _ILLinkerConvertClassRef(linker, parent);
-               if(!parent)
+               if(!ILProgramItemToTypeSpec(parent))
+               {
+                       /* Parent is a real class */
+                       ILClass *parentClass;
+
+                       parentClass = ILClass_ParentRef(classInfo);
+                       if(!parentClass)
                {
                        return 0;
                }
+                       parentClass = _ILLinkerConvertClassRef(linker, 
parentClass);
+                       if(!parentClass)
+                       {
+                               return 0;
+                       }
+                       parent = ILToProgramItem(parentClass);
+               }
+               else
+               {
+                       parent = 0;
+               }
        }
 
-       /* Create a new class record within the output image */
        if(nestedParent)
        {
                scope = (ILProgramItem *)nestedParent;
@@ -168,52 +178,69 @@
                ILClassSetAttrs(newClass, ~((ILUInt32)0), 
ILClass_Attrs(classInfo));
        }
 
-       /* Convert the custom attributes */
-       if(!_ILLinkerConvertAttrs(linker, (ILProgramItem *)classInfo,
-                                                         (ILProgramItem 
*)newClass))
+       /* Record the new class in the original class */
+       ILClassSetUserData(classInfo, (void *)newClass);
+
+       /* Create the typedef records for the nested classes */
+       nested = 0;
+       while((nested = ILClassNextNested(classInfo, nested)) != 0)
+       {
+               if(!CreateClass(linker, ILNestedInfoGetChild(nested), newClass))
        {
                return 0;
        }
+       }
 
-       /* Convert the security declarations */
-       if(!_ILLinkerConvertSecurity(linker, (ILProgramItem *)classInfo,
-                                                            (ILProgramItem 
*)newClass))
+       return 1;
+}
+
+/*
+ * Convert the class parents and the implemented interfaces.
+ */
+static int ConvertClassParents(ILLinker *linker, ILClass *classInfo)
+{
+       ILClass *newClass;
+       ILProgramItem *parent;
+       ILImplements *implements;
+       ILImplements *newImplements;
+       ILNestedInfo *nested;
+
+       newClass = (ILClass *)ILClassGetUserData(classInfo);
+       if(!newClass)
        {
                return 0;
        }
 
-       /* Convert the debug information that is attached to the class */
-       if(!_ILLinkerConvertDebug(linker, (ILProgramItem *)classInfo,
-                                                         (ILProgramItem 
*)newClass))
+       parent = ILClass_Parent(classInfo);
+       if(parent)
        {
-               return 0;
-       }
+               ILTypeSpec *parentSpec;
 
-       /* Copy the class layout information */
-       layout = ILClassLayoutGetFromOwner(classInfo);
-       if(layout)
+               if((parentSpec = ILProgramItemToTypeSpec(parent)) != 0)
        {
-               layout = ILClassLayoutCreate(linker->image, 0, newClass,
-                                                                        
ILClassLayout_PackingSize(layout),
-                                                                        
ILClassLayout_ClassSize(layout));
-               if(!layout)
+                       /* Parent is a TypSpec */
+                       parent = _ILLinkerConvertProgramItemRef(linker, parent);
+                       if(!parent)
                {
-                       _ILLinkerOutOfMemory(linker);
                        return 0;
                }
+                       ILClassSetParent(newClass, parent);
+               }
        }
 
        /* Copy the interface list */
        implements = 0;
        while((implements = ILClassNextImplements(classInfo, implements)) != 0)
        {
-               parent = _ILLinkerConvertClassRef
+               ILClass *interface;
+
+               interface = _ILLinkerConvertClassRef
                                        (linker, 
ILImplementsGetInterface(implements));
-               if(!parent)
+               if(!interface)
                {
                        return 0;
                }
-               newImplements = ILClassAddImplements(newClass, parent, 0);
+               newImplements = ILClassAddImplements(newClass, interface, 0);
                if(!newImplements)
                {
                        _ILLinkerOutOfMemory(linker);
@@ -226,6 +253,70 @@
                }
        }
 
+       /* Create the parents for the nested classes. */
+       nested = 0;
+       while((nested = ILClassNextNested(classInfo, nested)) != 0)
+       {
+               if(!ConvertClassParents(linker, ILNestedInfoGetChild(nested)))
+               {
+                       return 0;
+               }
+       }
+
+       return 1;
+}
+
+/*
+ * Convert the class members and attributes.
+ */
+static int ConvertClassMembers(ILLinker *linker, ILClass *classInfo)
+{
+       ILClass *newClass;
+       ILClassLayout *layout;
+       ILMember *member;
+       ILNestedInfo *nested;
+
+       newClass = (ILClass *)ILClassGetUserData(classInfo);
+       if(!newClass)
+       {
+               return 0;
+       }
+
+       /* Convert the custom attributes */
+       if(!_ILLinkerConvertAttrs(linker, (ILProgramItem *)classInfo,
+                                                         (ILProgramItem 
*)newClass))
+       {
+               return 0;
+       }
+
+       /* Convert the security declarations */
+       if(!_ILLinkerConvertSecurity(linker, (ILProgramItem *)classInfo,
+                                                            (ILProgramItem 
*)newClass))
+       {
+               return 0;
+       }
+
+       /* Convert the debug information that is attached to the class */
+       if(!_ILLinkerConvertDebug(linker, (ILProgramItem *)classInfo,
+                                                         (ILProgramItem 
*)newClass))
+       {
+               return 0;
+       }
+
+       /* Copy the class layout information */
+       layout = ILClassLayoutGetFromOwner(classInfo);
+       if(layout)
+       {
+               layout = ILClassLayoutCreate(linker->image, 0, newClass,
+                                                                        
ILClassLayout_PackingSize(layout),
+                                                                        
ILClassLayout_ClassSize(layout));
+               if(!layout)
+               {
+                       _ILLinkerOutOfMemory(linker);
+                       return 0;
+               }
+       }
+
 #if IL_VERSION_MAJOR > 1
        /* Convert the generic parameters, if any */
        if(!_ILLinkerConvertGenerics(linker, (ILProgramItem *)classInfo,
@@ -288,17 +379,19 @@
                }
        }
 
-       /* Convert the nested classes */
+       /* Create the members and attributes for the nested classes. */
        nested = 0;
        while((nested = ILClassNextNested(classInfo, nested)) != 0)
        {
-               if(!ConvertClass(linker, ILNestedInfoGetChild(nested), 
newClass))
+               if(!ConvertClassMembers(linker, ILNestedInfoGetChild(nested)))
                {
                        return 0;
                }
        }
 
-       /* Done */
+       /* Clear the userdata in the original class */
+       ILClassSetUserData(classInfo, 0);
+
        return 1;
 }
 
@@ -313,7 +406,33 @@
        {
                if(ILClassGetNestedParent(classInfo) == 0)
                {
-                       if(!ConvertClass(linker, classInfo, 0))
+                       if(!CreateClass(linker, classInfo, 0))
+                       {
+                               return 0;
+                       }
+               }
+       }
+
+       /* Now set parents and interfaces in the new classes */
+       while((classInfo = (ILClass *)ILImageNextToken
+                               (image, IL_META_TOKEN_TYPE_DEF, classInfo)) != 
0)
+       {
+               if(ILClassGetNestedParent(classInfo) == 0)
+               {
+                       if(!ConvertClassParents(linker, classInfo))
+                       {
+                               return 0;
+                       }
+               }
+       }
+
+       /* Now copy members and attributes to the new classes */
+       while((classInfo = (ILClass *)ILImageNextToken
+                               (image, IL_META_TOKEN_TYPE_DEF, classInfo)) != 
0)
+       {
+               if(ILClassGetNestedParent(classInfo) == 0)
+               {
+                       if(!ConvertClassMembers(linker, classInfo))
                        {
                                return 0;
                        }

Index: ilalink/link_create.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_create.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- ilalink/link_create.c       5 May 2007 15:56:42 -0000       1.33
+++ ilalink/link_create.c       18 Nov 2008 20:06:06 -0000      1.34
@@ -1,7 +1,7 @@
 /*
  * link_create.c - Create and destroy linker contexts.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

Index: ilalink/link_library.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_library.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- ilalink/link_library.c      5 May 2007 15:56:42 -0000       1.29
+++ ilalink/link_library.c      18 Nov 2008 20:06:06 -0000      1.30
@@ -1,7 +1,7 @@
 /*
  * link_library.c - Process libraries within a linker context.
  *
- * Copyright (C) 2001, 2003, 2004  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2003, 2004, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

Index: ilalink/link_main.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_main.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- ilalink/link_main.c 2 Aug 2005 14:13:41 -0000       1.28
+++ ilalink/link_main.c 18 Nov 2008 20:06:06 -0000      1.29
@@ -1,7 +1,7 @@
 /*
  * link_main.c - Link IL images together to form an assembly.
  *
- * Copyright (C) 2001, 2002, 2003  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2002, 2003, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -805,14 +805,14 @@
        }
 
        /* Add the libraries to the linker context */
-       for(temp = 0; temp < numLibraries; ++temp)
-       {
-               errors |= addLibrary(linker, libraries[temp]);
-       }
        if(useStdlib)
        {
                errors |= addLibrary(linker, stdLibrary);
        }
+       for(temp = 0; temp < numLibraries; ++temp)
+       {
+               errors |= addLibrary(linker, libraries[temp]);
+       }
 
        /* Set the metadata version in the assembly's header */
        ILLinkerSetMetadataVersion(linker, metadataVersion, stdLibrary);

Index: ilalink/link_module.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_module.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- ilalink/link_module.c       15 Mar 2004 22:51:28 -0000      1.7
+++ ilalink/link_module.c       18 Nov 2008 20:06:06 -0000      1.8
@@ -1,7 +1,7 @@
 /*
  * link_module.c - Module linking routines for C-style applications.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -309,7 +309,7 @@
                        }
                        linker->moduleClass = ILClassCreate
                                (ILClassGlobalScope(linker->image), 0,
-                                linker->moduleName, 0, parent);
+                                linker->moduleName, 0, 
ILToProgramItem(parent));
                        if(!(linker->moduleClass))
                        {
                                _ILLinkerOutOfMemory(linker);

Index: ilalink/link_type.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_type.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- ilalink/link_type.c 5 Oct 2008 14:21:50 -0000       1.14
+++ ilalink/link_type.c 18 Nov 2008 20:06:06 -0000      1.15
@@ -1,7 +1,7 @@
 /*
  * link_type.c - Convert a type into a final image type.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -397,17 +397,6 @@
                return 0;
        }
 
-       /* Search for an existing TypeSpec with this signature */
-       spec = 0;
-       while((spec = (ILTypeSpec *)ILImageNextToken
-                               (linker->image, IL_META_TOKEN_TYPE_SPEC, spec)) 
!= 0)
-       {
-               if(ILTypeIdentical(ILTypeSpec_Type(spec), type))
-               {
-                       return spec;
-               }
-       }
-
        /* Create a new TypeSpec within the output image */
        spec = ILTypeSpecCreate(linker->image, 0, type);
        if(!spec)
@@ -417,6 +406,39 @@
        return spec;
 }
 
+static ILProgramItem *ConvertProgramItemRef(ILLinker *linker,
+                                                                               
        ILProgramItem *item)
+{
+       ILClass *info;
+       ILTypeSpec *spec;
+
+       if((spec = ILProgramItemToTypeSpec(item)) != 0)
+       {
+               spec = _ILLinkerConvertTypeSpec(linker, ILTypeSpec_Type(spec));
+               if(!spec)
+               {
+                       return 0;
+               }
+               return ILToProgramItem(spec);
+       }
+       else if((info = ILProgramItemToClass(item)) != 0)
+       {
+               info = _ILLinkerConvertClassRef(linker, info);
+               if(!info)
+               {
+                       return 0;
+               }
+               return ILToProgramItem(info);
+       }
+       return 0;
+}
+
+ILProgramItem *_ILLinkerConvertProgramItemRef(ILLinker *linker,
+                                                                               
          ILProgramItem *item)
+{
+       return ConvertProgramItemRef(linker, item);
+}
+
 #ifdef __cplusplus
 };
 #endif

Index: ilalink/linker.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/linker.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- ilalink/linker.h    4 Oct 2008 20:13:23 -0000       1.35
+++ ilalink/linker.h    18 Nov 2008 20:06:06 -0000      1.36
@@ -1,7 +1,7 @@
 /*
  * linker.h - Internal definitions for image linking.
  *
- * Copyright (C) 2001, 2003  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2003, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -247,6 +247,13 @@
 ILClass *_ILLinkerConvertClassRef(ILLinker *linker, ILClass *classInfo);
 
 /*
+ * Convert a class ore typespec reference in a foreign image to a 
+ * class reference or typespec in the output image.
+ */
+ILProgramItem *_ILLinkerConvertProgramItemRef(ILLinker *linker,
+                                                                               
          ILProgramItem *item);
+
+/*
  * Convert a member reference in a foreign image into a
  * reference in the output image.
  */

Index: ilasm/ilasm_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_build.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- ilasm/ilasm_build.c 26 Jul 2007 19:46:56 -0000      1.33
+++ ilasm/ilasm_build.c 18 Nov 2008 20:06:07 -0000      1.34
@@ -1,7 +1,7 @@
 /*
  * ilasm_build.c - Data structure building helper routines.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -390,7 +390,7 @@
 }
 
 void ILAsmBuildNewClass(const char *name, ILAsmParamInfo *genericParams,
-                                               ILClass *parent, ILUInt32 attrs)
+                                               ILProgramItem *parent, ILUInt32 
attrs)
 {
        ILClass *info;
        char uniqueName[64];
@@ -402,7 +402,7 @@
           (strcmp(name, "Object") != 0 ||
            strcmp(namespace.string, "System") != 0))
        {
-               parent = ILAsmSystemClass("Object");
+               parent = ILToProgramItem(ILAsmSystemClass("Object"));
        }
 
        /* Do we already have a class with this name? */

Index: ilasm/ilasm_build.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_build.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- ilasm/ilasm_build.h 26 Jul 2007 19:46:57 -0000      1.17
+++ ilasm/ilasm_build.h 18 Nov 2008 20:06:07 -0000      1.18
@@ -1,7 +1,7 @@
 /*
  * ilasm_build.h - Data structure building helper routines.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -163,7 +163,7 @@
  * Create a new class and push it onto the class stack.
  */
 void ILAsmBuildNewClass(const char *name, ILAsmParamInfo *genericParams,
-                                               ILClass *parent, ILUInt32 
attrs);
+                                               ILProgramItem *parent, ILUInt32 
attrs);
 
 /*
  * Pop the class stack.

Index: ilasm/ilasm_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_grammar.y,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- ilasm/ilasm_grammar.y       26 Jul 2007 19:46:57 -0000      1.50
+++ ilasm/ilasm_grammar.y       18 Nov 2008 20:06:07 -0000      1.51
@@ -3,7 +3,7 @@
  * ilasm_grammar.y - Input file for yacc that defines the syntax of
  *                   the ILASM language.
  *
- * Copyright (C) 2001, 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -710,6 +710,7 @@
                int                     extraSize;
        }                               byteList;
        ILClass            *classInfo;
+       ILProgramItem  *programItem;
        ILType             *type;
        struct
        {
@@ -732,7 +733,6 @@
                ILProgramItem  *item;
 
        }                               typeSpec;
-       ILProgramItem  *customType;
        struct
        {
                const char *start;
@@ -1071,13 +1071,14 @@
 %type <opcode>         I_NEWARRAY I_MULTINEWARRAY
 %type <floatValue>     Float64 InstructionFloat
 %type <byteList>       ByteList
-%type <classInfo>      ClassName CatchClause ClassNameTypeSpec
+%type <classInfo>      ClassName CatchClause
+%type <programItem> ClassNameTypeSpec
 %type <type>           Type ArrayBounds Bounds
 %type <marshType>      MarshalledType
 %type <typeSpec>       TypeSpecification
 %type <params>         OptSignatureArguments SignatureArguments 
SignatureArgument
 %type <fieldInit>      FieldInitialization InitOption
-%type <customType>     CustomType
+%type <programItem>    CustomType
 %type <scope>          ScopeBlock TryBlock FilterClause HandlerBlock
 %type <scope>          JavaScopeBlock JavaTryBlock JavaHandlerBlock
 %type <exception>      ExceptionClause ExceptionClauses
@@ -1588,13 +1589,13 @@
 
 ClassNameList
        : ClassNameTypeSpec             {
-                               if(!ILClassAddImplements(ILAsmClass, $1, 0))
+                               if(!ILClassAddImplements(ILAsmClass, 
ILProgramItemToClass($1), 0))
                                {
                                        ILAsmOutOfMemory();
                                }
                        }
        | ClassNameList ',' ClassNameTypeSpec   {
-                               if(!ILClassAddImplements(ILAsmClass, $3, 0))
+                               if(!ILClassAddImplements(ILAsmClass, 
ILProgramItemToClass($3), 0))
                                {
                                        ILAsmOutOfMemory();
                                }
@@ -3159,7 +3160,7 @@
 
 ClassNameTypeSpec
        : TypeSpecification             {
-                               $$ = ILProgramItemToClass($1.item);
+                               $$ = $1.item;
                        }
        ;
 

Index: image/class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/class.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- image/class.c       12 Nov 2007 19:06:48 -0000      1.43
+++ image/class.c       18 Nov 2008 20:06:07 -0000      1.44
@@ -1,7 +1,7 @@
 /*
  * class.c - Process class information from an image file.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -224,7 +224,7 @@
  * with an image.
  */
 static ILClass *CreateClass(ILImage *image, const char *name,
-                                                       const char *namespace, 
ILClass *parent,
+                                                       const char *namespace, 
ILProgramItem *parent,
                                                        ILProgramItem *scope)
 {
        ILClass *info;
@@ -247,7 +247,7 @@
 #endif
 
        /* Get the name of the scope if it is a nesting parent */
-       scopeClass = ILProgramItemToClass(scope);
+       scopeClass = _ILProgramItem_ToClass(scope);
        if(scopeClass)
        {
                scopeName = scopeClass->className;
@@ -353,7 +353,7 @@
 }
 
 ILClass *ILClassCreate(ILProgramItem *scope, ILToken token, const char *name,
-                                          const char *namespace, ILClass 
*parent)
+                                          const char *namespace, ILProgramItem 
*parent)
 {
        ILImage *image = scope->image;
        ILClass *info;
@@ -361,7 +361,42 @@
        /* Import the parent class into this image */
        if(parent)
        {
-               parent = ILClassImport(image, parent);
+               ILClass *parentClass;
+               ILTypeSpec *parentSpec;
+
+               if((parentClass = _ILProgramItem_ToClass(parent)) != 0)
+               {
+                       parentClass = ILClassImport(image, parentClass);
+                       if(!parentClass)
+                       {
+                               return 0;
+                       }
+                       parent = ILToProgramItem(parentClass);
+               }
+               else if((parentSpec = _ILProgramItem_ToTypeSpec(parent)) != 0)
+               {
+                       parentSpec = ILTypeSpecImport(image, parentSpec);
+                       if(!parentSpec)
+                       {
+                               return 0;
+                       }
+                       parent = ILToProgramItem(parentSpec);
+               }
+               else if(parent->token == 0)
+               {
+                       /* We have an unresolved ClassRef here or a synthetic 
class */
+                       parentClass = ILClassImport(image, (ILClass *)parent);
+                       if(!parentClass)
+                       {
+                               return 0;
+                       }
+                       parent = ILToProgramItem(parentClass);
+               }
+               else
+               {
+                       /* Invalid parent program item type */
+                       return 0;
+               }
                if(!parent)
                {
                        return 0;
@@ -596,22 +631,72 @@
        return ((info->attributes & IL_META_TYPEDEF_REFERENCE) != 0);
 }
 
-ILClass *ILClassGetParent(ILClass *info)
+/*
+ * Get the parent of a class.
+ */
+static ILProgramItem *GetParent(ILClass *info)
 {
        if(info->parent)
        {
-               return (ILClass *)(_ILProgramItemResolve
-                                                               
(&(info->parent->programItem)));
+               return _ILProgramItemResolve(info->parent);
        }
-       else
+       return 0;
+}
+
+/*
+ * Get the parent class of a class.
+ * If the parent is a TypeSpec then the main class of the TypeSpec is returned.
+ */
+static ILClass *GetUnderlyingParentClass(ILClass *info)
+{
+       if(!info || !info->parent)
        {
                return 0;
        }
+       info = ILProgramItemToUnderlyingClass(info->parent);
+       if(info)
+       {
+               return ILClassResolve(info);
+       }
+       return 0;
+}
+
+/*
+ * Get the parent class of a class.
+ * If the parent is a type spec then the synthetic class is returned.
+ */
+static ILClass *GetParentClass(ILClass *info)
+{
+       if(info && info->parent)
+       {
+               if((info = ILProgramItemToClass(info->parent)) != 0)
+               {
+                       return ILClassResolve(info);
+               }
+       }
+       return 0;
+}
+
+ILProgramItem *ILClassGetParent(ILClass *info)
+{
+       return GetParent(info);
+}
+
+ILClass *ILClassGetUnderlyingParentClass(ILClass *info)
+{
+       return GetUnderlyingParentClass(info);
 }
 
-void ILClassSetParent(ILClass *info, ILClass *parent)
+ILClass *ILClassGetParentClass(ILClass *info)
+{
+       return GetParentClass(info);
+}
+
+void ILClassSetParent(ILClass *info, ILProgramItem *parent)
 {
        ILImage *image;
+       ILClass *parentClass;
+       ILTypeSpec *parentSpec;
 
        if(!info || !parent || ILClassIsComplete(info))
        {
@@ -619,16 +704,43 @@
        }
 
        image = ILClassToImage(info);
-       parent = ILClassImport(image, parent);
+
+       if((parentClass = _ILProgramItem_ToClass(parent)) != 0)
+       {
+               parentClass = ILClassImport(image, parentClass);
+               parent = ILToProgramItem(parentClass);
+       }
+       else if((parentSpec = _ILProgramItem_ToTypeSpec(parent)) != 0)
+       {
+               parentSpec = ILTypeSpecImport(image, parentSpec);
+               parent = ILToProgramItem(parentSpec);
+       }
+       else
+       {
+               /* Invalid parent */
+               return;
+       }
+
        info->parent = parent;
 }
 
 ILClass *ILClassGetParentRef(ILClass *info)
 {
-       if(info->parent)
+       if(info && info->parent)
+       {
+               ILProgramItem *item;
+               ILTypeSpec *spec;
+
+               item = info->parent;
+               if((info = _ILProgramItem_ToClass(item)) != 0)
+               {
+                       return (ILClass *)_ILProgramItemResolveRef(item);
+               }
+               if((spec = _ILProgramItem_ToTypeSpec(item)) != 0)
        {
-               return (ILClass *)(_ILProgramItemResolveRef
-                                                               
(&(info->parent->programItem)));
+                       return ILTypeSpecGetClassRef(spec);
+               }
+               return 0;
        }
        else
        {
@@ -695,6 +807,7 @@
 int ILClassIsValid(ILClass *info)
 {
        ILImplements *implements;
+       ILProgramItem *item;
        info = (ILClass *)(_ILProgramItemResolve(&(info->programItem)));
        while(info != 0)
        {
@@ -711,10 +824,10 @@
                        }
                        implements = implements->nextInterface;
                }
-               info = info->parent;
-               if(info != 0)
+               item = info->parent;
+               if(item != 0)
                {
-                       info = (ILClass 
*)(_ILProgramItemResolve(&(info->programItem)));
+                       item = _ILProgramItemResolve(item);
                }
        }
        return 1;
@@ -1066,11 +1179,7 @@
                {
                        return 1;
                }
-               info = info->parent;
-               if(info)
-               {
-                       info = (ILClass 
*)(_ILProgramItemResolve(&(info->programItem)));
-               }
+               info = GetParentClass(info);
        }
        return 0;
 }
@@ -1096,11 +1205,7 @@
                        }
                        temp = temp->nextInterface;
                }
-               info = info->parent;
-               if(info)
-               {
-                       info = (ILClass 
*)(_ILProgramItemResolve(&(info->programItem)));
-               }
+               info = GetParentClass(info);
        }
        return 0;
 }
@@ -1557,7 +1662,7 @@
                                return 1;
                        }
                }
-               info = ILClass_ParentRef(info);
+               info = GetUnderlyingParentClass(info);
        }
        return 0;
 }
@@ -1983,7 +2088,7 @@
                        {
                                break;
                        }
-                       parent = ILClassGetParent(parent);
+                       parent = GetParentClass(parent);
                }
        }
 
@@ -2008,7 +2113,7 @@
                        /* We have a non-override method at this level */
                        break;
                }
-               parent = ILClassGetParent(parent);
+               parent = GetParentClass(parent);
        }
 done:
 
@@ -2030,7 +2135,7 @@
 
        /* Start at the parent class and search for any public method that
           matches the specified signature */
-       parent = ILClassGetParent(info);
+       parent = GetParentClass(info);
        result = 0;
        while(parent != 0)
        {
@@ -2041,7 +2146,7 @@
                        result = method2;
                        break;
                }
-               parent = ILClassGetParent(parent);
+               parent = GetParentClass(parent);
        }
        return result;
 }

Index: image/generic_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/generic_class.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- image/generic_class.c       11 Oct 2007 19:31:52 -0000      1.2
+++ image/generic_class.c       18 Nov 2008 20:06:07 -0000      1.3
@@ -1,7 +1,7 @@
 /*
  * generic_class.c - Functions related to generic class instances.
  *
- * Copyright (C) 2007  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2007, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -110,12 +110,16 @@
        /* Expand the parent class and interfaces */
        if(origClass->parent)
        {               
-               classInfo->parent = ILClassExpand
-                       (image, ILClass_Parent(origClass), classParams, 0);
-               if(!(classInfo->parent))
+               ILClass *parentClass;
+
+               parentClass = ILClassExpand
+                       (image, ILClass_ParentClass(origClass), classParams, 0);
+               if(!parentClass)
                {
+                       classInfo->parent = 0;
                        return 0;
                }
+               classInfo->parent = ILToProgramItem(parentClass);
        }
        impl = 0;
        while((impl = ILClassNextImplements(origClass, impl)) != 0)

Index: image/item.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/item.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- image/item.c        3 Jul 2007 20:25:26 -0000       1.9
+++ image/item.c        18 Nov 2008 20:06:07 -0000      1.10
@@ -1,7 +1,7 @@
 /*
  * item.c - Process program item information from an image file.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -439,6 +439,59 @@
        }
 }
 
+ILClass *ILProgramItemToUnderlyingClass(ILProgramItem *item)
+{
+       if(!item)
+       {
+               return 0;
+       }
+       switch(item->token & IL_META_TOKEN_MASK)
+       {
+               case IL_META_TOKEN_TYPE_DEF:
+               case IL_META_TOKEN_TYPE_REF:
+               case IL_META_TOKEN_EXPORTED_TYPE:
+               {
+                       ILClass *info = (ILClass *)item;
+
+                       if(info->synthetic)
+                       {
+                               ILType *type;
+
+                               type = ILTypeGetWithMain(info->synthetic);
+                               if(!type)
+                               {
+                                       return 0;
+                               }
+                               type = ILTypeGetWithMain(type);
+                               if(type)
+                               {
+                                       return ILType_ToClass(type);
+                               }
+                               return 0;
+                       }
+                       return info;
+               }
+               break;
+
+               case IL_META_TOKEN_TYPE_SPEC:
+               {
+                       ILType *type;
+
+                       type = ILTypeSpec_Type((ILTypeSpec *)item);
+                       if(type)
+                       {
+                               type = ILTypeGetWithMain(type);
+                               if(type)
+                               {
+                                       return ILType_ToClass(type);
+                               }
+                       }
+               }
+               break;
+       }
+       return 0;
+}
+
 ILMember *ILProgramItemToMember(ILProgramItem *item)
 {
        ILToken tokenType = (item ? (item->token & IL_META_TOKEN_MASK) : 0);

Index: image/java_loader.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/java_loader.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- image/java_loader.c 5 Oct 2008 14:21:50 -0000       1.11
+++ image/java_loader.c 18 Nov 2008 20:06:07 -0000      1.12
@@ -1,7 +1,7 @@
 /*
  * java_loader.c - Load Java .class files and convert them into IL images.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1164,7 +1164,8 @@
 
        /* Convert the class from a reference into a definition */
        ILClassCreate(ILClassGlobalScope(image), 0, classInfo->className->name,
-                                 classInfo->className->namespace, otherClass);
+                                 classInfo->className->namespace,
+                                 ILToProgramItem(otherClass));
        ILClassSetAttrs(classInfo, IL_MAX_UINT32, accessFlags);
 
        /* Add the interfaces to the class */

Index: image/java_writer.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/java_writer.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- image/java_writer.c 5 May 2007 17:35:41 -0000       1.5
+++ image/java_writer.c 18 Nov 2008 20:06:07 -0000      1.6
@@ -2,7 +2,7 @@
  * java_writer.c - Writes java images.
  *
  * Copyright (C) 2002  Sylvain Pasche
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -970,7 +970,7 @@
        OUT_UINT16(thisIndex);
 
        /* parent class */
-       parentClass = ILClass_Parent(class);
+       parentClass = ILClass_ParentClass(class);
        if(parentClass)
        {
                parentIndex = ILJavaSetClass(writer, class, parentClass);

Index: image/lib_attrs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/lib_attrs.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- image/lib_attrs.c   1 Oct 2008 19:10:33 -0000       1.14
+++ image/lib_attrs.c   18 Nov 2008 20:06:07 -0000      1.15
@@ -1,7 +1,7 @@
 /*
  * lib_attrs.c - Builtin library attributes with special meanings.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@
        ILClass *classInfo;
 
        /* We must use this on a class */
-       classInfo = ILProgramItemToClass(item);
+       classInfo = _ILProgramItem_ToClass(item);
        if(!classInfo)
        {
                return 0;
@@ -54,7 +54,7 @@
        ILField *fieldInfo;
 
        /* We must use this on a field */
-       fieldInfo = ILProgramItemToField(item);
+       fieldInfo = _ILProgramItem_ToFieldDef(item);
        if(!fieldInfo)
        {
                return 0;
@@ -101,8 +101,8 @@
           We have added an extension to also support PInvoke'ed fields.
           The metadata supports PInvoke information on fields, and it
           is necessary for importing variables from shared objects */
-       method = ILProgramItemToMethod(item);
-       field = ILProgramItemToField(item);
+       method = _ILProgramItem_ToMethodDef(item);
+       field = _ILProgramItem_ToFieldDef(item);
        if(!method && !field)
        {
                return 0;
@@ -276,7 +276,7 @@
        ILUInt32 offset;
 
        /* We must use this on a field */
-       field = ILProgramItemToField(item);
+       field = _ILProgramItem_ToFieldDef(item);
        if(!field)
        {
                return 0;
@@ -317,7 +317,7 @@
        ILParameter *param;
 
        /* We must use this on a parameter */
-       param = ILProgramItemToParameter(item);
+       param = _ILProgramItem_ToParamDef(item);
        if(!param)
        {
                return 0;
@@ -343,7 +343,7 @@
        ILParameter *param;
 
        /* We must use this on a parameter */
-       param = ILProgramItemToParameter(item);
+       param = _ILProgramItem_ToParamDef(item);
        if(!param)
        {
                return 0;
@@ -369,7 +369,7 @@
        ILParameter *param;
 
        /* We must use this on a parameter */
-       param = ILProgramItemToParameter(item);
+       param = _ILProgramItem_ToParamDef(item);
        if(!param)
        {
                return 0;
@@ -405,7 +405,7 @@
        ILMember *member;
 
        /* We must use this on a class */
-       classInfo = ILProgramItemToClass(item);
+       classInfo = _ILProgramItem_ToClass(item);
        if(!classInfo)
        {
                return 0;
@@ -548,7 +548,7 @@
        ILFieldMarshal *marshal;
 
        /* We must use this on a field or parameter */
-       if(!ILProgramItemToField(item) && !ILProgramItemToParameter(item))
+       if(!_ILProgramItem_ToFieldDef(item) && !_ILProgramItem_ToParamDef(item))
        {
                return 0;
        }
@@ -751,7 +751,7 @@
        ILClass *classInfo;
 
        /* We must use this on a class */
-       classInfo = ILProgramItemToClass(item);
+       classInfo = _ILProgramItem_ToClass(item);
        if(!classInfo)
        {
                return 0;
@@ -773,7 +773,7 @@
        ILUInt32 attrs;
 
        /* We must use this on a method */
-       method = ILProgramItemToMethod(item);
+       method = _ILProgramItem_ToMethodDef(item);
        if(!method)
        {
                return 0;
@@ -804,7 +804,7 @@
 static int IndexerNameAttribute(ILProgramItem *item, ILSerializeReader *reader)
 {
        /* We must use this on a property, and we just remove it when found */
-       return (ILProgramItemToProperty(item) != 0);
+       return (_ILProgramItem_ToPropertyDef(item) != 0);
 }
 
 /*
@@ -859,7 +859,7 @@
        void *utf16;
 
        /* We only convert the attribute if it is on a parameter */
-       if(!ILProgramItemToParameter(item))
+       if(!_ILProgramItem_ToParamDef(item))
        {
                return 0;
        }
@@ -1122,9 +1122,9 @@
        ILDeclSecurity *decl;
 
        /* The item must be a class, method, or assembly */
-       if(!ILProgramItemToClass(item) &&
-          !ILProgramItemToMethod(item) &&
-          !ILProgramItemToAssembly(item))
+       if(!_ILProgramItem_ToTypeDef(item) &&
+          !_ILProgramItem_ToMethodDef(item) &&
+          !_ILProgramItem_ToAssemblyDef(item))
        {
                return 0;
        }

Index: image/member.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/member.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- image/member.c      14 Sep 2007 00:55:43 -0000      1.33
+++ image/member.c      18 Nov 2008 20:06:07 -0000      1.34
@@ -1,7 +1,7 @@
 /*
  * member.c - Process class member information from an image file.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -306,7 +306,7 @@
                return 0;
        }
 
-       if((spec = ILProgramItemToTypeSpec(owner)) != 0)
+       if((spec = _ILProgramItem_ToTypeSpec(owner)) != 0)
        {
                memberRef->member.owner = ILTypeSpecGetClassWrapper(spec);
        }
@@ -484,7 +484,8 @@
        ILMethod *underlying;
        if(classInfo)
        {
-               classInfo = ILClass_Parent(classInfo);
+               /* TODO */
+               classInfo = ILClass_ParentClass(classInfo);
        }
        while(classInfo != 0)
        {
@@ -511,7 +512,8 @@
                                }
                        }
                }
-               classInfo = ILClass_Parent(classInfo);
+               /* TODO */
+               classInfo = ILClass_ParentClass(classInfo);
        }
        return 0;
 }
@@ -1128,7 +1130,8 @@
                                return testMethod;
                        }
                }
-               classInfo = ILClass_Parent(classInfo);
+               /* TODO */
+               classInfo = ILClass_ParentClass(classInfo);
        }
 
        /* We could not find the resolved version */
@@ -1635,12 +1638,12 @@
        }
 
        /* Attach this record to the property or event */
-       if((property = ILProgramItemToProperty(item)) != 0)
+       if((property = _ILProgramItem_ToPropertyDef(item)) != 0)
        {
                sem->next = property->semantics;
                property->semantics = sem;
        }
-       else if((event = ILProgramItemToEvent(item)) != 0)
+       else if((event = _ILProgramItem_ToEventDef(item)) != 0)
        {
                sem->next = event->semantics;
                event->semantics = sem;
@@ -1652,12 +1655,12 @@
 
 ILEvent *ILMethodSemGetEvent(ILMethodSem *sem)
 {
-       return ILProgramItemToEvent(sem->owner);
+       return _ILProgramItem_ToEventDef(sem->owner);
 }
 
 ILProperty *ILMethodSemGetProperty(ILMethodSem *sem)
 {
-       return ILProgramItemToProperty(sem->owner);
+       return _ILProgramItem_ToPropertyDef(sem->owner);
 }
 
 ILUInt32 ILMethodSemGetType(ILMethodSem *sem)
@@ -1675,11 +1678,11 @@
        ILMethodSem *sem;
        ILProperty *property;
        ILEvent *event;
-       if((property = ILProgramItemToProperty(item)) != 0)
+       if((property = _ILProgramItem_ToPropertyDef(item)) != 0)
        {
                sem = property->semantics;
        }
-       else if((event = ILProgramItemToEvent(item)) != 0)
+       else if((event = _ILProgramItem_ToEventDef(item)) != 0)
        {
                sem = event->semantics;
        }

Index: image/meta_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_build.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- image/meta_build.c  5 Oct 2008 14:21:50 -0000       1.51
+++ image/meta_build.c  18 Nov 2008 20:06:07 -0000      1.52
@@ -1,7 +1,7 @@
 /*
  * meta_build.c - Build metadata structures from a metadata index.
  *
- * Copyright (C) 2001, 2002, 2003  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2002, 2003, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -2047,7 +2047,7 @@
                return IL_LOADERR_BAD_META;
        }
 #if IL_VERSION_MAJOR > 1
-       if((spec = ILProgramItemToTypeSpec(item)))
+       if((spec = _ILProgramItem_ToTypeSpec(item)))
        {
                interface = ILTypeSpecGetClassWrapper(spec);
        }
@@ -2375,7 +2375,7 @@
        }
 
        /* Create the method semantics block and attach it */
-       property = ILProgramItemToProperty(owner);
+       property = _ILProgramItem_ToPropertyDef(owner);
        if(property != 0 &&
           values[IL_OFFSET_METHODSEM_SEMANTICS] == IL_META_METHODSEM_GETTER)
        {
@@ -2495,7 +2495,7 @@
                                {
                                        break;
                                }
-                               currentInfo = ILClass_Parent(currentInfo);
+                               currentInfo = ILClass_ParentClass(currentInfo);
                        }
                        if(member == 0 && ILType_IsComplex(type) &&
                           ILType_Kind(type) == (IL_TYPE_COMPLEX_METHOD |
@@ -2610,7 +2610,7 @@
                                        {
                                                break;
                                        }
-                                       resolvedClass = 
ILClass_Parent(resolvedClass);
+                                       resolvedClass = 
ILClass_ParentClass(resolvedClass);
                                }
                                if(!resolvedMember)
                                {
@@ -3291,7 +3291,7 @@
                                                void *userData)
 {
        ILClass *info;
-       ILClass *parent;
+       ILProgramItem *parent;
        const char *name;
        const char *namespace;
        int error;
@@ -3362,22 +3362,31 @@
        /* Locate the parent class */
        if(values[IL_OFFSET_TYPEDEF_PARENT])
        {
-               parent = ILClass_FromToken(image, 
values[IL_OFFSET_TYPEDEF_PARENT]);
+               parent = ILProgramItem_FromToken(image, 
values[IL_OFFSET_TYPEDEF_PARENT]);
                if(parent)
                {
-                       /* Resolve TypeSpec's into ILClass structures */
-                       parent = ILProgramItemToClass((ILProgramItem *)parent);
+                       /* Nothing to do here */
                }
                else if((values[IL_OFFSET_TYPEDEF_PARENT] & IL_META_TOKEN_MASK)
                                        == IL_META_TOKEN_TYPE_DEF)
                {
                        /* The class inherits from a TypeDef we haven't seen 
yet */
+                       ILClass *parentInfo;
+
                        error = LoadForwardTypeDef(image, 
values[IL_OFFSET_TYPEDEF_PARENT]);
                        if(error != 0)
                        {
                                return error;
                        }
-                       parent = ILClass_FromToken(image, 
values[IL_OFFSET_TYPEDEF_PARENT]);
+                       parentInfo = ILClass_FromToken(image, 
values[IL_OFFSET_TYPEDEF_PARENT]);
+                       if(parentInfo)
+                       {
+                               parent = ILToProgramItem(parentInfo);
+                       }
+                       else
+                       {
+                               parent = 0;
+                       }
                }
                if(!parent)
                {
@@ -3833,7 +3842,7 @@
                {
                        break;
                }
-               resolvedClass = ILClass_Parent(resolvedClass);
+               resolvedClass = ILClass_ParentClass(resolvedClass);
        }
        if(!resolvedMember)
        {

Index: image/meta_types.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_types.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- image/meta_types.c  12 Nov 2007 19:06:48 -0000      1.22
+++ image/meta_types.c  18 Nov 2008 20:06:07 -0000      1.23
@@ -1,7 +1,7 @@
 /*
  * meta_types.c - Type handling for IL images.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1068,7 +1068,7 @@
        }
        if(classInfo)
        {
-               ILClass *parent = ILClass_Parent(classInfo);
+               ILClass *parent = ILClass_UnderlyingParentClass(classInfo);
                if(parent)
                {
                        const char *namespace = ILClass_Namespace(parent);
@@ -1351,7 +1351,9 @@
        if(ILType_IsValueType(type))
        {
                ILClass *classInfo = ILClassResolve(ILType_ToValueType(type));
-               ILClass *parent = ILClass_Parent(classInfo);
+               ILClass *parent;
+
+               parent = ILClass_UnderlyingParentClass(classInfo);
                if(parent)
                {
                        const char *namespace = ILClass_Namespace(parent);
@@ -1391,7 +1393,9 @@
        if(ILType_IsClass(type))
        {
                ILClass *classInfo = ILClassResolve(ILType_ToClass(type));
-               ILClass *parent = ILClass_Parent(classInfo);
+               ILClass *parent;
+
+               parent = ILClass_UnderlyingParentClass(classInfo);
                if(parent)
                {
                        const char *namespace = ILClass_Namespace(parent);
@@ -1420,8 +1424,9 @@
        {
                ILType *invokeMethod = ILTypeGetDelegateMethod(type);
                ILClass *classInfo = ILClassResolve(ILType_ToClass(type));
-               ILClass *parent = ILClass_Parent(classInfo);
+               ILClass *parent;
 
+               parent = ILClass_UnderlyingParentClass(classInfo);
                if (invokeMethod == 0)
                {
                        return 0;
@@ -1511,8 +1516,9 @@
        {
                ILType *invokeMethod = ILTypeGetDelegateMethod(type);
                ILClass *classInfo = ILClassResolve(ILType_ToClass(type));
-               ILClass *parent = ILClass_Parent(classInfo);
+               ILClass *parent;
 
+               parent = ILClass_UnderlyingParentClass(classInfo);
                if (invokeMethod == 0)
                {
                        return 0;
@@ -1683,7 +1689,7 @@
                                        return 1;
                                }
                        }
-                       classInfo = ILClass_Parent(classInfo);
+                       classInfo = ILClass_UnderlyingParentClass(classInfo);
                }
        }
        return 0;
@@ -1750,6 +1756,158 @@
        }
 }
 
+ILType *ILTypeImport(ILImage *image, ILType *type)
+{
+       if(!image || !type)
+       {
+               return 0;
+       }
+       if(ILType_IsPrimitive(type))
+       {
+               return type;
+       }
+       else if(ILType_IsClass(type) || ILType_IsValueType(type))
+       {
+               ILClass *class = ILType_ToClass(type);
+               ILType *synType;
+
+               if((synType = ILClassGetSynType(class)) != 0)
+               {
+                       return ILTypeImport(image, synType);
+               }
+               if(class->programItem.image != image)
+               {
+                       class = ILClassResolve(class);
+                       if(!class)
+                       {
+                               return 0;
+                       }
+                       class = ILClassImport(image, class);
+                       if(!class)
+                       {
+                               return 0;
+                       }
+                       if(ILType_IsClass(type))
+                       {
+                               return ILType_FromClass(class);
+                       }
+                       return ILType_FromValueType(class);
+               }
+               return type;
+       }
+       else if(ILType_IsComplex(type))
+       {
+               switch(ILType_Kind(type))
+               {
+                       case IL_TYPE_COMPLEX_VAR:
+                       case IL_TYPE_COMPLEX_MVAR:
+                       {
+                               return type;
+                       }
+                       break;
+
+                       case IL_TYPE_COMPLEX_BYREF:
+                       case IL_TYPE_COMPLEX_PTR:
+                       case IL_TYPE_COMPLEX_PINNED:
+                       {
+                               ILType *refType;
+                               ILType *newRefType;
+
+                               refType = ILType_Ref(type);
+                               if((newRefType = ILTypeImport(image, refType)) 
== 0)
+                               {
+                                       return 0;
+                               }
+                               if(newRefType != refType)
+                               {
+                                       return 
ILTypeCreateRef(ILImageToContext(image),
+                                                                               
   ILType_Kind(type), newRefType);
+                               }
+                               return type;
+                       }
+                       break;
+
+                       case IL_TYPE_COMPLEX_ARRAY:
+                       case IL_TYPE_COMPLEX_ARRAY_CONTINUE:
+                       {
+                               ILType *elemType;
+                               ILType *newElemType;
+
+                               elemType = ILType_ElemType(type);
+                               if(!elemType)
+                               {
+                                       return 0;
+                               }
+                               newElemType = ILTypeImport(image, elemType);
+                               if(!newElemType)
+                               {
+                                       return 0;
+                               }
+                               if(elemType != newElemType)
+                               {
+                                       ILType *newType;
+
+                                       newType = 
ILTypeCreateArray(ILImageToContext(image), 1,
+                                                                               
                newElemType);
+                                       if(!newType)
+                                       {
+                                               return 0;
+                                       }
+                                       newType->kind__ = ILType_Kind(type);
+                                       ILType_Size(newType) = 
ILType_Size(type);
+                                       ILType_LowBound(newType) = 
ILType_LowBound(type);
+                                       return newType;
+                               }
+                               return type;
+                       }
+                       break;
+
+                       case IL_TYPE_COMPLEX_WITH:
+                       {
+                               ILType *withMain;
+                               ILType *newWithMain;
+                               ILType *newType;
+                               unsigned long numWithParams;
+                               unsigned long current;
+
+                               withMain = ILTypeGetWithMain(type);
+                               if((newWithMain = ILTypeImport(image, 
withMain)) == 0)
+                               {
+                                       return 0;
+                               }
+                               if((newType = 
ILTypeCreateWith(ILImageToContext(image),
+                                                                               
           newWithMain)) == 0)
+                               {
+                                       return 0;
+                               }
+                               numWithParams = ILTypeNumWithParams(type);
+                               for(current = 1; current <= numWithParams; 
++current)
+                               {
+                                       ILType *withParam;
+                                       ILType *newWithParam;
+
+                                       if((withParam = 
ILTypeGetWithParam(type, current)) == 0)
+                                       {
+                                               return 0;
+                                       }
+                                       if((newWithParam = ILTypeImport(image, 
withParam)) == 0)
+                                       {
+                                               return 0;
+                                       }
+                                       
if(ILTypeAddWithParam(ILImageToContext(image), newType,
+                                                                               
  newWithParam) == 0)
+                                       {
+                                               return 0;
+                                       }
+                               }
+                               return newType;
+                       }
+                       break;
+               }
+       }
+       return 0;
+}
+
 #ifdef __cplusplus
 };
 #endif

Index: image/meta_writer.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_writer.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- image/meta_writer.c 1 Jul 2007 16:46:41 -0000       1.17
+++ image/meta_writer.c 18 Nov 2008 20:06:07 -0000      1.18
@@ -1,7 +1,7 @@
 /*
  * meta_writer.c - Write metadata index informtion to an image.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -176,6 +176,22 @@
        }
 }
 
+static ILToken ProgramItemToToken(ILImage *image, ILProgramItem *item)
+{
+       ILClass *info;
+       ILTypeSpec *spec;
+
+       if((info = _ILProgramItem_ToClass(item)) != 0)
+       {
+               return ClassToToken(image, info);
+       }
+       else if((spec = _ILProgramItem_ToTypeSpec(item)) != 0)
+       {
+               return ILTypeSpec_Token(spec);
+       }
+       return 0;
+}
+
 /*
  * Format a TypeDef token.
  */
@@ -196,7 +212,7 @@
                        GetPersistString(image, info->className->namespace);
        if(info->parent)
        {
-               values[IL_OFFSET_TYPEDEF_PARENT] = ClassToToken(image, 
info->parent);
+               values[IL_OFFSET_TYPEDEF_PARENT] = ProgramItemToToken(image, 
info->parent);
        }
        else
        {

Index: image/misc_token.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/misc_token.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- image/misc_token.c  10 Sep 2007 19:16:42 -0000      1.13
+++ image/misc_token.c  18 Nov 2008 20:06:08 -0000      1.14
@@ -1,7 +1,7 @@
 /*
  * misc_token.c - Handle miscellaneous tokens within images.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -69,6 +69,21 @@
        return spec;
 }
 
+ILTypeSpec *ILTypeSpecImport(ILImage *image, ILTypeSpec *spec)
+{
+       ILType *type;
+
+       if(spec->programItem.image == image)
+       {
+               return spec;
+       }
+       if((type = ILTypeImport(image, ILTypeSpec_Type(spec))) == 0)
+       {
+               return 0;
+       }
+       return ILTypeSpecCreate(image, 0, type);
+}
+
 ILType *ILTypeSpecGetType(ILTypeSpec *spec)
 {
        return spec->type;
@@ -210,15 +225,15 @@
 
        /* If the owner is a Field, Parameter, or Property, then
           set the "HAS_DEFAULT" flag within the definition */
-       if((field = ILProgramItemToField(owner)) != 0)
+       if((field = _ILProgramItem_ToFieldDef(owner)) != 0)
        {
                field->member.attributes |= IL_META_FIELDDEF_HAS_DEFAULT;
        }
-       else if((param = ILProgramItemToParameter(owner)) != 0)
+       else if((param = _ILProgramItem_ToParamDef(owner)) != 0)
        {
                param->attributes |= IL_META_PARAMDEF_HAS_DEFAULT;
        }
-       else if((property = ILProgramItemToProperty(owner)) != 0)
+       else if((property = _ILProgramItem_ToPropertyDef(owner)) != 0)
        {
                property->member.attributes |= IL_META_PROPDEF_HAS_DEFAULT;
        }
@@ -363,21 +378,21 @@
 
        /* Filter out program items that obviously don't have a value,
           to avoid searching the constant table unnecessarily */
-       if((field = ILProgramItemToField(owner)) != 0)
+       if((field = _ILProgramItem_ToFieldDef(owner)) != 0)
        {
                if((field->member.attributes & IL_META_FIELDDEF_HAS_DEFAULT) == 
0)
                {
                        return 0;
                }
        }
-       else if((param = ILProgramItemToParameter(owner)) != 0)
+       else if((param = _ILProgramItem_ToParamDef(owner)) != 0)
        {
                if((param->attributes & IL_META_PARAMDEF_HAS_DEFAULT) == 0)
                {
                        return 0;
                }
        }
-       else if((property = ILProgramItemToProperty(owner)) != 0)
+       else if((property = _ILProgramItem_ToPropertyDef(owner)) != 0)
        {
                if((property->member.attributes & IL_META_PROPDEF_HAS_DEFAULT) 
== 0)
                {
@@ -538,11 +553,11 @@
 
        /* If the owner is a Field or Parameter, then set the
           "HAS_FIELD_MARSHAL" flag within the definition */
-       if((field = ILProgramItemToField(owner)) != 0)
+       if((field = _ILProgramItem_ToFieldDef(owner)) != 0)
        {
                field->member.attributes |= IL_META_FIELDDEF_HAS_FIELD_MARSHAL;
        }
-       else if((param = ILProgramItemToParameter(owner)) != 0)
+       else if((param = _ILProgramItem_ToParamDef(owner)) != 0)
        {
                param->attributes |= IL_META_PARAMDEF_HAS_FIELD_MARSHAL;
        }
@@ -591,14 +606,14 @@
        ILParameter *param;
 
        /* Filter out members that obviously don't have marshal information */
-       if((field = ILProgramItemToField(owner)) != 0)
+       if((field = _ILProgramItem_ToFieldDef(owner)) != 0)
        {
                if((field->member.attributes & 
IL_META_FIELDDEF_HAS_FIELD_MARSHAL) == 0)
                {
                        return 0;
                }
        }
-       else if((param = ILProgramItemToParameter(owner)) != 0)
+       else if((param = _ILProgramItem_ToParamDef(owner)) != 0)
        {
                if((param->attributes & IL_META_PARAMDEF_HAS_FIELD_MARSHAL) == 
0)
                {
@@ -711,11 +726,11 @@
 
        /* If the owner is a TypeDef or MethodDef, then set the
           "HAS_SECURITY" flag within the definition */
-       if((classInfo = ILProgramItemToClass(owner)) != 0)
+       if((classInfo = _ILProgramItem_ToTypeDef(owner)) != 0)
        {
                classInfo->attributes |= IL_META_TYPEDEF_HAS_SECURITY;
        }
-       else if((method = ILProgramItemToMethod(owner)) != 0)
+       else if((method = _ILProgramItem_ToMethodDef(owner)) != 0)
        {
                method->member.attributes |= IL_META_METHODDEF_HAS_SECURITY;
        }

Index: image/program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/program.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- image/program.h     29 Sep 2008 10:53:06 -0000      1.29
+++ image/program.h     18 Nov 2008 20:06:08 -0000      1.30
@@ -1,7 +1,7 @@
 /*
  * program.h - Internal definitions related to program information.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -272,7 +272,7 @@
        ILProgramItem   programItem;            /* Parent class fields */
        ILUInt32                attributes;                     /* 
IL_META_TYPEDEF_xxx flags */
        ILClassName    *className;                      /* Name information for 
the class */
-       ILClass            *parent;                             /* Parent class 
*/
+       ILProgramItem  *parent;                         /* Parent item 
(TypeSpec or Class) */
        ILImplements   *implements;                     /* List of implemented 
interfaces */
        ILMember           *firstMember;                /* First member owned 
by the class */
        ILMember           *lastMember;                 /* Last member owned by 
the class */
@@ -750,6 +750,108 @@
  */
 void _ILMethodSpecSetTypeIndex(ILMethodSpec *spec, ILUInt32 index);
 
+/*
+ * Some internal helper macros to convert a program item.
+ */
+#define _ILProgramItem_ToAssemblyDef(item) \
+       (ILAssembly *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_ASSEMBLY) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToAssemblyRef(item) \
+       (ILAssembly *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_ASSEMBLY_REF) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToAttribute(item) \
+       (ILAttribute *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_ATTRIBUTE) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToExportedType(item) \
+       (ILClass *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_EXPORTED_TYPE) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToEventDef(item) \
+       (ILEvent *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_EVENT) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToFieldDef(item) \
+       (ILField *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_FIELD_DEF) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToMemberRef(item) \
+       (ILMember *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_MEMBER_REF) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToMethodDef(item) \
+       (ILMethod *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_METHOD_DEF) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToMethodImpl(item) \
+       (ILOverride *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_METHOD_IMPL) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToModuleDef(item) \
+       (ILModule *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_MODULE) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToModuleRef(item) \
+       (ILModule *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_MODULE_REF) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToParamDef(item) \
+       (ILParameter *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_PARAM_DEF) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToPropertyDef(item) \
+       (ILProperty *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_PROPERTY) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToTypeDef(item) \
+       (ILClass *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_TYPE_DEF) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToTypeRef(item) \
+       (ILClass *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_TYPE_REF) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToTypeSpec(item) \
+       (ILTypeSpec *)((item) && \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_TYPE_SPEC) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToAssembly(item) \
+       (ILAssembly *)((item) && \
+                       ((((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_ASSEMBLY) || \
+                       (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_ASSEMBLY_REF)) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToClass(item) \
+       (ILClass *)((item) && \
+                       ((((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_TYPE_DEF) || \
+               (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_TYPE_REF) || \
+               (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_EXPORTED_TYPE)) ? \
+                       (item) : 0)
+
+#define _ILProgramItem_ToModule(item) \
+       (ILModule *)((item) && \
+                       ((((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_MODULE) || \
+               (((item)->token & IL_META_TOKEN_MASK) == 
IL_META_TOKEN_MODULE_REF)) ? \
+                       (item) : 0)
+
 #ifdef __cplusplus
 };
 #endif

Index: image/ser_parse.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/ser_parse.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- image/ser_parse.c   3 Jul 2005 10:17:12 -0000       1.11
+++ image/ser_parse.c   18 Nov 2008 20:06:08 -0000      1.12
@@ -1,7 +1,7 @@
 /*
  * ser_parse.c - Parse serialized attribute values.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -600,7 +600,8 @@
                {
                        break;
                }
-               info = ILClassGetParent(info);
+               /* TODO */
+               info = ILClass_ParentClass(info);
        }
 
        /* The member must have public access and be an instance member.

Index: image/synthetic.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/synthetic.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- image/synthetic.c   13 Sep 2007 18:47:46 -0000      1.13
+++ image/synthetic.c   18 Nov 2008 20:06:08 -0000      1.14
@@ -1,7 +1,7 @@
 /*
  * synthetic.c - Handle synthetic classes such as arrays, pointers, etc.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -164,7 +164,7 @@
        }
 
        /* Create a new class information block */
-       info = ILClassCreate(scope, 0, name, "$Synthetic", parent);
+       info = ILClassCreate(scope, 0, name, "$Synthetic", 
ILToProgramItem(parent));
        if(!info)
        {
                return 0;

Index: include/il_program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_program.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- include/il_program.h        4 Aug 2008 10:42:06 -0000       1.63
+++ include/il_program.h        18 Nov 2008 20:06:08 -0000      1.64
@@ -1,7 +1,7 @@
 /*
  * il_program.h - Definitions related to program information.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -154,6 +154,15 @@
 ILGenericConstraint *ILProgramItemToGenericConstraint(ILProgramItem *item);
 
 /*
+ * Get the underlying class for a program item.
+ * If the program item is a TypeDef or TypeRef the program item is returned
+ * as a class.
+ * If the program item is a TypeSpec for a WithType (generic) then the
+ * generic class (MainType) is returned.
+ */
+ILClass *ILProgramItemToUnderlyingClass(ILProgramItem *item);
+
+/*
  * Helper macros for querying information about a program item.
  */
 #define        ILProgramItem_FromToken(image,token)    \
@@ -478,7 +487,7 @@
  * the class already exists.
  */
 ILClass *ILClassCreate(ILProgramItem *scope, ILToken token, const char *name,
-                                          const char *nspace, ILClass *parent);
+                                          const char *nspace, ILProgramItem 
*parent);
 
 /*
  * Create a reference class within a particular scope.
@@ -527,13 +536,27 @@
  * Get the parent of a particular class.  This will cross
  * image boundaries to take linking into account.
  */
-ILClass *ILClassGetParent(ILClass *info);
+ILProgramItem *ILClassGetParent(ILClass *info);
+
+/*
+ * Get the underlying parent class of a particular class.
+ * This will cross image boundaries to take linking into account.
+ */
+ILClass *ILClassGetUnderlyingParentClass(ILClass *info);
+
+/*
+ * Get the parent class of a particular class.  This will cross
+ * image boundaries to take linking into account.
+ * If the parent is a type spec the synthetic class for the
+ * TypeSpec will be returned.
+ */
+ILClass *ILClassGetParentClass(ILClass *info);
 
 /*
  * Set the parent of a class, if the class hasn't been
  * marked completed.
  */
-void ILClassSetParent(ILClass *info, ILClass *parent);
+void ILClassSetParent(ILClass *info, ILProgramItem *parent);
 
 /*
  * Get the parent of a particular class, but don't cross
@@ -945,6 +968,9 @@
 #define        ILClass_Namespace(info)         (ILClassGetNamespace((info)))
 #define        ILClass_SynType(info)           (ILClassGetSynType((info)))
 #define        ILClass_Parent(info)            (ILClassGetParent((info)))
+#define        ILClass_ParentClass(info)       (ILClassGetParentClass((info)))
+#define        ILClass_UnderlyingParentClass(info)     \
+                       (ILClassGetUnderlyingParentClass((info)))
 #define        ILClass_ParentRef(info)         (ILClassGetParentRef((info)))
 #define        ILClass_NestedParent(info)      (ILClassGetNestedParent((info)))
 #define        ILClass_UserData(info)          (ILClassGetUserData((info)))
@@ -1947,6 +1973,12 @@
 ILTypeSpec *ILTypeSpecCreate(ILImage *image, ILToken token, ILType *type);
 
 /*
+ * Import a TypeSpec token into the given image.
+ * Returns spec if it is in the given image.
+ */
+ILTypeSpec *ILTypeSpecImport(ILImage *image, ILTypeSpec *spec);
+
+/*
  * Get the type information associated with a TypeSpec.
  */
 ILType *ILTypeSpecGetType(ILTypeSpec *spec);

Index: include/il_types.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_types.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- include/il_types.h  30 Oct 2007 17:35:24 -0000      1.29
+++ include/il_types.h  18 Nov 2008 20:06:08 -0000      1.30
@@ -1,7 +1,7 @@
 /*
  * il_types.h - Type representation for IL images.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -304,6 +304,11 @@
 ILType *ILTypeCreateRef(ILContext *context, int kind, ILType *refType);
 
 /*
+ * Import a type into an image. Returns NULL if out of memory.
+ */
+ILType * ILTypeImport(ILImage *image, ILType *type);
+
+/*
  * Create an array type.  Returns NULL if out of memory.
  */
 ILType *ILTypeCreateArray(ILContext *context, unsigned long rank,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]