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

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

[Dotgnu-pnet-commits] CVS: pnet/image class.c,1.23,1.24 item.c,1.5,1.6 m


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/image class.c,1.23,1.24 item.c,1.5,1.6 meta_writer.c,1.8,1.9 misc_token.c,1.2,1.3 program.h,1.14,1.15
Date: Thu, 27 Feb 2003 22:59:03 -0500

Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv9984/image

Modified Files:
        class.c item.c meta_writer.c misc_token.c program.h 
Log Message:


Convert ILExportedType into a subclass of ILClass so that we
can treat exported types as a special kind of typeref.


Index: class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/class.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** class.c     27 Feb 2003 06:19:23 -0000      1.23
--- class.c     28 Feb 2003 03:59:00 -0000      1.24
***************
*** 315,319 ****
  {
        if((scope->token & IL_META_TOKEN_MASK) == IL_META_TOKEN_TYPE_REF ||
!          (scope->token & IL_META_TOKEN_MASK) == IL_META_TOKEN_TYPE_DEF)
        {
                return 1;
--- 315,320 ----
  {
        if((scope->token & IL_META_TOKEN_MASK) == IL_META_TOKEN_TYPE_REF ||
!          (scope->token & IL_META_TOKEN_MASK) == IL_META_TOKEN_TYPE_DEF ||
!          (scope->token & IL_META_TOKEN_MASK) == IL_META_TOKEN_EXPORTED_TYPE)
        {
                return 1;

Index: item.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/item.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** item.c      19 Feb 2003 05:02:08 -0000      1.5
--- item.c      28 Feb 2003 03:59:00 -0000      1.6
***************
*** 401,405 ****
        }
        else if((item->token & IL_META_TOKEN_MASK) == IL_META_TOKEN_TYPE_DEF ||
!               (item->token & IL_META_TOKEN_MASK) == IL_META_TOKEN_TYPE_REF)
        {
                return (ILClass *)item;
--- 401,406 ----
        }
        else if((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)
        {
                return (ILClass *)item;

Index: meta_writer.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_writer.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** meta_writer.c       19 Feb 2003 05:31:54 -0000      1.8
--- meta_writer.c       28 Feb 2003 03:59:00 -0000      1.9
***************
*** 648,657 ****
                                                ILUInt32 *values, 
ILExportedType *type)
  {
!       values[IL_OFFSET_EXPTYPE_ATTRS] = type->attributes;
        values[IL_OFFSET_EXPTYPE_CLASS] = type->identifier;
!       values[IL_OFFSET_EXPTYPE_NAME] = GetPersistString(image, type->name);
        values[IL_OFFSET_EXPTYPE_NAMESPACE] =
!                       GetPersistString(image, type->namespace);
!       values[IL_OFFSET_EXPTYPE_FILE] = type->scope->token;
  }
  
--- 648,658 ----
                                                ILUInt32 *values, 
ILExportedType *type)
  {
!       values[IL_OFFSET_EXPTYPE_ATTRS] = type->classItem.attributes;
        values[IL_OFFSET_EXPTYPE_CLASS] = type->identifier;
!       values[IL_OFFSET_EXPTYPE_NAME] =
!                       GetPersistString(image, type->classItem.name);
        values[IL_OFFSET_EXPTYPE_NAMESPACE] =
!                       GetPersistString(image, type->classItem.namespace);
!       values[IL_OFFSET_EXPTYPE_FILE] = type->classItem.scope->token;
  }
  

Index: misc_token.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/misc_token.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** misc_token.c        14 Feb 2003 23:55:49 -0000      1.2
--- misc_token.c        28 Feb 2003 03:59:00 -0000      1.3
***************
*** 834,846 ****
  
        /* Set the exported type fields */
!       type->programItem.image = image;
!       type->attributes = attributes;
        type->identifier = 0;
!       type->name = _ILContextPersistString(image, name);
!       type->namespace = _ILContextPersistString(image, namespace);
!       type->scope = 0;
  
        /* Assign a token code to the exported type */
!       if(!_ILImageSetToken(image, &(type->programItem), token,
                                                 IL_META_TOKEN_EXPORTED_TYPE))
        {
--- 834,857 ----
  
        /* Set the exported type fields */
!       type->classItem.programItem.image = image;
!       type->classItem.attributes = attributes | IL_META_TYPEDEF_REFERENCE;
        type->identifier = 0;
!       type->classItem.name = _ILContextPersistString(image, name);
!       if(!(type->classItem.name))
!       {
!               return 0;
!       }
!       if(namespace)
!       {
!               type->classItem.namespace = _ILContextPersistString(image, 
namespace);
!               if(!(type->classItem.namespace))
!               {
!                       return 0;
!               }
!       }
!       type->classItem.scope = 0;
  
        /* Assign a token code to the exported type */
!       if(!_ILImageSetToken(image, &(type->classItem.programItem), token,
                                                 IL_META_TOKEN_EXPORTED_TYPE))
        {
***************
*** 848,860 ****
        }
  
        /* Return the exported type to the caller */
        return type;
  }
  
- ILUInt32 ILExportedTypeGetAttrs(ILExportedType *type)
- {
-       return type->attributes;
- }
- 
  void ILExportedTypeSetId(ILExportedType *type, ILUInt32 identifier)
  {
--- 859,884 ----
        }
  
+       /* Add the class to the context's hash table */
+       if(!ILHashAdd(image->context->classHash, &(type->classItem)))
+       {
+               return 0;
+       }
+ 
+       /* Add the namespace to the context's namespace table if not present */
+       if(namespace)
+       {
+               if(ILHashFind(image->context->namespaceHash, namespace) == 0)
+               {
+                       if(!ILHashAdd(image->context->namespaceHash, 
&(type->classItem)))
+                       {
+                               return 0;
+                       }
+               }
+       }
+ 
        /* Return the exported type to the caller */
        return type;
  }
  
  void ILExportedTypeSetId(ILExportedType *type, ILUInt32 identifier)
  {
***************
*** 867,898 ****
  }
  
- const char *ILExportedTypeGetName(ILExportedType *type)
- {
-       return type->name;
- }
- 
- const char *ILExportedTypeGetNamespace(ILExportedType *type)
- {
-       return type->namespace;
- }
- 
  void ILExportedTypeSetScopeFile(ILExportedType *type, ILFileDecl *decl)
  {
!       type->scope = (ILProgramItem *)decl;
  }
  
  void ILExportedTypeSetScopeAssembly(ILExportedType *type, ILAssembly *assem)
  {
!       type->scope = (ILProgramItem *)assem;
  }
  
  void ILExportedTypeSetScopeType(ILExportedType *type, ILExportedType *scope)
  {
!       type->scope = (ILProgramItem *)scope;
! }
! 
! ILProgramItem *ILExportedTypeGetScope(ILExportedType *type)
! {
!       return type->scope;
  }
  
--- 891,907 ----
  }
  
  void ILExportedTypeSetScopeFile(ILExportedType *type, ILFileDecl *decl)
  {
!       type->classItem.scope = (ILProgramItem *)decl;
  }
  
  void ILExportedTypeSetScopeAssembly(ILExportedType *type, ILAssembly *assem)
  {
!       type->classItem.scope = (ILProgramItem *)assem;
  }
  
  void ILExportedTypeSetScopeType(ILExportedType *type, ILExportedType *scope)
  {
!       type->classItem.scope = (ILProgramItem *)scope;
  }
  
***************
*** 910,925 ****
                                (image, IL_META_TOKEN_EXPORTED_TYPE, type)) != 
0)
        {
!               if(!strcmp(type->name, name))
                {
                        if(!namespace)
                        {
!                               if(!(type->namespace))
                                {
                                        return type;
                                }
                        }
!                       else if(type->namespace)
                        {
!                               if(!strcmp(type->namespace, namespace))
                                {
                                        return type;
--- 919,934 ----
                                (image, IL_META_TOKEN_EXPORTED_TYPE, type)) != 
0)
        {
!               if(!strcmp(type->classItem.name, name))
                {
                        if(!namespace)
                        {
!                               if(!(type->classItem.namespace))
                                {
                                        return type;
                                }
                        }
!                       else if(type->classItem.namespace)
                        {
!                               if(!strcmp(type->classItem.namespace, 
namespace))
                                {
                                        return type;

Index: program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/program.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** program.h   20 Feb 2003 22:35:21 -0000      1.14
--- program.h   28 Feb 2003 03:59:00 -0000      1.15
***************
*** 613,622 ****
  struct _tagILExportedType
  {
!       ILProgramItem   programItem;            /* Parent class fields */
!       ILUInt32                attributes;                     /* Attributes 
for the type */
        ILUInt32                identifier;                     /* Foreign 
identifier for the type */
-       const char     *name;                           /* Name for the type */
-       const char     *namespace;                      /* Namespace for the 
type */
-       ILProgramItem  *scope;                          /* Scope where the type 
exists */
  
  };
--- 613,618 ----
  struct _tagILExportedType
  {
!       ILClass                 classItem;                      /* Parent class 
fields */
        ILUInt32                identifier;                     /* Foreign 
identifier for the type */
  
  };





reply via email to

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