• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LINK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _3dsLoadSubChunks

bool _3dsLoadSubChunks(HANDLE h, CHUNK *root, DWORD offset, DWORD length)
{
	while(length)
	{
		SetFilePointer(h, offset, 0, 0);

		CHUNK *chunk;
		chunk = new CHUNK;
		memset(chunk, 0, sizeof(CHUNK));
		LINK(root->Child, chunk);
		chunk->offset = offset;

		DWORD dwR = 0;
		ReadFile(h, &chunk->hdr, sizeof(CHUNK_HDR), &dwR, 0);
		if(dwR != sizeof(CHUNK_HDR))
		{
			ErrorMsg("read error");
			return false;
		}

		length -= chunk->hdr.length;
		offset += chunk->hdr.length;

		switch(chunk->hdr.id)
		{
		// just read data
		case POINT_ARRAY:
		case MSH_MAT_GROUP:
		case MAT_NAME:
		case COLOR_24:
		case MAT_MAPNAME:
		case TEX_VERTS:
			chunk->data_size = chunk->hdr.length - sizeof(CHUNK_HDR);
			chunk->data = _3dsLoadData(h, chunk->offset + sizeof(CHUNK_HDR), chunk->data_size);
			if(!chunk->data) return false;
			break;

		// just read chunks
		case MDATA:
		case N_TRI_OBJECT:
		case MAT_ENTRY:
		case MAT_DIFFUSE:
		case MAT_SPECULAR:
		case MAT_TEXMAP:
			if(!_3dsLoadSubChunks(h, chunk, chunk->offset + sizeof(CHUNK_HDR), chunk->hdr.length - sizeof(CHUNK_HDR))) return false;
			break;

		case NAMED_OBJECT:
			{
				char str[11];
				dwR = 0;
				ReadFile(h, str, 11, &dwR, 0);
				if(dwR != 11)
				{
					ErrorMsg("read error");
					return false;
				}

				chunk->data_size = strlen(str) + 1;
				chunk->data = malloc(chunk->data_size);
				memcpy(chunk->data, str, chunk->data_size);

				if(!_3dsLoadSubChunks(h, chunk, chunk->offset + sizeof(CHUNK_HDR) + chunk->data_size, chunk->hdr.length - sizeof(CHUNK_HDR) - chunk->data_size)) return false;
			}
			break;

		case FACE_ARRAY:
			{
				WORD w;
				dwR = 0;
				ReadFile(h, &w, sizeof(WORD), &dwR, 0);
				if(dwR != sizeof(WORD))
				{
					ErrorMsg("read error");
					return false;
				}

				chunk->data_size = sizeof(WORD) + w * sizeof(_3DS_FACE);
				chunk->data = _3dsLoadData(h, chunk->offset + sizeof(CHUNK_HDR), chunk->data_size);

				if(!_3dsLoadSubChunks(h, chunk, chunk->offset + sizeof(CHUNK_HDR) + chunk->data_size, chunk->hdr.length - sizeof(CHUNK_HDR) - chunk->data_size)) return false;
			}
			break;

		default: // unknow
			UNLINK(root->Child, chunk);
			delete chunk;
		}
	}

	return true;
}
开发者ID:Brandantl,项目名称:Pop-World-Editor,代码行数:92,代码来源:_3ds.cpp


示例2: process

    virtual void process() override
    {
        ActPrintLog("INDEXWRITE: Start");
        init();

        IRowStream *stream = inputStream;
        ThorDataLinkMetaInfo info;
        input->getMetaInfo(info);
        outRowAllocator.setown(getRowAllocator(helper->queryDiskRecordSize()));
        start();
        if (refactor)
        {
            assertex(isLocal);
            if (active)
            {
                unsigned targetWidth = partDesc->queryOwner().numParts()-(buildTlk?1:0);
                assertex(0 == container.queryJob().querySlaves() % targetWidth);
                unsigned partsPerNode = container.queryJob().querySlaves() / targetWidth;
                unsigned myPart = queryJobChannel().queryMyRank();

                IArrayOf<IRowStream> streams;
                streams.append(*LINK(stream));
                --partsPerNode;

 // Should this be merging 1,11,21,31 etc.
                unsigned p=0;
                unsigned fromPart = targetWidth+1 + (partsPerNode * (myPart-1));
                for (; p<partsPerNode; p++)
                {
                    streams.append(*createRowStreamFromNode(*this, fromPart++, queryJobChannel().queryJobComm(), mpTag, abortSoon));
                }
                ICompare *icompare = helper->queryCompare();
                assertex(icompare);
                Owned<IRowLinkCounter> linkCounter = new CThorRowLinkCounter;
                myInputStream.setown(createRowStreamMerger(streams.ordinality(), streams.getArray(), icompare, false, linkCounter));
                stream = myInputStream;
            }
            else // serve nodes, creating merged parts
                rowServer.setown(createRowServer(this, stream, queryJobChannel().queryJobComm(), mpTag));
        }
        processed = THORDATALINK_STARTED;

        // single part key support
        // has to serially pull all data fron nodes 2-N
        // nodes 2-N, could/should start pushing some data (as it's supposed to be small) to cut down on serial nature.
        unsigned node = queryJobChannel().queryMyRank();
        if (singlePartKey)
        {
            if (1 == node)
            {
                try
                {
                    open(*partDesc, false, helper->queryDiskRecordSize()->isVariableSize());
                    loop
                    {
                        OwnedConstThorRow row = inputStream->ungroupedNextRow();
                        if (!row)
                            break;
                        if (abortSoon) return;
                        processRow(row);
                    }

                    unsigned node = 2;
                    while (node <= container.queryJob().querySlaves())
                    {
                        Linked<IOutputRowDeserializer> deserializer = ::queryRowDeserializer(input);
                        CMessageBuffer mb;
                        Owned<ISerialStream> stream = createMemoryBufferSerialStream(mb);
                        CThorStreamDeserializerSource rowSource;
                        rowSource.setStream(stream);
                        bool successSR;
                        loop
                        {
                            {
                                BooleanOnOff tf(receivingTag2);
                                successSR = queryJobChannel().queryJobComm().sendRecv(mb, node, mpTag2);
                            }
                            if (successSR)
                            {
                                if (rowSource.eos())
                                    break;
                                Linked<IEngineRowAllocator> allocator = ::queryRowAllocator(input);
                                do
                                {
                                    RtlDynamicRowBuilder rowBuilder(allocator);
                                    size32_t sz = deserializer->deserialize(rowBuilder, rowSource);
                                    OwnedConstThorRow fRow = rowBuilder.finalizeRowClear(sz);
                                    processRow(fRow);
                                }
                                while (!rowSource.eos());
                            }
                        }
                        node++;
                    }
                }
                catch (CATCHALL)
                {
                    close(*partDesc, partCrc, true);
                    throw;
                }
//.........这里部分代码省略.........
开发者ID:bolaria,项目名称:HPCC-Platform,代码行数:101,代码来源:thindexwriteslave.cpp


示例3: depthFirstSearch

void LengauerTarjan::immediateDominators(){

    uint32_t dfsNo = 0;
    depthFirstSearch(rootLoc,&dfsNo);

    size[0]  = 0;
    label[0] = 0;
    semi[0]  = 0;

    for(int32_t i=reachableCount;i>1;i--){
        uint32_t vertexW =  vertex[i];

        BasicBlock* bb = locToBasicBlock[vertexW];
        ASSERT(bb && "Basic Block should be initialized");
        uint32_t numberOfSources = bb->getNumberOfSources();

        for(uint32_t j=0;j<numberOfSources;j++){
            BasicBlock* source = bb->getSourceBlock(j);
            if(!source->isUnreachable()){
                uint32_t vertexV = basicBlockToLoc[source->getIndex()];
                uint32_t vertexU = EVAL(vertexV);
                if(semi[vertexU] < semi[vertexW]){
                    semi[vertexW] = semi[vertexU];
                }
            }
        }

        bucket[vertex[semi[vertexW]]].insert(vertexW);

        LINK(parent[vertexW],vertexW);

        LinkedList<uint32_t>* bs = &(bucket[parent[vertexW]]);
        while(!bs->empty()){
            uint32_t vertexV = bs->shift();
            uint32_t vertexU = EVAL(vertexV);
            dom[vertexV] = ( semi[vertexU] < semi[vertexV] ) ? vertexU : parent[vertexW];
        }
    }
    for(uint32_t i=2;i<=reachableCount;i++){
        uint32_t vertexW = vertex[i];
        if(dom[vertexW] != vertex[semi[vertexW]]){
            dom[vertexW] = dom[dom[vertexW]];
        }
    }

    dom[rootLoc] = 0;
    PRINT_DEBUG("ROOT is %d",rootLoc);

    for(uint32_t i=1;i<=reachableCount;i++){
        uint32_t vertexW = vertex[i];
        BasicBlock* bb = locToBasicBlock[vertexW];
        ASSERT(!bb->isUnreachable());
        BasicBlock* immDom = locToBasicBlock[dom[vertexW]];
        if(immDom){
            PRINT_DEBUG("Reachable : Immediate Dominator of %d is %d",bb->getIndex(),immDom->getIndex());
            bb->setImmDominator(immDom);
        } else {
            PRINT_DEBUG("Reachable : Immediate Dominator of %d is Entry",bb->getIndex());
        }
    }
    for(int32_t i=nodeCount;i>reachableCount;i--){
        BasicBlock* bb = locToBasicBlock[i];
        ASSERT(bb->isUnreachable());
        BasicBlock* immDom = locToBasicBlock[rootLoc];
        PRINT_DEBUG("Un-Reachable : Immediate Dominator of %d is %d",bb->getIndex(),immDom->getIndex());
        bb->setImmDominator(immDom);
    }
}
开发者ID:danfinkelstein,项目名称:know-nothing-gmail,代码行数:68,代码来源:LengauerTarjan.C


示例4: extendOrCondition

inline void extendOrCondition(SharedHqlExpr & cond, IHqlExpression * r)
{
    cond.setown(extendConditionOwn(no_or, cond.getClear(), LINK(r)));
}
开发者ID:linuxsc,项目名称:HPCC-Platform,代码行数:4,代码来源:hqlutil.hpp


示例5: cleanup_session

void cleanup_session(struct session *ses)
{
	push_call("cleanup_session(%p)",ses);

	if (HAS_BIT(ses->flags, SES_FLAG_CLOSED))
	{
		tintin_printf2(NULL, "\n#SESSION '%s' IS ALREADY CLOSED.", ses->name);
		dump_stack();

		pop_call();
		return;
	}

	if (ses == gtd->update)
	{
		gtd->update = ses->next;
	}

	UNLINK(ses, gts->next, gts->prev);

	if (ses->socket)
	{
		if (close(ses->socket) == -1)
		{
			syserr("close in cleanup");
		}

		// the PID is stored in the session's port.

		if (HAS_BIT(ses->flags, SES_FLAG_RUN))
		{
			kill(atoi(ses->port), SIGKILL);
		}

	}

	SET_BIT(ses->flags, SES_FLAG_CLOSED);

	if (HAS_BIT(ses->flags, SES_FLAG_CONNECTED))
	{
		check_all_events(ses, SUB_ARG|SUB_SEC, 0, 4, "SESSION DISCONNECTED", ses->name, ses->host, ses->ip, ses->port);

		tintin_printf(gtd->ses, "#SESSION '%s' DIED.", ses->name);
	}
	else
	{
		check_all_events(ses, SUB_ARG|SUB_SEC, 0, 4, "SESSION TIMED OUT", ses->name, ses->host, ses->ip, ses->port);

		tintin_printf(gtd->ses, "#SESSION '%s' TIMED OUT.", ses->name);
	}

	if (ses == gtd->ses)
	{
		gtd->ses = newactive_session();
	}

	if (ses->logfile)
	{
		fclose(ses->logfile);
	}

	if (ses->logline)
	{
		fclose(ses->logline);
	}

	LINK(ses, gtd->dispose_next, gtd->dispose_prev);

	pop_call();
	return;
}
开发者ID:SlySven,项目名称:tintin,代码行数:71,代码来源:session.c


示例6: switch

IHqlExpression * PositionTransformer::createTransformed(IHqlExpression * _expr)
{
    OwnedHqlExpr transformed = NewHqlTransformer::createTransformed(_expr);

    switch (transformed->getOperator())
    {
    case no_table:
        {
            IHqlExpression * mode = transformed->queryChild(2);
            HqlExprArray fields;
            HqlExprArray args;

            if (mode->getOperator() == no_thor)
            {
                unwindChildren(fields, transformed->queryChild(1));
                IHqlExpression * filePosAttr = createComma(createAttribute(virtualAtom, createAttribute(filepositionAtom)), insertedAttr.getLink());
                IHqlExpression * sizeofAttr = createComma(createAttribute(virtualAtom, createAttribute(sizeofAtom)), insertedAttr.getLink());
                fields.append(*createField(fileposName, makeIntType(8, false), NULL, filePosAttr));
                fields.append(*createField(recordlenName, makeIntType(2, false), NULL, sizeofAttr));

                unwindChildren(args, transformed);
                args.replace(*createRecord(fields), 1);
                return transformed->clone(args);
            }
        }
        break;
    case no_iterate:
    case no_hqlproject:
        {
            HqlExprArray args;
            HqlExprArray assigns;
            IHqlExpression * transform = transformed->queryChild(1);
            unwindChildren(args, transformed);
            unwindChildren(assigns, transform);
            IHqlExpression * inRecord = transformed->queryChild(0)->queryRecord();
            IHqlExpression * outRecord = transform->queryRecord();

            HqlExprArray fields;
            unwindChildren(fields, outRecord);
            ForEachChild(idx, inRecord)
            {
                IHqlExpression * child = inRecord->queryChild(idx);
                if (child->hasProperty(insertedAtom))
                {
                    IHqlExpression * newTarget = createField(child->queryName(), child->getType(), LINK(child), insertedAttr.getLink());
                    fields.append(*newTarget);
                    assigns.append(*createValue(no_assign, makeVoidType(), newTarget, createSelectExpr(createValue(no_left), LINK(newTarget))));
                }
            }
            IHqlExpression * newRecord = createRecord(fields);
            args.replace(*createValue(no_transform, newRecord->getType(), assigns), 1);
            return transformed->clone(args);
        }
        break;
    case no_join:
        //only ok if join first
    case no_rollup:
    case no_newaggregate:
    case no_aggregate:
        fail();
        break;
    case no_usertable:
    case no_selectfields:
        {
            IHqlExpression * grouping = transformed->queryChild(2);
            if (grouping && (grouping->getOperator() != no_attr))
                fail();
            IHqlExpression * record = transformed->queryRecord();
            HqlExprArray fields;
            unwindChildren(fields, transformed->queryChild(1));
            ForEachChild(idx, record)
            {
                IHqlExpression * child = record->queryChild(idx);
                if (child->hasProperty(insertedAtom))
                    fields.append(*createField(child->queryName(), child->getType(), LINK(child), insertedAttr.getLink()));
            }

            HqlExprArray args;
            unwindChildren(args, transformed);
            args.replace(*createRecord(fields), 1);
            return transformed->clone(args);
        }
开发者ID:Goon83,项目名称:HPCC-Platform,代码行数:82,代码来源:fvwugen.cpp


示例7: LINK

IHqlExpression * FullExpandMonitor::onExpandSelector()
{
    return LINK(createRow);
//  return createValue(no_newrow, LINK(createRow));
}
开发者ID:anirudh3LOQ,项目名称:HPCC-Platform,代码行数:5,代码来源:hqlpmap.cpp


示例8: addShutdownHook

void addShutdownHook(IDaliClientShutdown &shutdown)
{
    shutdownHooks.append(*LINK(&shutdown));
}
开发者ID:aa0,项目名称:HPCC-Platform,代码行数:4,代码来源:daclient.cpp


示例9: LINK

extern jlib_decl IRecordSize *createDeltaRecordSize(IRecordSize * size, int delta)
{
    if (delta == 0)
        return LINK(size);
    return new CDeltaRecordSize(size, delta);
}
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:6,代码来源:jio.cpp


示例10: load_news

/* load the linked list from disk */
void load_news( void )
{
   FILE *fp = NULL;
   char filename[256];

   sprintf( filename, "%s%s", SYSTEM_DIR, NEWS_FILE );
   if( ( fp = fopen( filename, "r" ) ) == NULL )
   {
      perror( "load_news(): cannot open file" );
      return;
   }

   for( ;; )
   {
      NEWS_TYPE *type = NULL;
      NEWS *news = NULL;
      char *word;
      char letter;

      letter = fread_letter( fp );

      if( letter == '*' )
      {
         fread_to_eol( fp );
         continue;
      }

      if( letter != '#' )
      {
         bug( "load_news(): # not found" );
         break;
      }

      word = fread_word( fp );

      if( !str_cmp( word, "NEWS" ) )
      {
         CREATE( news, NEWS, 1 );
         news->type = -1;

         fread_news( news, fp );
         link_news_to_type( news );
         continue;
      }
      /*
       * added for new indexing - 5/5/02 
       */
      else if( !str_cmp( word, "NEWSTYPE" ) )
      {
         CREATE( type, NEWS_TYPE, 1 );

         fread_news_type( type, fp );
         LINK( type, first_news_type, last_news_type, next, prev );
         continue;
      }
      if( !str_cmp( word, "END" ) )
         break;
      else
      {
         bug( "load_news(): unknown section %s", word );
         continue;
      }
   }
   fclose( fp );
   fp = NULL;
   renumber_news(  );
   return;
}
开发者ID:Igdra,项目名称:smaugfuss,代码行数:69,代码来源:news.c


示例11: bug

/*
 * Add a reset to an area -Thoric
 */
RESET_DATA *add_reset( ROOM_INDEX_DATA * room, char letter, int extra, int arg1, int arg2, int arg3 )
{
	RESET_DATA *pReset;

	if ( !room )
	{
		bug( "%s: NULL room!", __FUNCTION__ );
		return NULL;
	}

	letter = UPPER( letter );
	pReset = make_reset( letter, extra, arg1, arg2, arg3 );
	pReset->sreset = TRUE;

	switch ( letter )
	{
		case 'M':
			room->last_mob_reset = pReset;
			break;

		case 'E':
		case 'G':
			if ( !room->last_mob_reset )
			{
				bug( "%s: Can't add '%c' reset to room: last_mob_reset is NULL.", __FUNCTION__, letter );
				return NULL;
			}
			room->last_obj_reset = pReset;
			LINK( pReset, room->last_mob_reset->first_reset, room->last_mob_reset->last_reset, next_reset, prev_reset );
			return pReset;

		case 'P':
			if ( !room->last_obj_reset )
			{
				bug( "%s: Can't add '%c' reset to room: last_obj_reset is NULL.", __FUNCTION__, letter );
				return NULL;
			}
			LINK( pReset, room->last_obj_reset->first_reset, room->last_obj_reset->last_reset, next_reset, prev_reset );
			return pReset;

		case 'O':
			room->last_obj_reset = pReset;
			break;

		case 'T':
			if ( IS_SET( extra, TRAP_OBJ ) )
			{
				pReset->prev_reset = NULL;
				pReset->next_reset = room->last_obj_reset->first_reset;
				if ( room->last_obj_reset->first_reset )
					room->last_obj_reset->first_reset->prev_reset = pReset;
				room->last_obj_reset->first_reset = pReset;
				if ( !room->last_obj_reset->last_reset )
					room->last_obj_reset->last_reset = pReset;
				return pReset;
			}
			break;

		case 'H':
			pReset->prev_reset = NULL;
			pReset->next_reset = room->last_obj_reset->first_reset;
			if ( room->last_obj_reset->first_reset )
				room->last_obj_reset->first_reset->prev_reset = pReset;
			room->last_obj_reset->first_reset = pReset;
			if ( !room->last_obj_reset->last_reset )
				room->last_obj_reset->last_reset = pReset;
			return pReset;
	}
	LINK( pReset, room->first_reset, room->last_reset, next, prev );
	return pReset;
}
开发者ID:andycervantes,项目名称:SMAUG-Pi,代码行数:74,代码来源:reset.c


示例12: do_editnews

/* olc editnews command */
void do_editnews( CHAR_DATA* ch, const char* argument)
{
   char arg[MAX_INPUT_LENGTH];

   if( IS_NPC( ch ) || !IS_IMMORTAL( ch ) )
   {
      send_to_char( "Huh?\r\n", ch );
      return;
   }

   set_char_color( AT_GREEN, ch );

   switch ( ch->substate )
   {
      default:
         break;

      case SUB_NEWS_POST:
      {
         NEWS *news = NULL;

         news = ( NEWS * ) ch->dest_buf;
         STRFREE( news->post );
         news->post = copy_buffer( ch );
         stop_editing( ch );
         ch->substate = ch->tempnum;
         renumber_news(  );
         save_news(  );
         return;
      }
         break;

      case SUB_NEWS_EDIT:
      {
         NEWS *news = NULL;

         news = ( NEWS * ) ch->dest_buf;
         STRFREE( news->post );
         news->post = copy_buffer( ch );
         stop_editing( ch );
         ch->substate = ch->tempnum;
         renumber_news(  );
         save_news(  );
         return;
      }
         break;
   }

   argument = one_argument( argument, arg );

   if( arg[0] == '\0' )
   {
      send_to_char( "Syntax: editnews addtype <name>\r\n"
                    "        editnews addnews <type> <subject>\r\n"
                    "        editnews removetype <number>\r\n"
                    "        editnews removenews <type> <number>\r\n"
                    "        editnews edittype <field> <value>\r\n"
                    "        editnews editnews <type> <number> <new subject [optional]>\r\n"
                    " Fields being one of the following:\r\n" " name header cmd_name level\r\n", ch );
      return;
   }

   if( !str_cmp( arg, "save" ) )
   {
      renumber_news(  );
      save_news(  );
      send_to_char( "News saved.\r\n", ch );
      return;
   }

   if( !str_cmp( arg, "addtype" ) )
   {
      NEWS_TYPE *type = NULL;

      if( argument[0] == '\0' )
      {
         send_to_char( "Syntax: editnews addtype <name>\r\n", ch );
         return;
      }

      if( top_news_type >= NEWS_MAX_TYPES )
      {
         send_to_char( "There are too many news types.\r\n", ch );
         return;
      }

      CREATE( type, NEWS_TYPE, 1 );
      type->name = STRALLOC( argument );
      type->cmd_name = STRALLOC( argument );
      type->vnum = top_news_type++;
      type->level = -1;

      news_command_table[type->vnum] = STRALLOC( type->cmd_name );

      LINK( type, first_news_type, last_news_type, next, prev );
      ch_printf( ch, "Newstype '%s' created.\r\n", argument );
      return;
   }

//.........这里部分代码省略.........
开发者ID:Igdra,项目名称:smaugfuss,代码行数:101,代码来源:news.c


示例13: redit_parse


//.........这里部分代码省略.........
	  case REDIT_EXIT_FLAGS:
		number = atoi( arg );
		if ( number == 0 )
		{
			redit_disp_exit_edit( d );
			return;
		}

		if ( number < 0 || number >= MAX_EXIT
		  || ((number-1) == EXIT_RES1)
		  || ((number-1) == EXIT_RES2)
		  || ((number-1) == EXIT_PORTAL) )
		{
			send_to_char( d->character, "That's not a valid choice!\r\n" );
			redit_disp_exit_flag_menu( d );
		}
		number -= 1;
		TOGGLE_BIT( pexit->flags, number );
		olc_log( d, "%s %s to %s exit",
			HAS_BIT(pexit->flags, number)  ?  "Added"  :  "Removed",
			code_name(NULL, number, CODE_EXIT),
			code_name(NULL, pexit->vdir, CODE_DIR) );
		redit_disp_exit_flag_menu( d );
		return;

	  case REDIT_EXTRADESC_DELETE:
		ed = redit_find_extradesc( room, atoi(arg) );
		if ( !ed )
		{
			send_to_char( d->character, "Not found, try again: " );
			return;
		}
		olc_log( d, "Deleted exdesc %s", ed->keyword );
		UNLINK( ed, room->first_extradescr, room->last_extradescr, next, prev );
		DISPOSE( ed->keyword );
		DISPOSE( ed->description );
		DISPOSE( ed );
		top_ed--;
		redit_disp_extradesc_menu(d);
		return;

	  case REDIT_EXTRADESC_CHOICE:
		switch ( toupper( arg[0] ) )
		{
		  case 'Q':
			if ( !ed->keyword || !ed->description )
			{
				send_to_char( d->character, "No keyword and/or description, junking..." );
				UNLINK( ed, room->first_extradescr, room->last_extradescr, next, prev );
				DISPOSE( ed->keyword );
				DISPOSE( ed->keyword );
				DISPOSE( ed );
				top_ed--;
			}
			d->character->spare_ptr = NULL;
			redit_disp_extradesc_menu(d);
			return;
		  case '1':
			OLC_MODE(d) = REDIT_EXTRADESC_KEY;
			send_to_char( d->character, "Keywords, seperated by spaces: " );
			return;
		  case '2':
			OLC_MODE(d) = REDIT_EXTRADESC_DESCRIPTION;
			d->character->substate = SUB_ROOM_EXTRA;
			d->character->last_cmd = do_redit_reset;
			send_to_char( d->character, "Enter new extradesc description: \r\n" );
开发者ID:Onirik79,项目名称:bardmud,代码行数:67,代码来源:olc_redit.c


示例14: initLDAP

//-----------------------------------------------------
//
//-----------------------------------------------------
bool initLDAP(IPropertyTree * ldapProps)
{
    StringAttr serverType( ldapProps->queryProp("@serverType") );
    if (!serverType.length())
    {
        fprintf(stderr, "\nERROR: serverType not set in LDAPServer component");
        return false;
    }

    StringBuffer hpccUser;
    StringBuffer hpccPwd;
    ldapProps->getProp("@systemUser", hpccUser);
    ldapProps->getProp("@systemPassword", hpccPwd);
    if (0==hpccUser.length() || 0==hpccPwd.length())
    {
        fprintf(stderr, "\nERROR: HPCC systemUser credentials not found in configuration");
        return false;
    }

    StringBuffer ldapAddress;
    ldapProps->getProp("@ldapAddress", ldapAddress);

    //Get LDAP admin creds from user
    char buff[100];
    fprintf(stdout, "\nEnter the '%s' LDAP Admin User name on '%s'...",serverType.get(),ldapAddress.str());
    do
    {
        char * line = fgets(buff, sizeof(buff), stdin);
        if (!line)
            return false;
    }
    while (buff[0] == (char)'\n');

    if (buff[strlen(buff)-1] == '\n')
        buff[strlen(buff)-1] = (char)NULL;
    StringAttr ldapUser(buff);

    fprintf(stdout, "Enter the LDAP Admin user '%s' password...",ldapUser.get());
    char * line = fgets(buff, sizeof(buff), stdin);
    if (!line)
        return false;

    if (buff[strlen(buff)-1] == '\n')
        buff[strlen(buff)-1] = (char)NULL;
    StringAttr ldapPwd(buff);
    if (0==ldapUser.length() || 0==ldapPwd.length())
    {
        fprintf(stderr, "\nERROR: Invalid LDAP Admin account credentials entered");
        return false;
    }

    fprintf(stdout, "\nReady to initialize HPCC LDAP Environment, using the following settings");
    fprintf(stdout, "\n\tLDAP Server     : %s", ldapAddress.str());
    fprintf(stdout, "\n\tLDAP Type       : %s", serverType.get());
    fprintf(stdout, "\n\tHPCC Admin User : %s", hpccUser.str());
    fprintf(stdout, "\nProceed?  y/n ");
    for (;;)
    {
        int c = getchar();
        if (c == 'y' || c == 'Y')
            break;
        else if (c == 'n' || c == 'N')
            return true;
    }

    if (stricmp(serverType.get(),"ActiveDirectory"))
        ldapProps->setProp("@systemBasedn", "");

    //Replace system user with LDAP Admin credentials
    ldapProps->setProp("@systemUser", ldapUser);
    ldapProps->setProp("@systemCommonName", ldapUser);
    StringBuffer sb;
    encrypt(sb,ldapPwd);
    ldapProps->setProp("@systemPassword", sb.str());

    //Create security manager. This creates the required OUs
    Owned<ISecManager> secMgr;
    try
    {
        secMgr.setown(newLdapSecManager("initldap", *LINK(ldapProps)));
    }
    catch(IException *e)
    {
        StringBuffer buff;
        e->errorMessage(buff);
        e->Release();
        fprintf(stderr, "\nERROR: Unable to create security manager : %s", buff.str());
        return false;
    }

    //Create HPCC Admin user
    Owned<ISecUser> user = secMgr->createUser(hpccUser.str());
    StringBuffer pwd;
    decrypt(pwd, hpccPwd.str());
    user->credentials().setPassword(pwd.str());
    try { secMgr->addUser(*user.get()); }
    catch(...) {}//user may already exist, so just move on
//.........这里部分代码省略.........
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:101,代码来源:initldap.cpp


示例15: queryExtra

void LogicalGraphCreator::createGraphActivity(IHqlExpression * expr)
{
    LogicalGraphInfo * extra = queryExtra(expr);
    if (extra->globalId && !inSubQuery())
    {
        extra->id = extra->globalId;
        return;
    }

    //First generate children...
    //MORE: may want to do inputs first and dependents afterwards.
    IAtom * dependencyKind = dependencyAtom;
    unsigned first = getFirstActivityArgument(expr);
    unsigned last = first + getNumActivityArguments(expr);
    node_operator op = expr->getOperator();
    HqlExprArray inputs, dependents;
    bool defaultInputs = true;
    switch (op)
    {
    case no_setresult:
    case no_map:
        last = first;
        dependencyKind = NULL;
        break;
    case no_select:
        if (!isNewSelector(expr))
        {
            last = first;
        }
        break;
    case no_addfiles:
        expandUnnamedFunnel(inputs, expr->queryBody());
        defaultInputs = false;
        break;
    case no_colon:
        {
            if (!isWorkflowExpanded(expr))
                defaultInputs = false;

            gatherWorkflowActivities(expr, dependents);
            inputs.append(*LINK(expr->queryChild(0)));
            defaultInputs = false;
            break;
        }
    case no_forcelocal:
    case no_forcenolocal:
    case no_allnodes:
    case no_thisnode:
        {
            IHqlExpression * child = expr->queryChild(0);
            createSubGraphActivity(child);
            addDependent(dependents, child);
            defaultInputs = false;
            break;
        }
    }
    if (defaultInputs)
    {
        ForEachChild(i, expr)
        {
            IHqlExpression * cur = expr->queryChild(i);
            if ((i >= first && i < last) && !cur->isAttribute())
                inputs.append(*LINK(cur));
            else if (includeChildInDependents(expr, i))
                gatherGraphActivities(cur, dependents);
        }
    }
开发者ID:HPCCSmoketest,项目名称:HPCC-Platform,代码行数:67,代码来源:hqlgraph.cpp


示例16: do_plantbug

void do_plantbug( CHAR_DATA * ch, char *argument )
{
   CHAR_DATA *victim;
   BUG_DATA *pbug;
   BUG_DATA *cbug;
   OBJ_DATA *obj;
   bool checkbug = FALSE;
   int schance;

   if( IS_NPC( ch ) )
      return;

   if( ( victim = get_char_room( ch, argument ) ) == NULL )
   {
      send_to_char( "They aren't here.\n\r", ch );
      return;
   }

   if( IS_NPC( victim ) )
   {
      send_to_char( "You can't bug NPC's!\n\r", ch );
      return;
   }

   if( IS_IMMORTAL( victim ) )
   {
      send_to_char( "Don't try to plant bugs on immortals.\n\r", ch );
      return;
   }

   if( in_arena( ch ) )
   {
      send_to_char( "You're here to FIGHT, not spy.\n\r", ch );
      return;
   }

   if( ch == victim )
   {
      send_to_char( "You can't bug yourself!\n\r", ch );
      return;
   }

   for( obj = ch->last_carrying; obj; obj = obj->prev_content )
      if( obj->item_type == ITEM_BUG )
         checkbug = TRUE;

   if( checkbug == FALSE )
   {
      send_to_char( "You don't have any bugs to plant.\n\r", ch );
      return;
   }

   for( cbug = victim->first_bug; cbug; cbug = cbug->next_in_bug )
      if( !str_cmp( ch->name, cbug->name ) )
      {
         send_to_char( "You have already planted a bug on this person.\n\r", ch );
         return;
      }

   schance = number_percent(  ) - UMIN( 0, ( get_curr_lck( ch ) - 14 ) ) + UMIN( 0, ( get_curr_lck( victim ) - 13 ) );

   if( schance < ch->pcdata->learned[gsn_plantbug] )
   {
      act( AT_WHITE, "You carefully reach into $N's pocket and place a bug.", ch, NULL, victim, TO_CHAR );
      CREATE( pbug, BUG_DATA, 1 );
      pbug->name = ch->name;
      LINK( pbug, victim->first_bug, victim->last_bug, next_in_bug, prev_in_bug );
      learn_from_success( ch, gsn_plantbug );

      for( obj = ch->last_carrying; obj; obj = obj->prev_content )
      {
         if( obj->item_type == ITEM_BUG )
         {
            separate_obj( obj );
            obj_from_char( obj );
            extract_obj( obj );
            break;
         }
      }
      return;
   }
   else
   {
      send_to_char( "&RYou try to find a pocket to plant the bug in but fail!\n\r", ch );
      learn_from_failure( ch, gsn_plantbug );
      if( number_bits( 0 ) == 0 )
         ch_printf( victim, "You feel a slight brush against your pocket to find %s's hand there.\n\r", PERS( ch, victim ) );
      return;
   }
}
开发者ID:ccubed,项目名称:SWFoteCustom,代码行数:90,代码来源:hunter.c


示例17: buildDiskOutputEcl

IHqlExpression * buildDiskOutputEcl(const char * logicalName, IHqlExpression * record)
{
    OwnedHqlExpr dataset = createNewDataset(createConstant(logicalName), LINK(record), createValue(no_thor), NULL, NULL, NULL);
    return addOutput(dataset);
}
开发者ID:Goon83,项目名称:HPCC-Platform,代码行数:5,代码来源:fvwugen.cpp


示例18: do_contract

//Contract System by Tawnos.
void do_contract( CHAR_DATA * ch, char *argument )
{
   CHAR_DATA *victim;
   CHAR_DATA *target;
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   char arg3[MAX_INPUT_LENGTH];
   long amount = 0;
   CONTRACT_DATA *ccontract;
   CONTRACT_DATA *contract;

   argument = one_argument( argument, arg1 );
   argument = one_argument( argument, arg2 );
   argument = one_argument( argument, arg3 );

   if( IS_NPC( ch ) )
      return;

   if( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' )
   {
      send_to_char( "&RSyntax: contract <person> <target> <amount>\n\r", ch );
      return;
   }

   if( ( victim = get_char_room( ch, arg1 ) ) == NULL )
   {
      send_to_char( "They aren't here.\n\r", ch );
      return;
   }

   if( ( target = get_char_world_ooc( ch, arg2 ) ) == NULL )
   {
      send_to_char( "Your target is currently not online.\n\r", ch );
      return;
   }

   if( ch == victim )
   {
      send_to_char( "You can't contract yourself!\n\r", ch );
      return;
   }

   if( IS_NPC( victim ) || IS_NPC( target ) )
   {
      send_to_char( "You can't contract NPC's.\n\r", ch );
      return;
   }

   if( ch == target )
   {
      send_to_char( "You can't contract against yourself!\n\r", ch );
      return;
   }

   if( target == victim )
   {
      send_to_char( "You can't contract them to kill themself!\n\r", ch );
      return;
   }

   amount = atoi( arg3 );

   if( amount < 5000 )
   {
      send_to_char( "&RYour contract must be for at least 5000 credits.\n\r", ch );
      return;
   }

   if( ch->gold < amount )
   {
      send_to_char( "&RYou don't have enough credits!\n\r", ch );
      return;
   }

   for( ccontract = victim->first_contract; ccontract; ccontract = ccontract->next_in_contract )
   {
      if( !str_cmp( ccontract->target, target->name ) )
      {
         ch->gold -= amount;
         ccontract->amount += amount;
         ch_printf( ch, "&GYou have contracted %s to kill %s for an amount of %d credits.\n\r", PERS( victim, ch ),
                    target->name, amount );
         ch_printf( victim, "&G%s has contracted you to kill %s, raising your contract reward by %d credits.\n\r",
                    PERS( ch, victim ), target->name, amount );
         return;
      }
   }

   CREATE( contract, CONTRACT_DATA, 1 );
   contract->target = target->name;
   contract->amount = amount;
   LINK( contract, victim->first_contract, victim->last_contract, next_in_contract, prev_in_contract );

   ch->gold -= amount;
   ch_printf( ch, "&GYou have contracted %s to kill %s for an amount of %d credits.\n\r", PERS( victim, ch ), target->name,
              amount );
   ch_printf( victim, "&G%s has contracted you to kill %s for an amount of %d credits.\n\r", PERS( ch, victim ),
              target->name, amount );

//.........这里部分代码省略.........
开发者ID:ccubed,项目名称:SWFoteCustom,代码行数:101,代码来源:hunter.c


示例19: addOutput

IHqlExpression * addOutput(IHqlExpression * dataset)
{
    return createValue(no_output, makeVoidType(), LINK(dataset));
}
开发者ID:Goon83,项目名称:HPCC-Platform,代码行数:4,代码来源:fvwugen.cpp


示例20: load_bits

/* Load the abits and qbits */
void load_bits( void )
{
   char buf[MAX_STRING_LENGTH];
   char *word;
   bool fMatch;
   int mode = 0;
   BIT_DATA *bit = NULL;
   FILE *fp;

   sprintf( buf, "%sabit.lst", SYSTEM_DIR );
   if( ( fp = fopen( buf, "r" ) ) == NULL )
   {
      perror( buf );
      return;
   }

   for( ;; )
   {
      word = feof( fp ) ? "End" : fread_word( fp );
      fMatch = FALSE;

      switch ( UPPER( word[0] ) )
      {
         case '*':
            fMatch = TRUE;
            fread_to_eol( fp );
            break;

         case '#':
            if( !str_cmp( word, "#END" ) )
            {
               fclose( fp );
               if( mode == 0 )
               {
                  mode = 1;   /* We have two files to read, I reused the same code to read both */
                  sprintf( buf, "%sqbit.lst", SYSTEM_DIR );
                  if( ( fp = fopen( buf, "r" ) ) == NULL )
                  {
                     perror( buf );
                     return;
                  }
               }
               else
                  return;
               fMatch = TRUE;
            }
            break;

         case 'D':
            if( !str_cmp( word, "Desc" ) )
            {
               fMatch = TRUE;
               strcpy( bit->desc, fread_string( fp ) );
            }
            break;

         case 'E':
            if( !strcmp( word, "End" ) )
            {
               if( mode == 0 )
                  LINK( bit, first_abit, last_abit, next, prev );
               else
                  LINK( bit, first_qbit, last_qbit, next, prev );
               bit = NULL;
               fMatch = TRUE;
            }
            break;

         case 'N':
            if( !strcmp( word, "Number" ) )
            {
               CREATE( bit, BIT_DATA, 1 );
        

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LINK_STATS_INC函数代码示例发布时间:2022-05-30
下一篇:
C++ LINFO函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap