From 960af18adff129deb563651dd520fc1c04c8343c Mon Sep 17 00:00:00 2001 Message-Id: <960af18adff129deb563651dd520fc1c04c8343c.1717034946.git.mdw@distorted.org.uk> From: Mark Wooding Date: Fri, 23 Jun 2006 12:25:37 +0000 Subject: [PATCH] Fixes for AMD64 Organization: Straylight/Edgeware From: espen --- gtk/gtktree.lisp | 16 +++++++++------- gtk/gtktypes.lisp | 17 ++++++----------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/gtk/gtktree.lisp b/gtk/gtktree.lisp index e67e26f..15c9a56 100644 --- a/gtk/gtktree.lisp +++ b/gtk/gtktree.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. -;; $Id: gtktree.lisp,v 1.20 2006-04-26 20:31:12 espen Exp $ +;; $Id: gtktree.lisp,v 1.21 2006-06-23 12:25:37 espen Exp $ (in-package "GTK") @@ -210,10 +210,11 @@ (defbinding %tree-path-get-depth () int (location pointer)) (defun %make-tree-path (path) - (let ((c-vector (make-c-vector 'int (length path) :content path)) - (location (allocate-memory (+ (size-of 'int) (size-of 'pointer))))) + (let* ((c-vector (make-c-vector 'int (length path) :content path)) + (pointer-offset (adjust-offset (size-of 'int) 'pointer)) + (location (allocate-memory (+ pointer-offset (size-of 'pointer))))) (funcall (writer-function 'int) (length path) location) - (funcall (writer-function 'pointer) c-vector location (size-of 'int)) + (funcall (writer-function 'pointer) c-vector location pointer-offset) location)) (defun %tree-path-to-vector (location) @@ -224,10 +225,11 @@ (defun %tree-path-to-vector (location) (map-c-vector 'vector #'identity indices 'int depth)))) (defmacro %with-tree-path ((var path) &body body) - (let ((vector-offset (+ (size-of 'int) (size-of 'pointer)))) - `(with-memory (,var (+ ,(size-of 'int) ,(size-of 'pointer) (* ,(size-of 'int) (length ,path)))) + (let* ((pointer-offset (adjust-offset (size-of 'int) 'pointer)) + (vector-offset (adjust-offset (+ pointer-offset (size-of 'pointer)) 'int))) + `(with-memory (,var (+ ,vector-offset (* ,(size-of 'int) (length ,path)))) (funcall (writer-function 'int) (length ,path) ,var) - (setf (ref-pointer ,var ,(size-of 'int)) (pointer+ ,var ,vector-offset)) + (setf (ref-pointer ,var ,pointer-offset) (pointer+ ,var ,vector-offset)) (make-c-vector 'int (length ,path) :content ,path :location (pointer+ ,var ,vector-offset)) ,@body))) diff --git a/gtk/gtktypes.lisp b/gtk/gtktypes.lisp index cce4e9a..c762663 100644 --- a/gtk/gtktypes.lisp +++ b/gtk/gtktypes.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. -;; $Id: gtktypes.lisp,v 1.47 2006-04-26 20:31:12 espen Exp $ +;; $Id: gtktypes.lisp,v 1.48 2006-06-23 12:25:38 espen Exp $ (in-package "GTK") @@ -114,17 +114,12 @@ (defclass stock-item (struct) (:ref stock-item-copy) (:unref stock-item-free)) -;; We don't really need to access any slots in this class, so we just -;; specify the total size (defclass tree-iter (boxed) - ( -;; (stamp :allocation :alien :type int) -;; (user-data :allocation :alien :type pointer) -;; (user-data2 :allocation :alien :type pointer) -;; (user-data3 :allocation :alien :type pointer) - ) - (:metaclass boxed-class) - (:size #.(+ (size-of 'int) (* 3 (size-of 'pointer))))) + ((stamp :allocation :alien :type int) + (user-data :allocation :alien :type pointer) + (user-data2 :allocation :alien :type pointer) + (user-data3 :allocation :alien :type pointer)) + (:metaclass boxed-class)) ;; (defclass tree-path (boxed) -- [mdw]