117
111
GSObjCSetVariable(id obj, int offset, unsigned int size, const void *data);
119
113
GS_EXPORT NSArray *
120
GSObjCMethodNames(id obj);
114
GSObjCMethodNames(id obj, BOOL recurse);
122
116
GS_EXPORT NSArray *
123
GSObjCVariableNames(id obj);
117
GSObjCVariableNames(id obj, BOOL recurse);
120
* <p>A Behavior can be seen as a "Protocol with an implementation" or a
121
* "Class without any instance variables". A key feature of behaviors
122
* is that they give a degree of multiple inheritance.
124
* <p>Behavior methods, when added to a class, override the class's
125
* superclass methods, but not the class's methods.
127
* <p>Whan a behavior class is added to a receiver class, not only are the
128
* methods defined in the behavior class added, but the methods from the
129
* behavior's class hierarchy are also added (unless already present).
131
* <p>It's not the case that a class adding behaviors from another class
132
* must have "no instance vars". The receiver class just has to have the
133
* same layout as the behavior class (optionally with some additional
134
* ivars after those of the behavior class).
136
* <p>This function provides Behaviors without adding any new syntax to
137
* the Objective C language. Simply define a class with the methods you
138
* want to add, then call this function with that class as the behavior
141
* <p>This function should be called in the +initialize method of the receiver.
143
* <p>If you add several behaviors to a class, be aware that the order of
144
* the additions is significant.
126
148
GSObjCAddClassBehavior(Class receiver, Class behavior);
151
* <p>An Override can be seen as a "category implemented as a separate class
152
* and manually added to the receiver class under program control, rather
153
* than automatically added by the compiler/runtime.
155
* <p>Override methods, when added to a receiver class, replace the class's
156
* class's methods of the same name (or are added if the class did not define
157
* methods with that name).
159
* <p>It's not the case that a class adding overrides from another class
160
* must have "no instance vars". The receiver class just has to have the
161
* same layout as the override class (optionally with some additional
162
* ivars after those of the override class).
164
* <p>This function provides overrides without adding any new syntax to
165
* the Objective C language. Simply define a class with the methods you
166
* want to add, then call this function with that class as the override
169
* <p>This function should usually be called in the +initialize method
172
* <p>If you add several overrides to a class, be aware that the order of
173
* the additions is significant.
177
GSObjCAddClassOverride(Class receiver, Class override);
179
/** Turn on (YES), off (NO) or test (-1) behavior debugging.
181
GS_EXPORT BOOL GSObjCBehaviorDebug(int setget);
128
183
GS_EXPORT NSValue *
129
184
GSObjCMakeClass(NSString *name, NSString *superName, NSDictionary *iVars);
132
187
GSObjCAddClasses(NSArray *classes);
190
* Given a NULL terminated list of methods, add them to the class.<br />
191
* If the method already exists in a superclass, the new version overrides
192
* that one, but if the method already exists in the class itsself, the
193
* new one is quietly ignored (replace==NO) or replaced with the new
194
* version (if replace==YES).<br />
195
* To add class methods, cls should be the metaclass of the class to
196
* which the methods are being added.
199
GSObjCAddMethods(Class cls, Method *list, BOOL replace);
135
202
* Functions for key-value encoding ... they access values in an object
136
203
* either by selector or directly, but do so using NSNumber for the
154
219
* where applicable.
157
#define GS_STATIC_INLINE static inline
160
* Fills a nil terminated array of Class objects referenced by buffer
161
* with max number of classes registered with the objc runtime.
162
* The provided buffer must be large enough to hold max + 1 Class objects.
163
* If buffer is nil, the function returns the number of Class
164
* objects that would be inserted if the buffer is large enough.
165
* Otherwise returns the number of Class objects that did not fit
166
* into the provided buffer. This function keeps a cache of the class
167
* list for future invocations when used with the GNU runtime. If
168
* clearCache is YES, this cache will be invalidated and rebuild. The
169
* flag has no effect for the NeXT runtime.
170
* This function is provided as consistent API to both runtimes.
171
* In the case of the GNU runtime it is likely more efficient to use
172
* objc_next_class() to iterate over the classes.
223
* Deprecated ... use objc_getClassList()
174
225
GS_EXPORT unsigned int
175
226
GSClassList(Class *buffer, unsigned int max, BOOL clearCache);
178
* GSObjCClass() return the class of an instance.
179
* Returns a nul pointer if the argument is nil.
181
GS_STATIC_INLINE Class
186
return obj->class_pointer;
190
* Returns the superclass of this.
192
GS_STATIC_INLINE Class
193
GSObjCSuper(Class cls)
196
if (cls != 0 && CLS_ISRESOLV (cls) == NO)
199
name = (const char *)cls->super_class;
204
return objc_lookup_class (name);
207
return class_get_super_class(cls);
211
* GSObjCIsInstance() tests to see if an id is an instance.
212
* Returns NO if the argument is nil.
214
GS_STATIC_INLINE BOOL
215
GSObjCIsInstance(id obj)
219
return object_is_instance(obj);
223
* GSObjCIsClass() tests to see if an id is a class.
224
* Returns NO if the argument is nil.
226
GS_STATIC_INLINE BOOL
227
GSObjCIsClass(Class cls)
231
return object_is_class(cls);
235
* GSObjCIsKindOf() tests to see if a class inherits from another class
229
* GSObjCClass() is deprecated ... use object_getClass()
231
GS_EXPORT Class GSObjCClass(id obj);
234
* GSObjCSuper() is deprecated ... use class_getSuperclass()
236
GS_EXPORT Class GSObjCSuper(Class cls);
239
* GSObjCIsInstance() is deprecated ... use object_getClass()
240
* in conjunction with class_isMetaClass()
242
GS_EXPORT BOOL GSObjCIsInstance(id obj);
245
* GSObjCIsClass() is deprecated ... use object_getClass()
246
* in conjunction with class_isMetaClass()
248
GS_EXPORT BOOL GSObjCIsClass(Class cls);
251
* Test to see if class inherits from another class
236
252
* The argument to this function must NOT be nil.
238
GS_STATIC_INLINE BOOL
239
GSObjCIsKindOf(Class cls, Class other)
247
cls = GSObjCSuper(cls);
253
* Given a class name, return the corresponding class or
254
* a nul pointer if the class cannot be found. <br />
255
* If the argument is nil, return a nul pointer.
257
GS_STATIC_INLINE Class
258
GSClassFromName(const char *name)
262
return objc_lookup_class(name);
266
* Return the name of the supplied class, or a nul pointer if no class
269
GS_STATIC_INLINE const char *
270
GSNameFromClass(Class cls)
274
return class_get_class_name(cls);
278
* Return the name of the object's class, or a nul pointer if no object
281
GS_STATIC_INLINE const char *
282
GSClassNameFromObject(id obj)
286
return object_get_class_name(obj);
290
* Return the name of the supplied selector, or a nul pointer if no selector
293
GS_STATIC_INLINE const char *
294
GSNameFromSelector(SEL sel)
298
return sel_get_name(sel);
302
* Return a selector matching the specified name, or nil if no name is
303
* supplied. The returned selector could be any one with the name.<br />
304
* If no selector exists, returns nil.
307
GSSelectorFromName(const char *name)
315
return sel_get_uid(name);
254
GS_EXPORT BOOL GSObjCIsKindOf(Class cls, Class other);
257
* GSClassFromName() is deprecated ... use objc_lookUpClass()
259
GS_EXPORT Class GSClassFromName(const char *name);
262
* GSNameFromClass() is deprecated ... use class_getName()
264
GS_EXPORT const char *GSNameFromClass(Class cls);
267
* GSClassNameFromObject() is deprecated ... use object_getClass()
268
* in conjunction with class_getName()
270
GS_EXPORT const char *GSClassNameFromObject(id obj);
273
* GSNameFromSelector() is deprecated ... use sel_getName()
275
GS_EXPORT const char *GSNameFromSelector(SEL sel);
278
* GSSelectorFromName() is deprecated ... use sel_getUid()
281
GSSelectorFromName(const char *name);
320
284
* Return the selector for the specified name and types. Returns a nul
427
353
BOOL searchSuperClasses);
430
* Flushes the cached method dispatch table for the class.
431
* Call this function after any manipulations in the method structures.<br/>
432
* It should be safe to use this function in +load implementations.<br/>
433
* This function should currently (June 2003) be considered WIP.
434
* Please follow potential changes (Name, parameters, ...) closely until
356
* Deprecated .. does nothing.
437
GS_STATIC_INLINE void
438
GSFlushMethodCacheForClass (Class cls)
440
extern void __objc_update_dispatch_table_for_class (Class);
441
__objc_update_dispatch_table_for_class (cls);
359
GSFlushMethodCacheForClass (Class cls);
445
* Returns the pointer to the instance variable structure
446
* for the instance variable name in the specified class.
447
* This function searches the specified class and its superclasses.<br/>
448
* It should be safe to use this function in +load implementations.<br/>
449
* This function should currently (June 2003) be considered WIP.
450
* Please follow potential changes (Name, parameters, ...) closely until
362
* Deprecated .. use class_getInstanceVariable()
454
365
GSCGetInstanceVariableDefinition(Class cls, const char *name);
457
* Returns the pointer to the instance variable structure
458
* for the instance variable name in the specified class.
459
* This function searches the specified class and its superclasses.<br/>
460
* It is not necessarily safe to use this function
461
* in +load implementations.<br/>
462
* This function should currently (June 2003) be considered WIP.
463
* Please follow potential changes (Name, parameters, ...) closely until
368
* Deprecated .. use class_getInstanceVariable()
467
371
GSObjCGetInstanceVariableDefinition(Class cls, NSString *name);
470
* <p>Returns a pointer to objc_malloc'ed memory large enough
471
* to hold a struct objc_method_list with 'count' number of
472
* struct objc_method entries. The memory returned is
473
* initialized with 0, including the method count and
474
* next method list fields. </p>
475
* <p> This function is intended for use in conjunction with
476
* GSAppendMethodToList() to fill the memory and GSAddMethodList()
477
* to activate the method list. </p>
478
* <p>After method list manipulation you should call
479
* GSFlushMethodCacheForClass() for the changes to take effect.</p>
480
* <p><em>WARNING:</em> Manipulating the runtime structures
481
* can be hazardous!</p>
482
* <p>This function should currently (June 2004) be considered WIP.
483
* Please follow potential changes (Name, parameters, ...) closely until
487
GSAllocMethodList (unsigned int count);
490
* <p>Inserts the method described by sel, types and imp
491
* into the slot of the list's method_count incremented by 1.
492
* This function does not and cannot check whether
493
* the list provided has the necessary capacity.</p>
494
* <p>The GNU runtime makes a difference between method lists
495
* that are "free standing" and those that "attached" to classes.
496
* For "free standing" method lists (e.g. created with GSAllocMethodList()
497
* that have not been added to a class or those which have been removed
498
* via GSRemoveMethodList()) isFree must be passed YES.
499
* When manipulating "attached" method lists, specify NO.</p>
500
* <p>This function is intended for use in conjunction with
501
* GSAllocMethodList() to allocate the list and GSAddMethodList()
502
* to activate the method list. </p>
503
* <p>After method list manipulation you should call
504
* GSFlushMethodCacheForClass() for the changes to take effect.</p>
505
* <p><em>WARNING:</em> Manipulating the runtime structures
506
* can be hazardous!</p>
507
* <p>This function should currently (June 2004) be considered WIP.
508
* Please follow potential changes (Name, parameters, ...) closely until
512
GSAppendMethodToList (GSMethodList list,
519
* <p>Removes the method identified by sel
520
* from the method list moving the following methods up in the list,
521
* leaving the last entry blank. After this call, all references
522
* of previous GSMethodFromList() calls with this list should be
523
* considered invalid. If the values they referenced are needed, they
524
* must be copied to external buffers before this function is called.</p>
525
* <p>Returns YES if the a matching method was found a removed,
527
* <p>The GNU runtime makes a difference between method lists
528
* that are "free standing" and those that "attached" to classes.
529
* For "free standing" method lists (e.g. created with GSAllocMethodList()
530
* that have not been added to a class or those which have been removed
531
* via GSRemoveMethodList()) isFree must be passed YES.
532
* When manipulating "attached" method lists, specify NO.</p>
533
* <p>After method list manipulation you should call
534
* GSFlushMethodCacheForClass() for the changes to take effect.</p>
535
* <p><em>WARNING:</em> Manipulating the runtime structures
536
* can be hazardous!</p>
537
* <p>This function should currently (June 2004) be considered WIP.
538
* Please follow potential changes (Name, parameters, ...) closely until
542
GSRemoveMethodFromList (GSMethodList list,
547
* <p>Returns a method list of the class that contains the selector.
548
* Depending on searchInstanceMethods either instance or class methods
550
* Returns NULL if none are found.
551
* This function does not search the superclasses method lists.
552
* Call this method with the address of a <code>void *</code>
553
* pointing to NULL to obtain the first (active) method list
554
* containing the selector.
555
* Subsequent calls will return further method lists which contain the
556
* selector. If none are found, it returns NULL.
557
* You may instead pass NULL as the iterator in which case the first
558
* method list containing the selector will be returned.
559
* Do not call it with an uninitialized iterator.
560
* If either class or selector are NULL the function returns NULL.
561
* If subsequent calls to this function with the same non-NULL iterator yet
562
* different searchInstanceMethods value are called, the behavior
564
* <p>This function should currently (June 2004) be considered WIP.
565
* Please follow potential changes (Name, parameters, ...) closely until
569
GSMethodListForSelector(Class cls,
572
BOOL searchInstanceMethods);
575
* <p>Returns the (first) GSMethod contained in the supplied list
576
* that corresponds to sel.
577
* Returns NULL if none is found.</p>
578
* <p>The GNU runtime makes a difference between method lists
579
* that are "free standing" and those that "attached" to classes.
580
* For "free standing" method lists (e.g. created with GSAllocMethodList()
581
* that have not been added to a class or those which have been removed
582
* via GSRemoveMethodList()) isFree must be passed YES.
583
* When manipulating "attached" method lists, specify NO.</p>
586
GSMethodFromList(GSMethodList list,
591
* <p>Add the method list to the class as the first list to be
592
* searched during method invocation for the given class.
593
* Depending on toInstanceMethods, this list will be added as
594
* an instance or a class method list.
595
* If the list is in use by another class, behavior is undefined.
596
* Create a new list with GSAllocMethodList() or use GSRemoveMethodList()
597
* to remove a list before inserting it in a class.</p>
598
* <p>After method list manipulation you should call
599
* GSFlushMethodCacheForClass() for the changes to take effect.</p>
600
* <p>This function should currently (June 2004) be considered WIP.
601
* Please follow potential changes (Name, parameters, ...) closely until
605
GSAddMethodList(Class cls,
607
BOOL toInstanceMethods);
610
* <p>Removes the method list from the classes instance or class method
611
* lists depending on fromInstanceMethods.
612
* If the list is not part of the class, behavior is undefined.</p>
613
* <p>After method list manipulation you should call
614
* GSFlushMethodCacheForClass() for the changes to take effect.</p>
615
* <p>This function should currently (June 2004) be considered WIP.
616
* Please follow potential changes (Name, parameters, ...) closely until
620
GSRemoveMethodList(Class cls,
622
BOOL fromInstanceMethods);
626
* Returns the version number of this.
629
GSObjCVersion(Class cls)
631
return class_get_version(cls);
634
#ifndef NeXT_Foundation_LIBRARY
635
#include <Foundation/NSZone.h>
637
#include <Foundation/Foundation.h>
641
* Return the zone in which an object belongs, without using the zone method
644
GSObjCZone(NSObject *obj);
374
* GSObjCVersion() is deprecated ... use class_getVersion()
376
GS_EXPORT int GSObjCVersion(Class cls);
647
379
* Quickly return autoreleased data storage area.