summaryrefslogtreecommitdiffstats
path: root/languages/bash
diff options
context:
space:
mode:
Diffstat (limited to 'languages/bash')
-rw-r--r--languages/bash/Makefile.am20
-rw-r--r--languages/bash/README.dox15
-rw-r--r--languages/bash/app_templates/Makefile.am3
-rw-r--r--languages/bash/app_templates/bash.appwizard2
-rw-r--r--languages/bash/app_templates/bashhello/.kdev_ignore0
-rw-r--r--languages/bash/app_templates/bashhello/Makefile.am16
-rw-r--r--languages/bash/app_templates/bashhello/app.kdevelop82
-rw-r--r--languages/bash/app_templates/bashhello/app.sh17
-rw-r--r--languages/bash/app_templates/bashhello/bashhello10
-rw-r--r--languages/bash/app_templates/bashhello/bashhello.kdevtemplate111
-rw-r--r--languages/bash/app_templates/bashhello/bashhello.pngbin0 -> 483 bytes
-rw-r--r--languages/bash/bashsupport_part.cpp442
-rw-r--r--languages/bash/bashsupport_part.h81
-rw-r--r--languages/bash/doc/Makefile.am6
-rw-r--r--languages/bash/doc/bash.toc80
-rw-r--r--languages/bash/doc/bash_bugs.toc7
-rw-r--r--languages/bash/kdevbashsupport.desktop85
-rw-r--r--languages/bash/kdevbashsupport.rc11
18 files changed, 988 insertions, 0 deletions
diff --git a/languages/bash/Makefile.am b/languages/bash/Makefile.am
new file mode 100644
index 00000000..90b94689
--- /dev/null
+++ b/languages/bash/Makefile.am
@@ -0,0 +1,20 @@
+#Here resides the Bash Shell support part.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \
+ $(all_includes)
+SUBDIRS = app_templates doc
+
+kde_module_LTLIBRARIES = libkdevbashsupport.la
+libkdevbashsupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevbashsupport_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevbashsupport_la_SOURCES = bashsupport_part.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevbashsupport.desktop
+
+rcdir = $(kde_datadir)/kdevbashsupport
+rc_DATA = kdevbashsupport.rc
diff --git a/languages/bash/README.dox b/languages/bash/README.dox
new file mode 100644
index 00000000..95765f0a
--- /dev/null
+++ b/languages/bash/README.dox
@@ -0,0 +1,15 @@
+/** \class BashSupportPart
+
+Supports bash language
+
+\authors <a href="mailto:geiseri AT kde.org">Ian Reinhart Geiser</a>
+
+\maintainer <a href="mailto:geiseri AT kde.org">Ian Reinhart Geiser</a>
+
+\feature function browser support
+\feature runs bash script in external terminal
+\feature syntax highlighting and code folding via katepart
+\feature Code completion works for variables
+\feature Consult \ref LangSupportStatus for a up to date features/status of this programming language support part.
+
+*/
diff --git a/languages/bash/app_templates/Makefile.am b/languages/bash/app_templates/Makefile.am
new file mode 100644
index 00000000..7dbe86af
--- /dev/null
+++ b/languages/bash/app_templates/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = bashhello
+profilesdir = $(kde_datadir)/kdevelop/profiles/IDE/ScriptingLanguageIDE/ShellIDE
+profiles_DATA = bash.appwizard
diff --git a/languages/bash/app_templates/bash.appwizard b/languages/bash/app_templates/bash.appwizard
new file mode 100644
index 00000000..2e4473b0
--- /dev/null
+++ b/languages/bash/app_templates/bash.appwizard
@@ -0,0 +1,2 @@
+[General]
+List=bashhello
diff --git a/languages/bash/app_templates/bashhello/.kdev_ignore b/languages/bash/app_templates/bashhello/.kdev_ignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/languages/bash/app_templates/bashhello/.kdev_ignore
diff --git a/languages/bash/app_templates/bashhello/Makefile.am b/languages/bash/app_templates/bashhello/Makefile.am
new file mode 100644
index 00000000..45e403b8
--- /dev/null
+++ b/languages/bash/app_templates/bashhello/Makefile.am
@@ -0,0 +1,16 @@
+dataFiles = app.sh app.kdevelop
+templateName = bashhello
+
+### no need to change below:
+template_DATA = $(templateName).kdevtemplate
+templatedir = ${appwizarddatadir}/templates
+
+appwizarddatadir = ${kde_datadir}/kdevappwizard
+$(templateName).tar.gz: ${dataFiles}
+ $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles}
+ $(GZIP_COMMAND) -f9 $(templateName).tar
+
+archivedir = ${appwizarddatadir}
+archive_DATA = $(templateName).tar.gz ${templateName}.png
+
+CLEANFILES = *.tar.gz \ No newline at end of file
diff --git a/languages/bash/app_templates/bashhello/app.kdevelop b/languages/bash/app_templates/bashhello/app.kdevelop
new file mode 100644
index 00000000..40e783a4
--- /dev/null
+++ b/languages/bash/app_templates/bashhello/app.kdevelop
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevScriptProject</projectmanagement>
+ <primarylanguage>Bash</primarylanguage>
+ <keywords>
+ <keyword>Bash</keyword>
+ </keywords>
+ <ignoreparts>
+ <part>KDevdistpart</part>
+ <part>KDevDebugger</part>
+ </ignoreparts>
+ </general>
+ <kdevscriptproject>
+ <general>
+ <activedir>src</activedir>
+ <includepatterns>*.sh</includepatterns>
+ <excludepatterns>*~</excludepatterns>
+ </general>
+ </kdevscriptproject>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.sh" name="Scripts" />
+ </groups>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="sh"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/languages/bash/app_templates/bashhello/app.sh b/languages/bash/app_templates/bashhello/app.sh
new file mode 100644
index 00000000..9e70bd5f
--- /dev/null
+++ b/languages/bash/app_templates/bashhello/app.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# $Id$
+# %{APPNAME} - Copyright (C) %{YEAR} %{AUTHOR} <%{EMAIL}>
+
+
+hello()
+{
+ echo "Hello $NAME"
+}
+
+echo "This is a test"
+
+LST="Ian Ben Rook Kaz"
+for NAME in $LST
+do
+ hello
+done
diff --git a/languages/bash/app_templates/bashhello/bashhello b/languages/bash/app_templates/bashhello/bashhello
new file mode 100644
index 00000000..7c9b9222
--- /dev/null
+++ b/languages/bash/app_templates/bashhello/bashhello
@@ -0,0 +1,10 @@
+# KDE Config File
+[General]
+Name=Simple Bash Shell Script
+Name[fr]=Un simple script de test Hello world
+Category=Shell
+Category[fr]=Interprteur BASH
+Comment=This generates a simplistic 'Hello world' program in Bash shell
+Comment[fr]=Gnre un simple script de test du type Hello world pour l'interprteur BASH.
+FileTemplates=sh,ShellStyle
+ShowFilesAfterGeneration=APPNAMELC.sh
diff --git a/languages/bash/app_templates/bashhello/bashhello.kdevtemplate b/languages/bash/app_templates/bashhello/bashhello.kdevtemplate
new file mode 100644
index 00000000..e62b1514
--- /dev/null
+++ b/languages/bash/app_templates/bashhello/bashhello.kdevtemplate
@@ -0,0 +1,111 @@
+# KDE Config File
+[General]
+Name=Simple Bash Shell Script
+Name[ca]=Simple script de l'intèrpret de comandaments Bash
+Name[da]=Simpelt Bash skal-script
+Name[de]=Ein einfaches Shell-Skript für Bash
+Name[el]=Απλό σενάριο κελύφους Bash
+Name[es]=Guión sencillo para el intérprete de órdenes Bash
+Name[et]=Lihtne bash'i shelliskript
+Name[eu]=Bash shell-aren script sinplea
+Name[fa]=دست‌نوشتۀ سادۀ پوستۀ Bash
+Name[fr]=Script shell Bash simple
+Name[ga]=Script Shimplí Bhlaoisce Bash
+Name[gl]=Script sinxelo en Bash Shell
+Name[hu]=Egyszerű Bash-szkript
+Name[it]=Semplice script shell Bash
+Name[ja]=簡単な Bash シェルスクリプト
+Name[nds]=En eenfach Konsoolskript för Bash
+Name[ne]=साधारण ब्यास शेल स्क्रिप्ट
+Name[nl]=Eenvoudig Bash-shellscript
+Name[pl]=Prosty skrypt powłoki Bash
+Name[pt]=Programa Simples da 'Shell' Bash
+Name[pt_BR]=Programa Simples da 'Shell' Bash
+Name[ru]=Простой скрипт Bash
+Name[sk]=Jednoduchý skript pre Bash Shell
+Name[sl]=Preprost skript za lupino Bash
+Name[sr]=Једноставна скрипта шкољке Bash
+Name[sr@Latn]=Jednostavna skripta školjke Bash
+Name[sv]=Enkelt Bash-skalskript
+Name[tr]=Basit Bash Kabuk Betiği
+Name[zh_CN]=简单的 Bash Shell 脚本
+Name[zh_TW]=簡單的 Bash shell 文稿
+Category=Shell
+Category[fr]=Interprteur BASH
+Comment=This generates a simplistic 'Hello world' program in Bash shell
+Comment[ca]=Genera un simple programa de 'Hello world' en l'intèrpret de comandaments Bash
+Comment[da]=Dette genererer et simplistisk 'Goddag verden' program i en Bash skal
+Comment[de]=Generiert ein einfaches "Hello world"-Programm für die Bash-Shell
+Comment[el]=Αυτό δημιουργεί ένα απλό πρόγραμμα 'Γεια σου κόσμε' στο κέλυφος Bash
+Comment[es]=Genera un sencillo programa «Hola mundo» para el intérprete de órdenes Bash
+Comment[et]=Lihtsa "Tere, maailm" programmi loomine bash'i shellis
+Comment[eu]=Honek "Kaixo mundua" programa sinple bat sortzen du Bash shell-erako
+Comment[fa]=یک برنامۀ سادۀ «Hello world» در پوستۀ Bash تولید می‌کند
+Comment[fr]=Génère un programme « Bonjour monde » des plus simples en shell Bash
+Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí "Hello World" i mblaosc Bash
+Comment[gl]=Xera un programa sinxelo 'Ola mundo' en Bash shell
+Comment[hu]=Létrehoz egy egyszerű Hello world programot a Bash parancsértelmezőhöz
+Comment[it]=Questo genera un semplice programma shell di "Hello world" in Bash
+Comment[ja]=簡単な Hello world プログラムを Bash シェルで記述します
+Comment[nds]=Dit stellt en eenfach "Moin Welt"-Programm för de Bash-Konsool op
+Comment[ne]=यसले ब्यास शेलमा साधारण 'हेल्डो वोल्डकार' कार्यक्रम उत्पन्न गर्दछ
+Comment[nl]=Dit genereert een eenvoudig "Hello World" programma in Bash-shell
+Comment[pl]=Generuje prosty program 'Witaj świecie' jako skrypt powłoki Bash
+Comment[pt]=Isto gera um programa simplista 'Olá mundo' para a linha de comandos Bash
+Comment[pt_BR]=Isto gera um programa simplista 'Olá mundo' para a linha de comandos Bash
+Comment[ru]=Создание простой программы 'Hello world' на Bash
+Comment[sk]=Vygeneruje jednoduchý "Ahoj svet" program v Bash Shell
+Comment[sl]=Ustvari preprost program 'Dobrodošel svet' v lupini Bash
+Comment[sr]=Ово прави једноставан „Здраво свете“ програм за шкољку Bash
+Comment[sr@Latn]=Ovo pravi jednostavan „Zdravo svete“ program za školjku Bash
+Comment[sv]=Detta skapar ett förenklat 'Hello world'-program för Bash-skalet
+Comment[tr]=Bu, Bash kabuğunda basit bir "Merhaba Dünya" programı üretir.
+Comment[zh_CN]=这将生成 Bash shell 中可以使用的“Hello world”程序
+Comment[zh_TW]=這會產生一個簡單的 Bash shell 的 hello world 程式
+FileTemplates=sh,ShellStyle
+ShowFilesAfterGeneration=%{dest}/%{APPNAMELC}.sh
+Archive=bashhello.tar.gz
+
+[FILE1]
+Type=install
+EscapeXML=true
+Source=%{src}/app.kdevelop
+Dest=%{dest}/%{APPNAMELC}.kdevelop
+
+[FILE2]
+Type=install
+Source=%{src}/app.sh
+Dest=%{dest}/%{APPNAMELC}.sh
+
+[MSG]
+Type=message
+Comment=A simple bash shell script project was created in %{dest}
+Comment[ca]=Un simple script de l'intèrpret de comandaments Bash ha estat creat en %{dest}
+Comment[da]=Et simpelt bash skalscript-projekt blev oprettet i %{dest}
+Comment[de]=Ein einfaches Shell-Skript-Projekt für Bash wurde in %{dest} erstellt
+Comment[el]=Ένα απλό σενάριο κελύφους bash δημιουργήθηκε στο %{dest}
+Comment[es]=Un sencillo proyecto de guión de intérprete de órdenes ha sido creado en %{dest}
+Comment[et]=Lihtne bash'i shelliskript loodi asukohta %{dest}
+Comment[eu]=Bash shell-erako proiektu sinple bat sortu da hemen:%{dest}
+Comment[fa]=یک پروژۀ دست‌نوشتۀ پوستۀ bash ساده در %{dest} ایجاد شد
+Comment[fr]=Un projet de script shell Bash simple a été créé dans %{dest}
+Comment[ga]=Cruthaíodh tionscadal simplí bash i %{dest}
+Comment[gl]=Creouse un proxecto de script sinxelo en bash shell en %{dest}
+Comment[hu]=Létrejött egy egyszerű Bash-szkript (projekt) itt: %{dest}
+Comment[it]=È stato creato un semplice progetto di script shell in Bash in %{dest}
+Comment[ja]=簡単な bash シェルスクリプトを %{dest} に作成しました
+Comment[nds]=In %{dest} wöör en eenfach Konsoolskript-Projekt för Bash opstellt
+Comment[ne]=एउटा साधारण शेल स्क्रिप्ट परियोजना %{dest} मा सिर्जना गरिएको थियो
+Comment[nl]=Een eenvoudig Bash-shellscript is aangemaakt in %{dest}
+Comment[pl]=Prosty skrypt powłoki został utworzony w %{dest}
+Comment[pt]=Foi criado um programa simples "Olá mundo" em Bash em %{dest}
+Comment[pt_BR]=Foi criado um programa simples "Olá mundo" em Bash em %{dest}
+Comment[ru]=Простая программа "Hello world" на Bash создана в %{dest}
+Comment[sk]=Jednoduchý Bash Shell projekt bol vytvorený v %{dest}
+Comment[sl]=Projekt s preprostim skriptom za lupino Bash je bil ustvarjen v %{dest}
+Comment[sr]=Пројекат једноставне скрипте за шкољку Bash направљен је у %{dest}
+Comment[sr@Latn]=Projekat jednostavne skripte za školjku Bash napravljen je u %{dest}
+Comment[sv]=Ett enkelt Bash skalskriptprojekt skapades i %{dest}
+Comment[tr]=Basit bir bash betik projesi %{dest} içinde yaratılmıştır.
+Comment[zh_CN]=在 %{dest} 中创建了简单的 Bash Shell 脚本工程
+Comment[zh_TW]=Bash shell 的 Hello world 程式已產生在 ${dest}
diff --git a/languages/bash/app_templates/bashhello/bashhello.png b/languages/bash/app_templates/bashhello/bashhello.png
new file mode 100644
index 00000000..840a953c
--- /dev/null
+++ b/languages/bash/app_templates/bashhello/bashhello.png
Binary files differ
diff --git a/languages/bash/bashsupport_part.cpp b/languages/bash/bashsupport_part.cpp
new file mode 100644
index 00000000..389c0a70
--- /dev/null
+++ b/languages/bash/bashsupport_part.cpp
@@ -0,0 +1,442 @@
+/*
+* Copyright (C) 2003 Ian Reinhart Geiser <geiseri@kde.org>
+*/
+#include "bashsupport_part.h"
+
+#include <qwhatsthis.h>
+
+#include <qfileinfo.h>
+#include <qstringlist.h>
+#include <qtextstream.h>
+#include <qtimer.h>
+#include <kapplication.h>
+#include <qregexp.h>
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kprocess.h>
+#include <kdebug.h>
+#include <kaction.h>
+#include <kparts/part.h>
+#include <kdialogbase.h>
+
+
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <kdevlanguagesupport.h>
+#include <kdevpartcontroller.h>
+#include <kdevproject.h>
+#include <kdevappfrontend.h>
+#include <kdevplugininfo.h>
+#include <domutil.h>
+#include <codemodel.h>
+
+typedef KDevGenericFactory<BashSupportPart> BashSupportFactory;
+static const KDevPluginInfo data("kdevbashsupport");
+K_EXPORT_COMPONENT_FACTORY( libkdevbashsupport, BashSupportFactory( data ) )
+
+BashSupportPart::BashSupportPart(QObject *parent, const char *name, const QStringList& )
+: KDevLanguageSupport (&data, parent, name ? name : "BashSupportPart" )
+{
+ setInstance(BashSupportFactory::instance());
+ setXMLFile("kdevbashsupport.rc");
+
+ KAction *action;
+ action = new KAction( i18n("&Run"), "exec",Key_F9,this, SLOT(slotRun()),actionCollection(), "build_execute" );
+ action->setToolTip(i18n("Run"));
+ action->setWhatsThis(i18n("<b>Run</b><p>Starts an application."));
+
+ kdDebug() << "Creating BashSupportPart" << endl;
+
+ connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)),
+ this, SLOT(projectConfigWidget(KDialogBase*)) );
+ connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) );
+ connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) );
+ connect( partController(), SIGNAL(savedFile(const KURL&)), this, SLOT(savedFile(const KURL&)) );
+ connect(partController(), SIGNAL(activePartChanged(KParts::Part*)),
+ this, SLOT(slotActivePartChanged(KParts::Part *)));
+
+ m_cc = new BashCodeCompletion();
+}
+
+
+BashSupportPart::~BashSupportPart()
+{
+ delete( m_cc );
+ m_cc = 0;
+}
+
+
+void BashSupportPart::projectConfigWidget(KDialogBase *dlg)
+{
+ Q_UNUSED( dlg );
+// QVBox *vbox = dlg->addVBoxPage(i18n("Bash"));
+// RubyConfigWidget *w = new RubyConfigWidget(*projectDom(), (QWidget *)vbox, "Bash config widget");
+// connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) );
+}
+
+void BashSupportPart::projectOpened()
+{
+ kdDebug(9014) << "projectOpened()" << endl;
+
+ connect( project(), SIGNAL(addedFilesToProject(const QStringList &)),
+ this, SLOT(addedFilesToProject(const QStringList &)) );
+ connect( project(), SIGNAL(removedFilesFromProject(const QStringList &)),
+ this, SLOT(removedFilesFromProject(const QStringList &)) );
+
+ // We want to parse only after all components have been
+ // properly initialized
+ QTimer::singleShot(0, this, SLOT(parse()));
+}
+
+
+void BashSupportPart::projectClosed()
+{
+
+}
+
+void BashSupportPart::slotRun ()
+{
+ QString file;
+ KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(partController()->activePart());
+ if(ro_part)
+ file = ro_part->url().path();
+
+ QString cmd = interpreter() + " " + file;
+ startApplication(cmd);
+}
+
+QString BashSupportPart::interpreter()
+{
+ QString prog = DomUtil::readEntry(*projectDom(), "/kdevrbashsupport/run/interpreter");
+ if (prog.isEmpty())
+ prog = "bash";
+ return prog;
+}
+
+void BashSupportPart::parse()
+{
+ kdDebug(9014) << "initialParse()" << endl;
+
+ if (project())
+ {
+ kapp->setOverrideCursor(waitCursor);
+ QStringList files = project()->allFiles();
+ for (QStringList::Iterator it = files.begin(); it != files.end() ;++it)
+ {
+ kdDebug(9014) << "maybe parse " << project()->projectDirectory() + "/" + (*it) << endl;
+ parse(project()->projectDirectory() + "/" + *it);
+ }
+ emit updatedSourceInfo();
+ kapp->restoreOverrideCursor();
+ } else {
+ kdDebug(9014) << "No project" << endl;
+ }
+}
+
+void BashSupportPart::addedFilesToProject(const QStringList &fileList)
+{
+kdDebug(9014) << "addedFilesToProject()" << endl;
+
+ QStringList::ConstIterator it;
+
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ parse(project()->projectDirectory() + "/" + ( *it ) );
+ }
+
+ emit updatedSourceInfo();
+}
+
+
+void BashSupportPart::removedFilesFromProject(const QStringList &fileList)
+{
+ kdDebug(9014) << "removedFilesFromProject()" << endl;
+
+ QStringList::ConstIterator it;
+
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ QString fileName = project()->projectDirectory() + "/" + ( *it );
+ if( codeModel()->hasFile(fileName) ){
+ emit aboutToRemoveSourceInfo( fileName );
+ codeModel()->removeFile( codeModel()->fileByName(fileName) );
+ }
+ }
+
+ //emit updatedSourceInfo();
+}
+
+void BashSupportPart::savedFile(const KURL &fileName)
+{
+ kdDebug(9014) << "savedFile()" << endl;
+
+ if (project()->allFiles().contains(fileName.path().mid ( project()->projectDirectory().length() + 1 )))
+ {
+ parse(fileName.path());
+ emit addedSourceInfo( fileName.path() );
+ }
+}
+
+void BashSupportPart::startApplication(const QString &program)
+{
+ kdDebug() << "starting application" << program << endl;
+ if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend"))
+ appFrontend->startAppCommand(QString::QString(), program, TRUE);
+}
+
+
+KDevLanguageSupport::Features BashSupportPart::features()
+{
+ return Features(Variables | Functions);
+}
+
+void BashSupportPart::parse(const QString &fileName)
+{
+ QFileInfo fi(fileName);
+ m_vars.clear();
+ if (fi.extension() == "sh")
+ {
+ if( codeModel()->hasFile(fileName) ){
+ emit aboutToRemoveSourceInfo( fileName );
+ codeModel()->removeFile( codeModel()->fileByName(fileName) );
+ }
+
+ FileDom m_file = codeModel()->create<FileModel>();
+ m_file->setName( fileName );
+
+ m_vars.clear();
+ QFile f(QFile::encodeName(fileName));
+ if (!f.open(IO_ReadOnly))
+ return;
+ QString rawline;
+ QString line;
+ uint lineNo = 0;
+ //KRegExp methodre("\\b([\\d\\w]+[\\s]*)\\([\\s]*\\)");
+ QRegExp methodre("^\\s*(\\w+)\\s*\\(\\s*\\)");
+ QRegExp varre( "^\\s*(\\w+)[=]" );
+ QRegExp expvarre( "^export\\s*(\\w+)[=]" );
+ QRegExp forvarre("\\bfor[\\s]+([\\d\\w]+)[\\s]+in[\\s]+");
+
+ QTextStream stream(&f);
+ while (!stream.atEnd())
+ {
+ rawline = stream.readLine();
+ line = rawline.stripWhiteSpace().local8Bit();
+ kdDebug() << "Trying line: " << line << endl;
+ if (methodre.search(line) != -1)
+ {
+ FunctionDom method = codeModel()->create<FunctionModel>();
+ method->setName(methodre.cap(1));
+ method->setFileName(fileName);
+ method->setStartPosition(lineNo, 0);
+
+ if( !m_file->hasFunction(method->name()) ){
+ kdDebug() << "Add global method " << method->name() << endl;
+ m_file->addFunction( method );
+ }
+ }
+ else if(varre.search(line) != -1)
+ {
+ addAttribute(varre.cap(1), m_file, lineNo);
+ }
+ else if(expvarre.search(line) != -1)
+ {
+ addAttribute(expvarre.cap(1), m_file, lineNo);
+ }
+ else if(forvarre.search(line) != -1)
+ {
+ addAttribute(forvarre.cap(1), m_file, lineNo);
+ }
+ ++lineNo;
+ }
+ f.close();
+
+ kdDebug() << "Trying to add list..." << endl;
+ codeModel()->addFile( m_file );
+ VariableList attrList = codeModel()->globalNamespace()->variableList();
+ for (VariableList::Iterator it = attrList.begin(); it != attrList.end(); ++it)
+ {
+ kdDebug() << "Adding " << (*it)->name() << endl;
+ m_vars.append((*it)->name());
+ }
+ m_cc->setVars(m_vars);
+
+ codeModel()->addFile( m_file );
+ }
+
+}
+
+void BashSupportPart::slotActivePartChanged(KParts::Part *part)
+{
+ kdDebug() << "Changeing part..." << endl;
+ m_cc->setActiveEditorPart(part);
+}
+
+void BashSupportPart::addAttribute(const QString &name, FileDom file, uint lineNo)
+{
+ VariableDom var = codeModel()->create<VariableModel>();
+ var->setName(name);
+ var->setFileName(file->name());
+ var->setStartPosition( lineNo, 0 );
+ var->setType(i18n("Variable"));
+
+ if( !file->hasVariable(var->name()) ){
+ kdDebug() << "Add global attribute " << var->name() << endl;
+ file->addVariable(var);
+ }
+}
+
+BashCodeCompletion::BashCodeCompletion()
+{
+ m_argWidgetShow = false;
+ m_completionBoxShow=false;
+}
+
+BashCodeCompletion::~BashCodeCompletion()
+{
+
+}
+
+void BashCodeCompletion::setActiveEditorPart(KParts::Part *part)
+{
+ if (!part || !part->widget())
+ return;
+
+ kdDebug() << "BashCodeCompletion::setActiveEditorPart" << endl;
+
+// We need to think about this
+// if(!(m_config->getCodeCompletion() || m_config->getCodeHinting())){
+// return; // no help
+// }
+
+ m_editInterface = dynamic_cast<KTextEditor::EditInterface*>(part);
+ if (!m_editInterface)
+ {
+ kdDebug() << "editor doesn't support the EditDocumentIface" << endl;
+ return;
+ }
+
+ m_cursorInterface = dynamic_cast<KTextEditor::ViewCursorInterface*>(part->widget());
+ if (!m_cursorInterface)
+ {
+ kdDebug() << "editor does not support the ViewCursorInterface" << endl;
+ return;
+ }
+
+ m_codeInterface = dynamic_cast<KTextEditor::CodeCompletionInterface*>(part->widget());
+ if (!m_codeInterface) { // no CodeCompletionDocument available
+ kdDebug() << "editor doesn't support the CodeCompletionDocumentIface" << endl;
+ return;
+ }
+
+ disconnect(part->widget(), 0, this, 0 ); // to make sure that it is't connected twice
+ connect(part->widget(), SIGNAL(cursorPositionChanged()),
+ this, SLOT(cursorPositionChanged()));
+ connect(part->widget(), SIGNAL(argHintHidden()), this, SLOT(argHintHidden()));
+ connect(part->widget(), SIGNAL(completionAborted()), this, SLOT(completionBoxAbort()));
+ connect(part->widget(), SIGNAL(completionDone()), this, SLOT(completionBoxHidden()));
+
+}
+
+void BashCodeCompletion::setVars(QStringList lst)
+{
+ m_vars = lst;
+}
+
+QValueList<KTextEditor::CompletionEntry> BashCodeCompletion::getVars(const QString &startText)
+{
+ kdDebug() << "getVars for " << startText << endl;
+ QValueList<KTextEditor::CompletionEntry> varList;
+ QValueList<QString>::ConstIterator it;
+ for (it = m_vars.begin(); it != m_vars.end(); ++it) {
+ QString var = "$" + (*it);
+ kdDebug() << "Compair " << var << endl;
+ if( var.startsWith( startText ))
+ {
+ KTextEditor::CompletionEntry e;
+ e.text = var;
+ //e.postfix ="";
+ //e.prefix ="";
+ kdDebug() << "getVar: " << var << endl;
+ varList.append(e);
+ }
+ }
+
+ return varList;
+}
+
+void BashCodeCompletion::cursorPositionChanged()
+{
+ uint line, col;
+ m_cursorInterface->cursorPositionReal(&line, &col);
+ kdDebug() << "BashCodeCompletion::cursorPositionChanged:" << line << ":" << col << endl;
+
+ QString lineStr = m_editInterface->textLine(line);
+ if(lineStr.isNull() || lineStr.isEmpty()){
+ kdDebug() << "No Text..." << endl;
+ return; // nothing to do
+ }
+// if(m_config->getCodeCompletion())
+// {
+ QString restLine = lineStr.mid(col);
+ QString prevText = lineStr.mid(0,col);
+
+ if(restLine.left(1) != " " && restLine.left(1) != "\t" && !restLine.isNull())
+ {
+ kdDebug() << "no codecompletion because no empty character after cursor:" << restLine << ":" << endl;
+ return;
+ }
+
+ QRegExp prevReg("[$][\\d\\w]*\\b$");
+
+ int pos = prevReg.search( prevText );
+ if (pos > -1 )
+ {
+ // We are in completion mode
+ QString startMatch = prevReg.cap(0);
+ kdDebug() << "Matching: " << startMatch << endl;
+ m_completionBoxShow=true;
+ m_codeInterface->showCompletionBox(getVars(startMatch),2);
+ }
+ else
+ {
+ kdDebug() << "no vars in: " << prevText << endl;
+ return;
+ }
+
+// }
+
+}
+
+void BashCodeCompletion::completionBoxHidden()
+{
+ kdDebug() << "Complete..." << endl;
+ m_completionBoxShow=false;
+/* uint line, col, start;
+ m_cursorInterface->cursorPositionReal(&line, &col);
+ QString lineStr = m_editInterface->textLine(line);
+
+ start = lineStr.findRev(QRegExp("[$][\\d\\w]*\\b$"));
+ m_editInterface->removeText ( start, col, line, col );
+*/
+}
+
+void BashCodeCompletion::completionBoxAbort()
+{
+ kdDebug() << "aborted..." << endl;
+ m_completionBoxShow=false;
+}
+
+KMimeType::List BashSupportPart::mimeTypes( )
+{
+ KMimeType::List list;
+
+ KMimeType::Ptr mime = KMimeType::mimeType( "application/x-shellscript" );
+ if( mime )
+ list << mime;
+
+ return list;
+}
+#include "bashsupport_part.moc"
diff --git a/languages/bash/bashsupport_part.h b/languages/bash/bashsupport_part.h
new file mode 100644
index 00000000..20c11c4e
--- /dev/null
+++ b/languages/bash/bashsupport_part.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2003 Ian Reinhart Geiser <geiseri@kde.org>
+ */
+
+
+#ifndef __KDEVPART_BASHSUPPORT_H__
+#define __KDEVPART_BASHSUPPORT_H__
+
+
+#include <qguardedptr.h>
+
+#include <kprocess.h>
+#include <kdialogbase.h>
+
+#include <codemodel.h>
+#include <kdevplugin.h>
+#include <kdevlanguagesupport.h>
+
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/codecompletioninterface.h>
+
+//class BashSupportWidget;
+
+class BashCodeCompletion : QObject
+{
+ Q_OBJECT
+ public:
+ BashCodeCompletion();
+ ~BashCodeCompletion();
+ void setActiveEditorPart(KParts::Part*);
+ void setVars(QStringList);
+ QValueList<KTextEditor::CompletionEntry> getVars(const QString& textHint);
+
+ public slots:
+ void cursorPositionChanged();
+ void completionBoxHidden();
+ void completionBoxAbort();
+
+ private:
+ QStringList m_vars;
+ bool m_argWidgetShow;
+ bool m_completionBoxShow;
+ KTextEditor::EditInterface *m_editInterface;
+ KTextEditor::CodeCompletionInterface *m_codeInterface;
+ KTextEditor::ViewCursorInterface *m_cursorInterface;
+};
+
+class BashSupportPart : public KDevLanguageSupport
+{
+ Q_OBJECT
+ public:
+ BashSupportPart(QObject *parent, const char *name, const QStringList &);
+ virtual ~BashSupportPart();
+
+ protected:
+ virtual Features features();
+ virtual KMimeType::List mimeTypes();
+
+ private slots:
+ void slotRun();
+ void projectConfigWidget(KDialogBase *dlg);
+ void projectOpened();
+ void projectClosed();
+ void savedFile(const KURL &fileName);
+ void addedFilesToProject(const QStringList &fileList);
+ void removedFilesFromProject(const QStringList &fileList);
+ void parse();
+ void slotActivePartChanged(KParts::Part *part);
+
+ private:
+ void startApplication(const QString &program);
+ QString interpreter();
+ void parse(const QString &fileName);
+ void addAttribute(const QString &name, FileDom file, uint line);
+ BashCodeCompletion *m_cc;
+ QStringList m_vars;
+
+};
+
+#endif
diff --git a/languages/bash/doc/Makefile.am b/languages/bash/doc/Makefile.am
new file mode 100644
index 00000000..1474d939
--- /dev/null
+++ b/languages/bash/doc/Makefile.am
@@ -0,0 +1,6 @@
+tocdir = ${kde_datadir}/kdevdocumentation/tocs
+toc_DATA = bash.toc bash_bugs.toc
+
+#indexdir = ${kde_datadir}/devdoctreeview/indices
+#index_DATA =
+
diff --git a/languages/bash/doc/bash.toc b/languages/bash/doc/bash.toc
new file mode 100644
index 00000000..060c59c7
--- /dev/null
+++ b/languages/bash/doc/bash.toc
@@ -0,0 +1,80 @@
+<!DOCTYPE kdeveloptoc>
+<kdeveloptoc>
+<title>Bash Reference Manual</title>
+<base href="http://bashdb.sourceforge.net/"/>
+<tocsect1 name="Introduction" url="bashref.html#SEC1">
+ <tocsect2 name="What is Bash?" url="bashref.html#SEC2"/>
+ <tocsect2 name="What is a Shell?" url="bashref.html#SEC3"/>
+</tocsect1>
+<tocsect1 name="Definitions" url="bashref.html#SEC4"></tocsect1>
+<tocsect1 name="Basic Shell Features" url="bashref.html#SEC5">
+ <tocsect2 name="Shell Syntax" url="bashref.html#SEC6"/>
+ <tocsect2 name="Shell Commands" url="bashref.html#SEC15"/>
+ <tocsect2 name="Shell Functions" url="bashref.html#SEC22"/>
+ <tocsect2 name="Shell Parameters" url="bashref.html#SEC23"/>
+ <tocsect2 name="Shell Expansions" url="bashref.html#SEC26"/>
+ <tocsect2 name="Shell Redirections" url="bashref.html#SEC37"/>
+ <tocsect2 name="Executeing Commands" url="bashref.html#SEC47"/>
+ <tocsect2 name="Shell Scripts" url="bashref.html#SEC54"/>
+</tocsect1>
+<tocsect1 name="Shell Builtin Commands" url="bashref.html#SEC55">
+ <tocsect2 name="Bourne Shell Builtins" url="bashref.html#SEC56"/>
+ <tocsect2 name="Bash Builtin Commands" url="bashref.html#SEC57"/>
+ <tocsect2 name="The Set Builtin" url="bashref.html#SEC58"/>
+ <tocsect2 name="Special Builtins" url="bashref.html#SEC59"/>
+</tocsect1>
+<tocsect1 name="Shell Variables" url="bashref.html#SEC60">
+ <tocsect2 name="Bourne Shell Variables" url="bashref.html#SEC61"/>
+ <tocsect2 name="Bash Variables" url="bashref.html#SEC62"/>
+</tocsect1>
+<tocsect1 name="Bash Features" url="bashref.html#SEC63">
+ <tocsect2 name="Invoking Bash" url="bashref.html#SEC64"/>
+ <tocsect2 name="Bash Startup Files" url="bashref.html#SEC65"/>
+ <tocsect2 name="Bash Conditional Expressions" url="bashref.html#SEC77"/>
+ <tocsect2 name="Shell Arithmetic" url="bashref.html#SEC78"/>
+ <tocsect2 name="Aliases" url="bashref.html#SEC79"/>
+ <tocsect2 name="Arrays" url="bashref.html#SEC80"/>
+ <tocsect2 name="The Directory Stack" url="bashref.html#SEC81"/>
+ <tocsect2 name="Controlling the Prompt" url="bashref.html#SEC83"/>
+ <tocsect2 name="The Restricted Shell" url="bashref.html#SEC84"/>
+ <tocsect2 name="Bash POSIX Mode" url="bashref.html#SEC85"/>
+</tocsect1>
+<tocsect1 name="Job Control" url="bashref.html#SEC86">
+ <tocsect2 name="Job Control Basics" url="bashref.html#SEC87"/>
+ <tocsect2 name="Job Control Builtins" url="bashref.html#SEC88"/>
+ <tocsect2 name="Job Control Variables" url="bashref.html#SEC89"/>
+</tocsect1>
+<tocsect1 name="Using History Interactively" url="bashref.html#SEC114">
+ <tocsect2 name="Bash History Facilities" url="bashref.html#SEC115"/>
+ <tocsect2 name="Bash Hisotry Builtins" url="bashref.html#SEC116"/>
+ <tocsect2 name="History Expansion" url="bashref.html#SEC117"/>
+</tocsect1>
+<tocsect1 name="Command Line Editing" url="bashref.html#SEC90">
+ <tocsect2 name="Introduciton to Line Editing" url="bashref.html#SEC91"/>
+ <tocsect2 name="Readline Interaction" url="bashref.html#SEC92"/>
+ <tocsect2 name="Readline Init File" url="bashref.html#SEC98"/>
+ <tocsect2 name="Bindable Readline Commands" url="bashref.html#SEC102"/>
+ <tocsect2 name="Readline VI Mode" url="bashref.html#SEC111"/>
+ <tocsect2 name="Programmable Completion" url="bashref.html#SEC112"/>
+ <tocsect2 name="Programmable Completion Builtins" url="bashref.html#SEC113"/>
+</tocsect1>
+<tocsect1 name="Installing Bash" url="bashref.html#SEC121">
+ <tocsect2 name="Basic Installation" url="bashref.html#SEC122"/>
+ <tocsect2 name="Compilers and Options" url="bashref.html#SEC123"/>
+ <tocsect2 name="Compileing for Multiple Architectures" url="bashref.html#SEC124"/>
+ <tocsect2 name="Installation Names" url="bashref.html#SEC125"/>
+ <tocsect2 name="Specifying the System Type" url="bashref.html#SEC126"/>
+ <tocsect2 name="Shareing Defaults" url="bashref.html#SEC127"/>
+ <tocsect2 name="Operation Controls" url="bashref.html#SEC128"/>
+ <tocsect2 name="Operational Features" url="bashref.html#SEC129"/>
+</tocsect1>
+<tocsect1 name="Reporting Bugs" url="bashref.html#SEC130"></tocsect1>
+<tocsect1 name="Major Differences From The Bourne Shell" url="bashref.html#SEC131"></tocsect1>
+<tocsect1 name="Enhancements to BASH 2.05b" url="bashref.html#SEC133"></tocsect1>
+<tocsect1 name="Index of Shell Builtin Commands" url="bashref.html#SEC134"></tocsect1>
+<tocsect1 name="Index of Shell Reserved Words" url="bashref.html#SEC135"></tocsect1>
+<tocsect1 name="Parameter and Variable Index" url="bashref.html#SEC136"></tocsect1>
+<tocsect1 name="Function Index" url="bashref.html#SEC137"></tocsect1>
+<tocsect1 name="Concept Index" url="bashref.html#SEC138"></tocsect1>
+</kdeveloptoc>
+
diff --git a/languages/bash/doc/bash_bugs.toc b/languages/bash/doc/bash_bugs.toc
new file mode 100644
index 00000000..aa7b42e3
--- /dev/null
+++ b/languages/bash/doc/bash_bugs.toc
@@ -0,0 +1,7 @@
+<!DOCTYPE kdeveloptoc>
+<kdeveloptoc>
+<title>Bash bugs</title>
+<base href="http://groups.google.com/"/>
+<tocsect1 name="Query" url="groups?group=gnu.bash.bug">
+</tocsect1>
+</kdeveloptoc>
diff --git a/languages/bash/kdevbashsupport.desktop b/languages/bash/kdevbashsupport.desktop
new file mode 100644
index 00000000..f46b99eb
--- /dev/null
+++ b/languages/bash/kdevbashsupport.desktop
@@ -0,0 +1,85 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Bash Support
+Comment[ca]=Suport per a Bash
+Comment[da]=Bash understøttelse
+Comment[de]=Unterstützung für Bash
+Comment[el]=Υποστήριξη Bash
+Comment[es]=Soporte para Bash
+Comment[et]=Bash'i toetus
+Comment[eu]=Bash-en euskarria
+Comment[fa]=پشتیبانی Bash
+Comment[fr]=Prise en charge de BASH
+Comment[ga]=Tacaíocht Bash
+Comment[gl]=Soporte de Bash
+Comment[hi]=बैश समर्थन
+Comment[hu]=Bash-támogatás
+Comment[is]=Bash stuðnigur
+Comment[it]=Supporto per Bash
+Comment[ja]=Bash サポート
+Comment[nds]=Bash-Ünnerstütten
+Comment[ne]=ब्यास समर्थन
+Comment[nl]=Ondersteuning voor Bash
+Comment[pl]=Obsługa bash-a
+Comment[pt]=Suporte a Bash
+Comment[pt_BR]=Suporte ao Bash
+Comment[ru]=Поддержка языка Bash
+Comment[sk]=Podpora Bash
+Comment[sl]=Podpora bash
+Comment[sr]=Bash подршка
+Comment[sr@Latn]=Bash podrška
+Comment[sv]=Bash-stöd
+Comment[ta]=பாஷ் ஆதரவு
+Comment[tg]=Ёри намудани забони Bash
+Comment[tr]=Bash Desteği
+Comment[zh_CN]=Bash 支持
+Comment[zh_TW]=Bash 支援
+Name=KDevBashSupport
+Name[da]=KDevelop Bash-understøttelse
+Name[de]=Unterstützung für Bash (KDevelop)
+Name[hi]=के-डेव-बैश-समर्थन
+Name[nds]=Bash-Ünnerstütten för KDevelop
+Name[ne]=केडीई विकास ब्यास समर्थन
+Name[pl]=KDevObsługaBasha
+Name[sk]=KDevBashPodpora
+Name[sv]=KDevelop Bash-stöd
+Name[ta]=கெடெவ்பாஷ் ஆதரவு
+Name[zh_TW]=KDevelop Bash 支援
+GenericName=Bash Support
+GenericName[ca]=Suport per a Bash
+GenericName[da]=Bash-understøttelse
+GenericName[de]=Unterstützung für Bash
+GenericName[el]=Υποστήριξη Bash
+GenericName[es]=Soporte para Bash
+GenericName[et]=Bash'i toetus
+GenericName[eu]=Bash-en euskarria
+GenericName[fa]=پشتیبانی Bash
+GenericName[fr]=Prise en charge de BASH
+GenericName[ga]=Tacaíocht Bash
+GenericName[gl]=Soporte de Bash
+GenericName[hi]=बैश समर्थन
+GenericName[hu]=Bash-támogatás
+GenericName[it]=Supporto Bash
+GenericName[ja]=Bash サポート
+GenericName[nds]=Ünnerstütten för Bash
+GenericName[ne]=ब्यास समर्थन
+GenericName[nl]=Ondersteuning voor Bash
+GenericName[pl]=Obsługa bash-a
+GenericName[pt]=Suporte de Bash
+GenericName[pt_BR]=Suporte ao Bash
+GenericName[ru]=Поддержка языка Bash
+GenericName[sk]=Podpora Bash
+GenericName[sl]=Podpora bash
+GenericName[sr]=Bash подршка
+GenericName[sr@Latn]=Bash podrška
+GenericName[sv]=Bash-stöd
+GenericName[ta]=பாஷ் ஆதரவு
+GenericName[tg]=Ёри намудани забони Bash
+GenericName[tr]=Bash Desteği
+GenericName[zh_CN]=Bash 支持
+GenericName[zh_TW]=Bash 支援
+ServiceTypes=KDevelop/LanguageSupport
+X-KDE-Library=libkdevbashsupport
+X-KDevelop-Version=5
+X-KDevelop-Language=Bash
diff --git a/languages/bash/kdevbashsupport.rc b/languages/bash/kdevbashsupport.rc
new file mode 100644
index 00000000..d4592d6b
--- /dev/null
+++ b/languages/bash/kdevbashsupport.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevBashSupport" version="2">
+<MenuBar>
+ <Menu name="build" >
+ <Action name="build_execute" />
+ </Menu>
+</MenuBar>
+<ToolBar name="buildToolBar">
+ <Action name="build_execute" group="build_operations" />
+</ToolBar>
+</kpartgui>