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/jalv2 | |
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/jalv2')
-rw-r--r-- | src/tools/jalv2/Makefile.am | 8 | ||||
-rw-r--r-- | src/tools/jalv2/gui/Makefile.am | 6 | ||||
-rw-r--r-- | src/tools/jalv2/gui/jalv2_ui.cpp | 19 | ||||
-rw-r--r-- | src/tools/jalv2/gui/jalv2_ui.h | 35 | ||||
-rw-r--r-- | src/tools/jalv2/jalv2.cpp | 77 | ||||
-rw-r--r-- | src/tools/jalv2/jalv2.h | 50 | ||||
-rw-r--r-- | src/tools/jalv2/jalv2_compile.cpp | 43 | ||||
-rw-r--r-- | src/tools/jalv2/jalv2_compile.h | 28 | ||||
-rw-r--r-- | src/tools/jalv2/jalv2_config.cpp | 9 | ||||
-rw-r--r-- | src/tools/jalv2/jalv2_config.h | 25 |
10 files changed, 300 insertions, 0 deletions
diff --git a/src/tools/jalv2/Makefile.am b/src/tools/jalv2/Makefile.am new file mode 100644 index 0000000..3b59ea9 --- /dev/null +++ b/src/tools/jalv2/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I$(top_srcdir)/src $(all_includes) +METASOURCES = AUTO + +noinst_LTLIBRARIES = libjalv2.la +libjalv2_la_SOURCES = jalv2_compile.cpp jalv2_config.cpp jalv2.cpp +libjalv2_la_LDFLAGS = $(all_libraries) + +SUBDIRS = gui
\ No newline at end of file diff --git a/src/tools/jalv2/gui/Makefile.am b/src/tools/jalv2/gui/Makefile.am new file mode 100644 index 0000000..92e338c --- /dev/null +++ b/src/tools/jalv2/gui/Makefile.am @@ -0,0 +1,6 @@ +INCLUDES = -I$(top_srcdir)/src $(all_includes) +METASOURCES = AUTO + +noinst_LTLIBRARIES = libjalv2ui.la +libjalv2ui_la_SOURCES = jalv2_ui.cpp +libjalv2ui_la_LDFLAGS = $(all_libraries) diff --git a/src/tools/jalv2/gui/jalv2_ui.cpp b/src/tools/jalv2/gui/jalv2_ui.cpp new file mode 100644 index 0000000..0990c6d --- /dev/null +++ b/src/tools/jalv2/gui/jalv2_ui.cpp @@ -0,0 +1,19 @@ +/*************************************************************************** + * Copyright (C) 2006 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 "jalv2_ui.h" + +//---------------------------------------------------------------------------- +JALV2::ConfigWidget::ConfigWidget(Project *project) + : ToolConfigWidget(project) +{} + +void JALV2::ConfigWidget::initEntries() +{ + createIncludeDirectoriesEntry(); +} diff --git a/src/tools/jalv2/gui/jalv2_ui.h b/src/tools/jalv2/gui/jalv2_ui.h new file mode 100644 index 0000000..93085c1 --- /dev/null +++ b/src/tools/jalv2/gui/jalv2_ui.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * Copyright (C) 2006 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 JALV2_UI_H +#define JALV2_UI_H + +#include "tools/gui/tool_config_widget.h" +#include "tools/gui/tool_group_ui.h" + +namespace JALV2 +{ +//---------------------------------------------------------------------------- +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/jalv2/jalv2.cpp b/src/tools/jalv2/jalv2.cpp new file mode 100644 index 0000000..1d910b8 --- /dev/null +++ b/src/tools/jalv2/jalv2.cpp @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2006 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 "jalv2.h" + +#include "jalv2_compile.h" +#include "jalv2_config.h" +#include "devices/pic/pic/pic_memory.h" +#include "devices/list/device_list.h" +#include "common/global/process.h" +#include "tools/jal/jal_generator.h" + +//---------------------------------------------------------------------------- +bool JALV2::Base::checkExecutableResult(bool, QStringList &lines) const +{ + QStringList tmp; + for (uint i=0; i<lines.count(); i++) + if ( !lines[i].contains('\r') ) tmp += lines[i]; // ?? + lines = tmp; + return ( lines.count()>0 && lines[0].startsWith("jal") ); +} + +//---------------------------------------------------------------------------- +QString JALV2::Group::informationText() const +{ + return i18n("<a href=\"%1\">JAL V2</a> is a new compiler for the high-level language JAL.").arg("http://www.casadeyork.com/jalv2"); +} + +Tool::Group::BaseData JALV2::Group::baseFactory(Tool::Category category) const +{ + if ( category==Tool::Category::Compiler ) return BaseData(new ::JALV2::Base, Both); + return BaseData(); +} + +const char * const SUPPORTED_DEVICES[] = { + "12C509A", "12F675", + "16F628", + "16F818", "16F819", + "16C84", "16F84", + "16F87", "16F88", + "16F873", "16F874", "16F876", "16F877", + "16F873A", "16F874A", "16F876A", "16F877A", + "18F242", "18F252", "18F452", + 0 +}; + +QValueList<const Device::Data *> JALV2::Group::getSupportedDevices(const QString &) const +{ + QValueList<const Device::Data *> list; + for (uint i=0; SUPPORTED_DEVICES[i]; i++) { + const Device::Data *data = Device::lister().data(SUPPORTED_DEVICES[i]); + Q_ASSERT(data); + list.append(data); + } + return list; +} + +Compile::Process *JALV2::Group::processFactory(const Compile::Data &data) const +{ + Q_ASSERT( data.category==Tool::Category::Compiler ); + return new CompileFile; +} + +Compile::Config *JALV2::Group::configFactory(::Project *project) const +{ + return new Config(project); +} + +Tool::SourceGenerator *JALV2::Group::sourceGeneratorFactory() const +{ + return new JAL::SourceGenerator; +} diff --git a/src/tools/jalv2/jalv2.h b/src/tools/jalv2/jalv2.h new file mode 100644 index 0000000..80c3d02 --- /dev/null +++ b/src/tools/jalv2/jalv2.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2006 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 JALV2_H +#define JALV2_H + +#include "tools/base/tool_group.h" + +namespace JALV2 +{ +//---------------------------------------------------------------------------- +class Base : public Tool::Base +{ +public: + virtual QString baseExecutable(bool, Tool::OutputExecutableType) const { return "jalv2"; } + +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 "jalv2"; } + virtual QString label() const { return i18n("JAL V2"); } + virtual QString informationText() const; + virtual bool hasDirectory(Compile::DirectoryType type) const { return type==Compile::DirectoryType::Header; } + virtual Tool::Category checkDevicesCategory() const { return Tool::Category::Nb_Types; } + virtual Tool::ExecutableType preferedExecutableType() const { return Tool::ExecutableType::Unix; } + virtual Tool::CompileType compileType() const { return Tool::AllFiles; } + virtual PURL::FileType implementationType(PURL::ToolType type) const { return (type==PURL::ToolType::Compiler ? PURL::JalSource : PURL::Nb_FileTypes); } + +private: + virtual BaseData baseFactory(Tool::Category c) const; + 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 Tool::SourceGenerator *sourceGeneratorFactory() const; +}; + +} // namespace + +#endif diff --git a/src/tools/jalv2/jalv2_compile.cpp b/src/tools/jalv2/jalv2_compile.cpp new file mode 100644 index 0000000..0b1e7f5 --- /dev/null +++ b/src/tools/jalv2/jalv2_compile.cpp @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2006 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 "jalv2_compile.h" + +#include "jalv2.h" +#include "common/common/misc.h" +#include "tools/list/compile_config.h" + +QStringList JALV2::CompileFile::genericArguments(const Compile::Config &config) const +{ + QStringList args; + QStringList includes = config.includeDirs(Tool::Category::Compiler, QString::null, QString::null, ";"); + QString s = (includes.isEmpty() ? QString::null : includes[0]); + PURL::Directory dir = Compile::Config::directory(group(), Compile::DirectoryType::Header).path(); + if ( !dir.isEmpty() ) { + if ( !s.isEmpty() ) s += ";"; + s += dir.path(); + } + if ( !s.isEmpty() ) { + args += "-s"; + args += s; + } + args += "%I"; + return args; +} + +void JALV2::CompileFile::logStderrLine(const QString &line) +{ + if ( parseErrorLine(line, Compile::ParseErrorData("([^:]*):([0-9]+):\\s*(warning)(.+)", 1, 2, 4, 3)) ) return; + if ( parseErrorLine(line, Compile::ParseErrorData("([^:]*):([0-9]+):\\s*(.+)", 1, 2, 3, Log::LineType::Error)) ) return; + doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized +} + +QString JALV2::CompileFile::outputFiles() const +{ + return "PURL::AsmGPAsm PURL::Hex"; +} diff --git a/src/tools/jalv2/jalv2_compile.h b/src/tools/jalv2/jalv2_compile.h new file mode 100644 index 0000000..de0257d --- /dev/null +++ b/src/tools/jalv2/jalv2_compile.h @@ -0,0 +1,28 @@ +/*************************************************************************** + * Copyright (C) 2006 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 JALV2_COMPILE_H +#define JALV2_COMPILE_H + +#include "tools/list/compile_process.h" + +namespace JALV2 +{ +class CompileFile : public Compile::Process +{ +Q_OBJECT +protected: + virtual QString deviceName() const { return _data.device; } + virtual void logStderrLine(const QString &line); + virtual QStringList genericArguments(const Compile::Config &config) const; + virtual QString outputFiles() const; +}; + +} // namespace + +#endif diff --git a/src/tools/jalv2/jalv2_config.cpp b/src/tools/jalv2/jalv2_config.cpp new file mode 100644 index 0000000..c172c5e --- /dev/null +++ b/src/tools/jalv2/jalv2_config.cpp @@ -0,0 +1,9 @@ +/*************************************************************************** + * Copyright (C) 2006 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 "jalv2_config.h" diff --git a/src/tools/jalv2/jalv2_config.h b/src/tools/jalv2/jalv2_config.h new file mode 100644 index 0000000..e2811d3 --- /dev/null +++ b/src/tools/jalv2/jalv2_config.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * Copyright (C) 2006 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 JALV2_CONFIG_H +#define JALV2_CONFIG_H + +#include "tools/list/compile_config.h" + +namespace JALV2 +{ + +class Config : public Compile::Config +{ +public: + Config(Project *project) : Compile::Config(project) {} +}; + +} // namespace + +#endif |