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


C++ ODD函数代码示例

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


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

示例1: pwrs_Node_SupEmon

/* Supervise emon server process */
void
pwrs_Node_SupEmon (
)
{
  int i = errh_eAnix_emon - 1;
  pwr_tTime current_time;
  pwr_tDeltaTime diff;
  static float timeout = 3;

  if ( !np) {
    pwr_tOid oid;
    pwr_tStatus sts;

    sts = gdh_GetNodeObject( 0, &oid);
    if ( ODD(sts))
      gdh_ObjidToPointer( oid, (void **) &np);
    if ( EVEN(sts)) return;
  }

  if ( !np)
    return;

  if ( np->ProcStatus[i] != 0 && np->ProcStatus[i] != PWR__PTIMEOUT) {
    time_GetTime( &current_time);
    time_Adiff( &diff, &current_time, &np->ProcTimeStamp[i]);

    if ( time_DToFloat( 0, &diff) > timeout) {
      if ( errh_Severity( np->ProcStatus[i]) < errh_Severity(PWR__PTIMEOUT)) {
	np->ProcStatus[i] = PWR__PTIMEOUT;
	np->SystemStatus = PWR__PTIMEOUT;
      }
    }
  }
}
开发者ID:Strongc,项目名称:proview,代码行数:35,代码来源:rt_c_node.c

示例2: logg_init

static pwr_tStatus	logg_init( logg_ctx	loggctx)
{
	pwr_tStatus	sts;
	pwr_tObjid	objid;
	logg_t_loggconf_list	*conflist_ptr;
	int		i;

	/* Get the logg config objects on this node */
	sts = gdh_GetClassList ( pwr_cClass_LoggConfig, &objid);
	while ( ODD(sts))
	{
          /* Store and direct link the LoggConfig objects */
          sts = logg_loggconflist_add( loggctx, objid,
		&loggctx->loggconflist,
		&loggctx->loggconf_count);
	  if (EVEN(sts)) Log( REM__CONFINIT, sts);

	  sts = gdh_GetNextObject( objid, &objid);
	}

	/* Open the files */
	conflist_ptr = loggctx->loggconflist;
	for ( i = 0; i < loggctx->loggconf_count; i++)
	{
	  sts = logg_open_file( conflist_ptr, 1);
	  conflist_ptr++;
	}

	return REM__SUCCESS;
}
开发者ID:hfuhuang,项目名称:proview,代码行数:30,代码来源:rs_remote_logg.c

示例3: write_xms_store

write_xms_store (j_common_ptr cinfo, backing_store_ptr info,
		 void FAR * buffer_address,
		 long file_offset, long byte_count)
{
  XMScontext ctx;
  XMSspec spec;
  char endbuffer[2];

  /* The XMS driver can't cope with an odd length, so handle the last byte
   * specially if byte_count is odd.  We don't expect this to be common.
   */

  spec.length = byte_count & (~ 1L);
  spec.src_handle = 0;
  spec.src.ptr = buffer_address;
  spec.dst_handle = info->handle.xms_handle;
  spec.dst.offset = file_offset;

  ctx.ds_si = (void far *) & spec;
  ctx.ax = 0x0b00;		/* EMB move */
  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
  if (ctx.ax != 1)
    ERREXIT(cinfo, JERR_XMS_WRITE);

  if (ODD(byte_count)) {
    read_xms_store(cinfo, info, (void FAR *) endbuffer,
		   file_offset + byte_count - 1L, 2L);
    endbuffer[0] = ((char FAR *) buffer_address)[byte_count - 1L];
    write_xms_store(cinfo, info, (void FAR *) endbuffer,
		    file_offset + byte_count - 1L, 2L);
  }
}
开发者ID:0-14N,项目名称:NDroid,代码行数:32,代码来源:jmemdos.c

示例4: triggPostCreate

pwr_tStatus wb_volume::triggPostCreate(wb_object& o)
{
  pwr_tStatus sts;
  char *methodName;
  wb_tMethod method;
  
  // Call object method, or inherited method
  for ( wb_cdef cd = cdef(o.cid()); cd; cd = cd.super()) {
    wb_cdrep *cdrep = cd;
    
    cdrep->dbCallBack(&sts, ldh_eDbCallBack_PostCreate, &methodName, 0);

    if (ODD(sts)) {
      m_vrep->erep()->method(&sts, methodName, &method);
      if (EVEN(sts)) return LDH__SUCCESS;

      wb_object father = o.parent();
      if (father) {
	sts = ((wb_tMethodPostCreate) (method))((ldh_tSesContext)this, o.oid(), father.oid(),
						father.cid());
      }
      else
	sts = ((wb_tMethodPostCreate) (method))((ldh_tSesContext)this, o.oid(), pwr_cNObjid,
						pwr_cNClassId);
      return sts;
    }
  }

  return LDH__SUCCESS;
}
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:30,代码来源:wb_volume.cpp

示例5: calloc

void WVselMotif::activate_ok( Widget w, WVselMotif *vsel, XmAnyCallbackStruct *data)
{
  int		sts;
  int 		*pos_list, pos_cnt;
  int 		i;
  pwr_tVolumeId	*volume_ptr;

  volume_ptr = (pwr_tVolumeId *) calloc( vsel->volume_count, 
					 sizeof( pwr_tVolumeId));
  if (XmListGetSelectedPos( vsel->widgets.volumelist, 
			    &pos_list, &pos_cnt))  {
    for (i = 0; i < pos_cnt; i++) {
      *(volume_ptr + i) = vsel->volumes[ pos_list[i] - 1];
    }
  }

  if (vsel->vsel_bc_success != NULL)
    sts = (vsel->vsel_bc_success) ( vsel, volume_ptr, pos_cnt);
  free( (char *) volume_ptr);

  if ( ODD(sts)) {
    if (vsel->vsel_bc_cancel != NULL)
      (vsel->vsel_bc_cancel) ();
    delete vsel;
  }
  else if ( sts == LDH__VOLALRATT) {
    vsel->wow->DisplayError( "Error",
			     "         Volume is already open        ");
  }
}
开发者ID:Strongc,项目名称:proview,代码行数:30,代码来源:wb_vsel_motif.cpp

示例6: lchoose

double lchoose(double n, double k)
{
    k = floor(k + 0.5);
#ifdef IEEE_754
    /* NaNs propagated correctly */
    if(ISNAN(n) || ISNAN(k)) return n + k;
#endif
    if (k < 2) {
	if (k <	 0) return ML_NEGINF;
	if (k == 0) return 0.;
	/* else: k == 1 */
	return log(n);
    }
    /* else: k >= 2 */
    if (n < 0) {
	if (ODD(k)) return ML_NAN;/* log( <negative> ) */
	return lchoose(-n+ k-1, k);
    }
    else if (R_IS_INT(n)) {
	if(n < k) return ML_NEGINF;
	if(n - k < 2) return lchoose(n, n-k); /* <- Symmetry */
	return lfastchoose(n, k);
    }
    /* else non-integer n >= 0 : */
    if (n < k-1) {
	int s;
	if (fmod(floor(n-k+1), 2.) == 0) /* choose() < 0 */
	    return ML_NAN;
	return lfastchoose2(n, k, &s);
    }
    return lfastchoose(n, k);
}
开发者ID:Vladimir84,项目名称:rcc,代码行数:32,代码来源:choose.c

示例7: put

wb_orep *wb_vrepext::object(pwr_tStatus *sts)
{
  vext_sQMsg qmsg;
  vext_sAMsg amsg;

  qmsg.Any.Type = vext_eMsgType_Object;
  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.Object.Status)) {
    *sts = LDH__SUCCESS;
    wb_cdrep *cdrep = m_merep->cdrep( sts, amsg.Object.cid);
    wb_cdef cdef = wb_cdef( cdrep);

    ext_object exto( &amsg.Object, m_vid, cdef);
    wb_orepext *orep = new wb_orepext( this, exto);
    return orep;
  }
  else {
    *sts = amsg.Object.Status;
    return 0;
  }
}
开发者ID:Strongc,项目名称:proview,代码行数:25,代码来源:wb_vrepext.cpp

示例8: AnteCreate

static pwr_tStatus AnteCreate (
  ldh_tSesContext   Session,
  pwr_tObjid	    Father,
  pwr_tClassId	    Class
) {
  pwr_tCid cid;
  pwr_tStatus sts;
  pwr_tOid oid;

  // ClassHier should be child to a $Node object
  if ( Father.oix == 0)
    return PWRS__POSSECURITY;

  sts = ldh_GetObjectClass( Session, Father, &cid);
  if ( EVEN(sts)) return sts;
  
  if ( cid != pwr_eClass_Node)
    return PWRS__POSSECURITY;

  // There should only be one security object
  sts = ldh_GetClassList( Session, pwr_eClass_Security, &oid);
  if ( ODD(sts))
    return PWRS__SECURITYALREX;

  return PWRS__SUCCESS;
}
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:26,代码来源:wb_c_security.cpp

示例9: wb_orepext

wb_orep *wb_vrepext::object(pwr_tStatus *sts, wb_name &name)
{
  if ( name.hasVolume() && !name.hasObject()) {
    // Volume object
    *sts = LDH__SUCCESS;
    return new wb_orepext( this, volume_object);
  }

  vext_sQMsg qmsg;
  vext_sAMsg amsg;

  qmsg.ObjectName.Type = vext_eMsgType_ObjectName;
  strcpy( qmsg.ObjectName.Name, name.name(cdh_mName_path | cdh_mName_object));
  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.Object.Status)) {
    *sts = LDH__SUCCESS;
    wb_cdrep *cdrep = m_merep->cdrep( sts, amsg.Object.cid);
    wb_cdef cdef = wb_cdef( cdrep);

    ext_object exto( &amsg.Object, m_vid, cdef);
    wb_orepext *orep = new wb_orepext( this, exto);
    return orep;
  }
  else {
    *sts = amsg.Object.Status;
    return 0;
  }
}
开发者ID:Strongc,项目名称:proview,代码行数:32,代码来源:wb_vrepext.cpp

示例10: read_xms_store

METHODDEF void
read_xms_store (backing_store_ptr info, void FAR * buffer_address,
		long file_offset, long byte_count)
{
  XMScontext ctx;
  XMSspec spec;
  char endbuffer[2];

  /* The XMS driver can't cope with an odd length, so handle the last byte
   * specially if byte_count is odd.  We don't expect this to be common.
   */

  spec.length = byte_count & (~ 1L);
  spec.src_handle = info->handle.xms_handle;
  spec.src.offset = file_offset;
  spec.dst_handle = 0;
  spec.dst.ptr = buffer_address;
  
  ctx.ds_si = (void far *) & spec;
  ctx.ax = 0x0b00;		/* EMB move */
  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
  if (ctx.ax != 1)
    ERREXIT(methods, "read from extended memory failed");

  if (ODD(byte_count)) {
    read_xms_store(info, (void FAR *) endbuffer,
		   file_offset + byte_count - 1L, 2L);
    ((char FAR *) buffer_address)[byte_count - 1L] = endbuffer[0];
  }
}
开发者ID:OS2World,项目名称:APP-GRAPHICS-X11-XLOADIMAGE,代码行数:30,代码来源:jmemdos.c

示例11: ivol_BuildVolume

pwr_tBoolean
ivol_BuildVolume (
  pwr_tStatus		*status,
  gdb_sVolume		*vp
)
{
  pool_sQlink		*ol;
  gdb_sObject		*op;

  pwr_dStatus(sts, status, GDH__SUCCESS);

  /* First link the volume block.  */


  /* Now link all objects.  */

  for (
    ol = pool_Qsucc(sts, gdbroot->pool, &vp->l.obj_lh);
    ol != &vp->l.obj_lh;
    ol = pool_Qsucc(sts, gdbroot->pool, ol)
  ) {
    op = pool_Qitem(ol, gdb_sObject, l.obj_ll);

    vol_LinkObject(sts, vp, op, vol_mLink_build);
    pwr_Assert(ODD(*sts));

  }
  return YES;
}
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:29,代码来源:rt_ivol.c

示例12: mountClients

static pwr_tBoolean
mountClients (
  pwr_tStatus		*sts,
  gdb_sVolume		*vp
)
{
  pool_sQlink		*ol;
  gdb_sObject		*op;

  /* First link the volume block.  */


  /* Now link all objects.  */

  for (
    ol = pool_Qsucc(sts, gdbroot->pool, &vp->l.obj_lh);
    ol != &vp->l.obj_lh;
    ol = pool_Qsucc(sts, gdbroot->pool, ol)
  ) {
    op = pool_Qitem(ol, gdb_sObject, l.obj_ll);

    if (op->g.flags.b.isMountClient && op->g.oid.vid == gdbroot->db->vid) {
      /* Only root volumes can mount.  */
      mountVolume(sts, op);
      if ( *sts != GDH__NOMOUNTOBJECT)
	pwr_Assert(ODD(*sts));
    }
  }
  return YES;
}
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:30,代码来源:rt_ivol.c

示例13: mh_OutunitReceive

void Ev::update( double scantime)
{
  int sts;
  int nodraw_set = 0;

  sts = mh_OutunitReceive();     
  while (ODD(sts))
  {
    if ( !nodraw_set)
    {
      eve->set_nodraw();
      ala->set_nodraw();
      nodraw_set = 1;
    }
    sts = mh_OutunitReceive();     
  }
  if ( nodraw_set)
  {
    eve->reset_nodraw();
    ala->reset_nodraw();
  }

  ala->flash();
  for ( int i = 0; i < sala_cnt; i++)
    sala[i]->update();
  if ( beep)
    ala->beep( scantime);
}      
开发者ID:Strongc,项目名称:proview,代码行数:28,代码来源:xtt_ev.cpp

示例14: set_view

pwr_tStatus EvEve::set_view(pwr_tOid view)
{
  pwr_tStatus sts;

  sts = ala->set_view( view);
  if ( ODD(sts)) {
    pwr_tString80 name;

    if ( cdh_ObjidIsNull( view)) {
      strcpy( name, "Event List");
    }
    else {
      pwr_tAttrRef name_ar, ar;

      ar = cdh_ObjidToAref( view);
      sts = gdh_ArefANameToAref( &ar, "Name", &name_ar);
      if (EVEN(sts)) return sts;

      sts = gdh_GetObjectInfoAttrref( &name_ar, name, sizeof(name));
      if (EVEN(sts)) return sts;
    }
    set_title_ala( name);
  }
  return sts;
}
开发者ID:Strongc,项目名称:proview,代码行数:25,代码来源:xtt_eveve.cpp

示例15: strcpy

bool wb_vrepext::renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name &name) 
{
  if ( orep->oid().vid != m_vid) {
    *sts = LDH__BADOBJID;
    return false;
  }
  if ( !name) {
    *sts = name.sts();
    return false;
  }
  
  vext_sQMsg qmsg;
  vext_sAMsg amsg;

  qmsg.RenameObject.Oix = orep->oix();
  qmsg.RenameObject.Type = vext_eMsgType_RenameObject;
  strcpy( qmsg.RenameObject.Name, name.object());

  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.Any.Status)) {
    *sts = LDH__SUCCESS;
  }
  else {
    *sts = amsg.Any.Status;
    return false;
  }
  // Remove from cashe
  cashe_remove( orep->oid().oix);
  return true;
}
开发者ID:Strongc,项目名称:proview,代码行数:34,代码来源:wb_vrepext.cpp


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