* Headers/gnustep/base/GSObjCRuntime.h:

* Source/Additions/GSObjCRuntime.m:
	Added typedef for GSIVar.
	(GSCGetInstanceVariableDefinition): New function.
	(GSObjCGetInstanceVariableDefinition): Ditto.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17168 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Ayers 2003-07-07 10:31:59 +00:00
parent afb5488c8b
commit e8cc1affaf
3 changed files with 63 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2003-07-07 David Ayers <d.ayers@inode.at>
* Headers/gnustep/base/GSObjCRuntime.h:
* Source/Additions/GSObjCRuntime.m:
Added typedef for GSIVar.
(GSCGetInstanceVariableDefinition): New function.
(GSObjCGetInstanceVariableDefinition): Ditto.
2003-07-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Source/GSFFCallInvocation.m: gs_objc_msg_forward() trust the

View file

@ -272,11 +272,12 @@ GSTypesFromSelector(SEL this)
/*
* Unfortunately the definition of the symbol 'Method'
* Unfortunately the definition of the symbol 'Method' "IVar(_t)"
* is incompatible between the GNU and NeXT/Apple runtimes.
* We introduce GSMethod to allow portability.
* We introduce GSMethod and GSIVar to allow portability.
*/
typedef struct objc_method *GSMethod;
typedef struct objc_ivar *GSIVar;
/**
* Returns the pointer to the instance method structure
@ -365,6 +366,31 @@ GSFlushMethodCacheForClass (Class class)
__objc_update_dispatch_table_for_class (class);
}
/**
* Returns the pointer to the instance variable structure
* for the instance variable name in the specified class.
* This function searches the specified class and its superclasses.<br/>
* It should be safe to use this function in +load implementations.<br/>
* This function should currently (June 2003) be considered WIP.
* Please follow potential changes (Name, parameters, ...) closely until
* it stabilizes.
*/
GS_EXPORT GSIVar
GSCGetInstanceVariableDefinition(Class class, const char *name);
/**
* Returns the pointer to the instance variable structure
* for the instance variable name in the specified class.
* This function searches the specified class and its superclasses.<br/>
* It is not necessarily safe to use this function
* in +load implementations.<br/>
* This function should currently (June 2003) be considered WIP.
* Please follow potential changes (Name, parameters, ...) closely until
* it stabilizes.
*/
GS_EXPORT GSIVar
GSObjCGetInstanceVariableDefinition(Class class, NSString *name);
/**
* Returns the superclass of this.

View file

@ -676,6 +676,33 @@ GSGetClassMethodNotInhertited (Class class, SEL sel)
return search_for_method_in_class (class->class_pointer, sel);
}
/* See header for documentation. */
GSIVar
GSCGetInstanceVariableDefinition(Class class, const char *name)
{
struct objc_ivar_list *list;
int i;
list = class->ivars;
for (i = 0; i < list->ivar_count; i++)
{
if (strcmp (list->ivar_list[i].ivar_name, name) == 0)
return &(list->ivar_list[i]);
}
class = GSObjCSuper(class);
if (class != 0)
{
return GSCGetInstanceVariableDefinition(class, name);
}
return 0;
}
GSIVar
GSObjCGetInstanceVariableDefinition(Class class, NSString *name)
{
return GSCGetInstanceVariableDefinition(class, [name cString]);
}
/**
* <p>A Behavior can be seen as a "Protocol with an implementation" or a