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


C++ STACK_END函数代码示例

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


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

示例1: 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);
}
开发者ID:alyst,项目名称:zorba,代码行数:60,代码来源:index_func_impl.cpp

示例2: 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);
}
开发者ID:alyst,项目名称:zorba,代码行数:60,代码来源:NumericsImpl.cpp

示例3: init_keepers

/*
* Initialize keeper states
*
* If there is a problem, return an error message (NULL for okay).
*
* Note: Any problems would be design flaws; the created Lua state is left
*       unclosed, because it does not really matter. In production code, this
*       function never fails.
*/
char const* init_keepers( int const _nbKeepers, lua_CFunction _on_state_create)
{
	int i;
	assert( _nbKeepers >= 1);
	GNbKeepers = _nbKeepers;
	GKeepers = malloc( _nbKeepers * sizeof( struct s_Keeper));
	for( i = 0; i < _nbKeepers; ++ i)
	{

		// We need to load all base libraries in the keeper states so that the transfer databases are populated properly
		// 
		// 'io' for debugging messages, 'package' because we need to require modules exporting idfuncs
		// the others because they export functions that we may store in a keeper for transfer between lanes
		lua_State* K = luaG_newstate( "*", _on_state_create);
		if (!K)
			return "out of memory";

		STACK_CHECK( K)
		// to see VM name in Decoda debugger
		lua_pushliteral( K, "Keeper #");
		lua_pushinteger( K, i + 1);
		lua_concat( K, 2);
		lua_setglobal( K, "decoda_name");

#if KEEPER_MODEL == KEEPER_MODEL_C
		// create the fifos table in the keeper state
		lua_pushlightuserdata( K, fifos_key);
		lua_newtable( K);
		lua_rawset( K, LUA_REGISTRYINDEX);
#endif // KEEPER_MODEL == KEEPER_MODEL_C

#if KEEPER_MODEL == KEEPER_MODEL_LUA
		// use package.loaders[2] to find keeper microcode
		lua_getglobal( K, "package");                  // package
		lua_getfield( K, -1, "loaders");               // package package.loaders
		lua_rawgeti( K, -1, 2);                        // package package.loaders package.loaders[2]
		lua_pushliteral( K, "lanes-keeper");           // package package.loaders package.loaders[2] "lanes-keeper"
		STACK_MID( K, 4);
		// first pcall loads lanes-keeper.lua, second one runs the chunk
		if( lua_pcall( K, 1 /*args*/, 1 /*results*/, 0 /*errfunc*/) || lua_pcall( K, 0 /*args*/, 0 /*results*/, 0 /*errfunc*/))
		{
			// LUA_ERRRUN / LUA_ERRMEM / LUA_ERRERR
			//
			char const* err = lua_tostring( K, -1);
			assert( err);
			return err;
		}                                              // package package.loaders
		STACK_MID( K, 2);
		lua_pop( K, 2);
#endif // KEEPER_MODEL == KEEPER_MODEL_LUA
		STACK_END( K, 0)
		MUTEX_INIT( &GKeepers[i].lock_);
		GKeepers[i].L = K;
		//GKeepers[i].count = 0;
	}
#if HAVE_KEEPER_ATEXIT_DESINIT
	atexit( atexit_close_keepers);
#endif // HAVE_KEEPER_ATEXIT_DESINIT
	return NULL;    // ok
}
开发者ID:Abyss116,项目名称:luaplus51-all,代码行数:69,代码来源:keeper.c

示例4: 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);
}
开发者ID:alyst,项目名称:zorba,代码行数:37,代码来源:documents_impl.cpp

示例5: 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);
}
开发者ID:zorba-processor,项目名称:zorba,代码行数:26,代码来源:node_position_impl.cpp

示例6: luaG_newdeepuserdata

/*
* Create a deep userdata
*
*   proxy_ud= deep_userdata( idfunc [, ...] )
*
* Creates a deep userdata entry of the type defined by 'idfunc'.
* Other parameters are passed on to the 'idfunc' "new" invocation.
*
* 'idfunc' must fulfill the following features:
*
*   lightuserdata = idfunc( eDO_new [, ...] )      -- creates a new deep data instance
*   void = idfunc( eDO_delete, lightuserdata )     -- releases a deep data instance
*   tbl = idfunc( eDO_metatable )                  -- gives metatable for userdata proxies
*
* Reference counting and true userdata proxying are taken care of for the
* actual data type.
*
* Types using the deep userdata system (and only those!) can be passed between
* separate Lua states via 'luaG_inter_move()'.
*
* Returns:  'proxy' userdata for accessing the deep data via 'luaG_todeep()'
*/
int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction idfunc)
{
	char const* errmsg;
	DEEP_PRELUDE* prelude = DEEP_MALLOC( sizeof(DEEP_PRELUDE));
	if( prelude == NULL)
	{
		return luaL_error( L, "couldn't not allocate deep prelude: out of memory");
	}

	prelude->refcount = 0; // 'push_deep_proxy' will lift it to 1
	prelude->idfunc = idfunc;

	STACK_GROW( L, 1);
	STACK_CHECK( L);
	{
		int oldtop = lua_gettop( L);
		prelude->deep = idfunc( L, eDO_new);
		if( prelude->deep == NULL)
		{
			luaL_error( L, "idfunc(eDO_new) failed to create deep userdata (out of memory)");
		}

		if( lua_gettop( L) - oldtop != 0)
		{
			luaL_error( L, "Bad idfunc(eDO_new): should not push anything on the stack");
		}
	}
	errmsg = push_deep_proxy( get_universe( L), L, prelude, eLM_LaneBody);  // proxy
	if( errmsg != NULL)
	{
		luaL_error( L, errmsg);
	}
	STACK_END( L, 1);
	return 1;
}
开发者ID:HighlandersFRC,项目名称:2015-lua,代码行数:57,代码来源:deep.c

示例7: get_idfunc

/*
* Return the registered ID function for 'index' (deep userdata proxy),
* or NULL if 'index' is not a deep userdata proxy.
*/
static inline luaG_IdFunction get_idfunc( lua_State* L, int index, enum eLookupMode mode_)
{
	// when looking inside a keeper, we are 100% sure the object is a deep userdata
	if( mode_ == eLM_FromKeeper)
	{
		DEEP_PRELUDE** proxy = (DEEP_PRELUDE**) lua_touserdata( L, index);
		// we can (and must) cast and fetch the internally stored idfunc
		return (*proxy)->idfunc;
	}
	else
	{
		// essentially we are making sure that the metatable of the object we want to copy is stored in our metatable/idfunc database
		// it is the only way to ensure that the userdata is indeed a deep userdata!
		// of course, we could just trust the caller, but we won't
		luaG_IdFunction ret;
		STACK_GROW( L, 1);
		STACK_CHECK( L);

		if( !lua_getmetatable( L, index))       // deep ... metatable?
		{
			return NULL;    // no metatable: can't be a deep userdata object!
		}

		// replace metatable with the idfunc pointer, if it is actually a deep userdata
		get_deep_lookup( L);                    // deep ... idfunc|nil

		ret = (luaG_IdFunction) lua_touserdata( L, -1); // NULL if not a userdata
		lua_pop( L, 1);
		STACK_END( L, 0);
		return ret;
	}
}
开发者ID:HighlandersFRC,项目名称:2015-lua,代码行数:36,代码来源:deep.c

示例8: 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);
}
开发者ID:zorba-processor,项目名称:zorba,代码行数:28,代码来源:schema_impl.cpp

示例9: push_registry_subtable

/*
* Push a registry subtable (keyed by unique 'token') onto the stack.
* If the subtable does not exist, it is created and chained.
*/
static
void push_registry_subtable( lua_State *L, void *token ) {

    STACK_GROW(L,3);

  STACK_CHECK(L)
    
    lua_pushlightuserdata( L, token );
    lua_rawget( L, LUA_REGISTRYINDEX );
        //
        // [-1]: nil/subtable
    
    if (lua_isnil(L,-1)) {
        lua_pop(L,1);
        lua_newtable(L);                    // value
        lua_pushlightuserdata( L, token );  // key
        lua_pushvalue(L,-2);
            //
            // [-3]: value (2nd ref)
            // [-2]: key
            // [-1]: value

        lua_rawset( L, LUA_REGISTRYINDEX );
    }
  STACK_END(L,1)

    ASSERT_L( lua_istable(L,-1) );
}
开发者ID:cloudkick,项目名称:ck-agent,代码行数:32,代码来源:tools.c

示例10: getTypeManager

bool SeqValueExceptIterator::nextImpl( store::Item_t &result,
                                       PlanState &plan_state ) const {
  XQPCollator *const coll = theSctx->get_default_collator( loc );
  store::Item_t item;
  TypeManager *const tm = getTypeManager();
  long tz;

  SeqValueExceptIteratorState *state;
  DEFAULT_STACK_INIT( SeqValueExceptIteratorState, state, plan_state );

  tz = plan_state.theLocalDynCtx->get_implicit_timezone();
  state->set_ = new_Item_set( tm, tz, coll, loc );

  while ( consumeNext( item, theChildren[1], plan_state ) )
    if ( state->set_->insert( item.getp() ).second )
      item->addReference();

  while ( consumeNext( item, theChildren[0], plan_state ) )
    if ( state->set_->insert( item.getp() ).second ) {
      item->addReference();
      result = item;
      STACK_PUSH( true, state );
    }

  delete_Item_set( state->set_ );
  STACK_END( state );
}
开发者ID:alyst,项目名称:zorba,代码行数:27,代码来源:seq_impl.cpp

示例11: populate_keepers

// cause each keeper state to populate its database of transferable functions with those from the specified module
// do do this we simply require the module inside the keeper state, then populate the lookup database
void populate_keepers( lua_State* L)
{
	size_t name_len;
	char const* name = luaL_checklstring( L, -1, &name_len);
	int i;

	DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "populate_keepers %s BEGIN\n" INDENT_END, name));
	DEBUGSPEW_CODE( ++ debugspew_indent_depth);

	for( i = 0; i < GNbKeepers; ++ i)
	{
		lua_State* K = GKeepers[i].L;
		int res;
		MUTEX_LOCK( &GKeepers[i].lock_);
		STACK_CHECK( K);
		STACK_GROW( K, 2);
		lua_getglobal( K, "require");
		lua_pushlstring( K, name, name_len);
		res = lua_pcall( K, 1, 1, 0);
		if( res != LUA_OK)
		{
			char const* err = luaL_checkstring( K, -1);
			luaL_error( L, "error requiring '%s' in keeper state: %s", name, err);
		}
		// after requiring the module, register the functions it exported in our name<->function database
		populate_func_lookup_table( K, -1, name);
		lua_pop( K, 1);
		STACK_END( K, 0);
		MUTEX_UNLOCK( &GKeepers[i].lock_);
	}
	DEBUGSPEW_CODE( -- debugspew_indent_depth);
}
开发者ID:AntonioModer,项目名称:lua-files,代码行数:34,代码来源:keeper.c

示例12: 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 );
}
开发者ID:alyst,项目名称:zorba,代码行数:28,代码来源:jsound_impl.cpp

示例13: 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);
}
开发者ID:buchenberg,项目名称:zorba,代码行数:25,代码来源:update.cpp

示例14: 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);
}
开发者ID:zorba-processor,项目名称:zorba,代码行数:30,代码来源:fn_hof_functions_impl.cpp

示例15: push_registry_subtable_mode

/*
* Does what the original 'push_registry_subtable' function did, but adds an optional mode argument to it
*/
void push_registry_subtable_mode( lua_State* L, void* key_, const char* mode_)
{
	STACK_GROW( L, 3);
	STACK_CHECK( L);

	lua_pushlightuserdata( L, key_);                      // key
	lua_rawget( L, LUA_REGISTRYINDEX);                    // {}|nil

	if( lua_isnil( L, -1))
	{
		lua_pop( L, 1);                                     //
		lua_newtable( L);                                   // {}
		lua_pushlightuserdata( L, key_);                    // {} key
		lua_pushvalue( L, -2);                              // {} key {}

		// _R[key_] = {}
		lua_rawset( L, LUA_REGISTRYINDEX);                  // {}

		// Set its metatable if requested
		if( mode_)
		{
			lua_newtable( L);                                 // {} mt
			lua_pushliteral( L, "__mode");                    // {} mt "__mode"
			lua_pushstring( L, mode_);                        // {} mt "__mode" mode
			lua_rawset( L, -3);                               // {} mt
			lua_setmetatable( L, -2);                         // {}
		}
	}
	STACK_END( L, 1);
	ASSERT_L( lua_istable( L, -1));
}
开发者ID:HighlandersFRC,项目名称:2015-lua,代码行数:34,代码来源:deep.c


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