;;; Prolog TURTLE package

:- prolog_language("pop11").

uses vturtle;                       ;;; load the POP-11 library file

define setpaint(x);
    x -> paint
enddefine;

define ved_pic;
    vars vedstartwindow;
    24 -> vedstartwindow;
    'picture' -> vedargument;
    ved_ved();
    vedputmessage('ESC x -- to get back to previous file');
enddefine;

:- prolog_language("prolog").

;;; Interface to turtle procedures from Prolog

turtle :-
   prolog_eval(apply(valof(turtle))).

draw(I) :-
   prolog_eval(draw(I)).

jump(I) :-
   prolog_eval(jump(I)).

turn(I) :-
   prolog_eval(turn(I)).

drawto(X,Y) :-
   prolog_eval(drawto(X,Y)).

jumpto(X,Y) :-
   prolog_eval(jumpto(X,Y)).

turnto(X,Y) :-
   prolog_eval(turnto(X,Y)).

xposition(X) :-
   X is valof(xposition).

yposition(Y) :-
   Y is valof(yposition).

heading(X) :-
   X is valof(heading).

display:-prolog_eval(apply(valof(display))).

paint(X) :-
    prolog_eval(setpaint(X)).

:- turtle.
