Leo wrote:
> On 2010-05-24 14:16 +0100, Leo wrote:
>> Hello,
>>
>> I have found when running plplot on another thread, none of the drivers
>> including qt on linux works well; they all crash the underlying lisp.
>> The only driver that works for me is aqt on darwin but sadly my server
>> is running linux - openSUSE 11.0 (X86-64).
>>
>> For information.
>>
>> Leo
> 
> It seems this is due to the fact my code is not robust. Anyone here can
> help make it robust? Thanks.
> 
> (defmacro with-plot-window (&body body)
>   (let ((xx (gensym "XX"))
>         (yy (gensym "YY"))
>         (corners (gensym "CORNERS")))
>     `(let ((,xx (make-array 0 :adjustable t :fill-pointer t))
>            (,yy (make-array 0 :adjustable t :fill-pointer t))
>            (,corners (list 0 0 0 0)))
>        (labels ((adjust-corners (x y)
>                   (when (< x (first ,corners))
>                     (setf (first ,corners) x))
>                   (when (> x (second ,corners))
>                     (setf (second ,corners) x))
>                   (when (< y (third ,corners))
>                     (setf (third ,corners) y))
>                   (when (> y (fourth ,corners))
>                     (setf (fourth ,corners) y))
>                   ,corners)
>                 (plot-point (x y &optional (symbol-type 2))
>                   (plclear)
>                   (apply #'plwind (adjust-corners x y))
>                   (plcol0 15)           ; black foreground
>                   (plbox "bcnst" 0 0 "bcnstv" 0 0)
>                   (pllab "(x)" "(y)" "cl-plplot")
>                   (plcol0 1)            ; red foreground
>                   (vector-push-extend x ,xx)
>                   (vector-push-extend y ,yy)
>                   (plpoin ,xx ,yy symbol-type)
>                   (plline ,xx ,yy)
>                   (plflush)))
>          (plsdev *plot-device*)
>          (plscol0 0 255 255 255)        ; swap black and white
>          (plscol0 15 0 0 0)
>          (plinit)
>          (plwid 1)
>          (pladv 0)
>          (plvsta)
>          (unwind-protect (progn ,@body)
>            (plend))))))
> 
> ;; test
>  (with-plot-window
>    (loop for (x y) in '((1 1) (-2 4) (3 9) (-4 16) (5 25))
>       do (plot-point x y)
>         (sleep 1)))
> 
> 
> Leo
> 

Are you getting any sort of error message? A backtrace?

Are multiple threads trying to run your code at the same time?

-Hazen

------------------------------------------------------------------------------

_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to