[BACK]Return to reduct.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / builtin

Annotation of OpenXM_contrib2/asir2000/builtin/reduct.c, Revision 1.1.1.1

1.1       noro        1: /* $OpenXM: OpenXM/src/asir99/builtin/reduct.c,v 1.1.1.1 1999/11/10 08:12:26 noro Exp $ */
                      2: #include "ca.h"
                      3: #include "parse.h"
                      4:
                      5: void Pred(), Predc(), Pprim();
                      6:
                      7: struct ftab reduct_tab[] = {
                      8:        {"red",Pred,1},
                      9:        {"redc",Predc,2},
                     10:        {"prim",Pprim,-2},
                     11:        {0,0,0},
                     12: };
                     13:
                     14: void Pred(arg,rp)
                     15: NODE arg;
                     16: Obj *rp;
                     17: {
                     18:        asir_assert(ARG0(arg),O_R,"red");
                     19:        reductr(CO,(Obj)ARG0(arg),rp);
                     20: }
                     21:
                     22: void Predc(arg,rp)
                     23: NODE arg;
                     24: P *rp;
                     25: {
                     26:        asir_assert(ARG0(arg),O_P,"redc");
                     27:        asir_assert(ARG1(arg),O_P,"redc");
                     28:        remsdcp(CO,(P)ARG0(arg),(P)ARG1(arg),rp);
                     29: }
                     30:
                     31: void Pprim(arg,rp)
                     32: NODE arg;
                     33: P *rp;
                     34: {
                     35:        P t,p,p1,r;
                     36:        V v;
                     37:        VL vl;
                     38:
                     39:        asir_assert(ARG0(arg),O_P,"prim");
                     40:        p = (P)ARG0(arg);
                     41:        if ( NUM(p) )
                     42:                *rp = (P)ONE;
                     43:        else {
                     44:                if ( argc(arg) == 2 ) {
                     45:                        v = VR((P)ARG1(arg));
                     46:                        change_mvar(CO,p,v,&p1);
                     47:                        if ( VR(p1) != v ) {
                     48:                                *rp = (P)ONE; return;
                     49:                        } else {
                     50:                                reordvar(CO,v,&vl); pcp(vl,p1,&r,&t);
                     51:                                restore_mvar(CO,r,v,rp);
                     52:                        }
                     53:                } else
                     54:                        pcp(CO,p,rp,&t);
                     55:        }
                     56: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>