From 9009d3dae40bb702de940a995f2830d5a72a2ab2 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Fri, 22 Sep 2017 20:25:31 +0200 Subject: [PATCH] eolian: add any_value_ptr Because pointer Eina_Values and value Eina_Values have slightly different semantics (when it comes to resource management) it's better to split them. --- src/lib/efl/interfaces/efl_config.eo | 6 +++--- src/lib/efl/interfaces/efl_model.eo | 2 +- src/lib/elementary/elm_prefs.eo | 2 +- src/lib/eolian/database_validate.c | 6 +++++- src/lib/eolian/eo_lexer.c | 3 ++- src/lib/eolian/eo_lexer.h | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/lib/efl/interfaces/efl_config.eo b/src/lib/efl/interfaces/efl_config.eo index 5adf7b2..7dec728 100644 --- a/src/lib/efl/interfaces/efl_config.eo +++ b/src/lib/efl/interfaces/efl_config.eo @@ -7,7 +7,7 @@ interface Efl.Config () [[Set configuration]] params { name: string; [[Configuration option name]] - val: ptr(const(any_value)); [[Configuration option value]] + val: const(any_value_ptr); [[Configuration option value]] } return: bool; [[$false in case of error: value type was invalid, the config can't be changed, config does not exist...]] @@ -17,14 +17,14 @@ interface Efl.Config () params { name: string; [[Configuration option name]] } - return: ptr(any_value) @owned; [[Configuration option value]] + return: any_value_ptr @owned; [[Configuration option value]] } config_list_get @const { [[Returns a list of generic values under a given key.]] params { @in name: string; [[Configuration option name]] } - return: iterator @owned; [[ + return: iterator @owned; [[ List of configuration option values]] } } diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo index 7ff10a1..39db6c4 100644 --- a/src/lib/efl/interfaces/efl_model.eo +++ b/src/lib/efl/interfaces/efl_model.eo @@ -47,7 +47,7 @@ interface Efl.Model () ]] params { @in property: string; [[Property name]] - @in value: ptr(const(any_value)); [[New value]] + @in value: const(any_value_ptr); [[New value]] } return: future; [[Future returning the recorded value or error]] } diff --git a/src/lib/elementary/elm_prefs.eo b/src/lib/elementary/elm_prefs.eo index 32f72cb..aba13e6 100644 --- a/src/lib/elementary/elm_prefs.eo +++ b/src/lib/elementary/elm_prefs.eo @@ -93,7 +93,7 @@ class Elm.Prefs (Elm.Widget, Efl.File) return: bool; [[$true, on success, $false otherwise]] params { @in name: string; [[The name of the item (as declared in the prefs collection)]] - @in value: ptr(const(any_value)); [[The value to set on the item. It should be typed as the item expects, preferably, or a conversion will take place]] + @in value: const(any_value_ptr); [[The value to set on the item. It should be typed as the item expects, preferably, or a conversion will take place]] } } item_value_get @const { diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index 5f9a6b2..dd4ea21 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c @@ -142,7 +142,8 @@ static const char * const eo_complex_frees[] = static const char *eo_obj_free = "efl_del"; static const char *eo_str_free = "free"; static const char *eo_strshare_free = "eina_stringshare_del"; -static const char *eo_value_free = "eina_value_free"; +static const char *eo_value_free = "eina_value_flush"; +static const char *eo_value_ptr_free = "eina_value_free"; static Eina_Bool _validate_type(Eolian_Type *tp) @@ -190,6 +191,9 @@ _validate_type(Eolian_Type *tp) case KW_any_value: tp->freefunc = eina_stringshare_add(eo_value_free); break; + case KW_any_value_ptr: + tp->freefunc = eina_stringshare_add(eo_value_ptr_free); + break; default: break; } diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index 188af3c..c081fce 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -74,7 +74,8 @@ static const char * const ctypes[] = "Eina_Accessor *", "Eina_Array *", "Eina_Iterator *", "Eina_Hash *", "Eina_List *", "Efl_Future *", - "Eina_Value", "char *", "const char *", "Eina_Stringshare *", + "Eina_Value", "Eina_Value *", + "char *", "const char *", "Eina_Stringshare *", "void *", diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 2235806..657bf5b 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(future), \ - KW(any_value), \ + KW(any_value), KW(any_value_ptr), \ KW(mstring), KW(string), KW(stringshare), \ \ KW(void_ptr), \ -- 2.7.4