summaryrefslogtreecommitdiffstats
path: root/src/tools/mpc/mpc_compile.cpp
blob: 69ee994df154d9c095bfaf0f1c50d7eaf1f38ac7 (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
/***************************************************************************
 *   Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.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 "mpc_compile.h"

#include "common/global/pfile.h"
#include "mpc_config.h"
#include "devices/list/device_list.h"
#include "devices/pic/base/pic.h"

QStringList MPC::CompileFile::genericArguments(const Compile::Config &) const
{
  QStringList args;
  args += "%I";
  return args;
}

void MPC::CompileFile::logStderrLine(const QString &)
{
  // ignore output
}

void MPC::CompileFile::parseLine(const QString &line)
{
  if ( parseErrorLine(line, Compile::ParseErrorData("(\\w+)\\s+(.*)\\s+(\\d+):\\d+:(.*)", 2, 3, 4, 1)) ) return;
  doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
}

void MPC::CompileFile::done(int code)
{
  // rely on error file
  PURL::Url url = PURL::Url(directory(), inputFilepath(0)).toExtension("err");
  Log::StringView sview;
  PURL::File file(url, sview);
  if ( !file.openForRead() ) doLog(Log::LineType::Error, i18n("Could not find error file (%1).").arg(url.pretty()), QString::null, 0);
  else {
    QStringList lines = file.readLines();
    for (uint i=0; i<lines.count(); i++) parseLine(lines[i]);
  }
  Compile::Process::done(code);
}

QString MPC::CompileFile::outputFiles() const
{
  return "PURL::Lst PURL::Hex PURL::Cod err";
}