本文整理汇总了C++中ODD函数的典型用法代码示例。如果您正苦于以下问题:C++ ODD函数的具体用法?C++ ODD怎么用?C++ ODD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ODD函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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( ¤t_time);
time_Adiff( &diff, ¤t_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
示例16: PostCreate
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
pwr_tOid Object,
pwr_tOid Father,
pwr_tCid Class
) {
pwr_tOid oid;
pwr_tOid toid;
pwr_tStatus sts;
int cnt = 0;
sts = ldh_GetClassList( Session, pwr_cClass_PlcThread, &oid);
while ( ODD(sts)) {
cnt++;
toid = oid;
sts = ldh_GetNextObject( Session, oid, &oid);
}
if ( cnt > 0) {
sts = ldh_SetObjectPar( Session, Object, "RtBody", "ThreadObject", (char *)&toid,
sizeof(toid));
if ( EVEN(sts)) return sts;
}
return PWRB__SUCCESS;
}
开发者ID:jordibrus,项目名称:proview,代码行数:25,代码来源:wb_c_plcpgm.cpp
示例17: activate_button
void XttMethodToolbarGtk::activate_button( GtkWidget *w, gpointer data)
{
XttMethodToolbarGtk *mt = ((xtt_sMethodButtonCb *)data)->mt;
int idx = ((xtt_sMethodButtonCb *)data)->idx;
int sts = 0;
int is_attr;
pwr_sAttrRef aref;
xmenu_eItemType menu_type;
if ( mt->get_select_cb)
sts = (mt->get_select_cb)( mt->m_parent_ctx, &aref, &is_attr);
if ( ODD(sts)) {
if ( aref.Flags.b.Object)
menu_type = xmenu_eItemType_Object;
else if ( aref.Flags.b.ObjectAttr)
menu_type = xmenu_eItemType_AttrObject;
else
menu_type = xmenu_eItemType_Attribute;
mt->m_xnav->call_method( mt->m_data[idx].method, mt->m_data[idx].filter, aref,
menu_type,
xmenu_mUtility_XNav,
mt->m_xnav->priv, 0);
}
}
开发者ID:Strongc,项目名称:proview,代码行数:27,代码来源:xtt_methodtoolbar_gtk.cpp
示例18: lchoose
double lchoose(double n, double k)
{
double k0 = k;
k = floor(k + 0.5);
#ifdef IEEE_754
/* NaNs propagated correctly */
if(ISNAN(n) || ISNAN(k)) return n + k;
#endif
if (fabs(k - k0) > 1e-7)
MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k);
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:dlebauer,项目名称:pecan-archives,代码行数:35,代码来源:choose.c
示例19: get_info_pixel
void GrowSlider::get_info_pixel( glow_eDirection *dir, double *max_position,
double *min_position, int bg_dyn_type)
{
GlowArrayElem *background;
glow_eDirection bg_dir;
double bg_max, bg_min;
int bg_found;
int sts;
double origo;
sts = ctx->get_background_object_limits(
(glow_eTraceType) bg_dyn_type,
(x_right + x_left) / 2, (y_low + y_high) / 2,
&background, &bg_min, &bg_max, &bg_dir);
if ( ODD(sts))
bg_found = 1;
else
bg_found = 0;
if ( !bg_found) {
*dir = direction;
if ( direction == glow_eDirection_Left ||
direction == glow_eDirection_Right) {
*max_position = max_pos * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
*min_position = min_pos * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
}
else {
*max_position = max_pos * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
*min_position = min_pos * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
}
}
else {
*dir = bg_dir;
get_origo( bg_dir, &origo);
switch ( bg_dir) {
case glow_eDirection_Right:
*max_position = (bg_max - origo) * ctx->mw.zoom_factor_x- ctx->mw.offset_x;
*min_position = (bg_min - origo) * ctx->mw.zoom_factor_x- ctx->mw.offset_x;
break;
case glow_eDirection_Left:
*max_position = (bg_max - (x_right - x_left - origo)) *
ctx->mw.zoom_factor_x- ctx->mw.offset_x;
*min_position = (bg_min - (x_right - x_left - origo)) *
ctx->mw.zoom_factor_x- ctx->mw.offset_x;
break;
case glow_eDirection_Down:
*max_position = (bg_max - origo) * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
*min_position = (bg_min - origo) * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
break;
case glow_eDirection_Up:
*max_position = (bg_max - (y_high - y_low - origo)) *
ctx->mw.zoom_factor_y - ctx->mw.offset_y;
*min_position = (bg_min - (y_high - y_low - origo)) *
ctx->mw.zoom_factor_y - ctx->mw.offset_y;
break;
default:
;
}
}
}
开发者ID:Strongc,项目名称:proview,代码行数:60,代码来源:glow_growslider.cpp
示例20: ShowConfiguration
// Show Configuration
static pwr_tStatus ShowConfiguration(xmenu_sMenuCall* ip)
{
pwr_tStatus sts;
xtt_pndevice_sCtx* ctx;
pwr_tFileName datafile;
sprintf(
datafile, "$pwrp_load/pwr_pn_%s.xml", id_to_string(ip->Pointed.Objid));
sts = xtt_pndevice_create_ctx(ip->Pointed, ip->EditorContext, &ctx);
if (EVEN(sts))
return sts;
ctx->attr = new GsdmlAttrQt(
CoXHelpQt::get_widget(), ctx, 0, ctx->gsdml, 0, datafile, &sts);
if (sts == PB__CONFIGABORTED) {
delete ctx->attr;
return 1;
}
ctx->attr->close_cb = xtt_pndevice_close_cb;
ctx->attr->save_cb = xtt_pndevice_save_cb;
ctx->attr->help_cb = xtt_pndevice_help_cb;
#if 0
if (ODD(sts))
sts = pndevice_init(ctx);
#endif
if (EVEN(sts)) {
ctx->attr->wow->DisplayError("Configuration load error",
"Configuration load error\nCheck configuration data");
}
return 1;
}
开发者ID:siamect,项目名称:proview,代码行数:34,代码来源:xtt_c_pndevice_qt.cpp
注:本文中的ODD函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论