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

C++ FindName函数代码示例

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

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



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

示例1: doRval

struct ExprRes *  doRval(char * name)  { 
   struct ExprRes *res;
   struct SymEntry * e;
   if( global ){
       e = FindName(locTable, name);
       if( !e) {
           e = FindName(table, name);
       }
   }
   else {
       e = FindName(table, name);
               }
   if (!e) {
		WriteIndicator(GetCurrentColumn());
		WriteMessage("Undeclared variable");
        exit(1); //doing something stupid like "print ln;" will cause me to segfault if we don't quit
   }
  struct Vtype * vtype = ((struct Vtype *)e->Attributes);



  res = (struct ExprRes *) malloc(sizeof(struct ExprRes));
  res->Reg = AvailTmpReg();
  
  if ( vtype->Local == 0 ){
         res->Instrs = GenInstr(NULL,"lw",TmpRegName(res->Reg),name,NULL); 
  }
  else {
      res->Instrs = GenInstr(NULL, "lw", TmpRegName(res->Reg), RegOff(vtype->StackIndex, "$sp"), NULL);
  }
  
  res->Type = vtype->Type;
  return res;
}
开发者ID:tyman7,项目名称:compiler,代码行数:34,代码来源:Semantics.c


示例2: memset

void FName::NameManager::InitBuckets ()
{
	Inited = true;
	memset (Buckets, -1, sizeof(Buckets));

	// Register built-in names. 'None' must be name 0.
	for (size_t i = 0; i < countof(PredefinedNames); ++i)
	{
		assert((0 == FindName(PredefinedNames[i], true)) && "Predefined name already inserted");
		FindName (PredefinedNames[i], false);
	}
}
开发者ID:Edward850,项目名称:zdoom,代码行数:12,代码来源:name.cpp


示例3: doArrayAssign

struct InstrSeq * doArrayAssign( char * name, struct ExprRes * index, struct ExprRes * val){
    struct SymEntry *e;
    if( global ){
        e = FindName(locTable, name);
        if( !e){
            e = FindName(table, name);
        }
    }
    else{
        e = FindName(table, name);
    }
    struct Vtype * vtype = ((struct Vtype *)e->Attributes);
    struct InstrSeq * code;
    int reg = AvailTmpReg();
    char * buffer;
    if (!e){
        WriteIndicator(GetCurrentColumn());
        WriteMessage("Undeclared variable");
    }
    if(index->Type != TYPE_INT){
        TypeError();
    }
    else if( val->Type != -1 && ((vtype->Type ==  TYPE_BOOLARR &&  val->Type != TYPE_BOOL) || (vtype->Type == TYPE_INTARR && val->Type != TYPE_INT ))){
        TypeError();
    }
    buffer = RegOff(0, TmpRegName(reg));
    code = val->Instrs;
    AppendSeq(code, index->Instrs);
    // change for locality later
    if (! vtype->Local){
        AppendSeq( code, GenInstr( NULL, "la", TmpRegName(reg), name, NULL));
         
    }
    else {
        AppendSeq(code, GenInstr(NULL, "addi", TmpRegName(reg), "$sp", Imm(vtype->StackIndex)));
    }
    
    
    
    AppendSeq( code, GenInstr( NULL, "mul", TmpRegName(index->Reg), TmpRegName(index->Reg), "4"));
    AppendSeq( code, GenInstr(NULL, "add", TmpRegName(reg), TmpRegName(reg), TmpRegName(index->Reg)));
    AppendSeq( code, GenInstr(NULL, "sw", TmpRegName(val->Reg), buffer, NULL));
    ReleaseTmpReg(val->Reg);
    ReleaseTmpReg(index->Reg);
    ReleaseTmpReg(reg);
    free(val);
    free(index);

    return code;
    
}
开发者ID:tyman7,项目名称:compiler,代码行数:51,代码来源:Semantics.c


示例4: DbgLogMediaTypeInfo

void DbgLogMediaTypeInfo(DWORD type, DWORD level, const CMediaType* pmt)
{
	DbgLogInfo(type, level,
		TEXT(" MediaType Info : %s %s %s %s SampleSize=%ld"),
			FindName(g_MediaTypes, &pmt->majortype),
			FindName(g_MediaSubTypes, &pmt->subtype),
			(pmt->bFixedSizeSamples 
				? TEXT("FixedSamples")
				: TEXT("NotFixedSamples")),
			(pmt->bTemporalCompression
				? TEXT("TemporalCompression")
				: TEXT("NotTemporalCompression")),
			pmt->lSampleSize);
}
开发者ID:Harurow,项目名称:DSFilters,代码行数:14,代码来源:Utils.cpp


示例5: FindName

CSrResourceFolder* CSrResourceHandler::GetScriptsFolder (void)
{
	CSrResourceBase* pBasePath = FindName("scripts\\source\\");
	if (pBasePath == NULL || !pBasePath->IsFolder()) return NULL;

	return (CSrResourceFolder *) pBasePath;
}
开发者ID:Purr4me,项目名称:TES5Edit-GoogleCode,代码行数:7,代码来源:srresourcehandler.cpp


示例6: GetName

HRESULT GetName(const NamedGuid* pTable, LPTSTR pszString, int cchBuf,
				const GUID *pGuid)
{
	ASSERT(pTable);
	ASSERT(pszString);
	ASSERT(pGuid);

	if (cchBuf < 1) {
		return E_INVALIDARG;
	}

	HRESULT hr = E_FAIL;

	pszString[0] = TEXT('\0');

	const LPCTSTR pName = FindName(pTable, pGuid);
	if (pName) 	{
		if (_tcscpy_s(pszString, cchBuf, pName) == 0) {
			return S_OK;
		}
	}

	if (FAILED(hr)) {
		hr = StringFromGUID2(*pGuid, pszString, cchBuf);
	}

	return hr;
}
开发者ID:Harurow,项目名称:DSFilters,代码行数:28,代码来源:Utils.cpp


示例7:

static struct NamedObj *searchns(pUtility UtilBase, struct NamedObj *object, struct NameSpace *ns, STRPTR search)
{
	struct NamedObj *ret;
	if (!search)
	{
		if (object->no_Non.non_Node.ln_Succ) return object;
		return NULL;
	}

	if ((ns->ns_Flags & NSB_CASE) != 0)
	{
		 ret = (struct NamedObj *)FindName((struct List *)object->no_Non.non_Node.ln_Pred, search);
		 return ret;
	}
	
	ForeachNode(object, ret)
	{
		if (Stricmp((const char*)search, (const char*)ret->no_Non.non_Node.ln_Name) == 0)
		{
			if (ret->no_Non.non_Node.ln_Succ) return ret;
			return NULL;
		}
	}
	return NULL;
}
开发者ID:cycl0ne,项目名称:poweros_x86,代码行数:25,代码来源:name.c


示例8: time_of_find_name

double time_of_find_name(char *Last)
{
	struct timespec t_start, t_end;
        uint64_t nsec1 = 0;
        uint64_t nsec2 = 0;
        uint64_t elapsed_nsec = 0;

        PhoneBook *pb_found;

        clock_gettime(CLOCK_MONOTONIC, &t_start);
        nsec1 = ((uint64_t)(t_start.tv_sec) * 1000000000LL + t_start.tv_nsec);

        pb_found = FindName(Last, pb);

        clock_gettime(CLOCK_MONOTONIC, &t_end);
        nsec2 = (uint64_t)(t_end.tv_sec) * 1000000000LL + t_end.tv_nsec;
        elapsed_nsec = nsec2 - nsec1;

        if(pb_found != NULL)
        {
                printf("%s found ",Last);
        }
        else
                printf("%s not found\n",Last);

        //printf("used time :%.3f sec\n",(double)elapsed_nsec/1000000000.0);

        return (double)elapsed_nsec/1000000000.0;
}
开发者ID:musicguitar,项目名称:phonebook_opt,代码行数:29,代码来源:pb_opt2.c


示例9: main

int main(void)
{
	PhoneBook *pb[DATA];
    int i = 0;

    clock_t start_time, end_time;

	pb[i] = (PhoneBook*) malloc(sizeof(PhoneBook));
	strncpy(pb[i]->LastName, "aaa", sizeof("aaa"));
	// strncpy(pb[i]->LastName, "pjay", sizeof("pjay"));
    while (i++ < DATA) {
    	pb[i] = (PhoneBook*) malloc(sizeof(PhoneBook));
    	strncpy(pb[i]->LastName, "aaa", sizeof("aaa"));
    	pb[i-1]->pNext = pb[i];
    } 
    strncpy(pb[DATA - 1]->LastName, "pjay", sizeof("pjay"));
    
    printf("%ld Byte * %d = %ld KByte\n", sizeof(PhoneBook), DATA, (sizeof(PhoneBook) * DATA)/1024);

    start_time = clock();
    PhoneBook *getPb = FindName("pjay", pb[0]);
    end_time = clock();

    printf("%f microsec\n", (float)(end_time - start_time));

    if (getPb != NULL) {
    	printf("%s\n", getPb->LastName);
    }

    return 0;
}
开发者ID:PJayChen,项目名称:Optimizing-Program-Example,代码行数:31,代码来源:main.c


示例10: L_WB_PutDiskObject

// Patched PutDiskObject()
BOOL __asm __saveds L_WB_PutDiskObject(
	register __a0 char *name,
	register __a1 struct DiskObject *diskobj)
{
	struct LibData *data;
	struct MyLibrary *libbase;
	BOOL result,magic=0;

	// Get library
	if (!(libbase=(struct MyLibrary *)FindName(&((struct ExecBase *)*((ULONG *)4))->LibList,"dopus5.library")))
		return 0;

	// Get data pointer
	data=(struct LibData *)libbase->ml_UserData;

	// See if icon type is set to inverse magic
	if (diskobj->do_Magic==(USHORT)~WB_DISKMAGIC)
	{
		// Fix it
		diskobj->do_Magic=WB_DISKMAGIC;

		// Set magic flag, which will stop us sending notification
		magic=1;
	}

	// Write icon
	result=L_WriteIcon(name,diskobj,libbase);

	// Succeeded?
	if (result && !magic) icon_notify(data,name,0,0);

	return result;
}
开发者ID:MrZammler,项目名称:opus_magellan,代码行数:34,代码来源:icons.c


示例11: L_WB_DeleteDiskObject

// Patched DeleteDiskObject()
BOOL __asm __saveds L_WB_DeleteDiskObject(register __a0 char *name)
{
	struct LibData *data;
	struct MyLibrary *libbase;
	BOOL result;
	char *full_name;

	// Get library
	if (!(libbase=(struct MyLibrary *)FindName(&((struct ExecBase *)*((ULONG *)4))->LibList,"dopus5.library")))
		return 0;

	// Get data pointer
	data=(struct LibData *)libbase->ml_UserData;

	// Get full name
	full_name=icon_fullname(data,name);

	// Write icon
	result=L_DeleteIcon(name,libbase);

#define DOSBase (data->dos_base)

	// Succeeded?
	if ((result || IoErr()==ERROR_OBJECT_NOT_FOUND) && full_name)
		icon_notify(data,full_name,INF_FULLNAME,1);

#undef DOSBase

	// Free full name buffer
	FreeVec(full_name);
	return result;
}
开发者ID:MrZammler,项目名称:opus_magellan,代码行数:33,代码来源:icons.c


示例12: column

/** @param type :: Data type of the column.
    @param name :: Column name.
    @return A shared pointer to the created column (will be null on failure).
*/
API::Column_sptr TableWorkspace::addColumn(const std::string &type,
                                           const std::string &name) {
  API::Column_sptr c;
  if (type.empty()) {
    g_log.error("Empty string passed as type argument of createColumn.");
    return c;
  }
  if (name.empty()) {
    g_log.error("Empty string passed as name argument of createColumn.");
    return c;
  }
  // Check that there is no column with the same name.
  auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name));
  if (ci != m_columns.end()) {
    g_log.error() << "Column with name " << name << " already exists.\n";
    return c;
  }
  try {
    c = API::ColumnFactory::Instance().create(type);
    m_columns.push_back(c);
    c->setName(name);
    resizeColumn(c.get(), rowCount());
  } catch (Kernel::Exception::NotFoundError &e) {
    g_log.error() << "Column of type " << type << " and name " << name
                  << " has not been created.\n";
    g_log.error() << e.what() << '\n';
    return c;
  }
  return c;
}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:34,代码来源:TableWorkspace.cpp


示例13: main

int main()
{
	int n;
	int index;
	int edges;
	int first, second;
	int counter;
	char tmp[MAX_LENGTH];
	double tr;

	counter = 0;
	do
	{
		counter++;
		scanf("%d", &n);
		if(!n)
			break;

		for(index=1; index<=n; index++)
			scanf("%s", names[index]);

		scanf("%d",&index);
		for(edges=0; edges<index; edges++)
		{
			scanf("%s", tmp);
			eArr[edges].x = FindName(tmp, n);
			scanf("%lf", &eArr[edges].rate);
			scanf("%s", tmp);
			eArr[edges].y = FindName(tmp, n); 
		}

#if DEBUG
		ShowEdges(edges);
#endif 

		printf("Case %d: ", counter);
		if(Bellman_Ford(edges) < 0)
			printf("Yes\n");
		else
			printf("No\n");

	}while(1);

	return 0;
}
开发者ID:UsuallyGO,项目名称:POJ,代码行数:45,代码来源:2240.c


示例14: FindName

/// Gets the shared pointer to a column.
API::Column_sptr TableWorkspace::getColumn(const std::string &name) {
  auto ci = std::find_if(m_columns.begin(), m_columns.end(), FindName(name));
  if (ci == m_columns.end()) {
    std::string str = "Column " + name + " does not exist.\n";
    g_log.error(str);
    throw std::runtime_error(str);
  }
  return *ci;
}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:10,代码来源:TableWorkspace.cpp


示例15: D

sem_t *sem_open(const char *name, int oflag, mode_t mode, unsigned int value)
{
    sem_t *sem;

    D(bug("%s(%s, %d, %u, %u)\n", __FUNCTION__, name, oflag, mode, value));

    pthread_once(&once_control, _Init_Semaphore);

    if (name == NULL)
    {
        errno = EINVAL;
        return SEM_FAILED;
    }

    ObtainSemaphore(&sema_sem);
    sem = (sem_t *)FindName(&semaphores, (STRPTR)name);
    if (sem != NULL)
    {
        if ((oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
        {
            ReleaseSemaphore(&sema_sem);
            errno = EEXIST;
            return SEM_FAILED;
        }
    }
    else
    {
        if (!(oflag & O_CREAT))
        {
            ReleaseSemaphore(&sema_sem);
            errno = ENOENT;
            return SEM_FAILED;
        }
        
        sem = malloc(sizeof(sem_t));
        if (sem == NULL)
        {
            ReleaseSemaphore(&sema_sem);
            errno = ENOMEM;
            return SEM_FAILED;
        }

        if (sem_init(sem, 0, value))
        {
            free(sem);
            ReleaseSemaphore(&sema_sem);
            return SEM_FAILED;
        }
        // TODO: this string should be duplicated
        sem->node.ln_Name = (char *)name;
        AddTail(&semaphores, (struct Node *)sem);
    }
    ReleaseSemaphore(&sema_sem);

    return sem;
}
开发者ID:michalsc,项目名称:AROS,代码行数:56,代码来源:semaphore.c


示例16: NewAFile

static AFile* NewAFile (IFile* IF, FILE* F)
/* Create a new AFile, push it onto the stack, add the path of the file to
 * the path search list, and finally return a pointer to the new AFile struct.
 */
{
    StrBuf Path = AUTO_STRBUF_INITIALIZER;

    /* Allocate a AFile structure */
    AFile* AF = (AFile*) xmalloc (sizeof (AFile));

    /* Initialize the fields */
    AF->Line  = 0;
    AF->F     = F;
    AF->Input = IF;

    /* Increment the usage counter of the corresponding IFile. If this
     * is the first use, set the file data and output debug info if
     * requested.
     */
    if (IF->Usage++ == 0) {

 	/* Get file size and modification time. There a race condition here,
         * since we cannot use fileno() (non standard identifier in standard
         * header file), and therefore not fstat. When using stat with the
         * file name, there's a risk that the file was deleted and recreated
         * while it was open. Since mtime and size are only used to check
         * if a file has changed in the debugger, we will ignore this problem
         * here.
         */
     	struct stat Buf;
 	if (FileStat (IF->Name, &Buf) != 0) {
 	    /* Error */
 	    Fatal ("Cannot stat `%s': %s", IF->Name, strerror (errno));
 	}
       	IF->Size  = (unsigned long) Buf.st_size;
 	IF->MTime = (unsigned long) Buf.st_mtime;

 	/* Set the debug data */
 	g_fileinfo (IF->Name, IF->Size, IF->MTime);
    }

    /* Insert the new structure into the AFile collection */
    CollAppend (&AFiles, AF);

    /* Get the path of this file and add it as an extra search path.
     * To avoid file search overhead, we will add one path only once.
     * This is checked by the PushSearchPath function.
     */
    SB_CopyBuf (&Path, IF->Name, FindName (IF->Name) - IF->Name);
    SB_Terminate (&Path);
    AF->SearchPath = PushSearchPath (UsrIncSearchPath, SB_GetConstBuf (&Path));
    SB_Done (&Path);

    /* Return the new struct */
    return AF;
}
开发者ID:eakmeister,项目名称:cc65,代码行数:56,代码来源:input.c


示例17: GetModule

static unsigned GetModule (const char* Name)
/* Get a module name index from the file name */
{
    /* Make a module name from the file name */
    const char* Module = FindName (Name);
    if (*Module == 0) {
        Error ("Cannot make module name from `%s'", Name);
    }
    return GetStringId (Module);
}
开发者ID:gilligan,项目名称:snesdev,代码行数:10,代码来源:objfile.c


示例18: Add

bool c_CustomRendererVector::Add( c_CustomRenderer* DataLayer )
{
  if( FindName(DataLayer->m_Name.c_str()) )
  {
    return false;
  }
  
  m_CustomRendererVector.push_back(DataLayer);
  return true;
}
开发者ID:Victorcasas,项目名称:georest,代码行数:10,代码来源:c_CustomRenderer.cpp


示例19: FindName

bool csArchive::FileExists (const char *name, size_t *size) const
{
  ArchiveEntry *f = (ArchiveEntry *) FindName (name);

  if (!f)
    return false;
  if (size)
    *size = f->info.ucsize;
  return true;
}
开发者ID:BackupTheBerlios,项目名称:libjtv-svn,代码行数:10,代码来源:archive.cpp


示例20: assert

/*Returns true if found an appropriate name in the DB for chr, or false if 
  it did not found such name. Also changes nameChanged if the name was found but 
  changed since the last time we've called CheckName function */
bool CPokerTrackerThread::CheckName(int chr, bool &nameChanged)
{
	char		oh_scraped_name[k_max_length_of_playername]; 
	char		best_name[k_max_length_of_playername];
	bool		result = false, ok_scrape = false;
	int			i;


	assert(chr >= k_min_chair_number); 
	assert(chr <= k_max_chair_number);
	
	memset(oh_scraped_name, 0, k_max_length_of_playername);
	memset(best_name, 0, k_max_length_of_playername);
	
	nameChanged = false;
	if (p_game_state->state((p_game_state->state_index()-1)&0xff)->m_player[chr].m_name_known == 0)
		return false;

	strcpy_s(oh_scraped_name, k_max_length_of_playername, p_game_state->state((p_game_state->state_index()-1)&0xff)->m_player[chr].m_name);

	// Check for bad name scrape
	int len = (int) strlen(oh_scraped_name);
	for (i = 0; i < len; ++i)
	{
		if (oh_scraped_name[i]!='l' && oh_scraped_name[i]!='i' && oh_scraped_name[i]!='.' && oh_scraped_name[i]!=',')
		{
			ok_scrape = true;
			break;
		}
	}
	if (!ok_scrape)
		return false;

	// We already have the name, and it has not changed since we last checked, so do nothing
	if (_player_stats[chr].found && 0 == strcmp(_player_stats[chr].scraped_name, oh_scraped_name))
		return true;
	
	nameChanged = true;


	// We have not found the name in PT, go find it
	// First see if we can find the exact scraped name
	result = FindName(oh_scraped_name, best_name);

	if (result)
	{
		SetPlayerName(chr, true, best_name, oh_scraped_name);
	}
	else
	{
		SetPlayerName(chr, false, "", "");
	}

	return result;
}
开发者ID:ohzooboy,项目名称:oh,代码行数:58,代码来源:CPokerTrackerThread.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ FindNext函数代码示例发布时间:2022-05-30
下一篇:
C++ FindModule函数代码示例发布时间: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