Help, wierd existence_error message from previously working code!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help, wierd existence_error message from previously working code!

emacstheviking
I am stuck with a really wierd problem around some code that used to work just fine and I am at a loss to explain what is happening. A long time back I published on github a comprehensive binding to SDL2 for gprolog, it all worked on ubuntu and OSX just fine.

A year or two down the line, I checked out the code, it built first time but it is raising existence_error-s on code that exists BUT ARITY IS ZERO.

I have an event loop predicate that calls itself until you hit the ESC key... here is what it looks like trying to run the fonttest predicate:

?- [f].
?- fonttest.
Window flags: 0
gp_SDL_CreateWindow: ok: 0x3e10390
SDL.PL: gp_SDL_CreateRenderer_C(65078160, -1, 6, Rndr).
render draw color: 0, 0, 0
Font texture: 480 x 95 pixels
render draw color: 255, 128, 128
render draw color: 0, 128, 128
window(213,2,shown)


uncaught exception: error(existence_error(procedure,handle_event/0),evloop/0)

at this point...
I listed the handle_event predicate, the code is there BUT NOT /0...

| ?- listing(handle_event).

% file: /home/sean/Documents/prolog/gnuprolog-libsdl2/f.pl

handle_event(quit(_)) :-
    format([81, 85, 73, 84, 32, 115, 101, 108, 101, 99, 116, 101, 100, 126, 110], []), !,
    fail.
handle_event(keyup(_, _, released, _, _, 27, _)) :-
    format([69, 83, 67, 32, 112, 114, 101, 115, 115, 101, 100, 126, 110], []), !,
    fail.
handle_event(_).


and finally I listed out the evloop predicate to check:

| ?- listing(evloop).

% file: /home/sean/Documents/prolog/gnuprolog-libsdl2/f.pl

evloop :-
    sdl_PollEvent(A),
    handle_event(A), !,
    evloop.
evloop.

evloop(A) :-
    call(A),
    sdl_PollEvent(B),
    handle_event(B), !,
    evloop(A).
evloop(_).


There IS evloop/0 but there is NO handle_event/0 ... why does it think there is??? I haven't managed to get over this yet!
I have attached the fill source code of the test.

Thanks
Sean.



_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog