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


C++ LINK函数代码示例

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


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


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