1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_config_defines_hpp
10 #define anna_config_defines_hpp
12 //#include <sys/types.h>
14 // For cstd0x compatibility we will use stdint.h types instead of std:: ones on cstdint:
15 //#include <cstdint> when C++11 available
17 #include <anna/core/tracing/Logger.hpp>
20 #ifdef ANNA_FILE_LOCATION
21 #undef ANNA_FILE_LOCATION
23 #define ANNA_FILE_LOCATION (const char *)__FILE__,(const int)__LINE__
24 //#define ANNA_FILE_LOCATION __PRETTY_FUNCTION__,(const char *)__FILE__,(const int)__LINE__
27 #define ANNA_VERSION 0x000d03
29 #if defined(__linux__) && !defined (_NO_BUILTIN)
30 #define anna_memcpy(a,b,c) __builtin_memcpy((a),(b),(c))
31 #define anna_memset(a,b,c) __builtin_memset((a),(b),(c))
32 #define anna_memmove(a,b,c) __builtin_memmove((a),(b),(c))
33 #define anna_strcpy(a,b) __builtin_strcpy((a),(b))
34 #define anna_strncpy(a,b,c) __builtin_strncpy((a),(b),(c))
35 #define anna_strcmp(a,b) __builtin_strcmp((a),(b))
36 #define anna_strncmp(a,b,n) __builtin_strncmp((a),(b),(n))
37 #define anna_strcat(a,b) __builtin_strcat((a),(b))
38 #define anna_strlen(a) __builtin_strlen((a))
39 #define anna_strstr(a,b) __builtin_strstr((a),(b))
40 #define anna_strchr(a,b) __builtin_strchr((a),(b))
42 #define anna_memcpy(a,b,c) memcpy((a),(b),(c))
43 #define anna_memset(a,b,c) memset((a),(b),(c))
44 #define anna_memmove(a,b,c) memmove((a),(b),(c))
45 #define anna_strcpy(a,b) strcpy((a),(b))
46 #define anna_strncpy(a,b,c) strncpy((a),(b),(c))
47 #define anna_strcmp(a,b) strcmp((a),(b))
48 #define anna_strncmp(a,b,n) strncmp((a),(b),(n))
49 #define anna_strcat(a,b) strcat((a),(b))
50 #define anna_strlen(a) strlen((a))
51 #define anna_strstr(a,b) strstr((a),(b))
52 #define anna_strchr(a,b) strchr((a),(b))
55 #define anna_signal_shield(r,a) { int cx (0); do { if ((r = (a)) < 0) cx ++; } while (r < 0 && errno == EINTR && cx < 5); }
57 //#define anna_append_string(str,str1,str2) (str).append (str1).append (str2)
60 #define LOGWARNING(a) if (anna::Logger::isActive (anna::Logger::Warning) == true) {a;}
61 #define LOGNOTICE(a) if (anna::Logger::isActive (anna::Logger::Notice) == true) {a;}
62 #define LOGINFORMATION(a) if (anna::Logger::isActive (anna::Logger::Information) == true) {a;}
63 #define LOG_EXCL_INFORMATION(a) if (anna::Logger::isActive (anna::Logger::Debug) == false && anna::Logger::isActive (anna::Logger::Information) == true) {a;}
64 #define LOGDEBUG(a) if (anna::Logger::isActive (anna::Logger::Debug) == true) {a;}
65 #define LOGLOCAL0(a) if (anna::Logger::isActive (anna::Logger::Local0) == true) {a;}
66 #define LOGLOCAL1(a) if (anna::Logger::isActive (anna::Logger::Local1) == true) {a;}
67 #define LOGLOCAL2(a) if (anna::Logger::isActive (anna::Logger::Local2) == true) {a;}
68 #define LOGLOCAL3(a) if (anna::Logger::isActive (anna::Logger::Local3) == true) {a;}
69 #define LOGLOCAL4(a) if (anna::Logger::isActive (anna::Logger::Local4) == true) {a;}
70 #define LOGLOCAL5(a) if (anna::Logger::isActive (anna::Logger::Local5) == true) {a;}
71 #define LOGLOCAL6(a) if (anna::Logger::isActive (anna::Logger::Local6) == true) {a;}
72 #define LOGLOCAL7(a) if (anna::Logger::isActive (anna::Logger::Local7) == true) {a;}
73 #define LOGMETHOD(a) a;
74 #define LOGFUNCTION(a) a;
78 #define LOGINFORMATION(a)
89 #define LOGFUNCTION(a)
93 #define WHEN_MULTITHREAD(a) a
94 #define WHEN_SINGLETHREAD(a)
96 #define WHEN_MULTITHREAD(a)
97 #define WHEN_SINGLETHREAD(a) a
103 ///** Defines required data type to conversion from pointer to integer */
104 //typedef int ptrnumber;
107 ///** Defines required data type to conversion from pointer to integer */
108 //typedef long ptrnumber;
111 typedef intptr_t ptrnumber;
116 * Make conversion from pointer to integer, it will work both 64 bits and 32 bits architecture.
118 #define anna_ptrnumber_cast(pointer) (anna::ptrnumber)((void*)(pointer))