diff --git a/ChangeLog b/ChangeLog index 8b1cce4e9..fd876da35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ * Tools/AGSOutput.m: Bugfix to output ivar type information. * Tools/AGSHtml.m: Reduce space around examples. Bugs reported by Chris B. Vetter + * Source/Additions/GSObjCRuntime.m: Tidied function name conventions. + * Headers/gnustep/base/GSObjCRuntime.h: ditto. + * Source/NSKeyValueCoding.m: Use new function names. 2002-11-27 Manuel Guesdon diff --git a/Headers/gnustep/base/GSMime.h b/Headers/gnustep/base/GSMime.h index 3767def22..44781c465 100644 --- a/Headers/gnustep/base/GSMime.h +++ b/Headers/gnustep/base/GSMime.h @@ -130,7 +130,7 @@ name: (NSString*)name; - (void) setContent: (id)newContent type: (NSString*)type - subtype: (NSString*)subType + subtype: (NSString*)subtype name: (NSString*)name; - (void) setHeader: (GSMimeHeader*)info; diff --git a/Headers/gnustep/base/GSObjCRuntime.h b/Headers/gnustep/base/GSObjCRuntime.h index bbad3d26e..67266d128 100644 --- a/Headers/gnustep/base/GSObjCRuntime.h +++ b/Headers/gnustep/base/GSObjCRuntime.h @@ -83,29 +83,30 @@ GS_EXPORT void GSObjCGetVariable(id obj, int offset, unsigned int size, GS_EXPORT void GSObjCSetVariable(id obj, int offset, unsigned int size, const void *data); -/* - * The next three are old (deprecated) names for the same thing. - */ -GS_EXPORT BOOL GSFindInstanceVariable(id obj, const char *name, - const char **type, unsigned int *size, int *offset); -GS_EXPORT void GSGetVariable(id obj, int offset, unsigned int size, void *data); -GS_EXPORT void GSSetVariable(id obj, int offset, unsigned int size, - const void *data); - GS_EXPORT void GSObjCAddClassBehavior(Class receiver, Class behavior); GS_EXPORT NSValue* GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars); GS_EXPORT void GSObjCAddClasses(NSArray *classes); - - - /* * Functions for key-value encoding ... they access values in an object * either by selector or directly, but do so using NSNumber for the * scalar types of data. */ +GS_EXPORT id GSObjCGetValue(NSObject *self, NSString *key, SEL sel, + const char *type, unsigned size, int offset); +GS_EXPORT void GSObjCSetValue(NSObject *self, NSString *key, id val, SEL sel, + const char *type, unsigned size, int offset); + +/* + * The next five are old (deprecated) names for the same thing. + */ +GS_EXPORT BOOL GSFindInstanceVariable(id obj, const char *name, + const char **type, unsigned int *size, int *offset); +GS_EXPORT void GSGetVariable(id obj, int offset, unsigned int size, void *data); +GS_EXPORT void GSSetVariable(id obj, int offset, unsigned int size, + const void *data); GS_EXPORT id GSGetValue(NSObject *self, NSString *key, SEL sel, const char *type, unsigned size, int offset); GS_EXPORT void GSSetValue(NSObject *self, NSString *key, id val, SEL sel, diff --git a/Source/Additions/GSObjCRuntime.m b/Source/Additions/GSObjCRuntime.m index 4dd423723..d82c44de8 100644 --- a/Source/Additions/GSObjCRuntime.m +++ b/Source/Additions/GSObjCRuntime.m @@ -38,6 +38,7 @@ #include #include +/** Deprecated ... use GSObjCFindInstanceVariable() */ BOOL GSFindInstanceVariable(id obj, const char *name, const char **type, unsigned int *size, int *offset) @@ -93,33 +94,36 @@ GSObjCFindInstanceVariable(id obj, const char *name, return YES; } -/** - * This function performs no checking ... you should use it only where - * you are providing information from a call to GSFindInstanceVariable() - * and you know that the data area provided is the correct size. - */ +/** Deprecated ... use GSObjCGetVariable() */ void GSGetVariable(id obj, int offset, unsigned int size, void *data) { GSObjCGetVariable(obj, offset, size, data); } +/** + * Gets the value from an instance variable in obj
+ * This function performs no checking ... you should use it only where + * you are providing information from a call to GSFindInstanceVariable() + * and you know that the data area provided is the correct size. + */ void GSObjCGetVariable(id obj, int offset, unsigned int size, void *data) { memcpy(data, ((void*)obj) + offset, size); } -/** - * This function performs no checking ... you should use it only where - * you are providing information from a call to GSFindInstanceVariable() - * and you know that the data area provided is the correct size. - */ +/** Deprecated ... use GSObjCSetVariable() */ void GSSetVariable(id obj, int offset, unsigned int size, const void *data) { GSObjCSetVariable(obj, offset, size, data); } - +/** + * Sets the value in an instance variable in obj
+ * This function performs no checking ... you should use it only where + * you are providing information from a call to GSFindInstanceVariable() + * and you know that the data area provided is the correct size. + */ void GSObjCSetVariable(id obj, int offset, unsigned int size, const void *data) { @@ -625,6 +629,14 @@ GSObjCAddClassBehavior(Class receiver, Class behavior) #include #include + +/** Deprecated ... use GSObjCGetValue() */ +id +GSGetValue(NSObject *self, NSString *key, SEL sel, + const char *type, unsigned size, int offset) +{ + return GSObjCGetValue(self, key, sel, type, size, offset); +} /** * This is used internally by the key-value coding methods, to get a * value from an object either via an accessor method (if sel is @@ -636,7 +648,7 @@ GSObjCAddClassBehavior(Class receiver, Class behavior) * to get a value. */ id -GSGetValue(NSObject *self, NSString *key, SEL sel, +GSObjCGetValue(NSObject *self, NSString *key, SEL sel, const char *type, unsigned size, int offset) { if (sel != 0) @@ -935,6 +947,13 @@ GSGetValue(NSObject *self, NSString *key, SEL sel, } } +/** Deprecated ... use GSObjCSetValue() */ +void +GSSetValue(NSObject *self, NSString *key, id val, SEL sel, + const char *type, unsigned size, int offset) +{ + GSObjCSetValue(self, key, val, sel, type, size, offset); +} /** * This is used internally by the key-value coding methods, to set a * value in an object either via an accessor method (if sel is @@ -946,7 +965,7 @@ GSGetValue(NSObject *self, NSString *key, SEL sel, * to set a value. */ void -GSSetValue(NSObject *self, NSString *key, id val, SEL sel, +GSObjCSetValue(NSObject *self, NSString *key, id val, SEL sel, const char *type, unsigned size, int offset) { if (sel != 0) diff --git a/Source/NSKeyValueCoding.m b/Source/NSKeyValueCoding.m index c1c1d2dd2..072657331 100644 --- a/Source/NSKeyValueCoding.m +++ b/Source/NSKeyValueCoding.m @@ -123,10 +123,11 @@ if ([[self class] accessInstanceVariablesDirectly] == YES) { // _key - if (GSFindInstanceVariable(self, name, &type, &size, &off) == NO) + if (GSObjCFindInstanceVariable(self, name, &type, &size, &off) + == NO) { name = &buf[4]; // key - GSFindInstanceVariable(self, name, &type, &size, &off); + GSObjCFindInstanceVariable(self, name, &type, &size, &off); } } if (type == NULL) @@ -147,7 +148,7 @@ } } } - return GSGetValue(self, aKey, sel, type, size, off); + return GSObjCGetValue(self, aKey, sel, type, size, off); } } @@ -197,10 +198,11 @@ buf[4] = lo; buf[3] = '_'; name = &buf[3]; // _key - if (GSFindInstanceVariable(self, name, &type, &size, &off) == NO) + if (GSObjCFindInstanceVariable(self, name, &type, &size, &off) + == NO) { name = &buf[4]; // key - GSFindInstanceVariable(self, name, &type, &size, &off); + GSObjCFindInstanceVariable(self, name, &type, &size, &off); } } if (type == NULL) @@ -216,7 +218,7 @@ } } } - GSSetValue(self, aKey, anObject, sel, type, size, off); + GSObjCSetValue(self, aKey, anObject, sel, type, size, off); } } @@ -264,16 +266,17 @@ buf[3] = '_'; buf[4] = lo; name = &buf[3]; // _key - if (GSFindInstanceVariable(self, name, &type, &size, &off) + if (GSObjCFindInstanceVariable(self, name, &type, &size, &off) == NO) { name = &buf[4]; // key - GSFindInstanceVariable(self, name, &type, &size, &off); + GSObjCFindInstanceVariable(self, name, &type, &size, + &off); } } } } - GSSetValue(self, aKey, anObject, sel, type, size, off); + GSObjCSetValue(self, aKey, anObject, sel, type, size, off); } } @@ -377,13 +380,13 @@ buf[4] = lo; buf[3] = '_'; name = &buf[3]; // _key - if (GSFindInstanceVariable(self, name, &type, &size, &off) == NO) + if (GSObjCFindInstanceVariable(self, name, &type, &size, &off) == NO) { name = &buf[4]; // key - GSFindInstanceVariable(self, name, &type, &size, &off); + GSObjCFindInstanceVariable(self, name, &type, &size, &off); } } - return GSGetValue(self, aKey, sel, type, size, off); + return GSObjCGetValue(self, aKey, sel, type, size, off); } }