aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-03-05 16:03:23 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2019-03-08 13:35:38 +0100
commit2862eb3671c3dd1d3d46390072d2a0b691c41e36 (patch)
tree00ab2bc42a75136d4778a8c0c57500072550742e
parentevas_canvas3d: add empty functions for missing APIs (diff)
downloadefl-devs/q66/eolian-beta-types.tar.gz
eolian: add support for marking type declarations betadevs/q66/eolian-beta-types
Summary: This also simplifies the beta checking API by unifying it under objects (makes much more sense that way) and reworks the validator to have betaness support within its context state, allowing checks to be done easily in any place. The betaness checks are disabled for types for the time being, because otherwise there are too many errors (types are assumed to be stable as they are not tagged beta, but they reference beta classes all over the place). Set EOLIAN_TYPEDECL_BETA_WARN to 1 in your environment to force enable the checks. Reviewers: zmike, bu5hm4n, stefan_schmidt, lauromoura, cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8102
-rw-r--r--src/bin/eolian/types.c16
-rw-r--r--src/bindings/luajit/eolian.lua15
-rw-r--r--src/lib/eolian/Eolian.h66
-rw-r--r--src/lib/eolian/database_class_api.c7
-rw-r--r--src/lib/eolian/database_event_api.c7
-rw-r--r--src/lib/eolian/database_function_api.c7
-rw-r--r--src/lib/eolian/database_validate.c116
-rw-r--r--src/lib/eolian/eo_parser.c78
-rw-r--r--src/lib/eolian/eolian_database.c7
-rw-r--r--src/lib/eolian/eolian_database.h6
-rw-r--r--src/scripts/pyolian/eolian.py12
-rw-r--r--src/scripts/pyolian/eolian_lib.py12
12 files changed, 232 insertions, 117 deletions
diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c
index b8f7b98452..d9a9bc2a45 100644
--- a/src/bin/eolian/types.c
+++ b/src/bin/eolian/types.c
@@ -156,6 +156,15 @@ _type_generate(const Eolian_State *state, const Eolian_Typedecl *tp,
eina_strbuf_reset(buf);
break;
}
+ eina_strbuf_append_char(buf, ';');
+#if 0
+ /* can't enable this yet, as this would trigger brokenness in our tree */
+ if (eolian_typedecl_is_beta(tp))
+ {
+ eina_strbuf_prepend(buf, "#ifdef EFL_BETA_API_SUPPORT\n");
+ eina_strbuf_append(buf, "\n#endif /* EFL_BETA_API_SUPPORT */");
+ }
+#endif
return buf;
}
@@ -200,6 +209,11 @@ _var_generate(const Eolian_State *state, const Eolian_Variable *vr, Eina_Bool le
eina_stringshare_del(ct);
}
free(fn);
+ if (eolian_variable_is_beta(vr))
+ {
+ eina_strbuf_prepend(buf, "#ifdef EFL_BETA_API_SUPPORT\n");
+ eina_strbuf_append(buf, "\n#endif /* EFL_BETA_API_SUPPORT */");
+ }
return buf;
}
@@ -252,7 +266,7 @@ void eo_gen_types_header_gen(const Eolian_State *state,
if (tbuf)
{
eina_strbuf_append(buf, eina_strbuf_string_get(tbuf));
- eina_strbuf_append(buf, ";\n\n");
+ eina_strbuf_append(buf, "\n\n");
eina_strbuf_free(tbuf);
}
}
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 0e72db3c05..e869950c94 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -295,6 +295,7 @@ ffi.cdef [[
const char *eolian_object_name_get(const Eolian_Object *obj);
const char *eolian_object_short_name_get(const Eolian_Object *obj);
Eina_Iterator *eolian_object_namespaces_get(const Eolian_Object *obj);
+ Eina_Bool eolian_object_is_beta(const Eolian_Object *obj);
Eina_Bool eolian_state_directory_add(Eolian_State *state, const char *dir);
Eina_Bool eolian_state_system_directory_add(Eolian_State *state);
Eina_Iterator *eolian_state_eo_file_paths_get(const Eolian_State *state);
@@ -348,7 +349,6 @@ ffi.cdef [[
const Eolian_Implement *eolian_function_implement_get(const Eolian_Function *function_id);
Eina_Bool eolian_function_is_legacy_only(const Eolian_Function *function_id, Eolian_Function_Type ftype);
Eina_Bool eolian_function_is_class(const Eolian_Function *function_id);
- Eina_Bool eolian_function_is_beta(const Eolian_Function *function_id);
Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass);
Eina_Bool eolian_function_is_function_pointer(const Eolian_Function *function_id);
Eina_Iterator *eolian_property_keys_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
@@ -385,7 +385,6 @@ ffi.cdef [[
const Eolian_Class *eolian_event_class_get(const Eolian_Event *event);
const Eolian_Documentation *eolian_event_documentation_get(const Eolian_Event *event);
Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
- Eina_Bool eolian_event_is_beta(const Eolian_Event *event);
Eina_Bool eolian_event_is_hot(const Eolian_Event *event);
Eina_Bool eolian_event_is_restart(const Eolian_Event *event);
const char *eolian_event_c_name_get(const Eolian_Event *event);
@@ -573,6 +572,10 @@ local object_idx, wrap_object = gen_wrap {
namespaces_get = function(self)
return iterator.String_Iterator(
eolian.eolian_object_namespaces_get(cast_obj(self)))
+ end,
+
+ is_beta = function(self)
+ return eolian.eolian_object_is_beta(cast_obj(self)) ~= 0
end
}
@@ -1089,10 +1092,6 @@ M.Function = ffi.metatype("Eolian_Function", {
return eolian.eolian_function_is_class(self) ~= 0
end,
- is_beta = function(self)
- return eolian.eolian_function_is_beta(self) ~= 0
- end,
-
is_constructor = function(self, klass)
return eolian.eolian_function_is_constructor(self, klass) ~= 0
end,
@@ -1289,10 +1288,6 @@ ffi.metatype("Eolian_Event", {
return ffi_stringshare(v)
end,
- is_beta = function(self)
- return eolian.eolian_event_is_beta(self) ~= 0
- end,
-
is_hot = function(self)
return eolian.eolian_event_is_hot(self) ~= 0
end,
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index aebe165f57..77a5c1843a 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -703,6 +703,19 @@ EAPI const char *eolian_object_short_name_get(const Eolian_Object *obj);
EAPI Eina_Iterator *eolian_object_namespaces_get(const Eolian_Object *obj);
/*
+ * @brief Get whether an object is beta.
+ *
+ * This applies to toplevel objects (classes, types) as well as some
+ * others such as functions and events.
+ *
+ * @param[in] obj The object.
+ * @return EINA_TRUE and EINA_FALSE respectively
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_object_is_beta(const Eolian_Object *obj);
+
+/*
* @brief Scan the given directory for .eo and .eot files.
*
* You need to add every directory you plan to use .eo/.eot files from.
@@ -1628,12 +1641,15 @@ EAPI Eina_Bool eolian_function_is_class(const Eolian_Function *function_id);
/*
* @brief Get whether a function is beta.
*
- * @param[in] function_id Id of the function
- * @return EINA_TRUE and EINA_FALSE respectively
+ * @see eolian_object_is_beta
*
* @ingroup Eolian
*/
-EAPI Eina_Bool eolian_function_is_beta(const Eolian_Function *function_id);
+static inline Eina_Bool
+eolian_function_is_beta(const Eolian_Function *function_id)
+{
+ return eolian_object_is_beta(EOLIAN_OBJECT(function_id));
+}
/*
* @brief Indicates if a function is a constructing function of a given class.
@@ -2133,12 +2149,15 @@ EAPI Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
/*
* @brief Get whether an event is beta.
*
- * @param[in] event the event handle
- * @return EINA_TRUE and EINA_FALSE respectively
+ * @see eolian_object_is_beta
*
* @ingroup Eolian
*/
-EAPI Eina_Bool eolian_event_is_beta(const Eolian_Event *event);
+static inline Eina_Bool
+eolian_event_is_beta(const Eolian_Event *event)
+{
+ return eolian_object_is_beta(EOLIAN_OBJECT(event));
+}
/*
* @brief Get whether an event is hot (unfreezable).
@@ -2303,12 +2322,15 @@ EAPI Eina_Stringshare *eolian_class_c_data_type_get(const Eolian_Class *klass);
/*
* @brief Get whether a class is beta.
*
- * @param[in] klass the class
- * @return EINA_TRUE if the class has been marked as BETA
+ * @see eolian_object_is_beta
*
* @ingroup Eolian
*/
-EAPI Eina_Bool eolian_class_is_beta(const Eolian_Class *klass);
+static inline Eina_Bool
+eolian_class_is_beta(const Eolian_Class *klass)
+{
+ return eolian_object_is_beta(EOLIAN_OBJECT(klass));
+}
/*
* @brief Get the type of a type declaration.
@@ -2506,6 +2528,19 @@ EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *
EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
/*
+ * @brief Get whether a typedecl is beta.
+ *
+ * @see eolian_object_is_beta
+ *
+ * @ingroup Eolian
+ */
+static inline Eina_Bool
+eolian_typedecl_is_beta(const Eolian_Typedecl *tp)
+{
+ return eolian_object_is_beta(EOLIAN_OBJECT(tp));
+}
+
+/*
* @brief Get the full C type name of the given type.
*
* @param[in] tp the type declaration.
@@ -3007,6 +3042,19 @@ eolian_variable_namespaces_get(const Eolian_Variable *tp)
EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var);
/*
+ * @brief Get whether a variable is beta.
+ *
+ * @see eolian_object_is_beta
+ *
+ * @ingroup Eolian
+ */
+static inline Eina_Bool
+eolian_variable_is_beta(const Eolian_Variable *var)
+{
+ return eolian_object_is_beta(EOLIAN_OBJECT(var));
+}
+
+/*
* @brief Get the summary of the documentation.
*
* This should never return NULL unless the input is invalid.
diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c
index 73d013672b..f79cdb800b 100644
--- a/src/lib/eolian/database_class_api.c
+++ b/src/lib/eolian/database_class_api.c
@@ -228,10 +228,3 @@ eolian_class_c_data_type_get(const Eolian_Class *cl)
*p = '_';
return eina_stringshare_add(buf);
}
-
-EAPI Eina_Bool
-eolian_class_is_beta(const Eolian_Class *cl)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
- return cl->is_beta;
-}
diff --git a/src/lib/eolian/database_event_api.c b/src/lib/eolian/database_event_api.c
index 97c8df8b9c..74f69cd411 100644
--- a/src/lib/eolian/database_event_api.c
+++ b/src/lib/eolian/database_event_api.c
@@ -36,13 +36,6 @@ eolian_event_scope_get(const Eolian_Event *event)
}
EAPI Eina_Bool
-eolian_event_is_beta(const Eolian_Event *event)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_FALSE);
- return event->is_beta;
-}
-
-EAPI Eina_Bool
eolian_event_is_hot(const Eolian_Event *event)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_FALSE);
diff --git a/src/lib/eolian/database_function_api.c b/src/lib/eolian/database_function_api.c
index 05e7bf9e51..9e7135b96e 100644
--- a/src/lib/eolian/database_function_api.c
+++ b/src/lib/eolian/database_function_api.c
@@ -394,10 +394,3 @@ eolian_function_class_get(const Eolian_Function *fid)
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
return fid->klass;
}
-
-EAPI Eina_Bool
-eolian_function_is_beta(const Eolian_Function *fid)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
- return fid->is_beta;
-}
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index cdc31b0ebb..665f095817 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -11,11 +11,28 @@
typedef struct _Validate_State
{
Eina_Bool warned;
+ Eina_Bool stable;
Eina_Bool event_redef;
Eina_Bool unimplemented;
+ Eina_Bool beta_types;
} Validate_State;
static Eina_Bool
+_set_stable(Validate_State *vals, Eina_Bool newval)
+{
+ Eina_Bool ret = vals->stable;
+ vals->stable = newval;
+ return ret;
+}
+
+static Eina_Bool
+_reset_stable(Validate_State *vals, Eina_Bool oldval, Eina_Bool ret)
+{
+ vals->stable = oldval;
+ return ret;
+}
+
+static Eina_Bool
_validate(Eolian_Object *obj)
{
obj->validated = EINA_TRUE;
@@ -79,21 +96,6 @@ _class_is_legacy(Eolian_Class *klass)
}
static Eina_Bool
-_validate_beta_usage(Eolian_Class *klass, Eolian_Type *type)
-{
- if (!klass) return EINA_TRUE;
- if (_class_is_legacy(klass)) return EINA_TRUE;
- if (klass->is_beta) return EINA_TRUE;
-
- if (type->type == EOLIAN_TYPE_CLASS && type->klass->is_beta)
- {
- _eo_parser_log(&type->base, "beta class used in public API");
- return EINA_FALSE;
- }
- return EINA_TRUE;
-}
-
-static Eina_Bool
_validate_doc(Eolian_Documentation *doc)
{
if (!doc)
@@ -163,39 +165,48 @@ _validate_typedecl(Validate_State *vals, Eolian_Typedecl *tp)
if (!_validate_doc(tp->doc))
return EINA_FALSE;
+ /* for the time being assume all typedecls are beta unless overridden */
+ Eina_Bool was_stable = _set_stable(vals, !tp->base.is_beta && vals->beta_types);
+
switch (tp->type)
{
case EOLIAN_TYPEDECL_ALIAS:
if (!_validate_type(vals, tp->base_type))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
if (!tp->freefunc && tp->base_type->freefunc)
tp->freefunc = eina_stringshare_ref(tp->base_type->freefunc);
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&tp->base);
case EOLIAN_TYPEDECL_STRUCT:
{
Cb_Ret rt = { vals, EINA_TRUE };
eina_hash_foreach(tp->fields, (Eina_Hash_Foreach)_sf_map_cb, &rt);
if (!rt.succ)
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&tp->base);
}
case EOLIAN_TYPEDECL_STRUCT_OPAQUE:
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&tp->base);
case EOLIAN_TYPEDECL_ENUM:
{
Cb_Ret rt = { vals, EINA_TRUE };
eina_hash_foreach(tp->fields, (Eina_Hash_Foreach)_ef_map_cb, &rt);
if (!rt.succ)
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&tp->base);
}
case EOLIAN_TYPEDECL_FUNCTION_POINTER:
if (!_validate_function(vals, tp->function_pointer, NULL))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&tp->base);
default:
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
}
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&tp->base);
}
@@ -316,6 +327,13 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
_eo_parser_log(&tp->base, "undefined type %s", tp->base.name);
return EINA_FALSE;
}
+ else if (vals->stable && tp->tdecl->base.is_beta && vals->beta_types)
+ {
+ /* we should enable this by default, but can't for now */
+ _eo_parser_log(&tp->base, "beta type declaration '%s' used in stable context",
+ tp->tdecl->base.name);
+ return EINA_FALSE;
+ }
if (!_validate_typedecl(vals, tp->tdecl))
return EINA_FALSE;
if (tp->tdecl->freefunc && !tp->freefunc)
@@ -331,6 +349,12 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
"(likely wrong namespacing)", tp->base.name);
return EINA_FALSE;
}
+ else if (vals->stable && tp->klass->base.is_beta)
+ {
+ _eo_parser_log(&tp->base, "beta class '%s' used in stable context",
+ tp->klass->base.name);
+ return EINA_FALSE;
+ }
if (!tp->freefunc)
tp->freefunc = eina_stringshare_add(eo_obj_free);
return _validate_ownable(tp);
@@ -383,7 +407,7 @@ _validate_function(Validate_State *vals, Eolian_Function *func, Eina_Hash *nhash
{
_eo_parser_log(&func->base,
"%sfunction '%s' conflicts with another symbol (at %s:%d:%d)",
- func->is_beta ? "beta " : "", func->base.name, oobj->file,
+ func->base.is_beta ? "beta " : "", func->base.name, oobj->file,
oobj->line, oobj->column);
vals->warned = EINA_TRUE;
}
@@ -399,24 +423,27 @@ _validate_function(Validate_State *vals, Eolian_Function *func, Eina_Hash *nhash
return EINA_TRUE;
}
- if (func->get_ret_type && (!_validate_type(vals, func->get_ret_type) || !_validate_beta_usage(func->klass, func->get_ret_type)))
- return EINA_FALSE;
+ /* need to preserve stable flag set from the class */
+ Eina_Bool was_stable = _set_stable(vals, !func->base.is_beta && vals->stable);
- if (func->set_ret_type && (!_validate_type(vals, func->set_ret_type) || !_validate_beta_usage(func->klass, func->set_ret_type)))
- return EINA_FALSE;
+ if (func->get_ret_type && !_validate_type(vals, func->get_ret_type))
+ return _reset_stable(vals, was_stable, EINA_FALSE);
+
+ if (func->set_ret_type && !_validate_type(vals, func->set_ret_type))
+ return _reset_stable(vals, was_stable, EINA_FALSE);
if (func->get_ret_val && !_validate_expr(func->get_ret_val,
func->get_ret_type, 0))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
if (func->set_ret_val && !_validate_expr(func->set_ret_val,
func->set_ret_type, 0))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
#define EOLIAN_PARAMS_VALIDATE(params) \
EINA_LIST_FOREACH(params, l, param) \
- if (!_validate_param(vals, param) || !_validate_beta_usage(func->klass, param->type)) \
- return EINA_FALSE;
+ if (!_validate_param(vals, param)) \
+ return _reset_stable(vals, was_stable, EINA_FALSE);
EOLIAN_PARAMS_VALIDATE(func->prop_values);
EOLIAN_PARAMS_VALIDATE(func->prop_values_get);
@@ -428,14 +455,15 @@ _validate_function(Validate_State *vals, Eolian_Function *func, Eina_Hash *nhash
#undef EOLIAN_PARAMS_VALIDATE
if (!_validate_doc(func->get_return_doc))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
if (!_validate_doc(func->set_return_doc))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
/* just for now, when dups become errors there will be no need to check */
if (!oobj && nhash)
eina_hash_add(nhash, &func->base.name, &func->base);
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&func->base);
}
@@ -503,15 +531,18 @@ _validate_event(Validate_State *vals, Eolian_Event *event, Eina_Hash *nhash)
return EINA_TRUE;
}
- if (!_validate_type(vals, event->type) || !_validate_beta_usage(event->klass, event->type))
- return EINA_FALSE;
+ Eina_Bool was_stable = _set_stable(vals, !event->base.is_beta && vals->stable);
+
+ if (!_validate_type(vals, event->type))
+ return _reset_stable(vals, was_stable, EINA_FALSE);
if (!_validate_doc(event->doc))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
if (vals->event_redef && !oobj)
eina_hash_add(nhash, &event->base.name, &event->base);
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&event->base);
}
@@ -1180,7 +1211,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
default:
break;
}
- if (!_class_is_legacy(cl) && !cl->is_beta && cl->parent->is_beta)
+ if (!_class_is_legacy(cl) && !cl->base.is_beta && cl->parent->base.is_beta)
{
_eo_parser_log(&cl->base, "non-beta class cannot have beta parent");
return EINA_FALSE;
@@ -1247,6 +1278,8 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
}
}
+ /* we are not verifying betaness for any legacy class */
+ _set_stable(vals, !cl->base.is_beta && !_class_is_legacy(cl));
EINA_LIST_FOREACH(cl->properties, l, func)
if (!_validate_function(vals, func, nhash))
@@ -1291,15 +1324,18 @@ _validate_variable(Validate_State *vals, Eolian_Variable *var)
if (var->base.validated)
return EINA_TRUE;
+ Eina_Bool was_stable = _set_stable(vals, !var->base.is_beta && vals->stable);
+
if (!_validate_type(vals, var->base_type))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
if (var->value && !_validate_expr(var->value, var->base_type, 0))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
if (!_validate_doc(var->doc))
- return EINA_FALSE;
+ return _reset_stable(vals, was_stable, EINA_FALSE);
+ _reset_stable(vals, was_stable, EINA_TRUE);
return _validate(&var->base);
}
@@ -1324,8 +1360,10 @@ database_validate(const Eolian_Unit *src)
Validate_State vals = {
EINA_FALSE,
+ EINA_TRUE,
!!getenv("EOLIAN_EVENT_REDEF_WARN"),
- !!getenv("EOLIAN_CLASS_UNIMPLEMENTED_WARN")
+ !!getenv("EOLIAN_CLASS_UNIMPLEMENTED_WARN"),
+ !!getenv("EOLIAN_TYPEDECL_BETA_WARN")
};
/* do an initial pass to refill inherits */
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 626e75b2ab..6de91efc15 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -433,11 +433,12 @@ _struct_field_free(Eolian_Struct_Type_Field *def)
static Eolian_Typedecl *
parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
- int line, int column, const char *freefunc)
+ Eina_Bool is_beta, int line, int column, const char *freefunc)
{
int bline = ls->line_number, bcolumn = ls->column;
Eolian_Typedecl *def = eo_lexer_typedecl_new(ls);
def->is_extern = is_extern;
+ def->base.is_beta = is_beta;
def->base.name = name;
def->type = EOLIAN_TYPEDECL_STRUCT;
def->fields = eina_hash_string_small_new(EINA_FREE_CB(_struct_field_free));
@@ -491,11 +492,12 @@ _enum_field_free(Eolian_Enum_Type_Field *def)
static Eolian_Typedecl *
parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern,
- int line, int column)
+ Eina_Bool is_beta, int line, int column)
{
int bline = ls->line_number, bcolumn = ls->column;
Eolian_Typedecl *def = eo_lexer_typedecl_new(ls);
def->is_extern = is_extern;
+ def->base.is_beta = is_beta;
def->base.name = name;
def->type = EOLIAN_TYPEDECL_ENUM;
def->fields = eina_hash_string_small_new(EINA_FREE_CB(_enum_field_free));
@@ -747,11 +749,23 @@ parse_typedef(Eo_Lexer *ls)
Eolian_Typedecl *def = eo_lexer_typedecl_new(ls);
Eina_Strbuf *buf;
eo_lexer_get(ls);
- if (ls->t.kw == KW_at_extern)
+ Eina_Bool has_extern = EINA_FALSE, has_beta = EINA_FALSE;
+ for (;;) switch (ls->t.kw)
{
+ case KW_at_extern:
+ CASE_LOCK(ls, extern, "extern qualifier");
def->is_extern = EINA_TRUE;
eo_lexer_get(ls);
+ break;
+ case KW_at_beta:
+ CASE_LOCK(ls, beta, "beta qualifier");
+ def->base.is_beta = EINA_TRUE;
+ eo_lexer_get(ls);
+ break;
+ default:
+ goto tags_done;
}
+tags_done:
def->type = EOLIAN_TYPEDECL_ALIAS;
buf = eina_strbuf_new();
eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf);
@@ -780,11 +794,23 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global)
Eolian_Variable *def = eo_lexer_variable_new(ls);
Eina_Strbuf *buf;
eo_lexer_get(ls);
- if (ls->t.kw == KW_at_extern)
+ Eina_Bool has_extern = EINA_FALSE, has_beta = EINA_FALSE;
+ for (;;) switch (ls->t.kw)
{
+ case KW_at_extern:
+ CASE_LOCK(ls, extern, "extern qualifier");
def->is_extern = EINA_TRUE;
eo_lexer_get(ls);
+ break;
+ case KW_at_beta:
+ CASE_LOCK(ls, beta, "beta qualifier");
+ def->base.is_beta = EINA_TRUE;
+ eo_lexer_get(ls);
+ break;
+ default:
+ goto tags_done;
}
+tags_done:
def->type = global ? EOLIAN_VAR_GLOBAL : EOLIAN_VAR_CONSTANT;
buf = eina_strbuf_new();
eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf);
@@ -1189,7 +1215,7 @@ parse_property(Eo_Lexer *ls)
break;
case KW_at_beta:
CASE_LOCK(ls, beta, "beta qualifier");
- prop->is_beta = EINA_TRUE;
+ prop->base.is_beta = EINA_TRUE;
eo_lexer_get(ls);
break;
case KW_at_pure_virtual:
@@ -1255,10 +1281,23 @@ parse_function_pointer(Eo_Lexer *ls)
eo_lexer_get(ls);
def->type = EOLIAN_TYPEDECL_FUNCTION_POINTER;
- def->is_extern = (ls->t.kw == KW_at_extern);
- if (def->is_extern)
- eo_lexer_get(ls);
-
+ Eina_Bool has_extern = EINA_FALSE, has_beta = EINA_FALSE;
+ for (;;) switch (ls->t.kw)
+ {
+ case KW_at_extern:
+ CASE_LOCK(ls, extern, "extern qualifier");
+ def->is_extern = EINA_TRUE;
+ eo_lexer_get(ls);
+ break;
+ case KW_at_beta:
+ CASE_LOCK(ls, beta, "beta qualifier");
+ def->base.is_beta = EINA_TRUE;
+ eo_lexer_get(ls);
+ break;
+ default:
+ goto tags_done;
+ }
+tags_done:
parse_name(ls, buf);
def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf));
eo_lexer_dtor_pop(ls);
@@ -1272,8 +1311,8 @@ parse_function_pointer(Eo_Lexer *ls)
def->function_pointer = meth;
eolian_object_ref(&meth->base);
- meth->is_beta = (ls->t.kw == KW_at_beta);
- if (meth->is_beta)
+ meth->base.is_beta = (ls->t.kw == KW_at_beta);
+ if (meth->base.is_beta)
eo_lexer_get(ls);
bline = ls->line_number;
@@ -1359,7 +1398,7 @@ parse_method(Eo_Lexer *ls)
break;
case KW_at_beta:
CASE_LOCK(ls, beta, "beta qualifier");
- meth->is_beta = EINA_TRUE;
+ meth->base.is_beta = EINA_TRUE;
eo_lexer_get(ls);
break;
case KW_at_pure_virtual:
@@ -1718,7 +1757,7 @@ parse_event(Eo_Lexer *ls)
break;
case KW_at_beta:
CASE_LOCK(ls, beta, "beta qualifier")
- ev->is_beta = EINA_TRUE;
+ ev->base.is_beta = EINA_TRUE;
eo_lexer_get(ls);
break;
case KW_at_hot:
@@ -2060,7 +2099,7 @@ parse_class(Eo_Lexer *ls, Eolian_Class_Type type)
eo_lexer_context_push(ls);
if (ls->t.kw == KW_at_beta)
{
- ls->klass->is_beta = EINA_TRUE;
+ ls->klass->base.is_beta = EINA_TRUE;
eo_lexer_get(ls);
}
parse_name(ls, buf);
@@ -2212,13 +2251,17 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
const char *freefunc = NULL;
Eina_Strbuf *buf;
eo_lexer_get(ls);
- Eina_Bool has_extern = EINA_FALSE, has_free = EINA_FALSE;
+ Eina_Bool has_extern = EINA_FALSE, has_free = EINA_FALSE, has_beta = EINA_FALSE;
for (;;) switch (ls->t.kw)
{
case KW_at_extern:
CASE_LOCK(ls, extern, "@extern qualifier")
eo_lexer_get(ls);
break;
+ case KW_at_beta:
+ CASE_LOCK(ls, beta, "@beta qualifier")
+ eo_lexer_get(ls);
+ break;
case KW_at_free:
{
if (is_enum)
@@ -2264,6 +2307,7 @@ postparams:
{
Eolian_Typedecl *def = eo_lexer_typedecl_new(ls);
def->is_extern = has_extern;
+ def->base.is_beta = has_beta;
def->type = EOLIAN_TYPEDECL_STRUCT_OPAQUE;
if (freefunc)
{
@@ -2278,9 +2322,9 @@ postparams:
break;
}
if (is_enum)
- parse_enum(ls, name, has_extern, line, col);
+ parse_enum(ls, name, has_extern, has_beta, line, col);
else
- parse_struct(ls, name, has_extern, line, col, freefunc);
+ parse_struct(ls, name, has_extern, has_beta, line, col, freefunc);
break;
}
def:
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index eb6e896bab..4ce5b00f63 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -119,6 +119,13 @@ eolian_object_namespaces_get(const Eolian_Object *obj)
return &it->itr;
}
+EAPI Eina_Bool
+eolian_object_is_beta(const Eolian_Object *obj)
+{
+ if (!obj) return EINA_FALSE;
+ return obj->is_beta;
+}
+
void database_doc_del(Eolian_Documentation *doc)
{
if (!doc) return;
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index b70f2b4f1e..058da20dd8 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -89,7 +89,8 @@ struct _Eolian_Object
int column;
int refcount;
Eolian_Object_Type type;
- Eina_Bool validated;
+ Eina_Bool validated: 1;
+ Eina_Bool is_beta: 1;
};
static inline void
@@ -196,7 +197,6 @@ struct _Eolian_Class
Eina_List *callables; /* internal for now */
Eina_Bool class_ctor_enable:1;
Eina_Bool class_dtor_enable:1;
- Eina_Bool is_beta :1;
};
struct _Eolian_Function
@@ -232,7 +232,6 @@ struct _Eolian_Function
Eina_Bool get_only_legacy: 1;
Eina_Bool set_only_legacy: 1;
Eina_Bool is_class :1;
- Eina_Bool is_beta :1;
Eina_List *ctor_of;
Eolian_Class *klass;
};
@@ -328,7 +327,6 @@ struct _Eolian_Event
Eolian_Type *type;
Eolian_Class *klass;
Eolian_Object_Scope scope;
- Eina_Bool is_beta :1;
Eina_Bool is_hot :1;
Eina_Bool is_restart :1;
};
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 0df6ee8884..a2a6b5c323 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -622,6 +622,10 @@ class Object(EolianBaseObject):
def column(self):
return int(lib.eolian_object_column_get(self))
+ @cached_property
+ def is_beta(self):
+ return bool(lib.eolian_object_is_beta(self))
+
class Class(Object):
def __repr__(self):
@@ -811,10 +815,6 @@ class Event(Object):
return Eolian_Object_Scope(lib.eolian_event_scope_get(self))
@cached_property
- def is_beta(self):
- return bool(lib.eolian_event_is_beta(self))
-
- @cached_property
def is_hot(self):
return bool(lib.eolian_event_is_hot(self))
@@ -887,10 +887,6 @@ class Function(Object):
return bool(lib.eolian_function_is_class(self))
@cached_property
- def is_beta(self):
- return bool(lib.eolian_function_is_beta(self))
-
- @cached_property
def object_is_const(self):
return bool(lib.eolian_function_object_is_const(self))
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 1f6a2f3d71..9389683123 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -228,6 +228,10 @@ lib.eolian_object_short_name_get.restype = c_char_p
lib.eolian_object_namespaces_get.argtypes = (c_void_p,)
lib.eolian_object_namespaces_get.restype = c_void_p
+# EAPI Eina_Bool eolian_object_is_beta(const Eolian_Object *obj);
+lib.eolian_object_is_beta.argtypes = (c_void_p,)
+lib.eolian_object_is_beta.restype = c_bool
+
### Eolian_Class ############################################################
# EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
@@ -340,10 +344,6 @@ lib.eolian_function_is_legacy_only.restype = c_bool
lib.eolian_function_is_class.argtypes = (c_void_p,)
lib.eolian_function_is_class.restype = c_bool
-# EAPI Eina_Bool eolian_function_is_beta(const Eolian_Function *function_id);
-lib.eolian_function_is_beta.argtypes = (c_void_p,)
-lib.eolian_function_is_beta.restype = c_bool
-
# EAPI Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass);
lib.eolian_function_is_constructor.argtypes = (c_void_p,c_void_p,)
lib.eolian_function_is_constructor.restype = c_bool
@@ -485,10 +485,6 @@ lib.eolian_event_documentation_get.restype = c_void_p
lib.eolian_event_scope_get.argtypes = (c_void_p,)
lib.eolian_event_scope_get.restype = c_int
-# EAPI Eina_Bool eolian_event_is_beta(const Eolian_Event *event);
-lib.eolian_event_is_beta.argtypes = (c_void_p,)
-lib.eolian_event_is_beta.restype = c_bool
-
# EAPI Eina_Bool eolian_event_is_hot(const Eolian_Event *event);
lib.eolian_event_is_hot.argtypes = (c_void_p,)
lib.eolian_event_is_hot.restype = c_bool