Esempio n. 1
0
int ATAManager::Startup()
{
	DeviceInfo	tmpInfo;
	
	// poll the hardware and insert each device into the map
	if(GetDeviceInformation(PRIMARY_IDE, DEVICE_0, tmpInfo))
	{
		ATADrivers.insert(pair<string, ATADriver*>(string("/dev/hda"), new ATADriver(PRIMARY_IDE, DEVICE_0)));
		ATAInformation.insert(pair<string, DeviceInfo>(string("/dev/hda"), tmpInfo));
// 		PrintATAInfo(tmpInfo);
	}
	
	if(GetDeviceInformation(PRIMARY_IDE, DEVICE_1, tmpInfo))
	{
		ATADrivers.insert(pair<string, ATADriver*>(string("/dev/hdb"), new ATADriver(PRIMARY_IDE, DEVICE_1)));
		ATAInformation.insert(pair<string, DeviceInfo>(string("/dev/hdb"), tmpInfo));
// 		PrintATAInfo(tmpInfo);
	}
	
	if(GetDeviceInformation(SECONDARY_IDE, DEVICE_0, tmpInfo))
	{
		ATADrivers.insert(pair<string, ATADriver*>(string("/dev/hdc"), new ATADriver(SECONDARY_IDE, DEVICE_0)));
		ATAInformation.insert(pair<string, DeviceInfo>(string("/dev/hdc"), tmpInfo));
// 		PrintATAInfo(tmpInfo);
	}
	
	if(GetDeviceInformation(SECONDARY_IDE, DEVICE_1, tmpInfo))
	{
		ATADrivers.insert(pair<string, ATADriver*>(string("/dev/hdd"), new ATADriver(SECONDARY_IDE, DEVICE_1)));
		ATAInformation.insert(pair<string, DeviceInfo>(string("/dev/hdd"), tmpInfo));
// 		PrintATAInfo(tmpInfo);
	}
	
	// once we have all the drives installed, go through and partition them
	list<ulong>	addrList;
	
	for(map<string, ATADriver*>::iterator it = ATADrivers.begin(), end = ATADrivers.end(); it != end; ++it)
	{
		addrList.clear();	// clear out the list first
		GetPartitionAddresses((*it).second, addrList);	// get the addresses
	
		char	charCounter = '1';
	
		// go through the list and make devices for each of these
		for(list<ulong>::iterator jt = addrList.begin(); jt != addrList.end(); ++jt)
		{
			ATADriver	*tmp = new ATADriver(*((*it).second));	// copy this device
			string		tmpStr(1, charCounter);
			
			tmp->ChangeBaseAddress(*jt);	// change it's base address
			
			// insert the device with it's new name into the manager
			ATADrivers.insert(pair<string, ATADriver*>((*it).first + tmpStr, tmp));
			
			++charCounter;
		}
	}
	
	return(0);
}
Esempio n. 2
0
naRef naHash_cget(naRef hash, char* key)
{
    struct naStr str;
    naRef result, key2;
    tmpStr(&key2, &str, key);
    return naHash_get(hash, key2, &result) ? result : naNil();
}
Esempio n. 3
0
    void SetSourcePath(string path) {
        string tmpStr(path);
        this->SourcePath = path;
        transform(tmpStr.begin(), tmpStr.end(), tmpStr.begin(), ::toupper);
        std::size_t found = tmpStr.find_last_of("/\\");
        if(found != string::npos) {
            tmpStr = tmpStr.substr(found+1);
        }
        // The file name is in 8+3, padded with spaces
        // tmpStr contains the file Name.
        std::size_t dotPosition = tmpStr.find_last_of(".");
        std::size_t maxNameSize = (size_t)8;

        string fileName = tmpStr.substr(0, min(maxNameSize, dotPosition));
        std::size_t nameSize = fileName.size();

        if(nameSize < maxNameSize) {
            fileName.append(maxNameSize - nameSize, ' ');
        }

        string extension;

        if(dotPosition != string::npos) {
            extension = tmpStr.substr(dotPosition + 1);
        }
        std::size_t maxExtSize = (size_t)3;
        std::size_t extSize = extension.size();
        if(extSize < maxExtSize) {
            fileName.append(maxExtSize - extSize, ' ');
        }

        memcpy(this->AmsDosName, fileName.c_str(), maxNameSize);
        memcpy(this->AmsDosName + maxNameSize, extension.c_str(), maxExtSize);        
    }
Esempio n. 4
0
unsigned char *CSD_PFC::extractInBlock(unsigned int block, unsigned int o)
{
	size_t pos = blocks->get(block);
    uint64_t delta = 0;

	// Read the first string
	string tmpStr((char*)(text+pos));
	pos += tmpStr.length()+1;

	for (unsigned int j=0; j<o; j++)
	{
		// Decode the prefix
		pos += VByte::decode(text+pos, text+bytes, &delta);

		// Copy the suffix
		tmpStr.resize(delta);
		tmpStr.append((char*)(text+pos));

		// Go forward the suffix size
        pos += tmpStr.length()-delta+1;
	}

	unsigned char *buf = new unsigned char[tmpStr.length()+1];
	strcpy((char*)buf, tmpStr.c_str());
	return buf;
}
Esempio n. 5
0
// invoke a static method
int	oXCompLib::invokeMethod(qlong pMethodId, EXTCompInfo* pECI){
	// no static methods by default
	qstring		tmpString;
	tmpString.appendFormattedString("Unknown static method call %li",pMethodId);
	str255		tmpStr(tmpString.cString());
	ECOaddTraceLine(&tmpStr);

	return 1L;
};		
void 
RightLogger::setRight(const char *rightName)
{
    if (rightName)      // NULL bad for string class and au_to_text()
    {
        string tmpStr(rightName);   // setRight() takes a string&
        setRight(tmpStr);
    }
}
Esempio n. 7
0
void SearchWidget::matchString(const std::string& str) {
	StationNames::const_iterator it = _stationNames.begin();
	for ( ; it != _stationNames.end(); it++ ) {
		QString tmpStr(it->c_str());
		bool match = str.empty() ||
		             tmpStr.contains(str.c_str(), Qt::CaseInsensitive);
		if ( match )
			addMatch(*it);
	}
}
Esempio n. 8
0
unsigned int CSD_PFC::locateInBlock(size_t block, const unsigned char *str, unsigned int len)
{
	if(block>=nblocks){
		return 0;
	}

    uint64_t delta = 0;
	unsigned int idInBlock = 0;
	unsigned int commonPrefix = 0;

	size_t pos = blocks->get(block);

	// Read the first string
	std::string tmpStr((char*)text+pos);

	pos+=tmpStr.length()+1;
	idInBlock++;

	// Read the rest
	while ( (idInBlock<blocksize) && (pos<bytes))
	{
		// Decode the prefix
		pos += VByte::decode(text+pos, text+bytes, &delta);

		// Copy the suffix
		tmpStr.resize(delta);
		tmpStr.append((char*)(text+pos));

		if (delta >= commonPrefix)
		{
			// Compare tmpString with the searched one, only after commonPrefix characters.
			// (We already knew that commonPrefix was common anyway).
			commonPrefix += longest_common_prefix(
					(unsigned char*)tmpStr.c_str()+commonPrefix,
					str+commonPrefix,
					tmpStr.length()-commonPrefix,
					len-commonPrefix
				);

			// We found it!
			if ((commonPrefix == len) && (tmpStr.length() == len)) {
				return idInBlock;
			}
		} else {
			// The common prefix is even worse than before, not found.
			return 0;
		}

		pos += tmpStr.length()+1-delta;
		idInBlock++;
	}

	// We checked the whole block but did not find it.
	return 0;
}
Esempio n. 9
0
void Rmi::processReply(char* data, size_t size)
{
    // read data and deserialize into a reply dataset

    DSptr   reply(new DataSet<TextSerializer> ());
    reply->deserialize(data);

    // get the request id and then route reply back to that request

    int* requestIdPtr=reply->get<int>("REQUEST", "REQUESTID");
    if (!requestIdPtr)
    {
        std::ostringstream tmp;
        std::string tmpStr (data, size);
        tmp << "Dropping reply. No RequestID found. UI may hang - data: " << tmpStr.c_str() 
            << "\n";
        LOG_ERROR(tmp.str());
        return;
    }

    if (debug_)
    {
        std::cout  << "reply data is - " << data << std::endl;
        std::cout << "the request id is " << *requestIdPtr<< std::endl;
    }

    // find request in map of requests

    IdRequestMap::iterator ret = requests_.find(*requestIdPtr);
    if (ret==requests_.end())
    {
        std::ostringstream tmp;
        std::string tmpStr (data, size);
        tmp << "No request waiting for this reply - : " << tmpStr.c_str() 
            << "\n";
        LOG_ERROR(tmp.str());
        return;
    }
    // get the request associated with this id
    (ret->second)->setReply(reply);
}
Esempio n. 10
0
//replaces all occurances of "searchChar" in "str" with "replChar"
SbString XipReplaceChar(const char * str, const char & searchChar, const char & replChar)
{
    std::string tmpStr(str);
    for (unsigned int i=0; i<tmpStr.size(); i++)
    {
        if ( tmpStr.at(i) == searchChar )
        {
            tmpStr[i] = replChar;
        }
    }
    return SbString(tmpStr.c_str());
}
	BSFixedString Substring(StaticFunctionTag* thisInput, BSFixedString theString, UInt32 startIndex, UInt32 len)
	{
		if (startIndex < 0)
			return NULL;

		std::string tmpStr(theString.data);
		if (startIndex >= tmpStr.length())
			return NULL;

		std::string sub = (len) ? tmpStr.substr(startIndex, len) : tmpStr.substr(startIndex);
		return sub.c_str();
	}
Esempio n. 12
0
    void Console::addString(const std::string& str)
    {
        history.push_back(str);
        int pos = 2;

        if(!strings.empty()) pos = strings.back().GetPosition().y + 16;
        sf::String tmpStr(history.back(), font, 14.f);
        tmpStr.SetColor(sf::Color::White);
        tmpStr.SetPosition(5, pos);
        strings.push_back(tmpStr);

        if(strings.size() > ((unsigned int) ((panelRect.GetPointPosition(2).y - panelRect.GetPointPosition(0).y) / 17))) removeString();
    }
Esempio n. 13
0
QString MythUIText::cutDown(const QString &data, MythFontProperties *font,
                            bool multiline)
{
    int length = data.length();
    if (length == 0)
        return data;

    int maxwidth = GetArea().width();
    int maxheight = GetArea().height();
    int justification = Qt::AlignLeft | Qt::TextWordWrap;
    QFontMetrics fm(font->face());

    int margin = length - 1;
    int index = 0;
    int diff = 0;

    while (margin > 0)
    {
        if (multiline)
            diff = maxheight - fm.boundingRect(0, 0, maxwidth, maxheight,
                                               justification,
                                               data.left(index + margin + 1)
                                               ).height();
        else
            diff = maxwidth - fm.width(data, index + margin + 1);
        if (diff >= 0)
            index += margin;

        margin /= 2;

        if (index + margin >= length - 1)
            margin = (length - 1) - index;
    }

    if (index < length - 1)
    {
        QString tmpStr(data);
        tmpStr.truncate(index);
        if (index >= 3)
            tmpStr.replace(index - 3, 3, "...");
        return tmpStr;
    }

    return data;

}
Esempio n. 14
0
void RTTIBuilder::push_array(llvm::Constant * CI, uint64_t dim, Type* valtype, Dsymbol * mangle_sym)
{
	std::string tmpStr(valtype->arrayOf()->toChars());
	tmpStr.erase( remove( tmpStr.begin(), tmpStr.end(), '[' ), tmpStr.end() );
	tmpStr.erase( remove( tmpStr.begin(), tmpStr.end(), ']' ), tmpStr.end() );
	tmpStr.append("arr");

	std::string initname(mangle_sym?mangle_sym->mangle():".ldc");
    initname.append(".rtti.");
    initname.append(tmpStr);
    initname.append(".data");

    LLGlobalVariable* G = new llvm::GlobalVariable(
        *gIR->module, CI->getType(), true, TYPEINFO_LINKAGE_TYPE, CI, initname);
    G->setAlignment(valtype->alignsize());

    push_array(dim, DtoBitCast(G, DtoType(valtype->pointerTo())));
}
void
RightAuthenticationLogger::logSuccess(uid_t authenticator, uid_t target, const char *targetName)
{
    if (false == open())
        return;
    writeCommon();
    
    // au_to_arg32() is really meant for auditing syscall arguments; 
    // we're slightly abusing it to get descriptive strings for free.  
    writeToken(au_to_arg32(1, authenticatorStr, authenticator), "authenticator");
    string tmpStr(authenticatedAsStr);
    // targetName shouldn't be NULL on a successful authentication, but allow
    // for programmer screwups
    tmpStr += targetName ? targetName : unknownUserStr;
    writeToken(au_to_arg32(2, tmpStr.c_str(), target), "target");
    writeReturn(0, 0);
    close();
}
void 
RightAuthenticationLogger::logAuthorizationResult(const char *client, const char *authCreator, int errcode)
{
    if (false == open())
        return;
    writeCommon();
    string tmpStr(clientStr);
    tmpStr += client ? client : unknownClientStr;
    writeToken(au_to_text(tmpStr.c_str()), "Authorization client");
    tmpStr.clear();
    tmpStr = authCreatorStr;
    tmpStr += authCreator ? authCreator : unknownAuthCreatorStr;
    writeToken(au_to_text(tmpStr.c_str()), "Authorization creator");
    if (errAuthorizationSuccess == errcode)
        writeReturn(0, 0);
    else
        writeReturn(EPERM, errcode);
    close();
}
Esempio n. 17
0
int CMDSimMW::initSetBrdDlg(QDialog *pdlg) {
    if(pdlg != NULL) {
        //set parent.. prevent mem leak.
        _pMainLay = new QGridLayout(pdlg);
        _pMainLay->setContentsMargins(30, 11, 30, 11);

        for(int i = 0; i < LVDTBrds; i++) {
            QString tmpStr(cvcp936("LVDT板卡"));
            tmpStr.append(QString::number(i).toUtf8());
            tmpStr.append(": ");
            _plblLVDT[i] = new QLabel(tmpStr, pdlg);
            _pleLVDT[i] = new QLineEdit(pdlg);
       }
        _pMainLay->setSpacing(20);
        pdlg->setLayout(_pMainLay);
        return EXE_SUCCESS;
    }
    return EXE_FAIL;
}
Esempio n. 18
0
void RTTIBuilder::push_array(llvm::Constant *CI, uint64_t dim, Type *valtype,
                             Dsymbol *mangle_sym) {
  std::string tmpStr(valtype->arrayOf()->toChars());
  tmpStr.erase(remove(tmpStr.begin(), tmpStr.end(), '['), tmpStr.end());
  tmpStr.erase(remove(tmpStr.begin(), tmpStr.end(), ']'), tmpStr.end());
  tmpStr.append("arr");

  std::string initname(mangle_sym ? mangle(mangle_sym) : ".ldc");
  initname.append(".rtti.");
  initname.append(tmpStr);
  initname.append(".data");

  const LinkageWithCOMDAT lwc(TYPEINFO_LINKAGE_TYPE, supportsCOMDAT());

  auto G = new LLGlobalVariable(gIR->module, CI->getType(), true,
                                lwc.first, CI, initname);
  setLinkage(lwc, G);
  G->setAlignment(DtoAlignment(valtype));

  push_array(dim, DtoBitCast(G, DtoType(valtype->pointerTo())));
}
Esempio n. 19
0
BOOL CProfilesDlg::OnInitDialog() 
{
    USES_CONVERSION;

    CDialog::OnInitDialog();
    
    PRUnichar *curProfileName = nsnull;

    // Fill the list of profiles
    nsresult rv;
    nsCOMPtr<nsIProfile> profileService = 
             do_GetService(NS_PROFILE_CONTRACTID, &rv);
    profileService->GetCurrentProfile(&curProfileName);

    PRInt32     selectedRow = 0;
    PRUint32    listLen;
    PRUnichar   **profileList;
    rv = profileService->GetProfileList(&listLen, &profileList);

    for (PRUint32 index = 0; index < listLen; index++)
    {
        CString tmpStr(W2T(profileList[index]));
        m_ProfileList.AddString(tmpStr);
        if (wcscmp(profileList[index], curProfileName) == 0)
            selectedRow = index;
    }
    nsMemory::Free(curProfileName);

    m_ProfileList.SetCurSel(selectedRow);

    if (m_bAtStartUp)
    {
        GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
    }
    
    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 20
0
File: main.cpp Progetto: Risca/sgct
void myDropCallback(int count, const char** paths)
{
	if (gEngine->isMaster())
	{
		std::size_t found;

		//simpy pick the first path to transmit
		std::string tmpStr(paths[0]);

		//transform to lowercase
		std::transform(tmpStr.begin(), tmpStr.end(), tmpStr.begin(), ::tolower);

		found = tmpStr.find(".jpg");
		if (found != std::string::npos)
		{
			imagePaths.addVal(std::pair<std::string, int>(paths[0], IM_JPEG));
			transfer.setVal(true);
			return;
		}

		found = tmpStr.find(".jpeg");
		if (found != std::string::npos)
		{
			imagePaths.addVal(std::pair<std::string, int>(paths[0], IM_JPEG));
			transfer.setVal(true);
			return;
		}

		found = tmpStr.find(".png");
		if (found != std::string::npos)
		{
			imagePaths.addVal(std::pair<std::string, int>(paths[0], IM_PNG));
			transfer.setVal(true);
			return;
		}
	}
}
Esempio n. 21
0
    void DiGLUtil::InitExtensions()
    {
        const GLubyte* pcVer = glGetString(GL_VERSION);
        DI_ASSERT(pcVer);

        // Version
        DiString tmpStr((const char*)pcVer);
        DI_INFO("GL_VERSION = %s", (const char*)pcVer);
        mVersion = tmpStr.substr(0, tmpStr.find(" "));

        // Vendor
        const GLubyte* pcVendor = glGetString(GL_VENDOR);
        tmpStr = (const char*)pcVendor;
        DI_INFO("GL_VENDOR = %s", (const char*)pcVendor);
        mVendor = tmpStr.substr(0, tmpStr.find(" "));

        // Renderer
        const GLubyte* pcRenderer = glGetString(GL_RENDERER);
        tmpStr = (const char*)pcRenderer;
        DI_INFO("GL_RENDERER = %s", (const char*)pcRenderer);

        // Extension list
        std::stringstream ext;
        std::string str;

        const GLubyte* pcExt = glGetString(GL_EXTENSIONS);
        DI_INFO("Supported GL extensions:");
        DiLogManager::GetInstancePtr()->Output(LOG_LEVEL_LOG, (const char*)pcExt);

        ext << pcExt;

        while (ext >> str)
        {
            mExtensionList.insert(str.c_str());
        }
    }
Esempio n. 22
0
/*!
 * Parse XML file and fill definition object
 */
bool XMLParser::Parse(FILE* pFile, AsterixDefinition* pDefinition, const char* filename)
{
	m_pDef = pDefinition;
	m_pFileName = filename;

	for (;;)
	{
		int done;
		int len;

		len = (int)fread(m_pBuff, 1, BUFFSIZE, pFile);
		if (ferror(pFile))
		{
#ifdef PYTHON_WRAPPER
            PyErr_SetString(PyExc_IOError, "Format file read error.");
#else
			Tracer::Error("Format file read error.");
#endif
			return false;
		}
		done = feof(pFile);

		if (XML_Parse(m_Parser, m_pBuff, len, done) == XML_STATUS_ERROR)
		{
			std::string tmpStr("Format file parse error: ");
			tmpStr += XML_ErrorString(XML_GetErrorCode(m_Parser));
			Error(tmpStr.c_str());
			return false;
		}

		if (done)
			break;
	}

	return !m_bErrorDetectedStopParsing;
}
Esempio n. 23
0
OffsetLinenumMap
JavaJncReader::GetOffsetLines(std::wstring funcName)
{
    int line = -1;
    std::string file;

    if (! m_lineMap.isEmpty())
    {
        return m_lineMap;
    }

    //fprintf(debugFP, "============================\n");
    //DumpJncPcStackInfoMap(debugFP);

    //if (gJncReaderVerbose)
    //{
    //fprintf (stderr, "CJNCReader::GetOffsetLines  (size:%lu) n",
    //           m_jncPcStackInfoMap.size());
    //}

    JncPcStackInfoMap::iterator it, itEnd;

    for (it = m_jncPcStackInfoMap.begin(), itEnd = m_jncPcStackInfoMap.end(); it != itEnd; ++it)
    {
        gtUInt64  pc = it->first;

        if (nullptr != debugFP)
        {
            fprintf(debugFP,
                    "loadaddr: 0x%llx, pc = 0x%llx, stack size = %u\n",
                    m_LoadAddr, pc, it->second->numstackframes);
        }

        int i = 0;

        for (i = 0 ; i < it->second->numstackframes; i++)
        {
            if (m_jncMethodMap[it->second->methods[i]].name.empty())
            {
                if (debugFP != nullptr)
                {
                    fprintf(debugFP, "Empty methods name..\n");
                }
                continue;
            }

            std::wstring tmpStr(m_jncMethodMap[it->second->methods[i]].name.begin(),
                                m_jncMethodMap[it->second->methods[i]].name.end());

            // parse method signature
            char parsedMethodSig[OS_MAX_PATH] = { 0 };
            parseMethodSignature(nullptr, m_jncMethodMap[it->second->methods[i]].signature.data(), parsedMethodSig);
            // append parsed signature to tmpStr
            tmpStr.append(parsedMethodSig, parsedMethodSig + strlen(parsedMethodSig));

            if ((!funcName.empty()) && wcscmp(funcName.c_str(), tmpStr.c_str()))
            {
                continue;
            }

            bool rv = _getSrcInfoFromBcAndMethodID(it->second->bcis[i],
                                                   it->second->methods[i],
                                                   line,
                                                   file);

            if (false == rv)
            {
                continue;
            }

            // Add it to offset line table
            unsigned int codeOffset = (unsigned int)(pc - m_LoadAddr);
            m_lineMap[codeOffset] = line;

            // if (gJncReaderVerbose)
            if (nullptr != debugFP)
            {
                fprintf(debugFP, "    Frame:%2u, bcis:%4d, method:(%lld) %s (%d,%s)\n",
                        i, it->second->bcis[i],
                        it->second->methods[i],
                        m_jncMethodMap[it->second->methods[i]].name.c_str(),
                        line, file.c_str());
            }
        }
    }

    return m_lineMap;
} // GetOffsetLines(wstring funcName)
Esempio n. 24
0
// GetOffsetLines(wstring funcName)
//
OffsetLinenumMap
JavaJncReader::GetOffsetLines(wstring funcName)
{
    int line = -1;
    string file;

    if (! m_lineMap.isEmpty())
    {
        return m_lineMap;
    }

    if (gJncReaderVerbose)
    {
        fprintf(stderr, "CJNCReader::GetOffsetLines  (size:%lu) n",
                m_jncPcStackInfoMap.size());
    }

    JncPcStackInfoMap::iterator it = m_jncPcStackInfoMap.begin();
    JncPcStackInfoMap::iterator itEnd = m_jncPcStackInfoMap.end();

    for (; it != itEnd; it++)
    {
        uint64_t  pc = it->first;

        if (gJncReaderVerbose)
        {
            fprintf(stderr,
                    "loadaddr: 0x%lx, size:%ld, pc = 0x%lx, stack size = %u\n",
                    m_loadAddr, m_textSize,
                    it->first, it->second->numstackframes);
        }

        int i = 0;

        for (i = 0 ; i < it->second->numstackframes; i++)
        {
            wstring tmpStr(m_jncMethodMap[it->second->methods[i]].name.begin(),
                           m_jncMethodMap[it->second->methods[i]].name.end());

            // parse method signature
            char parsedMethodSig[OS_MAX_PATH] = { 0 };
            parseMethodSignature(nullptr, m_jncMethodMap[it->second->methods[i]].signature.data(), parsedMethodSig);
            // append parsed signature to tmpStr
            tmpStr.append(parsedMethodSig, parsedMethodSig + strlen(parsedMethodSig));

            if ((!funcName.empty()) && wcscmp(funcName.c_str(), tmpStr.c_str()))
            {
                continue;
            }

            _getSrcInfoFromBcAndMethodID(it->second->bcis[i],
                                         it->second->methods[i],
                                         line,
                                         file);

            // Add it to offset line table
            unsigned int codeOffset = pc - m_loadAddr;
            m_lineMap[codeOffset] = line;

            if (gJncReaderVerbose)
            {
                fprintf(stderr, "    Frame:%2u, bcis:%4d, method:(%lx) %s (%d,%s)\n",
                        i, it->second->bcis[i],
                        (uint64_t)it->second->methods[i],
                        m_jncMethodMap[it->second->methods[i]].name.c_str(),
                        line, file.c_str());
            }
        }
    }

    return m_lineMap;
} // GetOffsetLines(wstring funcName)
Esempio n. 25
0
int main( int argc, char **argv )
{
	//	Define MEMORYREPORT on windows platfroms to enable debug memory heap checking
#if defined( MEMORYREPORT ) && defined( _WIN32 )
	TCHAR logPath[ MAX_PATH ];
	::GetCurrentDirectory( MAX_PATH, logPath );
	::_tcscat_s( logPath, _T( "\\MemoryReport.txt") );

	//	We leak the handle to this file, on purpose, so that the ::_CrtSetReportFile() can output it's memory
	//	statistics on app shutdown
	HANDLE hLogFile;
	hLogFile = ::CreateFile( logPath, GENERIC_WRITE,
		FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );

	::_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG );
	::_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG );
	::_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG );

	::_CrtSetReportFile( _CRT_ASSERT, hLogFile );
	::_CrtSetReportFile( _CRT_ERROR, hLogFile );
	::_CrtSetReportFile( _CRT_WARN, hLogFile );

	int tmp = ::_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
	tmp |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF;
	::_CrtSetDbgFlag( tmp );

	//	By looking at the memory leak report that is generated by this debug heap, there is a number with
	//	{} brackets that indicates the incremental allocation number of that block.  If you wish to set
	//	a breakpoint on that allocation number, put it in the _CrtSetBreakAlloc() call below, and the heap
	//	will issue a bp on the request, allowing you to look at the call stack
	//	::_CrtSetBreakAlloc( 997 );

#endif /* MEMORYREPORT */

	// Declare the supported options.
	po::options_description desc( "clFFT Runtime Test command line options" );
	desc.add_options()
		( "help,h",				"produces this help message" )
		( "verbose,v",			"print out detailed information for the tests" )
		( "noVersion",     "Don't print version information from the clFFT library" )
		( "noInfoCL",      "Don't print information from the OpenCL runtime" )
		( "cpu,c",         "Run tests on a CPU device" )
		( "gpu,g",         "Run tests on a GPU device (default)" )
		( "pointwise,p",         "Do a pointwise comparison to determine test correctness (default: use root mean square)" )
		( "tolerance,t",        po::value< float >( &tolerance )->default_value( 0.001f ),   "tolerance level to use when determining test pass/fail" )
		( "numRandom,r",        po::value< size_t >( &number_of_random_tests )->default_value( 2000 ),   "number of random tests to run" )
		( "seed",        po::value< time_t >( &random_test_parameter_seed )->default_value( time(NULL)%1308000000 ),
						"seed to use for the random test. defaults to time(NULL)" )
						// modulo lops off the first few digits of the time value to make the seed easier to type
						// even without these digits, the seed value won't wrap around until 2036 or later
		( "short,s",         "Run radix 2 tests; no random testing" )
		( "medium,m",         "Run all radices; no random testing" )
		;

	//	Parse the command line options, ignore unrecognized options and collect them into a vector of strings
	po::variables_map vm;
	po::parsed_options parsed = po::command_line_parser( argc, argv ).options( desc ).allow_unregistered( ).run( );
	po::store( parsed, vm );
	po::notify( vm );
	std::vector< std::string > to_pass_further = po::collect_unrecognized( parsed.options, po::include_positional );

	std::cout << std::endl;

	size_t mutex = ((vm.count( "gpu" ) > 0) ? 1 : 0)
		| ((vm.count( "cpu" ) > 0) ? 2 : 0);
	if ((mutex & (mutex-1)) != 0) {
		terr << _T("You have selected mutually-exclusive OpenCL device options:") << std::endl;
		if (vm.count ( "cpu" )  > 0) terr << _T("    cpu, c	Run tests on a CPU device" ) << std::endl;
		if (vm.count ( "gpu" )  > 0) terr << _T("    gpu, g	Run tests on a GPU device" ) << std::endl;
		return 1;
	}

	if( vm.count( "cpu" ) )
	{
		device_type = CL_DEVICE_TYPE_CPU;
	}

	if( vm.count( "gpu" ) )
	{
		device_type	= CL_DEVICE_TYPE_GPU;
		device_gpu_list = ~0;
	}

	//	Print version by default
	if( !vm.count( "noVersion" ) )
	{
		const int indent = countOf( "clFFT client API version: " );
		tout << std::left << std::setw( indent ) << _T( "clFFT client API version: " )
			<< clfftVersionMajor << _T( "." )
			<< clfftVersionMinor << _T( "." )
			<< clfftVersionPatch << std::endl;

		cl_uint libMajor, libMinor, libPatch;
		clfftGetVersion( &libMajor, &libMinor, &libPatch );

		tout << std::left << std::setw( indent ) << _T( "clFFT runtime version: " )
			<< libMajor << _T( "." )
			<< libMinor << _T( "." )
			<< libPatch << std::endl << std::endl;
	}

	//	Print clInfo by default
	if( !vm.count( "noInfoCL" ) )
	{
		cl_context tempContext = NULL;
		cl_command_queue tempQueue = NULL;
		cl_event tempEvent = NULL;
		std::vector< cl_device_id > device_id = ::initializeCL( device_type, device_gpu_list, tempContext, true );
		::cleanupCL( &tempContext, &tempQueue, 0, NULL, 0, NULL, &tempEvent );
	}

	if( vm.count( "help" ) )
	{
		std::cout << desc << std::endl;
		return 0;
	}

	if( vm.count( "verbose" ) )
	{
		verbose = true;
	}
	else
	{
		verbose = false;
	}

	if( vm.count( "short" ) && vm.count( "medium" ) )
	{
		terr << _T("Options 'short' and 'medium' are mutually-exclusive.  Please select only one.") << std::endl;
		return 1;
	}

	//	Create a new argc,argv to pass to InitGoogleTest
	//	First parameter of course is the name of this program
	std::vector< const char* > myArgv;

	//	Push back a pointer to the executable name
	if( argc > 0 )
		myArgv.push_back( *argv );

	//	Push into our new argv vector any parameter the user passed, except to filter their gtest_filter expressions
	std::string userFilter;
	for( int i = 1; i < argc; ++i )
	{
		if( vm.count( "short" ) || vm.count( "medium" ) )
		{
			std::string tmpStr( argv[ i ] );
			std::string::size_type pos = tmpStr.find( "gtest_filter" );
			if( pos == std::string::npos )
			{
				myArgv.push_back( argv[ i ] );
			}
			else
			{
				//  Capture the users filter, but only the regexp portion
				userFilter = argv[ i ];
				userFilter.erase( 0, 15 );
			}
		}
		else
		{
			myArgv.push_back( argv[ i ] );
		}
	}

	std::string newFilter;
	if( vm.count( "short" ) )
	{
		newFilter += "--gtest_filter=*accuracy_test_pow2*";
		if( userFilter.size( ) )
		{
			newFilter += ":";
			newFilter += userFilter;
		}
		myArgv.push_back( newFilter.c_str( ) );
	}

	if( vm.count( "medium" ) )
	{
		newFilter += "--gtest_filter=";
		if( userFilter.size( ) )
		{
			newFilter += userFilter;
			newFilter += ":";
		}
		newFilter += "-*Random*";
		myArgv.push_back( newFilter.c_str( ) );
	}

	if( vm.count( "pointwise" ) )
	{
		comparison_type = pointwise_compare;
	}
	else
	{
		comparison_type = root_mean_square;
	}

	int myArgc	= static_cast< int >( myArgv.size( ) );

	std::cout << "Result comparison tolerance is " << tolerance << std::endl;

	::testing::InitGoogleTest( &myArgc, const_cast< char** >( &myArgv[ 0 ] ) );

	return RUN_ALL_TESTS();
}
void TutorialDataCenter::InitXMLData()
{
	if (mIsLoadData)
	{
		return ;
	}
	mIsLoadData = true;

	const char* pFile = "Data/Tutorials.bin";
	char *xmlString =(char*) GameResourceManager::sharedManager()->loadXml(pFile);
	xmlDocPtr pDoc = xmlReadMemory(xmlString, strlen(xmlString), NULL, "UTF-8", XML_PARSE_RECOVER);
	xmlNodePtr pRoot = xmlDocGetRootElement(pDoc);

	if(pRoot != NULL)
	{
		xmlNodePtr pChildrenNode = pRoot->children;
		while (pChildrenNode != NULL)
		{
			unsigned int id = 0;
			bool isExpansionMainMenu = false;
			bool isTaskHead = false;
			bool IsNewWnd = false;
			bool IsAllowInEmptyArea = false;
			unsigned int eventType = 1;
			OneTutorialData oneTutorialData;

			if(xmlStrcmp(pChildrenNode->name, BAD_CAST"Tutorial") == 0)
			{
				xmlAttrPtr attrPtr = pChildrenNode->properties;

				while (attrPtr != NULL)
				{
					if (!xmlStrcmp(attrPtr->name, BAD_CAST "ID"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ID");

						id = atoi((const char*)szAttr);
						oneTutorialData.nId = id;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "UILayout"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "UILayout");

						oneTutorialData.szUiLayoutName = (const char*)szAttr;
												
						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "DstUILayout"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "DstUILayout");

						oneTutorialData.szUiDstLayoutName = (const char*)szAttr;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlType"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlType");

						oneTutorialData.szControlType = (const char*)szAttr;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlName"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlName");

						oneTutorialData.szControlName = (const char*)szAttr;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlTipType"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlTipType");

						oneTutorialData.nTipType = atoi((const char*)szAttr);

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlTipContent"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlTipContent");

						oneTutorialData.szControlContent = (const char*)szAttr;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlTipRelativePt"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlTipRelativePt");

						CCPoint pt;
						std::string tmpStr((const char*)szAttr);
						int endPos = tmpStr.find("/");
						pt.x = atoi(tmpStr.substr(0,endPos).c_str());
						pt.y = atoi(tmpStr.substr(endPos+1,tmpStr.length()-endPos-1).c_str());

						oneTutorialData.relativePoint = pt;
						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "TutorialType"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "TutorialType");

						oneTutorialData.nType = atoi((const char*)szAttr);

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "nextTutorial"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "nextTutorial");

						oneTutorialData.nNextId = atoi((const char*)szAttr);

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "IsExpansionMainMenu"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "IsExpansionMainMenu");

						if (strcmp((const char*)szAttr,"true") == 0 || strcmp((const char*)szAttr,"TRUE") == 0)
						{
							isExpansionMainMenu = true;
						}

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "IsTaskHeader"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "IsTaskHeader");

						if (strcmp((const char*)szAttr,"true") == 0 || strcmp((const char*)szAttr,"TRUE") == 0)
						{
							isTaskHead = true;
						}

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "IsNewWnd"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "IsNewWnd");

						if (strcmp((const char*)szAttr,"true") == 0 || strcmp((const char*)szAttr,"TRUE") == 0)
						{
							IsNewWnd = true;
						}

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlType_2"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlType_2");

						oneTutorialData.szControlType_2 = (const char*)szAttr;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlName_2"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlName_2");

						oneTutorialData.szControlName_2 = (const char*)szAttr;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlTipType_2"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlTipType_2");

						oneTutorialData.nTipType_2 = atoi((const char*)szAttr);

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlTipContent_2"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlTipContent_2");

						oneTutorialData.szControlContent_2 = (const char*)szAttr;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlTipRelativePt_2"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlTipRelativePt_2");

						CCPoint pt;
						std::string tmpStr((const char*)szAttr);
						int endPos = tmpStr.find("/");
						pt.x = atoi(tmpStr.substr(0,endPos).c_str());
						pt.y = atoi(tmpStr.substr(endPos+1,tmpStr.length()-endPos-1).c_str());

						oneTutorialData.relativePoint_2 = pt;
						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlPos"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlPos");

						oneTutorialData.nPos = atoi((const char*)szAttr);

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlPos_2"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlPos_2");

						int value = atoi((const char*)szAttr);
						if (-1 == value)
						{
							oneTutorialData.IsCareDstPos = false;
						}
						else
						{
							oneTutorialData.nPos_2 = value;
						}						

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlUIType_2"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlUIType_2");

						int type = GetUITypeByString((const char*)szAttr);
						oneTutorialData.nUIType_2 = type;

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "ControlEventType"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "ControlEventType");

						int type = atoi((const char*)szAttr);
						eventType = type;						

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "TaskId"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "TaskId");

						int taskId = atoi((const char*)szAttr);
						oneTutorialData.nTaskId = taskId;						

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "When"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "When");

						int when = atoi((const char*)szAttr);
						oneTutorialData.nWhen = when;						

						xmlFree(szAttr);
					}
					else if (!xmlStrcmp(attrPtr->name, BAD_CAST "IsAllowInEmptyArea"))
					{
						xmlChar* szAttr = xmlGetProp(pChildrenNode,BAD_CAST "IsAllowInEmptyArea");

						if (strcmp((const char*)szAttr,"true") == 0 || strcmp((const char*)szAttr,"TRUE") == 0)
						{
							IsAllowInEmptyArea = true;
						}				

						xmlFree(szAttr);
					}

					attrPtr = attrPtr->next;
				}

			}

			if (id != 0)
			{
				oneTutorialData.isExpansionMainMenu = isExpansionMainMenu;
				oneTutorialData.IsTaskHeader = isTaskHead;
				oneTutorialData.IsNewWnd = IsNewWnd;
				oneTutorialData.nEventType = eventType;
				oneTutorialData.IsAllowInEmptyArea = IsAllowInEmptyArea;
				mIdAndTutorialData.insert(std::make_pair(id,oneTutorialData));
			}

			pChildrenNode = pChildrenNode->next;
		}
	}

	mCurIter = mIdAndTutorialData.end();

	free(xmlString);
	xmlFreeDoc(pDoc);

	return ;
}
// -----------------------------------------------------------------------
//  TestParser: The DocTypeHandler interface
// -----------------------------------------------------------------------
void TestParser::attDef(const   DTDElementDecl& elemDecl
                        , const DTDAttDef&      attDef
                        , const bool            ignoring)
{
    if (fOutputType == OutputType_Debug)
    {
        XERCES_STD_QUALIFIER cout << "Got ATTDEF:\n    "
             << "Name: " << StrX(attDef.getFullName())
             << ", Type: "
             << StrX(XMLAttDef::getAttTypeString(attDef.getType()))
             << ", DefType: "
             << StrX(XMLAttDef::getDefAttTypeString(attDef.getDefaultType()));

        if (XMLString::stringLen(attDef.getValue()))
            XERCES_STD_QUALIFIER cout << ", Value: \"" << StrX(attDef.getValue()) << '"';

        XERCES_STD_QUALIFIER cout << "\n    SrcOfs: " << fScanner->getSrcOffset()
             << "\n" << XERCES_STD_QUALIFIER endl;
    }
     else if (fOutputType != OutputType_None)
    {
        if (fInExtSubset)
            return;

        if (fIntDTDOutput)
        {
            XERCES_STD_QUALIFIER cout << StrX(attDef.getFullName()) << " ";
            if (attDef.getType() == XMLAttDef::Enumeration)
            {
                XERCES_STD_QUALIFIER cout << '(';
                StrX tmpStr(attDef.getEnumeration());
                const char* curCh = tmpStr.localForm();
                while (*curCh)
                {
                    while (!isspace(*curCh) && *curCh)
                        XERCES_STD_QUALIFIER cout << *curCh++;

                    if (*curCh)
                    {
                        XERCES_STD_QUALIFIER cout << '|';
                        curCh++;
                    }
                }
                XERCES_STD_QUALIFIER cout << ')';
            }
             else
            {
                XERCES_STD_QUALIFIER cout << StrX(XMLAttDef::getAttTypeString(attDef.getType()));
            }

            if (XMLString::stringLen(attDef.getValue()))
                XERCES_STD_QUALIFIER cout << " \"" << StrX(attDef.getValue()) << '"';

            if (attDef.getDefaultType() != XMLAttDef::Default)
            {
                XERCES_STD_QUALIFIER cout << " "
                     << StrX(XMLAttDef::getDefAttTypeString(attDef.getDefaultType()));
            }
        }
    }
}
bool ossimAlphaSensorSupportData::readInsGpsFile(const ossimFilename& file)
{
   bool result = true;

   static const char M[] = "ossimAlphaSensorSupportData::readInsGpsFile";
   
   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << M << " entered:\n" << "file: " << file << "\n";
   }

   std::shared_ptr<ossim::istream> in = ossim::StreamFactoryRegistry::instance()->
      createIstream( file, std::ios_base::in);

   if ( in && in->good() )
   {
      ossim_float64 inum;
      ossim_float64 roll;
      ossim_float64 pitch;
      ossim_float64 heading;
      ossim_float64 lon;
      ossim_float64 lat;
      ossim_float64 alt;
      ossim_float64 scanAng;
      int res;
      int frm;
      const ossim_float64 BOGUS = -99999.0; // To detect read error/missing value.
      ossim_float64 timeCode = BOGUS;

      std::vector< ossim_uint32 > lines;

      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
            << "ossimAlphaSensorSupportData::readInsGpsFile DEBUG:" << std::endl;
         ossimNotify(ossimNotifyLevel_DEBUG)<<std::setprecision(8);
         ossimNotify(ossimNotifyLevel_DEBUG)<<std::setiosflags(std::ios_base::scientific);

      }

      // Format: line,roll,pitch,heading,lon,lat,alt,scanAngle,reserved,frame,time

      // Check the first line.  Some data has a phantom line, some starts with good data.
      std::string line1;
      std::getline( *in, line1 );
      ossim_uint32 fields = 0;
      if ( line1.size() )
      {
         std::string s;
         std::istringstream tmpStr( line1 );
         while ( !tmpStr.eof() )
         {
            tmpStr >> s;
            if ( s.size() )
            {
               ++fields;
               s.clear();
            }
         }
         if ( fields == 11 )
         {
            // First line is valid.
            in->seekg( 0, std::ios_base::beg );
         }
      }
Esempio n. 29
0
// jitProfileInitialize
//
static int jitProfileInitialize(AMDTJitProfileEnv* pEnv)
{
    int             ret = 0;
    std::wstring    profileDataDir;

    if (true == gAMDTJitProfileInitialized)
    {
        return AMDT_JITPROFILE_SUCCESS;
    }

    gJitPID = (NULL == pEnv) ? _getpid() : pEnv->processId;

    // Get the command-line to obtain the Application name;
    // gJitCmd will contain the name of JIT Application;
    ret = getCmdline(pEnv);

    if (AMDT_JITPROFILE_SUCCESS != ret)
    {
        jitError(pEnv, "Could not get the command line");
        return ret;
    }

    if (gJitVerbose)
    {
        wprintf(L"Command Line: %s\n", gJitCmd.c_str());
    }

    // Get the dir path in which the JIT profile data files will be written
    // Note: getProfileDataDir gives gSampleDir and profileDataDir
    ret = getProfileDataDir(profileDataDir);

    if (AMDT_JITPROFILE_SUCCESS != ret)
    {
        jitError(pEnv, "Could not get profile data dir for JIT application");
        return ret;
    }

    if (gJitVerbose)
    {
        wprintf(L"The JIT Profile data dir is " STR_FORMAT L".\n",
                profileDataDir.c_str());
    }

    // Save the profileDataDir for future use..
    gProfileDataDir = profileDataDir;

#if AMDT_BUILD_TARGET == AMDT_WINDOWS_OS
    // The directory access right is 771
    int j = recursiveMkdir(profileDataDir.c_str());

    if (0 != j)
    {
        wprintf(L"The sample directory " STR_FORMAT L" was not able to be created\n",
                profileDataDir.c_str());
        return AMDT_JITPROFILE_FAILED;
    }

    profileDataDir = gProfileDataDir;
#else
    // Linux
    struct stat buf;
    string tmpStr(profileDataDir.begin(), profileDataDir.end());

    if (stat(tmpStr.c_str(), &buf) != 0)
    {
        if (mkdir(tmpStr.c_str(), 0x01fd) != 0)
        {
            jitError(pEnv, "Cannot create directory %s",
                     profileDataDir.c_str());
            return AMDT_JITPROFILE_FAILED;
        }
    }

#endif

    // Save the profileDataDir for future use..
    gProfileDataDir = profileDataDir;

    // Construct the JCL filename
    wchar_t jclFile[OS_MAX_PATH] = { L'\0' };

    swprintf(jclFile, OS_MAX_PATH - 1, STR_FORMAT PATH_SEPARATOR L"%d.jcl", profileDataDir.c_str(), gJitPID);

    // Initialize JCLWriter
    gJCLWriter = new JclWriter(jclFile, gJitCmd.c_str(), gJitPID);

    if (NULL == gJCLWriter)
    {
        jitError(pEnv, "Error: Out of Memory");
        return AMDT_JITPROFILE_FAILED;
    }

    // This just writes the header record
    gJCLWriter->Initialize();

    return AMDT_JITPROFILE_SUCCESS;
} // jitProfileInitialize
Adesk::Boolean
AecUiPrEntitySet::verifyPickfirstSet(Adesk::Boolean singleSelect)
{
    if (m_disallowPickfirstSet) {
        cleanPickfirstSet();
        return Adesk::kFalse;
    }

    // if the set is already selected, verify that it has
    // the right stuff in it.
    AecBaseEditorReactor* edReact = AecUiBaseServices::getEditorReactor();
    if (edReact == NULL) {
        AEC_ASSERT(0);
        cleanPickfirstSet();
        return Adesk::kFalse;
    }

    m_selSet.setLogicalLength(0);   // reset to null set

    AcDbEntity* ent;
    Acad::ErrorStatus es;
    int filteredBecauseOfClass = 0;
    int filteredBecauseOfLockedLayer = 0;

    const AcDbObjectIdArray& pickSet = edReact->pickfirstSet();
    int len = pickSet.length();

    // if only allowing single select, bail if more than 1 item
    // in the pickfirst set.
    if (singleSelect && (len > 1)) {
        ads_printf(_DNT(_T("\n"))); // make sure we get to a new line
        AecRmCString tmpStr(GetAecUiBaseAppName(), AECU_STR_VERIFYPICKFIRSTSET_AECUIPRENTITYSET_TOO_MANY_OBJECTS, TRUE);
        ads_printf(tmpStr);        //~  "Too many objects in the pickfirst set, please select again.\n"
        cleanPickfirstSet();
        return Adesk::kFalse;
    }

    for (int i=0; i<len; i++) {
        es = acdbOpenAcDbEntity(ent, pickSet[i], AcDb::kForRead);
        if (es == Acad::eOk) {
            if (isCorrectClassType(ent->isA()) == Adesk::kFalse) {
                filteredBecauseOfClass++;
                ent->close();
                continue;
            }
            if (m_filterLockedLayers && m_lockedLayerCache.contains(ent->layerId())) {
                filteredBecauseOfLockedLayer++;
                ent->close();
                continue;
            }

            ent->close();
            m_selSet.append(pickSet[i]);
        }
        else {
            Aec::ads_printf(GetAecUiBaseAppName(), AECU_STR_VERIFYPICKFIRSTSET_AECUIPRENTITYSET_COULD_NOT_OPEN_ENTITY_FOR_READ, Aec::rxErrorStr(es)); //~ "\nCould not open entity for read: %s"
        }
    }

    ads_printf(_DNT(_T("\n"))); // make sure we get to a new line

    if (filteredBecauseOfClass == 1) {
        AecRmCString tmpStr(GetAecUiBaseAppName(), AECU_STR_VERIFYPICKFIRSTSET_AECUIPRENTITYSET_OBJECT_WAS, TRUE);
        ads_printf(tmpStr);    // NOTE: leave \n's at end so you can see message before dialog comes up (jma)        //~  "1 object was of the wrong type.\n"
    }
    else if (filteredBecauseOfClass > 1) {
        Aec::ads_printf(GetAecUiBaseAppName(), AECU_STR_VERIFYPICKFIRSTSET_AECUIPRENTITYSET_OBJECTS_WERE_OF_THE_WRONG_TYPE, filteredBecauseOfClass); //~ "%ld objects were of the wrong type.\n"
    }

    if (filteredBecauseOfLockedLayer == 1) {
        AecRmCString tmpStr(GetAecUiBaseAppName(), AECU_STR_VERIFYPICKFIRSTSET_AECUIPRENTITYSET_OBJECT_WAS_0, TRUE);
        ads_printf(tmpStr);        //~  "1 object was on a locked layer.\n"
    }
    else if (filteredBecauseOfLockedLayer > 1) {
        Aec::ads_printf(GetAecUiBaseAppName(), AECU_STR_VERIFYPICKFIRSTSET_AECUIPRENTITYSET_OBJECTS_WERE_ON_LOCKED_LAYER, filteredBecauseOfLockedLayer); //~"%ld objects were on a locked layer.\n"
    }

    if ((len > 0) && m_selSet.isEmpty()) {
        AecRmCString tmpStr(GetAecUiBaseAppName(), AECU_STR_VERIFYPICKFIRSTSET_AECUIPRENTITYSET_ALL_OBJECTS_IN, TRUE);
        ads_printf(tmpStr);        //~  "All objects in the pickfirst set were filtered out, please select again.\n"
    }

    cleanPickfirstSet();

    return !m_selSet.isEmpty();
}