当前位置: 首页>>代码示例>>C++>>正文


C++ DO函数代码示例

本文整理汇总了C++中DO函数的典型用法代码示例。如果您正苦于以下问题:C++ DO函数的具体用法?C++ DO怎么用?C++ DO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: response

/*
 * ZoneEdit OK codes are:
 *  CODE=200, 201
 *  CODE=707, for duplicated updates
 */
static int response(http_trans_t *trans, ddns_info_t *info, ddns_alias_t *alias)
{
	int code = -1;

	DO(http_status_valid(trans->status));

	sscanf(trans->rsp_body, "%*s CODE=\"%4d\" ", &code);
	switch (code) {
	case 200:
	case 201:
	case 707:
		/* XXX: is 707 really OK? */
		return 0;
	default:
		break;
	}

	return RC_DDNS_RSP_NOTOK;
}
开发者ID:eledir,项目名称:inadyn,代码行数:24,代码来源:zoneedit.c

示例2: ML_

void ML_(fill_elffpxregs_from_tst)(vki_elf_fpxregset_t* xfpu,
                                   const ThreadArchState* arch)
{
//::    xfpu->cwd = ?;
//::    xfpu->swd = ?;
//::    xfpu->twd = ?;
//::    xfpu->fop = ?;
//::    xfpu->fip = ?;
//::    xfpu->fcs = ?;
//::    xfpu->foo = ?;
//::    xfpu->fos = ?;
//::    xfpu->mxcsr = ?;
   xfpu->reserved = 0;
//::    xfpu->st_space = ?;

#  define DO(n)  VG_(memcpy)(xfpu->xmm_space + n * 4, &arch->vex.guest_XMM##n, sizeof(arch->vex.guest_XMM##n))
   DO(0);  DO(1);  DO(2);  DO(3);  DO(4);  DO(5);  DO(6);  DO(7);
#  undef DO

   VG_(memset)(xfpu->padding, 0, sizeof(xfpu->padding));
}
开发者ID:githubzenganiu,项目名称:toekn,代码行数:21,代码来源:coredump-x86-linux.c

示例3: cd

//Arthur says he doesn't use malloc or free. Andrei Moutchkine claims smallest unit is vm page (his truss says no malloc + add pages one at a time).
//Arthur not using malloc is probably true. No strdup & related functions in binary's strings. Note: Skelton references "different allocator" not in \w report
//This source would be improved by getting ridding of remaing malloc/calloc/realloc
K cd(K x)
{
  #ifdef DEBUG
  if(x && x->c <=0 ) { er(Tried to cd() already freed item) dd(tests) dd((L)x) dd(x->c) dd(x->t) dd(x->n) show(x); }
  #endif 

  P(!x,0)
  x->c -= 1;

  SW(xt)
  {
    CSR(5,)
    CS(0, DO(xn, cd(kK(x)[xn-i-1]))) //repool in reverse, attempt to maintain order
  }

  if(x->c > 0) R x;

  #ifdef DEBUG
  DO(kreci, if(x==krec[i]){krec[i]=0; break; })
开发者ID:indera,项目名称:kona,代码行数:22,代码来源:km.c

示例4: VBGLR3DECL

VBGLR3DECL(int) VbglR3DnDGHErrorEvent(int rcOp)
{
    DO(("GH_ERROR\n"));

    /* Initialize header */
    DragAndDropSvc::VBOXDNDGHEVTERRORMSG Msg;
    RT_ZERO(Msg);
    Msg.hdr.result      = VERR_WRONG_ORDER;
    Msg.hdr.u32ClientID = g_clientId;
    Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_EVT_ERROR;
    Msg.hdr.cParms      = 1;
    /* Initialize parameter */
    Msg.uRC.SetUInt32(rcOp);
    /* Do request */
    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
    if (RT_SUCCESS(rc))
        rc = Msg.hdr.result;
    return rc;
}
开发者ID:VirtualMonitor,项目名称:VirtualMonitor,代码行数:19,代码来源:VBoxGuestR3LibDragAndDrop.cpp

示例5: drawkeys

void drawkeys()
{
  int len,h2,x,y,*kx;
  len=Key->n;
  if (2>len) return;
  h2=LabelHit/2;
  kx=g_malloc(len*sizeof(int));
  pango_layout_set_font_description(PL,LabelFont);
  DO(len,kx[i]=gettextwidth(Key->v[i]));
  x=Gx+Gw-(10+KeyWid+maxi(len,kx));
  y=Gy+10+h2;
  cairo_set_line_width(CR,2);
  DO(len,{
    cairo_set_source(CR,glcolor(i));
    cairo_move_to(CR,x,y);
    cairo_line_to(CR,x+KeyWid,y);
    cairo_stroke(CR);
    y+=LabelHit;
  });
开发者ID:kevinarpe,项目名称:kx,代码行数:19,代码来源:price.c

示例6: pkcs_1_emsa_test

int pkcs_1_emsa_test(void)
{
  int hash_idx = find_hash("sha1");
  unsigned int i;
  unsigned int j;

  DO(hash_is_valid(hash_idx));

  for (i = 0; i < sizeof(testcases_emsa)/sizeof(testcases_emsa[0]); ++i) {
    testcase_t* t = &testcases_emsa[i];
    rsa_key k, *key = &k;
    DOX(mp_init_multi(&key->e, &key->d, &key->N, &key->dQ,
                       &key->dP, &key->qP, &key->p, &key->q, NULL), t->name);

    DOX(mp_read_unsigned_bin(key->e, t->rsa.e, t->rsa.e_l), t->name);
    DOX(mp_read_unsigned_bin(key->d, t->rsa.d, t->rsa.d_l), t->name);
    DOX(mp_read_unsigned_bin(key->N, t->rsa.n, t->rsa.n_l), t->name);
    DOX(mp_read_unsigned_bin(key->dQ, t->rsa.dQ, t->rsa.dQ_l), t->name);
    DOX(mp_read_unsigned_bin(key->dP, t->rsa.dP, t->rsa.dP_l), t->name);
    DOX(mp_read_unsigned_bin(key->qP, t->rsa.qInv, t->rsa.qInv_l), t->name);
    DOX(mp_read_unsigned_bin(key->q, t->rsa.q, t->rsa.q_l), t->name);
    DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
    key->type = PK_PRIVATE;

    for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
        rsaData_t* s = &t->data[j];
        unsigned char buf[20], obuf[256];
        unsigned long buflen = sizeof(buf), obuflen = sizeof(obuf);
        int stat;
        DOX(hash_memory(hash_idx, s->o1, s->o1_l, buf, &buflen), s->name);
        DOX(rsa_sign_hash_ex(buf, buflen, obuf, &obuflen, LTC_PKCS_1_V1_5, NULL, -1, hash_idx, 0, key), s->name);
        DOX(obuflen == (unsigned long)s->o2_l?CRYPT_OK:CRYPT_FAIL_TESTVECTOR, s->name);
        DOX(memcmp(s->o2, obuf, s->o2_l)==0?CRYPT_OK:CRYPT_FAIL_TESTVECTOR, s->name);
        DOX(rsa_verify_hash_ex(obuf, obuflen, buf, buflen, LTC_PKCS_1_V1_5, hash_idx, 0, &stat, key), s->name);
        DOX(stat == 1?CRYPT_OK:CRYPT_FAIL_TESTVECTOR, s->name);
    } /* for */

    mp_clear_multi(key->d,  key->e, key->N, key->dQ, key->dP, key->qP, key->p, key->q, NULL);
  } /* for */

  return 0;
}
开发者ID:libtom,项目名称:libtomcrypt,代码行数:42,代码来源:pkcs_1_emsa_test.c

示例7: switch

double *getklist(K p)
{
  double *r;

  r=g_malloc(p->n*sizeof(double));
  switch(p->t){
    case 1 : case 4 : DO(p->n,r[i]=kG(p)[i]);break;
    case 5 : DO(p->n,r[i]=kH(p)[i]);break;
    case 6 : case 13 : case 14 : case 17 : case 18 :
      DO(p->n,r[i]=kI(p)[i]);break;
    case 7 : case 16 : DO(p->n,r[i]=kJ(p)[i]);break;
    case 8 : DO(p->n,r[i]=kE(p)[i]);break;
    case 9 : case 15 : DO(p->n,r[i]=kF(p)[i]);break;
    case 10 : DO(p->n,r[i]=kC(p)[i]);break;
    default : g_free(r);return (double *)kerr("invalid numeric type");
  }
  return r;
}
开发者ID:kevinarpe,项目名称:kx,代码行数:18,代码来源:util.c

示例8: VBGLR3DECL

VBGLR3DECL(int) VbglR3DnDHGRequestData(const char* pcszFormat)
{
    DO(("DATA_REQ: '%s'\n", pcszFormat));
    /* Validate input */
    AssertPtrReturn(pcszFormat, VERR_INVALID_PARAMETER);

    /* Initialize header */
    DragAndDropSvc::VBOXDNDHGREQDATAMSG Msg;
    RT_ZERO(Msg);
    Msg.hdr.result      = VERR_WRONG_ORDER;
    Msg.hdr.u32ClientID = g_clientId;
    Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_HG_REQ_DATA;
    Msg.hdr.cParms      = 1;
    /* Do request */
    Msg.pFormat.SetPtr((void*)pcszFormat, (uint32_t)strlen(pcszFormat) + 1);
    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
    if (RT_SUCCESS(rc))
        rc = Msg.hdr.result;
    return rc;
}
开发者ID:OSLL,项目名称:vboxhsm,代码行数:20,代码来源:VBoxGuestR3LibDragAndDrop.cpp

示例9: switch

    QString to_source_f<QVariant>::operator()( QVariant const & x ) const
    {
	switch( x.userType() )
	{
#define DO(VT,T) \
	    case QVariant::VT: \
		return qboard::toSource( x.value<T>() ); break;

	    DO(Int,int);
	    DO(Double,int);
	    DO(String,QString);
	    DO(Point,QPoint);
	    DO(PointF,QPointF);
	    DO(Rect,QRect);
	    DO(RectF,QRectF);
	    DO(Size,QSize);
	    DO(SizeF,QSizeF);
	    DO(Color,QColor);
	  default:
	      break;
#undef DO
	};
	return QString("undefined");
    }
开发者ID:Mr-Kumar-Abhishek,项目名称:qboard,代码行数:24,代码来源:ScriptQt.cpp

示例10: winner_from

static uint8_t winner_from (PPosition_type pos, PState_DFS state, int f)
{
  prepare_state (state, f);

  int mi = (pos->player == L) ? X(f) : Y(f);
  int ma = (pos->player == L) ? X(f) : Y(f);

  while (not_done (state))
  {
    int const px = pop (state);
    int const py = pop (state);

#define DO(dx, dy)                                                      \
    if (  (px + dx) >= 0 && (px + dx) <= SIZE                           \
       && (py + dy) >= 0 && (py + dy) <= SIZE                           \
       && pos->taken[LIN ((px + dx), (py + dy))] == pos->player         \
       )                                                                \
    {                                                                   \
      if (not_seen (state, px + dx, py + dy))                           \
      {                                                                 \
        mi = MIN (mi, (pos->player == L) ? (px + dx) : (py + dy));      \
        ma = MAX (ma, (pos->player == L) ? (px + dx) : (py + dy));      \
                                                                        \
        if (mi == 0 && ma == SIZE)                                      \
        {                                                               \
          return pos->player;                                           \
        }                                                               \
                                                                        \
        push (state, px + dx, py + dy);                                 \
      }                                                                 \
    }                                                                   \

    DO ( 0, 1);
    DO ( 1, 1);
    DO ( 1, 0);
    DO ( 0,-1);
    DO (-1,-1);
    DO (-1, 0);

#undef DO
  }

  return N;
}
开发者ID:mrahn,项目名称:hex,代码行数:44,代码来源:hex.c

示例11: grade_updown

K grade_updown(K a, I r)
{
  I at=a->t, an=a->n;
  P(0< at, RE)
  if(-4==at)R symGrade(a,r);
  if(-3==at)R charGrade(a,r);
  if(-1==at||-2==at){
    K z;
    if(an<2){z=newK(-1,an);M(z);DO(an,kI(z)[i]=i);R z;}
    else{
      K x=0;uI y,u=(uI)-1,v=0,h=0,k;//MIN,MAX
      if(-2==at){x=newK(-1,an);M(x);}
      //trst();
      //elapsed("x=newK");
      if(-1==at)DO(an,y=kI(a)[i];h|=y;if(y<u)u=y;if(y>v)v=y)
      else DO(an,kU(x)[i]=(y=FtoI(kF(a)[i]));h|=y;if(y<u)u=y;if(y>v)v=y)
      //elapsed("fill x");
      //O("u:%016llx v:%016llx\n",u,v);
      if((r&&-1==at)||((u&MSB)!=(v&MSB))){
        u=(uI)-1;v=0;h=0;
        if(-1==at){
          x=newK(-1,an);M(x);
          DO(an,kU(x)[i]=(y=ItoU(kI(a)[i]));h|=y;if(y<u)u=y;if(y>v)v=y)}
        else DO(an,kU(x)[i]=(y=ItoU(kI(x)[i]));h|=y;if(y<u)u=y;if(y>v)v=y)}
开发者ID:0branch,项目名称:kona,代码行数:24,代码来源:vg.c

示例12: AssertPtrReturn

int DnDManager::nextMessageInfo(uint32_t *puMsg, uint32_t *pcParms)
{
    AssertPtrReturn(puMsg, VERR_INVALID_POINTER);
    AssertPtrReturn(pcParms, VERR_INVALID_POINTER);

    int rc = VINF_SUCCESS;

    if (m_pCurMsg)
        rc = m_pCurMsg->currentMessageInfo(puMsg, pcParms);
    else
    {
        if (m_dndMessageQueue.isEmpty())
        {
            rc = VERR_NO_DATA;
//            if (m_pfnProgressCallback)
//                m_pfnProgressCallback(100.0, DragAndDropSvc::DND_OP_CANCELLED, m_pvProgressUser);
        }
        else
            rc = m_dndMessageQueue.first()->currentMessageInfo(puMsg, pcParms);
    }

    DO(("next msg info: %d %d %Rrc\n", *puMsg, *pcParms, rc));
    return rc;
}
开发者ID:leopucci,项目名称:VirtualMonitor,代码行数:24,代码来源:dndmanager.cpp

示例13: response

static int response(http_trans_t *trans, ddns_info_t *UNUSED(info), ddns_alias_t *UNUSED(alias))
{
	int   code = -1;
	char *tmp;

	DO(http_status_valid(trans->status));

	tmp = strstr(trans->p_rsp_body, "\n");
	if (tmp)
		sscanf(++tmp, "%4d=", &code);

	switch (code) {
	case 0:
	case 1:
		return 0;
	case 4:
	case 11:
		return RC_DYNDNS_RSP_RETRY_LATER;
	default:
		break;
	}

	return RC_DYNDNS_RSP_NOTOK;
}
开发者ID:dbruenig,项目名称:inadyn,代码行数:24,代码来源:dnsexit.c

示例14: kclone

K kclone(K a)//Deep copy -- eliminate where possible
{
  if(!a) R 0;
  I t=a->t,n=a->n;
  K z= 7==t?Kv():newK(t,n);
  if     (4==ABS(t)) DO(n, kS(z)[i]=kS(a)[i])  //memcpy everywhere is better
  else if(3==ABS(t)) DO(n, kC(z)[i]=kC(a)[i]) 
  else if(2==ABS(t)) DO(n, kF(z)[i]=kF(a)[i]) 
  else if(1==ABS(t)) DO(n, kI(z)[i]=kI(a)[i]) 
  else if(0==    t ) DO(n, kK(z)[i]=kclone(kK(a)[i])) 
  else if(5==    t ) DO(n, kK(z)[i]=kclone(kK(a)[i]))
  else if(7==    t )
  {
    I k=0;

    z->t=a->t; 
    I vt=z->n = a->n;
    K kv;

    V*v;
    SW(vt)
    {
      CS(1, k=((K)kV(a)[CODE])->n-1;
            M(z,kv=newK(-4,k+1))
            v=(V*)kK(kv);
            //v[k]=0;//superfluous reminder
            DO(k, V w=kW(a)[i];
                  if(VA(w))v[i]=w;  //TODO: is this ok for NAMES? see similar code in capture()
                  else
                  {
                    K r=kclone(*(K*)w); //oom
                    V q=newE(LS,r); //oom
                    kap((K*) kV(z)+LOCALS,&q);//oom
                    cd(q);//kap does ci
                    q=EVP(q); //oom free z etc. kap needs checking 
                    v[i]=q;
                  }
              )
      )
      CS(2, M(z,kv=newK(-4,3))
            v=(V*)kK(kv);
            memcpy(v,kW(a),3*sizeof(V));
        )
开发者ID:elrzn,项目名称:kona,代码行数:43,代码来源:ko.c

示例15: gfarray

A gfarray(D *d, I n) { A z; D *zv;
    z=ga(FLT,1,n,NULL);
    zv=DAV(z);
    DO(n, zv[i]=d[i]);
    R z;
}
开发者ID:zeotrope,项目名称:anicca,代码行数:6,代码来源:memory.c


注:本文中的DO函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。