1 /* EINA - EFL data type library
2 * Copyright (C) 2008 Carsten Haitzler, Vincent Torri, Jorge Luis Zapata Muga
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
19 #ifndef EINA_PRIVATE_H_
20 #define EINA_PRIVATE_H_
24 #include "eina_magic.h"
25 #include "eina_iterator.h"
26 #include "eina_accessor.h"
29 # define MIN(x, y) (((x) > (y)) ? (y) : (x))
33 # define MAX(x, y) (((x) > (y)) ? (x) : (y))
37 # define ABS(x) ((x) < 0 ? -(x) : (x))
41 # define CLAMP(x, min, \
42 max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
45 #define EINA_INLIST_JUMP_SIZE 256
47 #define READBUFSIZ 65536
49 #define EINA_LOG_COLOR_DEFAULT "\033[36m"
51 /* eina magic types */
52 #define EINA_MAGIC_SHARE 0x98761234
53 #define EINA_MAGIC_SHARE_HEAD 0x98761235
54 #define EINA_MAGIC_STRINGSHARE_NODE 0x98761254
55 #define EINA_MAGIC_USTRINGSHARE_NODE 0x98761255
56 #define EINA_MAGIC_BINSHARE_NODE 0x98761256
58 #define EINA_MAGIC_LIST 0x98761237
59 #define EINA_MAGIC_LIST_ITERATOR 0x98761238
60 #define EINA_MAGIC_LIST_ACCESSOR 0x98761239
61 #define EINA_MAGIC_LIST_ACCOUNTING 0x9876123a
63 #define EINA_MAGIC_ARRAY 0x9876123b
64 #define EINA_MAGIC_ARRAY_ITERATOR 0x9876123c
65 #define EINA_MAGIC_ARRAY_ACCESSOR 0x9876123d
67 #define EINA_MAGIC_HASH 0x9876123e
68 #define EINA_MAGIC_HASH_ITERATOR 0x9876123f
70 #define EINA_MAGIC_TILER 0x98761240
71 #define EINA_MAGIC_TILER_ITERATOR 0x98761241
73 #define EINA_MAGIC_MATRIXSPARSE 0x98761242
74 #define EINA_MAGIC_MATRIXSPARSE_ROW 0x98761243
75 #define EINA_MAGIC_MATRIXSPARSE_CELL 0x98761244
76 #define EINA_MAGIC_MATRIXSPARSE_ITERATOR 0x98761245
77 #define EINA_MAGIC_MATRIXSPARSE_ROW_ITERATOR 0x98761246
78 #define EINA_MAGIC_MATRIXSPARSE_ROW_ACCESSOR 0x98761247
79 #define EINA_MAGIC_MATRIXSPARSE_CELL_ITERATOR 0x98761248
80 #define EINA_MAGIC_MATRIXSPARSE_CELL_ACCESSOR 0x98761249
82 #define EINA_MAGIC_STRBUF 0x98761250
83 #define EINA_MAGIC_USTRBUF 0x98761257
84 #define EINA_MAGIC_BINBUF 0x98761258
86 #define EINA_MAGIC_QUADTREE 0x98761251
87 #define EINA_MAGIC_QUADTREE_ROOT 0x98761252
88 #define EINA_MAGIC_QUADTREE_ITEM 0x98761253
90 #define EINA_MAGIC_SIMPLE_XML_TAG 0x98761260
91 #define EINA_MAGIC_SIMPLE_XML_DATA 0x98761261
92 #define EINA_MAGIC_SIMPLE_XML_ATTRIBUTE 0x98761262
94 #define EINA_MAGIC_INARRAY 0x98761270
95 #define EINA_MAGIC_INARRAY_ITERATOR 0x98761271
96 #define EINA_MAGIC_INARRAY_ACCESSOR 0x98761272
98 #define EINA_MAGIC_MODEL 0x98761280
100 #define EINA_MAGIC_CLASS 0x9877CB30
102 /* undef the following, we want out version */
111 #define IF_FREE(ptr) \
120 #define IF_FN_DEL(_fn, ptr) \
128 #define MAGIC_FREE(ptr) \
131 EINA_MAGIC_SET(ptr, EINA_MAGIC_NONE); \
136 #ifdef EFL_HAVE_THREADS
137 extern Eina_Bool _threads_activated;
139 void eina_share_common_threads_init(void);
140 void eina_share_common_threads_shutdown(void);
141 void eina_log_threads_init(void);
142 void eina_log_threads_shutdown(void);
145 void eina_cpu_count_internal(void);
147 void eina_file_mmap_faulty(void *addr, long page_size);
149 #endif /* EINA_PRIVATE_H_ */