summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-10 16:39:39 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-10 16:39:39 +0100
commit1d410434fefeef5ac26fc188eb31d69d922278ac (patch)
tree7896eb0fe483a9448c9b87beaf2281f0c1b580de
parent213ad2e9ce5aff9337234be84635e1a7ba22a598 (diff)
Glue layer: Add functions for class creation.
darcs-hash:e2dad7f45636d2065160cadec47f805f286a5bc7
-rw-r--r--Lisp/libobjcl.lisp21
-rw-r--r--Objective-C/libobjcl.h2
-rw-r--r--Objective-C/libobjcl.m9
3 files changed, 28 insertions, 4 deletions
diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp
index fd575d2..5616f71 100644
--- a/Lisp/libobjcl.lisp
+++ b/Lisp/libobjcl.lisp
@@ -133,6 +133,27 @@
(defcfun ("objcl_release_lock" %objcl-acquire-lock) :pointer
(lock :pointer))
+(defcfun ("objcl_create_class" %objcl-create-class) :pointer
+ (class-name :string)
+ (superclass :pointer)
+ (protocol-numer :int)
+ (protocol-names (:array :string))
+ (ivar-number :int)
+ (ivar-names (:array :string))
+ (ivar-typespecs (:array :string)))
+
+(defcfun ("objcl_add_method" %objcl-add-method) :void
+ (class :pointer)
+ (method-name :pointer)
+ (callback :pointer)
+ (argc :int)
+ (return-typespec :string)
+ (arg-typespecs (:array :string))
+ (signature :string))
+
+(defcfun ("objcl_finalise_class" %objcl-finalise-class) :void
+ (class :pointer))
+
(defcvar *objcl-current-exception-lock* :pointer)
(defcvar *objcl-current-exception* :pointer)
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h
index 56654fc..4a7137e 100644
--- a/Objective-C/libobjcl.h
+++ b/Objective-C/libobjcl.h
@@ -179,7 +179,7 @@ objcl_initialise_lock (void **lock);
Class
objcl_create_class (const char *class_name,
- const char *superclass,
+ Class superclass,
int protocol_number,
const char *protocol_names[],
int ivar_number,
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index 94a3663..92fc3cf 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -649,7 +649,7 @@ objcl_release_lock (void *lock)
Class
objcl_create_class (const char *class_name,
- const char *superclass,
+ Class superclass,
int protocol_number,
const char *protocol_names[],
int ivar_number,
@@ -660,7 +660,7 @@ objcl_create_class (const char *class_name,
int i;
Class class;
- objc_allocateClassPair (objcl_find_class (superclass), class_name, 0);
+ objc_allocateClassPair (superclass, class_name, 0);
class = objcl_find_class (class_name);
for (i = 0; i < ivar_number; i++)
@@ -689,6 +689,7 @@ objcl_create_class (const char *class_name,
void *argv[3 + ivar_number*2];
int i;
BOOL return_value;
+ const char *superclass_name;
arg_types[0] = &ffi_type_pointer;
arg_types[1] = &ffi_type_pointer;
@@ -696,8 +697,10 @@ objcl_create_class (const char *class_name,
for (i = 0; i < ivar_number*2; i++)
arg_types[3 + i] = &ffi_type_pointer;
+ superclass_name = objcl_class_name (superclass);
+
argv[0] = &class_name;
- argv[1] = &superclass;
+ argv[1] = &superclass_name;
argv[2] = &ivar_number;
for (i = 0; i < ivar_number; i++)
{