From kielhorn.martin at googlemail.com Wed Oct 22 16:24:34 2008 From: kielhorn.martin at googlemail.com (Martin Kielhorn) Date: Wed, 22 Oct 2008 17:24:34 +0100 Subject: [cells-gtk-devel] can't run testprogram Message-ID: <1ae41e820810220924vb5293b7k58f5df1bb5694747@mail.gmail.com> hi, i tried to install cells-gtk following the instructions from http://www.washbear-network.de/peterblog/getting-started-with-cells-gtk and http://www.washbear-network.de/peterblog/2008/04/13/cells-gtk3/ But I can't even run the examples. There seems to be an error in how strings are handled. sh-3.1$ cat test.lisp (require :asdf) (require :test-gtk) (in-package :test-gtk) (gtk-demo) sh-3.1$ sbcl --load test.lisp This is SBCL 1.0.20, an implementation of ANSI Common Lisp. More information about SBCL is available at . SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. ; loading system definition from /home/martin/.sbcl/systems/cells-gtk.asd into ; # ; registering # as CELLS-GTK [...] ; registering # as CELLS "----------UTILSRESET----------------------------------" "----------UTILSRESET----------------------------------" debugger invoked on a SIMPLE-ERROR in thread #: Error during processing of --eval option (LOAD #P"test.lisp"): The value of STRING is #(71 84 75 32 84 101 115 116 105 110 103), which is not of type STRING. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Ignore and continue with next --eval option. 1: [ABORT ] Skip rest of --eval options. 2: Skip to toplevel READ/EVAL/PRINT loop. 3: [QUIT ] Quit SBCL (calling #'QUIT, killing the process). ((FLET #:LAMBDA135) #) 0] sh-3.1$ ls ~/.sbcl/site/ alexandria cells3 cl-cairo2 cl-utilities trivial-g babel_0.3.0 cells-gtk3 cl-colors-latest slime bordeaux-threads cffi_0.10.2 cl-opengl trivial-f sh-3.1$ sbcl --version SBCL 1.0.20 Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From kielhorn.martin at googlemail.com Thu Oct 23 09:04:02 2008 From: kielhorn.martin at googlemail.com (Martin Kielhorn) Date: Thu, 23 Oct 2008 10:04:02 +0100 Subject: [cells-gtk-devel] can't run testprogram In-Reply-To: <1ae41e820810220924vb5293b7k58f5df1bb5694747@mail.gmail.com> References: <1ae41e820810220924vb5293b7k58f5df1bb5694747@mail.gmail.com> Message-ID: <1ae41e820810230204o12b1c45dy1ad15fc996509c28@mail.gmail.com> 2008/10/22 Martin Kielhorn > hi, > i tried to install cells-gtk following the instructions from > http://www.washbear-network.de/peterblog/getting-started-with-cells-gtk > > and > http://www.washbear-network.de/peterblog/2008/04/13/cells-gtk3/ > > But I can't even run the examples. There seems to be an error in how > strings > are handled. I resolved the issue by changing the following lines in gtk-ffi/gtk-ffi-impl.lisp (I removed the extra code for sbcl by renaming #+sbcl to #+sbcl2): (defun lisp-to-utf-8 (str) #-(or clisp sbcl2) (return-from lisp-to-utf-8 str) (when str #+clisp (ext:convert-string-to-bytes str charset:utf-8) #+sbcl2 (sb-ext:string-to-octets str :external-format :utf-8))) (defun utf-8-to-lisp (str) #-(or clisp sbcl2) (return-from utf-8-to-lisp str) (when str (let* ((nat (lisp-to-utf-8 str)) (oct (coerce (loop for i from 0 below (length nat) for b = (aref nat i) collect b ;; ph: gtk gives us 4 bytes per char ; why ? if (= b 195) do (incf i 2)) '(vector (unsigned-byte 8))))) #+clisp (ext:convert-string-from-bytes oct charset:utf-8) #+sbcl2 (sb-ext:octets-to-string oct :external-format :utf-8)))) Now the test application runs, but when I press the last tab "Drawing" the program aborts with: [...] 0> TX> "initialize-instance :after" :self window472 :|(id self)| #.(sb-sys:int-sap #x082a1240) 0> TX> "initialize-instance :after" :self window473 :|(id self)| #.(sb-sys:int-sap #x082a12e0) debugger invoked on a SIMPLE-ERROR in thread #: Error during processing of --eval option (LOAD #P"test.lisp"): The function CELLS-GTK::CONTEXT is undefined. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Ignore and continue with next --eval option. 1: [ABORT ] Skip rest of --eval options. 2: Skip to toplevel READ/EVAL/PRINT loop. 3: [QUIT ] Quit SBCL (calling #'QUIT, killing the process). ((FLET #:LAMBDA135) #) 0] backtrace 0: ((FLET #:LAMBDA135) #) 1: ((FLET #:LAMBDA135) #)[:EXTERNAL] 2: (SIGNAL #)[:EXTERNAL] 3: (ERROR UNDEFINED-FUNCTION)[:EXTERNAL] 4: (SB-KERNEL::UNDEFINED-FUN-ERROR-HANDLER # #.(SB-SYS:INT-SAP #XB79BE020) # (14)) 5: (SB-KERNEL::UNDEFINED-FUN-ERROR-HANDLER # #.(SB-SYS:INT-SAP #XB79BE020) # (14))[:EXTERNAL] 6: (SB-KERNEL:INTERNAL-ERROR #.(SB-SYS:INT-SAP #XB79BDD1C) #) 7: ("foreign function: call_into_lisp") 8: ("foreign function: funcall2") 9: ("foreign function: interrupt_internal_error") 10: ("foreign function: handle_trap") 11: ("bogus stack frame") 12: (CELLS-GTK::CAIRO-DRAWING-AREA-DRAW DRAW) 13: ((LAMBDA (CELLS-GTK::GTK-POINTER SIGNAL CELLS-GTK::DATA)) #.(SB-SYS:INT-SAP #X08237D98) # #) 14: ((LAMBDA (SB-ALIEN::ARGS-POINTER SB-ALIEN::RESULT-POINTER FUNCTION)) -303630245 -303630249 #) 15: ("foreign function: call_into_lisp") 16: ("foreign function: funcall3") 17: ("foreign function: #x1101858") 18: ("foreign function: _gtk_marshal_BOOLEAN__BOXED") 19: ("foreign function: g_closure_invoke") 20: ("foreign function: #xB6E43213") 21: ("foreign function: g_signal_emit_valist") 22: ("foreign function: g_signal_emit") 23: ("foreign function: #xB7259C78") 24: ("foreign function: #xB79BE5F4") 0] -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.hildebrandt at gmail.com Thu Oct 23 09:51:10 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Thu, 23 Oct 2008 11:51:10 +0200 Subject: [cells-gtk-devel] can't run testprogram In-Reply-To: <1ae41e820810230204o12b1c45dy1ad15fc996509c28@mail.gmail.com> References: <1ae41e820810220924vb5293b7k58f5df1bb5694747@mail.gmail.com> <1ae41e820810230204o12b1c45dy1ad15fc996509c28@mail.gmail.com> Message-ID: <7758b2680810230251x302b8010p8f3f7935e0c3cb95@mail.gmail.com> Hi Martin, welcome aboard. I am quite busy these days, and I don't have access to my linux box at the moment, therefore I can only give a few general comments. First, the sbcl specific string coding stuff has changed in recent SBCL versions, I believe, so it might well be the case that this is legacy code. Once I get around to setting up my linux box again (just waiting for Ubuntu 8.10 next weekend), I will clean up that mess and hopefully commit something that works out of the box on a current system again. I worked with SBCL 1.0.11 when I wrote that code, to give you an idea. The context function used to be part of Tamas Papp's cl-cairo2, I believe. Maybe he has changed something in there recently. Depending on what you are up to, there's four options: 1) You play around with everything but cairo (you might even use opengl for drawing if you like -- just comment out the cairo tabs in test-gtk) 2) You wait until I get around to fixing this -- maybe I'll get around to it within the next two weeks, but I would not hold my breath. Strategy consulting is inherently unpredictable ... 3) You fix it yourself. Maybe understand the cairo parts a little better and get in touch with Tamas. 4) You magically find another toolkit that runs better than cells-gtk3 and provides cairo drawing ... I would not hold my breath either ;-) So long, Peter 2008/10/23 Martin Kielhorn : > > > 2008/10/22 Martin Kielhorn >> >> hi, >> i tried to install cells-gtk following the instructions from >> http://www.washbear-network.de/peterblog/getting-started-with-cells-gtk >> >> and >> http://www.washbear-network.de/peterblog/2008/04/13/cells-gtk3/ >> >> But I can't even run the examples. There seems to be an error in how >> strings >> are handled. > > I resolved the issue by changing the following lines in > gtk-ffi/gtk-ffi-impl.lisp (I removed the extra code for sbcl by renaming > #+sbcl to #+sbcl2): > > (defun lisp-to-utf-8 (str) > #-(or clisp sbcl2) (return-from lisp-to-utf-8 str) > (when str > #+clisp (ext:convert-string-to-bytes str charset:utf-8) > #+sbcl2 (sb-ext:string-to-octets str :external-format :utf-8))) > > (defun utf-8-to-lisp (str) > #-(or clisp sbcl2) (return-from utf-8-to-lisp str) > (when str > (let* ((nat (lisp-to-utf-8 str)) > (oct (coerce (loop for i from 0 below (length nat) > for b = (aref nat i) > collect b > ;; ph: gtk gives us 4 bytes per char ; why ? > if (= b 195) do (incf i 2)) > '(vector (unsigned-byte 8))))) > #+clisp (ext:convert-string-from-bytes oct charset:utf-8) > #+sbcl2 (sb-ext:octets-to-string oct :external-format :utf-8)))) > > Now the test application runs, but when I press the last tab "Drawing" the > program aborts with: > > [...] > 0> TX> "initialize-instance :after" :self window472 :|(id self)| > #.(sb-sys:int-sap #x082a1240) > 0> TX> "initialize-instance :after" :self window473 :|(id self)| > #.(sb-sys:int-sap #x082a12e0) > debugger invoked on a SIMPLE-ERROR in thread # RUNNING {A6E5719}>: > Error during processing of --eval option (LOAD #P"test.lisp"): > > The function CELLS-GTK::CONTEXT is undefined. > > Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. > > restarts (invokable by number or by possibly-abbreviated name): > 0: [CONTINUE] Ignore and continue with next --eval option. > 1: [ABORT ] Skip rest of --eval options. > 2: Skip to toplevel READ/EVAL/PRINT loop. > 3: [QUIT ] Quit SBCL (calling #'QUIT, killing the process). > > ((FLET #:LAMBDA135) #) > 0] backtrace > > 0: ((FLET #:LAMBDA135) #) > 1: ((FLET #:LAMBDA135) #)[:EXTERNAL] > 2: (SIGNAL #)[:EXTERNAL] > 3: (ERROR UNDEFINED-FUNCTION)[:EXTERNAL] > 4: (SB-KERNEL::UNDEFINED-FUN-ERROR-HANDLER > # > #.(SB-SYS:INT-SAP #XB79BE020) > # (SB-ALIEN:STRUCT > > SB-VM::OS-CONTEXT-T-STRUCT))> > (14)) > 5: (SB-KERNEL::UNDEFINED-FUN-ERROR-HANDLER > # > #.(SB-SYS:INT-SAP #XB79BE020) > # (SB-ALIEN:STRUCT > > SB-VM::OS-CONTEXT-T-STRUCT))> > (14))[:EXTERNAL] > 6: (SB-KERNEL:INTERNAL-ERROR > #.(SB-SYS:INT-SAP #XB79BDD1C) > #) > 7: ("foreign function: call_into_lisp") > 8: ("foreign function: funcall2") > 9: ("foreign function: interrupt_internal_error") > 10: ("foreign function: handle_trap") > 11: ("bogus stack frame") > 12: (CELLS-GTK::CAIRO-DRAWING-AREA-DRAW DRAW) > 13: ((LAMBDA (CELLS-GTK::GTK-POINTER SIGNAL CELLS-GTK::DATA)) > #.(SB-SYS:INT-SAP #X08237D98) > # > #) > 14: ((LAMBDA (SB-ALIEN::ARGS-POINTER SB-ALIEN::RESULT-POINTER FUNCTION)) > -303630245 > -303630249 > #) > 15: ("foreign function: call_into_lisp") > 16: ("foreign function: funcall3") > 17: ("foreign function: #x1101858") > 18: ("foreign function: _gtk_marshal_BOOLEAN__BOXED") > 19: ("foreign function: g_closure_invoke") > 20: ("foreign function: #xB6E43213") > 21: ("foreign function: g_signal_emit_valist") > 22: ("foreign function: g_signal_emit") > 23: ("foreign function: #xB7259C78") > 24: ("foreign function: #xB79BE5F4") > > 0] > > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel > From kielhorn.martin at googlemail.com Thu Oct 30 18:18:54 2008 From: kielhorn.martin at googlemail.com (Martin Kielhorn) Date: Thu, 30 Oct 2008 18:18:54 +0000 Subject: [cells-gtk-devel] can't run testprogram In-Reply-To: <7758b2680810271041q1d494995p29033fbc7eac7194@mail.gmail.com> References: <1ae41e820810220924vb5293b7k58f5df1bb5694747@mail.gmail.com> <1ae41e820810230204o12b1c45dy1ad15fc996509c28@mail.gmail.com> <7758b2680810230251x302b8010p8f3f7935e0c3cb95@mail.gmail.com> <1ae41e820810240932n340a7dc6mf70a8bfd69af1774@mail.gmail.com> <7758b2680810271041q1d494995p29033fbc7eac7194@mail.gmail.com> Message-ID: <1ae41e820810301118o66c0d2c6n14c516a616d70fa6@mail.gmail.com> 2008/10/27 Peter Hildebrandt > > Lemme know if I can help. Right now I figure out if it is feasible to control a microscope with cells. In the end I would capture from a camera, move the focus, change objectives... But for the beginning I just try to create something similar to baudline ( http://www.baudline.com/). Just capture sound, fft and display in an opengl texture. That should be easier as there is not as much hardware involved. What I've come up with is the following code. And I have several questions: 1) Can how somehow prevent the introduction of the extra defmodel graphics with the cell rotation and just connect my the hscale value to the gl-rotate? 2) What's the best way to continuously call the draw function in graphics, so that the display gets updated with 30 Hz? I searched the graphics instance with (inspect *win*) but I didn't find it. Otherwise I could have called (redraw (graphics (vbox *win*))) from an endless loop in another thread. Ideally I want to have the application running in several threads. One thread should capture sound and fill it in a queue. That should be easy in sbcl: http://www.sbcl.org/manual/Waitqueue_002fcondition-variables.html#Waitqueue_002fcondition-variables when 2) is solved. remark: I think :resize isn't called when my program starts. (In early versions of my program it was called. I don't know what change introduced this bug) (require :asdf) (require :cells-gtk) (require :sb-simple-audio) (defpackage :martin (:use :cl :cgtk :cells)) (in-package :martin) (defparameter *tex* #x0) (defparameter *field* (cffi:make-shareable-byte-vector (* 256 256 3))) (defparameter *sound-buf-n* 1024) (defparameter *sound-buf* (make-array *sound-buf-n*)) (defparameter *sound-stream* (sb-simple-audio:open-audio :sample-rate 8000 :direction :input)) (defun plot (x y r g b) (setf (aref *field* (+ 0 (* 3 (+ x (* 256 y))))) r) (setf (aref *field* (+ 1 (* 3 (+ x (* 256 y))))) g) (setf (aref *field* (+ 2 (* 3 (+ x (* 256 y))))) b)) (defmodel graphics (gl-drawing-area) ((rotation :cell t :initarg :rotation :initform 0 :accessor rotation)) (:default-initargs :expand t :fill t :init #'(lambda (self) ;;(declare (ignorable self)) (loop for i below 256 do (loop for j below 256 do (plot i j i j 0))) (setf *tex* (first (gl:gen-textures 1))) (gl:bind-texture :texture-2d *tex*) (gl:tex-parameter :texture-2d :texture-mag-filter :nearest) (gl:tex-parameter :texture-2d :texture-min-filter :nearest) (cffi::with-pointer-to-vector-data (addr *field*) (gl:tex-image-2d :texture-2d 0 :rgba 256 256 0 :rgb :unsigned-byte addr))) :resize #'(lambda (self) (format t "RESIZE~%") (with-matrix-mode (:projection) (glu:perspective 50 (/ (allocated-width self) (allocated-height self)) .5 20))) :draw #'(lambda (self) (declare (ignorable self)) (gl:clear :color-buffer-bit) (gl:load-identity) ;(gl:translate 0 0 -5) (gl:rotate (* 360 (rotation self)) 0 0 1) (gl:color 1 1 1) (gl:enable :texture-2d) (gl:with-primitive :quads (gl:tex-coord 0 0)(gl:vertex 0 0) (gl:tex-coord 1 0)(gl:vertex 1 0) (gl:tex-coord 1 1)(gl:vertex 1 1) (gl:tex-coord 0 1)(gl:vertex 0 1)) (read-sequence *sound-buf* *sound-stream*) ;;(format t "~a~%" *sound-buf*) (gl:disable :texture-2d) (gl:with-primitive :points (loop for i below *sound-buf-n* do (gl:vertex (/ i *sound-buf-n*) (/ (aref *sound-buf* i) 5000)))) (gl:flush)))) (defobserver rotation ((self graphics)) (redraw self)) (defmodel my-app (gtk-app) () (:default-initargs :title "minimal gl control test" :position :center :width 500 :height 380 :kids (kids-list? (mk-vbox :kids (kids-list? (mk-hscale :md-name :scale :value-type 'single-float :min .01 :max 1. :step .01 :init .5) (make-kid 'graphics :md-name :graphics :height 300 :rotation (c? (widget-value :scale)))))))) (cells-gtk-init) ;(defparameter *win* (start-win 'my-app)) (start-app 'my-app) (* (inspect *win*) (sb-thread:list-all-threads) (make-thread (lambda () (write-line "test"))) *) -------------- next part -------------- An HTML attachment was scrubbed... URL: