summaryrefslogtreecommitdiff
path: root/Objective-C
diff options
context:
space:
mode:
Diffstat (limited to 'Objective-C')
-rw-r--r--Objective-C/libobjcl.h9
-rw-r--r--Objective-C/libobjcl.m22
2 files changed, 25 insertions, 6 deletions
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h
index 4d6d092..eefeb5e 100644
--- a/Objective-C/libobjcl.h
+++ b/Objective-C/libobjcl.h
@@ -36,21 +36,24 @@ objcl_initialise_runtime (void);
void
objcl_shutdown_runtime (void);
-void *
+OBJCL_OBJ_DATA
objcl_invoke_instance_method (OBJCL_OBJ_DATA receiver,
const char *method_name,
int argc,
...);
-void *
+OBJCL_OBJ_DATA
objcl_invoke_class_method (OBJCL_OBJ_DATA class,
const char *method_name,
int argc,
...);
-void *
+OBJCL_OBJ_DATA
objcl_find_class (const char *class_name);
+OBJCL_OBJ_DATA
+objcl_find_selector (const char *selector_name);
+
/* Return a null-terminated list of type information strings.
The first entry describes the type of the method's return value. */
char **
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index 41d165c..7208498 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -164,7 +164,7 @@ _objcl_invoke_method (id self_,
}
-void *
+OBJCL_OBJ_DATA
objcl_invoke_instance_method (OBJCL_OBJ_DATA receiver,
const char *method_name,
int argc,
@@ -211,7 +211,7 @@ objcl_invoke_instance_method (OBJCL_OBJ_DATA receiver,
}
-void *
+OBJCL_OBJ_DATA
objcl_invoke_class_method (OBJCL_OBJ_DATA class,
const char *method_name,
int argc,
@@ -258,7 +258,7 @@ objcl_invoke_class_method (OBJCL_OBJ_DATA class,
}
-void *
+OBJCL_OBJ_DATA
objcl_find_class (const char *class_name)
{
Class class =
@@ -274,6 +274,22 @@ objcl_find_class (const char *class_name)
}
+OBJCL_OBJ_DATA
+objcl_find_selector (const char *class_name)
+{
+ SEL selector =
+ NSSelectorFromString ([NSString stringWithUTF8String: class_name]);
+ OBJCL_OBJ_DATA result = malloc (sizeof (struct objcl_object));
+ const char *const typespec = ":";
+
+ result->type = malloc (strlen (typespec) + 1);
+ strcpy (result->type, typespec);
+ result->data.sel_val = selector;
+
+ return result;
+}
+
+
const char *
objcl_class_name (OBJCL_OBJ_DATA class)
{