r3897 - trunk/birnet
- From: timj svn gnome org
- To: svn-commits-list gnome org
- Subject: r3897 - trunk/birnet
- Date: Wed, 20 Sep 2006 18:17:21 -0400 (EDT)
Author: timj
Date: 2006-09-20 18:17:19 -0400 (Wed, 20 Sep 2006)
New Revision: 3897
Modified:
trunk/birnet/ChangeLog
trunk/birnet/birnetutils.h
trunk/birnet/birnetutilsxx.cc
trunk/birnet/birnetutilsxx.hh
Log:
Thu Sep 21 00:16:05 2006 Tim Janik <timj gtk org>
* birnetutils.h, birnetutilsxx.cc: added birnet_cxx_demangle() and
cxx_demangle() to easily demangle C++ names.
Modified: trunk/birnet/ChangeLog
===================================================================
--- trunk/birnet/ChangeLog 2006-09-19 20:33:00 UTC (rev 3896)
+++ trunk/birnet/ChangeLog 2006-09-20 22:17:19 UTC (rev 3897)
@@ -1,3 +1,8 @@
+Thu Sep 21 00:16:05 2006 Tim Janik <timj gtk org>
+
+ * birnetutils.h, birnetutilsxx.cc: added birnet_cxx_demangle() and
+ cxx_demangle() to easily demangle C++ names.
+
Sat Sep 16 15:14:32 2006 Tim Janik <timj gtk org>
* birnetutils.c (birnet_malloc_aligned): fixed alginment adjustment so
Modified: trunk/birnet/birnetutils.h
===================================================================
--- trunk/birnet/birnetutils.h 2006-09-19 20:33:00 UTC (rev 3896)
+++ trunk/birnet/birnetutils.h 2006-09-20 22:17:19 UTC (rev 3897)
@@ -52,6 +52,9 @@
bool birnet_file_equals (const gchar *file1,
const gchar *file2);
+/* --- C++ demangling --- */
+gchar* birnet_cxx_demangle (const char *mangled_identifier); /* in birnetutilsxx.cc */
+
/* --- zintern support --- */
guint8* birnet_zintern_decompress (unsigned int decompressed_size,
const unsigned char *cdata,
Modified: trunk/birnet/birnetutilsxx.cc
===================================================================
--- trunk/birnet/birnetutilsxx.cc 2006-09-19 20:33:00 UTC (rev 3896)
+++ trunk/birnet/birnetutilsxx.cc 2006-09-20 22:17:19 UTC (rev 3897)
@@ -24,9 +24,22 @@
#include <sys/time.h>
#include <vector>
#include <algorithm>
+#include <cxxabi.h>
extern "C" {
+/* --- demangling --- */
+gchar*
+birnet_cxx_demangle (const char *mangled_identifier) /* from birnetutils.h */
+{
+ int status = 0;
+ char *malloced_result = abi::__cxa_demangle (mangled_identifier, NULL, NULL, &status);
+ gchar *result = g_strdup (malloced_result && !status ? malloced_result : mangled_identifier);
+ if (malloced_result)
+ free (malloced_result);
+ return result;
+}
+
/* --- initialization for C --- */
static void (*birnet_init_cplusplus_func) (void) = NULL;
static BirnetInitSettings default_init_settings = {
@@ -98,6 +111,17 @@
namespace Birnet {
+/* --- demangling --- */
+String
+cxx_demangle (const char *mangled_identifier)
+{
+ int status = 0;
+ char *malloced_result = abi::__cxa_demangle (mangled_identifier, NULL, NULL, &status);
+ String result = malloced_result && !status ? malloced_result : mangled_identifier;
+ if (malloced_result)
+ free (malloced_result);
+ return result;
+}
/* --- InitHooks --- */
static InitHook *init_hooks = NULL;
Modified: trunk/birnet/birnetutilsxx.hh
===================================================================
--- trunk/birnet/birnetutilsxx.hh 2006-09-19 20:33:00 UTC (rev 3896)
+++ trunk/birnet/birnetutilsxx.hh 2006-09-20 22:17:19 UTC (rev 3897)
@@ -56,6 +56,7 @@
typedef std::string String;
using std::vector;
using std::map;
+String cxx_demangle (const char *mangled_identifier);
/* --- private copy constructor and assignment operator --- */
#define BIRNET_PRIVATE_CLASS_COPY(Class) private: Class (const Class&); Class& operator= (const Class&);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]