summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-22 17:10:42 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-22 17:10:42 +0200
commitf36e5bd543a1fed2bc93bc803e326684269e28d0 (patch)
tree78095130c96a60af66a74c8fd1859b8176cddaa1
parentfdd27cadf837bf3df7e8174030b3630d2649350b (diff)
eolian: add mstring
This is a new type representing a mutable string (no const). Regular strings cannot be made mutable with @owned because they might be hidden behind typedefs.
-rw-r--r--src/lib/ecore_con/efl_net_dialer_http.eo2
-rw-r--r--src/lib/elementary/efl_access_action.eo2
-rw-r--r--src/lib/elementary/elm_entry.eo2
-rw-r--r--src/lib/elementary/elm_interface_atspi_text.eo6
-rw-r--r--src/lib/elementary/elm_web.eo4
-rw-r--r--src/lib/eolian/database_type.c7
-rw-r--r--src/lib/eolian/eo_lexer.c2
-rw-r--r--src/lib/eolian/eo_lexer.h3
-rw-r--r--src/lib/evas/canvas/efl_canvas_text.eo2
-rw-r--r--src/tests/eolian/data/complex_type.eo2
-rw-r--r--src/tests/eolian/data/decl.eo2
-rw-r--r--src/tests/eolian/data/enum.eo2
-rw-r--r--src/tests/eolian/data/extern.eo2
-rw-r--r--src/tests/eolian/data/free_func.eo2
-rw-r--r--src/tests/eolian/data/function_as_argument.eo2
-rw-r--r--src/tests/eolian/data/function_types.eot2
-rw-r--r--src/tests/eolian/data/struct.eo2
-rw-r--r--src/tests/eolian/data/typedef.eo2
-rw-r--r--src/tests/eolian/data/var.eo2
-rw-r--r--src/tests/eolian_cxx/complex.eo4
-rw-r--r--src/tests/eolian_cxx/name1_name2_type_generation.eo4
21 files changed, 27 insertions, 31 deletions
diff --git a/src/lib/ecore_con/efl_net_dialer_http.eo b/src/lib/ecore_con/efl_net_dialer_http.eo
index 0e6244de9f..af2a3d8f0c 100644
--- a/src/lib/ecore_con/efl_net_dialer_http.eo
+++ b/src/lib/ecore_con/efl_net_dialer_http.eo
@@ -383,7 +383,7 @@ class Efl.Net.Dialer.Http (Efl.Loop_User, Efl.Net.Dialer, Efl.Io.Sizer) {
383 params { 383 params {
384 epochtime: int64; [[UNIX Epoch time - seconds since 1/1/1970]] 384 epochtime: int64; [[UNIX Epoch time - seconds since 1/1/1970]]
385 } 385 }
386 return: string @owned @warn_unused; [[Newly allocated null-terminated string on success or NULL on errors]] 386 return: mstring @owned @warn_unused; [[Newly allocated null-terminated string on success or NULL on errors]]
387 } 387 }
388 } 388 }
389 389
diff --git a/src/lib/elementary/efl_access_action.eo b/src/lib/elementary/efl_access_action.eo
index 577464cc93..931ecf2fd6 100644
--- a/src/lib/elementary/efl_access_action.eo
+++ b/src/lib/elementary/efl_access_action.eo
@@ -59,7 +59,7 @@ mixin Efl.Access.Action ()
59 params { 59 params {
60 @in id: int; [[ID for widget]] 60 @in id: int; [[ID for widget]]
61 } 61 }
62 return: string @owned @warn_unused; [[Should be freed by the user.]] 62 return: mstring @owned @warn_unused; [[Should be freed by the user.]]
63 } 63 }
64 } 64 }
65} 65}
diff --git a/src/lib/elementary/elm_entry.eo b/src/lib/elementary/elm_entry.eo
index 11f2af6be9..a76fda2356 100644
--- a/src/lib/elementary/elm_entry.eo
+++ b/src/lib/elementary/elm_entry.eo
@@ -632,7 +632,7 @@ class Elm.Entry (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
632 Only the text is returned, any format that may exist will not be part 632 Only the text is returned, any format that may exist will not be part
633 of the return value. You must free the string when done with \@ref free. 633 of the return value. You must free the string when done with \@ref free.
634 ]] 634 ]]
635 return: string @owned @warn_unused; [[Character]] 635 return: mstring @owned @warn_unused; [[Character]]
636 } 636 }
637 } 637 }
638 @property selection { 638 @property selection {
diff --git a/src/lib/elementary/elm_interface_atspi_text.eo b/src/lib/elementary/elm_interface_atspi_text.eo
index 8485d0885a..3cd2ddcaaa 100644
--- a/src/lib/elementary/elm_interface_atspi_text.eo
+++ b/src/lib/elementary/elm_interface_atspi_text.eo
@@ -70,7 +70,7 @@ interface Elm.Interface.Atspi.Text ()
70 end_offset: ptr(int); [[Offset indicating end of string according to given granularity. -1 in case of error.]] 70 end_offset: ptr(int); [[Offset indicating end of string according to given granularity. -1 in case of error.]]
71 } 71 }
72 values { 72 values {
73 string: string @owned; [[Newly allocated UTF-8 encoded string. Must be free by a user.]] 73 string: mstring @owned; [[Newly allocated UTF-8 encoded string. Must be free by a user.]]
74 } 74 }
75 } 75 }
76 @property text @protected { 76 @property text @protected {
@@ -82,7 +82,7 @@ interface Elm.Interface.Atspi.Text ()
82 end_offset: int; [[End offset of text.]] 82 end_offset: int; [[End offset of text.]]
83 } 83 }
84 values { 84 values {
85 text: string @owned; [[UTF-8 encoded text.]] 85 text: mstring @owned; [[UTF-8 encoded text.]]
86 } 86 }
87 } 87 }
88 @property caret_offset @protected { 88 @property caret_offset @protected {
@@ -108,7 +108,7 @@ interface Elm.Interface.Atspi.Text ()
108 end_offset: ptr(int); [[Position in text to which given attribute is set.]] 108 end_offset: ptr(int); [[Position in text to which given attribute is set.]]
109 } 109 }
110 values { 110 values {
111 value: string @owned; [[Value of text attribute. Should be free()]] 111 value: mstring @owned; [[Value of text attribute. Should be free()]]
112 } 112 }
113 } 113 }
114 @property attributes @protected { 114 @property attributes @protected {
diff --git a/src/lib/elementary/elm_web.eo b/src/lib/elementary/elm_web.eo
index f1c8e986ec..db349fd100 100644
--- a/src/lib/elementary/elm_web.eo
+++ b/src/lib/elementary/elm_web.eo
@@ -339,8 +339,8 @@ class Elm.Web (Elm.Widget)
339 The string returned must be freed by the user when it's done 339 The string returned must be freed by the user when it's done
340 with it. 340 with it.
341 ]] 341 ]]
342 /* FIXME: const doesn't belong here */ 342 /* FIXME: owned const string? */
343 return: const(string) @owned @warn_unused; [[A newly allocated string, or 343 return: string @owned @warn_unused; [[A newly allocated string, or
344 $null if nothing is selected 344 $null if nothing is selected
345 or an error occurred.]] 345 or an error occurred.]]
346 } 346 }
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index d9a8f17661..a05fa25fa5 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -146,12 +146,7 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name,
146 } 146 }
147 int kw = eo_lexer_keyword_str_to_id(tp->name); 147 int kw = eo_lexer_keyword_str_to_id(tp->name);
148 if (kw && eo_lexer_is_type_keyword(kw)) 148 if (kw && eo_lexer_is_type_keyword(kw))
149 { 149 eina_strbuf_append(buf, eo_lexer_get_c_type(kw));
150 /* FIXME: deal with aliased strings? */
151 if ((kw == KW_string) && !tp->owned)
152 eina_strbuf_append(buf, "const ");
153 eina_strbuf_append(buf, eo_lexer_get_c_type(kw));
154 }
155 else 150 else
156 eina_strbuf_append(buf, tp->name); 151 eina_strbuf_append(buf, tp->name);
157 } 152 }
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index caae8dd9bb..dc5d01fe3c 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -75,7 +75,7 @@ static const char * const ctypes[] =
75 75
76 "Eina_Accessor", "Eina_Array", "Eina_Iterator", "Eina_Hash", "Eina_List", 76 "Eina_Accessor", "Eina_Array", "Eina_Iterator", "Eina_Hash", "Eina_List",
77 "Efl_Future", 77 "Efl_Future",
78 "Eina_Value", "char *", "Eina_Stringshare *", 78 "Eina_Value", "char *", "const char *", "Eina_Stringshare *",
79 79
80 "void *", 80 "void *",
81 81
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h
index 2e7d0e5f7b..88e68a4690 100644
--- a/src/lib/eolian/eo_lexer.h
+++ b/src/lib/eolian/eo_lexer.h
@@ -54,7 +54,8 @@ enum Tokens
54 \ 54 \
55 KW(accessor), KW(array), KW(iterator), KW(hash), KW(list), \ 55 KW(accessor), KW(array), KW(iterator), KW(hash), KW(list), \
56 KW(future), \ 56 KW(future), \
57 KW(generic_value), KW(string), KW(stringshare), \ 57 KW(generic_value), \
58 KW(mstring), KW(string), KW(stringshare), \
58 \ 59 \
59 KW(void_ptr), \ 60 KW(void_ptr), \
60 KW(__builtin_free_cb), \ 61 KW(__builtin_free_cb), \
diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo
index 7d7b0f9b33..b0f075f1bf 100644
--- a/src/lib/evas/canvas/efl_canvas_text.eo
+++ b/src/lib/evas/canvas/efl_canvas_text.eo
@@ -159,7 +159,7 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format, Efl.Text.Cursor, Efl.Text.Annota
159 @since 1.18 159 @since 1.18
160 ]] 160 ]]
161 legacy: null; 161 legacy: null;
162 return: string @owned; [[The text in the given range]] 162 return: mstring @owned; [[The text in the given range]]
163 params { 163 params {
164 @in cur1: const(ptr(Efl.Text.Cursor.Cursor)); [[Start of range]] 164 @in cur1: const(ptr(Efl.Text.Cursor.Cursor)); [[Start of range]]
165 @in cur2: const(ptr(Efl.Text.Cursor.Cursor)); [[End of range]] 165 @in cur2: const(ptr(Efl.Text.Cursor.Cursor)); [[End of range]]
diff --git a/src/tests/eolian/data/complex_type.eo b/src/tests/eolian/data/complex_type.eo
index 2976125e6d..d4f85c942f 100644
--- a/src/tests/eolian/data/complex_type.eo
+++ b/src/tests/eolian/data/complex_type.eo
@@ -12,7 +12,7 @@ class Complex_Type {
12 } 12 }
13 foo { 13 foo {
14 params { 14 params {
15 buf: string @owned; 15 buf: mstring @owned;
16 } 16 }
17 return: list<stringshare> @owned; [[comment for method return]] 17 return: list<stringshare> @owned; [[comment for method return]]
18 } 18 }
diff --git a/src/tests/eolian/data/decl.eo b/src/tests/eolian/data/decl.eo
index de1ed889c3..ed036bc2a9 100644
--- a/src/tests/eolian/data/decl.eo
+++ b/src/tests/eolian/data/decl.eo
@@ -16,7 +16,7 @@ class Decl {
16 params { 16 params {
17 idx: int; 17 idx: int;
18 } 18 }
19 return: string @owned; 19 return: mstring @owned;
20 } 20 }
21 } 21 }
22} 22}
diff --git a/src/tests/eolian/data/enum.eo b/src/tests/eolian/data/enum.eo
index 4275b24567..73e8da07a3 100644
--- a/src/tests/eolian/data/enum.eo
+++ b/src/tests/eolian/data/enum.eo
@@ -39,7 +39,7 @@ class Enum {
39 params { 39 params {
40 idx: int; 40 idx: int;
41 } 41 }
42 return: string @owned; 42 return: mstring @owned;
43 } 43 }
44 } 44 }
45} 45}
diff --git a/src/tests/eolian/data/extern.eo b/src/tests/eolian/data/extern.eo
index d59caa21cd..217fb69c27 100644
--- a/src/tests/eolian/data/extern.eo
+++ b/src/tests/eolian/data/extern.eo
@@ -22,7 +22,7 @@ class Extern {
22 params { 22 params {
23 idx: int; 23 idx: int;
24 } 24 }
25 return: string @owned; 25 return: mstring @owned;
26 } 26 }
27 } 27 }
28} 28}
diff --git a/src/tests/eolian/data/free_func.eo b/src/tests/eolian/data/free_func.eo
index 5e77e5cb4b..6a3228ba81 100644
--- a/src/tests/eolian/data/free_func.eo
+++ b/src/tests/eolian/data/free_func.eo
@@ -24,7 +24,7 @@ class Free_Func {
24 params { 24 params {
25 idx: int; 25 idx: int;
26 } 26 }
27 return: string @owned; 27 return: mstring @owned;
28 } 28 }
29 } 29 }
30} 30}
diff --git a/src/tests/eolian/data/function_as_argument.eo b/src/tests/eolian/data/function_as_argument.eo
index 4c27253e40..5a14e8679e 100644
--- a/src/tests/eolian/data/function_as_argument.eo
+++ b/src/tests/eolian/data/function_as_argument.eo
@@ -19,7 +19,7 @@ class Function_As_Argument {
19 a: int; 19 a: int;
20 b: double; 20 b: double;
21 } 21 }
22 return: string @owned; 22 return: mstring @owned;
23 } 23 }
24 } 24 }
25} 25}
diff --git a/src/tests/eolian/data/function_types.eot b/src/tests/eolian/data/function_types.eot
index 5eae0e2da4..e8bc1865b5 100644
--- a/src/tests/eolian/data/function_types.eot
+++ b/src/tests/eolian/data/function_types.eot
@@ -16,7 +16,7 @@ function SimpleFunc {
16function ComplexFunc { 16function ComplexFunc {
17 params { 17 params {
18 @in c: string; 18 @in c: string;
19 @out d: string @owned; 19 @out d: mstring @owned;
20 } 20 }
21 return: double; 21 return: double;
22}; 22};
diff --git a/src/tests/eolian/data/struct.eo b/src/tests/eolian/data/struct.eo
index cb8981db37..cb664f366c 100644
--- a/src/tests/eolian/data/struct.eo
+++ b/src/tests/eolian/data/struct.eo
@@ -23,7 +23,7 @@ class Struct {
23 params { 23 params {
24 idx: int; 24 idx: int;
25 } 25 }
26 return: string @owned; 26 return: mstring @owned;
27 } 27 }
28 bar { 28 bar {
29 return: ptr(Named); 29 return: ptr(Named);
diff --git a/src/tests/eolian/data/typedef.eo b/src/tests/eolian/data/typedef.eo
index 59a33cb685..ad6ed00ff8 100644
--- a/src/tests/eolian/data/typedef.eo
+++ b/src/tests/eolian/data/typedef.eo
@@ -33,7 +33,7 @@ class Typedef {
33 params { 33 params {
34 idx: int; 34 idx: int;
35 } 35 }
36 return: string @owned; 36 return: mstring @owned;
37 } 37 }
38 } 38 }
39} 39}
diff --git a/src/tests/eolian/data/var.eo b/src/tests/eolian/data/var.eo
index 6605d30e28..a618f0331f 100644
--- a/src/tests/eolian/data/var.eo
+++ b/src/tests/eolian/data/var.eo
@@ -16,7 +16,7 @@ class Var {
16 params { 16 params {
17 idx: int; 17 idx: int;
18 } 18 }
19 return: string @owned; 19 return: mstring @owned;
20 } 20 }
21 } 21 }
22} 22}
diff --git a/src/tests/eolian_cxx/complex.eo b/src/tests/eolian_cxx/complex.eo
index df1c337b08..b9442a2ef1 100644
--- a/src/tests/eolian_cxx/complex.eo
+++ b/src/tests/eolian_cxx/complex.eo
@@ -40,7 +40,7 @@ class Complex (Efl.Object)
40 } 40 }
41 instringowncont { 41 instringowncont {
42 params { 42 params {
43 l: list<string @owned>; 43 l: list<mstring @owned>;
44 } 44 }
45 } 45 }
46 instringcontown { 46 instringcontown {
@@ -121,7 +121,7 @@ class Complex (Efl.Object)
121 } 121 }
122 outstringowncont { 122 outstringowncont {
123 params { 123 params {
124 @out l: list<string @owned>; 124 @out l: list<mstring @owned>;
125 } 125 }
126 } 126 }
127 outstringcontown { 127 outstringcontown {
diff --git a/src/tests/eolian_cxx/name1_name2_type_generation.eo b/src/tests/eolian_cxx/name1_name2_type_generation.eo
index 833a54059b..ee4d044a36 100644
--- a/src/tests/eolian_cxx/name1_name2_type_generation.eo
+++ b/src/tests/eolian_cxx/name1_name2_type_generation.eo
@@ -56,7 +56,7 @@ class Name1.Name2.Type_Generation (Efl.Object)
56 } 56 }
57 instringown { 57 instringown {
58 params { 58 params {
59 @in v: string @owned; 59 @in v: mstring @owned;
60 } 60 }
61 } 61 }
62 instringptrown { 62 instringptrown {
@@ -102,7 +102,7 @@ class Name1.Name2.Type_Generation (Efl.Object)
102 return: ptr(string); 102 return: ptr(string);
103 } 103 }
104 returnstringown { 104 returnstringown {
105 return: string @owned; 105 return: mstring @owned;
106 } 106 }
107 returnstringownptr { 107 returnstringownptr {
108 return: ptr(string) @owned; 108 return: ptr(string) @owned;