repos
/
smoke
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
Cleanup C++ to Lisp translation
Annotate for file src/clos.lisp
2009-04-05 tobias
1
(in-package #:smoke)
15:36:29 '
2
'
3
(declaim (inline lispify))
'
4
(defun lispify (name &optional (package nil))
'
5
"Returns the interned symbol for name in Lisp style."
'
6
(declare (string name)
'
7
(optimize (speed 3)))
'
8
(if (null package)
'
9
(values (intern (cxx-to-lisp name)))
'
10
(values (intern (cxx-to-lisp name) package))))
'
11
'
12
(defmacro define-string-transform (name documentation &body states)
'
13
"Defines a function to transform a string."
'
14
(let ((output (gensym))
'
15
(index (gensym))
'
16
(length (gensym)))
'
17
`(defun ,name (input)
'
18
,documentation
'
19
(declare (simple-string input)
'
20
(optimize (speed 3)))
2009-07-22 tobias
21
;; At least on sbcl 1.0.25.debian CONCATENATE is faster than
22:26:05 '
22
;; VECTOR-PUSH-EXTEND.
2009-04-05 tobias
23
(let ((,output "")
15:36:29 '
24
(,index 0)
'
25
(,length (length input))
'
26
(char #\Null))
'
27
(declare (base-char char))
'
28
(macrolet ((next-char ()
'
29
`(if (>= ,',index ,',length)
'
30
(return-from transform ,',output)
'
31
(progn
'
32
(setf char (aref input ,',index))
'
33
(incf ,',index))))
'
34
(go-next (tag)
'
35
`(progn (next-char)
'
36
(go ,tag)))
'
37
(append-char (char)
'
38
`(setf ,',output (concatenate 'string
'
39
,',output
'
40
(string ,char)))))
'
41
(block transform
'
42
(tagbody
'
43
(next-char) ;; Get first char
'
44
,@(reduce #'append
'
45
(mapcar #'(lambda (state)
'
46
(if (stringp (second state))
'
47
`(,(first state) . ,(cddr state))
'
48
state))
'
49
states)))))))))
'
50
'
51
'
52
(define-string-transform lisp-to-cxx
'
53
"Converts LISP-STYLE to camelCase.
2009-07-01 tobias
54
Note that (LISP-TO-CXX (CXX-TO-LIST SOME-STRING)) will not necessarily return
10:54:01 '
55
a string equal to SOME-STRING."
2009-04-05 tobias
56
(default
2009-07-01 tobias
57
"Down case, convert _ and dispatch."
2009-04-05 tobias
58
(case char
15:36:29 '
59
(#\- (go-next camel-upcase))
'
60
(#\. (go-next namespace))
'
61
(t (append-char (char-downcase char))
'
62
(go-next default))))
'
63
(camel-upcase
'
64
"Convert camelCase to lisp-style."
'
65
(append-char char)
'
66
(go-next default))
'
67
(namespace
'
68
"Convert . to ::"
'
69
(append-char #\:)
'
70
(append-char #\:)
'
71
(go default)))
'
72
'
73
(define-string-transform cxx-to-lisp
2009-04-17 tobias
74
"Returns camelCase STRING in lisp-style."
2009-04-05 tobias
75
(begin
2009-07-01 tobias
76
"Strip leading Q or K."
2009-04-05 tobias
77
(case char
15:36:29 '
78
(#\K (go-next default))
'
79
(#\Q (go-next default))
'
80
(t (go default))))
'
81
(default
2009-07-01 tobias
82
"Up case, convert _ and dispatch."
2009-04-05 tobias
83
(case char
15:36:29 '
84
(#\: (go-next namespace))
'
85
(#\_ (append-char #\-)
'
86
(go-next default))
2009-04-17 tobias
87
(#\ (append-char #\-) ;; space (cast operators)
15:26:55 '
88
(go-next default))
2009-04-05 tobias
89
(t (append-char (char-upcase char))
15:36:29 '
90
(if (lower-case-p char)
'
91
(go-next camel-case)
'
92
(go-next default)))))
'
93
(namespace
2009-06-22 tobias
94
"C++ namespace separator"
2009-04-05 tobias
95
(assert (eql #\: char))
15:36:29 '
96
(append-char #\.)
'
97
(go-next default))
'
98
(camel-case
'
99
"Convert camelCase to lisp-style."
'
100
(if (upper-case-p char)
'
101
(progn
'
102
(append-char #\-)
'
103
(append-char char)
'
104
(go-next default))
'
105
(go default))))
'
106
'
107
'
108
(defmethod print-object ((object smoke-standard-object) stream)
2009-05-27 tobias
109
(if (slot-boundp object 'pointer)
17:22:08 '
110
(print-unreadable-object (object stream :type t)
'
111
(princ (pointer object) stream))
'
112
(call-next-method)))
2009-04-05 tobias
113
15:36:29 '
114
(defclass smoke-standard-class (standard-class smoke-class)
2009-05-24 tobias
115
()
2009-04-05 tobias
116
(:documentation "A Smoke C++ class"))
15:36:29 '
117
2009-05-31 tobias
118
(defclass cxx:class (smoke-standard-class)
2009-07-08 tobias
119
()
2009-05-31 tobias
120
(:documentation "Metaclass to extend Smoke Objects."))
2009-05-14 tobias
121
2009-08-02 tobias
122
(defmethod closer-mop:validate-superclass ((class smoke-standard-class)
10:12:41 '
123
(superclass standard-class))
2009-07-22 tobias
124
t)
2009-04-05 tobias
125
2009-08-02 tobias
126
(defmethod closer-mop:validate-superclass ((class cxx:class)
10:12:41 '
127
(superclass smoke-standard-class))
2009-07-22 tobias
128
t)
2009-04-05 tobias
129
2009-08-02 tobias
130
;; Sets NIL superclass to SMOKE-STANDARD-OBJECT instead of the default
10:12:41 '
131
;; STANDARD-OBJECT.
'
132
(defun init-smoke-standard-class (class next-method
'
133
&rest args &key direct-superclasses
'
134
&allow-other-keys)
'
135
(apply next-method class
'
136
:direct-superclasses (or direct-superclasses
'
137
(list (find-class 'smoke-standard-object)))
'
138
args))
2009-04-05 tobias
139
2009-08-02 tobias
140
(defmethod initialize-instance :around ((class smoke-standard-class) &rest args)
10:12:41 '
141
(apply #'init-smoke-standard-class class #'call-next-method args))
'
142
'
143
(defmethod reinitialize-instance :around ((class smoke-standard-class) &rest args)
'
144
(apply #'init-smoke-standard-class class #'call-next-method args))
2009-04-05 tobias
145
15:36:29 '
146
2009-08-02 tobias
147
(defun init-cxx-class (class next-method &rest args &key direct-superclasses
10:12:41 '
148
&allow-other-keys)
2009-04-05 tobias
149
(assert (not (null direct-superclasses))
15:36:29 '
150
(direct-superclasses)
2009-08-30 tobias
151
"No superclass sup-lied for class ~A" class)
14:12:44 '
152
(let ((superclass (first direct-superclasses)))
'
153
(assert (subtypep (class-of superclass) (find-class 'smoke-standard-class))
2009-04-05 tobias
154
((first direct-superclasses))
2009-08-30 tobias
155
"The first superclass must be an subclass of an smoke class.")
2009-06-10 tobias
156
(assert (virtual-destructor-p superclass)
11:55:55 '
157
()
2009-08-30 tobias
158
"The class ~A has a non virtual destructor." superclass)
2009-04-05 tobias
159
(apply
2009-08-02 tobias
160
next-method class
2009-07-08 tobias
161
:id (id superclass)
2009-06-22 tobias
162
:smoke (smoke superclass)
2009-04-05 tobias
163
:direct-superclasses direct-superclasses
15:36:29 '
164
args)))
'
165
2009-08-02 tobias
166
(defmethod reinitialize-instance :around ((class cxx:class) &rest args)
10:12:41 '
167
(apply #'init-cxx-class class #'call-next-method args))
'
168
'
169
(defmethod initialize-instance :around ((class cxx:class) &rest args)
'
170
(apply #'init-cxx-class class #'call-next-method args))
'
171
2010-01-26 tobias
172
(defun smoke-class-symbol (smoke-class)
16:26:09 '
173
"Returns the Lisp class-name of SMOKE-CLASS:"
'
174
(if (external-p smoke-class)
'
175
(class-name (find-smoke-class smoke-class))
'
176
(lispify (name smoke-class))))
2009-04-05 tobias
177
2009-08-30 tobias
178
2009-06-11 tobias
179
(defun make-smoke-classes (package smoke)
2009-07-01 tobias
180
"Constructs a lisp class in PACKAGE for each one in the Smoke module SMOKE."
2009-06-22 tobias
181
(declare (optimize (speed 3)))
2010-01-10 tobias
182
(let ((*package* (find-package package)))
2009-06-22 tobias
183
(add-id-class-map smoke)
2009-04-05 tobias
184
(map-classes
15:36:29 '
185
#'(lambda (class)
2009-08-27 tobias
186
(unless (external-p class)
11:43:13 '
187
(add-id class
'
188
(closer-mop:ensure-class (lispify (name class))
'
189
:direct-superclasses
'
190
(mapcar #'smoke-class-symbol
'
191
(smoke-class-direct-superclasses class))
'
192
:id (id class)
'
193
:smoke (smoke class)
'
194
:metaclass 'smoke-standard-class))
'
195
(export (lispify (name class)))))
2009-06-11 tobias
196
smoke)))
2009-04-05 tobias
197
2009-04-12 tobias
198
(defclass smoke-gf (cxx-generic-function)
14:43:33 '
199
((cxx-name :reader name :initarg :cxx-name
2009-05-11 tobias
200
:type string
11:07:39 '
201
:documentation "The C++ name of the method."))
2009-04-05 tobias
202
(:metaclass closer-mop:funcallable-standard-class)
2009-05-11 tobias
203
(:documentation "Smoke generic function."))
2009-04-05 tobias
204
2009-06-22 tobias
205
(declaim (inline smoke-class-of))
2009-04-05 tobias
206
(defun smoke-class-of (object)
2009-07-01 tobias
207
"Returns the class of OBJECT or OBJECT iff it already is a class."
2009-06-22 tobias
208
(declare (optimize (speed 3)))
12:18:08 '
209
(if (typep object 'smoke-class)
2009-04-05 tobias
210
object
15:36:29 '
211
(class-of object)))
'
212
2009-04-12 tobias
213
;;; To speed up the startup
2009-04-05 tobias
214
;;; ENSURE-METHOD is only called as needed.
15:36:29 '
215
(defmethod no-applicable-method ((gf smoke-gf) &rest args)
'
216
"Calls the smoke method."
2009-06-22 tobias
217
(declare (dynamic-extent args)
12:18:08 '
218
(optimize (speed 3)))
2009-04-17 tobias
219
(call-using-args (first args) (name gf) (rest args)))
2009-04-05 tobias
220
2009-04-12 tobias
221
(defmethod add-method :after ((gf cxx-method-generic-function) method)
2009-04-05 tobias
222
"Adds a method which calls the smoke method, to make call-next-method work."
15:36:29 '
223
(when (null (rest (closer-mop:generic-function-methods gf)))
2009-04-12 tobias
224
(let ((lambda-list (closer-mop:method-lambda-list method)))
14:43:33 '
225
(closer-mop:ensure-method
'
226
gf
'
227
`(lambda ,lambda-list
'
228
(declare (optimize (speed 3)))
2009-05-11 tobias
229
(call-using-args ,(first lambda-list)
17:55:42 '
230
(name ,(cxx-generic-function gf))
2009-05-11 tobias
231
(list ,@(rest lambda-list))))))))
2009-04-05 tobias
232
15:36:29 '
233
(defcallback destructed :void
2009-07-22 tobias
234
((object-pointer :pointer))
2009-06-22 tobias
235
(declare (optimize (speed 3)))
2009-04-05 tobias
236
(let ((object (get-object object-pointer)))
2009-08-02 tobias
237
;; The destructed callback can be the result of deleting the object
10:12:41 '
238
;; in a finalizer. In that case the object is already removed from
'
239
;; *object-map* when the callback is invoked. Thus OBJECT can be NIL.
2009-04-05 tobias
240
(when object
2009-06-30 tobias
241
(remove-finalizer object)
2009-04-05 tobias
242
(remove-object object-pointer)
15:36:29 '
243
(setf (slot-value object 'pointer) (null-pointer)))))
'
244
2009-06-22 tobias
245
(declaim (inline argument-to-lisp))
12:18:08 '
246
(defun argument-to-lisp (stack-item type)
'
247
;; FIXME do not take ownership of stack allocated objects.
2009-08-02 tobias
248
;; It looks like there is no stack allocation in Qt virtual method signatures.
2009-06-22 tobias
249
(type-to-lisp stack-item type))
12:18:08 '
250
2009-04-05 tobias
251
(defun stack-to-args (stack arg &optional (args nil))
15:36:29 '
252
"Returns the arguments in STACK, where ARG is the type
'
253
of the first argument, as an list of Lisp objects."
'
254
(if (end-p arg)
2009-06-22 tobias
255
(reverse args)
12:18:08 '
256
(stack-to-args (inc-pointer stack
'
257
(foreign-type-size 'smoke-stack-item))
2009-04-05 tobias
258
(next arg)
2009-08-02 tobias
259
(push (argument-to-lisp (mem-ref stack 'smoke-stack-item)
2009-07-22 tobias
260
arg)
2009-06-22 tobias
261
args))))
2009-04-05 tobias
262
2009-09-02 tobias
263
(defun convert-argument (argument type &optional (user t))
11:49:34 '
264
"Returns ARGUMENT converted to TYPE. If USER is true, user defined
'
265
conversion sequences are considered."
'
266
(let ((rank (get-conversion-sequence argument type user)))
'
267
(if (null rank)
'
268
(error "Can not convert the argument ~S to ~A."
'
269
argument (name type))
'
270
(funcall (conversion-function-name rank)
'
271
argument))))
2009-04-05 tobias
272
2009-06-08 tobias
273
(defun put-returnvalue (stack value type object)
2009-04-05 tobias
274
(unless (void-p type)
2009-05-26 tobias
275
(let ((stack (make-call-stack stack)))
2009-07-08 tobias
276
(setf (call-stack-top stack) (call-stack-pointer stack))
2009-09-02 tobias
277
;; FIXME support user conversions.
11:49:34 '
278
;;
'
279
;; We need to determine which of value and converted-value is
'
280
;; passed on the stack. E.g. converted-value can be something
'
281
;; like (cxx:operator-variant value).
'
282
(let ((converted-value (convert-argument value type nil)))
'
283
(push-smoke-stack stack converted-value (type-id type))
'
284
(when (stack-p type) ;; Pass by value => smoke deletes the object.
'
285
(remove-finalizer converted-value)
'
286
(when (typep value 'smoke-standard-object)
2009-08-02 tobias
287
(remove-object (pointer value))))))))
10:12:41 '
288
; (transfer-ownership-to value object)))))))
2009-04-05 tobias
289
2009-05-19 tobias
290
(defun get-gf-for-method (smoke-method)
11:09:12 '
291
(declare (smoke-method smoke-method)
'
292
(optimize (speed 3)))
'
293
(symbol-function (lispify (name smoke-method) "CXX")))
2009-05-19 tobias
294
2009-08-02 tobias
295
;; Receive virutal function calls.
2009-04-05 tobias
296
(defcallback dispatch-method :boolean
2010-02-19 tobias
297
((binding :pointer)
21:10:24 '
298
(method smoke-index)
2009-06-30 tobias
299
(object-ptr :pointer)
22:47:39 '
300
(stack smoke-stack)
'
301
(abstract :boolean))
2009-04-05 tobias
302
(declare (optimize (speed 3)))
2009-06-30 tobias
303
(let ((object (get-object object-ptr)))
2009-08-02 tobias
304
;; The Lisp OBJECT can be gc'ed but we might still receive a
10:12:41 '
305
;; QObject destructed event when the C++ instance is deleted in
'
306
;; the finalizer. Thus OBJECT might be NIL.
'
307
(when (and object (typep (class-of object) 'cxx:class))
'
308
;; Do not allow overwriting methods of classes the users has
'
309
;; not derived from (like in C++), to reduce overhead.
'
310
(let* ((method (make-smoke-method
'
311
:smoke (gethash (pointer-address
'
312
(smoke-get-smoke binding))
'
313
*smoke-modules*)
'
314
:id method)))
'
315
(loop
'
316
(restart-case
'
317
(return-from dispatch-method
'
318
(let ((gf (get-gf-for-method method)))
'
319
(declare (function gf))
'
320
(if (null (gf-methods gf))
'
321
(progn
'
322
(when abstract
'
323
(error "Abstract method ~A of ~A called."
'
324
(method-declaration method) object))
'
325
nil)
'
326
(if object
'
327
(progn
'
328
(put-returnvalue
'
329
stack
'
330
(apply gf object
'
331
(stack-to-args
'
332
(inc-pointer stack (foreign-type-size
'
333
'smoke-stack-item))
'
334
(get-first-argument method)))
'
335
(return-type method) object)
'
336
t)
'
337
nil))))
'
338
;; Restarts to prevent stack unwinding across the C++ stack.
'
339
(call-default ()
'
340
:report (lambda (stream)
'
341
(declare (stream stream))
'
342
(format stream
'
343
"Call default implementation ~A instead."
'
344
method))
'
345
:test (lambda (condition)
'
346
(declare (ignore condition))
'
347
(not abstract))
'
348
(return-from dispatch-method nil))
'
349
(use-returnvalue (return-value)
'
350
:report (lambda (stream)
'
351
(declare (stream stream))
'
352
(format stream "Supply a return value for ~A."
'
353
(method-declaration method)))
'
354
:test (lambda (condition)
'
355
(declare (ignore condition))
'
356
(not (void-p (return-type method))))
'
357
:interactive (lambda ()
'
358
(format *query-io* "~&Enter a new return value: ")
'
359
(multiple-value-list (eval (read *query-io*))))
'
360
(put-returnvalue stack return-value
'
361
(return-type method)
'
362
(get-object object-ptr))
'
363
(return-from dispatch-method t))
'
364
(return ()
'
365
:report (lambda (stream)
'
366
(declare (stream stream))
'
367
(format stream "Return void for ~A."
'
368
(method-declaration method)))
'
369
:test (lambda (condition)
'
370
(declare (ignore condition))
'
371
(void-p (return-type method)))
'
372
(return-from dispatch-method (values)))
'
373
(retry ()
'
374
:report (lambda (stream)
'
375
(declare (stream stream))
'
376
(format stream "Try again calling ~A."
'
377
(method-declaration method))))))
'
378
nil))))
2009-04-05 tobias
379
15:36:29 '
380
;;FIXME use CHANGE-CLASS instead?
2009-08-30 tobias
381
(defun cast (object class)
14:12:44 '
382
"Returns a pointer of type CLASS to the C++ object of OBJECT."
2009-07-08 tobias
383
(declare (optimize (speed 3)))
2009-08-30 tobias
384
(assert (derived-p (class-of object) class)
14:12:44 '
385
()
'
386
"Can not cast object ~A of class ~A to class ~A."
'
387
object (name (class-of object)) (name class))
'
388
(smoke-cast (smoke-module-pointer (smoke (class-of object))) (pointer object)
'
389
(id (class-of object)) (id class)))
'
390
2009-04-05 tobias
391
15:36:29 '
392
(defun upcast (object class)
'
393
(assert (derived-p class (class-of object))
'
394
()
'
395
"Can not upcast object ~A of class ~A to class ~A."
'
396
object (name (class-of object)) (name class))
2009-06-22 tobias
397
(smoke-cast (smoke-module-pointer (smoke class)) (pointer object)
2009-04-05 tobias
398
(id (class-of object)) (id (real-class class))))
15:36:29 '
399
'
400
2009-08-02 tobias
401
;; The constructor name is the name of the class minus any namespace parts.
2009-07-22 tobias
402
(defun constructor-name (class)
2010-02-19 tobias
403
(let ((name-start (search "::" (name class) :from-end t)))
2009-07-22 tobias
404
(if name-start
2010-02-19 tobias
405
(subseq (name class) (+ name-start 2))
21:22:50 '
406
(name class))))
2009-07-22 tobias
407
2009-08-30 tobias
408
(defun call-constructor (object arguments)
14:12:44 '
409
(if (null arguments)
'
410
(let ((method (find-smoke-method (class-of object)
'
411
(constructor-name (class-of object)))))
'
412
(assert (valid-p method)
'
413
(method)
'
414
"No constructor for ~A." object)
'
415
(pointer-call method (null-pointer)))
'
416
(multiple-value-bind (method sequence)
'
417
(find-best-viable-function (constructor-name (class-of object))
'
418
arguments
'
419
(class-of object))
'
420
(when (null method)
'
421
(error "No constructor for object ~A with
'
422
the arguments ~S." object arguments))
'
423
(pointer-call method (null-pointer)
'
424
(mapcar #'(lambda (conversion argument)
'
425
(funcall conversion argument))
'
426
sequence arguments)))))
2009-04-05 tobias
427
15:36:29 '
428
(defmethod initialize-instance :after ((object smoke-standard-object)
2009-07-22 tobias
429
&key args
22:26:05 '
430
(arg0 nil arg0p)
'
431
(arg1 nil arg1p)
'
432
(arg2 nil arg2p)
'
433
&allow-other-keys)
2009-04-05 tobias
434
"Initializes a Smoke object. Calls its constructor with the arguments supplied
15:36:29 '
435
by the key :ARGS and sets the smoke binding."
2009-06-22 tobias
436
(declare (optimize (speed 3)))
2009-04-05 tobias
437
(assert (not (and (slot-boundp object 'pointer)
15:36:29 '
438
(not (null args))))
'
439
((slot-value object 'pointer) args)
'
440
"Pointer ~A bound and constructor argument :ARGS ~S supplied."
'
441
(slot-value object 'pointer) args)
'
442
(unless (slot-boundp object 'pointer)
2009-07-22 tobias
443
(if arg0p
22:26:05 '
444
(setf (slot-value object 'pointer)
2009-08-30 tobias
445
(call-constructor object
2009-07-22 tobias
446
(cond
22:26:05 '
447
(arg2p (list arg0 arg1 arg2))
'
448
(arg1p (list arg0 arg1))
'
449
(t (list arg0)))))
2009-08-30 tobias
450
(setf (slot-value object 'pointer) (call-constructor object args)))
2009-06-22 tobias
451
(set-binding object)
2009-05-24 tobias
452
(take-ownership object)
2009-04-05 tobias
453
(add-object object)))
15:36:29 '
454
'
455
'
456
(defmethod instance-to-lisp (pointer class type)
2009-06-22 tobias
457
(declare (type smoke-standard-class class)
12:18:08 '
458
(optimize (speed 3)))
2009-08-27 tobias
459
(let ((ret (make-instance class :pointer pointer)))
2009-05-24 tobias
460
(when (stack-p type)
11:30:05 '
461
(take-ownership ret)
'
462
(add-object ret))
2009-04-05 tobias
463
ret))
2009-05-31 tobias
464
2009-06-08 tobias
465
(defun keep-wrapper (object new-owner)
2009-06-22 tobias
466
(declare (type smoke-standard-object object)
12:18:08 '
467
(optimize (speed 3)))
2009-06-10 tobias
468
(when (member object (owned-objects new-owner))
2009-08-02 tobias
469
(cerror "ignore" "~A has already been added to ~A."
10:12:41 '
470
object new-owner))
2009-06-08 tobias
471
(push object (owned-objects new-owner)))
2009-05-31 tobias
472
2009-06-22 tobias
473
(declaim (inline remove-wrapper-object))
2009-06-08 tobias
474
(defun remove-wrapper-object (object owner)
09:20:54 '
475
(remove object (owned-objects owner)))
2009-05-31 tobias
476
2009-06-08 tobias
477
(defun transfer-ownership-to (object new-owner)
2009-05-31 tobias
478
"Transfers the ownership of OBJECT to C++."
2009-06-22 tobias
479
(declare (optimize (speed 3)))
2009-06-30 tobias
480
(remove-finalizer object)
2009-06-10 tobias
481
(if (virtual-destructor-p (class-of object))
11:55:55 '
482
(keep-wrapper object new-owner)
'
483
(remove-object (pointer object))))
2009-05-31 tobias
484
2009-06-08 tobias
485
(defun take-ownership (object &optional current-owner)
2009-05-31 tobias
486
"Assigns the ownership of OBJECT to Lisp. i.e.:
17:41:26 '
487
cl-smoke is responsible for deleting the object."
2009-06-08 tobias
488
(when current-owner
09:20:54 '
489
(remove-wrapper-object object current-owner))
2009-06-30 tobias
490
(set-finalizer object))