Beispiel #1
0
void GpsimProcessor::compileMicrobe( const QString &filename, QObject *receiver, const char * successMember, const char * failMember )
{
	ProcessOptions o;
	o.b_addToProject = false;
	o.setTargetFile( QString(filename).replace(".microbe",".hex") );
	o.setInputFiles(filename);
	o.setMethod( ProcessOptions::Method::Forget );
	o.setProcessPath( ProcessOptions::ProcessPath::Microbe_Program );
	ProcessChain * pc = new ProcessChain(o);
	if (receiver)
	{
		if (successMember)
			connect( pc, SIGNAL(successful()), receiver, successMember );
		if (failMember)
			connect( pc, SIGNAL(failed()), receiver, failMember );
	}
}
Beispiel #2
0
QString GpsimProcessor::generateSymbolFile( const QString &fileName, QObject *receiver, const char *successMember, const char * failMember )
{
	if ( !isValidProgramFile(fileName) )
		return QString::null;

	QString extension = fileName.right(
        fileName.length() - fileName.lastIndexOf('.') - 1
        ).toLower();

	if ( extension == "cod" )
	{
		QTimer::singleShot( 0, receiver, successMember );
		return fileName;
	}
	if ( extension == "hex" )
	{
		QTimer::singleShot( 0, receiver, successMember );
		// We've already checked for the existance of the ".cod" file in GpsimProcessor::isValidProgramFile
		return QString(fileName).replace(".hex",".cod");
	}

	else if ( extension == "basic" || extension == "microbe" )
	{
		compileMicrobe( fileName, receiver, successMember, failMember );
		return QString(fileName).replace( "."+extension, ".cod" );
	}
	else if ( extension == "flowcode" )
	{
		const QString hexFile = QTemporaryFile( "tmpXXXXXX.hex" ).fileName();

		ProcessOptions o;
		o.b_addToProject = false;
		o.setTargetFile( hexFile );
		o.setInputFiles( QStringList(fileName) );
		o.setMethod( ProcessOptions::Method::Forget );
		o.setProcessPath( ProcessOptions::ProcessPath::FlowCode_Program );

		ProcessChain * pc = new ProcessChain(o);
		if (receiver)
		{
			if (successMember)
				connect( pc, SIGNAL(successful()), receiver, successMember );
			if (failMember)
				connect( pc, SIGNAL(failed()), receiver, failMember );
		}

		return QString(hexFile).replace( ".hex", ".cod" );
	}
	else if ( extension == "asm" )
	{
		ProcessOptions o;
		o.b_addToProject = false;
		o.setTargetFile( QString(fileName).replace(".asm",".hex"));
		o.setInputFiles(QStringList(fileName));
		o.setMethod( ProcessOptions::Method::Forget );
		o.setProcessPath( ProcessOptions::ProcessPath::path( ProcessOptions::guessMediaType(fileName), ProcessOptions::ProcessPath::Program ) );

		ProcessChain *pc = new ProcessChain(o);
		if (receiver)
		{
			if (successMember)
				connect( pc, SIGNAL(successful()), receiver, successMember );
			if (failMember)
				connect( pc, SIGNAL(failed()), receiver, failMember );
		}

		return QString(fileName).replace(".asm",".cod");
	}
	else if ( extension == "c" )
	{
		ProcessOptions o;
		o.b_addToProject = false;
		o.setTargetFile( QString(fileName).replace(".c",".hex"));
		o.setInputFiles(QStringList(fileName));
		o.setMethod( ProcessOptions::Method::Forget );
		o.setProcessPath( ProcessOptions::ProcessPath::C_Program );

		ProcessChain *pc = new ProcessChain(o);
		if (receiver)
		{
			if (successMember)
				connect( pc, SIGNAL(successful()), receiver, successMember );
			if (failMember)
				connect( pc, SIGNAL(failed()), receiver, failMember );
		}

		return QString(fileName).replace(".c",".cod");
	}

	if ( failMember )
		QTimer::singleShot( 0, receiver, failMember );
	return QString::null;
}