version 1.5, 2000/05/29 08:54:45 |
version 1.7, 2000/07/14 08:26:39 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/builtin/gr.c,v 1.4 2000/04/25 04:07:58 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/builtin/gr.c,v 1.6 2000/07/13 05:09:00 noro Exp $ */ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
#include "base.h" |
#include "base.h" |
Line 42 void print_stat(void); |
|
Line 42 void print_stat(void); |
|
void init_stat(void); |
void init_stat(void); |
int dp_load_t(int,DP *); |
int dp_load_t(int,DP *); |
void dp_load(int,DP *); |
void dp_load(int,DP *); |
void dp_save(int,DP); |
void dp_save(int,Obj,char *); |
void dp_make_flaglist(LIST *); |
void dp_make_flaglist(LIST *); |
void dp_set_flag(Obj,Obj); |
void dp_set_flag(Obj,Obj); |
int membercheck(NODE,NODE); |
int membercheck(NODE,NODE); |
Line 127 static char *Demand = 0; |
|
Line 127 static char *Demand = 0; |
|
static int PtozpRA = 0; |
static int PtozpRA = 0; |
LIST Dist = 0; |
LIST Dist = 0; |
int NoGCD = 0; |
int NoGCD = 0; |
|
int GenTrace = 0; |
|
int OXCheck = -1; |
int doing_f4; |
int doing_f4; |
|
NODE TraceList; |
|
|
void Pdp_gr_flags(arg,rp) |
void Pdp_gr_flags(arg,rp) |
NODE arg; |
NODE arg; |
|
|
dltod(BDY(s),nv,&tdp); |
dltod(BDY(s),nv,&tdp); |
dp_subd(tdp,ps[(int)BDY(r)],&sd); |
dp_subd(tdp,ps[(int)BDY(r)],&sd); |
_dp_mod(sd,m,0,&sdm); |
_dp_mod(sd,m,0,&sdm); |
_mulmd(CO,m,ps[(int)BDY(r)],sdm,&f2); |
_mulmd(CO,m,sdm,ps[(int)BDY(r)],&f2); |
MKNODE(bt,f2,blist); blist = bt; |
MKNODE(bt,f2,blist); blist = bt; |
s = symb_merge(s,dp_dllist(f2),nv); |
s = symb_merge(s,dp_dllist(f2),nv); |
nred++; |
nred++; |
|
|
int m; |
int m; |
{ |
{ |
int i; |
int i; |
NODE s,s0; |
NODE s,s0,f0; |
|
|
f = NODE_sortb(f,1); |
f0 = f = NODE_sortb(f,1); |
psn = length(f); pslen = 2*psn; |
psn = length(f); pslen = 2*psn; |
ps = (DP *)MALLOC(pslen*sizeof(DP)); |
ps = (DP *)MALLOC(pslen*sizeof(DP)); |
psh = (DL *)MALLOC(pslen*sizeof(DL)); |
psh = (DL *)MALLOC(pslen*sizeof(DL)); |
|
|
for ( i = 0; i < psn; i++, f = NEXT(f) ) { |
for ( i = 0; i < psn; i++, f = NEXT(f) ) { |
prim_part((DP)BDY(f),m,&ps[i]); |
prim_part((DP)BDY(f),m,&ps[i]); |
if ( Demand ) |
if ( Demand ) |
dp_save(i,ps[i]); |
dp_save(i,(Obj)ps[i],0); |
psh[i] = BDY(ps[i])->dl; |
psh[i] = BDY(ps[i])->dl; |
pss[i] = ps[i]->sugar; |
pss[i] = ps[i]->sugar; |
psc[i] = BDY(ps[i])->c; |
psc[i] = BDY(ps[i])->c; |
} |
} |
|
if ( GenTrace && (OXCheck >= 0) ) { |
|
Q q; |
|
STRING fname; |
|
LIST input; |
|
NODE arg; |
|
Obj dmy; |
|
|
|
STOQ(OXCheck,q); |
|
MKSTR(fname,"register_input"); |
|
MKLIST(input,f0); |
|
arg = mknode(3,q,fname,input); |
|
Pox_cmo_rpc(arg,&dmy); |
|
} |
for ( s0 = 0, i = 0; i < psn; i++ ) { |
for ( s0 = 0, i = 0; i < psn; i++ ) { |
NEXTNODE(s0,s); BDY(s) = (pointer)i; |
NEXTNODE(s0,s); BDY(s) = (pointer)i; |
} |
} |
Line 983 void prim_part(f,m,r) |
|
Line 999 void prim_part(f,m,r) |
|
DP f,*r; |
DP f,*r; |
int m; |
int m; |
{ |
{ |
|
P d,t; |
|
|
if ( m > 0 ) { |
if ( m > 0 ) { |
if ( PCoeffs ) |
if ( PCoeffs ) |
dp_prim_mod(f,m,r); |
dp_prim_mod(f,m,r); |
|
|
dp_prim(f,r); |
dp_prim(f,r); |
else |
else |
dp_ptozp(f,r); |
dp_ptozp(f,r); |
|
if ( GenTrace && TraceList ) { |
|
divsp(CO,BDY(f)->c,BDY(*r)->c,&d); |
|
mulp(CO,(P)ARG3(BDY((LIST)BDY(TraceList))),d,&t); |
|
ARG3(BDY((LIST)BDY(TraceList))) = t; |
|
} |
} |
} |
} |
} |
|
|
|
|
} |
} |
get_eg(&tmp0); |
get_eg(&tmp0); |
dp_load(w[i],&ps[w[i]]); |
dp_load(w[i],&ps[w[i]]); |
_dp_nf(top,ps[w[i]],ps,1,&g); |
|
|
|
|
if ( GenTrace ) { |
|
Q q; |
|
NODE node; |
|
LIST hist; |
|
|
|
STOQ(w[i],q); |
|
node = mknode(4,ONE,q,ONE,ONE); |
|
MKLIST(hist,node); |
|
MKNODE(TraceList,hist,0); |
|
} |
if ( !PtozpRA || !Multiple ) |
if ( !PtozpRA || !Multiple ) |
_dp_nf(top,ps[w[i]],ps,1,&g); |
_dp_nf(top,ps[w[i]],ps,1,&g); |
else |
else |
|
|
ps[psn] = a; |
ps[psn] = a; |
else |
else |
ps[psn] = 0; |
ps[psn] = 0; |
dp_save(psn,a); |
dp_save(psn,(Obj)a,0); |
} else |
} else |
ps[psn] = a; |
ps[psn] = a; |
psh[psn] = BDY(a)->dl; |
psh[psn] = BDY(a)->dl; |
|
|
psc[psn] = BDY(a)->c; |
psc[psn] = BDY(a)->c; |
if ( m ) |
if ( m ) |
_dp_mod(a,m,subst,&psm[psn]); |
_dp_mod(a,m,subst,&psm[psn]); |
|
if ( GenTrace ) { |
|
NODE tn,tr,tr1; |
|
LIST trace; |
|
|
|
/* reverse the TraceList */ |
|
tn = TraceList; |
|
for ( tr = 0; tn; tn = NEXT(tn) ) { |
|
MKNODE(tr1,BDY(tn),tr); tr = tr1; |
|
} |
|
MKLIST(trace,tr); |
|
if ( OXCheck >= 0 ) { |
|
NODE arg; |
|
Q q1,q2; |
|
STRING fname; |
|
Obj dmy; |
|
|
|
STOQ(OXCheck,q1); |
|
MKSTR(fname,"check_trace"); |
|
STOQ(psn,q2); |
|
arg = mknode(5,q1,fname,a,q2,trace); |
|
Pox_cmo_rpc(arg,&dmy); |
|
} else |
|
dp_save(psn,(Obj)trace,"t"); |
|
TraceList = 0; |
|
} |
return psn++; |
return psn++; |
} |
} |
|
|
|
|
} |
} |
for ( top = 0, i = n-1; i >= 0; i-- ) |
for ( top = 0, i = n-1; i >= 0; i-- ) |
if ( r[i] >= 0 ) { |
if ( r[i] >= 0 ) { |
dp_load(r[i],&ps[r[i]]); dp_dehomo(ps[r[i]],&u); j = newps(u,0,0); |
dp_load(r[i],&ps[r[i]]); dp_dehomo(ps[r[i]],&u); |
|
if ( GenTrace ) { |
|
Q q; |
|
LIST hist; |
|
NODE node; |
|
|
|
STOQ(r[i],q); |
|
node = mknode(4,0,q,0,0); |
|
MKLIST(hist,node); |
|
MKNODE(TraceList,hist,0); |
|
} |
|
j = newps(u,0,0); |
MKNODE(t,j,top); top = t; |
MKNODE(t,j,top); top = t; |
} |
} |
*g = top; |
*g = top; |
|
|
struct oEGT tnf0,tnf1,tnfm0,tnfm1,tpz0,tpz1,tsp0,tsp1,tspm0,tspm1,tnp0,tnp1,tmp0,tmp1; |
struct oEGT tnf0,tnf1,tnfm0,tnfm1,tpz0,tpz1,tsp0,tsp1,tspm0,tspm1,tnp0,tnp1,tmp0,tmp1; |
int skip_nf_flag; |
int skip_nf_flag; |
double t_0; |
double t_0; |
|
Q q; |
|
int new_sugar; |
static prev_sugar = -1; |
static prev_sugar = -1; |
|
|
Max_mag = 0; |
Max_mag = 0; |
|
|
get_eg(&tmp1); add_eg(&eg_mp,&tmp0,&tmp1); |
get_eg(&tmp1); add_eg(&eg_mp,&tmp0,&tmp1); |
if ( m ) { |
if ( m ) { |
get_eg(&tspm0); |
get_eg(&tspm0); |
_dp_sp_mod(psm[l->dp1],psm[l->dp2],m,&h); |
_dp_sp_mod_dup(psm[l->dp1],psm[l->dp2],m,&h); |
|
new_sugar = h->sugar; |
get_eg(&tspm1); add_eg(&eg_spm,&tspm0,&tspm1); |
get_eg(&tspm1); add_eg(&eg_spm,&tspm0,&tspm1); |
get_eg(&tnfm0); |
get_eg(&tnfm0); |
_dp_nf_mod(gall,h,psm,m,0,&nfm); |
_dp_nf_mod_destructive(gall,h,psm,m,0,&nfm); |
get_eg(&tnfm1); add_eg(&eg_nfm,&tnfm0,&tnfm1); |
get_eg(&tnfm1); add_eg(&eg_nfm,&tnfm0,&tnfm1); |
} else |
} else |
nfm = (DP)1; |
nfm = (DP)1; |
|
|
} |
} |
} else |
} else |
dp_sp(ps[l->dp1],ps[l->dp2],&h); |
dp_sp(ps[l->dp1],ps[l->dp2],&h); |
|
if ( GenTrace ) { |
|
STOQ(l->dp1,q); ARG1(BDY((LIST)BDY(NEXT(TraceList)))) = q; |
|
STOQ(l->dp2,q); ARG1(BDY((LIST)BDY(TraceList))) = q; |
|
} |
|
new_sugar = h->sugar; |
get_eg(&tsp1); add_eg(&eg_sp,&tsp0,&tsp1); |
get_eg(&tsp1); add_eg(&eg_sp,&tsp0,&tsp1); |
get_eg(&tnf0); |
get_eg(&tnf0); |
t_0 = get_rtime(); |
t_0 = get_rtime(); |
|
|
add_eg(&eg_znfm,&tnfm0,&tnfm1); |
add_eg(&eg_znfm,&tnfm0,&tnfm1); |
ZR++; |
ZR++; |
if ( Print || PrintShort ) { |
if ( Print || PrintShort ) { |
if ( h && (h->sugar != prev_sugar) ) { |
if ( new_sugar != prev_sugar ) { |
fprintf(asir_out,"[%d]",h->sugar); |
fprintf(asir_out,"[%d]",new_sugar); |
prev_sugar = h->sugar; |
prev_sugar = new_sugar; |
} |
} |
fprintf(asir_out,"."); fflush(asir_out); prev = 0; |
fprintf(asir_out,"."); fflush(asir_out); prev = 0; |
} |
} |
|
|
l->dp2 = QTOS((Q)BDY(pair)); |
l->dp2 = QTOS((Q)BDY(pair)); |
if ( m ) { |
if ( m ) { |
get_eg(&tspm0); |
get_eg(&tspm0); |
_dp_sp_mod(psm[l->dp1],psm[l->dp2],m,&h); |
_dp_sp_mod_dup(ps[l->dp1],ps[l->dp2],m,&h); |
get_eg(&tspm1); add_eg(&eg_spm,&tspm0,&tspm1); |
get_eg(&tspm1); add_eg(&eg_spm,&tspm0,&tspm1); |
get_eg(&tnfm0); |
get_eg(&tnfm0); |
_dp_nf_mod(gall,h,psm,m,0,&nfm); |
_dp_nf_mod_destructive(gall,h,ps,m,!Top,&nf); |
get_eg(&tnfm1); add_eg(&eg_nfm,&tnfm0,&tnfm1); |
get_eg(&tnfm1); add_eg(&eg_nfm,&tnfm0,&tnfm1); |
} else |
} else |
nfm = (DP)1; |
nfm = (DP)1; |
|
|
get_eg(&tspm1); add_eg(&eg_spm,&tspm0,&tspm1); get_eg(&tnfm0); |
get_eg(&tspm1); add_eg(&eg_spm,&tspm0,&tspm1); get_eg(&tnfm0); |
dp_nf_mod(gall,h,ps,m,!Top,&nf); |
dp_nf_mod(gall,h,ps,m,!Top,&nf); |
} else { |
} else { |
_dp_sp_mod(ps[l->dp1],ps[l->dp2],m,&h); |
_dp_sp_mod_dup(ps[l->dp1],ps[l->dp2],m,&h); |
get_eg(&tspm1); add_eg(&eg_spm,&tspm0,&tspm1); get_eg(&tnfm0); |
get_eg(&tspm1); add_eg(&eg_spm,&tspm0,&tspm1); get_eg(&tnfm0); |
_dp_nf_mod(gall,h,ps,m,!Top,&nf); |
_dp_nf_mod_destructive(gall,h,ps,m,!Top,&nf); |
} |
} |
get_eg(&tnfm1); add_eg(&eg_nfm,&tnfm0,&tnfm1); |
get_eg(&tnfm1); add_eg(&eg_nfm,&tnfm0,&tnfm1); |
if ( nf ) { |
if ( nf ) { |
|
|
print_split_eg(&tnfm0,&tnfm1); fflush(asir_out); |
print_split_eg(&tnfm0,&tnfm1); fflush(asir_out); |
fprintf(asir_out,"(%d,%d),nb=%d,nab=%d,rp=%d,sugar=%d",l->dp1,l->dp2,length(g),length(gall),DPPlength(d),pss[nh]); |
fprintf(asir_out,"(%d,%d),nb=%d,nab=%d,rp=%d,sugar=%d",l->dp1,l->dp2,length(g),length(gall),DPPlength(d),pss[nh]); |
printdl(psh[nh]); fprintf(asir_out,"\n"); fflush(asir_out); |
printdl(psh[nh]); fprintf(asir_out,"\n"); fflush(asir_out); |
|
} else if ( PrintShort ) { |
|
fprintf(asir_out,"+"); fflush(asir_out); |
} |
} |
prev = 1; |
prev = 1; |
} else { |
} else { |
add_eg(&eg_znfm,&tnfm0,&tnfm1); |
add_eg(&eg_znfm,&tnfm0,&tnfm1); |
ZR++; |
ZR++; |
if ( Print ) { |
if ( Print || PrintShort ) { |
fprintf(asir_out,"."); fflush(asir_out); prev = 0; |
fprintf(asir_out,"."); fflush(asir_out); prev = 0; |
} |
} |
} |
} |
} |
} |
if ( Print ) |
if ( Print || PrintShort ) |
fprintf(asir_out,"gb_mod done\n"); |
fprintf(asir_out,"gb_mod done\n"); |
return g; |
return g; |
} |
} |
|
|
int full; |
int full; |
DP *rp; |
DP *rp; |
{ |
{ |
DP u,p,d,s,t; |
DP u,p,d,s,t,mult; |
P dmy; |
P coef; |
NODE l; |
NODE l; |
MP m,mr; |
MP m,mr; |
int sugar,psugar; |
int sugar,psugar; |
|
|
for ( u = 0, l = b; l; l = NEXT(l) ) { |
for ( u = 0, l = b; l; l = NEXT(l) ) { |
if ( dl_redble(BDY(g)->dl,psh[(int)BDY(l)]) ) { |
if ( dl_redble(BDY(g)->dl,psh[(int)BDY(l)]) ) { |
dp_load((int)BDY(l),&p); |
dp_load((int)BDY(l),&p); |
dp_red(d,g,p,&t,&u,&dmy); |
/* t+u = coef*(d+g) - mult*p (t = coef*d) */ |
|
dp_red(d,g,p,&t,&u,&coef,&mult); |
psugar = (BDY(g)->dl->td - BDY(p)->dl->td) + p->sugar; |
psugar = (BDY(g)->dl->td - BDY(p)->dl->td) + p->sugar; |
sugar = MAX(sugar,psugar); |
sugar = MAX(sugar,psugar); |
|
if ( GenTrace ) { |
|
LIST hist; |
|
Q cq; |
|
NODE node,node0; |
|
|
|
STOQ((int)BDY(l),cq); |
|
node0 = mknode(4,coef,cq,mult,ONE); |
|
MKLIST(hist,node0); |
|
MKNODE(node,hist,TraceList); TraceList = node; |
|
} |
if ( !u ) { |
if ( !u ) { |
if ( d ) |
if ( d ) |
d->sugar = sugar; |
d->sugar = sugar; |
|
|
|
|
double pz_t_e, pz_t_d, pz_t_d1, pz_t_c, im_t_s, im_t_r; |
double pz_t_e, pz_t_d, pz_t_d1, pz_t_c, im_t_s, im_t_r; |
|
|
|
extern int GenTrace; |
|
extern NODE TraceList; |
|
|
void _dp_nf_ptozp(b,g,ps,full,multiple,r) |
void _dp_nf_ptozp(b,g,ps,full,multiple,r) |
NODE b; |
NODE b; |
DP g; |
DP g; |
|
|
extern int kara_mag; |
extern int kara_mag; |
double get_rtime(); |
double get_rtime(); |
double t_0,t_00,tt,ttt,t_p,t_m,t_m1,t_m2,t_s,t_g,t_a; |
double t_0,t_00,tt,ttt,t_p,t_m,t_m1,t_m2,t_s,t_g,t_a; |
|
LIST hist; |
|
NODE node; |
|
Q rcred,mrcred; |
|
|
if ( !g ) { |
if ( !g ) { |
*r = 0; return; |
*r = 0; return; |
|
|
dc = 0; dp = 0; rc = ONE; rp = g; |
dc = 0; dp = 0; rc = ONE; rp = g; |
MKSTR(imul,"dp_imul_index"); |
MKSTR(imul,"dp_imul_index"); |
|
|
|
/* g = dc*dp+rc*rp */ |
for ( ; rp; ) { |
for ( ; rp; ) { |
for ( u = 0, l = b; l; l = NEXT(l) ) { |
for ( u = 0, l = b; l; l = NEXT(l) ) { |
if ( dl_redble(BDY(rp)->dl,psh[(int)BDY(l)]) ) { |
if ( dl_redble(BDY(rp)->dl,psh[(int)BDY(l)]) ) { |
|
|
|
|
psugar = (BDY(rp)->dl->td - BDY(red)->dl->td) + red->sugar; |
psugar = (BDY(rp)->dl->td - BDY(red)->dl->td) + red->sugar; |
sugar = MAX(sugar,psugar); |
sugar = MAX(sugar,psugar); |
|
if ( GenTrace ) { |
|
/* u = cr*rp + (-cred)*shift*red */ |
|
STOQ((int)BDY(l),cq); |
|
node = mknode(4,cr,cq,0,0); |
|
mulq(cred,rc,&rcred); |
|
chsgnnum((Num)rcred,(Num *)&mrcred); |
|
muldc(CO,shift,(P)mrcred,(DP *)&ARG2(node)); |
|
MKLIST(hist,node); |
|
} |
if ( !u ) { |
if ( !u ) { |
if ( dp ) |
if ( dp ) |
dp->sugar = sugar; |
dp->sugar = sugar; |
*r = dp; |
*r = dp; |
|
if ( GenTrace ) { |
|
ARG3(BDY(hist)) = ONE; |
|
MKNODE(node,hist,TraceList); TraceList = node; |
|
} |
goto final; |
goto final; |
} |
} |
break; |
break; |
|
|
tt = get_rtime()-t_0; t_a += tt; |
tt = get_rtime()-t_0; t_a += tt; |
rp = t; |
rp = t; |
hmag = multiple*HMAG(rp)/denom; |
hmag = multiple*HMAG(rp)/denom; |
|
if ( GenTrace ) { |
|
NTOQ(gn,1,gcd); |
|
ARG3(BDY(hist)) = (pointer)gcd; |
|
MKNODE(node,hist,TraceList); TraceList = node; |
|
} |
} else { |
} else { |
t_0 = get_rtime(); |
t_0 = get_rtime(); |
mulq(cr,dc,&dcq); dc = dcq; |
mulq(cr,dc,&dcq); dc = dcq; |
tt = get_rtime()-t_0; t_a += tt; |
tt = get_rtime()-t_0; t_a += tt; |
rp = u; |
rp = u; |
|
if ( GenTrace ) { |
|
ARG3(BDY(hist)) = (pointer)ONE; |
|
MKNODE(node,hist,TraceList); TraceList = node; |
|
} |
} |
} |
} else if ( !full ) { |
} else if ( !full ) { |
if ( rp ) { |
if ( rp ) { |
|
|
tt = get_rtime()-t_0; t_a += tt; |
tt = get_rtime()-t_0; t_a += tt; |
} |
} |
} |
} |
|
if ( GenTrace ) { |
|
mulq(ARG3(BDY((LIST)BDY(TraceList))),dc,&cq); |
|
ARG3(BDY((LIST)BDY(TraceList))) = (pointer)cq; |
|
} |
if ( dp ) |
if ( dp ) |
dp->sugar = sugar; |
dp->sugar = sugar; |
*r = dp; |
*r = dp; |
Line 2544 Obj name,value; |
|
Line 2666 Obj name,value; |
|
Denominator = v; |
Denominator = v; |
else if ( !strcmp(n,"PtozpRA") ) |
else if ( !strcmp(n,"PtozpRA") ) |
PtozpRA = v; |
PtozpRA = v; |
|
else if ( !strcmp(n,"GenTrace") ) |
|
GenTrace = v; |
|
else if ( !strcmp(n,"OXCheck") ) |
|
OXCheck = v; |
} |
} |
|
|
void dp_make_flaglist(list) |
void dp_make_flaglist(list) |
|
|
STOQ(Reverse,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Reverse"); 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; |
STOQ(Stat,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Stat"); MKNODE(n1,name,n); n = n1; |
STOQ(Print,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Print"); MKNODE(n1,name,n); n = n1; |
STOQ(Print,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Print"); MKNODE(n1,name,n); n = n1; |
|
STOQ(OXCheck,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"OXCheck"); MKNODE(n1,name,n); n = n1; |
|
STOQ(GenTrace,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"GenTrace"); MKNODE(n1,name,n); n = n1; |
STOQ(PtozpRA,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"PtozpRA"); MKNODE(n1,name,n); n = n1; |
STOQ(PtozpRA,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"PtozpRA"); MKNODE(n1,name,n); n = n1; |
STOQ(ShowMag,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"ShowMag"); MKNODE(n1,name,n); n = n1; |
STOQ(ShowMag,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"ShowMag"); MKNODE(n1,name,n); n = n1; |
STOQ(Top,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Top"); MKNODE(n1,name,n); n = n1; |
STOQ(Top,v); MKNODE(n1,v,n); n = n1; MKSTR(name,"Top"); MKNODE(n1,name,n); n = n1; |
|
|
#define DELIM ':' |
#define DELIM ':' |
#endif |
#endif |
|
|
void dp_save(index,p) |
void dp_save(index,p,prefix) |
int index; |
int index; |
DP p; |
Obj p; |
|
char *prefix; |
{ |
{ |
FILE *fp; |
FILE *fp; |
char path[BUFSIZ]; |
char path[BUFSIZ]; |
|
|
sprintf(path,"%s%c%d",Demand,DELIM,index); |
if ( prefix ) |
|
sprintf(path,"%s%c%s%d",Demand,DELIM,prefix,index); |
|
else |
|
sprintf(path,"%s%c%d",Demand,DELIM,index); |
#if defined(VISUAL) || defined(THINK_C) |
#if defined(VISUAL) || defined(THINK_C) |
if ( !(fp = fopen(path,"wb") ) ) |
if ( !(fp = fopen(path,"wb") ) ) |
#else |
#else |
if ( !(fp = fopen(path,"w") ) ) |
if ( !(fp = fopen(path,"w") ) ) |
#endif |
#endif |
error("dp_save : cannot open a file"); |
error("dp_save : cannot open a file"); |
savevl(fp,VC); saveobj(fp,(Obj)p); fclose(fp); |
savevl(fp,VC); saveobj(fp,p); fclose(fp); |
} |
} |
|
|
void dp_load(index,p) |
void dp_load(index,p) |
|
|
int full,multiple; |
int full,multiple; |
DP *rp; |
DP *rp; |
{ |
{ |
DP u,p,d,s,t,dmy; |
P dmy; |
|
DP u,p,d,s,t,dmy1; |
NODE l; |
NODE l; |
MP m,mr; |
MP m,mr; |
int i,n; |
int i,n; |
|
|
for ( u = 0, l = b; l; l = NEXT(l) ) { |
for ( u = 0, l = b; l; l = NEXT(l) ) { |
if ( dl_redble(BDY(g)->dl,psh[(int)BDY(l)]) ) { |
if ( dl_redble(BDY(g)->dl,psh[(int)BDY(l)]) ) { |
dp_load((int)BDY(l),&p); |
dp_load((int)BDY(l),&p); |
dp_red(d,g,p,&t,&u,&dmy); |
dp_red(d,g,p,&t,&u,&dmy,&dmy1); |
psugar = (BDY(g)->dl->td - BDY(p)->dl->td) + p->sugar; |
psugar = (BDY(g)->dl->td - BDY(p)->dl->td) + p->sugar; |
sugar = MAX(sugar,psugar); |
sugar = MAX(sugar,psugar); |
if ( !u ) { |
if ( !u ) { |