summaryrefslogtreecommitdiffstats
path: root/src/tools/jal
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 18:42:24 +0000
commitf508189682b6fba62e08feeb1596f682bad5fff9 (patch)
tree28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/tools/jal
downloadpiklab-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/jal')
-rw-r--r--src/tools/jal/Makefile.am8
-rw-r--r--src/tools/jal/gui/Makefile.am6
-rw-r--r--src/tools/jal/gui/jal_ui.cpp14
-rw-r--r--src/tools/jal/gui/jal_ui.h35
-rw-r--r--src/tools/jal/jal.cpp72
-rw-r--r--src/tools/jal/jal.h49
-rw-r--r--src/tools/jal/jal_compile.cpp26
-rw-r--r--src/tools/jal/jal_compile.h29
-rw-r--r--src/tools/jal/jal_config.cpp9
-rw-r--r--src/tools/jal/jal_config.h25
-rw-r--r--src/tools/jal/jal_generator.cpp35
-rw-r--r--src/tools/jal/jal_generator.h27
12 files changed, 335 insertions, 0 deletions
diff --git a/src/tools/jal/Makefile.am b/src/tools/jal/Makefile.am
new file mode 100644
index 0000000..b0d8b43
--- /dev/null
+++ b/src/tools/jal/Makefile.am
@@ -0,0 +1,8 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+METASOURCES = AUTO
+
+noinst_LTLIBRARIES = libjal.la
+libjal_la_LDFLAGS = $(all_libraries)
+libjal_la_SOURCES = jal_compile.cpp jal_config.cpp jal.cpp jal_generator.cpp
+
+SUBDIRS = gui \ No newline at end of file
diff --git a/src/tools/jal/gui/Makefile.am b/src/tools/jal/gui/Makefile.am
new file mode 100644
index 0000000..60341d3
--- /dev/null
+++ b/src/tools/jal/gui/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+METASOURCES = AUTO
+
+noinst_LTLIBRARIES = libjalui.la
+libjalui_la_LDFLAGS = $(all_libraries)
+libjalui_la_SOURCES = jal_ui.cpp
diff --git a/src/tools/jal/gui/jal_ui.cpp b/src/tools/jal/gui/jal_ui.cpp
new file mode 100644
index 0000000..4300de0
--- /dev/null
+++ b/src/tools/jal/gui/jal_ui.cpp
@@ -0,0 +1,14 @@
+/***************************************************************************
+ * 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 "jal_ui.h"
+
+//----------------------------------------------------------------------------
+JAL::ConfigWidget::ConfigWidget(Project *project)
+ : ToolConfigWidget(project)
+{}
diff --git a/src/tools/jal/gui/jal_ui.h b/src/tools/jal/gui/jal_ui.h
new file mode 100644
index 0000000..aa6957e
--- /dev/null
+++ b/src/tools/jal/gui/jal_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 JAL_UI_H
+#define JAL_UI_H
+
+#include "tools/gui/tool_config_widget.h"
+#include "tools/gui/tool_group_ui.h"
+
+namespace JAL
+{
+//----------------------------------------------------------------------------
+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/jal/jal.cpp b/src/tools/jal/jal.cpp
new file mode 100644
index 0000000..009ea21
--- /dev/null
+++ b/src/tools/jal/jal.cpp
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * 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 "jal.h"
+
+#include "jal_compile.h"
+#include "jal_config.h"
+#include "devices/pic/pic/pic_memory.h"
+#include "devices/list/device_list.h"
+#include "common/global/process.h"
+#include "jal_generator.h"
+
+//----------------------------------------------------------------------------
+bool JAL::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 JAL::Group::informationText() const
+{
+ return i18n("<a href=\"%1\">JAL</a> is a high-level language for PIC microcontrollers.").arg("http://jal.sourceforge.net");
+}
+
+Tool::Group::BaseData JAL::Group::baseFactory(Tool::Category category) const
+{
+ if ( category==Tool::Category::Compiler ) return BaseData(new ::JAL::Base, Both);
+ return BaseData();
+}
+
+const char * const SUPPORTED_DEVICES[] = {
+ "12C508", "12C509A", "12CE674", "12F629", "12F675",
+ "16C84", "16F84", "16F88", "16F873", "16F876", "16F877", "16F628",
+ "18F242", "18F252", "18F442", "18F452",
+ 0
+};
+
+QValueList<const Device::Data *> JAL::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 *JAL::Group::processFactory(const Compile::Data &data) const
+{
+ Q_ASSERT( data.category==Tool::Category::Compiler );
+ return new CompileFile;
+}
+
+Compile::Config *JAL::Group::configFactory(::Project *project) const
+{
+ return new Config(project);
+}
+
+Tool::SourceGenerator *JAL::Group::sourceGeneratorFactory() const
+{
+ return new SourceGenerator;
+}
diff --git a/src/tools/jal/jal.h b/src/tools/jal/jal.h
new file mode 100644
index 0000000..0c0d790
--- /dev/null
+++ b/src/tools/jal/jal.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * 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 JAL_H
+#define JAL_H
+
+#include "tools/base/tool_group.h"
+
+namespace JAL
+{
+//----------------------------------------------------------------------------
+class Base : public Tool::Base
+{
+public:
+ virtual QString baseExecutable(bool, Tool::OutputExecutableType) const { return "jal"; }
+
+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 "jal"; }
+ virtual QString label() const { return i18n("JAL"); }
+ virtual QString informationText() const;
+ 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/jal/jal_compile.cpp b/src/tools/jal/jal_compile.cpp
new file mode 100644
index 0000000..4d62e68
--- /dev/null
+++ b/src/tools/jal/jal_compile.cpp
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * 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 "jal_compile.h"
+
+void JAL::CompileFile::logStderrLine(const QString &line)
+{
+ if ( line.contains('\r') ) return; // what are those lines ?
+ // #### TODO
+ doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
+}
+
+QStringList JAL::CompileFile::genericArguments(const Compile::Config &) const
+{
+ return "%I";
+}
+
+QString JAL::CompileFile::outputFiles() const
+{
+ return "PURL::AsmGPAsm PURL::Hex";
+}
diff --git a/src/tools/jal/jal_compile.h b/src/tools/jal/jal_compile.h
new file mode 100644
index 0000000..e63f603
--- /dev/null
+++ b/src/tools/jal/jal_compile.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * 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 JAL_COMPILE_H
+#define JAL_COMPILE_H
+
+#include "tools/list/compile_process.h"
+
+namespace JAL
+{
+//-----------------------------------------------------------------------------
+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/jal/jal_config.cpp b/src/tools/jal/jal_config.cpp
new file mode 100644
index 0000000..c51ddf6
--- /dev/null
+++ b/src/tools/jal/jal_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 "jal_config.h"
diff --git a/src/tools/jal/jal_config.h b/src/tools/jal/jal_config.h
new file mode 100644
index 0000000..0d0a513
--- /dev/null
+++ b/src/tools/jal/jal_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 JAL_CONFIG_H
+#define JAL_CONFIG_H
+
+#include "tools/list/compile_config.h"
+
+namespace JAL
+{
+
+class Config : public Compile::Config
+{
+public:
+ Config(Project *project) : Compile::Config(project) {}
+};
+
+} // namespace
+
+#endif
diff --git a/src/tools/jal/jal_generator.cpp b/src/tools/jal/jal_generator.cpp
new file mode 100644
index 0000000..6aa9b08
--- /dev/null
+++ b/src/tools/jal/jal_generator.cpp
@@ -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. *
+ ***************************************************************************/
+#include "jal_generator.h"
+
+#include "devices/pic/base/pic.h"
+
+SourceLine::List JAL::SourceGenerator::configLines(PURL::ToolType, const Device::Memory &, bool &) const
+{
+ // no config lines (?)
+ return SourceLine::List();
+}
+
+SourceLine::List JAL::SourceGenerator::includeLines(PURL::ToolType, const Device::Data &data) const
+{
+ SourceLine::List lines;
+ lines.appendNotIndentedCode("include " + data.name().lower() + "_10", i18n("10MHz crystal"));
+ lines.appendNotIndentedCode("include jlib", i18n("jal standard library"));
+ return lines;
+}
+
+SourceLine::List JAL::SourceGenerator::sourceFileContent(PURL::ToolType, const Device::Data &, bool &) const
+{
+ SourceLine::List lines;
+ lines.appendTitle(i18n("main code"));
+ lines.appendNotIndentedCode(QString::null, "<< " + i18n("insert code") + " >>");
+ lines.appendNotIndentedCode("forever loop", i18n("loop forever"));
+ lines.appendNotIndentedCode("end loop");
+ return lines;
+}
diff --git a/src/tools/jal/jal_generator.h b/src/tools/jal/jal_generator.h
new file mode 100644
index 0000000..b6beddb
--- /dev/null
+++ b/src/tools/jal/jal_generator.h
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * 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 JAL_GENERATOR_H
+#define JAL_GENERATOR_H
+
+#include "tools/base/tool_group.h"
+
+namespace JAL
+{
+
+class SourceGenerator : public Tool::SourceGenerator
+{
+public:
+ virtual SourceLine::List configLines(PURL::ToolType type, const Device::Memory &memory, bool &ok) const;
+ virtual SourceLine::List sourceFileContent(PURL::ToolType type, const Device::Data &data, bool &ok) const;
+ virtual SourceLine::List includeLines(PURL::ToolType type, const Device::Data &data) const;
+};
+
+} // namespace
+
+#endif