checkpoint for merge
[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
59 COMMON_EXPORT unsigned addrHashCommon(const Address &addr);
60 COMMON_EXPORT unsigned ptrHash(const void * addr);
61 COMMON_EXPORT unsigned ptrHash(void * addr);
62
63 COMMON_EXPORT unsigned addrHash(const Address &addr);
64 COMMON_EXPORT unsigned addrHash4(const Address &addr);
65 COMMON_EXPORT unsigned addrHash16(const Address &addr);
66
67 COMMON_EXPORT unsigned stringhash(const std::string &s);
68 COMMON_EXPORT std::string itos(int);
69 COMMON_EXPORT std::string utos(unsigned);
70
71 #define WILDCARD_CHAR '?'
72 #define MULTIPLE_WILDCARD_CHAR '*'
73
74 COMMON_EXPORT bool wildcardEquiv(const std::string &us, const std::string &them, bool checkCase = false );
75
76 }
77 #endif