Commit Graph

194 Commits

Author SHA1 Message Date
Jérémy Zurcher 541cf25723 eo2: eo2_add_internal_end() return NULL if do_error is set 2014-04-10 04:20:19 +01:00
Jérémy Zurcher 9c1856bf82 eo2: support NULL op_descs 2014-04-10 04:20:19 +01:00
Jérémy Zurcher 11595dc40c eo2: fix mixim elaboration
a mixin class must not inherit
- _eo2_api_desc_get()
      accept NULL klass param
      EO_CLASS_TYPE_REGULAR_NO_INSTANT is an acceptable extension class type for
- _eo2_class_funcs_set() do not shout if parent is NULL
2014-04-10 04:20:18 +01:00
Jérémy Zurcher 23e2c29298 eo2: remove EO2_CLASS_FUNC_* macros
there is no more difference in class or regular functions prototypes and definitions

- eo2_api_op_id_get() uses _eo_is_a_class() at runtime
- add 'void *class_data EINA_UNUSED' parameter to eo2_base class functions
- Eo2_Op_Call_Data.klass is kept only for eo2_hook_call_pre end eo2_hook_call_post,
  but could be removed easily
2014-04-10 04:20:18 +01:00
Tom Hacohen 5e92ffb121 eo2: improved error messages on failed resolves. 2014-04-10 04:20:18 +01:00
Jérémy Zurcher eb01d1c3e8 eo2: add EO2_CLASS_CLASS 2014-04-10 04:20:18 +01:00
Jérémy Zurcher 47d560b720 eo2: support composites object
_eo2_api_desc_get() searches extensions classes
eo2_call_resolve() searches composites objects
2014-04-10 04:20:18 +01:00
Jérémy Zurcher 2e9ae2a571 eo2: optimize eo2_call_resolve and call stack 2014-04-10 04:20:18 +01:00
Jérémy Zurcher e51e397b89 eo2: fix eo_base_data_get(), eo_composite_attach(), eo_composite_detach() 2014-04-10 04:20:18 +01:00
Jérémy Zurcher fc448f89af eo2: clean up and speed up call stack usage 2014-04-10 04:20:18 +01:00
Jérémy Zurcher 4bbd97913d eo2: eo2_add_internal_start use trash and fix MAGIC 2014-04-10 04:20:18 +01:00
Jérémy Zurcher 782092f7af eo2: eo2_do() and eo2_do_super() supports objects and classes 2014-04-10 04:20:18 +01:00
Jérémy Zurcher 93f85f095e eo2: rewrite eo2_do_start(...)
we need Eo_Class *cur_klass for eo2_do_super
 be sure not to update stack pointer before we can't fail anymore
2014-04-10 04:20:18 +01:00
Jérémy Zurcher 2be91e465a eo2: change a few variable names
in the EPAI, don't show that Eo* could be IDs.
in the implementation, use klass_id and obj_id
if you know or want it to be a class or an object,
use eo_id in general cases.
2014-04-10 04:20:18 +01:00
Jérémy Zurcher c9ccc700fd eo2: add eo2_parent_set(), eo2_parent_get(), eo2_children_iterator_new()
imported from eo_base_class.c as is in
a7f417e 2013-12-24 23:45:30 +0900 <Carsten Haitzler (Rasterman)>
2014-04-10 04:20:17 +01:00
Jérémy Zurcher 796b151c27 eo2: minor fixes after huge rebase
indentation
use _Eo_Object * instead of _Eo *
use EO_CLASS_POINTER_RETURN_VAL(), _eo_id_get(), and _eo_class_id_get().
2014-04-10 04:20:17 +01:00
Jérémy Zurcher 3a86881941 eo2: eo2_do_start use EO_OBJ_POINTER_ macros not _eo_obj_pointer_get 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 74f7bf3633 eo2: eo2_call_resolve_internal support undef HAVE_EO_ID 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 2af0764eeb eo2: _eo2_api_desc_get: walks in mro not in klass->parent 2014-04-10 04:20:17 +01:00
Jérémy Zurcher fe23e26d0e eo2: add DBG msg in eo2_class_funcs_set 2014-04-10 04:20:17 +01:00
Cedric Bail 8613ebe403 eo2: memset will be faster, still why not using NULL instead of -1 ? 2014-04-10 04:20:17 +01:00
Cedric Bail 0b279b600e eo2: we can rely on LD_PRELOAD for those hook, so removing them. 2014-04-10 04:20:17 +01:00
Cedric Bail 4b97591634 eo2: add hook for beinning and start of all function execution and for all _do.
NOTE: I don't know what the _CLASS_FUNC are, so I may have broken stuff there.
2014-04-10 04:20:17 +01:00
Jérémy Zurcher bbab74320a eo2: fix eo2 custom constructors 2014-04-10 04:20:17 +01:00
Jérémy Zurcher ebc90200a6 eo2: sprinkle with 'const' 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 8959832be4 eo2: fixed EO2_CLASS_FUNC_BODY and etc. functions. 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 4f73887b47 eo2: remove EO2_OP_FUNC_VIRTUAL
a pure virtual function is an EO2_OP_FUNC
with NULL as private function implementation pointer
2014-04-10 04:20:17 +01:00
Tom Hacohen 5f45e57b89 eo2: revert "eo2_add accepts non-defauld constructors"
We want to have normal functions as non-default constructors, not va_arg
ones. What we should do is split the object creation to two parts again.
The creation, the constructing (changes using the macro) and the
verification/end part that checks the constructor has been called.

This reverts commit 2ff2ce1894f173b306a896bda595e1a7768c074d.
2014-04-10 04:20:17 +01:00
Jérémy Zurcher 7be0748b34 eo2: implement class function support 2014-04-10 04:20:17 +01:00
Jérémy Zurcher e82c0f6bf7 eo2: fix indent 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 42ad23c5c8 eo2: eo2_add accepts non-defauld constructors 2014-04-10 04:20:17 +01:00
Jérémy Zurcher 2d5baec80c eo2: call _eo2_class_funcs_set from _eo_class_constructor 2014-04-10 04:20:16 +01:00
Jérémy Zurcher b6991985ed eo2: eo2_do() uses __attribute__ cleanup
to protect us against bad use of break, goto, return ... in eo2_do,
we use __attribute__((cleanup(eo2_do_end))) to ensure that eo2_do_end()
is called whatever.
2014-04-10 04:20:16 +01:00
Jérémy Zurcher adc1ac0c23 eo2: add eo2_call_stack_depth 2014-04-10 04:20:16 +01:00
Jérémy Zurcher eeff3e898c eo2: EO2_CALL_STACK_SIZE -> EO2_CALL_STACK_DEPTH 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 1aa3b1536f eo2: add virtual func support 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 13b1d03def eo2: _eo2_api_desc_get() searches the class hierarchy 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 5febcc9ff1 eo2: oops, forgot to init desc to NULL in eo2_api_op_id_get() 2014-04-10 04:20:16 +01:00
Jérémy Zurcher d61a31a645 eo2: can't detect return in a eo2_do macro, *sigh* 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 9c4731f606 eo2: eo2_api_op_id_get search in parent klasses too 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 1d9d0cee9c eo2: EO2_OP_FUNC_OVERRIDE copy doc from overriden func 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 2edd305507 eo2: set eo2_constructor and eo2_destructor chaining 2014-04-10 04:20:16 +01:00
Jérémy Zurcher 7621758c80 eo2: use EO2_VERSION 2014-04-10 04:20:16 +01:00
Jérémy Zurcher c17a30dfb9 eo2: add cur_klass in call Stack and eo2_do_super
in eo2_do_start(), reuse previous stack fetched pointers when possible
2014-04-10 04:20:16 +01:00
Jérémy Zurcher 68fb3d4c03 eo2: improve func overriding
add klass_id parameter to eo2_get_op_id()
in op descriptions, allow NULL fct pointer for virtual,
and use EO2_OP_OVERRIDE to declare overriding.
2014-04-10 04:20:16 +01:00
Jérémy Zurcher 6a16edc888 eo2: call stack Proof Of Concept
no grow/shrink or thread local storage
2014-04-10 04:20:16 +01:00
Jérémy Zurcher 2490a1bef2 eo2: better op_descs integration
struct _Eo_Class_Description swallows
Eo2_Op_Description *descs2;
2014-04-10 04:20:15 +01:00
Jérémy Zurcher f05f51dd60 eo2: _Eo_Class_Description swallows op_descs
remove OpDescs argument from macros,
eo2_get_op_id() uses binary search
2014-04-10 04:20:15 +01:00
Jérémy Zurcher bc6019c154 eo2: add comments end clean up 2014-04-10 04:20:15 +01:00
Jérémy Zurcher 23ae1fc453 eo2: use internal unref, break if eo2_start returns NULL 2014-04-10 04:20:15 +01:00
Jérémy Zurcher 473609e1d3 eo2: eliminate the need of OPID and Eo_Op_Func_Description
at class elaboration, sort the op descriptions using the function pointer.
when calling a function, do a dichotomic search in the
class op descriptions to find the corresponding OP_ID,
then keep it in a static variable.
2014-04-10 04:20:15 +01:00
Jérémy Zurcher ef873b7b29 eo2: fix obj_data retrieval and speed up
obj_data which is built from func->src not obj->klass.
replace eo2_func_get() and eo2_data_scope_get() calls
with one call to eo2_call_resolve().
2014-04-10 04:20:15 +01:00
Jérémy Zurcher 71341334a9 eo2: add eo2_data_scope_get()
use it in function body
2014-04-10 04:20:15 +01:00
Tom Hacohen 35856fdd13 eo2: Eo2 first commit. 2014-04-10 04:20:15 +01:00
Tom Hacohen 8955c514c7 Eo: all classes are allowed in extension list.
All classes are allowed, because all classes can be used as interfaces in
order to override behaviour. This is especially needed for mixins and broke
the eo2 tests.
2014-04-01 14:22:00 +01:00
Stefan Schmidt 3716e9b12c eo: Make sure we have a va_end matching the va_start before returning.
Was fien on the normal path but missing on the error path. Also remove
the spurious break after the return. Would never be reached. Looks like
a copy and paste bug to me.

CID 1187638
2014-03-19 16:46:36 +01:00
Tom Hacohen e280f32c01 Eo: removed redundant macro. 2014-03-11 15:58:43 +00:00
Tom Hacohen 122a2f890e Eo: Made eo id for classes a bit more secure.
This patch sets the one before most significant bit on for classes. This
means that class ids are now very big, compared to the old ids which
were growing small integers (1, 2, 3...).
This makes accidental passing of integers (corrupted obj pointers) less
common.

@feature
2014-03-11 15:56:30 +00:00
Jérémy Zurcher ef09ef7489 eo: replace composite_objects Eina_List with an array of Eo_Object*
as we don't support multiple composites of the same class,
and know at class elaboration how many composites we should have,
we can create the composites array and pack it at the end of the object.
2014-03-05 23:57:39 +01:00
Jérémy Zurcher b763db3666 eo: memory waste at mixin class elaboration
@fix

mixins data offsets are stored in Eo_Extension_Data_Offset[],
if the constructed class is a mixin, do not reserve space for its
private data, the class is in mixins list and will be handled at
Eo_Extension_Data_Offset computation.

see  _eo_data_scope_get(...) for private data retrieval
2014-03-05 22:44:21 +01:00
Jérémy Zurcher c7922f92bc eo: revert 13502a1 and 7821df1
I'm running out of time, will look at it later
2014-02-27 15:02:45 +01:00
Jérémy Zurcher 2d52015823 eo: first check class desc in eo_class_new 2014-02-26 16:25:01 +01:00
Jérémy Zurcher 7821df17dc eo: replace composite_objects Eina_List with an array of Eo_Object*
as we don't support multiple composites of the same class,
and know at class elaboration how many composites we should have,
we can create the composites array and pack it at the end of the object.
2014-02-26 16:25:00 +01:00
Jérémy Zurcher 5be3b666b2 eo: block regular non-instantiable classes in class extension list 2014-02-26 16:25:00 +01:00
Jérémy Zurcher e199230615 eo: eo_composite_attach check composite class, disallow duplicates
eo_composite_attach fail if the class of the composite is not
listed in the parent class extensions, or if there is already a
composite of the same class. The later because calls are
forwarded to the first responding composite, see _eo_op_internal().
2014-02-26 16:25:00 +01:00
Tom Hacohen 05d2701474 Eo: Fixed eo_manual_free to always return a value.
I wonder how come this wasn't triggered in 64bit and only in 32.
2013-11-26 13:08:55 +00:00
Tom Hacohen d6ac2464bb Eo: Make eo_manual_free() return a success flag.
eo_manual_free() can fail in some cases, and it is useful for users of
this API to know about it in order to decide what to do.
2013-11-26 12:10:53 +00:00
Jérémy Zurcher 1648b67c5b eo: add EO_CLASS_CLASS
it's an empty class without operations,
used as a return value for eo_class_get() when the caller is a class
2013-10-13 00:00:13 +02:00
Cedric Bail 435caae51a eo: use Eina_Spinlock instead of Eina_Lock.
This is an ABI/API break for Eo, you will need to rebuild everything that use Eo.
2013-10-11 11:08:17 +09:00
Tom Hacohen baf0fc4268 Eo: Don't compare desc to NULL as it can never be NULL at that stage.
Fixes coverity CID1039420.
2013-09-30 14:32:47 +01:00
Tom Hacohen 42d29b55e5 Eo: don't va_start without a matching va_end.
Fixes coverity CID1099707.
2013-09-30 14:10:21 +01:00
Tom Hacohen 8ca320a1fc Eo: don't va_start without a matching va_end.
Fixes coverity CID1099708.
2013-09-30 14:07:20 +01:00
Tom Hacohen cb92a60a61 Eo: merge _eo_obj_dov_internal and _eo_class_dov_internal.
They are the same except for really minor differences.
2013-09-27 17:21:08 +01:00
Tom Hacohen 7ed7d7da8b Eo: class_get on a class should not return itself.
This is there until we create a Class class of which all classes are
instances.
2013-09-27 16:50:34 +01:00
Tom Hacohen 832fc5b5ce Manually revert "eo: replace Eo_Class with Eo"
This reverts commit ee1b0833ed

I did it manually because the code changed too much.

We actually want this type, it makes things more clear and easier to
understand.
2013-09-27 16:40:32 +01:00
Tom Hacohen ba5af54f6d Eo: Fixed the type _eo_id_get accepts. 2013-09-27 14:01:47 +01:00
Tom Hacohen 01effff86f Eo: Get rid of the _Eo type, it's not needed.
We have Eo_Base for that.
2013-09-27 14:01:47 +01:00
Tom Hacohen c64637e500 Eo: Use __FILE__ and __LINE__ instead of random values. 2013-09-27 14:01:47 +01:00
Tom Hacohen 1059f802bf Eo: Rename Eo_Header to Eo_Base. 2013-09-27 14:01:47 +01:00
Tom Hacohen e17e66db8c Eo: Get rid of handle. Use the shared header for detection. 2013-09-27 14:01:47 +01:00
Tom Hacohen 5e90d51013 Eo: Merge common part of class and object.
First step toward getting rid of "handle".
2013-09-27 14:01:47 +01:00
Tom Hacohen 8dbbc16731 Eo: Class_Id and Object_Id are now the same type. 2013-09-27 14:01:47 +01:00
Tom Hacohen 2a82ff95e4 Eo: unify the class func and normal func prototypes.
Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:47 +01:00
Tom Hacohen 298527191e Eo: Fixed unused warnings when have EO_ID. 2013-09-27 14:01:47 +01:00
Jérémy Zurcher 9fa35820ca eo: ojb_ref -> class_ref 2013-09-27 14:01:46 +01:00
Jérémy Zurcher f4c1bff0f3 eo: eo_do_super_internal() supports objects and classes
eo_class_do_super() macro calls eo_do_super()
eo_class_do_super_internal() and _eo_class_op_internal() are removed

Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher c4b40aae0d eo: eo_class_get() supports objects and classes 2013-09-27 14:01:46 +01:00
Jérémy Zurcher 8855024e16 eo: eo_class_name_get() supports objects and classes 2013-09-27 14:01:46 +01:00
Jérémy Zurcher ef62885c93 eo: eo_vdo_internal() supports objects and classes
Conflicts:
	src/lib/eo/Eo.h
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher 12bfc76483 eo: eo_do_internal() supports objects and classes
eo_class_do() macro calls eo_do()
eo_class_do_internal()  is removed
op_type argument is remove from eo_do, eo_vdo_internal

Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher f43287a261 eo: add _eo_is_a_class(const Eo *obj_id) 2013-09-27 14:01:46 +01:00
Jérémy Zurcher 41bd91379e eo: _Eo -> _Eo_Object
Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Jérémy Zurcher ee1b0833ed eo: replace Eo_Class with Eo 2013-09-27 14:01:46 +01:00
Jérémy Zurcher 5913f78b4f eo: if !HAVE_EO_ID front-pad _Eo_Class and _Eo_Object with _Eo_Handle
this is the first step on the road to remove class specific EAPI from Eo.h
using this handle we will know if a Eo* is a class or an object pointer

Conflicts:
	src/lib/eo/eo.c
2013-09-27 14:01:46 +01:00
Tom Hacohen 1845ffe5b0 Eo: remove the classe's EINA_MAGIC when using eo_id. 2013-09-26 16:26:55 +01:00
Cedric Bail 936a8072f2 eo: make eo_parent_get/set part of eo_base_class. 2013-09-25 13:34:18 +09:00
Jérémy Zurcher 2041e995fc eo: fix EO_DEBUG compilation 2013-09-23 11:07:07 +02:00
Cedric Bail 7f23deb723 eo: fix typo. 2013-09-13 16:46:08 +09:00
Cedric Bail cd77853222 eo: add eo_childrens_iterator_new().
The goal would be to replace the smart children list and friends. The
problem is that they differ in content. Smart children and Eo children are
the same, but Elm children and them differ. If I put this function as a
virtual, it would be possible to override the list of children and if we
start using it in Evas render loop, that could result in "weird" behavior.

I have added the use of a simplified Eina_Trash mempool kind of feature
to have some fast path for allocation if we start using it in Evas render
loop.
2013-09-11 16:08:06 +09:00
Cedric Bail 5290befb53 eo: add a small object cache to make memory recycling faster. 2013-09-11 11:23:50 +09:00