From 66b0555f595c8ce333334fd3e514a949e3d7f50b Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 29 Aug 2019 15:05:24 +0200 Subject: [PATCH] eolian: disallow legacy keyword in enums in stable api This also marks a bunch of users of that as beta, as they were effectively beta. --- src/lib/elementary/elm_general.eot | 26 ++-- src/lib/elementary/elm_general.h | 184 ++++++++++++++++++++++++++++ src/lib/eolian/database_validate.c | 5 + src/tests/eolian/data/enum.eo | 5 - src/tests/eolian/data/typedef.eo | 8 -- src/tests/eolian/data/typedef_ref.h | 7 -- src/tests/eolian/eolian_parsing.c | 13 -- 7 files changed, 202 insertions(+), 46 deletions(-) diff --git a/src/lib/elementary/elm_general.eot b/src/lib/elementary/elm_general.eot index 12d800b11a..d5080806bf 100644 --- a/src/lib/elementary/elm_general.eot +++ b/src/lib/elementary/elm_general.eot @@ -3,10 +3,10 @@ */ /* Legacy-only function pointer types, for the legacy EO classes (genlist, etc...) */ -type Evas_Smart_Cb: __undefined_type; [[Evas smart callback type]] +type @beta Evas_Smart_Cb: __undefined_type; [[Evas smart callback type]] /* FIXME: Move to Efl.Ui namespace after Efl.Ui.List gets merged! */ -enum Elm.Object.Select_Mode +enum @beta @extern Elm.Object.Select_Mode { [[Possible values for the #ELM_OBJECT_SELECT_MODE policy. @@ -29,7 +29,7 @@ enum Elm.Object.Select_Mode is forbidden.]] } -enum Elm.Icon.Type +enum @beta @extern Elm.Icon.Type { [[Elementary icon types]] legacy: elm_icon; @@ -39,13 +39,13 @@ enum Elm.Icon.Type } /* FIXME: shouldn't exist, they are unusable by the bindings */ -struct @extern Elm.Validate_Content; [[Data for the elm_validator_regexp_helper()]] -struct @extern Elm.Entry_Anchor_Info; [[The info sent in the callback for the "anchor,clicked" signals emitted - by entries.]] -struct @extern Elm.Entry_Anchor_Hover_Info; [[The info sent in the callback for "anchor,hover" signals emitted - by the Anchor_Hover widget]] +struct @beta @extern Elm.Validate_Content; [[Data for the elm_validator_regexp_helper()]] +struct @beta @extern Elm.Entry_Anchor_Info; [[The info sent in the callback for the "anchor,clicked" signals emitted + by entries.]] +struct @beta @extern Elm.Entry_Anchor_Hover_Info; [[The info sent in the callback for "anchor,hover" signals emitted + by the Anchor_Hover widget]] -enum Elm.Input.Panel.Layout +enum @beta @extern Elm.Input.Panel.Layout { [[Input panel (virtual keyboard) layout types. Type of input panel (virtual keyboard) to use - this is a hint and may not provide exactly what is desired. @@ -73,7 +73,7 @@ enum Elm.Input.Panel.Layout @since 1.19]] } -enum Elm.Input.Panel.Lang +enum @beta @extern Elm.Input.Panel.Lang { [[Input panel (virtual keyboard) language modes. ]] @@ -81,7 +81,7 @@ enum Elm.Input.Panel.Lang alphabet [[Alphabet]] } -enum Elm.Autocapital.Type +enum @beta @extern Elm.Autocapital.Type { [[Autocapitalization Types. Choose method of auto-capitalization. @@ -92,7 +92,7 @@ enum Elm.Autocapital.Type allcharacter [[Autocapitalize all letters.]] } -enum Elm.Input.Panel.Return_Key.Type +enum @beta @extern Elm.Input.Panel.Return_Key.Type { [["Return" Key types on the input panel (virtual keyboard). ]] @@ -109,7 +109,7 @@ enum Elm.Input.Panel.Return_Key.Type @since 1.8]] } -enum Elm.Input.Hints +enum @beta @extern Elm.Input.Hints { [[Enumeration that defines the types of Input Hints. diff --git a/src/lib/elementary/elm_general.h b/src/lib/elementary/elm_general.h index 4ee178b4df..6cbfb2ec1b 100644 --- a/src/lib/elementary/elm_general.h +++ b/src/lib/elementary/elm_general.h @@ -21,6 +21,190 @@ // Legacy types #include "elm_general.eot.h" +/** Possible values for the #ELM_OBJECT_SELECT_MODE policy. + * + * @since 1.7 + * + * @ingroup Elm_Object + */ +typedef enum +{ + ELM_OBJECT_SELECT_MODE_DEFAULT = 0, /**< default select mode. Once an item is + * selected, it would stay highlighted + * and not going to call selected + * callback again even it was clicked. + * Items can get focus. */ + ELM_OBJECT_SELECT_MODE_ALWAYS, /**< always select mode. Item selected + * callbacks will be called every time for + * click events, even after the item was + * already selected. Items can get focus. */ + ELM_OBJECT_SELECT_MODE_NONE, /**< no select mode. Items will never be + * highlighted and selected but the size will be + * adjusted by the finger size configuration. + * Items can't get focus. */ + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY, /**< no select mode with no finger size + * rule. Items will never be highlighted + * and selected and ignore the finger + * size. So the item size can be reduced + * below than the finger size + * configuration. Items can't get focus. + */ + ELM_OBJECT_SELECT_MODE_MAX /**< canary value: any value greater or equal to + * ELM_OBJECT_SELECT_MODE_MAX is forbidden. */ +} Elm_Object_Select_Mode; + +/** Elementary icon types + * + * @ingroup Elm_Icon + */ +typedef enum +{ + ELM_ICON_NONE = 0, /**< Icon has no type set */ + ELM_ICON_FILE, /**< Icon is of type file */ + ELM_ICON_STANDARD /**< Icon is of type standard */ +} Elm_Icon_Type; + +/** Input panel (virtual keyboard) layout types. Type of input panel (virtual + * keyboard) to use - this is a hint and may not provide exactly what is + * desired. + * + * @ingroup Elm_Input_Panel + */ +typedef enum +{ + ELM_INPUT_PANEL_LAYOUT_NORMAL = 0, /**< Default layout. */ + ELM_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout. */ + ELM_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout. */ + ELM_INPUT_PANEL_LAYOUT_URL, /**< URL layout. */ + ELM_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout. */ + ELM_INPUT_PANEL_LAYOUT_IP, /**< IP layout. */ + ELM_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout. */ + ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout. */ + ELM_INPUT_PANEL_LAYOUT_INVALID, /**< Never use this. */ + ELM_INPUT_PANEL_LAYOUT_HEX, /**< Hexadecimal layout. */ + ELM_INPUT_PANEL_LAYOUT_TERMINAL, /**< Command-line terminal layout including + * esc, alt, ctrl key, so on (no + * auto-correct, no auto-capitalization). */ + ELM_INPUT_PANEL_LAYOUT_PASSWORD, /**< Like normal, but no auto-correct, no + * auto-capitalization etc. */ + ELM_INPUT_PANEL_LAYOUT_DATETIME, /**< Date and time layout + * + * @since 1.8 */ + ELM_INPUT_PANEL_LAYOUT_EMOTICON, /**< Emoticon layout + * + * @since 1.10 */ + ELM_INPUT_PANEL_LAYOUT_VOICE /**< Voice layout, but if the IME does not + * support voice layout, then normal layout will + * be shown. + * + * @since 1.19 */ +} Elm_Input_Panel_Layout; + +/** Input panel (virtual keyboard) language modes. + * + * @ingroup Elm_Input_Panel + */ +typedef enum +{ + ELM_INPUT_PANEL_LANG_AUTOMATIC = 0, /**< Automatic */ + ELM_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */ +} Elm_Input_Panel_Lang; + +/** Autocapitalization Types. Choose method of auto-capitalization. + * + * @ingroup Elm_Autocapital + */ +typedef enum +{ + ELM_AUTOCAPITAL_TYPE_NONE = 0, /**< No auto-capitalization when typing. */ + ELM_AUTOCAPITAL_TYPE_WORD, /**< Autocapitalize each word typed. */ + ELM_AUTOCAPITAL_TYPE_SENTENCE, /**< Autocapitalize the start of each sentence. + */ + ELM_AUTOCAPITAL_TYPE_ALLCHARACTER /**< Autocapitalize all letters. */ +} Elm_Autocapital_Type; + +/** "Return" Key types on the input panel (virtual keyboard). + * + * @ingroup Elm_Input_Panel_Return_Key + */ +typedef enum +{ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT = 0, /**< Default. */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE, /**< Done. */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO, /**< Go. */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, /**< Join. */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, /**< Login. */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, /**< Next. */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, /**< Search string or magnifier icon. + */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEND, /**< Send. */ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN /**< Sign-in + * + * @since 1.8 */ +} Elm_Input_Panel_Return_Key_Type; + +/** Enumeration that defines the types of Input Hints. + * + * @since 1.12 + * + * @ingroup Elm_Input + */ +typedef enum +{ + ELM_INPUT_HINT_NONE = 0, /**< No active hints + * + * @since 1.12 */ + ELM_INPUT_HINT_AUTO_COMPLETE = 1 /* 1 >> 0 */, /**< Suggest word auto + * completion + * + * @since 1.12 */ + ELM_INPUT_HINT_SENSITIVE_DATA = 2 /* 1 >> 1 */, /**< Typed text should not be + * stored. + * + * @since 1.12 */ + ELM_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE = 256, /**< Autofill hint for a credit card + * expiration date + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_DAY = 512, /**< Autofill hint for a credit card + * expiration day + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_MONTH = 768, /**< Autofill hint for a credit card + * expiration month + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_CREDIT_CARD_EXPIRATION_YEAR = 1024, /**< Autofill hint for a credit card + * expiration year + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_CREDIT_CARD_NUMBER = 1280, /**< Autofill hint for a + * credit card number + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_EMAIL_ADDRESS = 1536, /**< Autofill hint for an email + * address + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_NAME = 1792, /**< Autofill hint for a user's real name + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_PHONE = 2048, /**< Autofill hint for a phone number + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_POSTAL_ADDRESS = 2304, /**< Autofill hint for a postal + * address + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_POSTAL_CODE = 2560, /**< Autofill hint for a postal + * code + * + * @since 1.21 */ + ELM_INPUT_HINT_AUTOFILL_ID = 2816 /**< Autofill hint for a user's ID + * + * @since 1.21 */ +} Elm_Input_Hints; + /** Data on the event when an Elementary policy has changed * * @ingroup Elm_Event diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index 7e3547b79b..ee55e6cfe3 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c @@ -184,6 +184,11 @@ _validate_typedecl(Validate_State *vals, Eolian_Typedecl *tp) return _validate(&tp->base); case EOLIAN_TYPEDECL_ENUM: { + if (vals->stable && tp->legacy) + { + _eo_parser_log(&tp->base, "legacy field not allowed in stable enums"); + return EINA_FALSE; + } Cb_Ret rt = { vals, EINA_TRUE }; eina_hash_foreach(tp->fields, (Eina_Hash_Foreach)_ef_map_cb, &rt); if (!rt.succ) diff --git a/src/tests/eolian/data/enum.eo b/src/tests/eolian/data/enum.eo index 73e8da07a3..bdc9a80e82 100644 --- a/src/tests/eolian/data/enum.eo +++ b/src/tests/eolian/data/enum.eo @@ -5,11 +5,6 @@ enum Foo { baz = 5 * 3 } -enum Bar { - legacy: test; - foo = Foo.baz -} - enum Baz { flag1 = 1 << 0, flag2 = 1 << 1, diff --git a/src/tests/eolian/data/typedef.eo b/src/tests/eolian/data/typedef.eo index 2e017324be..29f88e42c3 100644 --- a/src/tests/eolian/data/typedef.eo +++ b/src/tests/eolian/data/typedef.eo @@ -8,14 +8,6 @@ type @extern Evas.Pants: float; /* not generated */ type @beta Undef: __undefined_type; /* not generated */ -enum Enum.Bar -{ - legacy: bar; - first_item = 0, - second_item, - last_item -} - enum Elm.Object.Select_Mode { default = 0, diff --git a/src/tests/eolian/data/typedef_ref.h b/src/tests/eolian/data/typedef_ref.h index 24583b590f..524f803aee 100644 --- a/src/tests/eolian/data/typedef_ref.h +++ b/src/tests/eolian/data/typedef_ref.h @@ -19,13 +19,6 @@ typedef Evas_Coord Evas_Coord2; typedef Evas_Coord2 Evas_Coord3; -typedef enum -{ - BAR_FIRST_ITEM = 0, - BAR_SECOND_ITEM, - BAR_LAST_ITEM -} Enum_Bar; - typedef enum { ELM_OBJECT_SELECT_MODE_DEFAULT = 0, diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 9d6a219655..89daec1af5 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -928,19 +928,6 @@ EFL_START_TEST(eolian_enum) fail_if(v.type != EOLIAN_EXPR_INT); fail_if(v.value.i != 15); - fail_if(!(tdl = eolian_unit_enum_by_name_get(unit, "Bar"))); - fail_if(strcmp(eolian_typedecl_enum_legacy_prefix_get(tdl), "test")); - - fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "foo"))); - fail_if(!(exp = eolian_typedecl_enum_field_value_get(field, EINA_FALSE))); - v = eolian_expression_eval(exp, EOLIAN_MASK_ALL); - fail_if(v.type != EOLIAN_EXPR_INT); - fail_if(v.value.i != 15); - - cname = eolian_typedecl_enum_field_c_constant_get(field); - fail_if(strcmp(cname, "TEST_FOO")); - eina_stringshare_del(cname); - fail_if(!(tdl = eolian_unit_enum_by_name_get(unit, "Baz"))); fail_if(!(field = eolian_typedecl_enum_field_get(tdl, "flag1")));