Refactoring for removing desktop build environment, supporting menu button event...
[platform/core/uifw/efl-assist.git] / src / lib / efl_assist.c
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  *
16  */
17
18 #include "efl_assist.h"
19 #include "efl_assist_private.h"
20
21 /*===========================================================================*
22  *                                 Local                                     *
23  *===========================================================================*/
24
25 static const char *
26 _magic_string_get(ea_magic m)
27 {
28         switch (m) {
29         case EA_MAGIC_NONE:
30                 return "None (Freed Object)";
31
32         case EA_MAGIC_CUTLINK:
33                 return "cutlink";
34
35         default:
36                 return "<UNKNOWN>";
37      }
38 }
39
40 __CONSTRUCTOR__ static void
41 ea_mod_init(void)
42 {
43 }
44
45 __DESTRUCTOR__ static void
46 ea_mod_shutdown(void)
47 {
48 }
49
50
51 /*===========================================================================*
52  *                                Global                                     *
53  *===========================================================================*/
54
55 void
56 _ea_magic_fail(const void *d, ea_magic m, ea_magic req_m, const char *fname)
57 {
58         LOGE("\n*** MAGIC FAIL (%s) ***\n", fname);
59
60         if (!d)
61                 LOGE("  Input handle pointer is NULL!");
62         else if (m == EA_MAGIC_NONE)
63                 LOGE("  Input handle has already been freed!");
64         else if (m != req_m)
65                 LOGE("  Input handle is wrong type\n"
66                     "    Expected: %08x - %s\n"
67                     "    Supplied: %08x - %s",
68                     (unsigned int)req_m, _magic_string_get(req_m),
69                     (unsigned int)m, _magic_string_get(m));
70
71    if (getenv("EA_ERROR_ABORT")) abort();
72 }
73
74 /*===========================================================================*
75  *                                  API                                      *
76  *===========================================================================*/
77