Re: portray_goal/2

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Mon 23 Jun 2003 04:02:04 PM GMT
Message-ID: <3EF7247C.6AA7E10B@icparc.ic.ac.uk>
Ooops, the second clause shouldn't be there, i.e.


:- tool(portray_term/2, portray_term/3).

portray_term(Term, Portrayed, ContextModule) :-
        (
            % find applicable transfrmation
            functor(Term, N, A),
            once (
                current_macro(N/A, TN/TA, Options, DefMod)@ContextModule,
                memberchk(write, Options),
                nonmember(goal, Options),
                nonmember(clause, Options)
            ),
            functor(TransGoal, TN, TA),
            arg(1, TransGoal, Term),
            arg(2, TransGoal, TopPortrayed),
            ( TA > 2 ->
                arg(3, TransGoal, ContextModule)
            ;
                true
            ),
            % call toplevel transformation
            DefMod:TransGoal@ContextModule
        ->
            true
        ;
            TopPortrayed = Term
        ),
        % then transform arguments
        functor(TopPortrayed, PN, PA),
        functor(Portrayed, PN, PA),
        (
            for(I,1,PA),
            param(TopPortrayed,Portrayed,ContextModule)
        do
            arg(I, TopPortrayed, Arg),
            arg(I, Portrayed, PortrayedArg),
            portray_term(Arg, PortrayedArg, ContextModule)
        ).



-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
 Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
Received on Mon Jun 23 17:02:04 2003

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:23 PM GMT GMT