1 #include "evas_common.h"
2 #include "evas_private.h"
4 static Evas_Version _version = { VMAJ, VMIN, VMIC, VREV };
5 EAPI Evas_Version *evas_version = &_version;
7 int _evas_alloc_error = 0;
8 static int _evas_debug_init = 0;
9 static int _evas_debug_show = 0;
10 static int _evas_debug_abort = 0;
13 evas_alloc_error(void)
15 return _evas_alloc_error;
18 /* free cached items only in ram for speed reasons. return 0 if can't free */
20 evas_mem_free(int mem_required __UNUSED__)
25 /* start reducing quality of images etc. return 0 if can't free anything */
27 evas_mem_degrade(int mem_required __UNUSED__)
33 evas_mem_calloc(int size)
37 ptr = calloc(1, size);
40 while ((!ptr) && (evas_mem_free(size))) ptr = calloc(1, size);
42 while ((!ptr) && (evas_mem_degrade(size))) ptr = calloc(1, size);
49 evas_debug_error(void)
51 if (!_evas_debug_init)
53 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
54 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
58 CRIT("Evas Magic Check Failed!!!");
62 evas_debug_input_null(void)
64 if (!_evas_debug_init)
66 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
67 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
71 CRIT("Input object pointer is NULL!");
72 if (_evas_debug_abort) abort();
76 evas_debug_magic_null(void)
78 if (!_evas_debug_init)
80 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
81 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
85 CRIT("Input object is zero'ed out (maybe a freed object or zero-filled RAM)!");
86 if (_evas_debug_abort) abort();
90 evas_debug_magic_wrong(DATA32 expected, DATA32 supplied)
92 if (!_evas_debug_init)
94 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
95 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
99 CRIT("Input object is wrong type\n"
100 " Expected: %08x - %s\n"
101 " Supplied: %08x - %s",
102 expected, evas_debug_magic_string_get(expected),
103 supplied, evas_debug_magic_string_get(supplied));
104 if (_evas_debug_abort) abort();
108 evas_debug_generic(const char *str)
110 if (!_evas_debug_init)
112 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
113 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
114 _evas_debug_init = 1;
116 if (_evas_debug_show)
118 if (_evas_debug_abort) abort();
122 evas_debug_magic_string_get(DATA32 magic)
129 return "Evas_Object";
130 case MAGIC_OBJ_RECTANGLE:
131 return "Evas_Object (Rectangle)";
133 return "Evas_Object (Line)";
134 case MAGIC_OBJ_POLYGON:
135 return "Evas_Object (Polygon)";
136 case MAGIC_OBJ_IMAGE:
137 return "Evas_Object (Image)";
139 return "Evas_Object (Text)";
140 case MAGIC_OBJ_SMART:
141 return "Evas_Object (Smart)";