Cleanup C++ to Lisp translation
src/object-map.lisp
Sun Aug 2 12:12:41 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Cleanup C++ to Lisp translation
--- old-smoke/src/object-map.lisp 2014-10-30 08:11:54.000000000 +0100
+++ new-smoke/src/object-map.lisp 2014-10-30 08:11:54.000000000 +0100
@@ -6,7 +6,6 @@
(make-weak-hash-table :weakness weakness :synchronized t)
(make-weak-hash-table :synchronized t)))
-
#+openmcl
(let ((ccl::*shared-hash-table-default* t))
(defun make-synchronized-hash-table (&key weakness)
@@ -35,8 +34,8 @@
(defvar *object-map* (make-synchronized-hash-table :weakness :value)
"Contains all objects constructed by Smoke, that are not yet destructed;
-except object with a non virtual destructor which had their ownership transferred
-to C++.")
+except object with a non virtual destructor which had their ownership
+transferred to C++.")
(eval-on-save ()
(loop for object being the hash-value of *object-map* do
@@ -59,11 +58,7 @@
"Returns T when there is an object for POINTER in the map and NIL otherwise."
(nth-value 1 (gethash (pointer-address pointer) *object-map*)))
-(defun remove-if-exists (pointer)
- (remhash (pointer-address pointer) *object-map*))
-
(defun remove-object (pointer)
- (declare (optimize (speed 3)))
(unless (remhash (pointer-address pointer) *object-map*)
(cerror "ignore" "No object to remove for pointer ~A." pointer)))
@@ -111,12 +106,11 @@
(make-instance class :pointer pointer))
(funcall next)
(format *debug-io* "done~%"))))))
-
+
(defun add-object (object)
"Adds OBJECT to the pointer -> object map. It can later be retrieved
with GET-OBJECT."
- (assert (not (has-pointer-p (pointer object)))
- ()
+ (assert (not (has-pointer-p (pointer object))) ()
"There exists already a object ~A for the pointer of ~A."
(get-object (pointer object)) object)
(setf (get-object (pointer object)) object))