static DF2(case2){A u;V*sv; PREF2(case2); sv=VAV(self); RZ(u=from(df2(a,w,sv->g),sv->h)); ASSERT(!AR(u),EVRANK); R df2(a,w,*AV(u)); }
QString TreeView::findName(KDesktopFile *df, bool deleted) { QString name = df->readName(); if (deleted) { if (name == "empty") name.clear(); if (name.isEmpty()) { QString file = df->fileName(); QString res = df->resource(); bool isLocal = true; QStringList files = KGlobal::dirs()->findAllResources(res.toLatin1(), file); for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { if (isLocal) { isLocal = false; continue; } KDesktopFile df2(*it); name = df2.readName(); if (!name.isEmpty() && (name != "empty")) return name; } } } return name; }
static A jttayamp(J jt,A w,B nf,A x,A h){A y;B ng=!nf;I j,n;V*v=VAV(h); ASSERT(AR(x)<=(nf?v->lr:v->rr),EVRANK); switch(v->id){ case CPLUS: R tpoly(over(x,one)); case CMINUS: R tpoly(nf?over(x,num[-1]):over(negate(x),one)); case CSTAR: R tpoly(over(zero,x)); case CDIV: ASSERT(ng,EVDOMAIN); R tpoly(over(zero,recip(x))); case CJDOT: R tpoly(nf?over(x,a0j1):over(jdot1(x),one)); case CPOLY: ASSERT(nf,EVDOMAIN); R tpoly(BOX&AT(x)?poly1(x):x); case CHGEOM: ASSERT(nf,EVDOMAIN); RE(j=i0(x)); ASSERT(0<=j,EVDOMAIN); y=IX(j); R tpoly(divide(hgcoeff(y,h),fact(y))); case CBANG: ASSERT(nf,EVDOMAIN); RE(j=i0(x)); ASSERT(0<=j,EVDOMAIN); R tpoly(divide(poly1(box(iota(x))),fact(x))); case CEXP: if(nf)R eva(x,"(^.x)&^ % !"); RE(n=i0(x)); R 0<=n?tpoly(over(reshape(x,zero),one)):atop(ds(CDIV),amp(h,sc(-n))); case CFIT: ASSERT(nf&&CPOLY==ID(v->f),EVDOMAIN); y=over(x,IX(IC(x))); R tpoly(mdiv(df2(x,y,h),atab(CEXP,y,IX(IC(x))))); case CCIRCLE: switch(i0(x)){ case 1: R eval("{&0 1 0 _1@(4&|) % !"); case -3: R eval("{&0 1 0 _1@(4&|) % ]"); case 2: R eval("{&1 0 _1 0@(4&|) % !"); case 5: R eval("2&| % !"); case -7: R eval("2&| % ]"); case 6: R eval("2&|@>: % !"); case -1: R eval("(2&| % ]) * ([: */ (1&+ % 2&+)@(i.@<.&.-:))\"0"); case -5: R eval("({&0 1 0 _1@(4&|) % ]) * ([: */ (1&+ % 2&+)@(i.@<.&.-:))\"0"); }} ASSERT(0,EVDOMAIN); }
void Solve() { Tata[1] = 0; df(1); df2(1); printf("%d\n", B[1]); Solution(1, 1); }
void foo() { df1(&d); dg1(&d); dh1(&d); df2(&d); df3(&d); struct FA : A { void f() {} } fa; af(&fa); }
// This is the derived verb for f/. y static DF1(jtoblique){A x,y;I m,n,r,*u,*v; RZ(w); r=AR(w); // r = rank of w // create y= ,/ w - the _2-cells of w arranged in a list // we just create a header for y, pointing to the data from w RZ(y=gah(MAX(r-1,1),w)); u=AS(w); v=AS(y); // u,v->shape of y if(1>=r){*v=m=AN(w); n=1;}else{m=*u++; n=*u++; *v++=m*n; ICPY(v,u,r-2);} // set shape of y as _2-cells of w // Create x=+"0 1&i./ 2 {. $y RZ(x=irs2(IX(m),IX(n),0L,0L,1L,jtplus)); AR(x)=1; *AS(x)=AN(x); // perform x f/. y, which does the requested operation RZ(x=df2(x,y,sldot(VAV(self)->f))); // Final tweak: the result should have (0 >. <: +/ 2 {. $y) cells. It will, as long as // m and n are both non0: when one is 0, result has 0 cells (but that cell is the correct result // of execution on a fill-cell). Correct the length of the 0 case, when the result length should be nonzero // if((m==0 || n==0) && (m+n>0)){R reitem(sc(m+n-1),x);} This change withdrawn pending further deliberation R x; }
void df2(int nod) { lista *p; Flag[nod] = 1; for (p = L2[nod]; p != NULL; p = p -> next) if (!Flag[p -> nod]) df2(p -> nod); // am procesat fii, ma ocup de tata // A[i] int max = 0, fiu, sum; for (p = L2[nod]; p != NULL; p = p -> next) if (B[p -> nod] > max) max = B[p -> nod], fiu = p -> nod; A[nod] = max; Move[nod] = fiu; // B[i] // tai un fiu max = 30000; sum = fiu = 0; for (p = L2[nod]; p != NULL; sum += B[p -> nod], p = p -> next) if (B[p -> nod] < max) max = A[p -> nod], fiu = p -> nod; if (max == 30000) B[nod] = 0; else B[nod] = max + 1 + sum - B[fiu]; Tai[nod] = fiu; // nu tai nici un fiu max = 0; for (p = L2[nod]; p != NULL; p = p -> next) max += B[p -> nod]; if (max > B[nod]) B[nod] = max, Tai[nod] = 0; Flag[nod] = 0; }
REAL df2dy(const REAL h, const REAL alpha, const Matrix& f, const unsigned i, const unsigned j) { return df2(h, alpha, f.at(i,j-1), f.at(i,j), f.at(i,j+1)); }
REAL df2dx(const REAL h, const REAL alpha, const Matrix& f, const unsigned i, const unsigned j) { return df2(h, alpha, f.at(i-1,j), f.at(i,j), f.at(i+1,j)); }
static DF2(jtcorx2){F2PREFIP;DECLFGH;PROLOG(0031);A z; if(cap(fs))RZ(z=df2(a,w,folk(ds(CCAP),gs,hs))) else FOLK2; EPILOG(z);}
/* f g h where f may be [: */ // nvv forks. n must not be inplaced, since the fork may be reused. hx can be inplaced unless protected by caller. static DF1(jtnvv1){F1PREFIP;DECLFGH;PROLOG(0032); PUSHZOMB; A protw = (A)((I)w+((I)jtinplace&JTINPLACEW)); A hx=(h1)((VAV(hs)->flag&VINPLACEOK1)?jtinplace:jt, w,hs); POPZOMB; A z=(g2)(VAV(gs)->flag&VINPLACEOK2&&hx!=protw?( (J)((I)jt|JTINPLACEW) ):jt,fs,hx,gs); EPILOG(z);} static DF2(jtnvv2){F1PREFIP;DECLFGH;PROLOG(0033); PUSHZOMB; A protw = (A)((I)w+((I)jtinplace&JTINPLACEW)); A prota = (A)((I)a+((I)jtinplace&JTINPLACEA)); A hx=(h2)((VAV(hs)->flag&VINPLACEOK2)?jtinplace:jt,a,w,hs); POPZOMB; A z=(g2)(VAV(gs)->flag&VINPLACEOK2&&hx!=protw&&hx!=prota?( (J)((I)jt|JTINPLACEW) ):jt,fs,hx,gs); EPILOG(z);} static DF2(jtfolkcomp){F2PREFIP;DECLFGH;PROLOG(0034);A z;AF f; RZ(a&&w); if(f=atcompf(a,w,self))z=f(jt,a,w,self); else if(cap(fs))CAP2 else FOLK2; EPILOG(z); } static DF2(jtfolkcomp0){F2PREFIP;DECLFGH;PROLOG(0035);A z;AF f;D oldct=jt->ct; RZ(a&&w); jt->ct=0; if(f=atcompf(a,w,self))z=f(jt,a,w,self); else if(cap(fs))CAP2 else FOLK2; jt->ct=oldct; EPILOG(z); } static DF1(jtcharmapa){V*v=VAV(self); R charmap(w,VAV(v->h)->f,v->f);} static DF1(jtcharmapb){V*v=VAV(self); R charmap(w,VAV(v->f)->f,VAV(v->h)->f);} // Create the derived verb for a fork. Insert in-placeable flags based on routine, and asgsafe based on fgh A jtfolk(J jt,A f,A g,A h){A p,q,x,y;AF f1=jtfolk1,f2=jtfolk2;B b;C c,fi,gi,hi;I flag,j,m=-1;V*fv,*gv,*hv,*v; RZ(f&&g&&h); gv=VAV(g); gi=gv->id; hv=VAV(h); hi=hv->id; // Start flags with ASGSAFE (if g and h are safe), and with INPLACEOK to match the setting of f1,f2 flag=(VINPLACEOK1|VINPLACEOK2)+((gv->flag&hv->flag)&VASGSAFE); // We accumulate the flags for the derived verb. Start with ASGSAFE if all descendants are. if(NOUN&AT(f)){ /* y {~ x i. ] */ // Temporarily raise the usecount of the noun. Because we are in the same tstack frame as the parser, the usecount will stay // raised until any inplace decision has been made regarding this derived verb, protecting the derived verb if the // assigned name is the same as a name appearing here. If the derived verb is used in another sentence, it must first be // assigned to a name, which will protects values inside it. rat1s(f); // This justifies keeping the result ASGSAFE f1=jtnvv1; if(LIT&AT(f)&&1==AR(f)&&gi==CTILDE&&CFROM==ID(gv->f)&&hi==CFORK){ x=hv->f; if(LIT&AT(x)&&1==AR(x)&&CIOTA==ID(hv->g)&&CRIGHT==ID(hv->h)){f1=jtcharmapa; flag &=~(VINPLACEOK1);} } R fdef(CFORK,VERB, f1,jtnvv2, f,g,h, flag, RMAX,RMAX,RMAX); } fv=VAV(f); fi=fv->id; if(fi!=CCAP)flag &= fv->flag|~VASGSAFE; // remove ASGSAFE if f is unsafe switch(fi){ case CCAP: f1=jtcork1; f2=jtcork2; break; /* [: g h */ case CTILDE: if(NAME&AT(fv->f)){f1=jtcorx1; f2=jtcorx2;} break; /* name g h */ case CSLASH: if(gi==CDIV&&hi==CPOUND&&CPLUS==ID(fv->f)){f1=jtmean; flag|=VIRS1; flag &=~(VINPLACEOK1);} break; /* +/%# */ case CAMP: /* x&i. { y"_ */ case CFORK: /* (x i. ]) { y"_ */ if(hi==CQQ&&(y=hv->f,LIT&AT(y)&&1==AR(y))&&equ(ainf,hv->g)&& (x=fv->f,LIT&AT(x)&&1==AR(x))&&CIOTA==ID(fv->g)&& (fi==CAMP||CRIGHT==ID(fv->h))){f1=jtcharmapb; flag &=~(VINPLACEOK1);} break; case CAT: /* <"1@[ { ] */ if(gi==CLBRACE&&hi==CRIGHT){ p=fv->f; q=fv->g; if(CLEFT==ID(q)&&CQQ==ID(p)&&(v=VAV(p),x=v->f,CLT==ID(x)&&equ(one,v->g))){f2=jtsfrom; flag &=~(VINPLACEOK2);} }} switch(fi==CCAP?gi:hi){ case CQUERY: if(hi==CDOLLAR||hi==CPOUND){f2=jtrollk; flag &=~(VINPLACEOK2);} break; case CQRYDOT: if(hi==CDOLLAR||hi==CPOUND){f2=jtrollkx; flag &=~(VINPLACEOK2);} break; case CICAP: m=7; if(fi==CCAP){if(hi==CNE)f1=jtnubind; else if(FIT0(CNE,hv)){f1=jtnubind0; flag &=~(VINPLACEOK1);}} break; case CSLASH: c=ID(gv->f); m=c==CPLUS?4:c==CPLUSDOT?5:c==CSTARDOT?6:-1; if(fi==CCAP&&vaid(gv->f)&&vaid(h)){f2=jtfslashatg; flag &=~(VINPLACEOK2);} break; case CFCONS: if(hi==CFCONS){x=hv->h; j=*BAV(x); m=B01&AT(x)?(gi==CIOTA?j:gi==CICO?2+j:-1):-1;} break; case CRAZE: if(hi==CLBRACE){f2=jtrazefrom; flag &=~(VINPLACEOK2);} else if(hi==CCUT){ j=i0(hv->g); if(CBOX==ID(hv->f)&&!j){f2=jtrazecut0; flag &=~(VINPLACEOK2);} else if(boxatop(h)&&j&&-2<=j&&j<=2){f1=jtrazecut1; f2=jtrazecut2; flag &=~(VINPLACEOK1|VINPLACEOK2);} }} if(0<=m){ v=4<=m?hv:fv; b=CFIT==v->id&&equ(zero,v->g); switch(b?ID(v->f):v->id){ case CEQ: f2=b?jtfolkcomp0:jtfolkcomp; flag|=0+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break; case CNE: f2=b?jtfolkcomp0:jtfolkcomp; flag|=1+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break; case CLT: f2=b?jtfolkcomp0:jtfolkcomp; flag|=2+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break; case CLE: f2=b?jtfolkcomp0:jtfolkcomp; flag|=3+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break; case CGE: f2=b?jtfolkcomp0:jtfolkcomp; flag|=4+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break; case CGT: f2=b?jtfolkcomp0:jtfolkcomp; flag|=5+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break; case CEBAR: f2=b?jtfolkcomp0:jtfolkcomp; flag|=6+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break; case CEPS: f2=b?jtfolkcomp0:jtfolkcomp; flag|=7+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break; }} // If this fork is not a special form, set the flags to indicate whether the f verb does not use an // argument. In that case h can inplace the unused aegument. if(f1==jtfolk1 && f2==jtfolk2) flag |= atoplr(f); R fdef(CFORK,VERB, f1,f2, f,g,h, flag, RMAX,RMAX,RMAX); } static DF1(taa){TDECL;A t=df1(w,fs); ASSERT(!t||AT(t)&NOUN+VERB,EVSYNTAX); R df1(t,gs);} static DF1(tvc){TDECL; R df2(fs,w,gs);} /* also nc */ static DF1(tcv){TDECL; R df2(w,gs,fs);} /* also cn */
static DF1(tvc){TDECL; R df2(fs,w,gs);} /* also nc */
static DF2(jtfitpoly2){ F2RANK(1,0,jtfitpoly2,self); R aslash(CPLUS,tymes(a,ascan(CSTAR,shift1(plus(w,df2(IX(IC(a)),VAV(self)->g,slash(ds(CSTAR)))))))); } /* a p.!.s w */
A jtevc(J jt,A a,A w,C*s){R df2(a,w,colon(num[2],cstr(s)));}
static DF2(jtfitf2){V*sv=VAV(self); R df2(a,w,fit(fix(sv->f),sv->g));}
A jtev2(J jt,A a,A w,C*s){R df2(a,w,eval(s));}
static DF1(gcl1){DECLFG;A*hv=AAV(sv->h); R df1(df1(w,hv[2]),df2(df1(w,hv[1]),gs,ds(sv->id))); }
static DF2(gcl2){DECLFG;A*hv=AAV(sv->h); R df2(df2(a,w,hv[0]),df2(a,w,hv[2]),df2(df2(a,w,hv[1]),gs,ds(sv->id))); }
static DF2(jtfitexp2){ F2RANK(0,0,jtfitexp2,self); ASSERT(0<=i0(w)&&!jt->jerr,EVDOMAIN); R aslash(CSTAR,plus(a,df2(iota(w),VAV(self)->g,slash(ds(CSTAR))))); } /* a ^!.s w */