summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lisp/data-types.lisp33
-rw-r--r--Lisp/init.lisp3
-rw-r--r--Lisp/memory-management.lisp8
-rw-r--r--Lisp/utilities.lisp34
-rw-r--r--objective-cl.asd25
5 files changed, 55 insertions, 48 deletions
diff --git a/Lisp/data-types.lisp b/Lisp/data-types.lisp
index 35acb2f..6f66e8c 100644
--- a/Lisp/data-types.lisp
+++ b/Lisp/data-types.lisp
@@ -169,39 +169,6 @@ an __exception__, you can simply send it the `self' message.
(foreign-free obj-data))
-(defmethod print-object ((object id) stream)
- (print-unreadable-object (object stream)
- (format stream "~A `~A' {~X}"
- (objcl-class-name (primitive-invoke object "class" :id))
- (primitive-invoke (primitive-invoke object "description" :id)
- "UTF8String" :string)
- (primitive-invoke object "hash" :unsigned-int))))
-
-
-(defmethod print-object ((class objc-class) stream)
- (print-unreadable-object (class stream)
- (format stream "~S ~A {~X}"
- 'objc-class
- (objcl-class-name class)
- (primitive-invoke class "hash" :unsigned-int))))
-
-
-(defmethod print-object ((selector selector) stream)
- (print-unreadable-object (selector stream)
- (format stream "~S `~A'"
- 'selector
- (selector-name selector))))
-
-
-(defmethod print-object ((exception exception) stream)
- (print-unreadable-object (exception stream)
- (format stream "~S ~A {~X}"
- 'exception
- (primitive-invoke (primitive-invoke exception "name" :id)
- "UTF8String" :string)
- (primitive-invoke exception "hash" :unsigned-int))))
-
-
;;;; (@* "Convenience types")
(deftype c-pointer ()
'(satisfies pointerp))
diff --git a/Lisp/init.lisp b/Lisp/init.lisp
new file mode 100644
index 0000000..84ae511
--- /dev/null
+++ b/Lisp/init.lisp
@@ -0,0 +1,3 @@
+(in-package #:mulk.objective-cl)
+
+(initialise-runtime)
diff --git a/Lisp/memory-management.lisp b/Lisp/memory-management.lisp
index 1a3055b..4dec98e 100644
--- a/Lisp/memory-management.lisp
+++ b/Lisp/memory-management.lisp
@@ -18,8 +18,8 @@
`(lambda ()
(defmethod make-instance ((class (eql ',type)) &rest initargs &key)
(let* ((hash-table ,(ecase type
- ((id) '*id-objects*)
- ((objc-class) '*class-objects*)
+ ((id) '*id-objects*)
+ ((objc-class) '*class-objects*)
((exception) '*exception-objects*)))
(hash-key (pointer-address (getf initargs :pointer)))
(obj (weak-gethash hash-key hash-table nil)))
@@ -30,7 +30,7 @@
:incomplete)
(let ((new-obj (call-next-method)))
(unless *skip-retaining*
- (invoke-by-name new-obj "retain"))
+ (primitive-invoke new-obj "retain" :id))
(unless *skip-finalization*
;; We only put the new object into the hash
;; table if it is a regular wrapper object
@@ -56,7 +56,7 @@
(*skip-retaining* t))
(make-instance saved-type
:pointer saved-pointer))))
- (invoke-by-name temp "release"))))
+ (primitive-invoke temp "release" :id))))
(trivial-garbage:finalize new-obj #'finalizer))))
new-obj))
(t obj))))
diff --git a/Lisp/utilities.lisp b/Lisp/utilities.lisp
index 29efb60..be6f8b4 100644
--- a/Lisp/utilities.lisp
+++ b/Lisp/utilities.lisp
@@ -90,3 +90,37 @@
(defmethod objc-equal ((x string) (y selector))
(equal x (selector-name y)))
+
+
+;;; (@* "Object Representation")
+(defmethod print-object ((object id) stream)
+ (print-unreadable-object (object stream)
+ (format stream "~A `~A' {~X}"
+ (objcl-class-name (primitive-invoke object "class" :id))
+ (primitive-invoke (primitive-invoke object "description" :id)
+ "UTF8String" :string)
+ (primitive-invoke object "hash" :unsigned-int))))
+
+
+(defmethod print-object ((class objc-class) stream)
+ (print-unreadable-object (class stream)
+ (format stream "~S ~A {~X}"
+ 'objc-class
+ (objcl-class-name class)
+ (primitive-invoke class "hash" :unsigned-int))))
+
+
+(defmethod print-object ((selector selector) stream)
+ (print-unreadable-object (selector stream)
+ (format stream "~S `~A'"
+ 'selector
+ (selector-name selector))))
+
+
+(defmethod print-object ((exception exception) stream)
+ (print-unreadable-object (exception stream)
+ (format stream "~S ~A {~X}"
+ 'exception
+ (primitive-invoke (primitive-invoke exception "name" :id)
+ "UTF8String" :string)
+ (primitive-invoke exception "hash" :unsigned-int))))
diff --git a/objective-cl.asd b/objective-cl.asd
index a0772d0..66f45c0 100644
--- a/objective-cl.asd
+++ b/objective-cl.asd
@@ -11,27 +11,30 @@
(:file "data-types" :depends-on ("defpackage"))
(:file "parameters" :depends-on ("defpackage"))
(:file "name-conversion" :depends-on ("defpackage"))
+ (:file "internal-utilities" :depends-on ("defpackage"))
+ (:file "weak-hash-tables" :depends-on ("defpackage"))
(:file "libobjcl" :depends-on ("defpackage"
"constant-data"
"data-types"
"name-conversion"
"internal-utilities"
"parameters"))
- (:file "utilities" :depends-on ("defpackage"
- "method-invocation"
- "data-types"))
- (:file "internal-utilities" :depends-on ("defpackage"))
- (:file "weak-hash-tables" :depends-on ("defpackage"))
- (:file "memory-management" :depends-on ("defpackage"
- "weak-hash-tables"
- "data-types"
- "method-invocation"
- "parameters"))
+ (:file "init" :depends-on ("libobjcl"))
(:file "method-invocation" :depends-on ("defpackage"
"name-conversion"
"libobjcl"
"internal-utilities"
"parameters"))
+ (:file "memory-management" :depends-on ("defpackage"
+ "init"
+ "weak-hash-tables"
+ "data-types"
+ "method-invocation"
+ "parameters"))
(:file "reader-syntax" :depends-on ("defpackage"
- "method-invocation")))))
+ "method-invocation"))
+ (:file "utilities" :depends-on ("init"
+ "defpackage"
+ "method-invocation"
+ "data-types")))))
:serial t)