本文整理汇总了C++中RZ函数的典型用法代码示例。如果您正苦于以下问题:C++ RZ函数的具体用法?C++ RZ怎么用?C++ RZ使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RZ函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ATF_TC_BODY
ATF_TC_BODY(proccreds, tc)
{
struct lwp *l1, *l2;
rump_init();
RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
l1 = rump_pub_lwproc_curlwp();
RZ(rump_pub_lwproc_newlwp(rump_sys_getpid()));
RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
l2 = rump_pub_lwproc_curlwp();
RL(rump_sys_setuid(22));
ATF_REQUIRE_EQ(rump_sys_getuid(), 22);
rump_pub_lwproc_switch(l1);
ATF_REQUIRE_EQ(rump_sys_getuid(), 0); /* from parent, proc0 */
RL(rump_sys_setuid(11));
ATF_REQUIRE_EQ(rump_sys_getuid(), 11);
rump_pub_lwproc_switch(l2);
ATF_REQUIRE_EQ(rump_sys_getuid(), 22);
rump_pub_lwproc_newlwp(rump_sys_getpid());
ATF_REQUIRE_EQ(rump_sys_getuid(), 22);
}
示例2: ATF_TC_BODY
ATF_TC_BODY(makecn, tc)
{
struct componentname *cn;
char pathstr[MAXPATHLEN] = TESTFILE;
struct vnode *vp;
extern struct vnode *rumpns_rootvnode;
rump_init();
/*
* Strategy is to create a componentname, edit the passed
* string, and then do a lookup with the componentname.
*/
RL(rump_sys_mkdir("/" TESTFILE, 0777));
/* need stable lwp for componentname */
RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
/* try it once with the right path */
cn = rump_pub_makecn(RUMP_NAMEI_LOOKUP, 0, pathstr, strlen(pathstr),
rump_pub_cred_create(0, 0, 0, NULL), rump_pub_lwproc_curlwp());
RZ(RUMP_VOP_LOOKUP(rumpns_rootvnode, &vp, cn));
rump_pub_freecn(cn, RUMPCN_FREECRED);
/* and then with modification-in-the-middle */
cn = rump_pub_makecn(RUMP_NAMEI_LOOKUP, 0, pathstr, strlen(pathstr),
rump_pub_cred_create(0, 0, 0, NULL), rump_pub_lwproc_curlwp());
strcpy(pathstr, "/muuta");
RZ(RUMP_VOP_LOOKUP(rumpns_rootvnode, &vp, cn));
rump_pub_freecn(cn, RUMPCN_FREECRED);
}
示例3: REPF
static REPF(jtrepzsx) {
A q,x,y;
I c,d,j,k=-1,m,p=0,*qv,*xv,*yv;
P*ap;
RZ(a&&w);
ap=PAV(a);
x=SPA(ap,x);
m=AN(x);
if(!AN(SPA(ap,a)))R repzdx(ravel(x),w,wf,wcr);
y=SPA(ap,i);
yv=AV(y);
RZ(x=cvt(INT,vec(FL,2*m,AV(x))));
xv=AV(x);
if(equ(zero,SPA(ap,e))) {
k=c=*(wf+AS(w));
if(!wf&&SPARSE&AT(w)) {
A a,y;
I m,n,q,*v;
P*wp;
wp=PAV(w);
a=SPA(wp,a);
if(AN(a)&&!*AV(a)) {
y=SPA(wp,i);
v=AS(y);
m=v[0];
n=v[1];
v=AV(y);
k=m?v[(m-1)*n]+1:0;
q=0;
DO(m, if(q==*v)++q; else if(q<*v) {
k=q;
break;
}
v+=n;);
}
示例4: jtrank1ex
A jtrank1ex(J jt,A w,A fs,I mr,AF f1) {
PROLOG;
A y,y0,yw,z;
B wb;
C*v,*vv;
I k,mn,n=1,p,*s,wcn,wcr,wf,wk,wr,*ws,wt,yn,yr,*ys,yt;
RZ(w);
wt=AT(w);
if(wt&SPARSE)R sprank1(w,fs,mr,f1);
wr=AR(w);
ws=AS(w);
wcr=efr(wr,mr);
wf=wr-wcr;
wb=ARELATIVE(w);
if(!wf)R CALL1(f1,w,fs);
RE(wcn=prod(wcr,wf+ws));
wk=wcn*bp(wt);
v=CAV(w)-wk;
NEWYW;
p=wf;
s=ws;
RE(mn=prod(wf,ws));
if(AN(w))MOVEYW else RZ(yw=reshape(vec(INT,wcr,ws+wf),filler(w)));
#define VALENCE 1
#define TEMPLATE 0
#include "cr_t.h"
}
示例5: F2
static F2(jtfitct){D d;V*sv;
RZ(a&&w);
ASSERT(!AR(w),EVRANK);
sv=VAV(a);
RZ(w=cvt(FL,w)); d=*DAV(w); ASSERT(0<=d&&d<5.82076609134675e-11,EVDOMAIN);
R CDERIV(CFIT,jtfitct1,jtfitct2,sv->mr,sv->lr,sv->rr);
}
示例6: jtrank2ex
// General setup for verbs with IRS that do not go through jtirs[12]
// A verb u["n] using this function checks to see whether it has multiple cells; if so,
// it calls here, giving a callback; we split the arguents into cells and call the callback,
// which is often the same original function that called here.
A jtrank2ex(J jt,A a,A w,A fs,I lr,I rr,AF f2){PROLOG(0042);A y,y0,ya,yw,z;B ab,b,wb;
C*u,*uu,*v,*vv;I acn,acr,af,ak,ar,*as,at,k,mn,n=1,p,q,*s,wcn,wcr,wf,wk,wr,*ws,wt,yn,yr,*ys,yt;
RZ(a&&w);
at=AT(a); wt=AT(w);
if(at&SPARSE||wt&SPARSE)R sprank2(a,w,fs,lr,rr,f2);
// ?r=rank, ?s->shape, ?cr=effective rank, ?f=#frame, ?b=relative flag, for each argument
ar=AR(a); as=AS(a); acr=efr(ar,lr); af=ar-acr; ab=ARELATIVE(a);
wr=AR(w); ws=AS(w); wcr=efr(wr,rr); wf=wr-wcr; wb=ARELATIVE(w);
if(!af&&!wf)R CALL2(f2,a,w,fs); // if there's only one cell, run on it, that's the result
// multiple cells. Loop through them.
// ?cn=number of atoms in a cell, ?k=#bytes in a cell, uv point to one cell before aw data
// Allocate y? to hold one cell of ?, with uu,vv pointing to the data of y?
RE(acn=prod(acr,as+af)); ak=acn*bp(at); u=CAV(a)-ak; NEWYA;
RE(wcn=prod(wcr,ws+wf)); wk=wcn*bp(wt); v=CAV(w)-wk; NEWYW;
// b means 'w frame is larger'; p=#larger frame; q=#shorter frame; s->larger frame
// mn=#cells in larger frame (& therefore #cells in result); n=# times to repeat each cell
// from shorter-frame argument
b=af<=wf; p=b?wf:af; q=b?af:wf; s=b?ws:as; RE(mn=prod(p,s)); RE(n=prod(p-q,s+q));
ASSERT(!ICMP(as,ws,q),EVLENGTH); // error if frames are not same as prefix
// Initialize y? to hold data for the first cell; but if ? is empty, set y? to a cell of fills
if(AN(a))MOVEYA else RZ(ya=reshape(vec(INT,acr,as+af),filler(a)));
if(AN(w))MOVEYW else RZ(yw=reshape(vec(INT,wcr,ws+wf),filler(w)));
#define VALENCE 2
#define TEMPLATE 0
#include "cr_t.h"
}
示例7: ATF_TC_BODY
ATF_TC_BODY(key, tc)
{
RZ(rump_init());
RL(open("hostfile", O_RDWR | O_CREAT, 0777));
RZ(rump_pub_etfs_register("/key", "hostfile", RUMP_ETFS_REG));
ATF_REQUIRE_EQ(rump_pub_etfs_register("key", "hostfile", RUMP_ETFS_REG),
EINVAL);
RL(rump_sys_open("/key", O_RDONLY));
RL(rump_sys_open("////////key", O_RDONLY));
RZ(rump_pub_etfs_register("////key//with/slashes", "hostfile",
RUMP_ETFS_REG));
RL(rump_sys_open("/key//with/slashes", O_RDONLY));
RL(rump_sys_open("key//with/slashes", O_RDONLY));
ATF_REQUIRE_ERRNO(ENOENT,
rump_sys_open("/key/with/slashes", O_RDONLY) == -1);
RL(rump_sys_mkdir("/a", 0777));
ATF_REQUIRE_ERRNO(ENOENT,
rump_sys_open("/a/key//with/slashes", O_RDONLY) == -1);
}
示例8: REPF
static REPF(jtrepzdx){A p,q,x;P*wp;
RZ(a&&w);
if(SPARSE&AT(w)){wp=PAV(w); x=SPA(wp,e);}
else x=jt->fill&&AN(jt->fill)?jt->fill:filler(w);
RZ(p=repeat(ravel(rect(a)),ravel(stitch(IX(wcr?*(wf+AS(w)):1),num[-1]))));
RZ(q=irs2(w,x,0L,wcr,0L,jtover));
R irs2(p,q,0L,1L,wcr+!wcr,jtfrom);
} /* (dense complex) # (dense or sparse) */
示例9: jtcants
static A jtcants(J jt,A a,A w,A z){A a1,q,y;B*b,*c;I*u,wr,zr;P*wp,*zp;
RZ(a&&w&&z);
RZ(a=grade1(a));
wr=AR(w); wp=PAV(w); a1=SPA(wp,a);
zr=AR(z); zp=PAV(z);
ASSERT(wr==zr,EVNONCE);
RZ(b=bfi(wr,a1,1));
GA(q,B01,wr,1,0); c=BAV(q); u=AV(a); DO(wr, c[i]=b[u[i]];);
示例10: jtvaspc
static A jtvaspc(J jt,A a,A w,C id,VF ado,I cv,I t,I zt,I af,I acr,I wf,I wcr,I f,I r){A q;I*as,*v,*ws;
as=AS(a);
ws=AS(w);
GA(q,INT,f+r,1,0); v=AV(q);
if(r>acr){ICPY(v,wf+ws,r); RZ(a=irs2(vec(INT,r-acr,acr+v),a,0L,1L,0L,jtreshape));}
if(r>wcr){ICPY(v,af+as,r); RZ(w=irs2(vec(INT,r-wcr,wcr+v),w,0L,1L,0L,jtreshape));}
R vasp(a,w,id,ado,cv,t,zt,af,r,wf,r,f,r);
} /* prefix agreement on cells */
示例11: jtfxeachv
A jtfxeachv(J jt,I r,A w){A*wv,x,z,*zv;I n,wd;
RZ(w);
n=AN(w); wv=AAV(w); wd=(I)w*ARELATIVE(w);
ASSERT(r>=AR(w),EVRANK);
ASSERT(n,EVLENGTH);
ASSERT(BOX&AT(w),EVDOMAIN);
GA(z,BOX,n,AR(w),AS(w)); zv=AAV(z);
DO(n, RZ(zv[i]=x=fx(WVR(i))); ASSERT(VERB&AT(x),EVDOMAIN););
示例12: DF1
static DF1(jtgsuffix){A h,*hv,z,*zv;I m,n,r;
RZ(w);
if(jt->rank&&jt->rank[1]<AR(w)){r=jt->rank[1]; jt->rank=0; R rank1ex(w,self,jt->rank[1],jtgsuffix);}
jt->rank=0;
n=IC(w);
h=VAV(self)->h; hv=AAV(h); m=AN(h);
GATV(z,BOX,n,1,0); zv=AAV(z);
DO(n, RZ(zv[i]=df1(drop(sc(i),w),hv[i%m])););
示例13: F1
static F1(jtnvrpush){
if(jt->nvrtop==AN(jt->nvra)){
RZ(jt->nvra=ext(1,jt->nvra)); jt->nvrav=AAV(jt->nvra);
while(AN(jt->nvrb)<AN(jt->nvra))RZ(jt->nvrb=ext(1,jt->nvrb)); jt->nvrbv=BAV(jt->nvrb);
}
jt->nvrav[jt->nvrtop]=w;
jt->nvrbv[jt->nvrtop]=1;
++jt->nvrtop;
R w;
}
示例14: DF1
static DF1(insert){PROLOG;A hs,*hv,z;I hn,j,k,m,n;
RZ(w);
m=IC(w); hs=VAV(self)->h; hn=AN(hs); hv=AAV(hs);
if(!m)R df1(w,iden(*hv));
j=n=MAX(hn,m-1);
RZ(z=AR(w)?from(sc(n%m),w):ca(w));
if(1==n)R z;
DO(n, --j; k=j%hn; RZ(z=(VAV(hv[k])->f2)(from(sc(j%m),w),z,hv[k])));
EPILOG(z);
}
示例15: F1
F1(bool){A b,h;I j,*v;
RZ(w);
if(VERB&AT(w))R ADERIV(CBOOL, basis1,0L, 0L,0L,0L);
RZ(w=vi(w));
v=AV(w);
DO(AN(w), j=*v++; ASSERT(-16<=j&&j<16,EVINDEX));
GA(b,BOOL,64,2,0); *AS(b)=16; *(1+AS(b))=4; MC(AV(b),booltab,64L);
RZ(h=cant2(apv(AR(w),0L,1L),from(w,b)));
R fdef(CBOOL,VERB, bool1,bool2, w,0L,h, 0L, RMAXL,0L,0L);
}