本文整理汇总了C++中STACK_PUSH函数的典型用法代码示例。如果您正苦于以下问题:C++ STACK_PUSH函数的具体用法?C++ STACK_PUSH怎么用?C++ STACK_PUSH使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STACK_PUSH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DEFAULT_STACK_INIT
bool PromoteIterator::nextImpl(store::Item_t& result, PlanState& planState) const
{
store::Item_t item;
store::Item_t temp;
const TypeManager* tm = theSctx->get_typemanager();
PlanIteratorState* state;
DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
if (!consumeNext(item, theChild.getp(), planState))
{
if (theQuantifier == SequenceType::QUANT_PLUS ||
theQuantifier == SequenceType::QUANT_ONE)
{
raiseError("empty-sequence()");
}
}
else if (theQuantifier == SequenceType::QUANT_QUESTION ||
theQuantifier == SequenceType::QUANT_ONE)
{
if (consumeNext(temp, theChild.getp(), planState))
{
raiseError("sequence of more than one item");
}
// catch exceptions to add/change the error location
if (! GenericCast::promote(result, item, thePromoteType, &theNsCtx, tm, loc))
{
zstring valueType = tm->create_value_type(item)->toSchemaString();
raiseError(valueType);
}
STACK_PUSH(true, state);
}
else
{
do
{
if (! GenericCast::promote(result, item, thePromoteType, &theNsCtx, tm, loc))
{
zstring valueType = tm->create_value_type(item)->toSchemaString();
raiseError(valueType);
}
else
{
STACK_PUSH(true, state);
}
}
while (consumeNext(item, theChild.getp(), planState));
}
STACK_END(state);
}
示例2: op_not
static void op_not(void)
{
int val;
if (stack.sp < 1)
return;
STACK_POP(val);
if (val)
STACK_PUSH(0);
else
STACK_PUSH(1);
}
示例3: get_req_entry
void Row_mvcc::buffer_req(TsType type, TxnManager * txn)
{
MVReqEntry * req_entry = get_req_entry();
assert(req_entry != NULL);
req_entry->txn = txn;
req_entry->ts = txn->get_timestamp();
req_entry->starttime = get_sys_clock();
if (type == R_REQ) {
rreq_len ++;
STACK_PUSH(readreq_mvcc, req_entry);
} else if (type == P_REQ) {
preq_len ++;
STACK_PUSH(prereq_mvcc, req_entry);
}
}
示例4: DEFAULT_STACK_INIT
bool
DeleteIterator::nextImpl(store::Item_t& result, PlanState& aPlanState) const
{
store::Item_t target;
std::unique_ptr<store::PUL> pul;
PlanIteratorState* state;
DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
pul.reset(GENV_ITEMFACTORY->createPendingUpdateList());
while (consumeNext(target, theChild, aPlanState))
{
if (!target->isNode())
throw XQUERY_EXCEPTION( err::XUTY0007, ERROR_LOC( loc ) );
areNodeModifiersViolated(theSctx, target, loc);
pul->addDelete(&loc, target);
}
result = pul.release();
STACK_PUSH(true, state);
STACK_END(state);
}
示例5: DEFAULT_STACK_INIT
/*******************************************************************************
declare function
is-available-document($uri as xs:string) as xs:boolean
********************************************************************************/
bool IsAvailableDocumentIterator::nextImpl(
store::Item_t& result,
PlanState& aPlanState) const
{
zstring lRetrievedUriString;
zstring lResolvedUriString;
store::Item_t lUri;
PlanIteratorState* state;
DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
consumeNext(lUri, theChildren[0].getp(), aPlanState);
// absolutize retrieved uri
try
{
lUri->getStringValue2(lRetrievedUriString);
lResolvedUriString = theSctx->resolve_relative_uri(lRetrievedUriString, true);
}
catch (ZorbaException const&)
{
RAISE_ERROR(err::FODC0004, loc,
ERROR_PARAMS(lResolvedUriString, ZED(NoResolveRelativeURI)));
}
// check if document exists in the store
GENV_ITEMFACTORY->
createBoolean(result, GENV_STORE.getDocument(lResolvedUriString) != NULL);
STACK_PUSH(true, state);
STACK_END(state);
}
示例6: DEFAULT_STACK_INIT
bool FunctionNameIterator::nextImpl(
store::Item_t& r,
PlanState& planState) const
{
store::Item_t lFItem;
FunctionItem* lFunctionItem = 0;
PlanIteratorState* state;
DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
consumeNext(lFItem, theChildren[0], planState);
// function signature guarantees that
ZORBA_ASSERT(lFItem->isFunction());
lFunctionItem = static_cast<FunctionItem*>(lFItem.getp());
if ((!lFunctionItem->isInline() || lFunctionItem->isCoercion())
&&
lFunctionItem->getFunctionName()
&&
(lFunctionItem->getArity() == lFunctionItem->getStartArity()))
{
// non-inline function
r = lFunctionItem->getFunctionName();
STACK_PUSH(true, state);
}
STACK_END(state);
}
示例7: DEFAULT_STACK_INIT
bool JSoundValidateIterator::nextImpl( store::Item_t &result,
PlanState &plan_state ) const {
bool cast = cast_default;
store::Item_t jsd_item, type_item, json_item, options_item;
PlanIteratorState *state;
DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
consumeNext( jsd_item, theChildren[0], plan_state );
consumeNext( type_item, theChildren[1], plan_state );
consumeNext( json_item, theChildren[2], plan_state );
consumeNext( options_item, theChildren[3], plan_state );
try {
get_bool_opt( options_item, "cast-atomic-values", &cast );
jsound::schema const schema( jsd_item );
GENV_ITEMFACTORY->createBoolean(
result, schema.validate( json_item, type_item->getStringValue(), cast )
);
}
catch ( ZorbaException &e ) {
set_source( e, loc, false );
throw;
}
STACK_PUSH( true, state );
STACK_END( state );
}
示例8: DEFAULT_STACK_INIT
bool OpNumericUnaryIterator::nextImpl(store::Item_t& result, PlanState& planState) const
{
store::Item_t item;
store::SchemaTypeCode type;
const TypeManager* tm = theSctx->get_typemanager();
PlanIteratorState* state;
DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
if (consumeNext(item, theChild.getp(), planState ))
{
assert(item->isAtomic());
type = item->getTypeCode();
if (type == store::XS_UNTYPED_ATOMIC)
{
GenericCast::castToBuiltinAtomic(item, item, store::XS_DOUBLE, NULL, loc);
type = store::XS_DOUBLE;
}
// TODO Optimizations (e.g. if item has already the correct type and value,
// it does not have to be created newly)
if (TypeOps::is_subtype(type, store::XS_DOUBLE))
{
GENV_ITEMFACTORY->
createDouble(result,
(thePlus ? item->getDoubleValue() : -item->getDoubleValue()));
}
else if (TypeOps::is_subtype(type, store::XS_FLOAT))
{
GENV_ITEMFACTORY->
createFloat(result,
(thePlus ? item->getFloatValue() : -item->getFloatValue()));
}
else if (TypeOps::is_subtype(type, store::XS_INTEGER))
{
GENV_ITEMFACTORY->
createInteger(result,
(thePlus ? item->getIntegerValue() : -item->getIntegerValue()));
}
else if (TypeOps::is_subtype(type, store::XS_DECIMAL))
{
GENV_ITEMFACTORY->
createDecimal(result,
(thePlus ? item->getDecimalValue() : -item->getDecimalValue()));
}
else
{
xqtref_t type = tm->create_value_type(item);
RAISE_ERROR(err::XPTY0004, loc,
ERROR_PARAMS(ZED(BadTypeFor_23), type->toSchemaString(), ZED(UnaryArithOp)));
}
STACK_PUSH(true, state);
}
STACK_END(state);
}
示例9: DEFAULT_STACK_INIT
bool
IndexKeysIterator::nextImpl(
store::Item_t& result,
PlanState& aPlanState) const
{
store::Item_t lQName;
IndexDecl_t indexDecl;
store::IndexKey lKey;
store::Item_t lKeyNodeName;
GENV_ITEMFACTORY->createQName(lKeyNodeName,
static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS,
"", "key");
IndexKeysIteratorState* state;
DEFAULT_STACK_INIT(IndexKeysIteratorState, state, aPlanState);
consumeNext(lQName, theChildren[0].getp(), aPlanState);
if ((indexDecl = theSctx->lookup_index(lQName)) == NULL)
{
throw XQUERY_EXCEPTION(
zerr::ZDDY0021_INDEX_NOT_DECLARED,
ERROR_PARAMS( lQName->getStringValue() ),
ERROR_LOC( loc )
);
}
state->theIndex = GENV_STORE.getIndex(lQName);
if (!state->theIndex)
{
throw XQUERY_EXCEPTION(
zerr::ZDDY0023_INDEX_DOES_NOT_EXIST,
ERROR_PARAMS( lQName->getStringValue() ),
ERROR_LOC( loc )
);
}
state->theIter = state->theIndex->keys();
state->theIter->open();
// generate result elements of the form
// <key>
// <attribute value="key1_value"/>
// <attribute value="key2_value"/>
// <attribute value="key3_value"/>
// </key>
while (state->theIter->next(lKey))
{
IndexUtil::createIndexKeyElement(
state->theIndex->getSpecification().theIsGeneral,
result, lKey, static_context::ZORBA_STORE_STATIC_INDEXES_DML_FN_NS
);
STACK_PUSH(true, state);
}
STACK_END(state);
}
示例10: DEFAULT_STACK_INIT
bool
ZorbaValidateInPlaceIterator::nextImpl(store::Item_t& result, PlanState& planState) const
{
store::Item_t node;
PlanIteratorState* state;
store::PUL_t pul;
DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
if (consumeNext(node, theChild.getp(), planState))
{
// verify that if the element being revalidated is an element it is the root
if (node->getNodeKind()==store::StoreConsts::elementNode &&
node->getParent() &&
node->getParent()->getNodeKind()!=store::StoreConsts::documentNode)
throw XQUERY_EXCEPTION( zerr::ZAPI0090_CANNOT_VALIDATE_NON_ROOT, ERROR_LOC( loc ) );
pul = GENV_ITEMFACTORY->createPendingUpdateList();
pul->addRevalidate(&loc,node);
result.transfer(pul);
STACK_PUSH(true, state);
}
STACK_END(state);
}
示例11: push
static void
push(void **block)
{
void *obj = *block;
struct segment *seg;
size_t index;
bitptr_t b;
if (!IS_IN_HEAP(obj)) {
DBG(("%p at %p outside", obj, block));
if (obj != NULL)
sml_trace_ptr(obj);
return;
}
seg = OBJ_TO_SEGMENT(obj);
index = OBJ_TO_INDEX(seg, obj);
BITPTR_INIT(b, BITMAP0_BASE(seg), index);
if (BITPTR_TEST(b)) {
DBG(("already marked: %p", obj));
return;
}
MARKBIT(b, index, seg);
DBG(("MARK: %p", obj));
if (OBJ_HAS_NO_POINTER(obj)) {
DBG(("EARLYMARK: %p", obj));
return;
}
STACK_PUSH(obj, seg, index);
DBG(("PUSH: %p", obj));
}
示例12: push_object
static void
push_object (SCHEME_OBJECT object)
{
stack_pointer = ((SCHEME_OBJECT *) (WREG_REF (SVM1_REG_STACK_POINTER)));
STACK_PUSH (object);
WREG_SET (SVM1_REG_STACK_POINTER, ((SCHEME_OBJECT) stack_pointer));
}
示例13: DEFAULT_STACK_INIT
bool ForIterator::nextImpl(store::Item_t& aResult, PlanState& aPlanState) const
{
ForState* lState;
store::Item_t lItem;
DEFAULT_STACK_INIT(ForState, lState, aPlanState);
while (consumeNext(aResult, theChild0, aPlanState))
{
while (consumeNext(lItem, theChild1, aPlanState))
{
bindVariables(lItem, theVarRefs, aPlanState);
if (theHasPosVars)
{
store::Item_t lPosItem;
GENV_ITEMFACTORY->createInteger(lPosItem,
xs_integer(lState->incReturnPosition()));
bindVariables(lPosItem, thePosVarRefs, aPlanState);
}
STACK_PUSH(true, lState);
}
lState->resetPosition();
theChild1->reset(aPlanState);
}
STACK_END(lState);
}
示例14: DEFAULT_STACK_INIT
bool
IsFollowingSiblingPositionIterator::nextImpl(store::Item_t& result, PlanState& planState) const
{
store::Item_t lUriA;
store::Item_t lUriB;
PlanIteratorState* state;
DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
consumeNext(lUriA, theChildren[0].getp(), planState);
consumeNext(lUriB, theChildren[1].getp(), planState);
try
{
GENV_ITEMFACTORY->createBoolean(result, lUriA->isFollowingSibling(lUriB));
}
catch (ZorbaException& e)
{
set_source(e, loc);
throw;
}
STACK_PUSH(true,state);
STACK_END (state);
}
示例15: DEFAULT_STACK_INIT
bool JSONtoXMLInternal::nextImpl( store::Item_t& result,
PlanState &planState ) const {
store::Item_t item;
options_type options;
PlanIteratorState *state;
DEFAULT_STACK_INIT( PlanIteratorState, state, planState );
ZORBA_ASSERT( theChildren.size() == 2 );
consumeNext( item, theChildren[1], planState );
get_options( item, &options );
consumeNext( item, theChildren[0], planState );
result = nullptr;
{ // local scope
options_type::mapped_type const &format_opt = options[ "json-format" ];
ZORBA_ASSERT( !format_opt.empty() );
if ( format_opt == "Snelson" )
snelson::json_to_xml( item, &result );
else if ( format_opt == "JsonML" || format_opt == "JsonML-array" )
jsonml_array::json_to_xml( item, &result );
else if ( format_opt == "JsonML-object" )
jsonml_object::json_to_xml( item, &result );
else
ZORBA_ASSERT( false );
} // local scope
STACK_PUSH( !!result, state );
STACK_END( state );
}