summaryrefslogtreecommitdiffstats
path: root/languages/ada/ada_utils.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/ada/ada_utils.cpp
downloadtdevelop-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/ada/ada_utils.cpp')
-rw-r--r--languages/ada/ada_utils.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/languages/ada/ada_utils.cpp b/languages/ada/ada_utils.cpp
new file mode 100644
index 00000000..9630f058
--- /dev/null
+++ b/languages/ada/ada_utils.cpp
@@ -0,0 +1,69 @@
+/*
+ */
+#include <stdlib.h>
+#include <unistd.h>
+#include <iostream>
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qfile.h>
+#include <qregexp.h>
+
+#include <kdebug.h>
+
+#include "ada_utils.hpp"
+#include "adasupport.hpp"
+
+QString qtext (const RefAdaAST& n)
+{
+ return QString::fromLatin1 (text (n).c_str ());
+}
+
+QStringList qnamelist (const RefAdaAST& n)
+{
+ QString txt = qtext (n);
+ // kdDebug() << "qnamelist: input is " << txt << endl;
+ return QStringList::split ('.', txt);
+}
+
+QString ada_spec_filename (const QString& comp_unit_name)
+{
+ QString fn (comp_unit_name.lower ());
+
+ fn.replace (QRegExp("."), "-");
+ fn += ".ads";
+ return fn;
+}
+
+QString fq_specfilename (const QString& comp_unit_name)
+{
+ QString fname = ada_spec_filename (comp_unit_name);
+
+ if (QFile::exists (fname))
+ return fname;
+
+ QString adaincpath = getenv ("ADA_INCLUDE_PATH");
+ if (adaincpath.isNull ())
+ return QString::null;
+
+ QStringList dirs = QStringList::split (':', adaincpath);
+ QString fq_filename;
+ for (QStringList::Iterator it = dirs.begin (); it != dirs.end (); it++) {
+ fq_filename = *it;
+ if (! fq_filename.endsWith ("/"))
+ fq_filename += "/";
+ fq_filename += fname;
+ if (QFile::exists (fq_filename))
+ return fq_filename;
+ }
+ if (fname.startsWith ("ada-") ||
+ fname.startsWith ("text_io") ||
+ fname.startsWith ("system") ||
+ fname.startsWith ("unchecked_")) {
+ kdDebug () << "resolution of Ada predefined library is TBD" << endl;
+ } else {
+ kdDebug () << "Cannot find file " << fname << endl;
+ }
+ return QString::null;
+}
+