summaryrefslogtreecommitdiff
path: root/legacy/eobj
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-08-20 07:56:17 +0000
committerTom Hacohen <tom@stosb.com>2012-08-20 07:56:17 +0000
commitcf46d00796937da42cde292cc1f5ba3c13b0e154 (patch)
tree726c06b83da4306ef39833ca311e362578c6e325 /legacy/eobj
parent01dd698ac9fd49e0fe952e835ddd928e660439b4 (diff)
Eo: Removed static class support.
SVN revision: 75452
Diffstat (limited to 'legacy/eobj')
-rw-r--r--legacy/eobj/src/lib/Eo.h33
-rw-r--r--legacy/eobj/src/lib/eo.c37
-rw-r--r--legacy/eobj/src/lib/eo_base_class.c6
-rw-r--r--legacy/eobj/src/tests/eo_suite/eo_test_class_errors.c46
-rw-r--r--legacy/eobj/src/tests/eo_suite/eo_test_general.c57
5 files changed, 49 insertions, 130 deletions
diff --git a/legacy/eobj/src/lib/Eo.h b/legacy/eobj/src/lib/Eo.h
index b75df1c86c..f9de616b2d 100644
--- a/legacy/eobj/src/lib/Eo.h
+++ b/legacy/eobj/src/lib/Eo.h
@@ -188,24 +188,6 @@ typedef struct _Eo_Event_Description Eo_Event_Description;
188 * You must use this macro if you want thread safety in class creation. 188 * You must use this macro if you want thread safety in class creation.
189 */ 189 */
190#define EO_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) \ 190#define EO_DEFINE_CLASS(class_get_func_name, class_desc, parent_class, ...) \
191 EO_DEFINE_CLASS_STATIC(class_get_func_name, 0, class_desc, parent_class, __VA_ARGS__)
192
193/**
194 * @def EO_DEFINE_CLASS_STATIC(class_get_func_name, id, class_desc, parent_class, ...)
195 * *** DO NOT USE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING ***
196 * @param id a positive number to serve as the id of the class. 0 means dynamic. See eo_class_new() for details.
197 * @param class_get_func_name the name of the wanted class_get function name.
198 * @param class_desc the class description.
199 * @param parent_class The parent class for the function. Look at eo_class_new() for more information.
200 * @param ... List of etxensions. Look at eo_class_new() for more information.
201 *
202 * This macro should only be used if you know what you are doing and you want
203 * to create a class with a static id.
204 * Use #EO_DEFINE_CLASS instead.
205 *
206 * @see #EO_DEFINE_CLASS
207 */
208#define EO_DEFINE_CLASS_STATIC(class_get_func_name, id, class_desc, parent_class, ...) \
209EAPI const Eo_Class * \ 191EAPI const Eo_Class * \
210class_get_func_name(void) \ 192class_get_func_name(void) \
211{ \ 193{ \
@@ -228,7 +210,7 @@ class_get_func_name(void) \
228 } \ 210 } \
229 eina_lock_release(&_eo_class_creation_lock); \ 211 eina_lock_release(&_eo_class_creation_lock); \
230 (void) parent_class; \ 212 (void) parent_class; \
231 _my_class = eo_class_new(class_desc, id, parent_class, __VA_ARGS__); \ 213 _my_class = eo_class_new(class_desc, parent_class, __VA_ARGS__); \
232 eina_lock_release(&_my_lock); \ 214 eina_lock_release(&_my_lock); \
233 \ 215 \
234 eina_lock_take(&_eo_class_creation_lock); \ 216 eina_lock_take(&_eo_class_creation_lock); \
@@ -395,7 +377,6 @@ typedef struct _Eo_Class_Description Eo_Class_Description;
395/** 377/**
396 * @brief Create a new class. 378 * @brief Create a new class.
397 * @param desc the class description to create the class with. 379 * @param desc the class description to create the class with.
398 * @param id a positive number to serve as the id of the class. 0 means dynamic allocation. The number of static Ids is limited and regular users should not use static ids.
399 * @param parent the class to inherit from. 380 * @param parent the class to inherit from.
400 * @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects). 381 * @param ... A NULL terminated list of extensions (interfaces, mixins and the classes of any composite objects).
401 * @return The new class's handle on success, or NULL otherwise. 382 * @return The new class's handle on success, or NULL otherwise.
@@ -405,7 +386,7 @@ typedef struct _Eo_Class_Description Eo_Class_Description;
405 * 386 *
406 * @see #EO_DEFINE_CLASS 387 * @see #EO_DEFINE_CLASS
407 */ 388 */
408EAPI const Eo_Class *eo_class_new(const Eo_Class_Description *desc, Eo_Class_Id id, const Eo_Class *parent, ...); 389EAPI const Eo_Class *eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent, ...);
409 390
410/** 391/**
411 * @brief Check if an object "is a" klass. 392 * @brief Check if an object "is a" klass.
@@ -789,16 +770,10 @@ EAPI const Eo_Class *eo_base_class_get(void);
789typedef void (*eo_base_data_free_func)(void *); 770typedef void (*eo_base_data_free_func)(void *);
790 771
791/** 772/**
792 * @def EO_BASE_CLASS_ID 773 * @var EO_BASE_BASE_ID
793 * #EO_BASE_CLASS 's class id.
794 */
795#define EO_BASE_CLASS_ID 1
796
797/**
798 * @def EO_BASE_BASE_ID
799 * #EO_BASE_CLASS 's base id. 774 * #EO_BASE_CLASS 's base id.
800 */ 775 */
801#define EO_BASE_BASE_ID EO_BASE_CLASS_ID // FIXME: Awful hack. 776extern EAPI Eo_Op EO_BASE_BASE_ID;
802 777
803enum { 778enum {
804 EO_BASE_SUB_ID_CONSTRUCTOR, 779 EO_BASE_SUB_ID_CONSTRUCTOR,
diff --git a/legacy/eobj/src/lib/eo.c b/legacy/eobj/src/lib/eo.c
index d2e8f322da..5b0655c40b 100644
--- a/legacy/eobj/src/lib/eo.c
+++ b/legacy/eobj/src/lib/eo.c
@@ -6,7 +6,7 @@
6#include "config.h" 6#include "config.h"
7 7
8/* The last id that should be reserved for statically allocated classes. */ 8/* The last id that should be reserved for statically allocated classes. */
9#define EO_STATIC_IDS_LAST 10 9#define EO_CLASS_IDS_FIRST 1
10#define EO_OP_IDS_FIRST 1 10#define EO_OP_IDS_FIRST 1
11 11
12/* Used inside the class_get functions of classes, see #EO_DEFINE_CLASS */ 12/* Used inside the class_get functions of classes, see #EO_DEFINE_CLASS */
@@ -775,7 +775,7 @@ eo_class_free(Eo_Class *klass)
775 775
776/* DEVCHECK */ 776/* DEVCHECK */
777static Eina_Bool 777static Eina_Bool
778_eo_class_check_op_descs(const Eo_Class *klass, Eo_Class_Id id) 778_eo_class_check_op_descs(const Eo_Class *klass)
779{ 779{
780 const Eo_Class_Description *desc = klass->desc; 780 const Eo_Class_Description *desc = klass->desc;
781 const Eo_Op_Description *itr; 781 const Eo_Op_Description *itr;
@@ -783,7 +783,7 @@ _eo_class_check_op_descs(const Eo_Class *klass, Eo_Class_Id id)
783 783
784 if (desc->ops.count > 0) 784 if (desc->ops.count > 0)
785 { 785 {
786 if (((id == 0) || (id > EO_STATIC_IDS_LAST)) && !desc->ops.base_op_id) 786 if (!desc->ops.base_op_id)
787 { 787 {
788 ERR("Class '%s' has a non-zero ops count, but base_id is NULL.", 788 ERR("Class '%s' has a non-zero ops count, but base_id is NULL.",
789 desc->name); 789 desc->name);
@@ -832,7 +832,7 @@ _eo_class_isa_func(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *l
832} 832}
833 833
834EAPI const Eo_Class * 834EAPI const Eo_Class *
835eo_class_new(const Eo_Class_Description *desc, Eo_Class_Id id, const Eo_Class *parent, ...) 835eo_class_new(const Eo_Class_Description *desc, const Eo_Class *parent, ...)
836{ 836{
837 Eo_Class *klass; 837 Eo_Class *klass;
838 va_list p_list; 838 va_list p_list;
@@ -843,12 +843,6 @@ eo_class_new(const Eo_Class_Description *desc, Eo_Class_Id id, const Eo_Class *p
843 return NULL; 843 return NULL;
844 } 844 }
845 845
846 if (id > EO_STATIC_IDS_LAST)
847 {
848 ERR("Tried creating a class with the static id %d while the maximum static id is %d. Aborting.", id, EO_STATIC_IDS_LAST);
849 return NULL;
850 }
851
852 va_start(p_list, parent); 846 va_start(p_list, parent);
853 847
854 EINA_SAFETY_ON_NULL_RETURN_VAL(desc, NULL); 848 EINA_SAFETY_ON_NULL_RETURN_VAL(desc, NULL);
@@ -930,7 +924,7 @@ eo_class_new(const Eo_Class_Description *desc, Eo_Class_Id id, const Eo_Class *p
930 EO_ALIGN_SIZE(klass->parent->desc->data_size); 924 EO_ALIGN_SIZE(klass->parent->desc->data_size);
931 } 925 }
932 926
933 if (!_eo_class_check_op_descs(klass, id)) 927 if (!_eo_class_check_op_descs(klass))
934 { 928 {
935 goto cleanup; 929 goto cleanup;
936 } 930 }
@@ -983,24 +977,7 @@ eo_class_new(const Eo_Class_Description *desc, Eo_Class_Id id, const Eo_Class *p
983 977
984 eina_lock_take(&_eo_class_creation_lock); 978 eina_lock_take(&_eo_class_creation_lock);
985 979
986 if (id == 0) 980 klass->class_id = ++_eo_classes_last_id;
987 {
988 klass->class_id = ++_eo_classes_last_id;
989 }
990 else
991 {
992#ifndef NDEBUG
993 if (_eo_classes && _eo_classes[id - 1])
994 {
995 ERR("A class with id %d was already defined (%s). Aborting.", id,
996 _eo_classes[id - 1]->desc->name);
997 eina_lock_release(&_eo_class_creation_lock);
998 goto cleanup;
999 }
1000#endif
1001 klass->class_id = id;
1002 }
1003
1004 981
1005 { 982 {
1006 /* FIXME: Handle errors. */ 983 /* FIXME: Handle errors. */
@@ -1451,7 +1428,7 @@ eo_init(void)
1451 eina_init(); 1428 eina_init();
1452 1429
1453 _eo_classes = NULL; 1430 _eo_classes = NULL;
1454 _eo_classes_last_id = EO_STATIC_IDS_LAST; 1431 _eo_classes_last_id = EO_CLASS_IDS_FIRST - 1;
1455 _eo_ops_last_id = EO_OP_IDS_FIRST; 1432 _eo_ops_last_id = EO_OP_IDS_FIRST;
1456 _eo_log_dom = eina_log_domain_register(log_dom, EINA_COLOR_LIGHTBLUE); 1433 _eo_log_dom = eina_log_domain_register(log_dom, EINA_COLOR_LIGHTBLUE);
1457 if (_eo_log_dom < 0) 1434 if (_eo_log_dom < 0)
diff --git a/legacy/eobj/src/lib/eo_base_class.c b/legacy/eobj/src/lib/eo_base_class.c
index 9b5870cc63..acf3ac1feb 100644
--- a/legacy/eobj/src/lib/eo_base_class.c
+++ b/legacy/eobj/src/lib/eo_base_class.c
@@ -5,6 +5,8 @@
5 5
6#include "config.h" 6#include "config.h"
7 7
8EAPI Eo_Op EO_BASE_BASE_ID = 0;
9
8static int event_freeze_count = 0; 10static int event_freeze_count = 0;
9 11
10typedef struct 12typedef struct
@@ -565,12 +567,12 @@ static const Eo_Class_Description class_desc = {
565 EO_VERSION, 567 EO_VERSION,
566 "Eo Base", 568 "Eo Base",
567 EO_CLASS_TYPE_REGULAR_NO_INSTANT, 569 EO_CLASS_TYPE_REGULAR_NO_INSTANT,
568 EO_CLASS_DESCRIPTION_OPS(NULL, op_desc, EO_BASE_SUB_ID_LAST), 570 EO_CLASS_DESCRIPTION_OPS(&EO_BASE_BASE_ID, op_desc, EO_BASE_SUB_ID_LAST),
569 event_desc, 571 event_desc,
570 sizeof(Private_Data), 572 sizeof(Private_Data),
571 _class_constructor, 573 _class_constructor,
572 NULL 574 NULL
573}; 575};
574 576
575EO_DEFINE_CLASS_STATIC(eo_base_class_get, EO_BASE_CLASS_ID, &class_desc, NULL, NULL) 577EO_DEFINE_CLASS(eo_base_class_get, &class_desc, NULL, NULL)
576 578
diff --git a/legacy/eobj/src/tests/eo_suite/eo_test_class_errors.c b/legacy/eobj/src/tests/eo_suite/eo_test_class_errors.c
index 983ff2cfc6..269c87a7a5 100644
--- a/legacy/eobj/src/tests/eo_suite/eo_test_class_errors.c
+++ b/legacy/eobj/src/tests/eo_suite/eo_test_class_errors.c
@@ -44,46 +44,46 @@ START_TEST(eo_incomplete_desc)
44 NULL 44 NULL
45 }; 45 };
46 46
47 klass = eo_class_new(&class_desc, 0, NULL, NULL); 47 klass = eo_class_new(&class_desc, NULL, NULL);
48 fail_if(klass); 48 fail_if(klass);
49 49
50 class_desc.ops.base_op_id = &TMP_BASE_ID; 50 class_desc.ops.base_op_id = &TMP_BASE_ID;
51 class_desc.ops.descs = NULL; 51 class_desc.ops.descs = NULL;
52 52
53 klass = eo_class_new(&class_desc, 0, NULL, NULL); 53 klass = eo_class_new(&class_desc, NULL, NULL);
54 fail_if(klass); 54 fail_if(klass);
55 55
56 class_desc.ops.descs = op_desc; 56 class_desc.ops.descs = op_desc;
57 class_desc.ops.count = TEST_SUB_ID_LAST + 1; 57 class_desc.ops.count = TEST_SUB_ID_LAST + 1;
58 58
59 klass = eo_class_new(&class_desc, 0, NULL, NULL); 59 klass = eo_class_new(&class_desc, NULL, NULL);
60 fail_if(klass); 60 fail_if(klass);
61 61
62 class_desc.ops.count = 0; 62 class_desc.ops.count = 0;
63 63
64 klass = eo_class_new(&class_desc, 0, NULL, NULL); 64 klass = eo_class_new(&class_desc, NULL, NULL);
65 fail_if(klass); 65 fail_if(klass);
66 66
67 class_desc.ops.count = TEST_SUB_ID_LAST; 67 class_desc.ops.count = TEST_SUB_ID_LAST;
68 class_desc.ops.descs = op_desc_wrong; 68 class_desc.ops.descs = op_desc_wrong;
69 69
70 klass = eo_class_new(&class_desc, 0, NULL, NULL); 70 klass = eo_class_new(&class_desc, NULL, NULL);
71 fail_if(klass); 71 fail_if(klass);
72 72
73 class_desc.ops.descs = op_desc; 73 class_desc.ops.descs = op_desc;
74 class_desc.name = NULL; 74 class_desc.name = NULL;
75 75
76 klass = eo_class_new(&class_desc, 0, NULL, NULL); 76 klass = eo_class_new(&class_desc, NULL, NULL);
77 fail_if(klass); 77 fail_if(klass);
78 78
79 class_desc.name = "Simple"; 79 class_desc.name = "Simple";
80 80
81 81
82 klass = eo_class_new(NULL, 0, NULL, NULL); 82 klass = eo_class_new(NULL, NULL, NULL);
83 fail_if(klass); 83 fail_if(klass);
84 84
85 /* Should create a class. */ 85 /* Should create a class. */
86 klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, NULL); 86 klass = eo_class_new(&class_desc, EO_BASE_CLASS, NULL);
87 fail_if(!klass); 87 fail_if(!klass);
88 88
89 (void) klass; 89 (void) klass;
@@ -133,18 +133,18 @@ START_TEST(eo_inherit_errors)
133 NULL 133 NULL
134 }; 134 };
135 135
136 klass_mixin = eo_class_new(&class_desc_mixin, 0, NULL, NULL); 136 klass_mixin = eo_class_new(&class_desc_mixin, NULL, NULL);
137 fail_if(!klass_mixin); 137 fail_if(!klass_mixin);
138 138
139 klass_simple = eo_class_new(&class_desc_simple, 0, EO_BASE_CLASS, NULL); 139 klass_simple = eo_class_new(&class_desc_simple, EO_BASE_CLASS, NULL);
140 fail_if(!klass_simple); 140 fail_if(!klass_simple);
141 141
142 klass = eo_class_new(&class_desc, 0, klass_simple, NULL); 142 klass = eo_class_new(&class_desc, klass_simple, NULL);
143 fail_if(klass); 143 fail_if(klass);
144 144
145 class_desc.type = EO_CLASS_TYPE_REGULAR; 145 class_desc.type = EO_CLASS_TYPE_REGULAR;
146 146
147 klass = eo_class_new(&class_desc, 0, klass_mixin, NULL); 147 klass = eo_class_new(&class_desc, klass_mixin, NULL);
148 fail_if(klass); 148 fail_if(klass);
149 149
150 (void) klass; 150 (void) klass;
@@ -206,22 +206,22 @@ START_TEST(eo_inconsistent_mro)
206 NULL 206 NULL
207 }; 207 };
208 208
209 klass_mixin = eo_class_new(&class_desc_mixin, 0, NULL, NULL); 209 klass_mixin = eo_class_new(&class_desc_mixin, NULL, NULL);
210 fail_if(!klass_mixin); 210 fail_if(!klass_mixin);
211 211
212 klass_mixin2 = eo_class_new(&class_desc_mixin2, 0, klass_mixin, NULL); 212 klass_mixin2 = eo_class_new(&class_desc_mixin2, klass_mixin, NULL);
213 fail_if(!klass_mixin2); 213 fail_if(!klass_mixin2);
214 214
215 klass_mixin3 = eo_class_new(&class_desc_mixin3, 0, klass_mixin, NULL); 215 klass_mixin3 = eo_class_new(&class_desc_mixin3, klass_mixin, NULL);
216 fail_if(!klass_mixin3); 216 fail_if(!klass_mixin3);
217 217
218 klass = eo_class_new(&class_desc_simple, 0, EO_BASE_CLASS, klass_mixin, klass_mixin2, NULL); 218 klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin, klass_mixin2, NULL);
219 fail_if(klass); 219 fail_if(klass);
220 220
221 klass = eo_class_new(&class_desc_simple, 0, EO_BASE_CLASS, klass_mixin2, klass_mixin, NULL); 221 klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin2, klass_mixin, NULL);
222 fail_if(!klass); 222 fail_if(!klass);
223 223
224 klass = eo_class_new(&class_desc_simple, 0, EO_BASE_CLASS, klass_mixin2, klass_mixin3, NULL); 224 klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin2, klass_mixin3, NULL);
225 fail_if(!klass); 225 fail_if(!klass);
226 226
227 eo_shutdown(); 227 eo_shutdown();
@@ -247,24 +247,24 @@ START_TEST(eo_bad_interface)
247 NULL 247 NULL
248 }; 248 };
249 249
250 klass = eo_class_new(&class_desc, 0, NULL, NULL); 250 klass = eo_class_new(&class_desc, NULL, NULL);
251 fail_if(klass); 251 fail_if(klass);
252 252
253 class_desc.data_size = 0; 253 class_desc.data_size = 0;
254 class_desc.class_constructor = _stub_class_constructor; 254 class_desc.class_constructor = _stub_class_constructor;
255 255
256 klass = eo_class_new(&class_desc, 0, NULL, NULL); 256 klass = eo_class_new(&class_desc, NULL, NULL);
257 fail_if(!klass); 257 fail_if(!klass);
258 258
259 class_desc.class_constructor = NULL; 259 class_desc.class_constructor = NULL;
260 class_desc.class_destructor = _stub_class_constructor; 260 class_desc.class_destructor = _stub_class_constructor;
261 261
262 klass = eo_class_new(&class_desc, 0, NULL, NULL); 262 klass = eo_class_new(&class_desc, NULL, NULL);
263 fail_if(!klass); 263 fail_if(!klass);
264 264
265 class_desc.class_destructor = NULL; 265 class_desc.class_destructor = NULL;
266 266
267 klass = eo_class_new(&class_desc, 0, NULL, NULL); 267 klass = eo_class_new(&class_desc, NULL, NULL);
268 fail_if(!klass); 268 fail_if(!klass);
269 269
270 eo_shutdown(); 270 eo_shutdown();
@@ -326,7 +326,7 @@ START_TEST(eo_op_types)
326 NULL 326 NULL
327 }; 327 };
328 328
329 klass = eo_class_new(&class_desc, 0, SIMPLE_CLASS, NULL); 329 klass = eo_class_new(&class_desc, SIMPLE_CLASS, NULL);
330 fail_if(!klass); 330 fail_if(!klass);
331 331
332 /* Add class checks here... */ 332 /* Add class checks here... */
diff --git a/legacy/eobj/src/tests/eo_suite/eo_test_general.c b/legacy/eobj/src/tests/eo_suite/eo_test_general.c
index 12791a04f3..ac395d2b70 100644
--- a/legacy/eobj/src/tests/eo_suite/eo_test_general.c
+++ b/legacy/eobj/src/tests/eo_suite/eo_test_general.c
@@ -41,7 +41,7 @@ START_TEST(eo_data_fetch)
41 NULL 41 NULL
42 }; 42 };
43 43
44 const Eo_Class *klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, NULL); 44 const Eo_Class *klass = eo_class_new(&class_desc, EO_BASE_CLASS, NULL);
45 fail_if(!klass); 45 fail_if(!klass);
46 46
47 Eo *obj = eo_add(klass, NULL); 47 Eo *obj = eo_add(klass, NULL);
@@ -52,7 +52,7 @@ START_TEST(eo_data_fetch)
52 eo_unref(obj); 52 eo_unref(obj);
53 53
54 class_desc.data_size = 0; 54 class_desc.data_size = 0;
55 klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, NULL); 55 klass = eo_class_new(&class_desc, EO_BASE_CLASS, NULL);
56 fail_if(!klass); 56 fail_if(!klass);
57 57
58 obj = eo_add(klass, NULL); 58 obj = eo_add(klass, NULL);
@@ -83,7 +83,7 @@ START_TEST(eo_isa_tests)
83 NULL 83 NULL
84 }; 84 };
85 85
86 iface = eo_class_new(&class_desc, 0, NULL, NULL); 86 iface = eo_class_new(&class_desc, NULL, NULL);
87 fail_if(!iface); 87 fail_if(!iface);
88 } 88 }
89 89
@@ -100,7 +100,7 @@ START_TEST(eo_isa_tests)
100 NULL 100 NULL
101 }; 101 };
102 102
103 mixin = eo_class_new(&class_desc, 0, NULL, NULL); 103 mixin = eo_class_new(&class_desc, NULL, NULL);
104 fail_if(!mixin); 104 fail_if(!mixin);
105 } 105 }
106 106
@@ -117,7 +117,7 @@ START_TEST(eo_isa_tests)
117 NULL 117 NULL
118 }; 118 };
119 119
120 klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, iface, mixin, NULL); 120 klass = eo_class_new(&class_desc, EO_BASE_CLASS, iface, mixin, NULL);
121 fail_if(!klass); 121 fail_if(!klass);
122 } 122 }
123 123
@@ -164,40 +164,6 @@ START_TEST(eo_composite_tests)
164} 164}
165END_TEST 165END_TEST
166 166
167START_TEST(eo_static_classes)
168{
169 eo_init();
170
171 static const Eo_Op_Description op_desc[] = {
172 EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"),
173 EO_OP_DESCRIPTION_SENTINEL
174 };
175
176 /* Usually should be const, not const only for the test... */
177 static Eo_Class_Description class_desc = {
178 EO_VERSION,
179 "Simple2",
180 EO_CLASS_TYPE_REGULAR,
181 EO_CLASS_DESCRIPTION_OPS(NULL, op_desc, 1),
182 NULL,
183 0,
184 NULL,
185 NULL
186 };
187
188 const Eo_Class *klass = eo_class_new(&class_desc, 1, EO_BASE_CLASS, NULL);
189 fail_if(klass);
190
191 klass = eo_class_new(&class_desc, 1000, EO_BASE_CLASS, NULL);
192 fail_if(klass);
193
194 klass = eo_class_new(&class_desc, 2, EO_BASE_CLASS, NULL);
195 fail_if(!klass);
196
197 eo_shutdown();
198}
199END_TEST
200
201static Eina_Bool _man_should_con = EINA_TRUE; 167static Eina_Bool _man_should_con = EINA_TRUE;
202static Eina_Bool _man_should_des = EINA_TRUE; 168static Eina_Bool _man_should_des = EINA_TRUE;
203 169
@@ -247,7 +213,7 @@ START_TEST(eo_man_free)
247 NULL 213 NULL
248 }; 214 };
249 215
250 const Eo_Class *klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, NULL); 216 const Eo_Class *klass = eo_class_new(&class_desc, EO_BASE_CLASS, NULL);
251 fail_if(!klass); 217 fail_if(!klass);
252 218
253 Eo *obj = eo_add(klass, NULL); 219 Eo *obj = eo_add(klass, NULL);
@@ -260,7 +226,7 @@ START_TEST(eo_man_free)
260 eo_unref(obj); 226 eo_unref(obj);
261 227
262 _man_should_des = EINA_FALSE; 228 _man_should_des = EINA_FALSE;
263 klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, NULL); 229 klass = eo_class_new(&class_desc, EO_BASE_CLASS, NULL);
264 fail_if(!klass); 230 fail_if(!klass);
265 231
266 obj = eo_add(klass, NULL); 232 obj = eo_add(klass, NULL);
@@ -275,7 +241,7 @@ START_TEST(eo_man_free)
275 eo_manual_free(obj); 241 eo_manual_free(obj);
276 242
277 _man_should_con = EINA_FALSE; 243 _man_should_con = EINA_FALSE;
278 klass = eo_class_new(&class_desc, 0, EO_BASE_CLASS, NULL); 244 klass = eo_class_new(&class_desc, EO_BASE_CLASS, NULL);
279 fail_if(!klass); 245 fail_if(!klass);
280 246
281 obj = eo_add(klass, NULL); 247 obj = eo_add(klass, NULL);
@@ -467,7 +433,7 @@ START_TEST(eo_op_errors)
467 NULL 433 NULL
468 }; 434 };
469 435
470 const Eo_Class *klass = eo_class_new(&class_desc, 0, SIMPLE_CLASS, NULL); 436 const Eo_Class *klass = eo_class_new(&class_desc, SIMPLE_CLASS, NULL);
471 fail_if(!klass); 437 fail_if(!klass);
472 438
473 Eo *obj = eo_add(klass, NULL); 439 Eo *obj = eo_add(klass, NULL);
@@ -605,7 +571,7 @@ START_TEST(eo_magic_checks)
605 eo_class_do((Eo_Class *) buf, NULL); 571 eo_class_do((Eo_Class *) buf, NULL);
606 eo_class_do_super((Eo_Class *) buf, EO_NOOP); 572 eo_class_do_super((Eo_Class *) buf, EO_NOOP);
607 573
608 fail_if(eo_class_new(NULL, 0, (Eo_Class *) buf), NULL); 574 fail_if(eo_class_new(NULL, (Eo_Class *) buf), NULL);
609 575
610 eo_xref(obj, (Eo *) buf); 576 eo_xref(obj, (Eo *) buf);
611 eo_xunref(obj, (Eo *) buf); 577 eo_xunref(obj, (Eo *) buf);
@@ -714,7 +680,7 @@ START_TEST(eo_multiple_do)
714 NULL 680 NULL
715 }; 681 };
716 682
717 const Eo_Class *klass = eo_class_new(&class_desc, 0, SIMPLE_CLASS, NULL); 683 const Eo_Class *klass = eo_class_new(&class_desc, SIMPLE_CLASS, NULL);
718 fail_if(!klass); 684 fail_if(!klass);
719 685
720 Eo *obj = eo_add(klass, NULL); 686 Eo *obj = eo_add(klass, NULL);
@@ -739,7 +705,6 @@ void eo_test_general(TCase *tc)
739 tcase_add_test(tc, eo_magic_checks); 705 tcase_add_test(tc, eo_magic_checks);
740 tcase_add_test(tc, eo_data_fetch); 706 tcase_add_test(tc, eo_data_fetch);
741 tcase_add_test(tc, eo_man_free); 707 tcase_add_test(tc, eo_man_free);
742 tcase_add_test(tc, eo_static_classes);
743 tcase_add_test(tc, eo_composite_tests); 708 tcase_add_test(tc, eo_composite_tests);
744 tcase_add_test(tc, eo_isa_tests); 709 tcase_add_test(tc, eo_isa_tests);
745 tcase_add_test(tc, eo_multiple_do); 710 tcase_add_test(tc, eo_multiple_do);