eolian: implement a stringshare builtin
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Tue, 21 Jun 2016 13:41:18 +0000 (14:41 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Tue, 21 Jun 2016 13:41:18 +0000 (14:41 +0100)
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
src/lib/elementary/elm_app_client_view.eo
src/lib/elementary/elm_app_server.eo
src/lib/elementary/elm_dayselector.eo
src/lib/eo/eina_types.eot
src/lib/eo/eo_base.eo
src/lib/eolian/eo_lexer.c
src/lib/eolian/eo_lexer.h
src/tests/eolian/data/complex_type.eo

index a8658c3..a8c9dd3 100644 (file)
@@ -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<void *>;
    interfaces: list<void *>;
 }
 
 struct Eldbus.Introspection.Interface
 {
-   name: Eina.Stringshare *;
+   name: stringshare;
    methods: list<void *>;
    signals: list<void *>;
    properties: list<void *>;
@@ -39,35 +39,35 @@ struct Eldbus.Introspection.Interface
 
 struct Eldbus.Introspection.Method
 {
-   name: Eina.Stringshare *;
+   name: stringshare;
    arguments: list<void *>;
    annotations: list<void *>;
 }
 
 struct Eldbus.Introspection.Property
 {
-   name: Eina.Stringshare *;
-   type: Eina.Stringshare *;
+   name: stringshare;
+   type: stringshare;
    access: Eldbus.Introspection.Property_Access;
    annotations: list<void *>;
 }
 
 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<Eldbus.Introspection.Argument *>;
     annotations: list<Eldbus.Introspection.Annotation *>;
 }
index 236ee5f..3c335ab 100644 (file)
@@ -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 {
index a2e1402..1f77c7a 100644 (file)
@@ -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]]
index 1ede107..84eec69 100644 (file)
@@ -122,7 +122,7 @@ class Elm.Dayselector (Elm.Layout)
 
            @since 1.8
          ]]
-         return: own(list<own(Eina_Stringshare *)>) @warn_unused; [[A list of seven strings to be used as weekday names.]]
+         return: own(list<own(stringshare)>) @warn_unused; [[A list of seven strings to be used as weekday names.]]
       }
       day_selected_set {
          [[Set the state of given Dayselector_Day.
index 0643eef..d043da3 100644 (file)
@@ -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;
index d4e3bd6..07db677 100644 (file)
@@ -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.]]
 }
 
index b285405..1a0d9bd 100644 (file)
@@ -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 *",
 
index c2dfc17..5105288 100644 (file)
@@ -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), \
index 9eab979..30429b5 100644 (file)
@@ -14,7 +14,7 @@ class Complex_Type {
          params {
             buf: own(char*);
          }
-         return: own(list<Eina.Stringshare*>); [[comment for method return]]
+         return: own(list<stringshare>); [[comment for method return]]
       }
    }
 }