chiark
/
gitweb
/
~mdw
/
clg
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed to use of settable FOREIGN-LOCATION
[clg]
/
glib
/
proxy.lisp
diff --git
a/glib/proxy.lisp
b/glib/proxy.lisp
index 44f25771ab21b2bd4a1a24ddab25f33bbaf58766..53d35babc44990d2602cf78a30d56f81eee5d0ea 100644
(file)
--- a/
glib/proxy.lisp
+++ b/
glib/proxy.lisp
@@
-20,7
+20,7
@@
;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-;; $Id: proxy.lisp,v 1.3
0 2006-02-08 21:43:33
espen Exp $
+;; $Id: proxy.lisp,v 1.3
1 2006-02-08 22:10:47
espen Exp $
(in-package "GLIB")
(in-package "GLIB")
@@
-292,7
+292,7
@@
(defun list-invalidated-instances ()
;; TODO: add a ref-counted-proxy subclass
(defclass proxy ()
;; TODO: add a ref-counted-proxy subclass
(defclass proxy ()
- ((location :allocation :special :
reader foreign-location :
type pointer))
+ ((location :allocation :special :type pointer))
(:metaclass virtual-slots-class))
(defgeneric instance-finalizer (object))
(:metaclass virtual-slots-class))
(defgeneric instance-finalizer (object))
@@
-300,6
+300,15
@@
(defgeneric reference-foreign (class location))
(defgeneric unreference-foreign (class location))
(defgeneric invalidate-instance (object))
(defgeneric unreference-foreign (class location))
(defgeneric invalidate-instance (object))
+(defun foreign-location (instance)
+ (slot-value instance 'location))
+
+(defun (setf foreign-location) (location instance)
+ (setf (slot-value instance 'location) location))
+
+(defun proxy-valid-p (instance)
+ (slot-boundp instance 'location))
+
(defmethod reference-foreign ((name symbol) location)
(reference-foreign (find-class name) location))
(defmethod reference-foreign ((name symbol) location)
(reference-foreign (find-class name) location))
@@
-553,7
+562,7
@@
(defmethod make-proxy-instance ((class proxy-class) location &key weak)
(or
(find-invalidated-instance class)
(allocate-instance class))))
(or
(find-invalidated-instance class)
(allocate-instance class))))
- (setf (
slot-value instance 'location
) location)
+ (setf (
foreign-location instance
) location)
(unless weak
(finalize instance (instance-finalizer instance)))
instance))
(unless weak
(finalize instance (instance-finalizer instance)))
instance))