Eolian/Generator: Switch set/get functions generation.
authorDaniel Zaoui <daniel.zaoui@samsung.com>
Wed, 5 Mar 2014 11:45:14 +0000 (13:45 +0200)
committerDaniel Zaoui <daniel.zaoui@samsung.com>
Thu, 6 Mar 2014 13:12:51 +0000 (15:12 +0200)
We want to generate first set properties and then get properties to be
in accordance with the current op ids order.

src/bin/eolian/eo1_generator.c
src/bin/eolian/legacy_generator.c

index f41a72f..1fbdca9 100644 (file)
@@ -278,18 +278,18 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
                 _template_fill(str_subid, tmpl_eo_subid, classname, funcname, EINA_FALSE);
                 eo1_fundef_generate(classname, (Eolian_Function)data, UNRESOLVED, str_hdr);
              }
-           if (prop_read)
-             {
-                sprintf(tmpstr, "%s_get", funcname);
-                _template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE);
-                eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_hdr);
-             }
            if (prop_write)
              {
                 sprintf(tmpstr, "%s_set", funcname);
                 _template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE);
                 eo1_fundef_generate(classname, (Eolian_Function)data, SET, str_hdr);
              }
+           if (prop_read)
+             {
+                sprintf(tmpstr, "%s_get", funcname);
+                _template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE);
+                eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_hdr);
+             }
         }
 
    eina_strbuf_replace_all(str_hdr, "@#list_subid", eina_strbuf_string_get(str_subid));
@@ -621,18 +621,18 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
              Eina_Bool prop_read = ( ftype == SET ) ? EINA_FALSE : EINA_TRUE;
              Eina_Bool prop_write = ( ftype == GET ) ? EINA_FALSE : EINA_TRUE;
 
-             if (prop_read)
+             if (prop_write)
                {
-                  sprintf(tmpstr, "%s_get", funcname);
+                  sprintf(tmpstr, "%s_set", funcname);
                   _template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
-                  eo1_bind_func_generate(classname, in_prop, GET, str_bodyf, impl_class);
+                 eo1_bind_func_generate(classname, in_prop, SET, str_bodyf, impl_class);
                }
 
-             if (prop_write)
+             if (prop_read)
                {
-                  sprintf(tmpstr, "%s_set", funcname);
+                  sprintf(tmpstr, "%s_get", funcname);
                   _template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
-                 eo1_bind_func_generate(classname, in_prop, SET, str_bodyf, impl_class);
+                  eo1_bind_func_generate(classname, in_prop, GET, str_bodyf, impl_class);
                }
           }
           eina_strbuf_free(tmpl_impl);
@@ -664,15 +664,15 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
         Eina_Bool prop_read = ( ftype == SET ) ? EINA_FALSE : EINA_TRUE;
         Eina_Bool prop_write = ( ftype == GET ) ? EINA_FALSE : EINA_TRUE;
 
-        if (prop_read)
+        if (prop_write)
           {
-             char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get"));
+             char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set"));
 
-             sprintf(tmpstr, "%s_get", funcname);
+             sprintf(tmpstr, "%s_set", funcname);
              eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf);
              eina_strbuf_replace_all(tmpbuf, "@#desc", desc);
-             free(desc);
              eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
+             free(desc);
 
              if (!eolian_function_is_virtual_pure(fn))
                 eo1_eo_func_desc_generate(classname, tmpstr, tmpbuf);
@@ -680,15 +680,15 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
                 eina_strbuf_reset(tmpbuf);
              eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
           }
-        if (prop_write)
+        if (prop_read)
           {
-             char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set"));
+             char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get"));
 
-             sprintf(tmpstr, "%s_set", funcname);
+             sprintf(tmpstr, "%s_get", funcname);
              eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf);
              eina_strbuf_replace_all(tmpbuf, "@#desc", desc);
-             eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
              free(desc);
+             eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
 
              if (!eolian_function_is_virtual_pure(fn))
                 eo1_eo_func_desc_generate(classname, tmpstr, tmpbuf);
index bb93dd2..9d83fd0 100644 (file)
@@ -331,14 +331,14 @@ legacy_header_generate(const char *classname, int eo_version EINA_UNUSED, Eina_S
              {
                 _eapi_decl_func_generate(classname, (Eolian_Function)data, METHOD_FUNC, buf);
              }
-           if (prop_read)
-             {
-                _eapi_decl_func_generate(classname, (Eolian_Function)data, GET, buf);
-             }
            if (prop_write)
              {
                 _eapi_decl_func_generate(classname, (Eolian_Function)data, SET, buf);
              }
+           if (prop_read)
+             {
+                _eapi_decl_func_generate(classname, (Eolian_Function)data, GET, buf);
+             }
         }
    return EINA_TRUE;
 }
@@ -400,24 +400,24 @@ legacy_header_append(const char *classname, int eo_version EINA_UNUSED, Eina_Str
                      if (!eo1_fundef_generate(classname, (Eolian_Function)data, UNRESOLVED, str_funcdef)) return EINA_FALSE;
                   }
              }
-           if (prop_read)
+           if (prop_write)
              {
-                sprintf(tmpstr, "%s_get", funcname);
+                sprintf(tmpstr, "%s_set", funcname);
                 if (!strstr(eina_strbuf_string_get(header), tmpstr))
                   {
                      printf ("Appending eo function %s\n", tmpstr);
                      eo1_enum_append(classname, tmpstr, str_subid);
-                     if (!eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_funcdef)) return EINA_FALSE;
+                     if (!eo1_fundef_generate(classname, (Eolian_Function)data, SET, str_funcdef)) return EINA_FALSE;
                   }
              }
-           if (prop_write)
+           if (prop_read)
              {
-                sprintf(tmpstr, "%s_set", funcname);
+                sprintf(tmpstr, "%s_get", funcname);
                 if (!strstr(eina_strbuf_string_get(header), tmpstr))
                   {
                      printf ("Appending eo function %s\n", tmpstr);
                      eo1_enum_append(classname, tmpstr, str_subid);
-                     if (!eo1_fundef_generate(classname, (Eolian_Function)data, SET, str_funcdef)) return EINA_FALSE;
+                     if (!eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_funcdef)) return EINA_FALSE;
                   }
              }
         }
@@ -459,16 +459,16 @@ legacy_source_generate(const char *classname, Eina_Bool legacy, int eo_version E
         Eina_Bool prop_read = ( ftype == SET ) ? EINA_FALSE : EINA_TRUE;
         Eina_Bool prop_write = ( ftype == GET ) ? EINA_FALSE : EINA_TRUE;
 
-        if (prop_read)
-          {
-             if (!eo1_bind_func_generate(classname, fn, GET, str_bodyf, NULL)) return EINA_FALSE;
-             if (legacy) _eapi_func_generate(classname, fn, GET, str_bodyf);
-          }
         if (prop_write)
           {
              if (!eo1_bind_func_generate(classname, fn, SET, str_bodyf, NULL)) return EINA_FALSE;
              if (legacy) _eapi_func_generate(classname, fn, SET, str_bodyf);
           }
+        if (prop_read)
+          {
+             if (!eo1_bind_func_generate(classname, fn, GET, str_bodyf, NULL)) return EINA_FALSE;
+             if (legacy) _eapi_func_generate(classname, fn, GET, str_bodyf);
+          }
      }
 
    //Methods