[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/image class.c,1.24,1.25 context.c,1.9,1.
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/image class.c,1.24,1.25 context.c,1.9,1.10 java_loader.c,1.7,1.8 link.c,1.18,1.19 meta_build.c,1.22,1.23 meta_types.c,1.8,1.9 meta_writer.c,1.9,1.10 misc_token.c,1.3,1.4 program.h,1.15,1.16 ser_parse.c,1.5,1.6 synthetic.c,1.10,1.11 |
Date: |
Thu, 27 Feb 2003 23:57:51 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv16376/image
Modified Files:
class.c context.c java_loader.c link.c meta_build.c
meta_types.c meta_writer.c misc_token.c program.h ser_parse.c
synthetic.c
Log Message:
Shift the name information out of ILClass into a separate ILClassName
record, so that we can eventually load the names before loading the classes.
Index: class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/class.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** class.c 28 Feb 2003 03:59:00 -0000 1.24
--- class.c 28 Feb 2003 04:57:46 -0000 1.25
***************
*** 25,28 ****
--- 25,98 ----
#endif
+ ILClassName *_ILClassNameCreate(ILImage *image, ILToken token,
+ const char
*name, const char *namespace,
+ ILProgramItem
*scope)
+ {
+ ILClassName *className;
+
+ /* Allocate memory for the name information */
+ className = ILMemStackAlloc(&(image->memStack), ILClassName);
+ if(!className)
+ {
+ return 0;
+ }
+
+ /* Populate the name information */
+ className->image = image;
+ className->token = token;
+ className->name = _ILContextPersistString(image, name);
+ if(!(className->name))
+ {
+ return 0;
+ }
+ if(namespace)
+ {
+ className->namespace = _ILContextPersistString(image,
namespace);
+ if(!(className->namespace))
+ {
+ return 0;
+ }
+ }
+ className->scope = scope;
+
+ /* Add the class name to the class name hash */
+ if(!ILHashAdd(image->context->classHash, className))
+ {
+ 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, className))
+ {
+ return 0;
+ }
+ }
+ }
+
+ /* Done */
+ return className;
+ }
+
+ void _ILClassNameUpdateToken(ILClass *info)
+ {
+ info->className->token = info->programItem.token;
+ }
+
+ ILClass *_ILClassNameToClass(ILClassName *className)
+ {
+ if(className)
+ {
+ return ILClass_FromToken(className->image, className->token);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
/*
* Add a nesting relationship between two classes.
***************
*** 144,189 ****
info->programItem.image = image;
info->parent = parent;
- info->scope = scope;
info->ext = 0;
! /* Create a nesting relationship with the scope if necessary */
! if(ILClassIsNestingScope(scope))
! {
! if(!AddNested((ILClass *)scope, info))
! {
! return 0;
! }
! }
!
! /* Create persistent versions of the name and namespace */
! info->name = _ILContextPersistString(image, name);
! if(!(info->name))
! {
! return 0;
! }
! if(namespace)
! {
! info->namespace = _ILContextPersistString(image, namespace);
! if(!(info->namespace))
! {
! return 0;
! }
! }
!
! /* Add the class to the context's hash table */
! if(!ILHashAdd(image->context->classHash, info))
{
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, info))
! {
! return 0;
! }
}
}
--- 214,232 ----
info->programItem.image = image;
info->parent = parent;
info->ext = 0;
! /* Create the class name record */
! info->className = _ILClassNameCreate(image, 0, name, namespace, scope);
! if(!(info->className))
{
return 0;
}
! /* Create a nesting relationship with the scope if necessary */
! if(ILClassIsNestingScope(scope))
{
! if(!AddNested((ILClass *)scope, info))
{
! return 0;
}
}
***************
*** 230,233 ****
--- 273,277 ----
return 0;
}
+ _ILClassNameUpdateToken(info);
/* If this is a nested class, then move it to the
***************
*** 235,241 ****
methods will appear in the correct order in the
final output file */
! if(ILClassIsNestingScope(info->scope))
{
! MoveNestedToEnd((ILClass *)(info->scope), info);
}
--- 279,285 ----
methods will appear in the correct order in the
final output file */
! if(ILClassIsNestingScope(info->className->scope))
{
! MoveNestedToEnd((ILClass
*)(info->className->scope), info);
}
***************
*** 260,263 ****
--- 304,308 ----
return 0;
}
+ _ILClassNameUpdateToken(info);
}
return info;
***************
*** 287,290 ****
--- 332,336 ----
return 0;
}
+ _ILClassNameUpdateToken(info);
}
***************
*** 328,331 ****
--- 374,378 ----
ILClass *ILClassImport(ILImage *image, ILClass *info)
{
+ ILClassName *newName;
ILClass *newInfo;
ILProgramItem *scope;
***************
*** 339,346 ****
/* Determine the scope to use for the import */
! if(ILClassIsNestingScope(info->scope))
{
/* Importing a nested class, so import its parent first */
! newInfo = ILClassImport(image, (ILClass *)(info->scope));
if(!newInfo)
{
--- 386,393 ----
/* Determine the scope to use for the import */
! if(ILClassIsNestingScope(info->className->scope))
{
/* Importing a nested class, so import its parent first */
! newInfo = ILClassImport(image, (ILClass
*)(info->className->scope));
if(!newInfo)
{
***************
*** 361,374 ****
/* See if we already have a reference to this class */
! key.name = info->name;
! key.nameLen = strlen(info->name);
! key.namespace = info->namespace;
! key.namespaceLen = (info->namespace ? strlen(info->namespace) : 0);
key.scope = scope;
key.image = image;
key.wantGlobal = 0;
! newInfo = ILHashFindType(image->context->classHash, &key, ILClass);
! if(newInfo != 0)
{
/* Link "newInfo" to "info" */
if(!_ILProgramItemLinkedTo(&(newInfo->programItem)))
--- 408,429 ----
/* See if we already have a reference to this class */
! key.name = info->className->name;
! key.nameLen = strlen(info->className->name);
! key.namespace = info->className->namespace;
! key.namespaceLen = (info->className->namespace ?
!
strlen(info->className->namespace) : 0);
key.scope = scope;
key.image = image;
key.wantGlobal = 0;
! newName = ILHashFindType(image->context->classHash, &key, ILClassName);
! if(newName != 0)
{
+ /* Resolve the named class */
+ newInfo = _ILClassNameToClass(newName);
+ if(!(newInfo))
+ {
+ return 0;
+ }
+
/* Link "newInfo" to "info" */
if(!_ILProgramItemLinkedTo(&(newInfo->programItem)))
***************
*** 384,388 ****
/* Create a new reference */
! newInfo = ILClassCreateRef(scope, 0, info->name, info->namespace);
if(!newInfo)
{
--- 439,444 ----
/* Create a new reference */
! newInfo = ILClassCreateRef(scope, 0, info->className->name,
!
info->className->namespace);
if(!newInfo)
{
***************
*** 443,457 ****
ILProgramItem *ILClassGetScope(ILClass *info)
{
! return info->scope;
}
const char *ILClassGetName(ILClass *info)
{
! return info->name;
}
const char *ILClassGetNamespace(ILClass *info)
{
! return info->namespace;
}
--- 499,513 ----
ILProgramItem *ILClassGetScope(ILClass *info)
{
! return info->className->scope;
}
const char *ILClassGetName(ILClass *info)
{
! return info->className->name;
}
const char *ILClassGetNamespace(ILClass *info)
{
! return info->className->namespace;
}
***************
*** 474,480 ****
* Matching function that is used by "_ILClassRemoveAllFromHash".
*/
! static int ClassRemove_Match(const ILClass *classInfo, ILImage *key)
{
! return (classInfo->programItem.image == key);
}
--- 530,536 ----
* Matching function that is used by "_ILClassRemoveAllFromHash".
*/
! static int ClassRemove_Match(const ILClassName *className, ILImage *key)
{
! return (className->image == key);
}
***************
*** 527,531 ****
key.wantGlobal = 0;
key.ignoreCase = 0;
! return ILHashFindType(scope->image->context->classHash, &key, ILClass);
}
--- 583,588 ----
key.wantGlobal = 0;
key.ignoreCase = 0;
! return _ILClassNameToClass
! (ILHashFindType(scope->image->context->classHash, &key,
ILClassName));
}
***************
*** 543,547 ****
key.wantGlobal = 0;
key.ignoreCase = 0;
! return ILHashFindType(scope->image->context->classHash, &key, ILClass);
}
--- 600,605 ----
key.wantGlobal = 0;
key.ignoreCase = 0;
! return _ILClassNameToClass
! (ILHashFindType(scope->image->context->classHash, &key,
ILClassName));
}
***************
*** 633,637 ****
* Match a hash table element against a supplied key.
*/
! static int UnicodeMatch(const ILClass *classInfo, const ILClassKeyInfo *key)
{
/* Match the namespace */
--- 691,696 ----
* Match a hash table element against a supplied key.
*/
! static int UnicodeMatch(const ILClassName *classInfo,
! const ILClassKeyInfo *key)
{
/* Match the namespace */
***************
*** 664,668 ****
/* Match the image */
! if(key->image && key->image != classInfo->programItem.image)
{
return 0;
--- 723,727 ----
/* Match the image */
! if(key->image && key->image != classInfo->image)
{
return 0;
***************
*** 697,703 ****
key.wantGlobal = 0;
key.ignoreCase = ignoreCase;
! return ILHashFindAltType(scope->image->context->classHash, &key,
ILClass,
!
(ILHashKeyComputeFunc)UnicodeHashKey,
!
(ILHashMatchFunc)UnicodeMatch);
}
--- 756,763 ----
key.wantGlobal = 0;
key.ignoreCase = ignoreCase;
! return _ILClassNameToClass
! (ILHashFindAltType(scope->image->context->classHash, &key,
ILClassName,
!
(ILHashKeyComputeFunc)UnicodeHashKey,
!
(ILHashMatchFunc)UnicodeMatch));
}
***************
*** 714,718 ****
key.wantGlobal = 1;
key.ignoreCase = 0;
! return ILHashFindType(context->classHash, &key, ILClass);
}
--- 774,779 ----
key.wantGlobal = 1;
key.ignoreCase = 0;
! return _ILClassNameToClass
! (ILHashFindType(context->classHash, &key, ILClassName));
}
***************
*** 730,734 ****
key.wantGlobal = 1;
key.ignoreCase = 0;
! return ILHashFindType(context->classHash, &key, ILClass);
}
--- 791,796 ----
key.wantGlobal = 1;
key.ignoreCase = 0;
! return _ILClassNameToClass
! (ILHashFindType(context->classHash, &key, ILClassName));
}
***************
*** 747,753 ****
key.wantGlobal = 1;
key.ignoreCase = ignoreCase;
! return ILHashFindAltType(context->classHash, &key, ILClass,
!
(ILHashKeyComputeFunc)UnicodeHashKey,
!
(ILHashMatchFunc)UnicodeMatch);
}
--- 809,816 ----
key.wantGlobal = 1;
key.ignoreCase = ignoreCase;
! return _ILClassNameToClass
! (ILHashFindAltType(context->classHash, &key, ILClassName,
!
(ILHashKeyComputeFunc)UnicodeHashKey,
!
(ILHashMatchFunc)UnicodeMatch));
}
***************
*** 980,986 ****
ILClass *ILClassGetNestedParent(ILClass *info)
{
! if(ILClassIsNestingScope(info->scope))
{
! return (ILClass *)(info->scope);
}
else
--- 1043,1049 ----
ILClass *ILClassGetNestedParent(ILClass *info)
{
! if(ILClassIsNestingScope(info->className->scope))
{
! return (ILClass *)(info->className->scope);
}
else
***************
*** 1018,1022 ****
return 0;
}
! if(info->scope == (ILProgramItem *)scope)
{
return 1;
--- 1081,1085 ----
return 0;
}
! if(info->className->scope == (ILProgramItem *)scope)
{
return 1;
***************
*** 1270,1337 ****
/* Check for system classes with primitive equivalents */
! if(info->namespace && !strcmp(info->namespace, "System") &&
ILClassGetNestedParent(info) == 0)
{
! if(!strcmp(info->name, "Boolean"))
{
return ILType_Boolean;
}
! else if(!strcmp(info->name, "SByte"))
{
return ILType_Int8;
}
! else if(!strcmp(info->name, "Byte"))
{
return ILType_UInt8;
}
! else if(!strcmp(info->name, "Int16"))
{
return ILType_Int16;
}
! else if(!strcmp(info->name, "UInt16"))
{
return ILType_UInt16;
}
! else if(!strcmp(info->name, "Char"))
{
return ILType_Char;
}
! else if(!strcmp(info->name, "Int32"))
{
return ILType_Int32;
}
! else if(!strcmp(info->name, "UInt32"))
{
return ILType_UInt32;
}
! else if(!strcmp(info->name, "Int64"))
{
return ILType_Int64;
}
! else if(!strcmp(info->name, "UInt64"))
{
return ILType_UInt64;
}
! else if(!strcmp(info->name, "Single"))
{
return ILType_Float32;
}
! else if(!strcmp(info->name, "Double"))
{
return ILType_Float64;
}
! else if(!strcmp(info->name, "IntPtr"))
{
return ILType_Int;
}
! else if(!strcmp(info->name, "UIntPtr"))
{
return ILType_UInt;
}
! else if(!strcmp(info->name, "Void"))
{
return ILType_Void;
}
! else if(!strcmp(info->name, "TypedReference"))
{
return ILType_TypedRef;
--- 1333,1401 ----
/* Check for system classes with primitive equivalents */
! if(info->className->namespace &&
! !strcmp(info->className->namespace, "System") &&
ILClassGetNestedParent(info) == 0)
{
! if(!strcmp(info->className->name, "Boolean"))
{
return ILType_Boolean;
}
! else if(!strcmp(info->className->name, "SByte"))
{
return ILType_Int8;
}
! else if(!strcmp(info->className->name, "Byte"))
{
return ILType_UInt8;
}
! else if(!strcmp(info->className->name, "Int16"))
{
return ILType_Int16;
}
! else if(!strcmp(info->className->name, "UInt16"))
{
return ILType_UInt16;
}
! else if(!strcmp(info->className->name, "Char"))
{
return ILType_Char;
}
! else if(!strcmp(info->className->name, "Int32"))
{
return ILType_Int32;
}
! else if(!strcmp(info->className->name, "UInt32"))
{
return ILType_UInt32;
}
! else if(!strcmp(info->className->name, "Int64"))
{
return ILType_Int64;
}
! else if(!strcmp(info->className->name, "UInt64"))
{
return ILType_UInt64;
}
! else if(!strcmp(info->className->name, "Single"))
{
return ILType_Float32;
}
! else if(!strcmp(info->className->name, "Double"))
{
return ILType_Float64;
}
! else if(!strcmp(info->className->name, "IntPtr"))
{
return ILType_Int;
}
! else if(!strcmp(info->className->name, "UIntPtr"))
{
return ILType_UInt;
}
! else if(!strcmp(info->className->name, "Void"))
{
return ILType_Void;
}
! else if(!strcmp(info->className->name, "TypedReference"))
{
return ILType_TypedRef;
Index: context.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** context.c 23 Feb 2003 02:28:19 -0000 1.9
--- context.c 28 Feb 2003 04:57:46 -0000 1.10
***************
*** 52,56 ****
* Compute the hash value for a class.
*/
! static unsigned long ClassHash_Compute(const ILClass *classInfo)
{
unsigned long hash;
--- 52,56 ----
* Compute the hash value for a class.
*/
! static unsigned long ClassHash_Compute(const ILClassName *classInfo)
{
unsigned long hash;
***************
*** 89,93 ****
* Match a hash table element against a supplied key.
*/
! static int ClassHash_Match(const ILClass *classInfo, const ILClassKeyInfo
*key)
{
/* Match the namespace */
--- 89,94 ----
* Match a hash table element against a supplied key.
*/
! static int ClassHash_Match(const ILClassName *classInfo,
! const ILClassKeyInfo *key)
{
/* Match the namespace */
***************
*** 120,124 ****
/* Match the image */
! if(key->image && key->image != classInfo->programItem.image)
{
return 0;
--- 121,125 ----
/* Match the image */
! if(key->image && key->image != classInfo->image)
{
return 0;
***************
*** 142,146 ****
* Compute the hash value for a namespace.
*/
! static unsigned long NamespaceHash_Compute(const ILClass *classInfo)
{
if(classInfo->namespace)
--- 143,147 ----
* Compute the hash value for a namespace.
*/
! static unsigned long NamespaceHash_Compute(const ILClassName *classInfo)
{
if(classInfo->namespace)
***************
*** 173,177 ****
* Match a hash table element against a supplied namespace key.
*/
! static int NamespaceHash_Match(const ILClass *classInfo, const char *key)
{
int len;
--- 174,178 ----
* Match a hash table element against a supplied namespace key.
*/
! static int NamespaceHash_Match(const ILClassName *classInfo, const char *key)
{
int len;
Index: java_loader.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/java_loader.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** java_loader.c 5 Oct 2002 04:25:40 -0000 1.7
--- java_loader.c 28 Feb 2003 04:57:46 -0000 1.8
***************
*** 1162,1167 ****
/* Convert the class from a reference into a definition */
! ILClassCreate(ILClassGlobalScope(image), 0, classInfo->name,
! classInfo->namespace, otherClass);
ILClassSetAttrs(classInfo, IL_MAX_UINT32, accessFlags);
--- 1162,1167 ----
/* Convert the class from a reference into a definition */
! ILClassCreate(ILClassGlobalScope(image), 0, classInfo->className->name,
! classInfo->className->namespace, otherClass);
ILClassSetAttrs(classInfo, IL_MAX_UINT32, accessFlags);
Index: link.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/link.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** link.c 15 Jan 2003 14:45:04 -0000 1.18
--- link.c 28 Feb 2003 04:57:47 -0000 1.19
***************
*** 742,746 ****
{
method = ILProgramItemToMethod(ILAttributeTypeAsItem(attr));
! if(method != 0 && !strcmp(method->member.owner->name,
"DllImportMapAttribute"))
{
--- 742,746 ----
{
method = ILProgramItemToMethod(ILAttributeTypeAsItem(attr));
! if(method != 0 && !strcmp(method->member.owner->className->name,
"DllImportMapAttribute"))
{
Index: meta_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_build.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** meta_build.c 28 Feb 2003 00:26:28 -0000 1.22
--- meta_build.c 28 Feb 2003 04:57:47 -0000 1.23
***************
*** 463,467 ****
/* Skip this token if it does not have module scope */
info = (ILClass *)(table[(token & ~IL_META_TOKEN_MASK) - 1]);
! scope = (info ? info->scope : 0);
if(!info || !ScopeIsModule(scope))
{
--- 463,467 ----
/* Skip this token if it does not have module scope */
info = (ILClass *)(table[(token & ~IL_META_TOKEN_MASK) - 1]);
! scope = (info ? info->className->scope : 0);
if(!info || !ScopeIsModule(scope))
{
***************
*** 501,505 ****
/* Global class: look in any image for the type */
importInfo = ILClassLookupGlobal(image->context,
!
info->name, info->namespace);
}
else
--- 501,506 ----
/* Global class: look in any image for the type */
importInfo = ILClassLookupGlobal(image->context,
!
info->className->name,
!
info->className->namespace);
}
else
***************
*** 509,513 ****
if(scope)
{
! importInfo = ILClassLookup(scope, info->name,
info->namespace);
}
else
--- 510,515 ----
if(scope)
{
! importInfo = ILClassLookup(scope,
info->className->name,
!
info->className->namespace);
}
else
***************
*** 529,533 ****
{
#if IL_DEBUG_META
! ReportResolveError(image, 0, info->name,
info->namespace);
#endif
error = IL_LOADERR_UNRESOLVED;
--- 531,536 ----
{
#if IL_DEBUG_META
! ReportResolveError(image, 0, info->className->name,
!
info->className->namespace);
#endif
error = IL_LOADERR_UNRESOLVED;
***************
*** 1865,1874 ****
if(classInfo)
{
! if(classInfo->namespace &&
! !strcmp(classInfo->namespace, "$Synthetic"))
{
fprintf(stderr,
"token 0x%08lX: member `%s.%s'
not found\n",
! (unsigned long)token,
classInfo->name, name);
}
else
--- 1868,1877 ----
if(classInfo)
{
! if(classInfo->className->namespace &&
! !strcmp(classInfo->className->namespace,
"$Synthetic"))
{
fprintf(stderr,
"token 0x%08lX: member `%s.%s'
not found\n",
! (unsigned long)token,
classInfo->className->name, name);
}
else
***************
*** 1877,1883 ****
"token 0x%08lX: member
`%s%s%s.%s' not found\n",
(unsigned long)token,
! (classInfo->namespace ?
classInfo->namespace : ""),
! (classInfo->namespace ? "." :
""),
! classInfo->name, name);
}
}
--- 1880,1887 ----
"token 0x%08lX: member
`%s%s%s.%s' not found\n",
(unsigned long)token,
! (classInfo->className->namespace
! ?
classInfo->className->namespace : ""),
!
(classInfo->className->namespace ? "." : ""),
! classInfo->className->name,
name);
}
}
Index: meta_types.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_types.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** meta_types.c 19 Feb 2003 02:00:01 -0000 1.8
--- meta_types.c 28 Feb 2003 04:57:47 -0000 1.9
***************
*** 598,606 ****
len = 0;
}
! if(info->namespace)
{
! len += strlen(info->namespace) + 1;
}
! len += strlen(info->name) + 1;
/* Build the fully-qualified class name */
--- 598,606 ----
len = 0;
}
! if(info->className->namespace)
{
! len += strlen(info->className->namespace) + 1;
}
! len += strlen(info->className->name) + 1;
/* Build the fully-qualified class name */
***************
*** 619,629 ****
len = 0;
}
! if(info->namespace)
{
! strcpy(name + len, info->namespace);
! len += strlen(info->namespace);
name[len++] = '.';
}
! strcpy(name + len, info->name);
}
return name;
--- 619,629 ----
len = 0;
}
! if(info->className->namespace)
{
! strcpy(name + len, info->className->namespace);
! len += strlen(info->className->namespace);
name[len++] = '.';
}
! strcpy(name + len, info->className->name);
}
return name;
***************
*** 912,917 ****
/* Check the name against "System.String" */
info = ILClassResolve(ILType_ToClass(type));
! if(!strcmp(info->name, "String") &&
! info->namespace && !strcmp(info->namespace, "System"))
{
/* Check that it is within the system image, to prevent
--- 912,918 ----
/* Check the name against "System.String" */
info = ILClassResolve(ILType_ToClass(type));
! if(!strcmp(info->className->name, "String") &&
! info->className->namespace &&
! !strcmp(info->className->namespace, "System"))
{
/* Check that it is within the system image, to prevent
***************
*** 937,942 ****
/* Check the name against "System.String" */
info = ILClassResolve(ILType_ToClass(type));
! if(!strcmp(info->name, "Object") &&
! info->namespace && !strcmp(info->namespace, "System"))
{
/* Check that it is within the system image, to prevent
--- 938,944 ----
/* Check the name against "System.String" */
info = ILClassResolve(ILType_ToClass(type));
! if(!strcmp(info->className->name, "Object") &&
! info->className->namespace &&
! !strcmp(info->className->namespace, "System"))
{
/* Check that it is within the system image, to prevent
Index: meta_writer.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_writer.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** meta_writer.c 28 Feb 2003 03:59:00 -0000 1.9
--- meta_writer.c 28 Feb 2003 04:57:47 -0000 1.10
***************
*** 122,129 ****
}
}
! else if(info->scope)
{
/* Refers to a type in a foreign scope */
! values[IL_OFFSET_TYPEREF_SCOPE] = info->scope->token;
}
else if(!ILClassIsRef(info))
--- 122,129 ----
}
}
! else if(info->className->scope)
{
/* Refers to a type in a foreign scope */
! values[IL_OFFSET_TYPEREF_SCOPE] = info->className->scope->token;
}
else if(!ILClassIsRef(info))
***************
*** 137,143 ****
values[IL_OFFSET_TYPEREF_SCOPE] = 0;
}
! values[IL_OFFSET_TYPEREF_NAME] = GetPersistString(image, info->name);
values[IL_OFFSET_TYPEREF_NAMESPACE] =
! GetPersistString(image, info->namespace);
}
--- 137,144 ----
values[IL_OFFSET_TYPEREF_SCOPE] = 0;
}
! values[IL_OFFSET_TYPEREF_NAME] =
! GetPersistString(image, info->className->name);
values[IL_OFFSET_TYPEREF_NAMESPACE] =
! GetPersistString(image, info->className->namespace);
}
***************
*** 188,194 ****
values[IL_OFFSET_TYPEDEF_ATTRS] =
(info->attributes & ~IL_META_TYPEDEF_SYSTEM_MASK);
! values[IL_OFFSET_TYPEDEF_NAME] = GetPersistString(image, info->name);
values[IL_OFFSET_TYPEDEF_NAMESPACE] =
! GetPersistString(image, info->namespace);
if(info->parent)
{
--- 189,196 ----
values[IL_OFFSET_TYPEDEF_ATTRS] =
(info->attributes & ~IL_META_TYPEDEF_SYSTEM_MASK);
! values[IL_OFFSET_TYPEDEF_NAME] =
! GetPersistString(image, info->className->name);
values[IL_OFFSET_TYPEDEF_NAMESPACE] =
! GetPersistString(image, info->className->namespace);
if(info->parent)
{
***************
*** 651,658 ****
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;
}
--- 653,660 ----
values[IL_OFFSET_EXPTYPE_CLASS] = type->identifier;
values[IL_OFFSET_EXPTYPE_NAME] =
! GetPersistString(image,
type->classItem.className->name);
values[IL_OFFSET_EXPTYPE_NAMESPACE] =
! GetPersistString(image,
type->classItem.className->namespace);
! values[IL_OFFSET_EXPTYPE_FILE] =
type->classItem.className->scope->token;
}
Index: misc_token.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/misc_token.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** misc_token.c 28 Feb 2003 03:59:00 -0000 1.3
--- misc_token.c 28 Feb 2003 04:57:47 -0000 1.4
***************
*** 836,854 ****
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 */
--- 836,846 ----
type->classItem.programItem.image = image;
type->classItem.attributes = attributes | IL_META_TYPEDEF_REFERENCE;
! type->classItem.className =
! _ILClassNameCreate(image, token, name, namespace, 0);
! if(!(type->classItem.className))
{
return 0;
}
! type->identifier = 0;
/* Assign a token code to the exported type */
***************
*** 858,879 ****
return 0;
}
!
! /* 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 */
--- 850,854 ----
return 0;
}
! _ILClassNameUpdateToken(&(type->classItem));
/* Return the exported type to the caller */
***************
*** 893,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;
}
--- 868,882 ----
void ILExportedTypeSetScopeFile(ILExportedType *type, ILFileDecl *decl)
{
! type->classItem.className->scope = (ILProgramItem *)decl;
}
void ILExportedTypeSetScopeAssembly(ILExportedType *type, ILAssembly *assem)
{
! type->classItem.className->scope = (ILProgramItem *)assem;
}
void ILExportedTypeSetScopeType(ILExportedType *type, ILExportedType *scope)
{
! type->classItem.className->scope = (ILProgramItem *)scope;
}
***************
*** 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;
--- 894,909 ----
(image, IL_META_TOKEN_EXPORTED_TYPE, type)) !=
0)
{
! if(!strcmp(type->classItem.className->name, name))
{
if(!namespace)
{
! if(!(type->classItem.className->namespace))
{
return type;
}
}
! else if(type->classItem.className->namespace)
{
!
if(!strcmp(type->classItem.className->namespace, namespace))
{
return type;
Index: program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/program.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** program.h 28 Feb 2003 03:59:00 -0000 1.15
--- program.h 28 Feb 2003 04:57:47 -0000 1.16
***************
*** 220,223 ****
--- 220,254 ----
/*
+ * Information about a class name.
+ */
+ typedef struct _tagILClassName ILClassName;
+ struct _tagILClassName
+ {
+ ILImage *image; /* Image
containing the class */
+ ILToken token; /* Token code
for the class */
+ const char *name; /* Name of the
class */
+ const char *namespace; /* Name of the class's
namespace */
+ ILProgramItem *scope; /* Scope that the class
is defined in */
+ };
+
+ /*
+ * Create a new class name.
+ */
+ ILClassName *_ILClassNameCreate(ILImage *image, ILToken token,
+ const char
*name, const char *namespace,
+ ILProgramItem
*scope);
+
+ /*
+ * Update class name token information for a class.
+ */
+ void _ILClassNameUpdateToken(ILClass *info);
+
+ /*
+ * Convert a class name into the actual class, performing dynamic
+ * token lookup as necessary.
+ */
+ ILClass *_ILClassNameToClass(ILClassName *className);
+
+ /*
* Information about a class.
*/
***************
*** 226,231 ****
ILProgramItem programItem; /* Parent class fields */
ILUInt32 attributes; /*
IL_META_TYPEDEF_xxx flags */
! const char *name; /* Name of the
class */
! const char *namespace; /* Name of the class's
namespace */
ILClass *parent; /* Parent class
*/
ILImplements *implements; /* List of implemented
interfaces */
--- 257,261 ----
ILProgramItem programItem; /* Parent class fields */
ILUInt32 attributes; /*
IL_META_TYPEDEF_xxx flags */
! ILClassName *className; /* Name information for
the class */
ILClass *parent; /* Parent class
*/
ILImplements *implements; /* List of implemented
interfaces */
***************
*** 233,237 ****
ILMember *lastMember; /* Last member owned by
the class */
ILNestedInfo *nestedChildren; /* List of nested children */
- ILProgramItem *scope; /* Scope that the class
is defined in */
ILType *synthetic; /* Synthetic type for
this class */
ILClassExt *ext; /* Extension
information */
--- 263,266 ----
Index: ser_parse.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/ser_parse.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** ser_parse.c 11 Jun 2002 04:02:03 -0000 1.5
--- ser_parse.c 28 Feb 2003 04:57:47 -0000 1.6
***************
*** 110,117 ****
/* Check for "System.String" and "System.Type" */
classInfo = ILType_ToClass(type);
! if(!strcmp(classInfo->name, "String"))
{
! if(classInfo->namespace &&
! !strcmp(classInfo->namespace, "System") &&
ILClassGetNestedParent(classInfo) == 0)
{
--- 110,117 ----
/* Check for "System.String" and "System.Type" */
classInfo = ILType_ToClass(type);
! if(!strcmp(classInfo->className->name, "String"))
{
! if(classInfo->className->namespace &&
! !strcmp(classInfo->className->namespace, "System") &&
ILClassGetNestedParent(classInfo) == 0)
{
***************
*** 119,126 ****
}
}
! else if(!strcmp(classInfo->name, "Type"))
{
! if(classInfo->namespace &&
! !strcmp(classInfo->namespace, "System") &&
ILClassGetNestedParent(classInfo) == 0)
{
--- 119,126 ----
}
}
! else if(!strcmp(classInfo->className->name, "Type"))
{
! if(classInfo->className->namespace &&
! !strcmp(classInfo->className->namespace, "System") &&
ILClassGetNestedParent(classInfo) == 0)
{
Index: synthetic.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/synthetic.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** synthetic.c 20 Feb 2003 22:35:21 -0000 1.10
--- synthetic.c 28 Feb 2003 04:57:47 -0000 1.11
***************
*** 40,53 ****
{
ILClass *classInfo = ILType_ToClass(type);
! if(classInfo->namespace)
{
return ILHashString(ILHashString(ILHashString
!
(start, classInfo->namespace, -1),
!
".", 1),
!
classInfo->name, -1);
}
else
{
! return ILHashString(start, classInfo->name, -1);
}
}
--- 40,53 ----
{
ILClass *classInfo = ILType_ToClass(type);
! if(classInfo->className->namespace)
{
return ILHashString(ILHashString(ILHashString
! (start,
classInfo->className->namespace, -1),
! ".", 1),
!
classInfo->className->name, -1);
}
else
{
! return ILHashString(start, classInfo->className->name,
-1);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/image class.c,1.24,1.25 context.c,1.9,1.10 java_loader.c,1.7,1.8 link.c,1.18,1.19 meta_build.c,1.22,1.23 meta_types.c,1.8,1.9 meta_writer.c,1.9,1.10 misc_token.c,1.3,1.4 program.h,1.15,1.16 ser_parse.c,1.5,1.6 synthetic.c,1.10,1.11,
Rhys Weatherley <address@hidden> <=