~mdw
/
clg
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added function to get the GDK window associated to a Cairo xlib surface
[clg]
/
gffi
/
memory.lisp
diff --git
a/gffi/memory.lisp
b/gffi/memory.lisp
index
fd09f90
..
dd71a5a
100644
(file)
--- a/
gffi/memory.lisp
+++ b/
gffi/memory.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: memory.lisp,v 1.
1 2006/04/25 20:31:35
espen Exp $
+;; $Id: memory.lisp,v 1.
3 2006/12/21 16:38:19
espen Exp $
(in-package "GFFI")
(in-package "GFFI")
@@
-71,14
+71,19
@@
#+clisp(ffi:memory-as location 'ffi:uchar offset)
byte))
#+clisp(ffi:memory-as location 'ffi:uchar offset)
byte))
+(defparameter *memory-allocator* nil)
+(defparameter *memory-deallocator* nil)
+
(defun allocate-memory (size)
(defun allocate-memory (size)
- (declare (ignore size))
- (error "Memory allocator not set"))
+ (if *memory-allocator*
+ (funcall *memory-allocator* size)
+ (error "Memory allocator not set")))
(declaim (ftype (function (integer) system-area-pointer) allocate-memory))
(defun deallocate-memory (location)
(declaim (ftype (function (integer) system-area-pointer) allocate-memory))
(defun deallocate-memory (location)
- (declare (ignore location))
- (warn "Memory deallocator not set"))
+ (if *memory-deallocator*
+ (funcall *memory-deallocator* location)
+ (warn "Memory deallocator not set")))
(defun copy-memory (from length &optional (to (allocate-memory length)))
#+cmu(system-area-copy from 0 to 0 (* 8 length))
(defun copy-memory (from length &optional (to (allocate-memory length)))
#+cmu(system-area-copy from 0 to 0 (* 8 length))
@@
-141,4
+146,9
@@
(sb-alien-internals:parse-alien-type type nil)))
(defun sb-sizeof (type)
(sb-alien-internals:parse-alien-type type nil)))
(defun sb-sizeof (type)
- (/ (sb-sizeof-bits type) 8)))
+ (/ (sb-sizeof-bits type) 8))
+
+ (defun sb-alignment (type)
+ (/ (sb-alien-internals:alien-type-alignment
+ (sb-alien-internals:parse-alien-type type nil))
+ 8)))