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.
This commit is contained in:
Daniel Kolesa 2014-07-28 10:16:15 +01:00
parent c0297197d7
commit 64c2b292ba
6 changed files with 26 additions and 8 deletions

View File

@ -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");

View File

@ -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,

View File

@ -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 */
}
}
}

View File

@ -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 */
}
}
}

View File

@ -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 */

View File

@ -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"));