=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/builtin/gr.c,v retrieving revision 1.42 retrieving revision 1.46 diff -u -p -r1.42 -r1.46 --- OpenXM_contrib2/asir2000/builtin/gr.c 2002/07/17 09:45:49 1.42 +++ OpenXM_contrib2/asir2000/builtin/gr.c 2003/04/21 02:49:40 1.46 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/builtin/gr.c,v 1.41 2002/01/28 00:54:41 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/builtin/gr.c,v 1.45 2003/03/14 06:28:48 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -89,6 +89,7 @@ static VL VC; int PCoeffs; int DP_Print = 0; +int DP_PrintShort = 0; int DP_Multiple = 0; int DP_NFStat = 0; LIST Dist = 0; @@ -101,7 +102,6 @@ static int NoCriB = 0; static int NoGC = 0; static int NoMC = 0; static int NoRA = 0; -static int DP_PrintShort = 0; static int ShowMag = 0; static int Stat = 0; static int Denominator = 1; @@ -1161,9 +1161,7 @@ void prim_part(DP f,int m,DP *r) else *r = f; } else { - if ( dp_fcoeffs ) - *r = f; - else if ( PCoeffs ) + if ( dp_fcoeffs || PCoeffs ) dp_prim(f,r); else dp_ptozp(f,r); @@ -2067,6 +2065,7 @@ void dp_set_flag(Obj name,Obj value) { char *n; int v; + Q ratio; if ( OID(name) != O_STR ) return; @@ -2077,6 +2076,16 @@ void dp_set_flag(Obj name,Obj value) if ( !strcmp(n,"Dist") ) { Dist = (LIST)value; return; } + if ( !strcmp(n,"Content") ) { + ratio = (Q)value; + if ( ratio ) { + DP_Multiple = BD(NM(ratio))[0]; + Denominator = INT(ratio) ? 1 : BD(DN(ratio))[0]; + } else { + DP_Multiple = 0; + Denominator = 1; + } + } if ( value && OID(value) != O_N ) return; v = QTOS((Q)value); @@ -2120,12 +2129,20 @@ void dp_set_flag(Obj name,Obj value) void dp_make_flaglist(LIST *list) { - Q v; + Q v,nm,dn; STRING name,path; NODE n,n1; +#if 0 STOQ(DP_Multiple,v); MKNODE(n,v,0); MKSTR(name,"DP_Multiple"); MKNODE(n1,name,n); n = n1; STOQ(Denominator,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Denominator"); MKNODE(n1,name,n); n = n1; +#else + if ( DP_Multiple ) { + STOQ(DP_Multiple,nm); STOQ(Denominator,dn); divq(nm,dn,&v); + } else + v = 0; + MKNODE(n,v,0); MKSTR(name,"Content"); MKNODE(n1,name,n); n = n1; +#endif MKNODE(n1,Dist,n); n = n1; MKSTR(name,"Dist"); MKNODE(n1,name,n); n = n1; STOQ(Reverse,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Reverse"); MKNODE(n1,name,n); n = n1; STOQ(Stat,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Stat"); MKNODE(n1,name,n); n = n1; @@ -2178,7 +2195,11 @@ void dp_load(int index,DP *p) sprintf(path,"%s%c%d",Demand,DELIM,index); if ( !(fp = fopen(path,"rb") ) ) error("dp_load : cannot open a file"); - skipvl(fp); loadobj(fp,(Obj *)p); fclose(fp); + if ( PCoeffs ) + loadvl(fp); + else + skipvl(fp); + loadobj(fp,(Obj *)p); fclose(fp); } } @@ -2191,7 +2212,11 @@ int dp_load_t(int index,DP *p) if ( !(fp = fopen(path,"rb") ) ) return 0; else { - skipvl(fp); loadobj(fp,(Obj *)p); fclose(fp); return 1; + if ( PCoeffs ) + loadvl(fp); + else + skipvl(fp); + loadobj(fp,(Obj *)p); fclose(fp); return 1; } }