aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/main.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/main.c
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to '')
-rw-r--r--libraries/evas/src/lib/main.c150
1 files changed, 150 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/main.c b/libraries/evas/src/lib/main.c
new file mode 100644
index 0000000..f999889
--- /dev/null
+++ b/libraries/evas/src/lib/main.c
@@ -0,0 +1,150 @@
1#include "evas_common.h"
2#include "evas_private.h"
3
4static Evas_Version _version = { VMAJ, VMIN, VMIC, VREV };
5EAPI Evas_Version *evas_version = &_version;
6
7int _evas_alloc_error = 0;
8static int _evas_debug_init = 0;
9static int _evas_debug_show = 0;
10static int _evas_debug_abort = 0;
11
12EAPI Evas_Alloc_Error
13evas_alloc_error(void)
14{
15 return _evas_alloc_error;
16}
17
18/* free cached items only in ram for speed reasons. return 0 if can't free */
19int
20evas_mem_free(int mem_required __UNUSED__)
21{
22 return 0;
23}
24
25/* start reducing quality of images etc. return 0 if can't free anything */
26int
27evas_mem_degrade(int mem_required __UNUSED__)
28{
29 return 0;
30}
31
32void *
33evas_mem_calloc(int size)
34{
35 void *ptr;
36
37 ptr = calloc(1, size);
38 if (ptr) return ptr;
39 MERR_BAD();
40 while ((!ptr) && (evas_mem_free(size))) ptr = calloc(1, size);
41 if (ptr) return ptr;
42 while ((!ptr) && (evas_mem_degrade(size))) ptr = calloc(1, size);
43 if (ptr) return ptr;
44 MERR_FATAL();
45 return NULL;
46}
47
48void
49evas_debug_error(void)
50{
51 if (!_evas_debug_init)
52 {
53 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
54 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
55 _evas_debug_init = 1;
56 }
57 if (_evas_debug_show)
58 CRIT("Evas Magic Check Failed!!!");
59}
60
61void
62evas_debug_input_null(void)
63{
64 if (!_evas_debug_init)
65 {
66 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
67 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
68 _evas_debug_init = 1;
69 }
70 if (_evas_debug_show)
71 CRIT("Input object pointer is NULL!");
72 if (_evas_debug_abort) abort();
73}
74
75void
76evas_debug_magic_null(void)
77{
78 if (!_evas_debug_init)
79 {
80 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
81 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
82 _evas_debug_init = 1;
83 }
84 if (_evas_debug_show)
85 CRIT("Input object is zero'ed out (maybe a freed object or zero-filled RAM)!");
86 if (_evas_debug_abort) abort();
87}
88
89void
90evas_debug_magic_wrong(DATA32 expected, DATA32 supplied)
91{
92 if (!_evas_debug_init)
93 {
94 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
95 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
96 _evas_debug_init = 1;
97 }
98 if (_evas_debug_show)
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();
105}
106
107void
108evas_debug_generic(const char *str)
109{
110 if (!_evas_debug_init)
111 {
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;
115 }
116 if (_evas_debug_show)
117 CRIT("%s", str);
118 if (_evas_debug_abort) abort();
119}
120
121const char *
122evas_debug_magic_string_get(DATA32 magic)
123{
124 switch (magic)
125 {
126 case MAGIC_EVAS:
127 return "Evas";
128 case MAGIC_OBJ:
129 return "Evas_Object";
130 case MAGIC_OBJ_RECTANGLE:
131 return "Evas_Object (Rectangle)";
132 case MAGIC_OBJ_LINE:
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)";
138 case MAGIC_OBJ_TEXT:
139 return "Evas_Object (Text)";
140 case MAGIC_OBJ_SMART:
141 return "Evas_Object (Smart)";
142 case MAGIC_EVAS_GL:
143 return "Evas_GL";
144 case MAGIC_MAP:
145 return "Evas_Map";
146 default:
147 return "<UNKNOWN>";
148 };
149 return "<UNKNOWN>";
150}