diff options
Diffstat (limited to 'Objective-C')
-rw-r--r-- | Objective-C/libobjcl.h | 3 | ||||
-rw-r--r-- | Objective-C/libobjcl.m | 26 |
2 files changed, 26 insertions, 3 deletions
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h index eefeb5e..e8bcfaf 100644 --- a/Objective-C/libobjcl.h +++ b/Objective-C/libobjcl.h @@ -63,3 +63,6 @@ objcl_query_arglist_info (void *receiver, const char * objcl_class_name (OBJCL_OBJ_DATA class); + +const char * +objcl_selector_name (OBJCL_OBJ_DATA class); diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m index 7208498..916ffa3 100644 --- a/Objective-C/libobjcl.m +++ b/Objective-C/libobjcl.m @@ -293,10 +293,10 @@ objcl_find_selector (const char *class_name) const char * objcl_class_name (OBJCL_OBJ_DATA class) { + const char *ns_name; + char *name; Class cls = NULL; - /* fprintf (stderr, "---------> %s <--------\n", class->type); */ - fflush (stderr); assert (class->type[0] == '#' || class->type[0] == '@' || class->type[0] == 'E'); @@ -307,5 +307,25 @@ objcl_class_name (OBJCL_OBJ_DATA class) case 'E': cls = (id) class->data.exc_val; } - return class_get_class_name (cls); + ns_name = [(NSStringFromClass (cls)) UTF8String]; + name = malloc (strlen (ns_name) + 1); + strcpy (name, ns_name); + + return name; +} + + +const char * +objcl_selector_name (OBJCL_OBJ_DATA selector) +{ + const char *ns_name; + char *name; + + assert (selector->type[0] == ':'); + ns_name = [(NSStringFromSelector (selector->data.sel_val)) + UTF8String]; + name = malloc (strlen (ns_name) + 1); + strcpy (name, ns_name); + + return name; } |