diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/fortran/compiler | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/fortran/compiler')
8 files changed, 609 insertions, 0 deletions
diff --git a/languages/fortran/compiler/Makefile.am b/languages/fortran/compiler/Makefile.am new file mode 100644 index 00000000..3489a85c --- /dev/null +++ b/languages/fortran/compiler/Makefile.am @@ -0,0 +1,6 @@ +# This is the collection of plugins. In contrast to the parts +# directory, these are 'transient' in a sense and don't +# share the complete KDevComponent interface. + +SUBDIRS = pgioptions + diff --git a/languages/fortran/compiler/pgioptions/Makefile.am b/languages/fortran/compiler/pgioptions/Makefile.am new file mode 100644 index 00000000..3c3dd54e --- /dev/null +++ b/languages/fortran/compiler/pgioptions/Makefile.am @@ -0,0 +1,18 @@ +# Here resides the pgi option dialog plugin. +# This defines the options for the Portland Group compiler + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extras \ + $(all_includes) + +kde_module_LTLIBRARIES = libkdevpgioptions.la +libkdevpgioptions_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +libkdevpgioptions_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/lib/interfaces/extras/libkdevextras.la + +libkdevpgioptions_la_SOURCES = pgioptionsfactory.cpp pgioptionsplugin.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevpghpfoptions.desktop kdevpgf77options.desktop + diff --git a/languages/fortran/compiler/pgioptions/kdevpgf77options.desktop b/languages/fortran/compiler/pgioptions/kdevpgf77options.desktop new file mode 100644 index 00000000..8af14494 --- /dev/null +++ b/languages/fortran/compiler/pgioptions/kdevpgf77options.desktop @@ -0,0 +1,53 @@ +[Desktop Entry] +Type=Service +Exec=pgf77 +Comment=Portland Group Fortran77 Compiler +Comment[br]=Dastumer Fortran 77 ar strollad Portland +Comment[ca]=Compilador Fortran 77 de Portland Group +Comment[da]=Portland Group Fortran77 oversætter +Comment[el]=Μεταγλωττιστής Fortran77 ομάδας Portland +Comment[es]=Compilador de Fortran 77 de Portland Group +Comment[et]=Portland Group Fortran77 kompilaator +Comment[eu]=Portland Group Fortran77 konpiladorea +Comment[fa]=مترجم فرترن ۷۷ گروه Portland +Comment[fr]=Compilateur Fortran77 du Portland Group +Comment[gl]=Compilador de Fortran77 de Portland Group +Comment[hi]=पोर्टलैंड समूह फ़ोरट्रॉन77 कम्पायलर +Comment[hu]=Portland Group Fortran 77 fordítóprogram +Comment[is]=Portland Group Fortran77 þýðandi +Comment[it]=Compilatore per Portland Group Fortran77 +Comment[ja]=Portland グループ Fortran77 コンパイラ +Comment[nds]=Portland Group-Fortran77-Kompilerer +Comment[ne]=पोर्टल्यान्ड समूह फोर्ट्रान ७७ कम्पाइलर +Comment[nl]=Portland Group Fortran77-compiler +Comment[pl]=Kompilator Portland Group Fortran77 +Comment[pt]=Compilador de Fortran77 do Portland Group +Comment[pt_BR]=Compilador Portland Group Fortran77 +Comment[ru]=Компилятор Portland Group Fortran77 +Comment[sk]=Portland Group Fortran77 kompilátor +Comment[sl]=Prevajalnik za Portland Group Fortran77 +Comment[sr]=Преводилац Fortran-а 77 од Portland Group-а +Comment[sr@Latn]=Prevodilac Fortran-a 77 od Portland Group-a +Comment[sv]=Portland gruppens Fortran 77-kompilator +Comment[ta]=பொர்ட்லான்ட் குழு பொர்ட்ரான் 77 தொகுப்பி +Comment[tg]=Талфифгари Portland Group Fortran77 +Comment[tr]=Portland Grubu Fortran 77 Derleyicisi +Comment[zh_CN]=Portland Group Fortran77 编译器 +Comment[zh_TW]=Portland Group Fortran 77 編譯器 +Name=Pgf77Options +Name[da]=Portland Group Fortran77 indstillinger +Name[de]=Pgf77-Einstellungen (KDevelop) +Name[hi]=पीजीएफ़77विकल्प +Name[nds]=Pgf77-Instellen (KDevelop) +Name[pl]=Opcje Pgf77 +Name[sk]=Pgf77 možnosti +Name[sl]=Možnosti Pgf77 +Name[sv]=Alternativ för pgf77 +Name[ta]=Pgf77 விருப்பங்கள் +Name[tg]=Pgf77Интихобҳо +Name[zh_TW]=Pgf77 選項 +ServiceTypes=KDevelop/CompilerOptions +X-KDE-Library=libkdevpgioptions +X-KDevelop-Version=5 +X-KDevelop-Language=Fortran +X-KDevelop-Args=pgf77 diff --git a/languages/fortran/compiler/pgioptions/kdevpghpfoptions.desktop b/languages/fortran/compiler/pgioptions/kdevpghpfoptions.desktop new file mode 100644 index 00000000..56923deb --- /dev/null +++ b/languages/fortran/compiler/pgioptions/kdevpghpfoptions.desktop @@ -0,0 +1,50 @@ +[Desktop Entry] +Type=Service +Exec=pghpf +Comment=Portland Group High Performance Fortran compiler +Comment[ca]=Compilador Fortran d'altes prestacions de Portland Group +Comment[da]=Portland Group Fortran oversætter +Comment[de]=Portland Group High Performance Fortran Compiler +Comment[el]=Μεταγλωττιστής υψηλής ταχύτητας Fortran της ομάδας Portland +Comment[es]=Compilador de Fortran de alto rendimiento de Portland Group +Comment[et]=Portland Groupi suure jõudlusega Fortrani kompilaator +Comment[eu]=Portland Group-en errendimendu handiko Fortran konpiladorea +Comment[fa]=مترجم فرترن با کارایی بالای گروه Portland +Comment[fr]=Compilateur Fortran hautes performances du Portland Group +Comment[gl]=Compilador de High Performance Fortran de Portland Group +Comment[hi]=पोर्टलैंड समूह उच्च परफ़ार्मेंस फ़ोरट्रॉन कम्पायलर +Comment[hu]=Portland Group nagyteljesítményű Fortran fordítóprogram +Comment[it]=Compilatore ad alte prestazioni per Fortran del Portland Group +Comment[ja]=Portland グループ ハイパフォーマンス Fortran コンパイラ +Comment[nds]=Portland Group-Hoochleistenkompilerer för Fortran +Comment[ne]=पोर्टल्यान्ड समूह उच्च कार्यसम्पादन फोर्ट्रान कम्पाइलर +Comment[nl]=Portland Group High Performance Fortran-compiler +Comment[pl]=Kompilator Portland Group High Performance Fortran +Comment[pt]=Compilador Portland Group High Performance Fortran +Comment[pt_BR]=Compilador Portland Group Alta Performance +Comment[ru]=Компилятор Portland Group High Performance Fortran +Comment[sk]=Portland Group vysoko výkonný Fortran kompilátor +Comment[sr]=Преводилац Fortran-а високих перформанси, из Portland Group-а +Comment[sr@Latn]=Prevodilac Fortran-a visokih performansi, iz Portland Group-a +Comment[sv]=Portland gruppens högprestanda Fortran 77-kompilator +Comment[ta]=பொர்ட்லான்ட் குழு உயர் செயல்பாடு பொர்ட்ரான் தொகுப்பி +Comment[tg]=Талфифгари Portland Group High Performance Fortran +Comment[tr]=Portland Grubu Yüksek Başarımlı Fortran Derleyicisi +Comment[zh_CN]=Portland Group 高性能 Fortran 编译器 +Comment[zh_TW]=Portland Group 高效能 Fortran 編譯器 +Name=PghpfOptions +Name[da]=Portland Group oversætter-indstillinger +Name[de]=Pghpf-Einstellungen (KDevelop) +Name[hi]=पीजीएचपीएफ़-विकल्प +Name[nds]=Pghpf-Optschonen +Name[pl]=Opcje Pghpf +Name[sk]=Pghpf možnosti +Name[sv]=Alternativ för pghpf +Name[ta]=Pghpf விருப்பங்கள் +Name[tg]=PghpfИнтихобҳо +Name[zh_TW]=Pghpf 選項 +ServiceTypes=KDevelop/CompilerOptions +X-KDE-Library=libkdevpgioptions +X-KDevelop-Version=5 +X-KDevelop-Language=Fortran +X-KDevelop-Args=pghpf diff --git a/languages/fortran/compiler/pgioptions/pgioptionsfactory.cpp b/languages/fortran/compiler/pgioptions/pgioptionsfactory.cpp new file mode 100644 index 00000000..5fad6630 --- /dev/null +++ b/languages/fortran/compiler/pgioptions/pgioptionsfactory.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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 <kdebug.h> +#include <kinstance.h> +#include "pgioptionsplugin.h" +#include "pgioptionsfactory.h" + + +extern "C" { + + void *init_libkdevpgioptions() + { + return new PgiOptionsFactory; + } + +} + + +PgiOptionsFactory::PgiOptionsFactory(QObject *parent, const char *name) + : KLibFactory(parent, name) +{ + instance(); +} + + +PgiOptionsFactory::~PgiOptionsFactory() +{ + delete s_instance; + s_instance = 0; +} + + +QObject *PgiOptionsFactory::createObject(QObject *parent, const char *name, + const char * /*classname*/, const QStringList &args) +{ + if (args.count() > 0 && qstrcmp(args[0].latin1(), "pghpf") == 0) { + kdDebug(9021) << "Building PgiOptions for PGHPF" << endl; + return new PgiOptionsPlugin(PgiOptionsPlugin::PGHPF, parent, name); + } else if (args.count() > 0 && qstrcmp(args[0].latin1(), "pgf77") == 0) { + kdDebug(9021) << "Building PgiOptions for PGF77" << endl; + return new PgiOptionsPlugin(PgiOptionsPlugin::PGF77, parent, name); + } else { + kdDebug(9021) << "Wrong args for kdevpgioptions library" << endl; + if (args.count() > 0) + kdDebug(9021) << args[0] << endl; + return 0; + } +} + + +KInstance *PgiOptionsFactory::s_instance = 0; +KInstance *PgiOptionsFactory::instance() +{ + if (!s_instance) + s_instance = new KInstance("kdevpgioptions"); + + return s_instance; +} + +#include "pgioptionsfactory.moc" diff --git a/languages/fortran/compiler/pgioptions/pgioptionsfactory.h b/languages/fortran/compiler/pgioptions/pgioptionsfactory.h new file mode 100644 index 00000000..9e3113a7 --- /dev/null +++ b/languages/fortran/compiler/pgioptions/pgioptionsfactory.h @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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 _PGIOPTIONSFACTORY_H_ +#define _PGIOPTIONSFACTORY_H_ + +#include <klibloader.h> + + +class PgiOptionsFactory : public KLibFactory +{ + Q_OBJECT + +public: + PgiOptionsFactory( QObject *parent=0, const char *name=0 ); + ~PgiOptionsFactory(); + + virtual QObject* createObject( QObject *parent, const char *name, + const char *classname, const QStringList &args); + static KInstance *instance(); + +private: + static KInstance *s_instance; +}; + +#endif diff --git a/languages/fortran/compiler/pgioptions/pgioptionsplugin.cpp b/languages/fortran/compiler/pgioptions/pgioptionsplugin.cpp new file mode 100644 index 00000000..8bed362e --- /dev/null +++ b/languages/fortran/compiler/pgioptions/pgioptionsplugin.cpp @@ -0,0 +1,324 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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 <qapplication.h> +#include <qheader.h> +#include <qlayout.h> +#include <qlistview.h> +#include <qradiobutton.h> +#include <qvbox.h> +#include <qvbuttongroup.h> +#include <kdebug.h> +#include <klocale.h> + +#include "pgioptionsplugin.h" + + +const char * const optimization_flags[] = { + "-Mautopar", + "-Mextract", + "-Minline", + "-Mipa", + 0 +}; + + +const char * const hpf_flags[] = { + "-Mbackslash", + "-Mcmf", + "-Mdclchk", + "-Mextend", + "-Mf90", + "-Mnofree", + "-Mstandard", + "-Mupcase", + "-Mbyteswapio", + "-Mdepchk", + "-Mdlines", + "-Mg", + "-Mftn", + "-Minfo", + "-Minform", + "-Mkeepft", + "-Mkeepstaticn", + "-Mmpi", + "-Mmpl", + "-Mlist", + "-Mnohpfc", + "-Mnoindependent", + "-Mnoprelink", + "-Moverlap", + "-Mpreprocess", + "-Mprof", + "-Mpvm", + "-Mr8", + "-Mrecursive", + "-Mreplicate", + "-Mrpm", + "-Mrpm1", + "-M[no]sequence", + "-Msmp", + "-Mstats", + 0 +}; + + + +class GeneralTab : public QWidget +{ +public: + GeneralTab( QWidget *parent=0, const char *name=0 ); + ~GeneralTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); +}; + + +class OptimizationTab : public QWidget +{ +public: + OptimizationTab( PgiOptionsPlugin::Type type, QWidget *parent=0, const char *name=0 ); + ~OptimizationTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + QRadioButton *Odefault, *O0, *O1, *O2; + QListView *optBox; +}; + + +class HpfTab : public QWidget +{ +public: + HpfTab( QWidget *parent=0, const char *name=0 ); + ~HpfTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + QListView *hpfBox; +}; + + +OptimizationTab::OptimizationTab(PgiOptionsPlugin::Type type, QWidget *parent, const char *name) + : QWidget(parent, name) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QVButtonGroup *group = new QVButtonGroup(i18n("Optimization Level"), this); + Odefault = new QRadioButton(i18n("Default"), group); + Odefault->setChecked(true); + O0 = new QRadioButton(i18n("No optimization"), group); + O1 = new QRadioButton(i18n("Level 1"), group); + O2 = new QRadioButton(i18n("Level 2"), group); + + if (type == PgiOptionsPlugin::PGHPF) { + optBox = new QListView(this); + optBox->addColumn(QString::null); + optBox->header()->hide(); + for (const char * const *p = optimization_flags; *p; ++p) { + new QCheckListItem(optBox, *p, QCheckListItem::CheckBox); + kdDebug() << (*p) << endl; + } + } else + optBox = 0; + + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addStretch(); +} + + +OptimizationTab::~OptimizationTab() +{} + + +void OptimizationTab::readFlags(QStringList *list) +{ + if (optBox) { + QListViewItem *item = optBox->firstChild(); + for (; item; item = item->nextSibling()) { + QStringList::Iterator sli = list->find(item->text(0)); + if (sli != list->end()) { + static_cast<QCheckListItem*>(item)->setOn(true); + list->remove(sli); + } + } + } + + QStringList::Iterator sli; + sli = list->find("-O0"); + if (sli != list->end()) { + O0->setChecked(true); + list->remove(sli); + } + sli = list->find("-O1"); + if (sli != list->end()) { + O1->setChecked(true); + list->remove(sli); + } + sli = list->find("-O2"); + if (sli != list->end()) { + O2->setChecked(true); + list->remove(sli); + } +} + + +void OptimizationTab::writeFlags(QStringList *list) +{ + if (optBox) { + QListViewItem *item = optBox->firstChild(); + for (; item; item = item->nextSibling()) + if (static_cast<QCheckListItem*>(item)->isOn()) + (*list) << item->text(0); + } + + if (O0->isChecked()) + (*list) << "-O0"; + else if (O1->isChecked()) + (*list) << "-O1"; + else if (O2->isChecked()) + (*list) << "-O2"; +} + + +HpfTab::HpfTab(QWidget *parent, const char *name) + : QWidget(parent, name) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + hpfBox = new QListView(this); + hpfBox->addColumn(QString::null); + hpfBox->header()->hide(); + for (const char * const *p = hpf_flags; *p; ++p) + new QCheckListItem(hpfBox, *p, QCheckListItem::CheckBox); + + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addStretch(); +} + + +HpfTab::~HpfTab() +{} + + +void HpfTab::readFlags(QStringList *list) +{ + QListViewItem *item = hpfBox->firstChild(); + for (; item; item = item->nextSibling()) { + QStringList::Iterator sli = list->find(item->text(0)); + if (sli != list->end()) { + static_cast<QCheckListItem*>(item)->setOn(true); + list->remove(sli); + } + } +} + + +void HpfTab::writeFlags(QStringList *list) +{ + QListViewItem *item = hpfBox->firstChild(); + for (; item; item = item->nextSibling()) { + if (static_cast<QCheckListItem*>(item)->isOn()) + (*list) << item->text(0); + } +} + + +PgiOptionsDialog::PgiOptionsDialog(PgiOptionsPlugin::Type type, QWidget *parent, const char *name) + : KDialogBase(Tabbed, (type == PgiOptionsPlugin::PGHPF)? i18n("PGHPF Compiler Options") : i18n("PGF77 Compiler Options"), + Ok|Cancel, Ok, parent, name, true) +{ + QVBox *vbox; + + // vbox = addVBoxPage(i18n("General")); + // general = new GeneralTab(vbox, "general tab"); + + vbox = addVBoxPage(i18n("Optimization")); + optimization = new OptimizationTab(type, vbox, "optimization tab"); + + if (type == PgiOptionsPlugin::PGHPF) { + vbox = addVBoxPage(i18n("HPF")); + hpf = new HpfTab(vbox, "optimization tab"); + } else + hpf = 0; + +} + + +PgiOptionsDialog::~PgiOptionsDialog() +{ +} + + +void PgiOptionsDialog::setFlags(const QString &flags) +{ + QStringList flaglist = QStringList::split(" ", flags); + + // Hand them to 'general' at last, so it can make a line edit + // with the unprocessed items + if (hpf) + hpf->readFlags(&flaglist); + optimization->readFlags(&flaglist); + // general->readFlags(&flaglist); +} + + +QString PgiOptionsDialog::flags() const +{ + QStringList flaglist; + + if (hpf) + hpf->writeFlags(&flaglist); + optimization->writeFlags(&flaglist); + // general->writeFlags(&flaglist); + + QString flags; + QStringList::ConstIterator li; + for (li = flaglist.begin(); li != flaglist.end(); ++li) { + flags += (*li); + flags += " "; + } + + flags.truncate(flags.length()-1); + return flags; +} + + +PgiOptionsPlugin::PgiOptionsPlugin(Type type, QObject *parent, const char *name) + : KDevCompilerOptions(parent, name) +{ + pgitype = type; +} + + +PgiOptionsPlugin::~PgiOptionsPlugin() +{} + + +QString PgiOptionsPlugin::exec(QWidget *parent, const QString &flags) +{ + PgiOptionsDialog *dlg = new PgiOptionsDialog(pgitype, parent, "pgi options dialog"); + QString newFlags = flags; + dlg->setFlags(flags); + if (dlg->exec() == QDialog::Accepted) + newFlags = dlg->flags(); + delete dlg; + return newFlags; +} + +#include "pgioptionsplugin.moc" diff --git a/languages/fortran/compiler/pgioptions/pgioptionsplugin.h b/languages/fortran/compiler/pgioptions/pgioptionsplugin.h new file mode 100644 index 00000000..dfbf4547 --- /dev/null +++ b/languages/fortran/compiler/pgioptions/pgioptionsplugin.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2001 by Bernd Gehrmann * + * bernd@kdevelop.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 _PGIOPTIONSPLUGIN_H_ +#define _PGIOPTIONSPLUGIN_H_ + +#include <kdialogbase.h> + +#include "kdevcompileroptions.h" + +class GeneralTab; +class OptimizationTab; +class HpfTab; + + +class PgiOptionsPlugin : public KDevCompilerOptions +{ + Q_OBJECT + +public: + enum Type { PGHPF, PGF77 }; + + PgiOptionsPlugin( Type type, QObject *parent=0, const char *name=0 ); + ~PgiOptionsPlugin(); + + virtual QString exec(QWidget *parent, const QString &flags); + +private: + Type pgitype; +}; + + +class PgiOptionsDialog : public KDialogBase +{ +public: + PgiOptionsDialog(PgiOptionsPlugin::Type type, QWidget *parent=0, const char *name=0 ); + ~PgiOptionsDialog(); + + void setFlags(const QString &flags); + QString flags() const; + +private: + OptimizationTab *optimization; + HpfTab *hpf; +}; + +#endif |