File: kccommon.h

package info (click to toggle)
kyotocabinet 1.2.76-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,492 kB
  • ctags: 3,561
  • sloc: cpp: 59,347; ansic: 1,478; makefile: 1,207; ruby: 523; sh: 190; awk: 91; perl: 61
file content (205 lines) | stat: -rw-r--r-- 4,621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*************************************************************************************************
 * Common symbols for the library
 *                                                               Copyright (C) 2009-2012 FAL Labs
 * This file is part of Kyoto Cabinet.
 * This program is free software: you can redistribute it and/or modify it under the terms of
 * the GNU General Public License as published by the Free Software Foundation, either version
 * 3 of the License, or any later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 *************************************************************************************************/


#ifndef _KCCOMMON_H                      // duplication check
#define _KCCOMMON_H

extern "C" {
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
}

#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <csignal>
#include <cstring>
#include <ctime>
#include <cwchar>

#include <stdexcept>
#include <exception>
#include <limits>
#include <new>
#include <typeinfo>

#include <utility>
#include <functional>
#include <memory>
#include <iterator>
#include <algorithm>
#include <locale>

#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <map>
#include <set>

#include <ios>
#include <iostream>
#include <streambuf>
#include <fstream>
#include <sstream>

#if defined(_MSC_VER)
#define snprintf  _snprintf
#endif

#if defined(__CYGWIN__)
inline long double modfl(long double val, long double* iptr) {
  double integ;
  double fract = std::modf(val, &integ);
  *iptr = integ;
  return fract;
}
#endif

namespace std {
using ::modfl;
using ::snprintf;
}

#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(_MSC_VER)

#include <unordered_map>
#include <unordered_set>

#else

#include <tr1/unordered_map>
#include <tr1/unordered_set>

namespace std {
using tr1::hash;
using tr1::unordered_map;
using tr1::unordered_set;
}

#endif

#undef VERSION
#undef LIBVER
#undef LIBREV
#undef OSNAME
#undef BIGEND
#undef CLOCKTICK
#undef PAGESIZ
#undef FEATURES
#undef NUMBUFSIZ
#undef MEMMAXSIZ

#undef IOBUFSIZ
#undef SUCCESS
#undef NOIMPL
#undef INVALID
#undef NOREPOS
#undef NOPERM
#undef BROKEN
#undef DUPREC
#undef NOREC
#undef LOGIC
#undef SYSTEM
#undef MISC

#undef DEBUG
#undef INFO
#undef WARN
#undef ERROR
#undef OPEN
#undef CLOSE
#undef CLEAR
#undef ITERATE
#undef SYNCHRONIZE
#undef OCCUPY
#undef BEGINTRAN
#undef COMMITTRAN
#undef ABORTTRAN

#undef INT8MAX
#undef INT16MAX
#undef INT32MAX
#undef INT64MAX
#undef INT8MIN
#undef INT16MIN
#undef INT32MIN
#undef INT64MIN
#undef UINT8MAX
#undef UINT16MAX
#undef UINT32MAX
#undef UINT64MAX
#undef SIZEMAX
#undef FLTMAX
#undef DBLMAX

#if defined(_KCUYIELD)
#if defined(_MSC_VER)
#include <windows.h>
#define _yield_()  ::Sleep(0)
#else
#include <sched.h>
#define _yield_()  ::sched_yield()
#endif
#define _testyield_()                           \
  do {                                          \
    static uint32_t _KC_seed = 725;             \
    _KC_seed = _KC_seed * 123456761 + 211;      \
    if (_KC_seed % 0x100 == 0) _yield_();       \
  } while(false)
#define _assert_(KC_a)                          \
  do {                                          \
    _testyield_();                              \
    assert(KC_a);                               \
  } while(false)
#elif defined(_KCDEBUG)
#define _yield_()
#define _testyield_()
#define _assert_(KC_a)  assert(KC_a)
#else
#define _yield_()                        ///< for debugging
#define _testyield_()                    ///< for debugging
#define _assert_(KC_a)                   ///< for debugging
#endif

#if defined(__GNUC__)
#define __KCFUNC__  __func__             ///< for debugging
#elif defined(_MSC_VER)
#define __KCFUNC__  __FUNCTION__         ///< for debugging
#else
#define __KCFUNC__  "-"                  ///< for debugging
#endif
#define _KCCODELINE_  __FILE__, __LINE__, __KCFUNC__  ///< for debugging

/**
 * All symbols of Kyoto Cabinet.
 */
namespace kyotocabinet {}


#endif                                   // duplication check

// END OF FILE