diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/eina/src/lib/eina_binshare.c | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-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 'libraries/eina/src/lib/eina_binshare.c')
-rw-r--r-- | libraries/eina/src/lib/eina_binshare.c | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/libraries/eina/src/lib/eina_binshare.c b/libraries/eina/src/lib/eina_binshare.c new file mode 100644 index 0000000..68a82fc --- /dev/null +++ b/libraries/eina/src/lib/eina_binshare.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* EINA - EFL data type library | ||
2 | * Copyright (C) 2002-2008 Carsten Haitzler, | ||
3 | * Jorge Luis Zapata Muga, | ||
4 | * Cedric Bail, | ||
5 | * Gustavo Sverzut Barbieri | ||
6 | * Tom Hacohen | ||
7 | * | ||
8 | * This library is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU Lesser General Public | ||
10 | * License as published by the Free Software Foundation; either | ||
11 | * version 2.1 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This library is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * Lesser General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public | ||
19 | * License along with this library; | ||
20 | * if not, see <http://www.gnu.org/licenses/>. | ||
21 | |||
22 | */ | ||
23 | |||
24 | #include "eina_share_common.h" | ||
25 | #include "eina_unicode.h" | ||
26 | #include "eina_private.h" | ||
27 | #include "eina_binshare.h" | ||
28 | |||
29 | /*============================================================================* | ||
30 | * Local * | ||
31 | *============================================================================*/ | ||
32 | |||
33 | /** | ||
34 | * @cond LOCAL | ||
35 | */ | ||
36 | |||
37 | /* The actual share */ | ||
38 | static Eina_Share *binshare_share; | ||
39 | static const char EINA_MAGIC_BINSHARE_NODE_STR[] = "Eina Binshare Node"; | ||
40 | |||
41 | /** | ||
42 | * @endcond | ||
43 | */ | ||
44 | |||
45 | |||
46 | /*============================================================================* | ||
47 | * Global * | ||
48 | *============================================================================*/ | ||
49 | |||
50 | /** | ||
51 | * @internal | ||
52 | * @brief Initialize the share_common module. | ||
53 | * | ||
54 | * @return #EINA_TRUE on success, #EINA_FALSE on failure. | ||
55 | * | ||
56 | * This function sets up the share_common module of Eina. It is called by | ||
57 | * eina_init(). | ||
58 | * | ||
59 | * @see eina_init() | ||
60 | */ | ||
61 | EAPI Eina_Bool | ||
62 | eina_binshare_init(void) | ||
63 | { | ||
64 | return eina_share_common_init(&binshare_share, | ||
65 | EINA_MAGIC_BINSHARE_NODE, | ||
66 | EINA_MAGIC_BINSHARE_NODE_STR); | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * @internal | ||
71 | * @brief Shut down the share_common module. | ||
72 | * | ||
73 | * @return #EINA_TRUE on success, #EINA_FALSE on failure. | ||
74 | * | ||
75 | * This function shuts down the share_common module set up by | ||
76 | * eina_share_common_init(). It is called by eina_shutdown(). | ||
77 | * | ||
78 | * @see eina_shutdown() | ||
79 | */ | ||
80 | EAPI Eina_Bool | ||
81 | eina_binshare_shutdown(void) | ||
82 | { | ||
83 | Eina_Bool ret; | ||
84 | ret = eina_share_common_shutdown(&binshare_share); | ||
85 | return ret; | ||
86 | } | ||
87 | |||
88 | |||
89 | /*============================================================================* | ||
90 | * API * | ||
91 | *============================================================================*/ | ||
92 | |||
93 | EAPI void | ||
94 | eina_binshare_del(const void *obj) | ||
95 | { | ||
96 | if (!obj) | ||
97 | return; | ||
98 | |||
99 | eina_share_common_del(binshare_share, obj); | ||
100 | } | ||
101 | |||
102 | EAPI const void * | ||
103 | eina_binshare_add_length(const void *obj, unsigned int olen) | ||
104 | { | ||
105 | return eina_share_common_add_length(binshare_share, | ||
106 | obj, | ||
107 | (olen) * sizeof(char), | ||
108 | 0); | ||
109 | } | ||
110 | |||
111 | EAPI const void * | ||
112 | eina_binshare_ref(const void *obj) | ||
113 | { | ||
114 | return eina_share_common_ref(binshare_share, obj); | ||
115 | } | ||
116 | |||
117 | EAPI int | ||
118 | eina_binshare_length(const void *obj) | ||
119 | { | ||
120 | return eina_share_common_length(binshare_share, obj); | ||
121 | } | ||
122 | |||
123 | EAPI void | ||
124 | eina_binshare_dump(void) | ||
125 | { | ||
126 | eina_share_common_dump(binshare_share, NULL, 0); | ||
127 | } | ||