Further reduce header dependencies
[novacoin.git] / src / util.h
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2012 The Bitcoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_UTIL_H
6 #define BITCOIN_UTIL_H
7
8 #include "uint256.h"
9
10 #ifndef WIN32
11 #include <sys/types.h>
12 #include <sys/time.h>
13 #include <sys/resource.h>
14 #else
15 typedef int pid_t; /* define for windows compatiblity */
16 #endif
17 #include <map>
18 #include <vector>
19 #include <string>
20
21 #include <boost/thread.hpp>
22 #include <boost/filesystem.hpp>
23 #include <boost/filesystem/path.hpp>
24 #include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
25 #include <boost/interprocess/sync/scoped_lock.hpp>
26 #include <boost/interprocess/sync/interprocess_condition.hpp>
27 #include <boost/interprocess/sync/lock_options.hpp>
28 #include <boost/date_time/gregorian/gregorian_types.hpp>
29 #include <boost/date_time/posix_time/posix_time_types.hpp>
30
31 #include <openssl/sha.h>
32 #include <openssl/ripemd.h>
33
34 #include "netbase.h" // for AddTimeData
35
36 typedef long long  int64;
37 typedef unsigned long long  uint64;
38
39 static const int64 COIN = 100000000;
40 static const int64 CENT = 1000000;
41
42 #define loop                for (;;)
43 #define BEGIN(a)            ((char*)&(a))
44 #define END(a)              ((char*)&((&(a))[1]))
45 #define UBEGIN(a)           ((unsigned char*)&(a))
46 #define UEND(a)             ((unsigned char*)&((&(a))[1]))
47 #define ARRAYLEN(array)     (sizeof(array)/sizeof((array)[0]))
48 #define printf              OutputDebugStringF
49
50 #ifdef snprintf
51 #undef snprintf
52 #endif
53 #define snprintf my_snprintf
54
55 #ifndef PRI64d
56 #if defined(_MSC_VER) || defined(__MSVCRT__)
57 #define PRI64d  "I64d"
58 #define PRI64u  "I64u"
59 #define PRI64x  "I64x"
60 #else
61 #define PRI64d  "lld"
62 #define PRI64u  "llu"
63 #define PRI64x  "llx"
64 #endif
65 #endif
66
67 // This is needed because the foreach macro can't get over the comma in pair<t1, t2>
68 #define PAIRTYPE(t1, t2)    std::pair<t1, t2>
69
70 // Align by increasing pointer, must have extra space at end of buffer
71 template <size_t nBytes, typename T>
72 T* alignup(T* p)
73 {
74     union
75     {
76         T* ptr;
77         size_t n;
78     } u;
79     u.ptr = p;
80     u.n = (u.n + (nBytes-1)) & ~(nBytes-1);
81     return u.ptr;
82 }
83
84 #ifdef WIN32
85 #define MSG_NOSIGNAL        0
86 #define MSG_DONTWAIT        0
87
88 #ifndef S_IRUSR
89 #define S_IRUSR             0400
90 #define S_IWUSR             0200
91 #endif
92 #define unlink              _unlink
93 #else
94 #define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)
95 #define strlwr(psz)         to_lower(psz)
96 #define _strlwr(psz)        to_lower(psz)
97 #define MAX_PATH            1024
98 inline void Sleep(int64 n)
99 {
100     /*Boost has a year 2038 problem— if the request sleep time is past epoch+2^31 seconds the sleep returns instantly.
101       So we clamp our sleeps here to 10 years and hope that boost is fixed by 2028.*/
102     boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n>315576000000LL?315576000000LL:n));
103 }
104 #endif
105
106
107
108
109
110
111
112
113
114 extern std::map<std::string, std::string> mapArgs;
115 extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
116 extern bool fDebug;
117 extern bool fPrintToConsole;
118 extern bool fPrintToDebugger;
119 extern bool fRequestShutdown;
120 extern bool fShutdown;
121 extern bool fDaemon;
122 extern bool fServer;
123 extern bool fCommandLine;
124 extern std::string strMiscWarning;
125 extern bool fTestNet;
126 extern bool fNoListen;
127 extern bool fLogTimestamps;
128
129 void RandAddSeed();
130 void RandAddSeedPerfmon();
131 int OutputDebugStringF(const char* pszFormat, ...);
132 int my_snprintf(char* buffer, size_t limit, const char* format, ...);
133
134 /* It is not allowed to use va_start with a pass-by-reference argument.
135    (C++ standard, 18.7, paragraph 3). Use a dummy argument to work around this, and use a
136    macro to keep similar semantics.
137 */
138 std::string real_strprintf(const std::string &format, int dummy, ...);
139 #define strprintf(format, ...) real_strprintf(format, 0, __VA_ARGS__)
140
141 bool error(const char *format, ...);
142 void LogException(std::exception* pex, const char* pszThread);
143 void PrintException(std::exception* pex, const char* pszThread);
144 void PrintExceptionContinue(std::exception* pex, const char* pszThread);
145 void ParseString(const std::string& str, char c, std::vector<std::string>& v);
146 std::string FormatMoney(int64 n, bool fPlus=false);
147 bool ParseMoney(const std::string& str, int64& nRet);
148 bool ParseMoney(const char* pszIn, int64& nRet);
149 std::vector<unsigned char> ParseHex(const char* psz);
150 std::vector<unsigned char> ParseHex(const std::string& str);
151 bool IsHex(const std::string& str);
152 std::vector<unsigned char> DecodeBase64(const char* p, bool* pfInvalid = NULL);
153 std::string DecodeBase64(const std::string& str);
154 std::string EncodeBase64(const unsigned char* pch, size_t len);
155 std::string EncodeBase64(const std::string& str);
156 void ParseParameters(int argc, const char*const argv[]);
157 bool WildcardMatch(const char* psz, const char* mask);
158 bool WildcardMatch(const std::string& str, const std::string& mask);
159 int GetFilesize(FILE* file);
160 boost::filesystem::path GetDefaultDataDir();
161 const boost::filesystem::path &GetDataDir(bool fNetSpecific = true);
162 boost::filesystem::path GetConfigFile();
163 boost::filesystem::path GetPidFile();
164 void CreatePidFile(const boost::filesystem::path &path, pid_t pid);
165 bool ReadConfigFile(std::map<std::string, std::string>& mapSettingsRet, std::map<std::string, std::vector<std::string> >& mapMultiSettingsRet);
166 bool GetStartOnSystemStartup();
167 bool SetStartOnSystemStartup(bool fAutoStart);
168 void ShrinkDebugFile();
169 int GetRandInt(int nMax);
170 uint64 GetRand(uint64 nMax);
171 int64 GetTime();
172 void SetMockTime(int64 nMockTimeIn);
173 int64 GetAdjustedTime();
174 std::string FormatFullVersion();
175 std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);
176 void AddTimeData(const CNetAddr& ip, int64 nTime);
177
178
179
180
181
182
183
184
185
186
187
188 /** Wrapped boost mutex: supports recursive locking, but no waiting  */
189 typedef boost::interprocess::interprocess_recursive_mutex CCriticalSection;
190
191 /** Wrapped boost mutex: supports waiting but not recursive locking */
192 typedef boost::interprocess::interprocess_mutex CWaitableCriticalSection;
193
194 #ifdef DEBUG_LOCKORDER
195 void EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false);
196 void LeaveCritical();
197 #else
198 void static inline EnterCritical(const char* pszName, const char* pszFile, int nLine, void* cs, bool fTry = false) {}
199 void static inline LeaveCritical() {}
200 #endif
201
202 /** Wrapper around boost::interprocess::scoped_lock */
203 template<typename Mutex>
204 class CMutexLock
205 {
206 private:
207     boost::interprocess::scoped_lock<Mutex> lock;
208 public:
209
210     void Enter(const char* pszName, const char* pszFile, int nLine)
211     {
212         if (!lock.owns())
213         {
214             EnterCritical(pszName, pszFile, nLine, (void*)(lock.mutex()));
215 #ifdef DEBUG_LOCKCONTENTION
216             if (!lock.try_lock())
217             {
218                 printf("LOCKCONTENTION: %s\n", pszName);
219                 printf("Locker: %s:%d\n", pszFile, nLine);
220             }
221 #endif
222             lock.lock();
223         }
224     }
225
226     void Leave()
227     {
228         if (lock.owns())
229         {
230             lock.unlock();
231             LeaveCritical();
232         }
233     }
234
235     bool TryEnter(const char* pszName, const char* pszFile, int nLine)
236     {
237         if (!lock.owns())
238         {
239             EnterCritical(pszName, pszFile, nLine, (void*)(lock.mutex()), true);
240             lock.try_lock();
241             if (!lock.owns())
242                 LeaveCritical();
243         }
244         return lock.owns();
245     }
246
247     CMutexLock(Mutex& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) : lock(mutexIn, boost::interprocess::defer_lock)
248     {
249         if (fTry)
250             TryEnter(pszName, pszFile, nLine);
251         else
252             Enter(pszName, pszFile, nLine);
253     }
254
255     ~CMutexLock()
256     {
257         if (lock.owns())
258             LeaveCritical();
259     }
260
261     operator bool()
262     {
263         return lock.owns();
264     }
265
266     boost::interprocess::scoped_lock<Mutex> &GetLock()
267     {
268         return lock;
269     }
270 };
271
272 typedef CMutexLock<CCriticalSection> CCriticalBlock;
273 typedef CMutexLock<CWaitableCriticalSection> CWaitableCriticalBlock;
274 typedef boost::interprocess::interprocess_condition CConditionVariable;
275
276 /** Wait for a given condition inside a WAITABLE_CRITICAL_BLOCK */
277 #define WAIT(name,condition) \
278    do { while(!(condition)) { (name).wait(waitablecriticalblock.GetLock()); } } while(0)
279
280 /** Notify waiting threads that a condition may hold now */
281 #define NOTIFY(name) \
282    do { (name).notify_one(); } while(0)
283
284 #define NOTIFY_ALL(name) \
285    do { (name).notify_all(); } while(0)
286
287 #define LOCK(cs) CCriticalBlock criticalblock(cs, #cs, __FILE__, __LINE__)
288 #define LOCK2(cs1,cs2) CCriticalBlock criticalblock1(cs1, #cs1, __FILE__, __LINE__),criticalblock2(cs2, #cs2, __FILE__, __LINE__)
289 #define TRY_LOCK(cs,name) CCriticalBlock name(cs, #cs, __FILE__, __LINE__, true)
290 #define WAITABLE_LOCK(cs) CWaitableCriticalBlock waitablecriticalblock(cs, #cs, __FILE__, __LINE__)
291
292 #define ENTER_CRITICAL_SECTION(cs) \
293     { \
294         EnterCritical(#cs, __FILE__, __LINE__, (void*)(&cs)); \
295         (cs).lock(); \
296     }
297
298 #define LEAVE_CRITICAL_SECTION(cs) \
299     { \
300         (cs).unlock(); \
301         LeaveCritical(); \
302     }
303
304
305 // This is exactly like std::string, but with a custom allocator.
306 // (secure_allocator<> is defined in serialize.h)
307 typedef std::basic_string<char, std::char_traits<char>, secure_allocator<char> > SecureString;
308
309
310
311
312
313 inline std::string i64tostr(int64 n)
314 {
315     return strprintf("%"PRI64d, n);
316 }
317
318 inline std::string itostr(int n)
319 {
320     return strprintf("%d", n);
321 }
322
323 inline int64 atoi64(const char* psz)
324 {
325 #ifdef _MSC_VER
326     return _atoi64(psz);
327 #else
328     return strtoll(psz, NULL, 10);
329 #endif
330 }
331
332 inline int64 atoi64(const std::string& str)
333 {
334 #ifdef _MSC_VER
335     return _atoi64(str.c_str());
336 #else
337     return strtoll(str.c_str(), NULL, 10);
338 #endif
339 }
340
341 inline int atoi(const std::string& str)
342 {
343     return atoi(str.c_str());
344 }
345
346 inline int roundint(double d)
347 {
348     return (int)(d > 0 ? d + 0.5 : d - 0.5);
349 }
350
351 inline int64 roundint64(double d)
352 {
353     return (int64)(d > 0 ? d + 0.5 : d - 0.5);
354 }
355
356 inline int64 abs64(int64 n)
357 {
358     return (n >= 0 ? n : -n);
359 }
360
361 template<typename T>
362 std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
363 {
364     if (itbegin == itend)
365         return "";
366     const unsigned char* pbegin = (const unsigned char*)&itbegin[0];
367     const unsigned char* pend = pbegin + (itend - itbegin) * sizeof(itbegin[0]);
368     std::string str;
369     str.reserve((pend-pbegin) * (fSpaces ? 3 : 2));
370     for (const unsigned char* p = pbegin; p != pend; p++)
371         str += strprintf((fSpaces && p != pend-1 ? "%02x " : "%02x"), *p);
372     return str;
373 }
374
375 inline std::string HexStr(const std::vector<unsigned char>& vch, bool fSpaces=false)
376 {
377     return HexStr(vch.begin(), vch.end(), fSpaces);
378 }
379
380 template<typename T>
381 void PrintHex(const T pbegin, const T pend, const char* pszFormat="%s", bool fSpaces=true)
382 {
383     printf(pszFormat, HexStr(pbegin, pend, fSpaces).c_str());
384 }
385
386 inline void PrintHex(const std::vector<unsigned char>& vch, const char* pszFormat="%s", bool fSpaces=true)
387 {
388     printf(pszFormat, HexStr(vch, fSpaces).c_str());
389 }
390
391 inline int64 GetPerformanceCounter()
392 {
393     int64 nCounter = 0;
394 #ifdef WIN32
395     QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
396 #else
397     timeval t;
398     gettimeofday(&t, NULL);
399     nCounter = t.tv_sec * 1000000 + t.tv_usec;
400 #endif
401     return nCounter;
402 }
403
404 inline int64 GetTimeMillis()
405 {
406     return (boost::posix_time::ptime(boost::posix_time::microsec_clock::universal_time()) -
407             boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_milliseconds();
408 }
409
410 inline std::string DateTimeStrFormat(const char* pszFormat, int64 nTime)
411 {
412     time_t n = nTime;
413     struct tm* ptmTime = gmtime(&n);
414     char pszTime[200];
415     strftime(pszTime, sizeof(pszTime), pszFormat, ptmTime);
416     return pszTime;
417 }
418
419 template<typename T>
420 void skipspaces(T& it)
421 {
422     while (isspace(*it))
423         ++it;
424 }
425
426 inline bool IsSwitchChar(char c)
427 {
428 #ifdef WIN32
429     return c == '-' || c == '/';
430 #else
431     return c == '-';
432 #endif
433 }
434
435 /**
436  * Return string argument or default value
437  *
438  * @param strArg Argument to get (e.g. "-foo")
439  * @param default (e.g. "1")
440  * @return command-line argument or default value
441  */
442 std::string GetArg(const std::string& strArg, const std::string& strDefault);
443
444 /**
445  * Return integer argument or default value
446  *
447  * @param strArg Argument to get (e.g. "-foo")
448  * @param default (e.g. 1)
449  * @return command-line argument (0 if invalid number) or default value
450  */
451 int64 GetArg(const std::string& strArg, int64 nDefault);
452
453 /**
454  * Return boolean argument or default value
455  *
456  * @param strArg Argument to get (e.g. "-foo")
457  * @param default (true or false)
458  * @return command-line argument or default value
459  */
460 bool GetBoolArg(const std::string& strArg, bool fDefault=false);
461
462 /**
463  * Set an argument if it doesn't already have a value
464  *
465  * @param strArg Argument to set (e.g. "-foo")
466  * @param strValue Value (e.g. "1")
467  * @return true if argument gets set, false if it already had a value
468  */
469 bool SoftSetArg(const std::string& strArg, const std::string& strValue);
470
471 /**
472  * Set a boolean argument if it doesn't already have a value
473  *
474  * @param strArg Argument to set (e.g. "-foo")
475  * @param fValue Value (e.g. false)
476  * @return true if argument gets set, false if it already had a value
477  */
478 bool SoftSetBoolArg(const std::string& strArg, bool fValue);
479
480
481
482
483
484
485
486
487
488 // Randomize the stack to help protect against buffer overrun exploits
489 #define IMPLEMENT_RANDOMIZE_STACK(ThreadFn)     \
490     {                                           \
491         static char nLoops;                     \
492         if (nLoops <= 0)                        \
493             nLoops = GetRand(20) + 1;           \
494         if (nLoops-- > 1)                       \
495         {                                       \
496             ThreadFn;                           \
497             return;                             \
498         }                                       \
499     }
500
501
502 template<typename T1>
503 inline uint256 Hash(const T1 pbegin, const T1 pend)
504 {
505     static unsigned char pblank[1];
506     uint256 hash1;
507     SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1);
508     uint256 hash2;
509     SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
510     return hash2;
511 }
512
513 template<typename T1, typename T2>
514 inline uint256 Hash(const T1 p1begin, const T1 p1end,
515                     const T2 p2begin, const T2 p2end)
516 {
517     static unsigned char pblank[1];
518     uint256 hash1;
519     SHA256_CTX ctx;
520     SHA256_Init(&ctx);
521     SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
522     SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
523     SHA256_Final((unsigned char*)&hash1, &ctx);
524     uint256 hash2;
525     SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
526     return hash2;
527 }
528
529 template<typename T1, typename T2, typename T3>
530 inline uint256 Hash(const T1 p1begin, const T1 p1end,
531                     const T2 p2begin, const T2 p2end,
532                     const T3 p3begin, const T3 p3end)
533 {
534     static unsigned char pblank[1];
535     uint256 hash1;
536     SHA256_CTX ctx;
537     SHA256_Init(&ctx);
538     SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
539     SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
540     SHA256_Update(&ctx, (p3begin == p3end ? pblank : (unsigned char*)&p3begin[0]), (p3end - p3begin) * sizeof(p3begin[0]));
541     SHA256_Final((unsigned char*)&hash1, &ctx);
542     uint256 hash2;
543     SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
544     return hash2;
545 }
546
547 template<typename T>
548 uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
549 {
550     // Most of the time is spent allocating and deallocating CDataStream's
551     // buffer.  If this ever needs to be optimized further, make a CStaticStream
552     // class with its buffer on the stack.
553     CDataStream ss(nType, nVersion);
554     ss.reserve(10000);
555     ss << obj;
556     return Hash(ss.begin(), ss.end());
557 }
558
559 inline uint160 Hash160(const std::vector<unsigned char>& vch)
560 {
561     uint256 hash1;
562     SHA256(&vch[0], vch.size(), (unsigned char*)&hash1);
563     uint160 hash2;
564     RIPEMD160((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
565     return hash2;
566 }
567
568
569 /** Median filter over a stream of values. 
570  * Returns the median of the last N numbers
571  */
572 template <typename T> class CMedianFilter
573 {
574 private:
575     std::vector<T> vValues;
576     std::vector<T> vSorted;
577     int nSize;
578 public:
579     CMedianFilter(int size, T initial_value):
580         nSize(size)
581     {
582         vValues.reserve(size);
583         vValues.push_back(initial_value);
584         vSorted = vValues;
585     }
586     
587     void input(T value)
588     {
589         if(vValues.size() == nSize)
590         {
591             vValues.erase(vValues.begin());
592         }
593         vValues.push_back(value);
594
595         vSorted.resize(vValues.size());
596         std::copy(vValues.begin(), vValues.end(), vSorted.begin());
597         std::sort(vSorted.begin(), vSorted.end());
598     }
599
600     T median() const
601     {
602         int size = vSorted.size();
603         assert(size>0);
604         if(size & 1) // Odd number of elements
605         {
606             return vSorted[size/2];
607         }
608         else // Even number of elements
609         {
610             return (vSorted[size/2-1] + vSorted[size/2]) / 2;
611         }
612     }
613
614     int size() const
615     {
616         return vValues.size();
617     }
618
619     std::vector<T> sorted () const
620     {
621         return vSorted;
622     }
623 };
624
625
626
627
628
629
630
631
632
633
634 // Note: It turns out we might have been able to use boost::thread
635 // by using TerminateThread(boost::thread.native_handle(), 0);
636 #ifdef WIN32
637 typedef HANDLE pthread_t;
638
639 inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false)
640 {
641     DWORD nUnused = 0;
642     HANDLE hthread =
643         CreateThread(
644             NULL,                        // default security
645             0,                           // inherit stack size from parent
646             (LPTHREAD_START_ROUTINE)pfn, // function pointer
647             parg,                        // argument
648             0,                           // creation option, start immediately
649             &nUnused);                   // thread identifier
650     if (hthread == NULL)
651     {
652         printf("Error: CreateThread() returned %d\n", GetLastError());
653         return (pthread_t)0;
654     }
655     if (!fWantHandle)
656     {
657         CloseHandle(hthread);
658         return (pthread_t)-1;
659     }
660     return hthread;
661 }
662
663 inline void SetThreadPriority(int nPriority)
664 {
665     SetThreadPriority(GetCurrentThread(), nPriority);
666 }
667 #else
668 inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false)
669 {
670     pthread_t hthread = 0;
671     int ret = pthread_create(&hthread, NULL, (void*(*)(void*))pfn, parg);
672     if (ret != 0)
673     {
674         printf("Error: pthread_create() returned %d\n", ret);
675         return (pthread_t)0;
676     }
677     if (!fWantHandle)
678     {
679         pthread_detach(hthread);
680         return (pthread_t)-1;
681     }
682     return hthread;
683 }
684
685 #define THREAD_PRIORITY_LOWEST          PRIO_MAX
686 #define THREAD_PRIORITY_BELOW_NORMAL    2
687 #define THREAD_PRIORITY_NORMAL          0
688 #define THREAD_PRIORITY_ABOVE_NORMAL    0
689
690 inline void SetThreadPriority(int nPriority)
691 {
692     // It's unclear if it's even possible to change thread priorities on Linux,
693     // but we really and truly need it for the generation threads.
694 #ifdef PRIO_THREAD
695     setpriority(PRIO_THREAD, 0, nPriority);
696 #else
697     setpriority(PRIO_PROCESS, 0, nPriority);
698 #endif
699 }
700
701 inline void ExitThread(size_t nExitCode)
702 {
703     pthread_exit((void*)nExitCode);
704 }
705 #endif
706
707
708
709
710
711 inline uint32_t ByteReverse(uint32_t value)
712 {
713     value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8);
714     return (value<<16) | (value>>16);
715 }
716
717 #endif
718