>> shell
CIAO 0.4 #12: Mon Mar 16 13:51:20 MET 1998
?- use_module(library('compiler/pl2wam')).
Notice: module already in executable

yes
?- set_compiler_mode(wam).

yes
?- set_compiler_out(user).
A2 version B1 2 1 C3 66 I-1 J1 J3 L-1 
yes
?- use_module(engine(internals)).
Notice: module already in executable

yes
?- call_in_module(pl2wam, compile_all(p(X,Y), (arg(1,X,Y), !, display(hola)), unprofiled)).
clause(/(/(p,2),1), 
   [put_constant(1,2)
   ,function_2(41,2,2,0,0,3)
   ,get_x_value(1,2)
   ,cutb
   ,neck(2)
   ,put_constant(hola,0)
   ,execute(/(display,1))]).


yes
?- call_in_module(pl2wam, compile_all(p(X,Y), (arg(1,X,Y), true, !, display(hola)), unprofiled)).
clause(/(/(p,2),2), 
   [put_constant(1,2)
   ,function_2(41,2,2,0,0,3)
   ,get_x_value(1,2)
   ,neck(2)
   ,allocate
   ,choice_y(0)
   ,init([])
   ,call(/(true,0),1)
   ,cut_y(0)
   ,put_constant(hola,0)
   ,deallocate
   ,execute(/(display,1))]).


yes
?- call_in_module(pl2wam, compile_all(q(f(Y),Y), (true, !, display(hola)), unprofiled)).
clause(/(/(q,2),2), 
   [get_structure_x0(/(f,1))
   ,unify_x_local_value(1)
   ,neck(2)
   ,allocate
   ,choice_y(0)
   ,init([])
   ,call(/(true,0),1)
   ,cut_y(0)
   ,put_constant(hola,0)
   ,deallocate
   ,execute(/(display,1))]).


yes
?- call_in_module(pl2wam, compile_all(q(f(Y),Y), (!, display(hola)), unprofiled)).
clause(/(/(q,2),3), 
   [get_structure_x0(/(f,1))
   ,unify_x_local_value(1)
   ,cutb
   ,neck(2)
   ,put_constant(hola,0)
   ,execute(/(display,1))]).


yes
?- call_in_module(pl2wam, compile_all(q(f(Y),Y), (display(a), !, display(hola)), unprofiled)).
clause(/(/(q,2),4), 
   [get_structure_x0(/(f,1))
   ,unify_x_local_value(1)
   ,neck(2)
   ,allocate
   ,choice_y(0)
   ,put_constant(a,0)
   ,init([])
   ,call(/(display,1),1)
   ,cut_y(0)
   ,put_constant(hola,0)
   ,deallocate
   ,execute(/(display,1))]).


yes
?- call_in_module(pl2wam, compile_all(q(f(Y),Y), (a, !, display(hola)), unprofiled)).
clause(/(/(q,2),5), 
   [get_structure_x0(/(f,1))
   ,unify_x_local_value(1)
   ,neck(2)
   ,allocate
   ,choice_y(0)
   ,init([])
   ,call(/(a,0),1)
   ,cut_y(0)
   ,put_constant(hola,0)
   ,deallocate
   ,execute(/(display,1))]).


yes
?- call_in_module(pl2wam, emit_all_predicates).
predicate(/(q,2), 
   [choice
   ,switch_on_term([/(/(q,2),1),/(/(q,2),2),/(/(q,2),3),/(/(q,2),4),/(/(q,2),5)],[/(/(q,2),1)],[-(/(f,1),/(/(q,2),1)),-(/(f,1),/(/(q,2),2)),-(/(f,1),/(/(q,2),3)),-(/(f,1),/(/(q,2),4)),-(/(f,1),/(/(q,2),5))],[/(/(q,2),1)])]).

predicate(/(p,2), 
   [choice
   ,switch_on_term([/(/(p,2),1),/(/(p,2),2)],[/(/(p,2),1),/(/(p,2),2)],[],[/(/(p,2),1),/(/(p,2),2)])]).


yes
?- 
