This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch edje-vector-intergration
in repository efl.

View the commit online.

commit d76e7b76508b99e63ad1494190dd729b65a887b6
Author: [email protected] <[email protected]>
AuthorDate: Tue Apr 28 12:05:02 2026 -0600

    edje: add toplevel vectors{} block parser (Phase 2.3)
    
    This commit teaches edje_cc to parse the toplevel vectors { vector { ... } }
    declaration block, establishing the Phase 2 foundation for vector tree support
    in Edje collections.
    
    The parser accepts vector name and viewbox properties, detecting duplicate names
    with VEC001 diagnostic. Sub-node openers (shape/container/gradient_*) and
    per-node properties are deferred to subsequent commits to keep each slice small
    and reviewable. The parsed tree structure is available to the AST but not yet
    rendered (Phase 3 owns runtime).
    
    Handlers registered at both toplevel vectors.* and collections.vectors.* paths,
    mirroring color_classes convention. Includes Doxygen documentation for the new
    syntax blocks in the EDC reference manual.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---
 src/bin/edje/edje_cc_handlers.c | 118 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 117 insertions(+), 1 deletion(-)

diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index aa74f88e86..2f928768e1 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -43,6 +43,7 @@
 #endif
 
 #include "edje_cc.h"
+#include "edje_vg_tree.h"
 
 /**
  * @page edcref Edje Data Collection reference
@@ -278,6 +279,11 @@ static void       st_size_class_name(void);
 static void       st_size_class_min(void);
 static void       st_size_class_max(void);
 
+static void       ob_vectors_vector(void);
+static void       st_vectors_vector_name(void);
+static void       st_vectors_vector_viewbox(void);
+static void       _vg_tree_block_end(void);
+
 static void       ob_filters_filter(void);
 static void       ob_filters_filter_script(void);
 static void       st_filters_filter_file(void);
@@ -657,6 +663,8 @@ New_Statement_Handler statement_handlers[] =
    FONT_STYLE_CC_STATEMENTS("")
    TEXT_CLASS_STATEMENTS("")
    SIZE_CLASS_STATEMENTS("")
+   {"vectors.vector.name", st_vectors_vector_name},
+   {"vectors.vector.viewbox", st_vectors_vector_viewbox},
    {
       "data.item", st_data_item
    },
@@ -673,6 +681,8 @@ New_Statement_Handler statement_handlers[] =
    FONT_STYLE_CC_STATEMENTS("collections.")
    TEXT_CLASS_STATEMENTS("collections.")
    SIZE_CLASS_STATEMENTS("collections.")
+   {"collections.vectors.vector.name", st_vectors_vector_name},   /* dup */
+   {"collections.vectors.vector.viewbox", st_vectors_vector_viewbox},   /* dup */
    {
       "collections.base_scale", st_collections_base_scale
    },
@@ -1388,6 +1398,106 @@ st_collections_group_parts_part_description_params_smart(void)
    free(token);
 }
 
+/**
+    @page edcref
+
+    @block
+        vectors
+    @context
+    vectors {
+       vector { .. }
+       ..
+    }
+    @description
+        The "vectors" block declares named vector trees that can be referenced
+        from VECTOR part descriptions via "vector.use:". Each tree defines a
+        viewbox and a hierarchy of shape, container, and gradient nodes.
+    @endblock
+
+    @block
+        vector
+    @context
+    vectors {
+       vector {
+          name: "my_tree";
+          viewbox: 0 0 100 100;
+       }
+    }
+    @description
+        A single named vector tree. The "name" property registers the tree in
+        the global namespace; the "viewbox" property sets the SVG-style
+        coordinate origin and dimensions. Sub-node blocks (shape, container,
+        gradient_linear, gradient_radial) are added in subsequent tasks.
+    @endblock
+
+    @property
+        name
+    @parameters
+        [string]
+    @effect
+        Sets the unique name of the vector tree. Duplicate names are rejected
+        at compile time with error VEC001.
+    @endproperty
+
+    @property
+        viewbox
+    @parameters
+        [x] [y] [width] [height]
+    @effect
+        Defines the coordinate system of the vector tree, analogous to the SVG
+        viewBox attribute.  All node coordinates inside the tree are expressed
+        in this space.
+    @endproperty
+ */
+
+static void
+ob_vectors_vector(void)
+{
+   Edje_Vg_Tree *t = _edje_vg_tree_new();
+   if (!t) error_and_abort(NULL, "OOM building vector tree");
+   current_vg_tree = t;
+   current_vg_node = t->root;
+   if (!current_vg_node_stack)
+     current_vg_node_stack = eina_array_new(8);
+   eina_array_clean(current_vg_node_stack);
+   all_vg_trees = eina_list_append(all_vg_trees, t);
+}
+
+static void
+_vg_tree_block_end(void)
+{
+   current_vg_tree = NULL;
+   current_vg_node = NULL;
+   if (current_vg_node_stack) eina_array_clean(current_vg_node_stack);
+}
+
+static void
+st_vectors_vector_name(void)
+{
+   check_arg_count(1);
+   if (!current_vg_tree)
+     error_and_abort(NULL, "name: outside vectors.vector block");
+   char *name = parse_str(0);
+   if (!toplevel_vg_trees)
+     toplevel_vg_trees = eina_hash_string_superfast_new(NULL);
+   if (eina_hash_find(toplevel_vg_trees, name))
+     error_and_abort(NULL, "Duplicate vector tree name '%s' (VEC001)", name);
+   eina_hash_add(toplevel_vg_trees, name, current_vg_tree);
+   free(name);
+}
+
+static void
+st_vectors_vector_viewbox(void)
+{
+   check_arg_count(4);
+   if (!current_vg_tree)
+     error_and_abort(NULL, "viewbox: outside vectors.vector block");
+   current_vg_tree->vbx = parse_float(0);
+   current_vg_tree->vby = parse_float(1);
+   current_vg_tree->vbw = parse_float(2);
+   current_vg_tree->vbh = parse_float(3);
+}
+
 #define PROGRAM_OBJECTS(PREFIX)                                                                           \
   {PREFIX ".program", ob_collections_group_programs_program},   /* dup */                                 \
   {PREFIX ".program.script", ob_collections_group_programs_program_script},   /* dup */                   \
@@ -1420,6 +1530,8 @@ New_Object_Handler object_handlers[] =
    {"color_tree", ob_color_tree},
    {"color_classes", NULL},
    {"color_classes.color_class", ob_color_class},
+   {"vectors", NULL},
+   {"vectors.vector", ob_vectors_vector},
    {"text_classes", NULL},
    {"text_classes.text_class", ob_text_class},
    {"size_classes", NULL},
@@ -1441,6 +1553,8 @@ New_Object_Handler object_handlers[] =
    {"collections.color_tree", ob_color_tree},   /* dup */
    {"collections.color_classes", NULL},   /* dup */
    {"collections.color_classes.color_class", ob_color_class},   /* dup */
+   {"collections.vectors", NULL},   /* dup */
+   {"collections.vectors.vector", ob_vectors_vector},   /* dup */
    {"collections.text_classes", NULL},
    {"collections.text_classes.text_class", ob_text_class},   /* dup */
    {"collections.size_classes", NULL},   /* dup */
@@ -1629,7 +1743,9 @@ New_Object_Handler object_handlers_short[] =
 };
 
 New_Nested_Handler nested_handlers[] = {
-   {"collections.group.parts", "part", NULL, edje_cc_handlers_hierarchy_pop }
+   {"collections.group.parts", "part", NULL, edje_cc_handlers_hierarchy_pop },
+   {"collections.vectors", "vector", NULL, _vg_tree_block_end },
+   {"vectors", "vector", NULL, _vg_tree_block_end },
 };
 
 New_Nested_Handler nested_handlers_short[] = {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to