~ubuntu-branches/ubuntu/karmic/piklab/karmic

« back to all changes in this revision

Viewing changes to src/tools/mpc/mpc_compile.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2007-09-01 22:37:44 UTC
  • Revision ID: james.westby@ubuntu.com-20070901223744-2r8t5kiqdurs5j8g
Tags: upstream-0.14.5
ImportĀ upstreamĀ versionĀ 0.14.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org>                  *
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU General Public License as published by  *
 
6
 *   the Free Software Foundation; either version 2 of the License, or     *
 
7
 *   (at your option) any later version.                                   *
 
8
 ***************************************************************************/
 
9
#include "mpc_compile.h"
 
10
 
 
11
#include <qregexp.h>
 
12
#include <klocale.h>
 
13
 
 
14
#include "common/global/pfile.h"
 
15
#include "mpc_config.h"
 
16
#include "devices/list/device_list.h"
 
17
#include "devices/pic/base/pic.h"
 
18
 
 
19
QStringList MPC::CompileFile::genericArguments(const Compile::Config &) const
 
20
{
 
21
  QStringList args;
 
22
  args += "%I";
 
23
  return args;
 
24
}
 
25
 
 
26
void MPC::CompileFile::logStderrLine(const QString &)
 
27
{
 
28
  // ignore output
 
29
}
 
30
 
 
31
void MPC::CompileFile::parseLine(const QString &line)
 
32
{
 
33
  QRegExp rexp("(\\w+)\\s+(.*)\\s+(\\d+):\\d+:(.*)");
 
34
  if ( rexp.exactMatch(line) ) doLog(rexp.cap(1), rexp.cap(4), rexp.cap(2), rexp.cap(3).toUInt()-1);
 
35
  else _manager->log(Log::Data, line); // unrecognized
 
36
}
 
37
 
 
38
void MPC::CompileFile::done(int code)
 
39
{
 
40
  // rely on error file
 
41
  PURL::Url url = PURL::Url(directory(), inputFilepath(0)).toExtension("err");
 
42
  PURL::File file(url, 0);
 
43
  if ( !file.openForRead() ) _manager->log(Log::Error, i18n("Could not find error file (%1).").arg(url.pretty()));
 
44
  else {
 
45
    QStringList lines = file.readLines();
 
46
    for (uint i=0; i<lines.count(); i++) parseLine(lines[i]);
 
47
  }
 
48
  Compile::Process::done(code);
 
49
}
 
50
 
 
51
QString MPC::CompileFile::outputFiles() const
 
52
{
 
53
  return "PURL::Lst PURL::Hex PURL::Cod err";
 
54
}