diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-15 23:57:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-15 23:57:48 +0000 |
commit | 16d128e5e10d541a78654b86409d5a3539f07708 (patch) | |
tree | 66de0af63c3811bb3040c16e9b52c11985f70811 /Build/source/utils/asymptote/util.cc | |
parent | b20f78c549859ec0e8610bdd3ad904245e86b489 (diff) |
asymptote 1.83
git-svn-id: svn://tug.org/texlive/trunk@14696 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/util.cc')
-rw-r--r-- | Build/source/utils/asymptote/util.cc | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Build/source/utils/asymptote/util.cc b/Build/source/utils/asymptote/util.cc index 33fb56ad104..46f99ab669d 100644 --- a/Build/source/utils/asymptote/util.cc +++ b/Build/source/utils/asymptote/util.cc @@ -17,7 +17,6 @@ #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> -#include <signal.h> #include <cstring> #include <algorithm> @@ -35,6 +34,31 @@ namespace vm { void error(const char* message); } +#if __GNUC__ +#include <cxxabi.h> +string demangle(const char *s) +{ + int status; + char *demangled = abi::__cxa_demangle(s,NULL,NULL,&status); + if (status == 0 && demangled) { + string str(demangled); + free(demangled); + return str; + } else if (status == -2) { + free(demangled); + return s; + } else { + free(demangled); + return string("Unknown(") + s + ")"; + } +}; +#else +string demangle(const char* s) +{ + return s; +} +#endif + char *Strdup(string s) { size_t size=s.size()+1; @@ -162,6 +186,16 @@ string auxname(string filename, string suffix) return buildname(filename,suffix,"_"); } +sighandler_t Signal(int signum, sighandler_t handler) +{ + struct sigaction action,oldaction; + action.sa_handler=handler; + sigemptyset(&action.sa_mask); + action.sa_flags=0; + return sigaction(signum,&action,&oldaction) == 0 ? oldaction.sa_handler : + SIG_ERR; +} + void push_split(mem::vector<string>& a, const string& S) { const char *p=S.c_str(); |