summaryrefslogtreecommitdiffstats
path: root/src/tools/cc5x
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/cc5x')
-rw-r--r--src/tools/cc5x/Makefile.am8
-rw-r--r--src/tools/cc5x/cc5x.cpp62
-rw-r--r--src/tools/cc5x/cc5x.h50
-rw-r--r--src/tools/cc5x/cc5x_compile.cpp37
-rw-r--r--src/tools/cc5x/cc5x_compile.h29
-rw-r--r--src/tools/cc5x/cc5x_config.cpp9
-rw-r--r--src/tools/cc5x/cc5x_config.h25
-rw-r--r--src/tools/cc5x/gui/Makefile.am6
-rw-r--r--src/tools/cc5x/gui/cc5x_ui.cpp19
-rw-r--r--src/tools/cc5x/gui/cc5x_ui.h35
10 files changed, 280 insertions, 0 deletions
diff --git a/src/tools/cc5x/Makefile.am b/src/tools/cc5x/Makefile.am
new file mode 100644
index 0000000..b72d8bb
--- /dev/null
+++ b/src/tools/cc5x/Makefile.am
@@ -0,0 +1,8 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+METASOURCES = AUTO
+
+noinst_LTLIBRARIES = libcc5x.la
+libcc5x_la_SOURCES = cc5x.cpp cc5x_compile.cpp cc5x_config.cpp
+libcc5x_la_LDFLAGS = $(all_libraries)
+
+SUBDIRS = gui \ No newline at end of file
diff --git a/src/tools/cc5x/cc5x.cpp b/src/tools/cc5x/cc5x.cpp
new file mode 100644
index 0000000..5b28397
--- /dev/null
+++ b/src/tools/cc5x/cc5x.cpp
@@ -0,0 +1,62 @@
+/***************************************************************************
+ * 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 "cc5x.h"
+
+#include <qregexp.h>
+
+#include "cc5x_compile.h"
+#include "cc5x_config.h"
+#include "devices/pic/pic/pic_memory.h"
+#include "devices/list/device_list.h"
+#include "devices/base/device_group.h"
+
+//----------------------------------------------------------------------------
+bool CC5X::Base::checkExecutableResult(bool, QStringList &lines) const
+{
+ return ( lines.count()>0 && lines[0].startsWith("CC5X") );
+}
+
+//----------------------------------------------------------------------------
+QValueList<const Device::Data *> CC5X::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 Pic::Data *data = static_cast<const Pic::Data *>(Device::lister().data(devices[i]));
+ if ( data->architecture()!=Pic::Architecture::P10X && data->architecture()!=Pic::Architecture::P16X ) continue;
+ list.append(data);
+ }
+ return list;
+}
+
+Compile::Process *CC5X::Group::processFactory(const Compile::Data &data) const
+{
+ switch (data.category.type()) {
+ case Tool::Category::Compiler: return new CC5X::CompileFile;
+ default: break;
+ }
+ Q_ASSERT(false);
+ return 0;
+}
+
+Compile::Config *CC5X::Group::configFactory(::Project *project) const
+{
+ return new Config(project);
+}
+
+QString CC5X::Group::informationText() const
+{
+ return i18n("<a href=\"%1\">CC5X</a> is a C compiler distributed by B Knudsen Data.").arg("http://www.bknd.com/cc5x/index.shtml");
+}
+
+Tool::Group::BaseData CC5X::Group::baseFactory(Tool::Category category) const
+{
+ if ( category==Tool::Category::Compiler ) return BaseData(new CC5X::Base, Both);
+ return BaseData();
+}
diff --git a/src/tools/cc5x/cc5x.h b/src/tools/cc5x/cc5x.h
new file mode 100644
index 0000000..054a9ef
--- /dev/null
+++ b/src/tools/cc5x/cc5x.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * 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 CC5X_H
+#define CC5X_H
+
+#include "tools/base/tool_group.h"
+#include "common/global/pfile.h"
+
+namespace CC5X
+{
+//----------------------------------------------------------------------------
+class Base : public Tool::Base
+{
+public:
+ virtual QString baseExecutable(bool, Tool::OutputExecutableType) const { return "cc5x"; }
+
+private:
+ virtual QStringList checkExecutableOptions(bool) const { return QStringList(); }
+ virtual bool checkExecutableResult(bool withWine, QStringList &lines) const;
+};
+
+//----------------------------------------------------------------------------
+class Group : public Tool::Group
+{
+public:
+ virtual QString name() const { return "cc5x"; }
+ virtual QString label() const { return i18n("CC5X 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/cc5x/cc5x_compile.cpp b/src/tools/cc5x/cc5x_compile.cpp
new file mode 100644
index 0000000..6956eb8
--- /dev/null
+++ b/src/tools/cc5x/cc5x_compile.cpp
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * 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 "cc5x_compile.h"
+
+#include "cc5x_config.h"
+
+QStringList CC5X::CompileFile::genericArguments(const Compile::Config &config) const
+{
+ QStringList args;
+ args += "-a"; // produce asm file
+ args += "-CC"; // produce cod c file
+ args += "-L"; // produce list file
+ args += "-eL"; // error details
+ //args += "-FM"; // error format for MPLAB
+ args += "-o%O"; // set output file
+ args += config.includeDirs(Tool::Category::Compiler, "-I");
+ args += config.customOptions(Tool::Category::Compiler);
+ args += "%I";
+ return args;
+}
+
+void CC5X::CompileFile::logStderrLine(const QString &line)
+{
+ if ( parseErrorLine(line, Compile::ParseErrorData("(.*):([0-9]+):(.+)\\[([0-9]+)\\](.+)", 1, 2, 5, 3)) ) return;
+ doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
+}
+
+QString CC5X::CompileFile::outputFiles() const
+{
+ return "PURL::Lst PURL::AsmGPAsm PURL::Hex PURL::Cod occ";
+}
diff --git a/src/tools/cc5x/cc5x_compile.h b/src/tools/cc5x/cc5x_compile.h
new file mode 100644
index 0000000..f400380
--- /dev/null
+++ b/src/tools/cc5x/cc5x_compile.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * 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 CC5X_COMPILE_H
+#define CC5X_COMPILE_H
+
+#include "tools/list/compile_process.h"
+
+namespace CC5X
+{
+
+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;
+};
+
+} // namespace
+
+#endif
diff --git a/src/tools/cc5x/cc5x_config.cpp b/src/tools/cc5x/cc5x_config.cpp
new file mode 100644
index 0000000..96def5c
--- /dev/null
+++ b/src/tools/cc5x/cc5x_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 "cc5x_config.h"
diff --git a/src/tools/cc5x/cc5x_config.h b/src/tools/cc5x/cc5x_config.h
new file mode 100644
index 0000000..da1d1f9
--- /dev/null
+++ b/src/tools/cc5x/cc5x_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 CC5X_CONFIG_H
+#define CC5X_CONFIG_H
+
+#include "tools/list/compile_config.h"
+
+namespace CC5X
+{
+//----------------------------------------------------------------------------
+class Config : public Compile::Config
+{
+public:
+ Config(Project *project) : Compile::Config(project) {}
+};
+
+} // namespace
+
+#endif
diff --git a/src/tools/cc5x/gui/Makefile.am b/src/tools/cc5x/gui/Makefile.am
new file mode 100644
index 0000000..760aee9
--- /dev/null
+++ b/src/tools/cc5x/gui/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+METASOURCES = AUTO
+
+noinst_LTLIBRARIES = libcc5xui.la
+libcc5xui_la_SOURCES = cc5x_ui.cpp
+libcc5xui_la_LDFLAGS = $(all_libraries) \ No newline at end of file
diff --git a/src/tools/cc5x/gui/cc5x_ui.cpp b/src/tools/cc5x/gui/cc5x_ui.cpp
new file mode 100644
index 0000000..b35e6af
--- /dev/null
+++ b/src/tools/cc5x/gui/cc5x_ui.cpp
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * 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 "cc5x_ui.h"
+
+//----------------------------------------------------------------------------
+CC5X::ConfigWidget::ConfigWidget(Project *project)
+ : ToolConfigWidget(project)
+{}
+
+void CC5X::ConfigWidget::initEntries()
+{
+ if ( _category!=Tool::Category::Linker ) createIncludeDirectoriesEntry();
+}
diff --git a/src/tools/cc5x/gui/cc5x_ui.h b/src/tools/cc5x/gui/cc5x_ui.h
new file mode 100644
index 0000000..7bf0a37
--- /dev/null
+++ b/src/tools/cc5x/gui/cc5x_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 CC5X_UI_H
+#define CC5X_UI_H
+
+#include "tools/gui/tool_config_widget.h"
+#include "tools/gui/tool_group_ui.h"
+
+namespace CC5X
+{
+//----------------------------------------------------------------------------
+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