forked from enlightenment/efl
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:
parent
c0297197d7
commit
64c2b292ba
|
@ -466,6 +466,15 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
|
||||||
{
|
{
|
||||||
const char *default_ret_val =
|
const char *default_ret_val =
|
||||||
eolian_function_return_default_value_get(funcid, ftype);
|
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",
|
eina_strbuf_append_printf(eo_func_decl, ", %s%s, %s",
|
||||||
ret_const ? "const " : "", rettype,
|
ret_const ? "const " : "", rettype,
|
||||||
default_ret_val?default_ret_val:"0");
|
default_ret_val?default_ret_val:"0");
|
||||||
|
|
|
@ -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);
|
sprintf (tmp_ret_str, "%s%s", ret_const?"const ":"", rettype);
|
||||||
const char *default_ret_val =
|
const char *default_ret_val =
|
||||||
eolian_function_return_default_value_get(funcid, ftype);
|
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, '*');
|
Eina_Bool had_star = !!strchr(rettype, '*');
|
||||||
sprintf (tmpstr, " %s%s%s%s = %s;\n",
|
sprintf (tmpstr, " %s%s%s%s = %s;\n",
|
||||||
ret_const?"const ":"", rettype, had_star?"":" ", retname,
|
ret_const?"const ":"", rettype, had_star?"":" ", retname,
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Simple {
|
||||||
set {
|
set {
|
||||||
/*@
|
/*@
|
||||||
comment a.set */
|
comment a.set */
|
||||||
return bool (EINA_TRUE); /*@ comment for property set return */
|
return bool (true); /*@ comment for property set return */
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class Simple {
|
||||||
@inout char b;
|
@inout char b;
|
||||||
@out double c;
|
@out double c;
|
||||||
}
|
}
|
||||||
return char *(NULL); /*@ comment for method return */
|
return char * (null); /*@ comment for method return */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Const {
|
||||||
properties {
|
properties {
|
||||||
a {
|
a {
|
||||||
set {
|
set {
|
||||||
return bool (EINA_TRUE); /*@ comment for property set return */
|
return bool (true); /*@ comment for property set return */
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
buffer: const;
|
buffer: const;
|
||||||
|
@ -21,7 +21,7 @@ class Const {
|
||||||
@inout char b;
|
@inout char b;
|
||||||
@out double c;
|
@out double c;
|
||||||
}
|
}
|
||||||
return char *(NULL); /*@ comment for method return */
|
return char * (null); /*@ comment for method return */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Object (Base) {
|
||||||
properties {
|
properties {
|
||||||
a {
|
a {
|
||||||
set {
|
set {
|
||||||
return bool(EINA_FALSE);
|
return bool (false);
|
||||||
value: const;
|
value: const;
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
|
@ -43,7 +43,7 @@ class Object (Base) {
|
||||||
@inout char b;
|
@inout char b;
|
||||||
@out double c;
|
@out double c;
|
||||||
}
|
}
|
||||||
return char *(NULL); /*@ comment for method return */
|
return char * (null); /*@ comment for method return */
|
||||||
}
|
}
|
||||||
foo2 @const {
|
foo2 @const {
|
||||||
/*@ comment foo */
|
/*@ comment foo */
|
||||||
|
|
|
@ -475,7 +475,7 @@ START_TEST(eolian_simple_parsing)
|
||||||
fail_if(strcmp(eolian_type_name_get(tp), "Eina_Bool"));
|
fail_if(strcmp(eolian_type_name_get(tp), "Eina_Bool"));
|
||||||
string = eolian_function_return_default_value_get(fid, EOLIAN_PROP_SET);
|
string = eolian_function_return_default_value_get(fid, EOLIAN_PROP_SET);
|
||||||
fail_if(!string);
|
fail_if(!string);
|
||||||
fail_if(strcmp(string, "EINA_TRUE"));
|
fail_if(strcmp(string, "true"));
|
||||||
string = eolian_function_return_comment_get(fid, EOLIAN_PROP_SET);
|
string = eolian_function_return_comment_get(fid, EOLIAN_PROP_SET);
|
||||||
fail_if(!string);
|
fail_if(!string);
|
||||||
fail_if(strcmp(string, "comment for property set return"));
|
fail_if(strcmp(string, "comment for property set return"));
|
||||||
|
@ -510,7 +510,7 @@ START_TEST(eolian_simple_parsing)
|
||||||
eina_stringshare_del(string);
|
eina_stringshare_del(string);
|
||||||
string = eolian_function_return_default_value_get(fid, EOLIAN_METHOD);
|
string = eolian_function_return_default_value_get(fid, EOLIAN_METHOD);
|
||||||
fail_if(!string);
|
fail_if(!string);
|
||||||
fail_if(strcmp(string, "NULL"));
|
fail_if(strcmp(string, "null"));
|
||||||
string = eolian_function_return_comment_get(fid, EOLIAN_METHOD);
|
string = eolian_function_return_comment_get(fid, EOLIAN_METHOD);
|
||||||
fail_if(!string);
|
fail_if(!string);
|
||||||
fail_if(strcmp(string, "comment for method return"));
|
fail_if(strcmp(string, "comment for method return"));
|
||||||
|
|
Loading…
Reference in New Issue