summaryrefslogtreecommitdiffstats
path: root/kmtrace/demangle.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
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /kmtrace/demangle.cpp
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.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/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmtrace/demangle.cpp')
-rw-r--r--kmtrace/demangle.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/kmtrace/demangle.cpp b/kmtrace/demangle.cpp
new file mode 100644
index 00000000..81bcff90
--- /dev/null
+++ b/kmtrace/demangle.cpp
@@ -0,0 +1,60 @@
+#include <qintdict.h>
+#include <stdio.h>
+#include <qstringlist.h>
+#include <qstrlist.h>
+#include <qtextstream.h>
+#include <qsortedlist.h>
+#include <qfile.h>
+#include <qtl.h>
+#include <qvaluelist.h>
+#include <stdlib.h>
+#include <ktempfile.h>
+#include <kinstance.h>
+#include <kstandarddirs.h>
+#include <kcmdlineargs.h>
+
+extern "C" {
+/* Options passed to cplus_demangle (in 2nd parameter). */
+
+#define DMGL_NO_OPTS 0 /* For readability... */
+#define DMGL_PARAMS (1 << 0) /* Include function args */
+#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
+#define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */
+
+#define DMGL_AUTO (1 << 8)
+#define DMGL_GNU (1 << 9)
+#define DMGL_LUCID (1 << 10)
+#define DMGL_ARM (1 << 11)
+#define DMGL_HP (1 << 12) /* For the HP aCC compiler; same as ARM
+ except for template arguments, etc. */
+#define DMGL_EDG (1 << 13)
+#define DMGL_GNU_V3 (1 << 14)
+#define DMGL_GNAT (1 << 15)
+
+
+extern char *cplus_demangle(const char *mangled, int options);
+}
+
+
+int main(int argc, char **argv)
+{
+ char buf[1024];
+
+ while(!feof(stdin))
+ {
+ fgets(buf, 1024, stdin);
+ QCString line = buf;
+ line = line.stripWhiteSpace();
+ char *res = cplus_demangle(line.data(), DMGL_PARAMS | DMGL_AUTO | DMGL_ANSI );
+ if (res)
+ {
+ printf("%s\n", res);
+ free(res);
+ }
+ else
+ {
+ printf("%s\n", line.data());
+ }
+ }
+}
+