diff options
author | Tom Hacohen <tom@stosb.com> | 2015-05-29 10:32:48 +0100 |
---|---|---|
committer | Tom Hacohen <tom@stosb.com> | 2015-05-29 11:39:03 +0100 |
commit | 5b89cf16336380c2d74690b6bbbbf7a9f36b0fa0 (patch) | |
tree | 40afec3e9a83b11c7a6d1de6460893fd72e20a1a | |
parent | cab1391471b96752c846d6a030c7397f4d226db2 (diff) |
Eo base: move type definitions into eo_base.eo.
-rw-r--r-- | src/lib/eo/Eo.h | 96 | ||||
-rw-r--r-- | src/lib/eo/eo_base.eo | 62 |
2 files changed, 67 insertions, 91 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index e2229d96c3..02a5520a09 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h | |||
@@ -113,18 +113,6 @@ typedef struct _Eo_Opaque Eo; | |||
113 | typedef Eo Eo_Class; | 113 | typedef Eo Eo_Class; |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * @typedef Eo_Callback_Priority | ||
117 | * | ||
118 | * Callback priority value. Range is -32k - 32k. The lower the number, the | ||
119 | * higher the priority. | ||
120 | * | ||
121 | * @see EO_CALLBACK_PRIORITY_AFTER | ||
122 | * @see EO_CALLBACK_PRIORITY_BEFORE | ||
123 | * @see EO_CALLBACK_PRIORITY_DEFAULT | ||
124 | */ | ||
125 | typedef short Eo_Callback_Priority; | ||
126 | |||
127 | /** | ||
128 | * @var _eo_class_creation_lock | 116 | * @var _eo_class_creation_lock |
129 | * This variable is used for locking purposes in the class_get function | 117 | * This variable is used for locking purposes in the class_get function |
130 | * defined in #EO_DEFINE_CLASS. | 118 | * defined in #EO_DEFINE_CLASS. |
@@ -153,20 +141,28 @@ enum _Eo_Op_Type | |||
153 | */ | 141 | */ |
154 | typedef enum _Eo_Op_Type Eo_Op_Type; | 142 | typedef enum _Eo_Op_Type Eo_Op_Type; |
155 | 143 | ||
144 | /** XXX: Hack until fixed in Eolian */ | ||
145 | typedef struct _Eo_Event_Description Eo_Event_Description2; | ||
156 | /** | 146 | /** |
157 | * @addtogroup Eo_Debug_Information Eo's Debug information helper. | 147 | * @typedef Eo_Event_Cb |
158 | * @{ | 148 | * |
149 | * An event callback prototype. | ||
150 | * | ||
151 | * @param data The user data registered with the callback. | ||
152 | * @param obj The object which initiated the event. | ||
153 | * @param desc The event's description. | ||
154 | * @param event_info additional data passed with the event. | ||
155 | * @return #EO_CALLBACK_STOP to stop calling additional callbacks for the event, #EO_CALLBACK_CONTINUE to continue. | ||
159 | */ | 156 | */ |
157 | typedef Eina_Bool (*Eo_Event_Cb)(void *data, Eo *obj, const Eo_Event_Description2 *desc, void *event_info); | ||
158 | |||
159 | #include "eo_base.eo.h" | ||
160 | #define EO_CLASS EO_BASE_CLASS | ||
160 | 161 | ||
161 | /** | 162 | /** |
162 | * @struct _Eo_Dbg_Info | 163 | * @addtogroup Eo_Debug_Information Eo's Debug information helper. |
163 | * The structure for the debug info used by Eo. | 164 | * @{ |
164 | */ | 165 | */ |
165 | struct _Eo_Dbg_Info | ||
166 | { | ||
167 | Eina_Stringshare *name; /**< The name of the part (stringshare). */ | ||
168 | Eina_Value value; /**< The value. */ | ||
169 | }; | ||
170 | 166 | ||
171 | /** | 167 | /** |
172 | * @var EO_DBG_INFO_TYPE | 168 | * @var EO_DBG_INFO_TYPE |
@@ -175,12 +171,6 @@ struct _Eo_Dbg_Info | |||
175 | EAPI extern const Eina_Value_Type *EO_DBG_INFO_TYPE; | 171 | EAPI extern const Eina_Value_Type *EO_DBG_INFO_TYPE; |
176 | 172 | ||
177 | /** | 173 | /** |
178 | * @typedef Eo_Dbg_Info | ||
179 | * A convenience typedef for #_Eo_Dbg_Info | ||
180 | */ | ||
181 | typedef struct _Eo_Dbg_Info Eo_Dbg_Info; | ||
182 | |||
183 | /** | ||
184 | * Creates a list inside debug info list. | 174 | * Creates a list inside debug info list. |
185 | * @param[in] list list where to append | 175 | * @param[in] list list where to append |
186 | * @param[in] name name of the list | 176 | * @param[in] name name of the list |
@@ -248,24 +238,6 @@ typedef unsigned int Eo_Op; | |||
248 | */ | 238 | */ |
249 | 239 | ||
250 | /** | 240 | /** |
251 | * @struct _Eo_Event_Description | ||
252 | * This struct holds the description of a specific event. | ||
253 | */ | ||
254 | struct _Eo_Event_Description | ||
255 | { | ||
256 | const char *name; /**< name of the event. */ | ||
257 | const char *doc; /**< Explanation about the event. */ | ||
258 | |||
259 | Eina_Bool unfreezable; /**< Eina_True if the event cannot be frozen */ | ||
260 | }; | ||
261 | |||
262 | /** | ||
263 | * @typedef Eo_Event_Description | ||
264 | * A convenience typedef for #_Eo_Event_Description | ||
265 | */ | ||
266 | typedef struct _Eo_Event_Description Eo_Event_Description; | ||
267 | |||
268 | /** | ||
269 | * @def EO_EVENT_DESCRIPTION(name, doc) | 241 | * @def EO_EVENT_DESCRIPTION(name, doc) |
270 | * An helper macro to help populating #Eo_Event_Description | 242 | * An helper macro to help populating #Eo_Event_Description |
271 | * @param name The name of the event. | 243 | * @param name The name of the event. |
@@ -984,36 +956,6 @@ EAPI const Eo_Event_Description *eo_base_legacy_only_event_description_get(const | |||
984 | #define EO_CALLBACK_CONTINUE EINA_TRUE | 956 | #define EO_CALLBACK_CONTINUE EINA_TRUE |
985 | 957 | ||
986 | /** | 958 | /** |
987 | * @typedef Eo_Event_Cb | ||
988 | * | ||
989 | * An event callback prototype. | ||
990 | * | ||
991 | * @param data The user data registered with the callback. | ||
992 | * @param obj The object which initiated the event. | ||
993 | * @param desc The event's description. | ||
994 | * @param event_info additional data passed with the event. | ||
995 | * @return #EO_CALLBACK_STOP to stop calling additional callbacks for the event, #EO_CALLBACK_CONTINUE to continue. | ||
996 | */ | ||
997 | typedef Eina_Bool (*Eo_Event_Cb)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info); | ||
998 | |||
999 | /** | ||
1000 | * @typedef Eo_Callback_Array_Item | ||
1001 | * A convenience typedef for #_Eo_Callback_Array_Item | ||
1002 | */ | ||
1003 | typedef struct _Eo_Callback_Array_Item Eo_Callback_Array_Item; | ||
1004 | |||
1005 | /** | ||
1006 | * @struct _Eo_Callback_Array_Item | ||
1007 | * An item in an array of callback desc/func. | ||
1008 | * @see eo_event_callback_array_add() | ||
1009 | */ | ||
1010 | struct _Eo_Callback_Array_Item | ||
1011 | { | ||
1012 | const Eo_Event_Description *desc; /**< The event description. */ | ||
1013 | Eo_Event_Cb func; /**< The callback function. */ | ||
1014 | }; | ||
1015 | |||
1016 | /** | ||
1017 | * Helper for creating global callback arrays. | 959 | * Helper for creating global callback arrays. |
1018 | * The problem is on windows where you can't declare a static array with | 960 | * The problem is on windows where you can't declare a static array with |
1019 | * external symbols in it, because the addresses are only known at runtime. | 961 | * external symbols in it, because the addresses are only known at runtime. |
@@ -1077,10 +1019,6 @@ struct _Eo_Callback_Array_Item | |||
1077 | * @} | 1019 | * @} |
1078 | */ | 1020 | */ |
1079 | 1021 | ||
1080 | #include "eo_base.eo.h" | ||
1081 | |||
1082 | #define EO_CLASS EO_BASE_CLASS | ||
1083 | |||
1084 | /** | 1022 | /** |
1085 | * @} | 1023 | * @} |
1086 | */ | 1024 | */ |
diff --git a/src/lib/eo/eo_base.eo b/src/lib/eo/eo_base.eo index 97bc6bff27..1a2b05ff8e 100644 --- a/src/lib/eo/eo_base.eo +++ b/src/lib/eo/eo_base.eo | |||
@@ -1,3 +1,41 @@ | |||
1 | /* XXX: Hack until Eolian is ready. */ | ||
2 | type @extern Eo.Event_Cb: __builtin_event_cb; | ||
3 | |||
4 | struct Eo.Event_Description { | ||
5 | /*@ | ||
6 | * This struct holds the description of a specific event. | ||
7 | */ | ||
8 | name: const(char) *; /*@< name of the event. */ | ||
9 | doc: const(char) *; /*@< Explanation about the event. */ | ||
10 | unfreezable: bool; /*@< Eina_True if the event cannot be frozen */ | ||
11 | } | ||
12 | |||
13 | struct Eo.Callback_Array_Item { | ||
14 | /*@ | ||
15 | * An item in an array of callback desc/func. | ||
16 | * @see eo_event_callback_array_add() | ||
17 | */ | ||
18 | desc: const(Eo.Event_Description) *; /*@< The event description. */ | ||
19 | func: Eo.Event_Cb; /*@< The callback function. */ | ||
20 | } | ||
21 | |||
22 | struct Eo.Dbg_Info { | ||
23 | /*@ | ||
24 | * The structure for the debug info used by Eo. | ||
25 | */ | ||
26 | name: Eina_Stringshare *; /*@< The name of the part (stringshare). */ | ||
27 | value: Eina_Value; /*@< The value. */ | ||
28 | } | ||
29 | |||
30 | |||
31 | type Eo.Callback_Priority: short; /*@ * Callback priority value. Range is -32k - 32k. | ||
32 | *The lower the number, the higher the priority. | ||
33 | * | ||
34 | * @see EO_CALLBACK_PRIORITY_AFTER | ||
35 | * @see EO_CALLBACK_PRIORITY_BEFORE | ||
36 | * @see EO_CALLBACK_PRIORITY_DEFAULT | ||
37 | */ | ||
38 | |||
1 | abstract Eo.Base () | 39 | abstract Eo.Base () |
2 | { | 40 | { |
3 | eo_prefix: eo; | 41 | eo_prefix: eo; |
@@ -109,17 +147,17 @@ Prevents event callbacks from being called for the object. */ | |||
109 | /*@ Add a callback for an event with a specific priority. | 147 | /*@ Add a callback for an event with a specific priority. |
110 | callbacks of the same priority are called in reverse order of creation. */ | 148 | callbacks of the same priority are called in reverse order of creation. */ |
111 | params { | 149 | params { |
112 | @in desc: const(Eo_Event_Description)*; /*@ The description of the event to listen to */ | 150 | @in desc: const(Eo.Event_Description)*; /*@ The description of the event to listen to */ |
113 | @in priority: Eo_Callback_Priority; /*@ The priority of the callback */ | 151 | @in priority: Eo.Callback_Priority; /*@ The priority of the callback */ |
114 | @in cb: Eo_Event_Cb; /*@ the callback to call */ | 152 | @in cb: Eo.Event_Cb; /*@ the callback to call */ |
115 | @in data: const(void)*; /*@ additional data to pass to the callback */ | 153 | @in data: const(void)*; /*@ additional data to pass to the callback */ |
116 | } | 154 | } |
117 | } | 155 | } |
118 | event_callback_del { | 156 | event_callback_del { |
119 | /*@ Del a callback with a specific data associated to it for an event. */ | 157 | /*@ Del a callback with a specific data associated to it for an event. */ |
120 | params { | 158 | params { |
121 | @in desc: const(Eo_Event_Description)*; /*@ The description of the event to listen to */ | 159 | @in desc: const(Eo.Event_Description)*; /*@ The description of the event to listen to */ |
122 | @in func: Eo_Event_Cb; /*@ the callback to delete */ | 160 | @in func: Eo.Event_Cb; /*@ the callback to delete */ |
123 | @in user_data: const(void)*; /*@ The data to compare */ | 161 | @in user_data: const(void)*; /*@ The data to compare */ |
124 | } | 162 | } |
125 | } | 163 | } |
@@ -127,22 +165,22 @@ callbacks of the same priority are called in reverse order of creation. */ | |||
127 | /*@ Add a callback array for an event with a specific priority. | 165 | /*@ Add a callback array for an event with a specific priority. |
128 | callbacks of the same priority are called in reverse order of creation. */ | 166 | callbacks of the same priority are called in reverse order of creation. */ |
129 | params { | 167 | params { |
130 | @in array: const(Eo_Callback_Array_Item)*; /*@ an #Eo_Callback_Array_Item of events to listen to */ | 168 | @in array: const(Eo.Callback_Array_Item)*; /*@ an #Eo_Callback_Array_Item of events to listen to */ |
131 | @in priority: Eo_Callback_Priority; /*@ The priority of the callback */ | 169 | @in priority: Eo.Callback_Priority; /*@ The priority of the callback */ |
132 | @in data: const(void)*; /*@ additional data to pass to the callback */ | 170 | @in data: const(void)*; /*@ additional data to pass to the callback */ |
133 | } | 171 | } |
134 | } | 172 | } |
135 | event_callback_array_del { | 173 | event_callback_array_del { |
136 | /*@ Del a callback array with a specific data associated to it for an event. */ | 174 | /*@ Del a callback array with a specific data associated to it for an event. */ |
137 | params { | 175 | params { |
138 | @in array: const(Eo_Callback_Array_Item)*; /*@ an #Eo_Callback_Array_Item of events to listen to */ | 176 | @in array: const(Eo.Callback_Array_Item)*; /*@ an #Eo_Callback_Array_Item of events to listen to */ |
139 | @in user_data: const(void)*; /*@ The data to compare */ | 177 | @in user_data: const(void)*; /*@ The data to compare */ |
140 | } | 178 | } |
141 | } | 179 | } |
142 | event_callback_call { | 180 | event_callback_call { |
143 | /*@ Call the callbacks for an event of an object. */ | 181 | /*@ Call the callbacks for an event of an object. */ |
144 | params { | 182 | params { |
145 | @in desc: const(Eo_Event_Description)*; /*@ The description of the event to call */ | 183 | @in desc: const(Eo.Event_Description)*; /*@ The description of the event to call */ |
146 | @in event_info: void *; /*@ Extra event info to pass to the callbacks */ | 184 | @in event_info: void *; /*@ Extra event info to pass to the callbacks */ |
147 | } | 185 | } |
148 | return: bool; /*@ @c EINA_TRUE if one of the callbacks aborted the call, @c EINA_FALSE otherwise */ | 186 | return: bool; /*@ @c EINA_TRUE if one of the callbacks aborted the call, @c EINA_FALSE otherwise */ |
@@ -150,21 +188,21 @@ callbacks of the same priority are called in reverse order of creation. */ | |||
150 | event_callback_forwarder_add { | 188 | event_callback_forwarder_add { |
151 | /*@ Add an event callback forwarder for an event and an object. */ | 189 | /*@ Add an event callback forwarder for an event and an object. */ |
152 | params { | 190 | params { |
153 | @in desc: const(Eo_Event_Description)*; /*@ The description of the event to listen to */ | 191 | @in desc: const(Eo.Event_Description)*; /*@ The description of the event to listen to */ |
154 | @in new_obj: Eo.Base *; /*@ The object to emit events from */ | 192 | @in new_obj: Eo.Base *; /*@ The object to emit events from */ |
155 | } | 193 | } |
156 | } | 194 | } |
157 | event_callback_forwarder_del { | 195 | event_callback_forwarder_del { |
158 | /*@ Remove an event callback forwarder for an event and an object. */ | 196 | /*@ Remove an event callback forwarder for an event and an object. */ |
159 | params { | 197 | params { |
160 | @in desc: const(Eo_Event_Description)*; /*@ The description of the event to listen to */ | 198 | @in desc: const(Eo.Event_Description)*; /*@ The description of the event to listen to */ |
161 | @in new_obj: Eo.Base *; /*@ The object to emit events from */ | 199 | @in new_obj: Eo.Base *; /*@ The object to emit events from */ |
162 | } | 200 | } |
163 | } | 201 | } |
164 | dbg_info_get { | 202 | dbg_info_get { |
165 | /*@ Get dbg information from the object. */ | 203 | /*@ Get dbg information from the object. */ |
166 | params { | 204 | params { |
167 | @in root_node: Eo_Dbg_Info*; /*@ node of the tree */ | 205 | @in root_node: Eo.Dbg_Info*; /*@ node of the tree */ |
168 | } | 206 | } |
169 | } | 207 | } |
170 | children_iterator_new { | 208 | children_iterator_new { |