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