add code for other runtimes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32413 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-02-28 16:00:21 +00:00
parent 6ae45ff3f3
commit 40e6fedf16
2 changed files with 18 additions and 6 deletions

View file

@ -281,18 +281,19 @@ GS_EXPORT SEL
GSSelectorFromName(const char *name); GSSelectorFromName(const char *name);
/** /**
* Return the selector for the specified name and types. Returns a nul * Return the selector for the specified name and types.<br />
* pointer if the name is nul. Uses any available selector if the types * Returns a nul pointer if the name is nul.<br />
* argument is nul. <br /> * Creates a new selector if necessary.<br />
* Creates a new selector if necessary. * Code must NOT rely on this providing a selector with type information.
*/ */
GS_EXPORT SEL GS_EXPORT SEL
GSSelectorFromNameAndTypes(const char *name, const char *types); GSSelectorFromNameAndTypes(const char *name, const char *types);
/** /**
* Return the type information from the specified selector. * Return the type information from the specified selector.<br />
* May return a nul pointer if the selector was a nul pointer or if it * May return a nul pointer if the selector was a nul pointer or if it
* was not typed. * was not typed (or if the runtime does not support typed selectors).<br />
* Code must NOT rely on this providing any type information.
*/ */
GS_EXPORT const char * GS_EXPORT const char *
GSTypesFromSelector(SEL sel); GSTypesFromSelector(SEL sel);

View file

@ -137,11 +137,16 @@ GSSelectorFromName(const char *name)
{ {
return sel_getUid(name); return sel_getUid(name);
} }
SEL SEL
GSSelectorFromNameAndTypes(const char *name, const char *types) GSSelectorFromNameAndTypes(const char *name, const char *types)
{ {
#if NeXT_RUNTIME #if NeXT_RUNTIME
return sel_getUid(name); return sel_getUid(name);
#elif defined (__GNU_LIBOBJC__)
return sel_registerTypedName(name, types);
#elif defined (__GNUSTEP_RUNTIME__)
return sel_registerTypedName_np(name, types);
#else #else
if (name == 0) if (name == 0)
{ {
@ -174,11 +179,16 @@ GSSelectorFromNameAndTypes(const char *name, const char *types)
} }
#endif #endif
} }
const char * const char *
GSTypesFromSelector(SEL sel) GSTypesFromSelector(SEL sel)
{ {
#if NeXT_RUNTIME #if NeXT_RUNTIME
return 0; return 0;
#elif defined (__GNU_LIBOBJC__)
return sel_getTypes(name);
#elif defined (__GNUSTEP_RUNTIME__)
return sel_getType_np(name);
#else #else
if (sel == 0) if (sel == 0)
{ {
@ -190,6 +200,7 @@ GSTypesFromSelector(SEL sel)
} }
#endif #endif
} }
void void
GSFlushMethodCacheForClass (Class cls) GSFlushMethodCacheForClass (Class cls)
{ {