summaryrefslogtreecommitdiffstats
path: root/src/tools/mpc/mpc_compile.cpp
blob: 8c39e3c041c7b3ae37f0333e85494eb582677415 (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"

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

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

void MPC::CompileFile::parseLine(const TQString &line)
{
  if ( parseErrorLine(line, Compile::ParseErrorData("(\\w+)\\s+(.*)\\s+(\\d+):\\d+:(.*)", 2, 3, 4, 1)) ) return;
  doLog(Log::LineType::Normal, line, TQString(), 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).").tqarg(url.pretty()), TQString(), 0);
  else {
    TQStringList lines = file.readLines();
    for (uint i=0; i<lines.count(); i++) parseLine(lines[i]);
  }
  Compile::Process::done(code);
}

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