From 2e244d781b1b1096cddfd0df558ec7cee19b33a1 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Fri, 15 Feb 2008 10:44:10 +0100 Subject: System refactoring. darcs-hash:961c2ecf3be60a2a4abcfd15f3e51b5ccfb163c0 --- Lisp/internal-utilities.lisp | 16 ---------------- Lisp/libobjcl.lisp | 16 ++++++++++++++++ Objective-C/libobjcl.h | 4 +++- objective-cl.asd | 3 ++- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Lisp/internal-utilities.lisp b/Lisp/internal-utilities.lisp index 9be74a9..1c54068 100644 --- a/Lisp/internal-utilities.lisp +++ b/Lisp/internal-utilities.lisp @@ -27,22 +27,6 @@ (member symbol *features*)) -(defun objc-null (value) - (or (null value) - (and (typep value 'c-pointer-wrapper) - (objc-pointer-null (pointer-to value))))) - - -(defmacro objc-or (&rest forms) - (let ((sym (gensym))) - `(let ((,sym ,(first forms))) - (if (objc-null ,sym) - ,(if (rest forms) - `(objc-or ,@(rest forms)) - 'nil) - ,sym)))) - - (defmacro with-foreign-string-pool ((register-fn-name) &body body) (let ((pool-var (gensym))) `(let ((,pool-var (list))) diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp index 0858cb9..89930b8 100644 --- a/Lisp/libobjcl.lisp +++ b/Lisp/libobjcl.lisp @@ -375,6 +375,22 @@ conventional case for namespace identifiers in Objective-C." (cffi:pointer-eq pointer (objcl-get-nil)))) +(defun objc-null (value) + (or (null value) + (and (typep value 'c-pointer-wrapper) + (objc-pointer-null (pointer-to value))))) + + +(defmacro objc-or (&rest forms) + (let ((sym (gensym))) + `(let ((,sym ,(first forms))) + (if (objc-null ,sym) + ,(if (rest forms) + `(objc-or ,@(rest forms)) + 'nil) + ,sym)))) + + (declaim (ftype (function (string) (or null selector)) find-selector-by-name)) (defun find-selector-by-name (selector-name) diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h index cca5d12..35d6150 100644 --- a/Objective-C/libobjcl.h +++ b/Objective-C/libobjcl.h @@ -156,7 +156,9 @@ objcl_slot_value (id obj, const char *ivar_name); /* The following function returns a freshly consed array that the caller must deallocate. */ IVAR_T * -objcl_class_direct_slots (Class class, unsigned int *count, unsigned int *element_size); +objcl_class_direct_slots (Class class, + unsigned int *count, + unsigned int *element_size); const char * objcl_slot_name (IVAR_T ivar); diff --git a/objective-cl.asd b/objective-cl.asd index bf0fecb..9420f95 100644 --- a/objective-cl.asd +++ b/objective-cl.asd @@ -30,11 +30,12 @@ (:file "constant-data" :depends-on ("defpackage")) (:file "conditions" :depends-on ("defpackage")) (:file "parameters" :depends-on ("defpackage")) - (:file "name-conversion" :depends-on ("defpackage")) (:file "data-types" :depends-on ("defpackage" "conditions")) (:file "internal-utilities" :depends-on ("defpackage" "data-types")) + (:file "name-conversion" :depends-on ("defpackage" + "internal-utilities")) (:file "weak-hash-tables" :depends-on ("defpackage")) (:file "performance-hacks" :depends-on ("defpackage")) (:file "policy" :depends-on ("defpackage" -- cgit v1.2.3