windows build fixes and some more work on symtab serialization
[dyninst.git] / dynutil / h / util.h
1
2
3 #ifndef __UTIL_H__
4 #define __UTIL_H__
5
6 #include "dyntypes.h"
7 namespace Dyninst {
8
9 #if !defined(SYMTAB_EXPORT)
10   #if defined(_MSC_VER)
11     #if defined SYMTAB_LIB
12       #define SYMTAB_EXPORT __declspec(dllexport)
13     #else
14       #define SYMTAB_EXPORT __declspec(dllimport)
15     #endif
16   #else
17     #define SYMTAB_EXPORT
18   #endif
19 #endif
20
21 #if !defined(COMMON_EXPORT)
22   #if defined (_MSC_VER)
23     #if defined(COMMON_LIB)
24        #define COMMON_EXPORT __declspec(dllexport)
25     #else
26        #define COMMON_EXPORT __declspec(dllimport)   
27     #endif
28   #else
29     #define COMMON_EXPORT
30   #endif
31 #endif
32
33 #if !defined(COMMON_TEMPLATE_EXPORT)
34   #if defined (_MSC_VER)
35     #if defined(COMMON_LIB) || defined(INSTRUCTION_LIB) || \
36                 defined(SYMTAB_LIB)     || defined(BPATCH_LIBRARY)
37        #define COMMON_TEMPLATE_EXPORT __declspec(dllexport)
38     #else
39        #define COMMON_TEMPLATE_EXPORT __declspec(dllimport)   
40     #endif
41   #else
42     #define COMMON_TEMPLATE_EXPORT
43   #endif
44 #endif
45
46 #if !defined(INSTRUCTION_EXPORT)
47   #if defined(_MSC_VER)
48     #if defined(INSTRUCTION_LIB)
49       #define INSTRUCTION_EXPORT __declspec(dllexport)
50     #else
51       #define INSTRUCTION_EXPORT __declspec(dllimport)
52     #endif
53   #else
54     #define INSTRUCTION_EXPORT
55 #endif
56 #endif
57
58 #if defined(_MSC_VER)
59 #define THROW_SPEC(x)
60 #define THROW
61 #else
62 #define THROW_SPEC(x) throw (x)
63 #define THROW throw ()
64 #endif
65
66 COMMON_EXPORT unsigned addrHashCommon(const Address &addr);
67 COMMON_EXPORT unsigned ptrHash(const void * addr);
68 COMMON_EXPORT unsigned ptrHash(void * addr);
69
70 COMMON_EXPORT unsigned addrHash(const Address &addr);
71 COMMON_EXPORT unsigned addrHash4(const Address &addr);
72 COMMON_EXPORT unsigned addrHash16(const Address &addr);
73
74 COMMON_EXPORT unsigned stringhash(const std::string &s);
75 COMMON_EXPORT std::string itos(int);
76 COMMON_EXPORT std::string utos(unsigned);
77
78 #define WILDCARD_CHAR '?'
79 #define MULTIPLE_WILDCARD_CHAR '*'
80
81 COMMON_EXPORT bool wildcardEquiv(const std::string &us, const std::string &them, bool checkCase = false );
82
83 }
84 #endif