QString CppHelperPluginConfigPage::getCurrentCompiler() const
{
    auto binary = QString{};
    if (m_compiler_paths->gcc->isChecked())
        binary = findBinary(DEFAULT_GCC_BINARY);
    else if (m_compiler_paths->clang->isChecked())
        binary = findBinary(DEFAULT_CLANG_BINARY);

    return binary;
}
예제 #2
0
static tagResult find(tagFile * const file, tagEntry * const entry,
                      const char *const name, const int options)
{
	tagResult result = TagFailure;
	file->search.name = name;
	file->search.nameLength = strlen(name);
	file->search.partial = (options & TAG_PARTIALMATCH) != 0;
	file->search.ignorecase = (options & TAG_IGNORECASE) != 0;
	fseek(file->fp, 0, SEEK_END);
	file->size = ftell(file->fp);
	rewind(file->fp);
	if ((file->sortMethod == TAG_SORTED && !file->search.ignorecase) ||
	        (file->sortMethod == TAG_FOLDSORTED && file->search.ignorecase))
		result = findBinary(file);
	else
		result = findSequential(file);

	if (result != TagSuccess)
		file->search.pos = file->size;
	else
	{
		file->search.pos = file->pos;
		if (entry != NULL)
			parseTagLine(file, entry);
	}
	return result;
}
bool dpLoader::unload(const char *path)
{
    if(dpBinary *bin=findBinary(path)) {
        unloadImpl(bin);
        return true;
    }
    return false;
}
예제 #4
0
void main() {
		int a[MAX] = {0, 2,1, 5,4,3, 9,8,7,6, 11,10};
		int n = 12;
		int num = 5;
		int pos;
		pos = findBinary(a, n, num);
		if (pos != -1)
				printf("a[%d] = %d\n", pos, a[pos]);
		else
				printf("Not found\n");
}
예제 #5
0
파일: readtags.c 프로젝트: pragmaware/ctags
static tagResult find (tagFile *const file, tagEntry *const entry,
					   const char *const name, const int options)
{
	tagResult result;
	if (file->search.name != NULL)
		free (file->search.name);
	file->search.name = duplicate (name);
	file->search.nameLength = strlen (name);
	file->search.partial = (options & TAG_PARTIALMATCH) != 0;
	file->search.ignorecase = (options & TAG_IGNORECASE) != 0;
	fseek (file->fp, 0, SEEK_END);
	file->size = ftell (file->fp);
	rewind (file->fp);
	if ((file->sortMethod == TAG_SORTED      && !file->search.ignorecase) ||
		(file->sortMethod == TAG_FOLDSORTED  &&  file->search.ignorecase))
	{
#ifdef DEBUG
		printf ("<performing binary search>\n");
#endif
		result = findBinary (file);
	}
	else
	{
#ifdef DEBUG
		printf ("<performing sequential search>\n");
#endif
		result = findSequential (file);
	}

	if (result != TagSuccess)
		file->search.pos = file->size;
	else
	{
		file->search.pos = file->pos;
		if (entry != NULL)
			parseTagLine (file, entry);
	}
	return result;
}
BinaryType* dpLoader::loadBinaryImpl(const char *path)
{
    dpBuilder::ScopedPreloadLock pl(dpGetBuilder());

    BinaryType *old = static_cast<BinaryType*>(findBinary(path));
    if(old) {
        dpTime t = dpGetMTime(path);
        if(t<=old->getLastModifiedTime()) { return old; }
    }

    BinaryType *ret = new BinaryType(m_context);
    if(ret->loadFile(path)) {
        if(old) { unloadImpl(old); }
        m_binaries.push_back(ret);
        addOnLoadList(ret);
        dpPrintInfo("loaded \"%s\"\n", ret->getPath());
    }
    else {
        delete ret;
        ret = nullptr;
    }
    return ret;
}