From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- languages/ada/ada_utils.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 languages/ada/ada_utils.cpp (limited to 'languages/ada/ada_utils.cpp') 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 +#include +#include + +#include +#include +#include +#include + +#include + +#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; +} + -- cgit v1.2.1