diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-13 18:11:12 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-13 18:11:12 +0100 |
commit | 4f294ea0c5f54751e90fa27860613b017c050698 (patch) | |
tree | 1b67c688353000e4404bc2804158f984ec37199d | |
parent | 77a40a1b44afddde7bdb15278a199584e8670b95 (diff) |
Use the new type declaration reader macro in Objective-CL code.
darcs-hash:ba8b3023e541d9e723704583e3f6ffb7a9b3898a
-rw-r--r-- | Lisp/constant-data.lisp | 12 | ||||
-rw-r--r-- | Lisp/libobjcl.lisp | 29 | ||||
-rw-r--r-- | objective-cl.asd | 6 |
3 files changed, 25 insertions, 22 deletions
diff --git a/Lisp/constant-data.lisp b/Lisp/constant-data.lisp index 7829554..ab1e6f0 100644 --- a/Lisp/constant-data.lisp +++ b/Lisp/constant-data.lisp @@ -16,6 +16,7 @@ ;;;; <http://www.gnu.org/licenses/>. (in-package #:mulk.objective-cl) +#.(enable-type-declaration-syntax) ;;;; (@* "Allocation Parameters") @@ -151,22 +152,27 @@ ;;;; (@* "Constant accessors") -(declaim (ftype (function (*) symbol) lisp-value->type-name)) +#? * -> symbol (defun lisp-value->type-name (value) (car (rassoc-if #'(lambda (type) (typep value type)) *objcl-type-map*))) -(declaim (ftype (function (symbol) string) type-name->type-id)) +#? symbol -> string (defun type-name->type-id (type-name) (string (cdr (assoc type-name *objcl-api-type-names*)))) -(declaim (ftype (function (symbol) symbol) type-name->c-type)) +#? symbol -> symbol (defun type-name->c-type (type-name) (cdr (assoc type-name *objcl-c-type-map*))) +#? symbol -> symbol (defun typespec-name->type-name (typespec-name) (cdr (assoc typespec-name *objcl-typespec-map*))) +#? symbol -> string (defun typespec-name->type-id (typespec-name) (type-name->type-id (typespec-name->type-name typespec-name))) + + +#.(disable-type-declaration-syntax) diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp index e224e35..e5bd6f9 100644 --- a/Lisp/libobjcl.lisp +++ b/Lisp/libobjcl.lisp @@ -16,6 +16,7 @@ ;;;; <http://www.gnu.org/licenses/>. (in-package #:mulk.objective-cl) +#.(enable-type-declaration-syntax) (eval-when (:compile-toplevel :load-toplevel :execute) @@ -266,9 +267,7 @@ objects or classes, let alone send messages to them. (%shutdown-runtime))) -(declaim (ftype (function ((or string symbol) &optional t) - (or null objective-c-class)) - find-objc-class)) +#? (or string symbol) &optional t -> (or null objective-c-class) (defun find-objc-class (class-name &optional errorp) "Retrieve an Objective-C class by name. @@ -333,8 +332,7 @@ conventional case for namespace identifiers in Objective-C." nil)))) -(declaim (ftype (function (string) (or null objective-c-class)) - find-objc-class-by-name)) +#? string -> (or null objective-c-class) (defun find-objc-class-by-name (class-name-string) ;; Note that this function is able to find classes that are not yet ;; registered with the Objective-C runtime simply by looking for an @@ -469,8 +467,7 @@ conventional case for namespace identifiers in Objective-C." ,sym)))) -(declaim (ftype (function (string) (or null selector)) - find-selector-by-name)) +#? string -> (or null selector) (defun find-selector-by-name (selector-name) (let ((selector-ptr (%objcl-find-selector selector-name))) (if (cffi:null-pointer-p selector-ptr) @@ -486,8 +483,7 @@ conventional case for namespace identifiers in Objective-C." (intern-pointer-wrapper 'selector :pointer selector-ptr))) -(declaim (ftype (function ((or objective-c-class id exception)) string) - objc-class-name)) +#? (or objective-c-class id exception) -> string (defun objc-class-name (class) "Find the name of a class. @@ -526,7 +522,7 @@ If *name* is the name of an existing class: (%objcl-class-name (pointer-to class))) -(declaim (ftype (function (selector) string) selector-name)) +#? selector -> string (defun selector-name (selector) "Find the name of a selector. @@ -566,17 +562,14 @@ If *name* is the name of an existing selector: (%objcl-selector-name (pointer-to selector))) -(declaim (ftype (function ((or id objective-c-class exception) selector) t) - get-method-implementation)) +#? (or id objective-c-class exception) selector -> t (defun get-method-implementation (object selector) (declare (type selector selector)) (%objcl-get-method-implementation (pointer-to object) (pointer-to selector))) -(declaim (ftype (function ((or selector symbol string list) &optional t) - (or null selector)) - find-selector)) +#? (or selector symbol string list) &optional t -> (or null selector) (defun find-selector (selector-name &optional (errorp t)) "Retrieve a method selector by name. @@ -835,8 +828,7 @@ separating parts by hyphens works nicely in all of the `:INVERT`, '(satisfies cffi:pointerp))))) -(declaim (ftype (function ((or selector string symbol list)) selector) - selector)) +#? (or selector string symbol list) -> selector (defun selector (designator) "Convert an object into a selector. @@ -1012,3 +1004,6 @@ __enable-method-syntax__. (defun objcl-object-backed-by-lisp-class-p (instance) (objcl-object-backed-by-lisp-class-p/pointer (pointer-to instance))) + + +#.(disable-type-declaration-syntax) diff --git a/objective-cl.asd b/objective-cl.asd index dbc056e..c35f7fa 100644 --- a/objective-cl.asd +++ b/objective-cl.asd @@ -45,7 +45,9 @@ :components ((:module "Lisp" :components ((:file "defpackage") - (:file "constant-data" :depends-on ("defpackage")) + (:file "internal-reader-syntax" :depends-on ("defpackage")) + (:file "constant-data" :depends-on ("defpackage" + "internal-reader-syntax")) (:file "conditions" :depends-on ("defpackage")) (:file "parameters" :depends-on ("defpackage")) (:file "data-types" :depends-on ("defpackage" @@ -60,6 +62,7 @@ "parameters" "libobjcl")) (:file "libobjcl" :depends-on ("defpackage" + "internal-reader-syntax" "constant-data" "data-types" "name-conversion" @@ -104,7 +107,6 @@ (:file "reader-syntax" :depends-on ("defpackage" "method-invocation" "internal-reader-syntax")) - (:file "internal-reader-syntax" :depends-on ("defpackage")) (:file "utilities" :depends-on ("init" "defpackage" "method-invocation" |