本文整理汇总了C++中pwr_Return函数的典型用法代码示例。如果您正苦于以下问题:C++ pwr_Return函数的具体用法?C++ pwr_Return怎么用?C++ pwr_Return使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pwr_Return函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dbs_Address
void *
dbs_Address(pwr_tStatus *sts, const dbs_sVenv *vep, dbs_tRef r)
{
dbs_uRefBits bits;
if (r == dbs_cNref)
return NULL;
if (!vep->mp->flags.b.isMapped)
pwr_Return(NULL, sts, DBS__NOTMAPPED);
if (vep->index != 0) {
/*printf("index: %d, name %s\n", vep->index, vep->vp->name)*/;
}
bits.m = r;
if (bits.b.sect > dbs_eSect_)
pwr_Return(NULL, sts, DBS__BADSECT);
if (bits.b.offs >= vep->sect[bits.b.sect].size)
pwr_Return(NULL, sts, DBS__BADOFFS);
return (void *)(vep->base + vep->sect[bits.b.sect].offset + bits.b.offs);
}
示例2: gdb_AddNode
gdb_sNode *
gdb_AddNode (
pwr_tStatus *sts,
pwr_tNodeId nid,
pwr_tBitMask flags
)
{
gdb_sNode *np;
gdb_AssumeLocked;
np = hash_Search(sts, gdbroot->nid_ht, &nid);
if (np != NULL) return np;
if (np != NULL) {
if (flags & gdb_mAdd_failIfAdded)
pwr_Return(NULL, sts, GDB__DUPLADD);
else
pwr_Return(np, sts, GDB__ALRADD);
}
np = pool_Alloc(sts, gdbroot->pool, sizeof(*np));
if (np == NULL) return NULL;
np->nid = nid;
np->buf_id = 1; /* Next available buffer id */
pool_Qinit(NULL, gdbroot->pool, &np->nid_htl);
pool_Qinit(NULL, gdbroot->pool, &np->nod_ll);
pool_Qinit(NULL, gdbroot->pool, &np->own_lh);
pool_Qinit(NULL, gdbroot->pool, &np->ccvol_lh);
pool_Qinit(NULL, gdbroot->pool, &np->nodms_lh);
pool_Qinit(NULL, gdbroot->pool, &np->nodmo_lh);
pool_Qinit(NULL, gdbroot->pool, &np->subc_lh);
pool_Qinit(NULL, gdbroot->pool, &np->nodsubs_lh);
pool_Qinit(NULL, gdbroot->pool, &np->nodsubb_lh);
pool_Qinit(NULL, gdbroot->pool, &np->sansAct_lh);
pool_Qinit(NULL, gdbroot->pool, &np->sansUpd_lh);
pool_Qinit(NULL, gdbroot->pool, &np->sancAdd_lh);
pool_Qinit(NULL, gdbroot->pool, &np->sancRem_lh);
pool_Qinit(NULL, gdbroot->pool, &np->sancAct_lh);
pool_Qinit(NULL, gdbroot->pool, &np->cacheNode.lh);
#if defined OS_ELN
np->cacheNode.lc_max = 100;
#else
np->cacheNode.lc_max = 200;
#endif
np->cacheNode.flags.b.cacheNode = 1;
np->cacheNode.next = pool_Reference(NULL, gdbroot->pool, &gdbroot->db->cacheCom);
np = hash_Insert(sts, gdbroot->nid_ht, np);
if (np == NULL) errh_Bugcheck(GDH__WEIRD, "adding new node");
pool_QinsertPred(NULL, gdbroot->pool, &np->nod_ll, &gdbroot->db->nod_lh);
return np;
}
示例3: tree_Predecessor
void *
tree_Predecessor(pwr_tStatus *sts, tree_sTable *tp, void *np)
{
np = predecessorNode(tp, np);
if (np == tp->null) {
pwr_Return(NULL, sts, TREE__NOTFOUND);
} else {
pwr_Return(np, sts, TREE__FOUND);
}
}
示例4: tree_Minimum
void *
tree_Minimum(pwr_tStatus *sts, tree_sTable*tp)
{
tree_sNode *np;
np = minimumNode(tp, tp->root);
if (np == tp->null) {
pwr_Return(NULL, sts, TREE__NOTFOUND);
} else {
pwr_Return((void *)np, sts, TREE__FOUND);
}
}
示例5: tree_Find
void *
tree_Find(pwr_tStatus *sts, tree_sTable *tp, void *key)
{
tree_sNode *np;
np = findNode(tp, key);
if (np == tp->null) {
pwr_Return(NULL, sts, TREE__NOTFOUND);
} else {
pwr_Return((void *)np, sts, TREE__FOUND);
}
}
示例6: ptree_Predecessor
void* ptree_Predecessor(pwr_tStatus* sts, ptree_sTable* tp, void* np)
{
pool_tRef nr = pool_Reference(sts, tp->php, np);
nr = predecessorNode(tp, nr);
if (nr == tp->g->null)
pwr_Return(NULL, sts, TREE__NOTFOUND);
np = pool_Address(sts, tp->php, nr);
pwr_Return(np, sts, TREE__FOUND);
}
示例7: createTree
static tree_sTable *
createTree(
pwr_tStatus *sts,
size_t keySize,
ptrdiff_t keyOffset,
size_t recordSize,
unsigned int allocCount,
int (*compareFunc) (tree_sTable *tp, tree_sNode *x, tree_sNode *y))
{
tree_sTable *tp;
tp = (tree_sTable *) calloc(1, sizeof(*tp));
if (tp == NULL)
pwr_Return(NULL, sts, TREE__INSVIRMEM);
tp->keySize = keySize;
tp->keyOffset = keyOffset;
tp->recordSize = recordSize;
tp->allocCount = allocCount;
tp->compareFunc = compareFunc;
tp->null = allocNode(tp, NULL);
tp->key = allocNode(tp, NULL);
tp->root = tp->null;
tp->null->bal = 0;
tp->null->left = tp->null;
tp->null->right = tp->null;
tp->null->parent = tp->null;
return tp;
}
示例8: dbs_AlignedRead
pwr_tBoolean
dbs_AlignedRead(pwr_tStatus *sts, void *buf, pwr_tUInt32 size, const dbs_sEnv *ep)
{
int offset;
*sts = DBS__SUCCESS;
if (fread(buf, size, 1, ep->f) == 0)
pwr_Return(NO, sts, errno_GetStatus());
if ((offset = dbs_dPadding(size)) > 0)
if(fseek(ep->f, offset, SEEK_CUR))
pwr_Return(NO, sts, errno_GetStatus());
return YES;
}
示例9: cloneTree
static tree_sTable *
cloneTree(pwr_tStatus *sts, tree_sTable *otp)
{
tree_sTable *ntp;
ntp = (tree_sTable *) calloc(1, sizeof(*ntp));
if (ntp == NULL)
pwr_Return(NULL, sts, TREE__INSVIRMEM);
ntp->keySize = otp->keySize;
ntp->keyOffset = otp->keyOffset;
ntp->recordSize = otp->recordSize;
ntp->allocCount = otp->allocCount;
ntp->null = allocNode(ntp, NULL);
ntp->compareFunc = otp->compareFunc;
ntp->key = allocNode(ntp, NULL);
ntp->null->bal = 0;
ntp->null->left = ntp->null;
ntp->null->right = ntp->null;
ntp->null->parent = ntp->null;
ntp->root = copyNodes(ntp, ntp->null, otp, otp->root);
ntp->nNode = otp->nNode;
return ntp;
}
示例10: gdb_AddAliasServer
gdb_sAliasServer *
gdb_AddAliasServer (
pwr_tStatus *sts,
pwr_tObjid soid,
pwr_tBitMask flags
)
{
gdb_sAliasServer *asp;
gdb_sObject *op = NULL;
gdb_AssumeLocked;
pwr_Assert(cdh_ObjidIsNotNull(soid));
asp = hash_Search(sts, gdbroot->as_ht, &soid);
if (asp != NULL) {
if (flags & gdb_mAdd_failIfAdded)
pwr_Return(NULL, sts, GDB__DUPLADD);
else
pwr_Return(asp, sts, GDB__ALRADD);
}
asp = pool_Alloc(sts, gdbroot->pool, sizeof(*asp));
if (asp == NULL) return NULL;
asp->oid = soid;
pool_Qinit(NULL, gdbroot->pool, &asp->as_htl);
pool_Qinit(NULL, gdbroot->pool, &asp->as_ll);
pool_Qinit(NULL, gdbroot->pool, &asp->cli_lh);
asp = hash_Insert(sts, gdbroot->as_ht, asp);
if (asp == NULL) errh_Bugcheck(GDH__WEIRD, "adding new alias server");
pool_QinsertPred(NULL, gdbroot->pool, &asp->as_ll, &gdbroot->db->as_lh);
op = hash_Search(sts, gdbroot->oid_ht, &soid);
if (op == NULL) errh_Bugcheck(GDH__WEIRD, "getting alias server object");
op->g.flags.b.isAliasServer = 1;
return asp;
}
示例11: csup_Init
/*_*
@aref cyclesup CycleSup
*/
lst_sEntry *
csup_Init (
pwr_tStatus *status,
pwr_tObjid tid,
float scanTime
)
{
lst_sEntry *lh;
pwr_tObjid cid;
pwr_tObjid pid;
csup_sObject *cp;
int tv_sec;
pwr_tFloat32 max_delay;
pwr_dStatus(sts, status, CSUP__SUCCESS);
lh = calloc(1, sizeof(*lh));
if (lh == NULL)
pwr_Return(NULL, sts, CSUP__INSVIRMEM);
lst_Init(NULL, lh, NULL);
for (
*sts = gdh_GetClassList(pwr_cClass_CycleSup, &cid);
ODD(*sts);
*sts = gdh_GetNextObject(cid, &cid)
) {
cp = calloc(1, sizeof(*cp));
cp->aref.Objid = cid;
*sts = gdh_DLRefObjectInfoAttrref(&cp->aref, (void**)&cp->o, &cp->dlid);
if (EVEN(*sts))
goto error;
if ( ODD(gdh_GetParent( cid, &pid)) && cdh_ObjidIsEqual( pid, tid))
cp->is_owner = 1;
lst_InsertSucc(NULL, lh, &cp->le, cp);
max_delay = cp->o->MaxDelay;
cp->o->DelayLimit.tv_sec = tv_sec = (int)max_delay;
cp->o->DelayLimit.tv_nsec = (int)((max_delay - (float)tv_sec + FLT_EPSILON) * 1.0e9);
// printf("maxdelay: %f, tv_sec: %d, tv_nsec: %d\n", cp->o->MaxDelay, cp->o->DelayLimit.tv_sec, cp->o->DelayLimit.tv_nsec);
errh_Info("maxdelay: %f, tv_sec: %d, tv_nsec: %d", cp->o->MaxDelay,
cp->o->DelayLimit.tv_sec, cp->o->DelayLimit.tv_nsec);
}
if (lst_IsEmpty(NULL, lh))
goto error;
return lh;
error:
csup_Exit(NULL, lh);
return NULL;
}
示例12: tree_Insert
void *
tree_Insert(pwr_tStatus *sts, tree_sTable *tp, void *key)
{
tree_sNode *np;
tree_sNode *op;
np = findNode(tp, key);
if (np != tp->null)
pwr_Return((void *)np, sts, TREE__FOUND);
np = allocNode(tp, key);
if (np == NULL) return NULL;
op = insertNode(tp, np);
if (np == op) {
pwr_Return((void *)np, sts, TREE__INSERTED);
} else {
freeNode(tp, np);
pwr_Return(NULL, sts, TREE__ERROR);
}
}
示例13: gdb_AddVolume
gdb_sVolume *
gdb_AddVolume (
pwr_tStatus *sts,
pwr_tVolumeId vid,
pwr_tBitMask flags
)
{
gdb_sVolume *vp;
gdb_AssumeLocked;
vp = hash_Search(sts, gdbroot->vid_ht, &vid);
if (vp != NULL) {
if (flags & gdb_mAdd_failIfAdded)
pwr_Return(NULL, sts, GDB__DUPLADD);
else
pwr_Return(vp, sts, GDB__ALRADD);
}
vp = pool_Alloc(sts, gdbroot->pool, sizeof(*vp));
if (vp == NULL) return NULL;
vp->g.vid = vid;
vp->g.oid.vid = vid;
pool_Qinit(NULL, gdbroot->pool, &vp->l.vid_htl);
pool_Qinit(NULL, gdbroot->pool, &vp->l.vn_htl);
pool_Qinit(NULL, gdbroot->pool, &vp->l.vol_ll);
pool_Qinit(NULL, gdbroot->pool, &vp->l.own_ll);
pool_Qinit(NULL, gdbroot->pool, &vp->l.obj_lh);
pool_Qinit(NULL, gdbroot->pool, &vp->l.volms_lh);
hash_Insert(sts, gdbroot->vid_ht, vp);
vp->l.flags.b.inVidTable = 1;
pool_QinsertPred(sts, gdbroot->pool, &vp->l.vol_ll, &gdbroot->db->vol_lh);
vp->l.flags.b.inVolList = 1;
return vp;
}
示例14: gdb_AddMountServer
gdb_sMountServer *
gdb_AddMountServer (
pwr_tStatus *sts,
pwr_tObjid soid,
pwr_tBitMask flags
)
{
gdb_sMountServer *msp;
gdb_AssumeLocked;
// pwr_Assert(cdh_ObjidIsNotNull(soid));
if (cdh_ObjidIsNull(soid)) return NULL;
msp = hash_Search(sts, gdbroot->ms_ht, &soid);
if (msp != NULL) {
if (flags & gdb_mAdd_failIfAdded)
pwr_Return(NULL, sts, GDB__DUPLADD);
else
pwr_Return(msp, sts, GDB__ALRADD);
}
msp = pool_Alloc(sts, gdbroot->pool, sizeof(*msp));
if (msp == NULL) return NULL;
msp->oid = soid;
pool_Qinit(NULL, gdbroot->pool, &msp->ms_htl);
pool_Qinit(NULL, gdbroot->pool, &msp->ms_ll);
pool_Qinit(NULL, gdbroot->pool, &msp->nodms_ll);
pool_Qinit(NULL, gdbroot->pool, &msp->volms_ll);
pool_Qinit(NULL, gdbroot->pool, &msp->cli_lh);
msp = hash_Insert(sts, gdbroot->ms_ht, msp);
if (msp == NULL) errh_Bugcheck(GDH__WEIRD, "adding new mount server");
pool_QinsertPred(NULL, gdbroot->pool, &msp->ms_ll, &gdbroot->db->ms_lh);
return msp;
}
示例15: ConvertGet
static pwr_tBoolean
ConvertGet (
pwr_tStatus *sts,
qcom_sGet *get,
void *data
)
{
pwr_tStatus lsts;
XDR xdrs;
qdb_sNode *np;
tFuncXdr fXdr;
gdb_sNode *gnp;
pwr_tUInt32 netver;
if (get->type.b != net_cMsgClass)
pwr_Return(FALSE, sts, NET__XDRFAILED);
np = hash_Search(&lsts, &qdb->nid_ht, &get->sender.nid);
if (np == NULL) pwr_Return(FALSE, sts, lsts);
if ((int)get->type.s <= (int)net_eMsg__ || (int)get->type.s >= (int)net_eMsg_)
pwr_Return(FALSE, sts, NET__NOSUCHQCOMSUBT);
/* This is a simple way to fix the net_sGvolume difference between
* Neth version 7 and later. If this is needed for more messages
* then a generic solution must be implemented.
*/
fXdr = func_xdr[(int)get->type.s];
if (get->type.s == (qcom_eStype)net_eMsg_volumes) {
gdb_ScopeLock {
gnp = hash_Search(&lsts, gdbroot->nid_ht, &np->nid);
netver = gnp->netver;
} gdb_ScopeUnlock;
if (netver == 7) {
get->type.s = net_eMsg_volumes7;
fXdr = xdr_net_sVolumes7;
}
}