summaryrefslogtreecommitdiff
path: root/src/lib/elua/elua.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-12-11 15:48:18 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2014-12-11 15:48:18 +0000
commit3b343878a840d6b33e65dab573fadad0dee54fd4 (patch)
treef47d26c40ced1564ad3a5e3b940f57224ba19f61 /src/lib/elua/elua.c
parent2f6f06d7a1490263d58d41405278e7220f6833e9 (diff)
elua: add initial pieces of the library
Diffstat (limited to '')
-rw-r--r--src/lib/elua/elua.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index fc4b894f9c..5e987599b9 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -1 +1,65 @@
1#include <Eina.h>
2
1#include "Elua.h" 3#include "Elua.h"
4#include "elua_private.h"
5
6static Eina_Prefix *_elua_pfx = NULL;
7
8static int _elua_init_counter = 0;
9int _elua_log_dom = -1;
10
11EAPI int
12elua_init(void)
13{
14 const char *dom = "elua";
15 if (_elua_init_counter > 0) return ++_elua_init_counter;
16
17 eina_init();
18 _elua_log_dom = eina_log_domain_register(dom, EINA_COLOR_LIGHTBLUE);
19 if (_elua_log_dom < 0)
20 {
21 EINA_LOG_ERR("Could not register log domain: %s", dom);
22 return EINA_FALSE;
23 }
24
25 eina_log_timing(_elua_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT);
26 INF("elua init");
27
28 _elua_pfx = eina_prefix_new(NULL, elua_init, "ELUA", "elua", NULL,
29 PACKAGE_BIN_DIR, "", PACKAGE_DATA_DIR,
30 LOCALE_DIR);
31
32 if (!_elua_pfx)
33 {
34 ERR("coul not find elua prefix");
35 return EINA_FALSE;
36 }
37
38 return ++_elua_init_counter;
39}
40
41EAPI int
42elua_shutdown(void)
43{
44 if (_elua_init_counter <= 0)
45 {
46 EINA_LOG_ERR("Init count not greater than 0 in shutdown.");
47 return EINA_FALSE;
48 }
49 --_elua_init_counter;
50
51 if (_elua_init_counter > 0)
52 return _elua_init_counter;
53
54 INF("shutdown");
55 eina_log_timing(_elua_log_dom, EINA_LOG_STATE_START, EINA_LOG_STATE_SHUTDOWN);
56
57 eina_prefix_free(_elua_pfx);
58 _elua_pfx = NULL;
59
60 eina_log_domain_unregister(_elua_log_dom);
61 _elua_log_dom = -1;
62
63 eina_shutdown();
64 return _elua_init_counter;
65}