=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/kanExport0.c,v retrieving revision 1.29 retrieving revision 1.42 diff -u -p -r1.29 -r1.42 --- OpenXM/src/kan96xx/Kan/kanExport0.c 2004/08/31 05:30:20 1.29 +++ OpenXM/src/kan96xx/Kan/kanExport0.c 2005/06/09 05:46:57 1.42 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport0.c,v 1.28 2004/08/31 04:45:42 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/kanExport0.c,v 1.41 2004/11/15 08:27:27 takayama Exp $ */ #include #include "datatype.h" #include "stackm.h" @@ -687,8 +687,16 @@ KooEqualQ(obj1,obj2) { struct object ob; int i; + extern int Verbose; if (obj1.tag != obj2.tag) { warningKan("KooEqualQ(ob1,ob2): the datatypes of ob1 and ob2 are not same. Returns false (0).\n"); + if (Verbose & 0x10) { + fprintf(stderr,"obj1(tag:%d)=",obj1.tag); + printObject(obj1,0,stderr); + fprintf(stderr,", obj2(tag:%d)=",obj2.tag); + printObject(obj2,0,stderr); + fprintf(stderr,"\n"); fflush(stderr); + } return(0); } switch(obj1.tag) { @@ -919,6 +927,10 @@ struct object KdataConversion(obj,key) return(rob); }else if (strcmp(key,"poly") == 0) { rob = KpoPOLY(ZERO); + return rob; + }else if (strcmp(key,"array") == 0) { + rob = newObjectArray(0); + return rob; }else{ warningKan("Sorry. The data conversion from null to this data type has not supported yet.\n"); } @@ -1015,7 +1027,7 @@ struct object KdataConversion(obj,key) if (strcmp(key,"array") == 0) { return(rob); }else if (strcmp(key,"list") == 0) { - rob = *( arrayToList(obj) ); + rob = KarrayToList(obj); return(rob); }else if (strcmp(key,"arrayOfPOLY")==0) { rob = KpoArrayOfPOLY(arrayToArrayOfPOLY(obj)); @@ -1029,6 +1041,9 @@ struct object KdataConversion(obj,key) }else if (strcmp(key,"null") == 0) { rob = NullObject; return(rob); + }else if (strcmp(key,"byteArray") == 0) { + rob = newByteArray(getoaSize(obj),obj); + return(rob); }else { { /* Automatically maps the elements. */ int n,i; @@ -1108,7 +1123,7 @@ struct object KdataConversion(obj,key) break; case Slist: if (strcmp(key,"array") == 0) { - rob = listToArray(&obj); + rob = KlistToArray(obj); return(rob); } break; @@ -1206,6 +1221,14 @@ struct object KdataConversion(obj,key) warningKan("Sorryl This type of data conversion of ringp has not supported yet.\n"); } break; + case SbyteArray: + if (strcmp(key,"array") == 0) { + rob = byteArrayToArray(obj); + return(rob); + } else { + warningKan("Sorryl This type of data conversion of ringp has not supported yet.\n"); + } + break; default: warningKan("Sorry. This type of data conversion has not supported yet.\n"); } @@ -1499,7 +1522,7 @@ int KsetUpRing(ob1,ob2,ob3,ob4,ob5) ob4 = Order matrix ob5 = [(keyword) value (keyword) value ....] */ -#define RP_LIMIT 500 +#define RP_LIMIT 5000 { int i; struct object ob; @@ -1642,6 +1665,8 @@ int KsetUpRing(ob1,ob2,ob3,ob4,ob5) newRingp->degreeShiftSize = 0; newRingp->degreeShiftN = 0; newRingp->degreeShift = NULL; + newRingp->partialEcart = 0; + newRingp->partialEcartGlobalVarX = NULL; if (ob5.tag != Sarray || (getoaSize(ob5) % 2) != 0) { errorKan1("%s\n","[(keyword) value (keyword) value ....] should be given."); @@ -1722,6 +1747,36 @@ int KsetUpRing(ob1,ob2,ob3,ob4,ob5) } } } + } else if (strcmp(KopString(getoa(ob5,i)),"partialEcartGlobalVarX") == 0) { + if (getoa(ob5,i+1).tag != Sarray) { + errorKan1("%s\n","An array of array should be given. (partialEcart)"); + } + { + struct object odv; + struct object ovv; + int k,j,nn; + char *vname; + odv=getoa(ob5,i+1); + nn = getoaSize(odv); + newRingp->partialEcart = nn; + newRingp->partialEcartGlobalVarX = (int *) sGC_malloc(sizeof(int)*nn+1); + if (newRingp->partialEcartGlobalVarX == NULL) errorKan1("%s\n","No more memory."); + for (j=0; jpartialEcartGlobalVarX)[j] = -1; + for (j=0; jpartialEcartGlobalVarX)[j] = k; break; + }else{ + if (k == n-1) errorKan1("%s\n","partialEcartGlobalVarX: no such variable."); + } + } + } + } + switch_function("grade","module1v"); /* Warning: grading is changed to module1v!! */ } else { @@ -2946,11 +3001,243 @@ struct object KdefaultPolyRing(struct object ob) { } +struct object Krest(struct object ob) { + struct object rob; + struct object *op; + int n,i; + if (ob.tag == Sarray) { + n = getoaSize(ob); + if (n == 0) return ob; + rob = newObjectArray(n-1); + for (i=1; i 0) { + ba = (unsigned char *) sGC_malloc(size); + if (ba == NULL) errorKan1("%s\n","No more memory."); + } + rob.tag = SbyteArray; rob.lc.bytes = ba; rob.rc.ival = size; + if (obj.tag == SbyteArray) { + n = getByteArraySize(obj); + ba2 = KopByteArray(obj); + for (i=0; i<(n 0) { + ba = (unsigned char *) sGC_malloc(size); + if (ba == NULL) errorKan1("%s\n","No more memory."); + } + rob.tag = SbyteArray; rob.lc.bytes = ba; rob.rc.ival = size; + for (i=0; i