Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

QString GpsimProcessor::generateSymbolFile ( const QString &  fileName,
QObject *  receiver,
const char *  successMember,
const char *  failMember = 0l 
) [static]

Converts the file at programFile to a Symbol file for emulation, and returns that symbol file's path

Parameters:
programFile The full url to the file
assembled The slot to connect the assembled signal to
See also:
static bool isValidProgramFile( const QString &programFile )

Definition at line 323 of file gpsimprocessor.cpp.

References LanguageManager::compile(), compileMicrobe(), and isValidProgramFile().

Referenced by PICComponent::createSymbolFile().

{
      if ( !isValidProgramFile(fileName) )
            return QString::null;
      
      QString extension = fileName.right( fileName.length() - fileName.findRev('.') - 1 ).lower();
      
      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 = KTempFile( QString::null, ".hex" ).name();
            
            ProcessOptions o;
            o.b_addToProject = false;
            o.setTargetFile( hexFile );
            o.setInputFiles( fileName );
            o.setMethod( ProcessOptions::Method::Forget );
            o.setProcessPath( ProcessOptions::ProcessPath::FlowCode_Program );
            
            ProcessChain * pc = LanguageManager::self()->compile(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(fileName);
            o.setMethod( ProcessOptions::Method::Forget );
            o.setProcessPath( ProcessOptions::ProcessPath::path( ProcessOptions::guessMediaType(fileName), ProcessOptions::ProcessPath::Program ) );
            
            ProcessChain *pc = LanguageManager::self()->compile(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(fileName);
            o.setMethod( ProcessOptions::Method::Forget );
            o.setProcessPath( ProcessOptions::ProcessPath::C_Program );
            
            ProcessChain *pc = LanguageManager::self()->compile(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;
}


Generated by  Doxygen 1.6.0   Back to index