Felix wrote:

> On 6/12/07, Eduardo Cavazos <[EMAIL PROTECTED]> wrote:

> > That only works with the compiler (csc). Is there a way to box/unbox data
> > in the interpreter so I can call xquerypointer from csi? Just curious as
> > it's easier to experiment via csi instead of recompiling my file each
> > time a change is made.
>
> You could create a wrapper function that does the xquerypointer call
> and returns its data and compile the function into a dynamically
> loadable library with "-s". Then "load" the generated file into the
> interpreter.

Thanks Felix!

Something else I had in mind was to make "foreign boxes":

(define (make-ulong-box)
  (let-location ((val unsigned-long))
    (lambda (op)
      (case op
        ((get)
         val)
        ((set)
         (lambda (new-val)
           (set! val new-val)))
        ((box)
         (location val))))))

I made those for uinteger and integer as well, and compiled them 
as "foreign-boxes.so".

Then I was able to use xquerypointer from csi as follows:

;; make the boxes

(define root (make-ulong-box))
(define child (make-ulong-box))
(define root-x (make-integer-box))
(define root-y (make-integer-box))
(define win-x (make-integer-box))
(define win-y (make-integer-box))
(define mask (make-uinteger-box))

;; call xquerypointer

(xquerypointer (dpy 'ptr)
               ((dpy 'default-root) 'id)
               (root 'box)
               (child 'box)
               (root-x 'box)
               (root-y 'box)
               (win-x 'box)
               (win-y 'box)
               (mask 'box))

;; look at some box values

(list (win-x 'get)
      (win-y 'get))

Ed


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to