blob: f7da2c79bbb71242c1169240d7af3f05c8b00a04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
/***************************************************************************
* Copyright (C) 2005 by David Saxton *
* david@bluehaze.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "contexthelp.h"
#include "docmanager.h"
#include "logview.h"
#include "microbe.h"
#include "languagemanager.h"
#include <kdebug.h>
#include <tdelocale.h>
#include <tdemessagebox.h>
#include <kstandarddirs.h>
#include <tqfile.h>
#include <tdeprocess.h>
Microbe::Microbe( ProcessChain *processChain, KTechlab *parent )
: ExternalLanguage( processChain, parent, "Microbe" )
{
m_failedMessage = i18n("*** Compilation failed ***");
m_successfulMessage = i18n("*** Compilation successful ***");
// Setup error messages list
TQFile file( locate("appdata",i18n("error_messages_en_gb")) );
if ( file.open( IO_ReadOnly ) )
{
TQTextStream stream( &file );
TQString line;
while ( !stream.atEnd() )
{
line = stream.readLine(); // line of text excluding '\n'
if ( !line.isEmpty() )
{
bool ok;
const int pos = line.left( line.find("#") ).toInt(&ok);
if (ok) {
m_errorMessages[pos] = line.right(line.length()-line.find("#"));
} else {
kdError() << k_funcinfo << "Error parsing Microbe error-message file"<<endl;
}
}
}
file.close();
}
}
Microbe::~Microbe()
{
}
void Microbe::processInput( ProcessOptions options )
{
resetLanguageProcess();
m_processOptions = options;
*m_languageProcess << ("microbe");
// Input Asm file
*m_languageProcess << ( options.inputFiles().first() );
// Output filename
*m_languageProcess << ( options.intermediaryOutput() );
*m_languageProcess << ("--show-source");
if ( !start() )
{
KMessageBox::sorry( LanguageManager::self()->logView(), i18n("Assembly failed. Please check you have KTechlab installed properly (\"microbe\" could not be started).") );
processInitFailed();
return;
}
}
bool Microbe::isError( const TQString &message ) const
{
return message.contains( "Error", false );
}
bool Microbe::isWarning( const TQString &message ) const
{
return message.contains( "Warning", false );
}
ProcessOptions::ProcessPath::Path Microbe::outputPath( ProcessOptions::ProcessPath::Path inputPath ) const
{
switch (inputPath)
{
case ProcessOptions::ProcessPath::Microbe_AssemblyAbsolute:
return ProcessOptions::ProcessPath::None;
case ProcessOptions::ProcessPath::Microbe_PIC:
return ProcessOptions::ProcessPath::AssemblyAbsolute_PIC;
case ProcessOptions::ProcessPath::Microbe_Program:
return ProcessOptions::ProcessPath::AssemblyAbsolute_Program;
case ProcessOptions::ProcessPath::AssemblyAbsolute_PIC:
case ProcessOptions::ProcessPath::AssemblyAbsolute_Program:
case ProcessOptions::ProcessPath::AssemblyRelocatable_Library:
case ProcessOptions::ProcessPath::AssemblyRelocatable_Object:
case ProcessOptions::ProcessPath::AssemblyRelocatable_PIC:
case ProcessOptions::ProcessPath::AssemblyRelocatable_Program:
case ProcessOptions::ProcessPath::C_AssemblyRelocatable:
case ProcessOptions::ProcessPath::C_Library:
case ProcessOptions::ProcessPath::C_Object:
case ProcessOptions::ProcessPath::C_PIC:
case ProcessOptions::ProcessPath::C_Program:
case ProcessOptions::ProcessPath::FlowCode_AssemblyAbsolute:
case ProcessOptions::ProcessPath::FlowCode_Microbe:
case ProcessOptions::ProcessPath::FlowCode_PIC:
case ProcessOptions::ProcessPath::FlowCode_Program:
case ProcessOptions::ProcessPath::Object_Disassembly:
case ProcessOptions::ProcessPath::Object_Library:
case ProcessOptions::ProcessPath::Object_PIC:
case ProcessOptions::ProcessPath::Object_Program:
case ProcessOptions::ProcessPath::PIC_AssemblyAbsolute:
case ProcessOptions::ProcessPath::Program_Disassembly:
case ProcessOptions::ProcessPath::Program_PIC:
case ProcessOptions::ProcessPath::Invalid:
case ProcessOptions::ProcessPath::None:
return ProcessOptions::ProcessPath::Invalid;
}
return ProcessOptions::ProcessPath::Invalid;
}
|