Beispiel #1
0
 QSystemLocaleData()
     : lc_numeric(QLocale::C)
      ,lc_time(QLocale::C)
      ,lc_monetary(QLocale::C)
      ,lc_messages(QLocale::C)
 {
     readEnvironment();
 }
bool MakefileFactory::apply(const QStringList& commandLineArguments, Options **outopt)
{
    if (m_makefile)
        clear();

    Options *options = new Options;
    if (outopt)
        *outopt = options;
    MacroTable *macroTable = new MacroTable;
    macroTable->setEnvironment(m_environment);

    QString filename;
    if (!options->readCommandLineArguments(commandLineArguments, filename, m_activeTargets, *macroTable)) {
        m_errorType = CommandLineError;
        return false;
    }
    if (options->showUsageAndExit || options->showVersionAndExit)
        return true;

    if (!options->stderrFile.isEmpty()) {
        // Try to open the file for writing.
        const wchar_t *wszFileName = reinterpret_cast<const wchar_t*>(options->stderrFile.utf16());
        FILE *f = _wfopen(wszFileName, L"w");
        if (!f) {
            m_errorString = QLatin1String("Cannot open stderr file for writing.");
            m_errorType = IOError;
            return false;
        }
        fclose(f);
        if (!_wfreopen(wszFileName, L"w", stderr)) {
            m_errorString = QLatin1String("Cannot reopen stderr handle for writing.");
            m_errorType = IOError;
            return false;
        }
    }

    options->fullAppPath = QDir::toNativeSeparators(QCoreApplication::applicationFilePath());

    readEnvironment(m_environment, macroTable, options->overrideEnvVarMacros);
    if (!options->ignorePredefinedRulesAndMacros) {
        macroTable->setMacroValue("MAKE", encloseInDoubleQuotesIfNeeded(options->fullAppPath));
        macroTable->setMacroValue("MAKEDIR", encloseInDoubleQuotesIfNeeded(QDir::currentPath()));
        macroTable->setMacroValue("AS", "ml");       // Macro Assembler
        macroTable->setMacroValue("ASFLAGS", QString());
        macroTable->setMacroValue("BC", "bc");       // Basic Compiler
        macroTable->setMacroValue("BCFLAGS", QString());
        macroTable->setMacroValue("CC", "cl");       // C Compiler
        macroTable->setMacroValue("CCFLAGS", QString());
        macroTable->setMacroValue("COBOL", "cobol"); // COBOL Compiler
        macroTable->setMacroValue("COBOLFLAGS", QString());
        macroTable->setMacroValue("CPP", "cl");      // C++ Compiler
        macroTable->setMacroValue("CPPFLAGS", QString());
        macroTable->setMacroValue("CXX", "cl");      // C++ Compiler
        macroTable->setMacroValue("CXXFLAGS", QString());
        macroTable->setMacroValue("FOR", "fl");      // FORTRAN Compiler
        macroTable->setMacroValue("FORFLAGS", QString());
        macroTable->setMacroValue("PASCAL", "pl");   // Pascal Compiler
        macroTable->setMacroValue("PASCALFLAGS", QString());
        macroTable->setMacroValue("RC", "rc");       // Resource Compiler
        macroTable->setMacroValue("RCFLAGS", QString());
    }

    try {
        m_makefile = new Makefile(filename);
        m_makefile->setOptions(options);
        m_makefile->setMacroTable(macroTable);
        Preprocessor preprocessor;
        preprocessor.setMacroTable(macroTable);
        preprocessor.openFile(filename);
        Parser parser;
        parser.apply(&preprocessor, m_makefile, m_activeTargets);
    } catch (Exception &e) {
        m_errorType = ParserError;
        m_errorString = e.toString();
    }

    return m_errorType == NoError;
}
BOOL LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytesUsed)
{
	U32 currByte = 4;

	gSetInitDataDefaults(out);

	if(mData[0] & PART_SYS_KILL_P_MASK)
	{
		currByte = readKill_p(out, currByte);
	}
	
	if(mData[0] & PART_SYS_BOUNCE_P_MASK)
	{
		currByte = readBounce_p(out, currByte);
	}
	
	if(mData[0] & PART_SYS_BOUNCE_B_MASK)
	{
		currByte = readBounce_b(out, currByte);
	}
	
	if(mData[0] & PART_SYS_ALPHA_SCALE_DIFF_MASK)
	{
		currByte = readAlphaScaleDiffEqn_range(out, currByte);
	}
	
	if(mData[0] & PART_SYS_SCALE_RANGE_MASK)
	{
		currByte = readScale_range(out, currByte);
	}
	
	if(mData[0] & PART_SYS_VEL_OFFSET_MASK)
	{
		currByte = readVelocityOffset(out, currByte);
	}
	
	if(mData[0] & PART_SYS_M_IMAGE_UUID_MASK)
	{
		currByte = readUUID(out, currByte);
	}
	

	if(mData[3] & PART_SYS_BYTE_SPAWN_MASK)
	{
		currByte = readSpawn(out, currByte);
	}
	
	if(mData[3] & PART_SYS_BYTE_ENVIRONMENT_MASK)
	{
		currByte = readEnvironment(out, currByte);
	}
	
	if(mData[3] & PART_SYS_BYTE_LIFESPAN_MASK)
	{
		currByte = readLifespan(out, currByte);
	}
	
	if(mData[3] & PART_SYS_BYTE_DECAY_DAMP_MASK)
	{
		currByte = readDecayDamp(out, currByte);
	}
	
	if(mData[3] & PART_SYS_BYTE_WIND_DIFF_MASK)
	{
		currByte = readWindDiffusionFactor(out, currByte);
	}
	
	if(mData[2] & PART_SYS_BYTE_3_ALPHA_MASK)
	{
		currByte = readAlpha_range(out, currByte);
	}

	out->maxParticles = mData[currByte++];
	out->initialParticles = mData[currByte++];

	U32 flagFlag = 1; // flag indicating which flag bytes are non-zero
	//                   yeah, I know, the name sounds funny
	for(U32 i = 0; i < 8; i++)
	{
		flagFlag = 1<<i;
	
		if((mData[1] & flagFlag))
		{
			out->mFlags[i] = mData[currByte++];
		}
	}

	*bytesUsed = currByte;
	return TRUE;
}