1

my operate system is OS X 10.11.5, code with emacs+slime+sbcl
I loaded lispbuilder-sdl using command:

(asdf:operate 'asdf:load-op :cocoahelper)
(asdf:operate 'asdf:load-op :lispbuilder-sdl)

then copy the example code on here

(sdl:with-init ()
  (sdl:window 320 240)
  (sdl:update-display)
  (sdl:with-events ()
     (:quit-event () t)))

but nothing happened,so i type 'C-c C-c' to terminate the process, it shows some error like this:

Restarts:
0: [CONTINUE] Continue from break.
1: [RETRY] Retry SLIME REPL evaluation request.
2: [*ABORT] Return to SLIME's top level.
3: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1003FC0003}>)

Backtrace:
0: ("bogus stack frame")
1: ("foreign function: SDL_Delay")
2: (LISPBUILDER-SDL-CFFI::SDL-DELAY 27)
3: ((SB-PCL::EMF LISPBUILDER-SDL::PROCESS-TIMESTEP) #<unavailable argument> #<unavailable argument> #<LISPBUILDER-SDL:FPS-FIXED {10059F6E43}> #<FUNCTION (LAMBDA NIL :IN #:DROP-THRU-TAG-1) {10056C6A0B}>)
4: ((:METHOD LISPBUILDER-SDL::PROCESS-TIMESTEP :AROUND (LISPBUILDER-SDL::FPS-MANAGER T)) #<LISPBUILDER-SDL:FPS-FIXED {10059F6E43}> #<FUNCTION (LAMBDA NIL :IN #:DROP-THRU-TAG-1) {10056C6A0B}>) [fast-metho..
5: ((LAMBDA ()))
6: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LISPBUILDER-SDL:WITH-INIT NIL (LISPBUILDER-SDL:WINDOW 320 240) (LISPBUILDER-SDL:UPDATE-DISPLAY) (LISPBUILDER-SDL:WITH-EVENTS NIL (:QUIT-EVENT NIL T))) #<NULL-LEXENV>)
7: (EVAL (LISPBUILDER-SDL:WITH-INIT NIL (LISPBUILDER-SDL:WINDOW 320 240) (LISPBUILDER-SDL:UPDATE-DISPLAY) (LISPBUILDER-SDL:WITH-EVENTS NIL (:QUIT-EVENT NIL T))))

Is there anyone can help me fix this error?

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346
neo
  • 11
  • 1

1 Answers1

0

I tried to reproduce your example (Linux/SBCL). First:

(ql:quickload :lispbuilder-sdl)

Then:

(sdl:with-init ()
  (sdl:window 320 240)
  (sdl:update-display)
  (sdl:with-events ()
    (:quit-event () t)))

This displays an empty window while the REPL hangs (as expected), until I close the window and can use the REPL again. But if I do C-c C-c while the window is displayed, then I obtain a stack trace similar to yours:

Interrupt from Emacs
   [Condition of type SIMPLE-ERROR]

Restarts:
 0: [CONTINUE] Continue from break.
 1: [RETRY] Retry SLIME REPL evaluation request.
 2: [*ABORT] Return to SLIME's top level.
 3: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1003498033}>)

Backtrace:
  0: ("bogus stack frame")
  1: ((SB-PCL::EMF LISPBUILDER-SDL::PROCESS-TIMESTEP) #<unavailable argument> #<unavailable argument> #<LISPBUILDER-SDL:FPS-FIXED {1006F962A3}> #<FUNCTION (LAMBDA NIL :IN #:DROP-THRU-TAG-1) {1006F95F0B}>)
  2: ((:METHOD LISPBUILDER-SDL::PROCESS-TIMESTEP :AROUND (LISPBUILDER-SDL::FPS-MANAGER T)) #<LISPBUILDER-SDL:FPS-FIXED {1006F962A3}> #<FUNCTION (LAMBDA NIL :IN #:DROP-THRU-TAG-1) {1006F95F0B}>) [fast-metho..
  3: ((LAMBDA ()))
  4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LISPBUILDER-SDL:WITH-INIT NIL (LISPBUILDER-SDL:WINDOW 320 240) (LISPBUILDER-SDL:UPDATE-DISPLAY) (LISPBUILDER-SDL:WITH-EVENTS NIL (:QUIT-EVENT NIL T))) #<NULL-LEXENV>)
  5: (EVAL (LISPBUILDER-SDL:WITH-INIT NIL (LISPBUILDER-SDL:WINDOW 320 240) (LISPBUILDER-SDL:UPDATE-DISPLAY) (LISPBUILDER-SDL:WITH-EVENTS NIL (:QUIT-EVENT NIL T))))
 --more--

However, everything is working as expected, because I can for example choose to continue the execution, or abort. That's what the interrupt is for.

My guess is that everything works fine but you can't see the window. I don't know why and I have no experience with OS X, unfortunately. Maybe if you try to actually display something (see below), as recommended in SDL window does not show, it could work. Here is an example which draws something:

(sdl:with-init ()
  (sdl:window 320 240)
  (sdl:update-display)
  (sdl:with-events ()
    (:quit-event () t)
    (:idle (sdl:fill-surface sdl:*white*)
           (sdl:update-display))))
Community
  • 1
  • 1
coredump
  • 37,664
  • 5
  • 43
  • 77
  • Thanks for your answer, i tried the code on Linux too, and it works well. SDL needs cocoahelper to work with cocoa on OSX, maybe there is something wrong with cocoahelper, but i don't know how to fix it. – neo Jul 18 '16 at 12:35
  • This may be an interaction with slime. If you are using the default spawn communication style change it to sigio and see if that works. – David Hodge Jul 18 '16 at 20:40
  • I changed the communication style into `:SIGIO` and `:FD-HANDLER` in the `swank.lisp` file, run the code, but it still don't work, with new error `arithmetic error FLOATING-POINT-INEXACT signalled`. – neo Jul 19 '16 at 12:08
  • Two pieces of advice then. First try to run this outside of slums and see if it works. The second is to go to the lispbuilder Google group once you have determined if it's slime or not and ask there. They are usually very helpful. And that's how I solved my problem a while ago. Cheers – David Hodge Jul 20 '16 at 23:24