diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
commit | f508189682b6fba62e08feeb1596f682bad5fff9 (patch) | |
tree | 28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/tools/mpc | |
download | piklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip |
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/tools/mpc')
-rw-r--r-- | src/tools/mpc/Makefile.am | 8 | ||||
-rw-r--r-- | src/tools/mpc/gui/Makefile.am | 6 | ||||
-rw-r--r-- | src/tools/mpc/gui/mpc_ui.cpp | 14 | ||||
-rw-r--r-- | src/tools/mpc/gui/mpc_ui.h | 35 | ||||
-rw-r--r-- | src/tools/mpc/mpc.cpp | 57 | ||||
-rw-r--r-- | src/tools/mpc/mpc.h | 49 | ||||
-rw-r--r-- | src/tools/mpc/mpc_compile.cpp | 51 | ||||
-rw-r--r-- | src/tools/mpc/mpc_compile.h | 35 | ||||
-rw-r--r-- | src/tools/mpc/mpc_config.cpp | 9 | ||||
-rw-r--r-- | src/tools/mpc/mpc_config.h | 25 |
10 files changed, 289 insertions, 0 deletions
diff --git a/src/tools/mpc/Makefile.am b/src/tools/mpc/Makefile.am new file mode 100644 index 0000000..debc478 --- /dev/null +++ b/src/tools/mpc/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I$(top_srcdir)/src $(all_includes) +METASOURCES = AUTO + +noinst_LTLIBRARIES = libmpc.la +libmpc_la_SOURCES = mpc.cpp mpc_compile.cpp mpc_config.cpp +libmpc_la_LDFLAGS = $(all_libraries) + +SUBDIRS = gui
\ No newline at end of file diff --git a/src/tools/mpc/gui/Makefile.am b/src/tools/mpc/gui/Makefile.am new file mode 100644 index 0000000..5d590c6 --- /dev/null +++ b/src/tools/mpc/gui/Makefile.am @@ -0,0 +1,6 @@ +INCLUDES = -I$(top_srcdir)/src $(all_includes) +METASOURCES = AUTO + +noinst_LTLIBRARIES = libmpcui.la +libmpcui_la_SOURCES = mpc_ui.cpp +libmpcui_la_LDFLAGS = $(all_libraries)
\ No newline at end of file diff --git a/src/tools/mpc/gui/mpc_ui.cpp b/src/tools/mpc/gui/mpc_ui.cpp new file mode 100644 index 0000000..b3ad4e7 --- /dev/null +++ b/src/tools/mpc/gui/mpc_ui.cpp @@ -0,0 +1,14 @@ +/*************************************************************************** + * 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_ui.h" + +//---------------------------------------------------------------------------- +MPC::ConfigWidget::ConfigWidget(Project *project) + : ToolConfigWidget(project) +{} diff --git a/src/tools/mpc/gui/mpc_ui.h b/src/tools/mpc/gui/mpc_ui.h new file mode 100644 index 0000000..2fc51f9 --- /dev/null +++ b/src/tools/mpc/gui/mpc_ui.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef MPC_UI_H +#define MPC_UI_H + +#include "tools/gui/tool_config_widget.h" +#include "tools/gui/tool_group_ui.h" + +namespace MPC +{ +//---------------------------------------------------------------------------- +class ConfigWidget : public ToolConfigWidget +{ +Q_OBJECT +public: + ConfigWidget(Project *project); + virtual void initEntries() {} +}; + +//---------------------------------------------------------------------------- +class GroupUI : public Tool::GroupUI +{ +public: + virtual ToolConfigWidget *configWidgetFactory(Tool::Category, ::Project *project) const { return new ConfigWidget(project); } +}; + +} // namespace + +#endif diff --git a/src/tools/mpc/mpc.cpp b/src/tools/mpc/mpc.cpp new file mode 100644 index 0000000..88f9ec2 --- /dev/null +++ b/src/tools/mpc/mpc.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** + * 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.h" + +#include <qregexp.h> + +#include "mpc_compile.h" +#include "mpc_config.h" +#include "devices/pic/pic/pic_memory.h" +#include "devices/list/device_list.h" +#include "devices/base/device_group.h" + +//---------------------------------------------------------------------------- +QValueList<const Device::Data *> MPC::Group::getSupportedDevices(const QString &) const +{ + QValueList<const Device::Data *> list; + QValueVector<QString> devices = Device::lister().group("pic")->supportedDevices(); + for (uint i=0; i<devices.count(); i++) { + const Device::Data *data = Device::lister().data(devices[i]); + Pic::Architecture arch = static_cast<const Pic::Data *>(data)->architecture(); + if ( arch!=Pic::Architecture::P16X && arch!=Pic::Architecture::P17C ) continue; + list.append(data); + } + return list; +} + +Compile::Process *MPC::Group::processFactory(const Compile::Data &data) const +{ + switch (data.category.type()) { + case Tool::Category::Compiler: return new MPC::CompileFile; + default: break; + } + Q_ASSERT(false); + return 0; +} + +Compile::Config *MPC::Group::configFactory(::Project *project) const +{ + return new Config(project); +} + +QString MPC::Group::informationText() const +{ + return i18n("<a href=\"%1\">MPC Compiler</a> is a C compiler distributed by Byte Craft.").arg("http://www.bytecraft.com/mpccaps.html"); +} + +Tool::Group::BaseData MPC::Group::baseFactory(Tool::Category category) const +{ + if ( category==Tool::Category::Compiler ) return BaseData(new MPC::Base, Both); + return BaseData(); +} diff --git a/src/tools/mpc/mpc.h b/src/tools/mpc/mpc.h new file mode 100644 index 0000000..a378307 --- /dev/null +++ b/src/tools/mpc/mpc.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef MPC_H +#define MPC_H + +#include "tools/base/tool_group.h" +#include "common/global/pfile.h" + +namespace MPC +{ +//---------------------------------------------------------------------------- +class Base : public Tool::Base +{ +public: + virtual QString baseExecutable(bool, Tool::OutputExecutableType) const { return "mpcw"; } + virtual bool checkExecutable() const { return false; } + virtual QStringList checkExecutableOptions(bool) const { return QStringList(); } + virtual bool checkExecutableResult(bool, QStringList &) const { return true; } +}; + +//---------------------------------------------------------------------------- +class Group : public Tool::Group +{ +public: + virtual QString name() const { return "mpcw"; } + virtual QString label() const { return i18n("MPC Compiler"); } + virtual QString informationText() const; + virtual Tool::Category checkDevicesCategory() const { return Tool::Category::Nb_Types; } + virtual Tool::ExecutableType preferedExecutableType() const { return Tool::ExecutableType::Windows; } + virtual Tool::CompileType compileType() const { return Tool::SingleFile; } + virtual PURL::FileType implementationType(PURL::ToolType type) const { return (type==PURL::ToolType::Compiler ? PURL::CSource : PURL::Nb_FileTypes); } + +private: + virtual QValueList<const Device::Data *> getSupportedDevices(const QString &s) const; + virtual Compile::Process *processFactory(const Compile::Data &data) const; + virtual Compile::Config *configFactory(::Project *project) const; + virtual BaseData baseFactory(Tool::Category) const; + virtual Tool::SourceGenerator *sourceGeneratorFactory() const { /*TODO*/ return 0; } +}; + +} // namespace + +#endif diff --git a/src/tools/mpc/mpc_compile.cpp b/src/tools/mpc/mpc_compile.cpp new file mode 100644 index 0000000..69ee994 --- /dev/null +++ b/src/tools/mpc/mpc_compile.cpp @@ -0,0 +1,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"; +} diff --git a/src/tools/mpc/mpc_compile.h b/src/tools/mpc/mpc_compile.h new file mode 100644 index 0000000..a699734 --- /dev/null +++ b/src/tools/mpc/mpc_compile.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef MPC_COMPILE_H +#define MPC_COMPILE_H + +#include "tools/list/compile_process.h" + +namespace MPC +{ + +class CompileFile : public Compile::Process +{ +Q_OBJECT +protected: + virtual QString deviceName() const { return QString::null; } + virtual QStringList genericArguments(const Compile::Config &config) const; + virtual void logStderrLine(const QString &line); + virtual QString outputFiles() const; + +protected slots: + virtual void done(int code); + +private: + void parseLine(const QString &line); +}; + +} // namespace + +#endif diff --git a/src/tools/mpc/mpc_config.cpp b/src/tools/mpc/mpc_config.cpp new file mode 100644 index 0000000..d477e1e --- /dev/null +++ b/src/tools/mpc/mpc_config.cpp @@ -0,0 +1,9 @@ +/*************************************************************************** + * 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_config.h" diff --git a/src/tools/mpc/mpc_config.h b/src/tools/mpc/mpc_config.h new file mode 100644 index 0000000..45ae64c --- /dev/null +++ b/src/tools/mpc/mpc_config.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef MPC_CONFIG_H +#define MPC_CONFIG_H + +#include "tools/list/compile_config.h" + +namespace MPC +{ +//---------------------------------------------------------------------------- +class Config : public Compile::Config +{ +public: + Config(Project *project) : Compile::Config(project) {} +}; + +} // namespace + +#endif |