From 758496037773748a2b06571df4509619f02b460c Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 21 Jun 2016 14:41:18 +0100 Subject: [PATCH] eolian: implement a stringshare builtin This implements a new builtin, stringshare, which is replaced with the right pointer to Eina_Strinshare as necessary. This allows simplifying binding code (it can call the proper eina APIs, deal with lifetime etc). It also removes the extern Eina.Stringshare typedef from eina_types.eot, which was actually incorrect and would generate invalid code in binding generators. @feature @fix --- src/lib/eldbus/eldbus_types.eot | 20 ++++++++++---------- src/lib/elementary/elm_app_client_view.eo | 2 +- src/lib/elementary/elm_app_server.eo | 6 +++--- src/lib/elementary/elm_dayselector.eo | 2 +- src/lib/eo/eina_types.eot | 1 - src/lib/eo/eo_base.eo | 2 +- src/lib/eolian/eo_lexer.c | 2 +- src/lib/eolian/eo_lexer.h | 2 +- src/tests/eolian/data/complex_type.eo | 2 +- 9 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/lib/eldbus/eldbus_types.eot b/src/lib/eldbus/eldbus_types.eot index a8658c3..a8c9dd3 100644 --- a/src/lib/eldbus/eldbus_types.eot +++ b/src/lib/eldbus/eldbus_types.eot @@ -23,14 +23,14 @@ enum Eldbus.Introspection.Property_Access /* FIXME: Properly type all of these lists. */ struct Eldbus.Introspection.Node { - name: Eina.Stringshare *; [[optional]] + name: stringshare; [[optional]] nodes: list; interfaces: list; } struct Eldbus.Introspection.Interface { - name: Eina.Stringshare *; + name: stringshare; methods: list; signals: list; properties: list; @@ -39,35 +39,35 @@ struct Eldbus.Introspection.Interface struct Eldbus.Introspection.Method { - name: Eina.Stringshare *; + name: stringshare; arguments: list; annotations: list; } struct Eldbus.Introspection.Property { - name: Eina.Stringshare *; - type: Eina.Stringshare *; + name: stringshare; + type: stringshare; access: Eldbus.Introspection.Property_Access; annotations: list; } struct Eldbus.Introspection.Annotation { - name: Eina.Stringshare *; - value: Eina.Stringshare *; + name: stringshare; + value: stringshare; } struct Eldbus.Introspection.Argument { - name: Eina.Stringshare *; [[Optional]] - type: Eina.Stringshare *; + name: stringshare; [[Optional]] + type: stringshare; direction: Eldbus.Introspection.Argument_Direction; } struct Eldbus.Introspection.Signal { - name: Eina.Stringshare *; + name: stringshare; arguments: list; annotations: list; } diff --git a/src/lib/elementary/elm_app_client_view.eo b/src/lib/elementary/elm_app_client_view.eo index 236ee5f..3c335ab 100644 --- a/src/lib/elementary/elm_app_client_view.eo +++ b/src/lib/elementary/elm_app_client_view.eo @@ -52,7 +52,7 @@ class Elm.App.Client.View (Eo.Base) [[Get DBus path of view]] } values { - ret: Eina.Stringshare *; [[DBus path of view]] + ret: stringshare; [[DBus path of view]] } } @property package { diff --git a/src/lib/elementary/elm_app_server.eo b/src/lib/elementary/elm_app_server.eo index a2e1402..1f77c7a 100644 --- a/src/lib/elementary/elm_app_server.eo +++ b/src/lib/elementary/elm_app_server.eo @@ -13,7 +13,7 @@ class Elm.App.Server (Eo.Base) get { } values { - icon: Eina.Stringshare *; [[title of icon]] + icon: stringshare; [[title of icon]] } } @property views { @@ -35,7 +35,7 @@ class Elm.App.Server (Eo.Base) get { } values { - ret: Eina.Stringshare *; + ret: stringshare; } } @property pixels { @@ -87,7 +87,7 @@ class Elm.App.Server (Eo.Base) } title_get { [[Get title of application]] - return: Eina.Stringshare *; [[title of application]] + return: stringshare; [[title of application]] } save { [[Save the state of all views]] diff --git a/src/lib/elementary/elm_dayselector.eo b/src/lib/elementary/elm_dayselector.eo index 1ede107..84eec69 100644 --- a/src/lib/elementary/elm_dayselector.eo +++ b/src/lib/elementary/elm_dayselector.eo @@ -122,7 +122,7 @@ class Elm.Dayselector (Elm.Layout) @since 1.8 ]] - return: own(list) @warn_unused; [[A list of seven strings to be used as weekday names.]] + return: own(list) @warn_unused; [[A list of seven strings to be used as weekday names.]] } day_selected_set { [[Set the state of given Dayselector_Day. diff --git a/src/lib/eo/eina_types.eot b/src/lib/eo/eina_types.eot index 0643eef..d043da3 100644 --- a/src/lib/eo/eina_types.eot +++ b/src/lib/eo/eina_types.eot @@ -1,5 +1,4 @@ /* FIXME: Move to Eina when we decide they are handled properly. */ -type @extern Eina.Stringshare: const(char) *; struct @extern Eina.Rectangle { x: int; y: int; diff --git a/src/lib/eo/eo_base.eo b/src/lib/eo/eo_base.eo index d4e3bd6..07db677 100644 --- a/src/lib/eo/eo_base.eo +++ b/src/lib/eo/eo_base.eo @@ -30,7 +30,7 @@ struct Eo.Callback_Array_Item { struct Eo.Dbg_Info { [[The structure for the debug info used by Eo.]] - name: Eina.Stringshare *; [[The name of the part (stringshare).]] + name: stringshare; [[The name of the part (stringshare).]] value: generic_value; [[The value.]] } diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index b285405..1a0d9bd 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -74,7 +74,7 @@ static const char * const ctypes[] = "Eina_Accessor", "Eina_Array", "Eina_Iterator", "Eina_Hash", "Eina_List", "Eina_Promise", - "Eina_Value", "const char *", + "Eina_Value", "const char *", "Eina_Stringshare *", "void *", diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index c2dfc17..5105288 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -52,7 +52,7 @@ enum Tokens \ KW(accessor), KW(array), KW(iterator), KW(hash), KW(list), \ KW(promise), \ - KW(generic_value), KW(string), \ + KW(generic_value), KW(string), KW(stringshare), \ \ KW(void_ptr), \ KW(__builtin_event_cb), \ diff --git a/src/tests/eolian/data/complex_type.eo b/src/tests/eolian/data/complex_type.eo index 9eab979..30429b5 100644 --- a/src/tests/eolian/data/complex_type.eo +++ b/src/tests/eolian/data/complex_type.eo @@ -14,7 +14,7 @@ class Complex_Type { params { buf: own(char*); } - return: own(list); [[comment for method return]] + return: own(list); [[comment for method return]] } } } -- 2.7.4