Advertisement
logicmoo

Untitled

Mar 25th, 2015
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. :-module_transparent(nth_pi/2).
  2. :-module_transparent(nth_goal/2).
  3. :-module_transparent(nth_frame/3).
  4. :-module_transparent(nth_frame_attribute/5).
  5. nth_pi(Nth, Value):- prolog_current_frame(Frame), nth_frame_attribute(Nth,-1, Frame, predicate_indicator, Value).
  6. nth_goal(Nth, Value):- prolog_current_frame(Frame), nth_frame_attribute(Nth,-1, Frame, goal, Value).
  7. nth_frame(Nth, Key, Value):- prolog_current_frame(Frame), nth_frame_attribute(Nth,-1, Frame, Key, Value).
  8. nth_frame_attribute(Nth,NthIn, Frame, Key, Value):-
  9. (NthIn>=0,Nth=NthIn,prolog_frame_attribute(Frame, Key, Value));
  10. ((prolog_frame_attribute(Frame, parent, ParentFrame),
  11. NthNext is NthIn + 1, nth_frame_attribute(Nth,NthNext, ParentFrame, Key, Value))).
  12.  
  13. in_file_expansion :- nth_pi(LF,_:'$load_file'/_),nth_pi(TL,'$toplevel':_/0),!,LF<TL,
  14. (nth_pi(ED,_:'$execute_directive_3'/_)-> (LF<ED) ; true).
  15.  
  16. in_file_directive :- nth_pi(LF,_:'$load_file'/_),nth_pi(TL,'$toplevel':_/0),!,LF<TL,
  17. (nth_pi(ED,_:'$execute_directive_3'/_)-> (LF>ED) ; false).
  18.  
  19. in_toplevel :- nth_pi(LF,_:'$load_file'/_),nth_pi(TL,'$toplevel':_/0),!,LF>TL,
  20. (nth_pi(ED,_:'$execute_directive_3'/_)-> (ED>TL) ; true).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement