=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/Kclass/indeterminate.c,v retrieving revision 1.1.1.1 retrieving revision 1.7 diff -u -p -r1.1.1.1 -r1.7 --- OpenXM/src/kan96xx/Kan/Kclass/indeterminate.c 1999/10/08 02:12:02 1.1.1.1 +++ OpenXM/src/kan96xx/Kan/Kclass/indeterminate.c 2003/11/21 02:10:37 1.7 @@ -1,5 +1,6 @@ +/* $OpenXM: OpenXM/src/kan96xx/Kan/Kclass/indeterminate.c,v 1.6 2001/09/01 01:37:48 takayama Exp $ */ /* Kclass/indeterminate.c */ -/* This file handles indeterminate, tree, recursivePolynomial, +/* This file handles indeterminate, recursivePolynomial, polynomialInOneVariable */ #include @@ -42,110 +43,9 @@ void fprintIndeterminate(FILE *fp,struct object op) printObject(KopIndeterminate(op),0,fp); } - +/* Functions for trees are moved to tree.c */ /* ---------------------------------------------------- */ -/* Data conversion function : see KclassDataConversion*/ -struct object KpoTree(struct object ob) { - struct object rob; - struct object ob1,ob2,ob3; - struct object *newobp; - rob.tag = Sclass; - rob.lc.ival = CLASSNAME_tree; - newobp = (struct object *) sGC_malloc(sizeof(struct object)); - if (newobp == NULL) errorKan1("%s\n","Kclass/indeterminate.c, no more memory."); - if (ob.tag != Sarray) { - errorKan1("%s\n","Kclass/indeterminate.c, only properly formatted list object can be transformed into tree. [name, cdname, arglist]."); - } - if (getoaSize(ob) < 3) { - errorKan1("%s\n","Kclass/indeterminate.c, the length must 3 or more than 3. [name, cdname, arglist]."); - } - ob1 = getoa(ob,0); ob2 = getoa(ob,1); ob3 = getoa(ob,2); - if (ob1.tag != Sdollar || ob2.tag != Sdollar || ob3.tag != Sarray) { - errorKan1("%s\n","Kclass/indeterminate.c, [string name, string cdname, list arglist]."); - } - *newobp = ob; - rob.rc.voidp = newobp; - return(rob); -} - -/* Printing function : see fprintClass */ -void fprintTree(FILE *fp,struct object op) -{ - printObject(KopTree(op),0,fp); -} - -int isTreeAdd(struct object ob) { - struct object name; - if (ob.tag != Sclass) { - return(0); - } - if (ectag(ob) != CLASSNAME_tree) { - return(0); - } - ob = KopTree(ob); - if (ob.tag != Sarray) { - errorKan1("%s\n","CLASSNAME_tree is broken. Should be array."); - } - name = getoa(ob,0); - if (name.tag != Sdollar) { - errorKan1("%s\n","CLASSNAME_tree is broken. Should be string."); - } - if (strcmp(KopString(name),"add") == 0) { - return(1); - }else{ - return(0); - } -} - -struct object addTree(struct object ob1, struct object ob2) -{ - struct object rob,aob; - struct object ob3,ob4; - int i; - if (isTreeAdd(ob1) && !isTreeAdd(ob2)) { - ob1 = KopTree(ob1); - ob3 = getoa(ob1,2); - aob = newObjectArray(getoaSize(ob3)+1); - for (i=0; i 1) { - fprintf(fp,"^%d ",k); + fprintf(fp,"^%d ",k); }else if (k == 1) { }else{ - fprintf(fp,"^(%d) ",k); + fprintf(fp,"^(%d) ",k); } fprintf(fp," * "); } @@ -203,7 +109,7 @@ static void printBodyOfRecursivePolynomial(struct obj void fprintRecursivePolynomial(FILE *fp,struct object op) { /* old code - printObject(KopRecursivePolynomial(op),0,fp); return; + printObject(KopRecursivePolynomial(op),0,fp); return; */ struct object ob; struct object vlist; @@ -297,11 +203,11 @@ struct object polyToRecursivePoly(struct object p) { putoa(rob,0,vlist2); putoa(rob,1,ob1); /* format of rob [ list of variables, poly or universalNumber or yyy to express - a recursive polynomial. ] - format of yyy = CLASSNAME_polynomialInOneVariable + a recursive polynomial. ] + format of yyy = CLASSNAME_polynomialInOneVariable [Sinteger, Sinteger, coeff obj, Sinteger, coeff obj, .....] - name of var, exp, coeff, exp, coeff - This format is checked by isRecursivePolynomial2(). + name of var, exp, coeff, exp, coeff + This format is checked by isRecursivePolynomial2(). */ rob = KpoRecursivePolynomial(rob); if (isRecursivePolynomial2(rob)) { @@ -398,9 +304,9 @@ static int isRecursivePolynomial2a(struct object ob2, if (ectag(tmp) == CLASSNAME_polynomialInOneVariable) { if (isRecursivePolynomial2a(tmp,n)) { }else{ - fprintf(stderr,"isRecursivePolynomial2a: entry is not a polynomial in one variable.\n"); - printObject(tmp,0,stderr); fprintf(stderr,"\n"); - return(0); + fprintf(stderr,"isRecursivePolynomial2a: entry is not a polynomial in one variable.\n"); + printObject(tmp,0,stderr); fprintf(stderr,"\n"); + return(0); } } } @@ -434,8 +340,10 @@ int isRecursivePolynomial2(struct object ob) { n = getoaSize(ob1); for (i=0; i