q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=64c2b292ba76cdaffee0feaf9b0fe3548d58cb89

commit 64c2b292ba76cdaffee0feaf9b0fe3548d58cb89
Author: Daniel Kolesa <[email protected]>
Date:   Mon Jul 28 10:16:15 2014 +0100

    eolian: preliminary eo file support for builtin true/false/null
    
    Real API will use the new expression system, but that won't get into 1.11.
---
 src/bin/eolian/eo_generator.c         | 9 +++++++++
 src/bin/eolian/legacy_generator.c     | 9 +++++++++
 src/tests/eolian/data/class_simple.eo | 4 ++--
 src/tests/eolian/data/consts.eo       | 4 ++--
 src/tests/eolian/data/object_impl.eo  | 4 ++--
 src/tests/eolian/eolian_parsing.c     | 4 ++--
 6 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index b5cb402..65690d1 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -466,6 +466,15 @@ eo_bind_func_generate(const Eolian_Class *class, const 
Eolian_Function *funcid,
           {
              const char *default_ret_val =
                 eolian_function_return_default_value_get(funcid, ftype);
+             if (default_ret_val)
+               {
+                  if (!strcmp(default_ret_val, "true"))
+                    default_ret_val = "EINA_TRUE";
+                  else if (!strcmp(default_ret_val, "false"))
+                    default_ret_val = "EINA_FALSE";
+                  else if (!strcmp(default_ret_val, "null"))
+                    default_ret_val = "NULL";
+               }
              eina_strbuf_append_printf(eo_func_decl, ", %s%s, %s",
                    ret_const ? "const " : "", rettype,
                    default_ret_val?default_ret_val:"0");
diff --git a/src/bin/eolian/legacy_generator.c 
b/src/bin/eolian/legacy_generator.c
index fa97578..db4f64e 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -301,6 +301,15 @@ _eapi_func_generate(const Eolian_Class *class, const 
Eolian_Function *funcid, Eo
         sprintf (tmp_ret_str, "%s%s", ret_const?"const ":"", rettype);
              const char *default_ret_val =
                 eolian_function_return_default_value_get(funcid, ftype);
+             if (default_ret_val)
+               {
+                  if (!strcmp(default_ret_val, "true"))
+                    default_ret_val = "EINA_TRUE";
+                  else if (!strcmp(default_ret_val, "false"))
+                    default_ret_val = "EINA_FALSE";
+                  else if (!strcmp(default_ret_val, "null"))
+                    default_ret_val = "NULL";
+               }
              Eina_Bool had_star = !!strchr(rettype, '*');
              sprintf (tmpstr, "   %s%s%s%s = %s;\n",
                    ret_const?"const ":"", rettype, had_star?"":" ", retname,
diff --git a/src/tests/eolian/data/class_simple.eo 
b/src/tests/eolian/data/class_simple.eo
index 9375eb7..ae7a932 100644
--- a/src/tests/eolian/data/class_simple.eo
+++ b/src/tests/eolian/data/class_simple.eo
@@ -8,7 +8,7 @@ class Simple {
          set {
             /*@
             comment a.set */
-            return bool (EINA_TRUE); /*@ comment for property set return */
+            return bool (true); /*@ comment for property set return */
          }
          get {
          }
@@ -25,7 +25,7 @@ class Simple {
             @inout char b;
             @out double c;
          }
-         return char *(NULL); /*@ comment for method return */
+         return char * (null); /*@ comment for method return */
       }
    }
 }
diff --git a/src/tests/eolian/data/consts.eo b/src/tests/eolian/data/consts.eo
index 9e9ff4d..0dff005 100644
--- a/src/tests/eolian/data/consts.eo
+++ b/src/tests/eolian/data/consts.eo
@@ -2,7 +2,7 @@ class Const {
    properties {
       a {
          set {
-            return bool (EINA_TRUE); /*@ comment for property set return */
+            return bool (true); /*@ comment for property set return */
          }
          get {
             buffer: const;
@@ -21,7 +21,7 @@ class Const {
             @inout char b;
             @out double c;
          }
-         return char *(NULL); /*@ comment for method return */
+         return char * (null); /*@ comment for method return */
       }
    }
 }
diff --git a/src/tests/eolian/data/object_impl.eo 
b/src/tests/eolian/data/object_impl.eo
index 7588cb2..16dc295 100644
--- a/src/tests/eolian/data/object_impl.eo
+++ b/src/tests/eolian/data/object_impl.eo
@@ -12,7 +12,7 @@ class Object (Base) {
    properties {
       a {
          set {
-            return bool(EINA_FALSE);
+            return bool (false);
             value: const;
          }
          get {
@@ -43,7 +43,7 @@ class Object (Base) {
             @inout char b;
             @out double c;
          }
-         return char *(NULL); /*@ comment for method return */
+         return char * (null); /*@ comment for method return */
       }
       foo2 @const {
          /*@ comment foo */
diff --git a/src/tests/eolian/eolian_parsing.c 
b/src/tests/eolian/eolian_parsing.c
index f1bdd15..60a12d7 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -475,7 +475,7 @@ START_TEST(eolian_simple_parsing)
    fail_if(strcmp(eolian_type_name_get(tp), "Eina_Bool"));
    string = eolian_function_return_default_value_get(fid, EOLIAN_PROP_SET);
    fail_if(!string);
-   fail_if(strcmp(string, "EINA_TRUE"));
+   fail_if(strcmp(string, "true"));
    string = eolian_function_return_comment_get(fid, EOLIAN_PROP_SET);
    fail_if(!string);
    fail_if(strcmp(string, "comment for property set return"));
@@ -510,7 +510,7 @@ START_TEST(eolian_simple_parsing)
    eina_stringshare_del(string);
    string = eolian_function_return_default_value_get(fid, EOLIAN_METHOD);
    fail_if(!string);
-   fail_if(strcmp(string, "NULL"));
+   fail_if(strcmp(string, "null"));
    string = eolian_function_return_comment_get(fid, EOLIAN_METHOD);
    fail_if(!string);
    fail_if(strcmp(string, "comment for method return"));

-- 


Reply via email to