• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Category list?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Category list?


  • Subject: Category list?
  • From: petite_abeille <email@hidden>
  • Date: Fri, 12 Jul 2002 01:24:25 +0200

Hello,

how does one get a list of category for a given class in the new world order (aka osx)?

In the not so old days, I could do something along those lines:

struct objc_header_info
{
void* header;
Module module;
unsigned int moduleCount;
void* _private;
unsigned long _private1;
unsigned int _private2;
};

typedef struct objc_header_info* ObjCHeaderInfo;
typedef struct objc_method_list* ObjCMethodList;


extern unsigned int _objc_headerCount();
extern ObjCHeaderInfo _objc_headerVector();

+ (NSSet*) categories
{
NSMutableSet* aSet = [NSMutableSet set];
unsigned int headerCount = _objc_headerCount();
unsigned int headerIndex = 0;
ObjCHeaderInfo aHeaderVector = _objc_headerVector(NULL);

for ( headerIndex = 0; headerIndex < headerCount; headerIndex++ )
{
ObjCHeaderInfo aHeaderInfo = (ObjCHeaderInfo) &aHeaderVector[headerIndex].header;
Module aModule = aHeaderInfo -> module;

if ( aModule != NULL )
{
unsigned long aSize = aModule -> size;

if ( ( aSize > 0 ) && ( aSize < 0x100 ) )
{
for ( ; ( aModule -> size == aSize ) && ( aModule -> name != NULL ) && ( aModule -> symtab != NULL ); aModule++ )
{
unsigned short categoryCount = aModule -> symtab -> cat_def_cnt;

if ( categoryCount > 0 )
{
void** someDefinitions = aModule -> symtab -> defs;

if ( someDefinitions != NULL )
{
unsigned short classCount = aModule -> symtab -> cls_def_cnt;
unsigned short index = 0;

for ( index = 0; index < categoryCount; index++ )
{
Category aCategory = someDefinitions[ classCount + index ];
NSValue* aValue = [NSValue value: &aCategory withObjCType: @encode(Category)];

[aSet addObject: aValue];
}
}
}
}
}
}
}

if ( [aSet count] > 0 )
{
return aSet;
}

return nil;
}


But things have changed... so it doesn't work anymore... :-( What do I need to do now?

Thanks for any insights!-)

PA.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: NSFormatter problem when dialog box closed
  • Next by Date: NSModulePathForClass?
  • Previous by thread: Re: NSFormatter problem when dialog box closed
  • Next by thread: NSModulePathForClass?
  • Index(es):
    • Date
    • Thread