[EGIT] [core/efl] master 01/01: edje_cc: Extract function to build stack ending with wildcard
conr2d pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7c0f1fdd34186220ca01d6b52b02b94cf6db9962 commit 7c0f1fdd34186220ca01d6b52b02b94cf6db9962 Author: Jeeyong UmDate: Fri Nov 10 12:59:55 2017 +0900 edje_cc: Extract function to build stack ending with wildcard --- src/bin/edje/edje_cc_parse.c | 45 ++-- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/bin/edje/edje_cc_parse.c b/src/bin/edje/edje_cc_parse.c index f3afd8a5e7..d8a7802e87 100644 --- a/src/bin/edje/edje_cc_parse.c +++ b/src/bin/edje/edje_cc_parse.c @@ -188,6 +188,23 @@ fill_object_statement_hashes(void) } } +static char * +stack_dup_wildcard(void) +{ + char buf[PATH_MAX] = { 0, }; + char *end; + + strncpy(buf, stack_id(), sizeof(buf) - 1); + + end = strrchr(buf, '.'); + if (end) end++; + else end = buf; + + strcpy(end, "*"); + + return eina_strdup(buf); +} + static void new_object(void) { @@ -219,17 +236,9 @@ new_object(void) sh = eina_hash_find(_new_statement_short_single_hash, id); if (!sh) { - char buf[512] = { 0, }; - char *end; - - strncpy(buf, id, sizeof(buf) - 1); - buf[sizeof(buf) - 1] = 0; - end = strrchr(buf, '.'); - if (end) end++; - else end = buf; - - strcpy(end, "*"); - sh = eina_hash_find(_new_statement_hash, buf); + char *tmp = stack_dup_wildcard(); + sh = eina_hash_find(_new_statement_hash, tmp); + free(tmp); } if ((!sh) && (!did_wildcard) && (!had_quote)) { @@ -260,17 +269,9 @@ new_statement(void) } else { -char buf[512] = { 0, }; -char *end; - -strncpy(buf, id, sizeof(buf) - 1); -buf[sizeof(buf) - 1] = 0; -end = strrchr(buf, '.'); -if (end) end++; -else end = buf; - -strcpy(end, "*"); -sh = eina_hash_find(_new_statement_hash, buf); +char *tmp = stack_dup_wildcard(); +sh = eina_hash_find(_new_statement_hash, tmp); +free(tmp); if (sh) { --
[EGIT] [core/efl] master 01/01: cxx: Fix example for GCC
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=247d25aa99b6dd461ce82f61fa8345f86c157b0f commit 247d25aa99b6dd461ce82f61fa8345f86c157b0f Author: Jean-Philippe AndreDate: Fri Nov 10 12:19:53 2017 +0900 cxx: Fix example for GCC clang has no problem, but GCC complains with "support not implemented" Discovered with distcheck --- src/examples/elementary/clock_cxx_example.cc | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/examples/elementary/clock_cxx_example.cc b/src/examples/elementary/clock_cxx_example.cc index a290c08267..7e30937c2c 100644 --- a/src/examples/elementary/clock_cxx_example.cc +++ b/src/examples/elementary/clock_cxx_example.cc @@ -21,9 +21,14 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) ck2.format_set("%I:%M %p"); bx.pack_end(ck2); + Efl_Time time; + time.tm_hour = 12; + time.tm_min = 42; + time.tm_sec = 59; + efl::ui::Clock ck3(instantiate, win); ck2.format_set("%H:%M:%S"); - ck3.time_set(Efl_Time({.tm_hour = 12, .tm_min = 42, .tm_sec = 59})); + ck3.time_set(time); bx.pack_end(ck3); efl::ui::Clock ck5(instantiate, win); --
[EGIT] [core/efl] master 01/07: triangulator:Added stroke_set api to the triangulator_stroker.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5f9c54a1b2724abcb02ba0a70640a927a1f67ccc commit 5f9c54a1b2724abcb02ba0a70640a927a1f67ccc Author: subhransu mohantyDate: Thu Oct 26 10:59:16 2017 +0900 triangulator:Added stroke_set api to the triangulator_stroker. --- src/static_libs/triangulator/triangulator_stroker.c | 14 ++ src/static_libs/triangulator/triangulator_stroker.h | 5 - 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/static_libs/triangulator/triangulator_stroker.c b/src/static_libs/triangulator/triangulator_stroker.c index a1d06657f0..cf07bec5a3 100644 --- a/src/static_libs/triangulator/triangulator_stroker.c +++ b/src/static_libs/triangulator/triangulator_stroker.c @@ -21,6 +21,20 @@ triangulator_stroker_free(Triangulator_Stroker *stroker) eina_inarray_free(stroker->arc_pts); } +void triangulator_stroker_stroke_set(Triangulator_Stroker *stroker, float width, + Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style, Eina_Matrix3 *m) +{ + float scale_factor = 1.0; + if (m) + { +// get the minimum scale factor from matrix +scale_factor = m->xx < m->yy ? m->xx : m->yy; + } + stroker->width = (width * scale_factor)/2; + stroker->join_style = join_style; + stroker->cap_style = cap_style; +} + // calculate the normal vector static void normal_vector(float x1, float y1, float x2, float y2, float width, diff --git a/src/static_libs/triangulator/triangulator_stroker.h b/src/static_libs/triangulator/triangulator_stroker.h index 2dee4290e4..4cb0f3e2a4 100644 --- a/src/static_libs/triangulator/triangulator_stroker.h +++ b/src/static_libs/triangulator/triangulator_stroker.h @@ -38,6 +38,9 @@ Triangulator_Stroker *triangulator_stroker_new(void); */ void triangulator_stroker_free(Triangulator_Stroker *stroker); +void triangulator_stroker_stroke_set(Triangulator_Stroker *stroker, float width, + Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style, Eina_Matrix3 *m); + /** * Process the command list to generate triangle strips. * The alogrithm handles multiple contour by adding invisible triangles. @@ -48,7 +51,7 @@ void triangulator_stroker_free(Triangulator_Stroker *stroker); * pt_count : number of points. * * output : It generates the outline in the form of triangle strips store in vertices array. - * The array can be used to copy the data to a VBO and draw the data using TRIANGLE_STRIP. + * The array can be used to copy the data to a VBO and draw the data using TRIANGLE_STRIP. */ void triangulator_stroker_process(Triangulator_Stroker *stroker, const Efl_Gfx_Path_Command *cmds, const double *pts, int cmd_count, int pt_count); --
[EGIT] [core/efl] master 05/07: evas/engine: added new engine api for ector
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=befb7701a71e45e9c76fb3873f3056b74d62527c commit befb7701a71e45e9c76fb3873f3056b74d62527c Author: subhransu mohantyDate: Fri Oct 27 13:42:01 2017 +0900 evas/engine: added new engine api for ector --- src/lib/evas/common/evas_common_generic_cache.c| 6 +- src/lib/evas/include/evas_private.h| 6 ++ src/modules/evas/engines/gl_generic/evas_engine.c | 65 +- .../evas/engines/software_generic/evas_engine.c| 53 ++ 4 files changed, 126 insertions(+), 4 deletions(-) diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c index 55fd6e06b2..55bcf725d6 100644 --- a/src/lib/evas/common/evas_common_generic_cache.c +++ b/src/lib/evas/common/evas_common_generic_cache.c @@ -34,7 +34,7 @@ generic_cache_dump(Generic_Cache *cache) } EAPI void -generic_cache_set(Generic_Cache *cache, void *key, void *surface) +generic_cache_data_set(Generic_Cache *cache, void *key, void *surface) { Generic_Cache_Entry *entry = NULL; int count; @@ -59,7 +59,7 @@ generic_cache_set(Generic_Cache *cache, void *key, void *surface) } EAPI void * -generic_cache_get(Generic_Cache *cache, void *key) +generic_cache_data_get(Generic_Cache *cache, void *key) { Generic_Cache_Entry *entry = NULL, *lru_data; Eina_List *l; @@ -84,7 +84,7 @@ generic_cache_get(Generic_Cache *cache, void *key) } EAPI void -generic_cache_drop(Generic_Cache *cache, void *key) +generic_cache_data_drop(Generic_Cache *cache, void *key) { Generic_Cache_Entry *entry = NULL; diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 7ec4095692..2fac91e094 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -1513,6 +1513,12 @@ struct _Evas_Func void* (*ector_new)(void *engine, void *context, Ector_Surface *ector, void *surface); void (*ector_free) (void *engine_data); + void *(*ector_surface_create) (void *engine, int w, int h, int *error); + void (*ector_surface_destroy)(void *engine, void *surface); + void (*ector_surface_cache_set) (void *engine, void *key, void *surface); + void *(*ector_surface_cache_get) (void *engine, void *key); + void (*ector_surface_cache_drop) (void *engine, void *key); + Evas_Filter_Support (*gfx_filter_supports) (void *engine, Evas_Filter_Command *cmd); Eina_Bool (*gfx_filter_process) (void *engine, Evas_Filter_Command *cmd); diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 62f1a38290..6e6d6a9082 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -2623,6 +2623,65 @@ eng_ector_renderer_draw(void *engine EINA_UNUSED, void *data, void *context, voi eina_array_free(c); } +// Ector functions start +static void* +eng_ector_surface_create(void *engine, int width, int height, int *error) +{ + void *surface; + + *error = EINA_FALSE; + + if (use_gl) + { +surface = evas_gl_common_image_surface_new(gl_generic_context_get(engine, EINA_TRUE), + width, height, EINA_TRUE, EINA_FALSE); +if (!surface) *error = EINA_TRUE; + } + else + { +surface = eng_image_new_from_copied_data(engine, width, height, NULL, EINA_TRUE, EVAS_COLORSPACE_ARGB); +if (!surface) + *error = EINA_TRUE; +else //Use this hint for ZERO COPY texture upload. + eng_image_content_hint_set(engine, surface, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); + } + + return surface; +} + +static void +eng_ector_surface_destroy(void *engine, void *surface) +{ + if (!surface) return; + eng_image_free(engine, surface); +} + +static void +eng_ector_surface_cache_set(void *engine, void *key , void *surface) +{ + Render_Engine_GL_Generic *e = engine; + + generic_cache_data_set(e->software.surface_cache, key, surface); + +} + +static void * +eng_ector_surface_cache_get(void *engine, void *key) +{ + Render_Engine_GL_Generic *e = engine; + + return generic_cache_data_get(e->software.surface_cache, key); +} + +static void +eng_ector_surface_cache_drop(void *engine, void *key) +{ + Render_Engine_GL_Generic *e = engine; + + generic_cache_data_drop(e->software.surface_cache, key); +} + + typedef struct _Evas_GL_Ector Evas_GL_Ector; struct _Evas_GL_Ector { @@ -3305,7 +3364,11 @@ module_open(Evas_Module *em) ORD(ector_end); ORD(ector_new); ORD(ector_free); - + ORD(ector_surface_create); + ORD(ector_surface_destroy); + ORD(ector_surface_cache_set); + ORD(ector_surface_cache_get); + ORD(ector_surface_cache_drop); ORD(gfx_filter_supports);
[EGIT] [core/efl] master 03/07: evas/common: added a generic cache in evas common.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d4a2b2025bd1e7396de74c0becb09d4ecbf3b6b9 commit d4a2b2025bd1e7396de74c0becb09d4ecbf3b6b9 Author: subhransu mohantyDate: Thu Nov 9 10:34:01 2017 +0900 evas/common: added a generic cache in evas common. --- src/Makefile_Evas.am| 4 +- src/lib/evas/common/evas_common_generic_cache.c | 104 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index f1d0148667..408c0c7583 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -494,7 +494,9 @@ lib/evas/common/language/evas_language_utils.h \ lib/evas/common/language/evas_script_table.h \ lib/evas/common/evas_text_utils.h \ lib/evas/common/evas_font_ot.h \ -lib/evas/common/evas_font_draw.h +lib/evas/common/evas_font_draw.h \ +lib/evas/common/evas_common_generic_cache.c + lib_evas_libevas_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/evas/canvas \ diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c new file mode 100644 index 00..55fd6e06b2 --- /dev/null +++ b/src/lib/evas/common/evas_common_generic_cache.c @@ -0,0 +1,104 @@ +#include "evas_common_private.h" + +EAPI Generic_Cache* +generic_cache_new(void *user_data, Generic_Cache_Free func) +{ + Generic_Cache *cache; + cache = calloc(1, sizeof(Generic_Cache)); + cache->hash = eina_hash_int32_new(NULL); + cache->user_data = user_data; + cache->free_func = func; + return cache; +} + +EAPI void +generic_cache_destroy(Generic_Cache *cache) +{ + generic_cache_dump(cache); + eina_hash_free(cache->hash); +} + +EAPI void +generic_cache_dump(Generic_Cache *cache) +{ + Generic_Cache_Entry *entry; + if (cache) + { +eina_hash_free_buckets(cache->hash); +EINA_LIST_FREE(cache->lru_list, entry) + { + cache->free_func(cache->user_data, entry->data); + free(entry); + } + } +} + +EAPI void +generic_cache_set(Generic_Cache *cache, void *key, void *surface) +{ + Generic_Cache_Entry *entry = NULL; + int count; + + entry = calloc(1, sizeof(Generic_Cache_Entry)); + entry->key = key; + entry->data = surface; + entry->ref = 1; + eina_hash_add(cache->hash, , entry); + cache->lru_list = eina_list_prepend(cache->lru_list, entry); + count = eina_list_count(cache->lru_list); + if (count > 50) + { + entry = eina_list_data_get(eina_list_last(cache->lru_list)); + // if its still being ref. + if (entry->ref) return; + eina_hash_del(cache->hash, >key, entry); + cache->lru_list = eina_list_remove_list(cache->lru_list, eina_list_last(cache->lru_list)); + cache->free_func(cache->user_data, entry->data); + free(entry); + } +} + +EAPI void * +generic_cache_get(Generic_Cache *cache, void *key) +{ + Generic_Cache_Entry *entry = NULL, *lru_data; + Eina_List *l; + + entry = eina_hash_find(cache->hash, ); + if (entry) + { +// update the ref +entry->ref += 1; +// promote in lru +EINA_LIST_FOREACH(cache->lru_list, l, lru_data) + { +if (lru_data == entry) + { + cache->lru_list = eina_list_promote_list(cache->lru_list, l); + break; + } + } +return entry->data; + } + return NULL; +} + +EAPI void +generic_cache_drop(Generic_Cache *cache, void *key) +{ + Generic_Cache_Entry *entry = NULL; + + entry = eina_hash_find(cache->hash, ); + if (entry) + { +entry->ref -= 1; +// if its still being ref. +if (entry->ref) return; +eina_hash_del(cache->hash, >key, entry); +// find and remove from lru list +cache->lru_list = eina_list_remove(cache->lru_list, entry); +cache->free_func(cache->user_data, entry->data); +free(entry); + } +} + --
[EGIT] [core/efl] master 07/07: evas/vg: use surface cache for efl vg canvas
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=41062cb15d2fecf57d3e649eabdb373f909ca53c commit 41062cb15d2fecf57d3e649eabdb373f909ca53c Author: subhransu mohantyDate: Thu Nov 9 16:57:00 2017 +0900 evas/vg: use surface cache for efl vg canvas --- src/lib/evas/canvas/efl_canvas_vg.c| 257 + src/lib/evas/canvas/evas_vg_private.h | 9 +- src/modules/evas/engines/gl_sdl/evas_engine.c | 1 + .../evas/engines/software_generic/evas_engine.c| 1 - 4 files changed, 225 insertions(+), 43 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg.c b/src/lib/evas/canvas/efl_canvas_vg.c index a869308651..4d204edd41 100644 --- a/src/lib/evas/canvas/efl_canvas_vg.c +++ b/src/lib/evas/canvas/efl_canvas_vg.c @@ -135,18 +135,21 @@ evas_object_vg_add(Evas *e) EOLIAN static Efl_VG * _efl_canvas_vg_root_node_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd) { + Efl_VG *root = NULL; + if (pd->vg_entry) - { -return evas_cache_vg_tree_get(pd->vg_entry); - } - return pd->vg_tree; + root = evas_cache_vg_tree_get(pd->vg_entry); + else if (pd->user_entry) + root = pd->user_entry->root; + + return root; } EOLIAN static void -_efl_canvas_vg_root_node_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, Efl_VG *root_node) +_efl_canvas_vg_root_node_set(Eo *obj, Efl_Canvas_Vg_Data *pd, Efl_VG *root_node) { // if the same root is already set - if (pd->vg_tree == root_node) + if (pd->user_entry && pd->user_entry->root == root_node) return; // check if a file has been already set @@ -157,15 +160,26 @@ _efl_canvas_vg_root_node_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, Efl_VG } // detach/free the old root_node - if (pd->vg_tree) - efl_parent_set(pd->vg_tree, NULL); + if (pd->user_entry && pd->user_entry->root) + efl_parent_set(pd->user_entry->root, NULL); - pd->vg_tree = root_node; - - if (pd->vg_tree) + if (root_node) { +pd->user_entry = calloc(1, sizeof(User_Vg_Entry)); +pd->user_entry->root = root_node; // set the parent so that vg canvas can render it. -efl_parent_set(pd->vg_tree, pd->root); +efl_parent_set(pd->user_entry->root, pd->root); + } + else + { +if (pd->user_entry) + { + // drop any surface cache attached to it. + Evas_Object_Protected_Data *eobj = efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS); + eobj->layer->evas->engine.func->ector_surface_cache_drop(_evas_engine_context(eobj->layer->evas), pd->user_entry); + free(pd->user_entry); + } +pd->user_entry = NULL; } // force a redraw @@ -304,13 +318,8 @@ _cleanup_reference(void *data, const Efl_Event *event EINA_UNUSED) EOLIAN static void _efl_canvas_vg_efl_object_destructor(Eo *eo_obj, Efl_Canvas_Vg_Data *pd) { - Evas_Object_Protected_Data *obj; Evas *e = evas_object_evas_get(eo_obj); - obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); - if (pd->engine_data) - obj->layer->evas->engine.func->ector_free(pd->engine_data); - efl_event_callback_del(e, EFL_CANVAS_EVENT_RENDER_POST, _cleanup_reference, pd); efl_del(pd->root); @@ -376,13 +385,193 @@ _evas_vg_render(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Data *vd, nd = efl_data_scope_get(n, EFL_VG_CLASS); -obj->layer->evas->engine.func->ector_renderer_draw(engine, output, context, surface, vd->engine_data, nd->renderer, clips, do_async); +obj->layer->evas->engine.func->ector_renderer_draw(engine, output, context, surface, nd->renderer, clips, do_async); if (do_async) eina_array_push(>cleanup, efl_ref(nd->renderer)); } } +// renders a vg_tree to an offscreen buffer +// and push it to the cache. +static void * +_render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Data *vd, + void *engine, void *surface, + Efl_VG *root, int w, int h, void *key, + void *buffer, Eina_Bool do_async) +{ + Ector_Surface *ector; + RGBA_Draw_Context *context; + int error = 0; + Eina_Bool buffer_created = EINA_FALSE; + + ector = evas_ector_get(obj->layer->evas); + if (!ector) return NULL; + + if (!buffer) + { +// 2. create a buffer +buffer = obj->layer->evas->engine.func->ector_surface_create(engine, + w, h, + ); +if (error) + return NULL; // surface creation error +buffer_created = EINA_TRUE; + } + + + //1. render pre + _evas_vg_render_pre(root, ector, NULL); + + //3. draw into the buffer + context = evas_common_draw_context_new(); + evas_common_draw_context_set_render_op(context,
[EGIT] [core/efl] master 02/07: ector: move gradient generation api to draw library for reuse.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=76e75dc105ce98b29d5fd9026a0bc2fd18e41acd commit 76e75dc105ce98b29d5fd9026a0bc2fd18e41acd Author: subhransu mohantyDate: Thu Oct 26 11:12:42 2017 +0900 ector: move gradient generation api to draw library for reuse. --- src/lib/ector/software/ector_software_gradient.c | 63 +--- src/static_libs/draw/draw.h | 2 + src/static_libs/draw/draw_main.c | 58 ++ 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/src/lib/ector/software/ector_software_gradient.c b/src/lib/ector/software/ector_software_gradient.c index 2656a1da5f..7f4e916511 100644 --- a/src/lib/ector/software/ector_software_gradient.c +++ b/src/lib/ector/software/ector_software_gradient.c @@ -280,73 +280,14 @@ _linear_helper_sse3(uint32_t *buffer, int length, Ector_Renderer_Software_Gradie #endif -static inline double -_ease_linear(double t) -{ - return t; -} - -static Eina_Bool -_generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_count, uint32_t *color_table, int size) -{ - int dist, idist, pos = 0, i; - Eina_Bool alpha = EINA_FALSE; - Efl_Gfx_Gradient_Stop *curr, *next; - uint32_t current_color, next_color; - double delta, t, incr, fpos; - - assert(stop_count > 0); - - curr = gradient_stops; - if (curr->a != 255) alpha = EINA_TRUE; - current_color = DRAW_ARGB_JOIN(curr->a, curr->r, curr->g, curr->b); - incr = 1.0 / (double)size; - fpos = 1.5 * incr; - - color_table[pos++] = current_color; - - while (fpos <= curr->offset) - { -color_table[pos] = color_table[pos - 1]; -pos++; -fpos += incr; - } - - for (i = 0; i < stop_count - 1; ++i) - { -curr = (gradient_stops + i); -next = (gradient_stops + i + 1); -delta = 1/(next->offset - curr->offset); -if (next->a != 255) alpha = EINA_TRUE; -next_color = DRAW_ARGB_JOIN(next->a, next->r, next->g, next->b); -while (fpos < next->offset && pos < size) - { - t = _ease_linear((fpos - curr->offset) * delta); - dist = (int)(256 * t); - idist = 256 - dist; - color_table[pos] = draw_interpolate_256(current_color, idist, next_color, dist); - ++pos; - fpos += incr; - } -current_color = next_color; - } - - for (;pos < size; ++pos) - color_table[pos] = current_color; - - // Make sure the last color stop is represented at the end of the table - color_table[size-1] = current_color; - return alpha; -} - static void _update_color_table(void *data, Ector_Software_Thread *t EINA_UNUSED) { Ector_Renderer_Software_Gradient_Data *gdata = data; gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4); - gdata->alpha = _generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count, - gdata->color_table, GRADIENT_STOPTABLE_SIZE); + gdata->alpha = efl_draw_generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count, + gdata->color_table, GRADIENT_STOPTABLE_SIZE); } static void diff --git a/src/static_libs/draw/draw.h b/src/static_libs/draw/draw.h index e4f64340f4..825d6338f0 100644 --- a/src/static_libs/draw/draw.h +++ b/src/static_libs/draw/draw.h @@ -29,6 +29,8 @@ Cspace_Convert_Func efl_draw_convert_func_get (Efl_Gfx_Colorspace origcs, int efl_draw_argb_premul(uint32_t *data, unsigned int len); void efl_draw_argb_unpremul(uint32_t *data, unsigned int len); +Eina_Bool efl_draw_generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_count, uint32_t *color_table, int size); + /* common sw draw helpers */ diff --git a/src/static_libs/draw/draw_main.c b/src/static_libs/draw/draw_main.c index 92d2044541..2731514789 100644 --- a/src/static_libs/draw/draw_main.c +++ b/src/static_libs/draw/draw_main.c @@ -276,6 +276,64 @@ efl_draw_func_span_get(Efl_Gfx_Render_Op op, uint32_t color, Eina_Bool src_alpha return func_for_mode[op]; } +static double +_ease_linear(double t) +{ + return t; +} + +Eina_Bool +efl_draw_generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_count, uint32_t *color_table, int size) +{ + int dist, idist, pos = 0, i; + Eina_Bool alpha = EINA_FALSE; + Efl_Gfx_Gradient_Stop *curr, *next; + uint32_t current_color, next_color; + double delta, t, incr, fpos; + + curr = gradient_stops; + if (curr->a != 255) alpha = EINA_TRUE; + current_color = DRAW_ARGB_JOIN(curr->a, curr->r, curr->g, curr->b); + incr = 1.0 / (double)size; + fpos = 1.5 * incr; + + color_table[pos++] = current_color; + + while (fpos <= curr->offset) + { +color_table[pos] = color_table[pos - 1]; +pos++; +fpos += incr;
[EGIT] [core/efl] master 04/07: evas/vg: added support for engine surface cache.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=aacf277c3affcc68806020c1f9e7a44829e1bb74 commit aacf277c3affcc68806020c1f9e7a44829e1bb74 Author: subhransu mohantyDate: Thu Nov 9 10:31:12 2017 +0900 evas/vg: added support for engine surface cache. --- src/lib/evas/include/evas_common_private.h | 28 + src/modules/evas/engines/gl_drm/evas_engine.c | 5 +- src/modules/evas/engines/gl_generic/evas_engine.c | 5 + src/modules/evas/engines/gl_sdl/evas_engine.c | 5 +- src/modules/evas/engines/gl_x11/evas_engine.c | 4 +- .../Evas_Engine_Software_Generic.h | 2 +- .../evas/engines/software_generic/evas_engine.c| 122 +++-- src/modules/evas/engines/wayland_egl/evas_engine.c | 3 +- 8 files changed, 108 insertions(+), 66 deletions(-) diff --git a/src/lib/evas/include/evas_common_private.h b/src/lib/evas/include/evas_common_private.h index 4f731d4e79..6518b16f93 100644 --- a/src/lib/evas/include/evas_common_private.h +++ b/src/lib/evas/include/evas_common_private.h @@ -1174,6 +1174,34 @@ typedef enum _Evas_Render_Mode void evas_common_rgba_image_scalecache_items_ref(Image_Entry *ie, Eina_Array *ret); void evas_common_rgba_image_scalecache_item_unref(Image_Entry *ie); +// Generic Cache +typedef struct _Generic_Cache Generic_Cache; +typedef struct _Generic_Cache_EntryGeneric_Cache_Entry; + +struct _Generic_Cache_Entry +{ + void *key; // pointer + void *data; // engine image + int ref; +}; + +typedef void (*Generic_Cache_Free)(void *user_data, void *data); + +struct _Generic_Cache +{ + Eina_Hash *hash; + Eina_List *lru_list; + void *user_data; + Generic_Cache_Free free_func; +}; + +EAPI Generic_Cache* generic_cache_new(void *user_data, Generic_Cache_Free func); +EAPI void generic_cache_destroy(Generic_Cache *cache); +EAPI void generic_cache_dump(Generic_Cache *cache); +EAPI void generic_cache_data_set(Generic_Cache *cache, void *key, void *data); +EAPI void *generic_cache_data_get(Generic_Cache *cache, void *key); +EAPI void generic_cache_data_drop(Generic_Cache *cache, void *key); + /*/ #ifdef __cplusplus diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c index e1a36940cc..fd219bbd9b 100644 --- a/src/modules/evas/engines/gl_drm/evas_engine.c +++ b/src/modules/evas/engines/gl_drm/evas_engine.c @@ -1070,13 +1070,14 @@ eng_canvas_alpha_get(void *data) } static void -eng_output_dump(void *engine EINA_UNUSED, void *data) +eng_output_dump(void *engine, void *data) { Render_Engine *re; + Render_Engine_GL_Generic *e = engine; re = (Render_Engine *)data; if (!re) return; - + generic_cache_dump(e->software.surface_cache); evas_common_image_image_all_unload(); evas_common_font_font_all_unload(); glsym_evas_gl_common_image_all_unload(eng_get_ob(re)->gl_context); diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index a6b229a5c6..62f1a38290 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -152,6 +152,8 @@ egl_display_get(Render_Engine_GL_Generic *engine) } #endif +void eng_image_free(void *engine, void *image); + static void * eng_engine_new(void) { @@ -159,6 +161,7 @@ eng_engine_new(void) engine = calloc(1, sizeof (Render_Engine_GL_Generic)); if (!engine) return NULL; + engine->software.surface_cache = generic_cache_new(engine, eng_image_free); return engine; } @@ -169,6 +172,8 @@ eng_engine_free(void *engine) Render_Engine_GL_Generic *e = engine; Render_Output_GL_Generic *output; + generic_cache_destroy(e->software.surface_cache); + EINA_LIST_FREE(e->software.outputs, output) ERR("Output %p not properly cleaned before engine destruction.", output); free(e); diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c b/src/modules/evas/engines/gl_sdl/evas_engine.c index bf6ba6540c..8a00b1196b 100644 --- a/src/modules/evas/engines/gl_sdl/evas_engine.c +++ b/src/modules/evas/engines/gl_sdl/evas_engine.c @@ -316,11 +316,13 @@ eng_output_free(void *engine, void *data) } static void -eng_output_dump(void *engine EINA_UNUSED, void *data) +eng_output_dump(void *engine, void *data) { Render_Engine *re; + Render_Engine_GL_Generic *e = engine; re = (Render_Engine *)data; + generic_cache_dump(e->software.surface_cache); evas_common_image_image_all_unload(); evas_common_font_font_all_unload(); glsym_evas_gl_common_image_all_unload(re->generic.software.ob->gl_context); @@ -339,7 +341,6 @@ gl_symbols(void) #define LINK2GENERIC(sym) \ glsym_##sym = dlsym(RTLD_DEFAULT, #sym); -
[EGIT] [core/efl] master 01/01: ecore_evas: improve ecore_evas fallback animator logic for legacy case.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3b7607d7f622ceaab7aa30790ce79b6792f230e1 commit 3b7607d7f622ceaab7aa30790ce79b6792f230e1 Author: Cedric BailDate: Thu Nov 9 18:07:31 2017 -0800 ecore_evas: improve ecore_evas fallback animator logic for legacy case. In Enlightenment with internal window being WL window connected to the X11 backend, you end up with the later requiring the former to tick, even if the former do not have a proper animator source. To work around the problem when there is one backend that is not providing support for animator source, we do need to avoid switching on another window source as they could be linked somehow and we can not know. --- src/lib/ecore_evas/ecore_evas.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 77ab679107..11c043e606 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -3148,6 +3148,7 @@ _ecore_evas_tick_source_find(void) Ecore_Evas *ee; Eina_Bool source = EINA_FALSE; + // Check if we do have a potential tick source for legacy EINA_INLIST_FOREACH(ecore_evases, ee) if (!ee->deleted && ee->engine.func->fn_animator_register && @@ -3157,7 +3158,19 @@ _ecore_evas_tick_source_find(void) break; } - // If no source is available for ticking, fallback to timer. + // If just one source require fallback, we can't be sure that + // we are not running enlightenment and that this source might + // actually be the true tick source of all other window. In + // that scenario, we have to forcefully fallback. + EINA_INLIST_FOREACH(ecore_evases, ee) + if (!ee->deleted && + (!ee->engine.func->fn_animator_register || + !ee->engine.func->fn_animator_unregister)) + { + source = EINA_FALSE; + break; + } + if (!source) { ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); --
[EGIT] [core/efl] master 01/01: ecore_con: add support for EFL_MAIN with ecore_con support.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fee2b1beb4e46b1a3b0509bf407efae243a3536e commit fee2b1beb4e46b1a3b0509bf407efae243a3536e Author: Cedric BailDate: Thu Nov 9 15:25:51 2017 -0800 ecore_con: add support for EFL_MAIN with ecore_con support. --- src/lib/ecore/efl_general.h | 13 - src/lib/ecore_con/Efl_Net.h | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/efl_general.h b/src/lib/ecore/efl_general.h index b4ffdfe97a..c91f61fce2 100644 --- a/src/lib/ecore/efl_general.h +++ b/src/lib/ecore/efl_general.h @@ -10,6 +10,7 @@ #undef __EFL_MAIN_CONSTRUCTOR #undef __EFL_MAIN_DESTRUCTOR #undef __EFL_UI +#undef __EFL_NET #undef EFL_MAIN #undef EFL_MAIN_EX @@ -38,10 +39,14 @@ #endif #define __EFL_MAIN_CONSTRUCTOR \ + __EFL_NET(ecore_con_init();) \ + __EFL_NET(ecore_con_url_init();) \ __EFL_UI(elm_init(argc, argv);) #define __EFL_MAIN_DESTRUCTOR \ - __EFL_UI(elm_shutdown();) + __EFL_UI(elm_shutdown();) \ + __EFL_NET(ecore_con_url_shutdown();) \ + __EFL_NET(ecore_con_shutdown();) #ifdef __EFL_UI_IS_REQUIRED # define __EFL_UI(...) __VA_ARGS__ @@ -49,6 +54,12 @@ # define __EFL_UI(...) #endif +#ifdef __EFL_NET_IS_REQUIRED +# define __EFL_NET(...) __VA_ARGS__ +#else +# define __EFL_NET(...) +#endif + #define _EFL_APP_VERSION_SET() \ do { \ if (efl_build_version_set) \ diff --git a/src/lib/ecore_con/Efl_Net.h b/src/lib/ecore_con/Efl_Net.h index f98ff29ed4..5d163e7efd 100644 --- a/src/lib/ecore_con/Efl_Net.h +++ b/src/lib/ecore_con/Efl_Net.h @@ -8,6 +8,9 @@ #else # include #endif + +#define __EFL_NET_IS_REQUIRED + #include #ifdef EAPI --
[EGIT] [core/efl] master 01/03: elementary: make elm_init and elm_shutdown optional in EFL_MAIN.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4d41f95106bc00e9e59eadca6ecac516a576bd2a commit 4d41f95106bc00e9e59eadca6ecac516a576bd2a Author: Cedric BailDate: Thu Nov 9 14:33:15 2017 -0800 elementary: make elm_init and elm_shutdown optional in EFL_MAIN. --- src/lib/elementary/efl_general.h | 20 src/lib/elementary/elm_general.h | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/efl_general.h b/src/lib/elementary/efl_general.h index 9d7171b05f..4fd4a26ad7 100644 --- a/src/lib/elementary/efl_general.h +++ b/src/lib/elementary/efl_general.h @@ -24,6 +24,18 @@ # define _EFL_BUILD_ID NULL #endif +#define __EFL_MAIN_CONSTRUCTOR \ + __EFL_UI(elm_init(argc, argv);) + +#define __EFL_MAIN_DESTRUCTOR \ + __EFL_UI(elm_shutdown();) + +#ifdef __EFL_UI_IS_REQUIRED +# define __EFL_UI(...) __VA_ARGS__ +#else +# define __EFL_UI(...) +#endif + #define _EFL_APP_VERSION_SET() \ do { \ if (efl_build_version_set) \ @@ -40,10 +52,10 @@ ecore_init(); \ efl_event_callback_add(ecore_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL); \ ecore_init_ex(argc, argv); \ - elm_init(argc, argv); \ + __EFL_MAIN_CONSTRUCTOR;\ ret__ = efl_loop_begin(ecore_main_loop_get()); \ real__ = efl_loop_exit_code_process(ret__);\ - elm_shutdown();\ + __EFL_MAIN_DESTRUCTOR; \ ecore_shutdown_ex(); \ ecore_shutdown(); \ return real__; \ @@ -64,10 +76,10 @@ ecore_init(); \ efl_event_callback_array_add(ecore_main_loop_get(), _efl_main_ex(), NULL); \ ecore_init_ex(argc, argv); \ - elm_init(argc, argv); \ + __EFL_MAIN_CONSTRUCTOR;\ ret__ = efl_loop_begin(ecore_main_loop_get()); \ real__ = efl_loop_exit_code_process(ret__);\ - elm_shutdown();\ + __EFL_MAIN_DESTRUCTOR; \ ecore_shutdown_ex(); \ ecore_shutdown(); \ return real__; \ diff --git a/src/lib/elementary/elm_general.h b/src/lib/elementary/elm_general.h index 5645bf471f..be657e1660 100644 --- a/src/lib/elementary/elm_general.h +++ b/src/lib/elementary/elm_general.h @@ -96,6 +96,8 @@ extern EAPI double _elm_startup_time; #define ELM_MAIN() int main(int argc, char **argv) { int ret__; _elm_startup_time = ecore_time_unix_get(); ret__ = elm_quicklaunch_fallback(argc, argv); elm_shutdown(); return ret__; } #endif +#define __EFL_UI_IS_REQUIRED + #include "Efl_Core.h" #include "efl_general.h" --
[EGIT] [core/efl] master 02/03: elementary: allow efl_general.h to be included multiple time.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=66c46f052832a98b2e6c09d7853e9557f03287c3 commit 66c46f052832a98b2e6c09d7853e9557f03287c3 Author: Cedric BailDate: Thu Nov 9 14:33:46 2017 -0800 elementary: allow efl_general.h to be included multiple time. --- src/lib/elementary/efl_general.h | 13 + 1 file changed, 13 insertions(+) diff --git a/src/lib/elementary/efl_general.h b/src/lib/elementary/efl_general.h index 4fd4a26ad7..b4ffdfe97a 100644 --- a/src/lib/elementary/efl_general.h +++ b/src/lib/elementary/efl_general.h @@ -1,5 +1,18 @@ #ifdef EFL_BETA_API_SUPPORT +// This file is designed to be included again and again +// so cleanup last inclusion before generating this one. +#undef _EFL_VERSION_MICRO +#undef _EFL_VERSION_REVISION +#undef _EFL_VERSION_FLAVOR +#undef _EFL_BUILD_ID +#undef _EFL_APP_VERSION_SET +#undef __EFL_MAIN_CONSTRUCTOR +#undef __EFL_MAIN_DESTRUCTOR +#undef __EFL_UI +#undef EFL_MAIN +#undef EFL_MAIN_EX + #ifdef EFL_VERSION_MICRO # define _EFL_VERSION_MICRO EFL_VERSION_MICRO #else --
[EGIT] [core/efl] master 03/03: ecore: move EFL_MAIN to Efl_Core.h
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=bd83a76393a1e5ceb7f725916a7eb9d41305f788 commit bd83a76393a1e5ceb7f725916a7eb9d41305f788 Author: Cedric BailDate: Thu Nov 9 15:08:40 2017 -0800 ecore: move EFL_MAIN to Efl_Core.h This make EFL_MAIN available and working with just Ecore. For simplicity it is available with Efl_Core.h. Ideally it should also work with Efl_Net.h alone and finally with an Efl_Ui.h. T6262 --- src/Makefile_Ecore.am | 1 + src/Makefile_Elementary.am | 1 - src/lib/ecore/Efl_Core.h| 4 src/lib/{elementary => ecore}/efl_general.h | 0 src/lib/elementary/elm_general.h| 1 - 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am index ad637161b4..02b06f0353 100644 --- a/src/Makefile_Ecore.am +++ b/src/Makefile_Ecore.am @@ -65,6 +65,7 @@ lib/ecore/Ecore_Common.h \ lib/ecore/Ecore_Legacy.h \ lib/ecore/Ecore_Eo.h \ lib/ecore/Efl_Core.h \ +lib/ecore/efl_general.h \ lib/ecore/Ecore_Getopt.h nodist_installed_ecoremainheaders_DATA = \ diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 4101360d7b..1c41f580f7 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -415,7 +415,6 @@ includesub_HEADERS = \ lib/elementary/efl_ui_frame_legacy.h \ lib/elementary/elm_gen.h \ lib/elementary/elm_general.h \ - lib/elementary/efl_general.h \ lib/elementary/elm_gengrid.h \ lib/elementary/elm_gengrid_common.h \ lib/elementary/elm_gengrid_legacy.h \ diff --git a/src/lib/ecore/Efl_Core.h b/src/lib/ecore/Efl_Core.h index a88e5412ed..585f847b55 100644 --- a/src/lib/ecore/Efl_Core.h +++ b/src/lib/ecore/Efl_Core.h @@ -76,3 +76,7 @@ extern EAPI double _efl_startup_time; #define EAPI #endif + +// We are including efl_general.h again, just in case Efl_Core.h was already included before this +// and the __EFL_*_IS_REQUIRED changed since then. +#include "efl_general.h" diff --git a/src/lib/elementary/efl_general.h b/src/lib/ecore/efl_general.h similarity index 100% rename from src/lib/elementary/efl_general.h rename to src/lib/ecore/efl_general.h diff --git a/src/lib/elementary/elm_general.h b/src/lib/elementary/elm_general.h index be657e1660..d718594f8a 100644 --- a/src/lib/elementary/elm_general.h +++ b/src/lib/elementary/elm_general.h @@ -99,7 +99,6 @@ extern EAPI double _elm_startup_time; #define __EFL_UI_IS_REQUIRED #include "Efl_Core.h" -#include "efl_general.h" /**/ /* General calls */ --
[EGIT] [core/efl] master 02/02: wayland_shm: Don't require dmabuf support to use wl_shm
derekf pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ba2abb2eb9e395b049515f70416559982f503b74 commit ba2abb2eb9e395b049515f70416559982f503b74 Author: Derek ForemanDate: Thu Nov 9 16:08:30 2017 -0600 wayland_shm: Don't require dmabuf support to use wl_shm Unintended side effect of my merging of the two code paths. We should still try to use wl_shm if we can't use dmabuf here. --- src/modules/evas/engines/wayland_shm/evas_dmabuf.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c index 77849a4e46..d4b278dd0d 100644 --- a/src/modules/evas/engines/wayland_shm/evas_dmabuf.c +++ b/src/modules/evas/engines/wayland_shm/evas_dmabuf.c @@ -405,9 +405,11 @@ _wl_shm_buffer_manager_setup(int fd EINA_UNUSED) } static Buffer_Manager * -_buffer_manager_get(void) +_buffer_manager_get(Surface_Type types) { int fd; + Eina_Bool dmabuf = types & SURFACE_DMABUF; + Eina_Bool shm = types & SURFACE_SHM; Eina_Bool success = EINA_FALSE; if (buffer_manager) @@ -424,10 +426,10 @@ _buffer_manager_get(void) if (!getenv("EVAS_WAYLAND_SHM_DISABLE_DMABUF")) { -success = _intel_buffer_manager_setup(fd); -if (!success) success = _exynos_buffer_manager_setup(fd); +success = dmabuf && _intel_buffer_manager_setup(fd); +if (!success) success = dmabuf && _exynos_buffer_manager_setup(fd); } - if (!success) success = _wl_shm_buffer_manager_setup(fd); + if (!success) success = shm && _wl_shm_buffer_manager_setup(fd); if (!success) goto err_bm; drm_fd = fd; @@ -736,11 +738,15 @@ _evas_dmabuf_surface_destroy(Surface *s) Eina_Bool _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff) { + Surface_Type types = 0; Dmabuf_Surface *surf = NULL; int i = 0; if (dmabuf_totally_hosed) return EINA_FALSE; - if (!ecore_wl2_display_dmabuf_get(s->info->info.wl2_display)) return EINA_FALSE; + if (ecore_wl2_display_shm_get(s->info->info.wl2_display)) + types |= SURFACE_SHM; + if (ecore_wl2_display_dmabuf_get(s->info->info.wl2_display)) + types |= SURFACE_DMABUF; if (!(s->surf.dmabuf = calloc(1, sizeof(Dmabuf_Surface return EINA_FALSE; surf = s->surf.dmabuf; @@ -754,7 +760,7 @@ _evas_dmabuf_surface_create(Surface *s, int w, int h, int num_buff) surf->buffer = calloc(surf->nbuf, sizeof(Dmabuf_Buffer *)); if (!surf->buffer) goto err; - if (!_buffer_manager_get()) goto err; + if (!_buffer_manager_get(types)) goto err; if (w && h) { --
[EGIT] [core/efl] master 01/02: ecore_wl2: Discard too-old dmabuf support
derekf pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=132a77c6827b91eba3fa3094afd99ef9efa8e058 commit 132a77c6827b91eba3fa3094afd99ef9efa8e058 Author: Derek ForemanDate: Thu Nov 9 16:06:42 2017 -0600 ecore_wl2: Discard too-old dmabuf support We need at least version 2 for create_immed, so don't even bind the global if it's useless to us. This will also stop us from trying to use dmabuf (and getting killed by the compositor) on older compositors that don't support the version we need - we'll just use wl_shm instead when this pointer is NULL. --- src/lib/ecore_wl2/ecore_wl2_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index 1a2a24ef55..eb7252a80e 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -276,7 +276,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const ewd->wl.shm = wl_registry_bind(registry, id, _shm_interface, 1); } - else if (!strcmp(interface, "zwp_linux_dmabuf_v1")) + else if (!strcmp(interface, "zwp_linux_dmabuf_v1") && (version >= 2)) { ewd->wl.dmabuf = wl_registry_bind(registry, id, _linux_dmabuf_v1_interface, 2); --
[EGIT] [tools/examples] master 01/01: eina-iterator: Add first reference example
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/examples.git/commit/?id=ad5287a9e3e044b94df5b46353be0762822619c7 commit ad5287a9e3e044b94df5b46353be0762822619c7 Author: Andy WilliamsDate: Thu Nov 9 18:46:02 2017 + eina-iterator: Add first reference example --- reference/c/eina-iterator/meson.build | 13 reference/c/eina-iterator/src/eina_iterator_main.c | 87 ++ reference/c/eina-iterator/src/meson.build | 12 +++ 3 files changed, 112 insertions(+) diff --git a/reference/c/eina-iterator/meson.build b/reference/c/eina-iterator/meson.build new file mode 100644 index 000..b3c1309 --- /dev/null +++ b/reference/c/eina-iterator/meson.build @@ -0,0 +1,13 @@ +project( + 'efl-reference-eina-iterator', 'c', + version : '0.0.1', + default_options: [ 'c_std=gnu99', 'warning_level=2' ], + meson_version : '>= 0.38.0') + +eina = dependency('eina', version : '>=1.20.99') +efl = dependency('efl', version : '>=1.20.99') +elm = dependency('elementary', version : '>=1.20.99') + +inc = include_directories('.') +subdir('src') + diff --git a/reference/c/eina-iterator/src/eina_iterator_main.c b/reference/c/eina-iterator/src/eina_iterator_main.c new file mode 100644 index 000..c0895d0 --- /dev/null +++ b/reference/c/eina-iterator/src/eina_iterator_main.c @@ -0,0 +1,87 @@ +#define EFL_EO_API_SUPPORT 1 +#define EFL_BETA_API_SUPPORT 1 + +#include +#include + +#include +#include + +static Eina_Bool +_print_item(const void *container EINA_UNUSED, void *data, void *fdata EINA_UNUSED) +{ + printf("%s\n", (char*)data); + return EINA_TRUE; +} + +static void +_print_container(Eina_Iterator *it) +{ + printf("--start--\n"); + eina_iterator_foreach(it, _print_item, NULL); + printf("-- end --\n"); +} + +static Eina_Array * +_create_array() +{ + const char *strings[] = + { + "name strings", + "husker", + "starbuck", + "boomer" + }; + + Eina_Array *array; + int i; + + array = eina_array_new(4); + for (i = 0; i < 4; i++) + eina_array_push(array, strings[i]); + + return array; +} + +static Eina_List * +_create_list() +{ + const char *more_strings[] = { + "sentence strings", + "what do your hear?", + "nothing but the rain", + "then grab your gun and bring the cat in" + }; + + Eina_List *list = NULL; + int i; + + for (i = 0; i < 4; i++) + list = eina_list_append(list, more_strings[i]); + + return list; +} + +EAPI_MAIN void +efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) +{ + Eina_Array *array; + Eina_List *list; + Eina_Iterator *it; + + array = _create_array(); + it = eina_array_iterator_new(array); + _print_container(it); + eina_iterator_free(it); + eina_array_free(array); + + list = _create_list(); + it = eina_list_iterator_new(list); + _print_container(it); + eina_iterator_free(it); + eina_list_free(list); + + efl_exit(0); +} +EFL_MAIN() + diff --git a/reference/c/eina-iterator/src/meson.build b/reference/c/eina-iterator/src/meson.build new file mode 100644 index 000..96c3239 --- /dev/null +++ b/reference/c/eina-iterator/src/meson.build @@ -0,0 +1,12 @@ +src = files([ + 'eina_iterator_main.c', +]) + +deps = [eina, efl, elm] + +executable('efl_reference_eina_iterator', src, + dependencies : deps, + include_directories : inc, + install : true +) + --
[EGIT] [core/enlightenment] master 01/01: Make e_gadget_runner.c compile on efl 1.20
derekf pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=db9e70708a809c3b29eb5e5d36f89db6a216 commit db9e70708a809c3b29eb5e5d36f89db6a216 Author: Derek ForemanDate: Thu Nov 9 12:39:24 2017 -0600 Make e_gadget_runner.c compile on efl 1.20 It won't work, but it won't fail to build. Temporary hack until 1.21 is released. --- src/bin/e_gadget_runner.c | 20 1 file changed, 20 insertions(+) diff --git a/src/bin/e_gadget_runner.c b/src/bin/e_gadget_runner.c index 6f14bea91..eb11b6ecb 100644 --- a/src/bin/e_gadget_runner.c +++ b/src/bin/e_gadget_runner.c @@ -8,6 +8,26 @@ # pragma GCC diagnostic ignored "-Wformat-truncation" #endif +#ifndef EFL_VERSION_1_21 +static void efl_wl_aspect_set(Evas_Object *obj EINA_UNUSED, Eina_Bool set EINA_UNUSED) +{ +} + +static void efl_wl_minmax_set(Evas_Object *obj EINA_UNUSED, Eina_Bool set EINA_UNUSED) +{ +} + +static void *efl_wl_global_add(Evas_Object *obj EINA_UNUSED, const void *interface EINA_UNUSED, uint32_t version EINA_UNUSED, void *data EINA_UNUSED, void *bind_cb EINA_UNUSED) +{ + return NULL; +} + +static Eina_Bool efl_wl_surface_extract(Evas_Object *surface EINA_UNUSED) +{ + return EINA_FALSE; +} +#endif + typedef enum { EXIT_MODE_RESTART, --
[EGIT] [tools/examples] master 01/01: Move examples into examples/c/ and rename them to remove the extra namespace
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/examples.git/commit/?id=632662aeeec1c7c50bd23aade401e8dcb6a3723a commit 632662aeeec1c7c50bd23aade401e8dcb6a3723a Author: Andy WilliamsDate: Thu Nov 9 18:18:52 2017 + Move examples into examples/c/ and rename them to remove the extra namespace --- README | 4 ++-- {c-eo-classes => examples/c/eo-classes}/meson.build | 0 {c-eo-classes => examples/c/eo-classes}/src/eo_classes_main.c| 0 {c-eo-classes => examples/c/eo-classes}/src/example_rectangle.c | 0 {c-eo-classes => examples/c/eo-classes}/src/example_rectangle.eo | 0 {c-eo-classes => examples/c/eo-classes}/src/example_shape.c | 0 {c-eo-classes => examples/c/eo-classes}/src/example_shape.eo | 0 {c-eo-classes => examples/c/eo-classes}/src/example_square.c | 0 {c-eo-classes => examples/c/eo-classes}/src/example_square.eo| 0 {c-eo-classes => examples/c/eo-classes}/src/meson.build | 0 {c-eo-intro => examples/c/eo-intro}/meson.build | 0 {c-eo-intro => examples/c/eo-intro}/src/eo_intro_main.c | 0 {c-eo-intro => examples/c/eo-intro}/src/meson.build | 0 {c-eo-refcount => examples/c/eo-refcount}/meson.build| 0 {c-eo-refcount => examples/c/eo-refcount}/src/eo_refcount_main.c | 0 {c-eo-refcount => examples/c/eo-refcount}/src/meson.build| 0 {c-cmdline => examples/c/hello-cmdline}/meson.build | 0 {c-cmdline => examples/c/hello-cmdline}/src/cmdline_main.c | 0 {c-cmdline => examples/c/hello-cmdline}/src/meson.build | 0 {c-gui => examples/c/hello-gui}/meson.build | 0 {c-gui => examples/c/hello-gui}/src/gui_main.c | 0 {c-gui => examples/c/hello-gui}/src/meson.build | 0 {c-lib => examples/c/lib}/meson.build| 0 {c-lib => examples/c/lib}/src/lib/Example.h | 0 {c-lib => examples/c/lib}/src/lib/example.c | 0 {c-lib => examples/c/lib}/src/lib/meson.build| 0 {c-lib => examples/c/lib}/src/meson.build| 0 {c-lib => examples/c/lib}/src/test/meson.build | 0 {c-lib => examples/c/lib}/src/test/runner.c | 0 {c-lib => examples/c/lib}/src/test/suite.h | 0 {c-lib => examples/c/lib}/src/test/test_lib.c| 0 {c-lifecycle => examples/c/lifecycle}/meson.build| 0 {c-lifecycle => examples/c/lifecycle}/src/lifecycle_main.c | 0 {c-lifecycle => examples/c/lifecycle}/src/meson.build| 0 34 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index 19e7bdf..4e3b47c 100644 --- a/README +++ b/README @@ -6,11 +6,11 @@ EFL usage in here should be using the latest APIs where possible and use support For C we are using meson to build - the standard steps are: - * mesin build/ + * meson build/ * cd build * ninja if, however, you have Edi installed then the edi_build command will run the appropriate steps automatically. -Directory naming is - please be careful to namespace example binaries in case they are installed by the user. +Directory naming is // please be careful to namespace example binaries in case they are installed by the user. diff --git a/c-eo-classes/meson.build b/examples/c/eo-classes/meson.build similarity index 100% rename from c-eo-classes/meson.build rename to examples/c/eo-classes/meson.build diff --git a/c-eo-classes/src/eo_classes_main.c b/examples/c/eo-classes/src/eo_classes_main.c similarity index 100% rename from c-eo-classes/src/eo_classes_main.c rename to examples/c/eo-classes/src/eo_classes_main.c diff --git a/c-eo-classes/src/example_rectangle.c b/examples/c/eo-classes/src/example_rectangle.c similarity index 100% rename from c-eo-classes/src/example_rectangle.c rename to examples/c/eo-classes/src/example_rectangle.c diff --git a/c-eo-classes/src/example_rectangle.eo b/examples/c/eo-classes/src/example_rectangle.eo similarity index 100% rename from c-eo-classes/src/example_rectangle.eo rename to examples/c/eo-classes/src/example_rectangle.eo diff --git a/c-eo-classes/src/example_shape.c b/examples/c/eo-classes/src/example_shape.c similarity index 100% rename from c-eo-classes/src/example_shape.c rename to examples/c/eo-classes/src/example_shape.c diff --git a/c-eo-classes/src/example_shape.eo b/examples/c/eo-classes/src/example_shape.eo similarity index 100% rename from c-eo-classes/src/example_shape.eo rename to examples/c/eo-classes/src/example_shape.eo diff --git a/c-eo-classes/src/example_square.c b/examples/c/eo-classes/src/example_square.c similarity index 100% rename from c-eo-classes/src/example_square.c rename to examples/c/eo-classes/src/example_square.c diff --git a/c-eo-classes/src/example_square.eo
[EGIT] [tools/examples] master 01/01: c-eo-classes: Fix out of dir build
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/examples.git/commit/?id=a9a0bd4d5a7c4dc6beb1760748e9460372ab8785 commit a9a0bd4d5a7c4dc6beb1760748e9460372ab8785 Author: Andy WilliamsDate: Thu Nov 9 16:14:30 2017 + c-eo-classes: Fix out of dir build --- c-eo-classes/src/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c-eo-classes/src/meson.build b/c-eo-classes/src/meson.build index 0b7f6ca..419da3d 100644 --- a/c-eo-classes/src/meson.build +++ b/c-eo-classes/src/meson.build @@ -12,9 +12,9 @@ foreach eo : eo_src input : eo_file, output : [eo_file + '.h'], command : [eolian_gen, '-I', eolian.get_pkgconfig_variable('eoincludedir'), - '-I', '../src', + '-I', meson.source_root() + '/src', '-gchi', '-o', 'h:' + eo_file + '.h', - '-o', 'i:../src/' + eo + '.c', + '-o', 'i:' + meson.source_root() + '/src/' + eo + '.c', '-o', 'c:' + eo_file + '.c', '@INPUT@']) endforeach --
[EGIT] [website/www-content] master 01/01: Wiki page sidebar changed with summary [] by Xavi Artigas
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=ec2efd1a8285fcd812161a365226c03d1b2b5572 commit ec2efd1a8285fcd812161a365226c03d1b2b5572 Author: Xavi ArtigasDate: Thu Nov 9 05:59:35 2017 -0800 Wiki page sidebar changed with summary [] by Xavi Artigas --- pages/develop/sidebar.txt | 1 + pages/eina-programming-guide.md.txt| 16 - pages/eina-programming-guide/arrays.md.txt | 714 - .../iterator-functions.md.txt | 24 - pages/eina-programming-guide/lists.md.txt | 647 --- pages/eina-programming-guide/strings.md.txt| 175 - 6 files changed, 1 insertion(+), 1576 deletions(-) diff --git a/pages/develop/sidebar.txt b/pages/develop/sidebar.txt index 8ec15ea8..d59980ad 100644 --- a/pages/develop/sidebar.txt +++ b/pages/develop/sidebar.txt @@ -6,6 +6,7 @@ === Tutorials === * [[/develop/tutorial/c/hello-world | Command Line [Beta]]] * [[/develop/tutorial/c/eo-intro | Introduction to Eo [Beta]]] + * [[/develop/tutorial/c/eo-refcount | Reference Counting in Eo [Beta]]] * [[/develop/legacy/tutorial/start | Stable API Tutorials]] diff --git a/pages/eina-programming-guide.md.txt b/pages/eina-programming-guide.md.txt deleted file mode 100644 index f3e8f0f1.. --- a/pages/eina-programming-guide.md.txt +++ /dev/null @@ -1,16 +0,0 @@ -~~Title: Eina Programming Guide~~ -~~NOCACHE~~ - -# Eina Programming Guide # - -Just a dummy page to contain and index the documents belonging to the Eina programming guide, to wit: - -* [Iterator Functions](https://www.enlightenment.org/eina-programming-guide/iterator-functions.md) -* [Strings](https://www.enlightenment.org/eina-programming-guide/strings.md) -* [Arrays](https://www.enlightenment.org/eina-programming-guide/arrays.md) -* [Lists](https://www.enlightenment.org/eina-programming-guide/lists.md) [UNFINISHED] - - -This can deleted when all the documents in the playground/eina-programming-guide/ namespace have been moved to their final resting place. \ No newline at end of file diff --git a/pages/eina-programming-guide/arrays.md.txt b/pages/eina-programming-guide/arrays.md.txt deleted file mode 100644 index 42362b2c.. --- a/pages/eina-programming-guide/arrays.md.txt +++ /dev/null @@ -1,714 +0,0 @@ -~~Title: Arrays~~ - -# Arrays # - -An array is a data type which describes an ordered collection of values. The values are accessed by their index. - -|INDEX |VALUE | -|--|--| -|0 |value0| -|1 |value1| -|2 |value2| -|3 |value3| -|4 |value4| -|5 |value5| -|6 |value6| -|7 |value7| - -Eina provides 2 array types: the **classic array** and an **inline array**. - -## Creating and Destroying a Classic Array ## - -The ``eina_array_new()`` function creates a new array. You can store strings or objects in the created array. The function returns a new array, or if memory allocation fails, ``NULL``. - -The first parameter of the ``eina_array_new()`` function defines the size of the array allocation step. For example, if you set it to 4, the function returns an array of 4 elements. The next time you grow the array it grows by 4 elements. Unless you have pushed 4 elements inside, it does not grow. But once you add the 5th element, it grows again and becomes an array of 8 elements. The allocation step feature is very useful for optimizing performance, and it also reduces memory fragmentat [...] - -### Creating an Array to Store Strings ### - -First create the array: - -```c -[...] - -// Strings to store in the array -const char* strings[] = -{ - "helo", "hera", "starbuck", "kat", "boomer", - "hotdog", "longshot", "jammer", "crashdown", "hardball", - "duck", "racetrack", "apolo", "husker", "freaker", - "skulls", "bulldog", "flat top", "hammerhead", "gonzo" -}; -// Declaring the array (type Eina_Array) -Eina_Array *array; -unsigned int i; - -// Creating the array -array = eina_array_new(20); - -// Inserting elements in the array -for (i = 0; i < 20; i++) - eina_array_push(array, strdup(strings[i])); - -[...] -``` -> **NOTE:** -> ``[...]`` in a Code Block indicates there will usually be code above and below the shown snippet, but that it has been excluded for the sake of brevity. There is no need to type ``[...]`` into your program. - -To change the allocation step, use the ``eina_array_step_set()`` function, the first parameter is the array you want to change, the second parameter is the size of that specific array (retrieved with the ``sizeof()`` function) and the last parameter is the new step size. - -In this example, the array step changes from 20 to 30. - -```c -[...] -eina_array_step_set(array, sizeof(*array), 30); -[...] -``` - -When no longer used, use the ``eina_array_free()`` function to free the array. It first calls the
[EGIT] [website/www-content] master 01/01: Wiki page eo-intro.md changed with summary [updated link to part 2] by Xavi Artigas
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=f2268dda2e149677a142de2c6ff2e1ad84759854 commit f2268dda2e149677a142de2c6ff2e1ad84759854 Author: Xavi ArtigasDate: Thu Nov 9 05:30:25 2017 -0800 Wiki page eo-intro.md changed with summary [updated link to part 2] by Xavi Artigas --- pages/develop/tutorial/c/eo-intro.md.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/develop/tutorial/c/eo-intro.md.txt b/pages/develop/tutorial/c/eo-intro.md.txt index 956e0f5d..28f0294e 100644 --- a/pages/develop/tutorial/c/eo-intro.md.txt +++ b/pages/develop/tutorial/c/eo-intro.md.txt @@ -288,7 +288,7 @@ At the end of this tutorial you have learned: The following tutorial builds on top of this one, adding instrumentation calls to display the actual values of the different reference counters. ## Further Reading ## -[Introduction to Eo 2](eo-intro-2.md) +[Introduction to Eo 2](eo-refcount.md) :Part two of this tutorial [Setting up the Development Environment](/develop/setup/c/) --
[EGIT] [website/www-content] master 01/01: Wiki page eo-refcount.md changed with summary [created] by Xavi Artigas
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=ed4c57d41131ec00d26f51b11ca617e37221716d commit ed4c57d41131ec00d26f51b11ca617e37221716d Author: Xavi ArtigasDate: Thu Nov 9 05:29:34 2017 -0800 Wiki page eo-refcount.md changed with summary [created] by Xavi Artigas --- pages/develop/tutorial/c/eo-refcount.md.txt | 609 1 file changed, 609 insertions(+) diff --git a/pages/develop/tutorial/c/eo-refcount.md.txt b/pages/develop/tutorial/c/eo-refcount.md.txt new file mode 100644 index ..c1021bc2 --- /dev/null +++ b/pages/develop/tutorial/c/eo-refcount.md.txt @@ -0,0 +1,609 @@ +--- +~~Title: Reference Counting in Eo~~ +--- + +# Reference Counting in Eo # + +The previous tutorial ([Introduction to Eo](eo-intro.md)) explained how Eo objects should be created and destroyed in order to avoid *memory leaks*. The present tutorial shows graphically the inner workings of the reference counting mechanism. + +To do so, some new *instrumentation* techniques are introduced. These techniques allow collecting information about the state of your program, and, although not frequently used in normal applications, they can be useful for debugging purposes. + +## Prerequisites ## + +* Read the [Introduction to Eo](eo-intro.md) tutorial, which is the basis for this one. + +## Step One: Print the Reference Counts ## + +The previous tutorial talked a lot about reference counts, but it never printed one on the screen. This tutorial will begin by doing just that. It turns out this is not a trivial task, and that is why it has been moved to this second tutorial. + +Without further ado: the method to retrieve the reference count of an object is ``efl_ref_count()``. It takes an ``Eo *`` as parameter and returns an integer. + +This tutorial starts where the previous one left off, so here's the final listing from the [Introduction to Eo](eo-intro.md) tutorial: + +```c +#define EFL_EO_API_SUPPORT 1 +#define EFL_BETA_API_SUPPORT 1 + +#include +#include +#include + +#include + +Eo *_root, *_child1, *_child2; + +// Create our test hierarchy +static void +_obj_create() +{ + // First create a root element + _root = efl_add(EFL_MODEL_ITEM_CLASS, NULL, + efl_name_set(efl_added, "Root")); + + // Create the first child element + _child1 = efl_add(EFL_MODEL_ITEM_CLASS, _root, + efl_name_set(efl_added, "Child1")); + + // Create the second child element, this time, with an extra reference + _child2 = efl_add_ref(EFL_MODEL_ITEM_CLASS, _root, + efl_name_set(efl_added, "Child2")); +} + +// Destroy the test hierarchy +static void +_obj_destroy() +{ + // Destroy the root element + printf ("Deleting root...\n"); + efl_unref(_root); + + // Destroy the child2 element, for which we were keeping an extra reference + printf ("Deleting Child2...\n"); + efl_unref(_child2); +} + +EAPI_MAIN void +efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) +{ + // Create all objects + _obj_create(); + + // Destroy all objects + _obj_destroy(); + + // Exit + efl_exit(0); +} +EFL_MAIN() +``` + +Add a new method before ``_obj_create()`` that uses ``efl_ref_count()`` to print the counts of all the objects in a nice table: + +```c +// Prints status of all our objects in a pretty table +static void +_status_print() +{ + printf("Object: %6s %6s %6s\n", "ROOT", "CHILD1", "CHILD2"); + printf("Refcount: %6d %6d %6d\n", + efl_ref_count(_root), + efl_ref_count(_child1), + efl_ref_count(_child2)); +} +``` + +And call this method in a couple of interesting places. For example, in your main function (``efl_main()``) after creating all the objects (``_obj_create()``) and after destroying them (``_obj_destroy()``): + +```c + [...] + // Create all objects + _obj_create(); + + printf ("Initial state:\n"); + _status_print(); + + // Destroy all objects + _obj_destroy(); + + printf ("Final state:\n"); + _status_print(); + [...] +``` + +What do you think is going to happen if you run this program? Go ahead and try. + +The expected behavior is *undefined*, which usually means your program will abort abnormally (commonly known as *crash*). This is what happened: + +You can always ask an object for its internal reference count... as long as the object still exists. The problem with the above code is that when a reference count reaches 0, the object is destroyed. If you still hold a pointer to that object (like ``_root`` or ``_child1``) that pointer is *invalid*, and trying to use it as a parameter to any EFL call will result in *undefined behavior*. + +In summary, the first call to ``_status_print()`` succeeded because the objects where alive, but the second one, after calling ``_obj_destroy()``, crashed because all the objects had been destroyed, and hence their
[EGIT] [website/www-content] master 01/01: Wiki page eo-intro.md changed with summary [fix links] by Xavi Artigas
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=4b3ded5ecf0ee26146c28d620d165e3fdc8635b0 commit 4b3ded5ecf0ee26146c28d620d165e3fdc8635b0 Author: Xavi ArtigasDate: Thu Nov 9 04:25:16 2017 -0800 Wiki page eo-intro.md changed with summary [fix links] by Xavi Artigas --- pages/develop/tutorial/c/eo-intro.md.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/develop/tutorial/c/eo-intro.md.txt b/pages/develop/tutorial/c/eo-intro.md.txt index dfdacc54..956e0f5d 100644 --- a/pages/develop/tutorial/c/eo-intro.md.txt +++ b/pages/develop/tutorial/c/eo-intro.md.txt @@ -17,7 +17,7 @@ Due to its fundamental nature, this tutorial is more theoretic than the average. ## Step One: Object Creation and Destruction ## -Start with the basic EFL application skeleton from the [Hello World tutorial](hello-word.md) and add some placeholder methods that will be filled later on: +Start with the basic EFL application skeleton from the [Hello World tutorial](hello-world.md) and add some placeholder methods that will be filled later on: ```c #define EFL_EO_API_SUPPORT 1 @@ -294,5 +294,5 @@ The following tutorial builds on top of this one, adding instrumentation calls t [Setting up the Development Environment](/develop/setup/c/) :Read this before trying to develop with the EFL -[Hello World tutorial](hello-word.md) +[Hello World tutorial](hello-world.md) :Teaches the basic EFL application skeleton --
[EGIT] [website/www-content] master 01/01: Wiki page eo-intro.md changed with summary [little rephrasing] by Xavi Artigas
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=4650a19d80534e8188435f92b5075986f984d30e commit 4650a19d80534e8188435f92b5075986f984d30e Author: Xavi ArtigasDate: Thu Nov 9 04:21:16 2017 -0800 Wiki page eo-intro.md changed with summary [little rephrasing] by Xavi Artigas --- pages/develop/tutorial/c/eo-intro.md.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/develop/tutorial/c/eo-intro.md.txt b/pages/develop/tutorial/c/eo-intro.md.txt index aff7847d..dfdacc54 100644 --- a/pages/develop/tutorial/c/eo-intro.md.txt +++ b/pages/develop/tutorial/c/eo-intro.md.txt @@ -193,7 +193,7 @@ And now, in the ``_obj_create()`` method, add a new ``efl_add()`` line below the efl_name_set(efl_added, "Child1")); ``` -Here you are creating a new object (of type ``EFL_MODEL_ITEM_CLASS``, again) and setting its parent to ``_root``. As you saw in the previous step, the one reference to the new object belongs to the parent, therefore you need not worry about returning it. It also means that you won't be able to work with this object later on. In fact, you don't event need to keep the ``_child1`` pointer (it's here because you will be using it in the following tutorial). +Here you are creating a new object (of type ``EFL_MODEL_ITEM_CLASS``, again) and setting its parent to ``_root``. As explained in the previous step, since you are giving the object a parent, its one reference now belongs to the parent, therefore you need not worry about returning it. It also means that you won't be able to work with this object later on. In fact, you don't event need to keep the ``_child1`` pointer (it's here because you will be using it in the following tutorial). Add now a second object just below the previous one: --
[EGIT] [website/www-content] master 01/01: Wiki page eo-intro.md changed with summary [] by Xavi Artigas
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=80fd17f16bd0684e1327d841c524d1e70993f1d6 commit 80fd17f16bd0684e1327d841c524d1e70993f1d6 Author: Xavi ArtigasDate: Thu Nov 9 04:09:26 2017 -0800 Wiki page eo-intro.md changed with summary [] by Xavi Artigas --- pages/develop/tutorial/c/eo-intro.md.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/develop/tutorial/c/eo-intro.md.txt b/pages/develop/tutorial/c/eo-intro.md.txt index c3e0b7fa..aff7847d 100644 --- a/pages/develop/tutorial/c/eo-intro.md.txt +++ b/pages/develop/tutorial/c/eo-intro.md.txt @@ -96,7 +96,7 @@ At this point, you have created your first Eo object. It is time now to talk abo ### Reference Counting ### -In the simplest case, when only one piece of code is interacting with an object, you can create the object, use it, and then destroy it. In more complex scenarios though, when different parts of the code use the same object, maybe from different execution threads, it is not easy to know when an object is not in use anymore and can therefore be safely destroyed. +In the simplest case, when only one piece of code is interacting with an object, you can create the object, use it, and then destroy it. In more complex scenarios though, when different parts of the code use the same object, it is not easy to know when an object is not in use anymore and can therefore be safely destroyed. A common approach to this problem is to use the **Reference Counting** technique, in which every object keeps track of how many people (pieces of code) are using it in an internal *reference counter*: --
[EGIT] [website/www-content] master 01/01: Wiki page eo-intro.md changed with summary [Added efl_add_ref() to the Summary] by Xavi Artigas
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=364351986343b599a33615cce3584d1ba8642aaf commit 364351986343b599a33615cce3584d1ba8642aaf Author: Xavi ArtigasDate: Thu Nov 9 03:53:52 2017 -0800 Wiki page eo-intro.md changed with summary [Added efl_add_ref() to the Summary] by Xavi Artigas --- pages/develop/tutorial/c/eo-intro.md.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/develop/tutorial/c/eo-intro.md.txt b/pages/develop/tutorial/c/eo-intro.md.txt index 28948d86..c3e0b7fa 100644 --- a/pages/develop/tutorial/c/eo-intro.md.txt +++ b/pages/develop/tutorial/c/eo-intro.md.txt @@ -283,6 +283,7 @@ At the end of this tutorial you have learned: * Objects are **created** with ``efl_add()``. * ``efl_add()`` creates objects with **one reference**, which belongs to their parent. You don't have to do anything to destroy the objects. * If you do not provide a parent to ``efl_add()`` then the reference belongs to **you**, and you have to return it when you are done working with the object using ``efl_unref()``. +* Objects can be created with an **extra reference** with ``efl_add_ref()``, which is useful if you want to give the object a parent and also start working with it right away. The following tutorial builds on top of this one, adding instrumentation calls to display the actual values of the different reference counters. --
[EGIT] [website/www-content] master 01/01: Wiki page sidebar changed with summary [] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=aaac346546957421ef429b7c18077ab9b9b2d1b4 commit aaac346546957421ef429b7c18077ab9b9b2d1b4 Author: Andrew WilliamsDate: Thu Nov 9 03:53:35 2017 -0800 Wiki page sidebar changed with summary [] by Andrew Williams --- pages/develop/sidebar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/develop/sidebar.txt b/pages/develop/sidebar.txt index 1417c053..8ec15ea8 100644 --- a/pages/develop/sidebar.txt +++ b/pages/develop/sidebar.txt @@ -1,7 +1,7 @@ ~~NOCACHE~~ === Setup === - * [[develop/setup/c/ | Setting up C development [TODO] ]] + * [[/develop/setup/c/ | Setting up C development [TODO]]] === Tutorials === * [[/develop/tutorial/c/hello-world | Command Line [Beta]]] --
[EGIT] [website/www-content] master 01/01: Wiki page sidebar changed with summary [] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=914ae25aae87d64808ea75a2b39ff08e4519b1e5 commit 914ae25aae87d64808ea75a2b39ff08e4519b1e5 Author: Andrew WilliamsDate: Thu Nov 9 03:52:46 2017 -0800 Wiki page sidebar changed with summary [] by Andrew Williams --- pages/develop/sidebar.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pages/develop/sidebar.txt b/pages/develop/sidebar.txt index f8d101c9..1417c053 100644 --- a/pages/develop/sidebar.txt +++ b/pages/develop/sidebar.txt @@ -1,5 +1,8 @@ ~~NOCACHE~~ +=== Setup === + * [[develop/setup/c/ | Setting up C development [TODO] ]] + === Tutorials === * [[/develop/tutorial/c/hello-world | Command Line [Beta]]] * [[/develop/tutorial/c/eo-intro | Introduction to Eo [Beta]]] --
[EGIT] [website/www-content] master 01/01: Wiki page start.md changed with summary [created] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=211b3094d46b6a2887eebd7b00abe74b6e95e53f commit 211b3094d46b6a2887eebd7b00abe74b6e95e53f Author: Andrew WilliamsDate: Thu Nov 9 03:52:05 2017 -0800 Wiki page start.md changed with summary [created] by Andrew Williams --- pages/develop/setup/c/start.md.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pages/develop/setup/c/start.md.txt b/pages/develop/setup/c/start.md.txt new file mode 100644 index ..cbab1714 --- /dev/null +++ b/pages/develop/setup/c/start.md.txt @@ -0,0 +1,3 @@ +# Setting up for development with C # + +TODO \ No newline at end of file --
[EGIT] [website/www-content] master 01/01: Wiki page sidebar changed with summary [] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=615209b00614066ff9d5b5c9eee3f92f1f1a6242 commit 615209b00614066ff9d5b5c9eee3f92f1f1a6242 Author: Andrew WilliamsDate: Thu Nov 9 03:43:05 2017 -0800 Wiki page sidebar changed with summary [] by Andrew Williams --- pages/develop/sidebar.txt | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/develop/sidebar.txt b/pages/develop/sidebar.txt index c104a291..f8d101c9 100644 --- a/pages/develop/sidebar.txt +++ b/pages/develop/sidebar.txt @@ -1,12 +1,12 @@ ~~NOCACHE~~ === Tutorials === - * [[/develop/tutorial/c/hello-world | Command Line]] - * [[/develop/tutorial/c/eo-intro | Introduction to Eo]] + * [[/develop/tutorial/c/hello-world | Command Line [Beta]]] + * [[/develop/tutorial/c/eo-intro | Introduction to Eo [Beta]]] - * [[/develop/legacy/tutorial/start | Legacy Tutorials]] + * [[/develop/legacy/tutorial/start | Stable API Tutorials]] === APIs === - * [[/develop/api/ | C API]] + * [[/develop/api/ | C API [Beta]]] - * [[/develop/legacy/api/c | Legacy C API]] \ No newline at end of file + * [[/develop/legacy/api/c | C Stable API]] \ No newline at end of file --
[EGIT] [website/www-content] master 01/01: Wiki page eo-intro.md changed with summary [Fix link] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=4c6b78f6a2b76a6ff232e9e67072d5275fff94df commit 4c6b78f6a2b76a6ff232e9e67072d5275fff94df Author: Andrew WilliamsDate: Thu Nov 9 03:37:54 2017 -0800 Wiki page eo-intro.md changed with summary [Fix link] by Andrew Williams --- pages/develop/tutorial/c/eo-intro.md.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/develop/tutorial/c/eo-intro.md.txt b/pages/develop/tutorial/c/eo-intro.md.txt index dcfc5e2c..28948d86 100644 --- a/pages/develop/tutorial/c/eo-intro.md.txt +++ b/pages/develop/tutorial/c/eo-intro.md.txt @@ -13,7 +13,7 @@ Due to its fundamental nature, this tutorial is more theoretic than the average. ## Prerequisites ## * Read the [Setting up the Development Environment](/develop/setup/c/) guide so you are able to build and run EFL applications. -* Read the [Hello World tutorial](hello-word.md) so you know the basics of building an EFL application. +* Read the [Hello World tutorial](hello-world.md) so you know the basics of building an EFL application. ## Step One: Object Creation and Destruction ## --
[EGIT] [website/www-content] master 01/01: Wiki page sidebar changed with summary [] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=c6f1e2c0bf1879fe5cce32f13b7cb70f957bb9e7 commit c6f1e2c0bf1879fe5cce32f13b7cb70f957bb9e7 Author: Andrew WilliamsDate: Thu Nov 9 03:32:04 2017 -0800 Wiki page sidebar changed with summary [] by Andrew Williams --- pages/develop/sidebar.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pages/develop/sidebar.txt b/pages/develop/sidebar.txt index 6987c229..c104a291 100644 --- a/pages/develop/sidebar.txt +++ b/pages/develop/sidebar.txt @@ -4,6 +4,9 @@ * [[/develop/tutorial/c/hello-world | Command Line]] * [[/develop/tutorial/c/eo-intro | Introduction to Eo]] + * [[/develop/legacy/tutorial/start | Legacy Tutorials]] + === APIs === * [[/develop/api/ | C API]] + * [[/develop/legacy/api/c | Legacy C API]] \ No newline at end of file --
[EGIT] [website/www-content] master 01/01: Wiki page start changed with summary [] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=ffb49e8973f821a75c6c9c2ebe024025e6cfc6f6 commit ffb49e8973f821a75c6c9c2ebe024025e6cfc6f6 Author: Andrew WilliamsDate: Thu Nov 9 03:31:04 2017 -0800 Wiki page start changed with summary [] by Andrew Williams --- pages/develop/legacy/tutorial/start.txt | 24 1 file changed, 24 insertions(+) diff --git a/pages/develop/legacy/tutorial/start.txt b/pages/develop/legacy/tutorial/start.txt new file mode 100644 index ..023fa3e8 --- /dev/null +++ b/pages/develop/legacy/tutorial/start.txt @@ -0,0 +1,24 @@ +~~Title: EFL Tutorials~~ + + EFL Tutorials + +Here is a selection of tutorials that will help you become familiar with some details of the EFL modules and APIs. You can approach them in any order, make sure you are familiar with the [[develop/efl/start]] guide first. + +=== Tutorials === + + * [[develop/legacy/tutorial/basic_tutorial|Basic Tutorial]] + * [[develop/legacy/tutorial/genlist_tutorial|Genlist Tutorial]] + * [[develop/legacy/tutorial/panes_tutorial|Panes Tutorial]] + * [[develop/legacy/tutorial/form_tutorial|Form Tutorial]] + * [[develop/legacy/tutorial/menu_tutorial|Menu Tutorial]] + * [[develop/legacy/tutorial/naviframe_tutorial|Naviframe Tutorial]] + * [[develop/legacy/tutorial/popup_tutorial|Popup Tutorial]] + * [[develop/legacy/tutorial/gl_2d_tutorial|GL 2D Tutorial]] + * [[develop/legacy/tutorial/preference_tutorial|Preference Tutorial]] + * [[develop/legacy/tutorial/effects_tutorial|Effects Tutorial]] + * [[develop/legacy/tutorial/multimedia_tutorial|Multimedia Tutorial]] + * [[develop/legacy/tutorial/javascript_tutorial|JavaScript Tutorial]] + +=== Samples === + + * [[develop/legacy/samples/elm_min_size_control|Controlling Minimum Size of Widgets]] \ No newline at end of file --
[EGIT] [website/www-content] master 01/01: Wiki page start changed with summary [] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=b6ee2ecb3c6f931971bdc84d2cff89c3c96de292 commit b6ee2ecb3c6f931971bdc84d2cff89c3c96de292 Author: Andrew WilliamsDate: Thu Nov 9 03:31:05 2017 -0800 Wiki page start changed with summary [] by Andrew Williams --- pages/develop/tutorial/start.txt | 25 + 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/pages/develop/tutorial/start.txt b/pages/develop/tutorial/start.txt index 023fa3e8..803b506c 100644 --- a/pages/develop/tutorial/start.txt +++ b/pages/develop/tutorial/start.txt @@ -1,24 +1 @@ -~~Title: EFL Tutorials~~ - - EFL Tutorials - -Here is a selection of tutorials that will help you become familiar with some details of the EFL modules and APIs. You can approach them in any order, make sure you are familiar with the [[develop/efl/start]] guide first. - -=== Tutorials === - - * [[develop/legacy/tutorial/basic_tutorial|Basic Tutorial]] - * [[develop/legacy/tutorial/genlist_tutorial|Genlist Tutorial]] - * [[develop/legacy/tutorial/panes_tutorial|Panes Tutorial]] - * [[develop/legacy/tutorial/form_tutorial|Form Tutorial]] - * [[develop/legacy/tutorial/menu_tutorial|Menu Tutorial]] - * [[develop/legacy/tutorial/naviframe_tutorial|Naviframe Tutorial]] - * [[develop/legacy/tutorial/popup_tutorial|Popup Tutorial]] - * [[develop/legacy/tutorial/gl_2d_tutorial|GL 2D Tutorial]] - * [[develop/legacy/tutorial/preference_tutorial|Preference Tutorial]] - * [[develop/legacy/tutorial/effects_tutorial|Effects Tutorial]] - * [[develop/legacy/tutorial/multimedia_tutorial|Multimedia Tutorial]] - * [[develop/legacy/tutorial/javascript_tutorial|JavaScript Tutorial]] - -=== Samples === - - * [[develop/legacy/samples/elm_min_size_control|Controlling Minimum Size of Widgets]] \ No newline at end of file +This page is redirected to [[:develop:legacy:tutorial:start]]. \ No newline at end of file --
[EGIT] [website/www-content] master 01/01: Wiki page lists.md changed with summary [created] by Paul
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=4d03ebc1859f6a19db345b51fab84331d99e9bf3 commit 4d03ebc1859f6a19db345b51fab84331d99e9bf3 Author: PaulDate: Thu Nov 9 03:26:18 2017 -0800 Wiki page lists.md changed with summary [created] by Paul --- .../tutorial/c/hello-world-alternate.md.txt| 119 pages/eina-programming-guide/lists.md.txt | 647 + 2 files changed, 647 insertions(+), 119 deletions(-) diff --git a/pages/develop/tutorial/c/hello-world-alternate.md.txt b/pages/develop/tutorial/c/hello-world-alternate.md.txt deleted file mode 100644 index 38a3defc.. --- a/pages/develop/tutorial/c/hello-world-alternate.md.txt +++ /dev/null @@ -1,119 +0,0 @@ -~~Title: Tutorial 1: Hello World~~ - -# Tutorial 1: Hello World # - -This tutorial will guide you through the necessary steps to build your first "Hello World" example using the *Enlightenment Foundation Libraries* (EFL). Before continuing make sure you have read the [Setting up the Development Environment](/develop/setup/c/) guide. - -There is very little code in this first tutorial so don't worry if you have little coding experience. The main goal is to build and execute an application using EFL. You will need a basic knowledge of C to get started. - -## Step One: Includes ## - -Using your favorite text editor, create a text file and save it as ``hello-world.c``. Type in the following: - -```c -#include -#include -#include -``` - -The EFL is split into several libraries. You only need to include the ones you actually want to use. In this tutorial we are calling methods from the ``Eina`` and ``Efl`` libraries, therefore we need to include the ``Eina.h`` and ``Efl.h`` headers. - -> **NOTE:** -> The ``Elementary.h`` header is special and required for the program to compile. It will be removed soon, however. - -If you're not sure which libraries your program is actually using just look at the prefix of the EFL methods and macros. In this case we're using ``eina_``, ``EINA_``, ``efl_`` and ``EFL_``. - -You will explore the EFL libraries in greater depth in later tutorials. In the meantime, visit the [List of EFL Libraries](list-of-efl-libraries.md) for an overview of the purpose of each one. - -## Step Two: Main Function ## - -Instead of the ``main()`` function marking the standard C entry point EFL uses ``efl_main()``. Type the following underneath the includes section of your program: - -```c -void -efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) -{ -} -``` - -EFL takes care of all initialization tasks and calls your ``efl_main()`` method when everything is ready. - -We will focus on the ``efl_main()`` parameters in the following tutorial. In this one we're not using them, hence the ``EINA_UNUSED`` macro. This is optional but it gets rid of warnings regarding unused parameters so it's worth having. - -## Step Three: Print "Hello World" ## - -Type the following between the curly brackets of ``efl_main()``: - -```c - printf("Hello World!\n"); -``` - -This is a regular C ``printf()`` which will output the "Hello World" string to the console. - -## Step Four: Exiting ## - -Any programs you create with EFL must always terminate by calling ``efl_exit()``. This is an important difference to the regular C ``main()``, where a program exits when it reaches the end of a method. Enter the following below your ``printf()``: - -```c -efl_exit(0); -``` - -The parameter ``efl_exit()`` is the value your program returns to the operating system. - -## Step Five: Automatic EFL setup and Shutdown ## - -This final piece of "boilerplate" code should be included at the end of every EFL program. Type the following at the very end of your program as the last line: - -```c -EFL_MAIN() -``` - -This defines the real ``main()`` method required by C programs, which deals with initialization and deinitilization tasks. It also eventually calls the ``efl_main()`` method that you defined above. - -This is not mandatory but it simplifies the setup and shutdown processes considerably, so we are going to use it in this series of tutorials. - -## The Complete Program ## - -```c -#include -#include -#include - -void -efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) -{ - printf("Hello World!\n"); - efl_exit(0); -} - -EFL_MAIN() -``` - -## Running the Program ## - -Save the program then build it as outlined in [Setting up the Development Environment](/develop/setup/c/#Building). If you are using the ``gcc`` compiler, run: - -```bash -gcc -o hello-world hello-world.c `pkg-config --cflags --libs eina efl elementary` -DEFL_EO_API_SUPPORT=1 -DEFL_BETA_API_SUPPORT=1 -``` - -If the systems displays no errors, your program should be ready. Test it by typing: - -```bash -./hello-world -``` - -The words ``Hello World!`` will now appear on the screen. - -##
[EGIT] [website/www-content] master 01/01: Wiki page eina-programming-guide.md changed with summary [] by Paul
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=371bac821b21fd0e2b4038cc547a55f9af34fe93 commit 371bac821b21fd0e2b4038cc547a55f9af34fe93 Author: PaulDate: Thu Nov 9 03:27:24 2017 -0800 Wiki page eina-programming-guide.md changed with summary [] by Paul --- pages/eina-programming-guide.md.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pages/eina-programming-guide.md.txt b/pages/eina-programming-guide.md.txt index 94def48c..f3e8f0f1 100644 --- a/pages/eina-programming-guide.md.txt +++ b/pages/eina-programming-guide.md.txt @@ -9,6 +9,8 @@ Just a dummy page to contain and index the documents belonging to the Eina progr * [Iterator Functions](https://www.enlightenment.org/eina-programming-guide/iterator-functions.md) * [Strings](https://www.enlightenment.org/eina-programming-guide/strings.md) +* [Arrays](https://www.enlightenment.org/eina-programming-guide/arrays.md) +* [Lists](https://www.enlightenment.org/eina-programming-guide/lists.md) [UNFINISHED] This can deleted when all the documents in the playground/eina-programming-guide/ namespace have been moved to their final resting place. \ No newline at end of file --
[EGIT] [website/www-content] master 01/01: Wiki page hello-world.md changed with summary [] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=39c6643699b9de9a307cab3c9ddbca7c81a64ca8 commit 39c6643699b9de9a307cab3c9ddbca7c81a64ca8 Author: Andrew WilliamsDate: Thu Nov 9 03:25:55 2017 -0800 Wiki page hello-world.md changed with summary [] by Andrew Williams --- pages/develop/tutorial/c/hello-world.md.txt | 101 ++-- 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/pages/develop/tutorial/c/hello-world.md.txt b/pages/develop/tutorial/c/hello-world.md.txt index ea2249b9..38a3defc 100644 --- a/pages/develop/tutorial/c/hello-world.md.txt +++ b/pages/develop/tutorial/c/hello-world.md.txt @@ -4,54 +4,20 @@ # Tutorial 1: Hello World # -This tutorial will guide you through the necessary steps to build your first "Hello World" example using the *Enlightenment Foundation Libraries* (EFL). Before continuing make sure you have read the [Setting up the development environment](/develop/setup/c/) guide. +This tutorial will guide you through the necessary steps to build your first "Hello World" example using the *Enlightenment Foundation Libraries* (EFL). Before continuing make sure you have read the [Setting up the Development Environment](/develop/setup/c/) guide. There is very little code in this first tutorial so don't worry if you have little coding experience. The main goal is to build and execute an application using EFL. You will need a basic knowledge of C to get started. -## The Program ## +## Step One: Includes ## -Using your favorite text editor, copy the below code into a new file and save as ``hello-world.c``. Don't worry if you don't understand all of it right away, you'll see how each part of the code works in the Walkthrough section below. +Using your favorite text editor, create a text file and save it as ``hello-world.c``. Type in the following: ```c #include #include #include - -void -efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) -{ - printf("Hello World!\n"); - efl_exit(0); -} - -EFL_MAIN() -``` - -Next, build this application as outlined in [Setting up the Development Environment](/develop/setup/c/#Building). If you are using the ``gcc`` compiler, run: - -```bash -gcc -o hello-world hello-world.c `pkg-config --cflags --libs eina efl elementary` -DEFL_EO_API_SUPPORT=1 -DEFL_BETA_API_SUPPORT=1 ``` -If the systems displays no errors, your program should be ready. Test it by typing: - -```bash -./hello-world -``` - -The words ``Hello World!`` will now appear on the screen. - -## Walkthrough ## - -### Includes ### - -Let's start by focusing on the ``include``s section: - -```c -#include -#include -#include -``` The EFL is split into several libraries. You only need to include the ones you actually want to use. In this tutorial we are calling methods from the ``Eina`` and ``Efl`` libraries, therefore we need to include the ``Eina.h`` and ``Efl.h`` headers. > **NOTE:** @@ -59,11 +25,11 @@ The EFL is split into several libraries. You only need to include the ones you a If you're not sure which libraries your program is actually using just look at the prefix of the EFL methods and macros. In this case we're using ``eina_``, ``EINA_``, ``efl_`` and ``EFL_``. -You will explore the EFL libraries in greater depth in later tutorials. In the meantime, visit the [List of EFL Libraries](list-of-efl-libraries.md) for an overview of the purpose of each one. +You will explore the EFL libraries in greater depth in later tutorials. In the meantime, visit the [List of EFL Libraries](list-of-efl-libraries.md) for an overview of the purpose of each one. -### Main Function ### +## Step Two: Main Function ## -Instead of the ``main()`` function marking the standard C entry point EFL uses ``efl_main()``: +Instead of the ``main()`` function marking the standard C entry point EFL uses ``efl_main()``. Type the following underneath the includes section of your program: ```c void @@ -76,15 +42,19 @@ EFL takes care of all initialization tasks and calls your ``efl_main()`` method We will focus on the ``efl_main()`` parameters in the following tutorial. In this one we're not using them, hence the ``EINA_UNUSED`` macro. This is optional but it gets rid of warnings regarding unused parameters so it's worth having. -The next line is a regular C ``printf()`` which will output the "Hello World" string to the console: +## Step Three: Print "Hello World" ## + +Type the following between the curly brackets of ``efl_main()``: ```c printf("Hello World!\n"); ``` -### Exiting ### +This is a regular C ``printf()`` which will output the "Hello World" string to the console. -Any programs you create with EFL must always terminate by calling ``efl_exit()``. This is an important difference to the regular C ``main()``, where a program exits when it reaches the end of a method.
[EGIT] [website/www-content] master 01/01: Wiki page sidebar changed with summary [] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=6a4eaaeaf392227b96f3274710db7c8fcd73af29 commit 6a4eaaeaf392227b96f3274710db7c8fcd73af29 Author: Andrew WilliamsDate: Thu Nov 9 03:26:52 2017 -0800 Wiki page sidebar changed with summary [] by Andrew Williams --- pages/develop/sidebar.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pages/develop/sidebar.txt b/pages/develop/sidebar.txt index d7f306e3..6987c229 100644 --- a/pages/develop/sidebar.txt +++ b/pages/develop/sidebar.txt @@ -1,9 +1,8 @@ ~~NOCACHE~~ === Tutorials === - * [[/develop/tutorial/c/hello-world]] - * [[/develop/tutorial/c/hello-world-alternate]] - * [[/develop/tutorial/c/eo-intro]] + * [[/develop/tutorial/c/hello-world | Command Line]] + * [[/develop/tutorial/c/eo-intro | Introduction to Eo]] === APIs === * [[/develop/api/ | C API]] --
[EGIT] [website/www-content] master 01/01: Wiki page sidebar changed with summary [created] by Andrew Williams
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=958e6e7d4dbad929de2d1535300c89b3770dbb16 commit 958e6e7d4dbad929de2d1535300c89b3770dbb16 Author: Andrew WilliamsDate: Thu Nov 9 03:20:38 2017 -0800 Wiki page sidebar changed with summary [created] by Andrew Williams --- pages/develop/sidebar.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/pages/develop/sidebar.txt b/pages/develop/sidebar.txt new file mode 100644 index ..d7f306e3 --- /dev/null +++ b/pages/develop/sidebar.txt @@ -0,0 +1,10 @@ +~~NOCACHE~~ + +=== Tutorials === + * [[/develop/tutorial/c/hello-world]] + * [[/develop/tutorial/c/hello-world-alternate]] + * [[/develop/tutorial/c/eo-intro]] + +=== APIs === + * [[/develop/api/ | C API]] + * [[/develop/legacy/api/c | Legacy C API]] \ No newline at end of file --
[EGIT] [website/www-content] master 01/01: Wiki page arrays.md changed with summary [] by Paul
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=10c1780195e509dfe7daff70b1c5b53c9868efcb commit 10c1780195e509dfe7daff70b1c5b53c9868efcb Author: PaulDate: Thu Nov 9 01:28:50 2017 -0800 Wiki page arrays.md changed with summary [] by Paul --- pages/eina-programming-guide/arrays.md.txt | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pages/eina-programming-guide/arrays.md.txt b/pages/eina-programming-guide/arrays.md.txt index 8cef69cc..42362b2c 100644 --- a/pages/eina-programming-guide/arrays.md.txt +++ b/pages/eina-programming-guide/arrays.md.txt @@ -4,8 +4,7 @@ # Arrays # -An array is a data type which describes an ordered collection of values. The -values are accessed by their index. +An array is a data type which describes an ordered collection of values. The values are accessed by their index. |INDEX |VALUE | |--|--| @@ -153,7 +152,7 @@ int remove_array() [...] ``` -### Completely Wipe an Array Out ### +### Wiping all Data from an Array ### Use the ``eina_array_flush()`` function. This function sets the count and total members of an array to 0, and frees and sets its data members to ``NULL``. For performance reasons, there is no array check. If the value is ``NULL`` or invalid, the program can crash. The only parameter of this function is a pointer to the ``Eina_Array`` array you want to flush. @@ -203,7 +202,7 @@ nb_elm = eina_array_count(array); You can use various methods: - Using the ```ITER_NEXT`` iterator + Using the ``ITER_NEXT`` iterator You can use the iterator by calling the macro ``EINA_ARRAY_ITER_NEXT()``. It takes the array to iterate as the first parameter, a counter for the current index during the iteration, and a variable of the same type as the item data and an ``Eina_Iterator``. To use it, declare an ``Eina_Iterator``, an ``int`` counter, and, for example, a ``char *`` item if your array contains strings. --
[EGIT] [website/www-content] master 01/01: Wiki page arrays.md changed with summary [] by Paul
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=58b51ba38a1ade7d5c84a586938a9d34483d034a commit 58b51ba38a1ade7d5c84a586938a9d34483d034a Author: PaulDate: Thu Nov 9 01:24:07 2017 -0800 Wiki page arrays.md changed with summary [] by Paul --- pages/eina-programming-guide/arrays.md.txt | 349 - 1 file changed, 97 insertions(+), 252 deletions(-) diff --git a/pages/eina-programming-guide/arrays.md.txt b/pages/eina-programming-guide/arrays.md.txt index 39f6696a..8cef69cc 100644 --- a/pages/eina-programming-guide/arrays.md.txt +++ b/pages/eina-programming-guide/arrays.md.txt @@ -18,28 +18,17 @@ values are accessed by their index. |6 |value6| |7 |value7| -Eina provides 2 array types: the classic array and an inline array. +Eina provides 2 array types: the **classic array** and an **inline array**. ## Creating and Destroying a Classic Array ## -The ``eina_array_new()`` function creates a new array. You can store strings or -objects in the created array. The function returns a new array, or if memory -allocation fails, ``NULL``. +The ``eina_array_new()`` function creates a new array. You can store strings or objects in the created array. The function returns a new array, or if memory allocation fails, ``NULL``. -The first parameter of the ``eina_array_new()`` function defines the size of -the array allocation step. For example, if you set it to 4, the function -returns an array of 4 elements and the next time you grow the array it grows -by 4 elements. Unless you have pushed 4 elements inside, it does not grow. But -once you add the 5th element, it grows again and becomes an array of 8 -elements. The allocation step feature is very useful for optimizing -performance, and it also reduces memory fragmentation by having a size that -fits the array usage. If you set the step to 0, the function sets a default -safe value. +The first parameter of the ``eina_array_new()`` function defines the size of the array allocation step. For example, if you set it to 4, the function returns an array of 4 elements. The next time you grow the array it grows by 4 elements. Unless you have pushed 4 elements inside, it does not grow. But once you add the 5th element, it grows again and becomes an array of 8 elements. The allocation step feature is very useful for optimizing performance, and it also reduces memory fragmentat [...] -### To create an array to store strings ### - -__**1**__. Create the array: +### Creating an Array to Store Strings ### +First create the array: ```c [...] @@ -65,108 +54,77 @@ for (i = 0; i < 20; i++) [...] ``` +> **NOTE:** +> ``[...]`` in a Code Block indicates there will usually be code above and below the shown snippet, but that it has been excluded for the sake of brevity. There is no need to type ``[...]`` into your program. -__**2**__. To change the allocation step, use the ``eina_array_step_set()`` function: - * The first parameter is the array you want to change. - * The second parameter is the size of that specific array (retrieved with the ``sizeof()`` function). - * The last parameter is the new step size. +To change the allocation step, use the ``eina_array_step_set()`` function, the first parameter is the array you want to change, the second parameter is the size of that specific array (retrieved with the ``sizeof()`` function) and the last parameter is the new step size. In this example, the array step changes from 20 to 30. ```c [...] - eina_array_step_set(array, sizeof(*array), 30); - [...] ``` -__**3**__. When no longer used, use the ``eina_array_free()`` function to free the array. It first calls the ``eina_array_flush()`` function and frees the memory of the pointer. It does not free the memory allocated for the elements of the array. To free them, use a ``while`` statement with the ``eina_array_pop`` function. +When no longer used, use the ``eina_array_free()`` function to free the array. It first calls the ``eina_array_flush()`` function and frees the memory of the pointer. It does not free the memory allocated for the elements of the array. To do that, use a ``while`` statement with the ``eina_array_pop`` function. ```c [...] - // Freeing the array elements while (eina_array_count(array)) free(eina_array_pop(array)); -// Freeing the array itself + // Freeing the array itself eina_array_free(array); - [...] ``` ## Modifying Classic Array Content ## -### To set the data of an element ### -Use the ``eina_array_data_set()`` function. The first parameter is the array, -the second is the index of the element you want to set, and the last one is -the data. You must first get the related pointer if you need to free it, as -this function replaces the previously held data. Be careful, as there is no -array or index check. If the value is ``NULL`` or invalid, the