chiark
/
gitweb
/
~mdw
/
clg
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Disable SVG tests if librsvg is not available
[clg]
/
glib
/
glib.lisp
diff --git
a/glib/glib.lisp
b/glib/glib.lisp
index 6bd2dff92aafec829722d65e35919b9b61a1584b..ebc3b30f1ff3e7127fe156467486253883d9397e 100644
(file)
--- a/
glib/glib.lisp
+++ b/
glib/glib.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: glib.lisp,v 1.3
0 2005/04/23 16:48:50
espen Exp $
+;; $Id: glib.lisp,v 1.3
3 2006/02/09 22:24:31
espen Exp $
(in-package "GLIB")
(in-package "GLIB")
@@
-47,6
+47,12
@@
(defun copy-memory (from length &optional (to (allocate-memory length)))
#+sbcl(system-area-ub8-copy from 0 to 0 length)
to)
#+sbcl(system-area-ub8-copy from 0 to 0 length)
to)
+(defmacro with-allocated-memory ((var size) &body body)
+ `(let ((,var (allocate-memory ,size)))
+ (unwind-protect
+ (progn ,@body)
+ (deallocate-memory ,var))))
+
;;;; User data mechanism
;;;; User data mechanism
@@
-230,7
+236,8
@@
(defmethod writer-function ((type (eql 'glist)) &rest args)
(defmethod reader-function ((type (eql 'glist)) &rest args)
(declare (ignore type))
(destructuring-bind (element-type) args
(defmethod reader-function ((type (eql 'glist)) &rest args)
(declare (ignore type))
(destructuring-bind (element-type) args
- #'(lambda (location &optional (offset 0))
+ #'(lambda (location &optional (offset 0) weak-p)
+ (declare (ignore weak-p))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-glist 'list #'identity (sap-ref-sap location offset) element-type)))))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-glist 'list #'identity (sap-ref-sap location offset) element-type)))))
@@
-339,7
+346,8
@@
(defmethod writer-function ((type (eql 'gslist)) &rest args)
(defmethod reader-function ((type (eql 'gslist)) &rest args)
(declare (ignore type))
(destructuring-bind (element-type) args
(defmethod reader-function ((type (eql 'gslist)) &rest args)
(declare (ignore type))
(destructuring-bind (element-type) args
- #'(lambda (location &optional (offset 0))
+ #'(lambda (location &optional (offset 0) weak-p)
+ (declare (ignore weak-p))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-glist 'list #'identity (sap-ref-sap location offset) element-type)))))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-glist 'list #'identity (sap-ref-sap location offset) element-type)))))
@@
-447,7
+455,7
@@
(defmethod copy-from-alien-form (c-vector (type (eql 'vector)) &rest args)
(destructuring-bind (element-type &optional (length '*)) args
(if (eq length '*)
(error "Can't use vector of variable size as return type")
(destructuring-bind (element-type &optional (length '*)) args
(if (eq length '*)
(error "Can't use vector of variable size as return type")
- `(map-c-vector 'vector #'identity ,c-vector ',element-type
'
,length))))
+ `(map-c-vector 'vector #'identity ,c-vector ',element-type ,length))))
(defmethod copy-from-alien-function ((type (eql 'vector)) &rest args)
(declare (ignore type))
(defmethod copy-from-alien-function ((type (eql 'vector)) &rest args)
(declare (ignore type))
@@
-486,7
+494,8
@@
(defmethod reader-function ((type (eql 'vector)) &rest args)
(destructuring-bind (element-type &optional (length '*)) args
(if (eq length '*)
(error "Can't create reader function for vector of variable size")
(destructuring-bind (element-type &optional (length '*)) args
(if (eq length '*)
(error "Can't create reader function for vector of variable size")
- #'(lambda (location &optional (offset 0))
+ #'(lambda (location &optional (offset 0) weak-p)
+ (declare (ignore weak-p))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-c-vector 'vector #'identity (sap-ref-sap location offset)
element-type length))))))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-c-vector 'vector #'identity (sap-ref-sap location offset)
element-type length))))))
@@
-607,7
+616,8
@@
(defmethod reader-function ((type (eql 'null-terminated-vector)) &rest args)
(destructuring-bind (element-type) args
(unless (eq (alien-type element-type) (alien-type 'pointer))
(error "Elements in null-terminated vectors need to be of pointer types"))
(destructuring-bind (element-type) args
(unless (eq (alien-type element-type) (alien-type 'pointer))
(error "Elements in null-terminated vectors need to be of pointer types"))
- #'(lambda (location &optional (offset 0))
+ #'(lambda (location &optional (offset 0) weak-p)
+ (declare (ignore weak-p))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-0-vector 'vector #'identity (sap-ref-sap location offset)
element-type)))))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-0-vector 'vector #'identity (sap-ref-sap location offset)
element-type)))))
@@
-704,7
+714,8
@@
(defmethod writer-function ((type (eql 'counted-vector)) &rest args)
(defmethod reader-function ((type (eql 'counted-vector)) &rest args)
(declare (ignore type))
(destructuring-bind (element-type) args
(defmethod reader-function ((type (eql 'counted-vector)) &rest args)
(declare (ignore type))
(destructuring-bind (element-type) args
- #'(lambda (location &optional (offset 0))
+ #'(lambda (location &optional (offset 0) weak-p)
+ (declare (ignore weak-p))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-counted-vector 'vector #'identity
(sap-ref-sap location offset) element-type)))))
(unless (null-pointer-p (sap-ref-sap location offset))
(map-counted-vector 'vector #'identity
(sap-ref-sap location offset) element-type)))))