:- compiler_options([spec_off]).

%?- xsb_flag(verboseness,3).
%:- import private_builtin/1 from machine.

:- table wrapper/2, wrapper/3.

db(wrapper(app,_)).
db(wrapper(pps,_)).
db(wrapper(p,_,_)).

%% wrapper/2
wrapper(pps,_) :-
%	writeln(calling(wrapper(pps,_))),
        wrapper(app,foobar),
        fail.
wrapper(app,_) :- wrapper(p,_,foobar).
wrapper(X,Y) :-
	writeln(clause3(wrapper(X,Y))),
        db(wrapper(X,Y)),

        nl,
        writeln('About to cut'),
        !,
        fail.
%% Shouldn't go here after the cut!!!
wrapper(X,Y) :-
	writeln(clause4(wrapper(X,Y))),
        writeln('******fell through the cut!!! ' - X).

%% wrapper/3
wrapper(p,0,_).
wrapper(p,_,_) :-
        wrapper(p,_,foobar),
        wrapper(pps,foobar).

test:- wrapper(pps,foobar).
