forked from enlightenment/efl
Eolian/Generator: remove Eo1 generation
This commit is contained in:
parent
7aab226a81
commit
38b993c29b
|
@ -15,24 +15,6 @@ _gen_@#class_class_destructor(Eo_Class *klass)\n\
|
|||
\n\
|
||||
";
|
||||
|
||||
static const char
|
||||
tmpl_eo1_class_ctor[] = "\
|
||||
static void\n\
|
||||
_gen_@#class_class_constructor(Eo_Class *klass)\n\
|
||||
{\n\
|
||||
const Eo_Op_Func_Description func_desc[] = {@#list_func\n\
|
||||
EO_OP_FUNC_SENTINEL\n\
|
||||
};\n\
|
||||
eo_class_funcs_set(klass, func_desc);\n\
|
||||
@#user_ctor_func\
|
||||
}\n\n";
|
||||
|
||||
static const char
|
||||
tmpl_eo1_ops_desc[] = "\
|
||||
static const Eo_Op_Description _@#class_op_desc[] = {@#list_op\n\
|
||||
EO_OP_DESCRIPTION_SENTINEL\n\
|
||||
};\n\n";
|
||||
|
||||
static const char
|
||||
tmpl_eo_ops_desc[] = "\
|
||||
static Eo_Op_Description _@#class_op_desc[] = {@#list_op\n\
|
||||
|
@ -54,7 +36,7 @@ tmpl_eo_src[] = "\
|
|||
@#ops_desc\
|
||||
@#events_desc\
|
||||
static const Eo_Class_Description _@#class_class_desc = {\n\
|
||||
@#EO_VERSION,\n\
|
||||
EO_VERSION,\n\
|
||||
\"@#Class\",\n\
|
||||
@#type_class,\n\
|
||||
@#eo_class_desc_ops,\n\
|
||||
|
@ -67,18 +49,9 @@ static const Eo_Class_Description _@#class_class_desc = {\n\
|
|||
EO_DEFINE_CLASS(@#eoprefix_class_get, &_@#class_class_desc, @#list_inheritNULL);\
|
||||
";
|
||||
|
||||
static const char
|
||||
tmpl_eo1_op_desc[] = "\n EO_OP_DESCRIPTION(@#EOPREFIX_SUB_ID_@#FUNC, \"@#desc\"),";
|
||||
|
||||
static const char
|
||||
tmpl_eo1_func_desc[] = "\n EO_OP_FUNC(@#EOPREFIX_ID(@#EOPREFIX_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),";
|
||||
|
||||
static const char
|
||||
tmpl_eo_func_desc[] = "\n EO_OP_FUNC_OVERRIDE(@#eoprefix_@#func, _@#class_@#func),";
|
||||
|
||||
static const char
|
||||
tmpl_eo1base_func_desc[] = "\n EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),";
|
||||
|
||||
static const char
|
||||
tmpl_eo_op_desc[] = "\n EO_OP_FUNC(@#eoprefix_@#func, _@#class_@#func, \"@#desc\"),";
|
||||
|
||||
|
@ -88,22 +61,6 @@ tmpl_eo_obj_header[] = "\
|
|||
\n\
|
||||
const Eo_Class *@#eoprefix_class_get(void) EINA_CONST;\n\
|
||||
\n\
|
||||
extern EAPI Eo_Op @#EOPREFIX_BASE_ID;\n\
|
||||
\n\
|
||||
enum\n\
|
||||
{@#list_subid\n\
|
||||
@#EOPREFIX_SUB_ID_LAST\n\
|
||||
};\n\
|
||||
\n\
|
||||
#define @#EOPREFIX_ID(sub_id) (@#EOPREFIX_BASE_ID + sub_id)\n\n\
|
||||
";
|
||||
|
||||
static const char
|
||||
tmpl_eo_obj_header_no_ids[] = "\
|
||||
#define @#EOPREFIX_CLASS @#eoprefix_class_get()\n\
|
||||
\n\
|
||||
const Eo_Class *@#eoprefix_class_get(void) EINA_CONST;\n\
|
||||
\n\
|
||||
";
|
||||
|
||||
static const char
|
||||
|
@ -124,9 +81,6 @@ tmpl_eo_funcdef_doxygen[] = "\
|
|||
*\n\
|
||||
*/\n";
|
||||
|
||||
static const char
|
||||
tmpl_eo1_funcdef[] = "#define @#eoprefix_@#func(@#list_param) @#EOPREFIX_ID(@#EOPREFIX_SUB_ID_@#FUNC)@#list_typecheck\n";
|
||||
|
||||
static const char
|
||||
tmpl_eo_funcdef[] = "EAPI @#rettype @#eoprefix_@#func(@#full_params);\n";
|
||||
|
||||
|
@ -138,21 +92,8 @@ static const char
|
|||
tmpl_eo_retdesc[] =" * @return %s\n";
|
||||
#endif
|
||||
|
||||
static const char
|
||||
tmpl_eo1bind_body[] ="\
|
||||
\n\
|
||||
@#ret_type _@#class_@#func(Eo *obj, @#Datatype_Data *pd@#full_params);\n\n\
|
||||
static void\n\
|
||||
_eo_obj_@#class_@#func(Eo *obj, void *_pd, va_list *list@#list_unused)\n\
|
||||
{\n\
|
||||
@#list_vars\
|
||||
@#ret_param_@#class_@#func(obj, _pd, @#list_params);\n\
|
||||
@#return_ret\
|
||||
}\n\
|
||||
";
|
||||
|
||||
static Eina_Bool
|
||||
eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext)
|
||||
eo_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext)
|
||||
{
|
||||
const char *str_dir[] = {"in", "out", "inout"};
|
||||
const Eina_List *l;
|
||||
|
@ -192,13 +133,9 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function
|
|||
if (scope == EOLIAN_SCOPE_PROTECTED)
|
||||
eina_strbuf_append_printf(str_func, "#ifdef %s_PROTECTED\n", capclass);
|
||||
_template_fill(str_func, tmpl_eo_funcdef_doxygen, classname, funcname, EINA_FALSE);
|
||||
#ifndef EO
|
||||
_template_fill(str_func, tmpl_eo1_funcdef, classname, funcname, EINA_FALSE);
|
||||
#else
|
||||
_template_fill(str_func, tmpl_eo_funcdef, classname, funcname, EINA_FALSE);
|
||||
if (scope == EOLIAN_SCOPE_PROTECTED)
|
||||
eina_strbuf_append_printf(str_func, "#endif\n");
|
||||
#endif
|
||||
eina_strbuf_append_printf(str_func, "\n");
|
||||
|
||||
eina_strbuf_replace_all(str_func, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
|
@ -235,13 +172,7 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function
|
|||
eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, "in", pname, pdesc?pdesc:"No description supplied.");
|
||||
|
||||
if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", ");
|
||||
#ifdef EO
|
||||
eina_strbuf_append_printf(str_par, "%s %s", ptype, pname);
|
||||
#else
|
||||
eina_strbuf_append(str_par, pname);
|
||||
|
||||
eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s, %s)", ptype, pname);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!var_as_ret)
|
||||
|
@ -268,44 +199,19 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function
|
|||
eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, dir_str, pname, pdesc?pdesc:"No description supplied.");
|
||||
|
||||
if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", ");
|
||||
#ifdef EO
|
||||
eina_strbuf_append_printf(str_par, "%s%s%s%s%s",
|
||||
is_const?"const ":"",
|
||||
ptype, had_star?"":" ", add_star?"*":"", pname);
|
||||
#else
|
||||
eina_strbuf_append(str_par, pname);
|
||||
|
||||
eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s%s%s%s, %s)",
|
||||
is_const?"const ":"",
|
||||
ptype, had_star?"":" ", add_star?"*":"", pname);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (rettype && strcmp(rettype, "void"))
|
||||
{
|
||||
#ifndef EO
|
||||
const char *ret_desc = eolian_function_return_comment_get(func, ftype);
|
||||
eina_strbuf_append_printf(str_pardesc, tmpl_eo_pardesc, "out", "ret", ret_desc);
|
||||
if (eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, ", ");
|
||||
eina_strbuf_append(str_par, "ret");
|
||||
Eina_Bool had_star = !!strchr(rettype, '*');
|
||||
eina_strbuf_append_printf(str_typecheck, ", EO_TYPECHECK(%s%s%s*, ret)",
|
||||
ret_const ? "const " : "", rettype, had_star?"":" ");
|
||||
|
||||
#else
|
||||
/* eina_strbuf_append_printf(str_retdesc, tmpl_eo_retdesc, ret_desc); */
|
||||
#endif
|
||||
}
|
||||
#ifdef EO
|
||||
tmpstr[0] = '\0';
|
||||
sprintf(tmpstr, "%s%s%s",
|
||||
ret_const ? "const " : "",
|
||||
rettype ? rettype : "void",
|
||||
rettype && strchr(rettype, '*')?"":" ");
|
||||
eina_strbuf_replace_all(str_func, "@#rettype", tmpstr);
|
||||
#endif
|
||||
|
||||
eina_strbuf_replace_all(str_func, "@#list_param", eina_strbuf_string_get(str_par));
|
||||
if (!eina_strbuf_length_get(str_par)) eina_strbuf_append(str_par, "void");
|
||||
|
@ -327,7 +233,7 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
||||
eo_header_generate(const char *classname, Eina_Strbuf *buf)
|
||||
{
|
||||
const Eolian_Function_Type ftype_order[] = {EOLIAN_CTOR, EOLIAN_PROPERTY, EOLIAN_METHOD};
|
||||
const Eina_List *l;
|
||||
|
@ -342,19 +248,7 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
#ifndef EO
|
||||
if (eolian_class_functions_list_get(classname, EOLIAN_CTOR) ||
|
||||
eolian_class_functions_list_get(classname, EOLIAN_DTOR) ||
|
||||
eolian_class_functions_list_get(classname, EOLIAN_PROPERTY) ||
|
||||
eolian_class_functions_list_get(classname, EOLIAN_METHOD))
|
||||
{
|
||||
_template_fill(str_hdr, tmpl_eo_obj_header, classname, "", EINA_TRUE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
_template_fill(str_hdr, tmpl_eo_obj_header_no_ids, classname, "", EINA_TRUE);
|
||||
}
|
||||
_template_fill(str_hdr, tmpl_eo_obj_header, classname, "", EINA_TRUE);
|
||||
|
||||
eina_strbuf_replace_all(str_hdr, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
eina_strbuf_replace_all(str_hdr, "@#eoprefix", current_eo_prefix_lower);
|
||||
|
@ -397,19 +291,19 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
|||
if (!prop_read && !prop_write)
|
||||
{
|
||||
_template_fill(str_subid, tmpl_eo_subid, classname, funcname, EINA_FALSE);
|
||||
eo1_fundef_generate(classname, (Eolian_Function)data, EOLIAN_UNRESOLVED, str_hdr);
|
||||
eo_fundef_generate(classname, (Eolian_Function)data, EOLIAN_UNRESOLVED, 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, EOLIAN_PROP_SET, str_hdr);
|
||||
eo_fundef_generate(classname, (Eolian_Function)data, EOLIAN_PROP_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, EOLIAN_PROP_GET, str_hdr);
|
||||
eo_fundef_generate(classname, (Eolian_Function)data, EOLIAN_PROP_GET, str_hdr);
|
||||
}
|
||||
eina_strbuf_replace_all(str_subid, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
}
|
||||
|
@ -430,22 +324,8 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
#ifndef EO
|
||||
static const char*
|
||||
_varg_upgr(const char *stype)
|
||||
{
|
||||
if (!strcmp(stype, "Eina_Bool") ||
|
||||
!strcmp(stype, "char") ||
|
||||
!strcmp(stype, "short") ||
|
||||
!strcmp(stype, "unsigned short"))
|
||||
return "int";
|
||||
|
||||
return stype;
|
||||
}
|
||||
#endif
|
||||
|
||||
static Eina_Bool
|
||||
eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name)
|
||||
eo_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name)
|
||||
{
|
||||
const char *suffix = "";
|
||||
Eina_Bool var_as_ret = EINA_FALSE;
|
||||
|
@ -455,11 +335,7 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
|
|||
Eina_Bool add_star = EINA_FALSE;
|
||||
|
||||
Eina_Bool need_implementation = EINA_TRUE;
|
||||
#ifndef EO
|
||||
if (!impl_name && eolian_function_is_virtual_pure(funcid, ftype)) return EINA_TRUE;
|
||||
#else
|
||||
if (!impl_name && eolian_function_is_virtual_pure(funcid, ftype)) need_implementation = EINA_FALSE;
|
||||
#endif
|
||||
|
||||
Eina_Strbuf *fbody = eina_strbuf_new();
|
||||
Eina_Strbuf *va_args = eina_strbuf_new();
|
||||
|
@ -493,11 +369,7 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
|
|||
sprintf (tmpstr, "%s%s", eolian_function_name_get(funcid), suffix);
|
||||
char tmpstr2[0xFF];
|
||||
sprintf (tmpstr2, "%s_%s", classname, impl_name);
|
||||
#ifndef EO
|
||||
_template_fill(fbody, tmpl_eo1bind_body, impl_name?tmpstr2:classname, tmpstr, EINA_FALSE);
|
||||
#else
|
||||
_class_func_names_fill(impl_name?tmpstr2:classname, tmpstr);
|
||||
#endif
|
||||
|
||||
const Eina_List *l;
|
||||
void *data;
|
||||
|
@ -508,11 +380,6 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
|
|||
const char *ptype;
|
||||
eolian_parameter_information_get((Eolian_Function_Parameter)data, NULL, &ptype, &pname, NULL);
|
||||
Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET);
|
||||
#ifndef EO
|
||||
eina_strbuf_append_printf(va_args, " %s%s %s = va_arg(*list, %s%s);\n",
|
||||
is_const?"const ":"", ptype, pname,
|
||||
is_const?"const ":"", _varg_upgr(ptype));
|
||||
#endif
|
||||
if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", ");
|
||||
eina_strbuf_append_printf(params, "%s", pname);
|
||||
eina_strbuf_append_printf(full_params, ", %s%s %s",
|
||||
|
@ -530,11 +397,6 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
|
|||
Eina_Bool is_const = eolian_parameter_const_attribute_get(data, ftype == EOLIAN_PROP_GET);
|
||||
Eina_Bool had_star = !!strchr(ptype, '*');
|
||||
if (ftype == EOLIAN_UNRESOLVED || ftype == EOLIAN_METHOD) add_star = (pdir == EOLIAN_OUT_PARAM);
|
||||
#ifndef EO
|
||||
eina_strbuf_append_printf(va_args, " %s%s%s%s%s = va_arg(*list, %s%s%s%s);\n",
|
||||
is_const?"const ":"", ptype, had_star?"":" ", add_star?"*":"", pname,
|
||||
is_const?"const ":"", add_star ? ptype : _varg_upgr(ptype), !had_star && add_star?" ":"", add_star?"*":"");
|
||||
#endif
|
||||
if (eina_strbuf_length_get(params)) eina_strbuf_append(params, ", ");
|
||||
eina_strbuf_append_printf(params, "%s", pname);
|
||||
eina_strbuf_append_printf(full_params, ", %s%s%s%s%s",
|
||||
|
@ -543,44 +405,6 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef EO
|
||||
if (rettype && strcmp(rettype, "void"))
|
||||
{
|
||||
Eina_Bool had_star = !!strchr(rettype, '*');
|
||||
eina_strbuf_append_printf(va_args, " %s%s%s*%s = va_arg(*list, %s%s%s*);\n",
|
||||
ret_const?"const ":"",
|
||||
rettype, had_star?"":" ", retname,
|
||||
ret_const?"const ":"",
|
||||
rettype, had_star?"":" ");
|
||||
Eina_Strbuf *ret_param = eina_strbuf_new();
|
||||
if (rettype) eina_strbuf_append_printf(ret_param, "%s%s%s_%s = ", ret_const?"const ":"", rettype, had_star?"":" ", retname);
|
||||
eina_strbuf_replace_all(fbody, "@#ret_param", eina_strbuf_string_get(ret_param));
|
||||
sprintf(tmpstr, "%s%s", ret_const?"const ":"", rettype);
|
||||
eina_strbuf_replace_all(fbody, "@#ret_type", tmpstr);
|
||||
sprintf(tmpstr, " if (%s) *%s = _%s;\n", retname, retname, retname);
|
||||
eina_strbuf_replace_all(fbody, "@#return_ret", tmpstr);
|
||||
eina_strbuf_free(ret_param);
|
||||
}
|
||||
else
|
||||
{
|
||||
eina_strbuf_replace_all(fbody, "@#ret_param", "");
|
||||
eina_strbuf_replace_all(fbody, "@#ret_type", "void");
|
||||
eina_strbuf_replace_all(fbody, "@#return_ret", "");
|
||||
}
|
||||
|
||||
if (eina_list_count(eolian_parameters_list_get(funcid)) == 0 &&
|
||||
(eina_list_count(eolian_property_keys_list_get(funcid)) == 0))
|
||||
{
|
||||
eina_strbuf_replace_all(fbody, "@#list_unused", " EINA_UNUSED");
|
||||
}
|
||||
else
|
||||
{
|
||||
eina_strbuf_replace_all(fbody, "@#list_unused", "");
|
||||
}
|
||||
if (!eina_strbuf_length_get(params)) eina_strbuf_replace_all(fbody, ", @#list_params", "");
|
||||
eina_strbuf_replace_all(fbody, "@#list_vars", eina_strbuf_string_get(va_args));
|
||||
eina_strbuf_replace_all(fbody, "@#list_params", eina_strbuf_string_get(params));
|
||||
#else
|
||||
if (need_implementation)
|
||||
{
|
||||
Eina_Strbuf *ret_param = eina_strbuf_new();
|
||||
|
@ -624,7 +448,7 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
|
|||
eina_strbuf_append_printf(fbody, "%s\n", eina_strbuf_string_get(eo_func_decl));
|
||||
eina_strbuf_free(eo_func_decl);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (need_implementation)
|
||||
{
|
||||
eina_strbuf_replace_all(fbody, "@#full_params", eina_strbuf_string_get(full_params));
|
||||
|
@ -652,7 +476,7 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
eo1_eo_func_desc_generate(const char *class_name, const char *impl_name, const char *func_name, Eina_Strbuf *buf)
|
||||
eo_func_desc_generate(const char *class_name, const char *impl_name, const char *func_name, Eina_Strbuf *buf)
|
||||
{
|
||||
if (impl_name)
|
||||
_class_func_names_fill(impl_name, func_name);
|
||||
|
@ -676,12 +500,6 @@ eo_op_desc_generate(const char *classname, Eolian_Function fid, Eolian_Function_
|
|||
|
||||
eina_strbuf_reset(buf);
|
||||
_class_func_names_fill(classname, funcname);
|
||||
#ifndef EO
|
||||
if (ftype == EOLIAN_PROP_GET) suffix = "_GET";
|
||||
if (ftype == EOLIAN_PROP_SET) suffix = "_SET";
|
||||
eina_strbuf_append_printf(buf, "\n EO_OP_DESCRIPTION(%s_SUB_ID_%s%s, \"%s\"),",
|
||||
current_eo_prefix_upper, capfunc, suffix, desc);
|
||||
#else
|
||||
if (ftype == EOLIAN_PROP_GET) suffix = "_get";
|
||||
if (ftype == EOLIAN_PROP_SET) suffix = "_set";
|
||||
Eina_Bool is_virtual_pure = eolian_function_is_virtual_pure(fid, ftype);
|
||||
|
@ -690,31 +508,18 @@ eo_op_desc_generate(const char *classname, Eolian_Function fid, Eolian_Function_
|
|||
eina_strbuf_append_printf(buf, "_%s_%s%s, \"%s\"),", lowclass, funcname, suffix, desc);
|
||||
else
|
||||
eina_strbuf_append_printf(buf, "NULL, \"%s\"),", desc);
|
||||
#endif
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf)
|
||||
eo_source_beginning_generate(const char *classname, Eina_Strbuf *buf)
|
||||
{
|
||||
const Eina_List *itr;
|
||||
|
||||
Eina_Strbuf *tmpbuf = eina_strbuf_new();
|
||||
Eina_Strbuf *str_ev = eina_strbuf_new();
|
||||
|
||||
#ifndef EO
|
||||
if (eolian_class_functions_list_get(classname, EOLIAN_CTOR) ||
|
||||
eolian_class_functions_list_get(classname, EOLIAN_DTOR) ||
|
||||
eolian_class_functions_list_get(classname, EOLIAN_PROPERTY) ||
|
||||
eolian_class_functions_list_get(classname, EOLIAN_METHOD))
|
||||
{
|
||||
_template_fill(NULL, NULL, classname, NULL, EINA_TRUE);
|
||||
eina_strbuf_append_printf(buf, "EAPI Eo_Op @#EOPREFIX_BASE_ID = EO_NOOP;\n");
|
||||
eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
}
|
||||
#endif
|
||||
|
||||
Eolian_Event event;
|
||||
EINA_LIST_FOREACH(eolian_class_events_list_get(classname), itr, event)
|
||||
{
|
||||
|
@ -741,7 +546,7 @@ eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
||||
eo_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
||||
{
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
const Eina_List *itr;
|
||||
|
@ -782,54 +587,26 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
|
||||
_template_fill(str_end, tmpl_eo_src, classname, NULL, EINA_TRUE);
|
||||
|
||||
eina_strbuf_replace_all(str_end, "@#EO_VERSION",
|
||||
#ifdef EO
|
||||
"EO_VERSION"
|
||||
#else
|
||||
"EO_VERSION"
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
eina_strbuf_replace_all(str_end, "@#type_class", str_classtype);
|
||||
eina_strbuf_replace_all(str_end, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
eina_strbuf_replace_all(str_end, "@#eoprefix", current_eo_prefix_lower);
|
||||
|
||||
eina_strbuf_reset(tmpbuf);
|
||||
#ifndef EO
|
||||
_template_fill(tmpbuf, tmpl_eo1_class_ctor, classname, "", EINA_TRUE);
|
||||
#endif
|
||||
eina_strbuf_replace_all(str_end, "@#ctor_func", eina_strbuf_string_get(tmpbuf));
|
||||
|
||||
eina_strbuf_reset(tmpbuf);
|
||||
#ifndef EO
|
||||
_template_fill(tmpbuf, "_gen_@#class_class_constructor", classname, "", EINA_TRUE);
|
||||
eina_strbuf_replace_all(str_end, "@#ctor_name", eina_strbuf_string_get(tmpbuf));
|
||||
eina_strbuf_reset(tmpbuf);
|
||||
if (eolian_class_ctor_enable_get(classname))
|
||||
_template_fill(tmpbuf, " _@#class_class_constructor(klass);\n", classname, "", EINA_TRUE);
|
||||
eina_strbuf_replace_all(str_end, "@#user_ctor_func", eina_strbuf_string_get(tmpbuf));
|
||||
#else
|
||||
if (eolian_class_ctor_enable_get(classname))
|
||||
_template_fill(tmpbuf, "_@#class_class_constructor", classname, "", EINA_TRUE);
|
||||
else
|
||||
eina_strbuf_append_printf(tmpbuf, "NULL");
|
||||
eina_strbuf_replace_all(str_end, "@#ctor_name", eina_strbuf_string_get(tmpbuf));
|
||||
#endif
|
||||
|
||||
eina_strbuf_reset(tmpbuf);
|
||||
if (eolian_class_dtor_enable_get(classname))
|
||||
{
|
||||
#ifndef EO
|
||||
_template_fill(tmpbuf, tmpl_dtor, classname, "", EINA_TRUE);
|
||||
#endif
|
||||
eina_strbuf_replace_all(str_end, "@#dtor_func", eina_strbuf_string_get(tmpbuf));
|
||||
eina_strbuf_reset(tmpbuf);
|
||||
#ifndef EO
|
||||
_template_fill(tmpbuf, "_gen_@#class_class_destructor", classname, "", EINA_TRUE);
|
||||
#else
|
||||
_template_fill(tmpbuf, "_@#class_class_destructor", classname, "", EINA_TRUE);
|
||||
#endif
|
||||
eina_strbuf_replace_all(str_end, "@#dtor_name", eina_strbuf_string_get(tmpbuf));
|
||||
}
|
||||
else
|
||||
|
@ -844,15 +621,13 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
Eolian_Function ctor_fn = eolian_class_default_constructor_get(classname);
|
||||
if (ctor_fn)
|
||||
{
|
||||
_template_fill(str_func, tmpl_eo1base_func_desc, classname, "constructor", EINA_FALSE);
|
||||
eo1_bind_func_generate(classname, ctor_fn, EOLIAN_UNRESOLVED, str_bodyf, NULL);
|
||||
eo_bind_func_generate(classname, ctor_fn, EOLIAN_UNRESOLVED, str_bodyf, NULL);
|
||||
}
|
||||
// default destructor
|
||||
Eolian_Function dtor_fn = eolian_class_default_destructor_get(classname);
|
||||
if (dtor_fn)
|
||||
{
|
||||
_template_fill(str_func, tmpl_eo1base_func_desc, classname, "destructor", EINA_FALSE);
|
||||
eo1_bind_func_generate(classname, dtor_fn, EOLIAN_UNRESOLVED, str_bodyf, NULL);
|
||||
eo_bind_func_generate(classname, dtor_fn, EOLIAN_UNRESOLVED, str_bodyf, NULL);
|
||||
}
|
||||
|
||||
//Implements - TODO one generate func def for all
|
||||
|
@ -867,11 +642,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
|
||||
eina_strbuf_reset(tmpl_impl);
|
||||
_template_fill(str_func, NULL, impl_class, NULL, EINA_FALSE); /* Invoked to set the variables */
|
||||
#ifndef EO
|
||||
eina_strbuf_append(tmpl_impl, tmpl_eo1_func_desc);
|
||||
#else
|
||||
eina_strbuf_append(tmpl_impl, tmpl_eo_func_desc);
|
||||
#endif
|
||||
eina_strbuf_replace_all(tmpl_impl, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
eina_strbuf_replace_all(tmpl_impl, "@#eoprefix", current_eo_prefix_lower);
|
||||
|
||||
|
@ -907,12 +678,8 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
|
||||
if (in_meth)
|
||||
{
|
||||
#ifndef EO
|
||||
_template_fill(str_func, tmpl_impl_str, impl_class, funcname, EINA_FALSE);
|
||||
#else
|
||||
_template_fill(str_op, tmpl_impl_str, impl_class, funcname, EINA_FALSE);
|
||||
#endif
|
||||
eo1_bind_func_generate(classname, in_meth, EOLIAN_UNRESOLVED, str_bodyf, impl_class);
|
||||
eo_bind_func_generate(classname, in_meth, EOLIAN_UNRESOLVED, str_bodyf, impl_class);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -928,23 +695,15 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
if (prop_write)
|
||||
{
|
||||
sprintf(tmpstr, "%s_set", funcname);
|
||||
#ifndef EO
|
||||
_template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
|
||||
#else
|
||||
_template_fill(str_op, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
|
||||
#endif
|
||||
eo1_bind_func_generate(classname, in_prop, EOLIAN_PROP_SET, str_bodyf, impl_class);
|
||||
eo_bind_func_generate(classname, in_prop, EOLIAN_PROP_SET, str_bodyf, impl_class);
|
||||
}
|
||||
|
||||
if (prop_read)
|
||||
{
|
||||
sprintf(tmpstr, "%s_get", funcname);
|
||||
#ifndef EO
|
||||
_template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
|
||||
#else
|
||||
_template_fill(str_op, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
|
||||
#endif
|
||||
eo1_bind_func_generate(classname, in_prop, EOLIAN_PROP_GET, str_bodyf, impl_class);
|
||||
eo_bind_func_generate(classname, in_prop, EOLIAN_PROP_GET, str_bodyf, impl_class);
|
||||
}
|
||||
}
|
||||
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
|
||||
|
@ -959,10 +718,10 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
|
||||
free(desc);
|
||||
|
||||
eo1_eo_func_desc_generate(classname, NULL, funcname, tmpbuf);
|
||||
eo_func_desc_generate(classname, NULL, funcname, tmpbuf);
|
||||
eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
|
||||
|
||||
eo1_bind_func_generate(classname, fn, EOLIAN_UNRESOLVED, str_bodyf, NULL);
|
||||
eo_bind_func_generate(classname, fn, EOLIAN_UNRESOLVED, str_bodyf, NULL);
|
||||
}
|
||||
|
||||
//Properties
|
||||
|
@ -985,7 +744,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
free(desc);
|
||||
|
||||
if (!eolian_function_is_virtual_pure(fn, EOLIAN_PROP_SET))
|
||||
eo1_eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf);
|
||||
eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf);
|
||||
else
|
||||
eina_strbuf_reset(tmpbuf);
|
||||
eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
|
||||
|
@ -1000,7 +759,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
|
||||
|
||||
if (!eolian_function_is_virtual_pure(fn, EOLIAN_PROP_GET))
|
||||
eo1_eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf);
|
||||
eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf);
|
||||
else
|
||||
eina_strbuf_reset(tmpbuf);
|
||||
eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
|
||||
|
@ -1018,7 +777,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
|
||||
|
||||
if (!eolian_function_is_virtual_pure(fn, EOLIAN_METHOD))
|
||||
eo1_eo_func_desc_generate(classname, NULL, funcname, tmpbuf);
|
||||
eo_func_desc_generate(classname, NULL, funcname, tmpbuf);
|
||||
else
|
||||
eina_strbuf_reset(tmpbuf);
|
||||
eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
|
||||
|
@ -1071,33 +830,18 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
if (eina_strbuf_length_get(str_op))
|
||||
{
|
||||
Eina_Strbuf *ops_desc = eina_strbuf_new();
|
||||
#ifndef EO
|
||||
_template_fill(ops_desc, tmpl_eo1_ops_desc, classname, "", EINA_TRUE);
|
||||
#else
|
||||
_template_fill(ops_desc, tmpl_eo_ops_desc, classname, "", EINA_TRUE);
|
||||
#endif
|
||||
eina_strbuf_replace_all(ops_desc, "@#list_op", eina_strbuf_string_get(str_op));
|
||||
eina_strbuf_replace_all(str_end, "@#ops_desc", eina_strbuf_string_get(ops_desc));
|
||||
eina_strbuf_free(ops_desc);
|
||||
#ifndef EO
|
||||
_template_fill(tmpbuf,
|
||||
"EO_CLASS_DESCRIPTION_OPS(&@#EOPREFIX_BASE_ID, _@#class_op_desc, @#EOPREFIX_SUB_ID_LAST)",
|
||||
classname, NULL, EINA_TRUE);
|
||||
eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
#else
|
||||
_template_fill(tmpbuf,
|
||||
"EO_CLASS_DESCRIPTION_OPS(_@#class_op_desc)",
|
||||
classname, NULL, EINA_TRUE);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
eina_strbuf_replace_all(str_end, "@#ops_desc", "");
|
||||
#ifndef EO
|
||||
eina_strbuf_append_printf(tmpbuf, "EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0)");
|
||||
#else
|
||||
eina_strbuf_append_printf(tmpbuf, "EO_CLASS_DESCRIPTION_NOOPS()");
|
||||
#endif
|
||||
}
|
||||
|
||||
eina_strbuf_replace_all(str_end, "@#functions_body", eina_strbuf_string_get(str_bodyf));
|
||||
|
@ -1139,7 +883,7 @@ eo_source_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbu
|
|||
|
||||
Eina_Strbuf *str_bodyf = eina_strbuf_new();
|
||||
|
||||
if (!eo1_source_beginning_generate(classname, buf)) goto end;
|
||||
if (!eo_source_beginning_generate(classname, buf)) goto end;
|
||||
|
||||
//Properties
|
||||
EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, EOLIAN_PROPERTY), itr, fn)
|
||||
|
@ -1151,24 +895,24 @@ eo_source_generate(const char *classname, int eo_version EINA_UNUSED, Eina_Strbu
|
|||
|
||||
if (prop_write)
|
||||
{
|
||||
if (!eo1_bind_func_generate(classname, fn, EOLIAN_PROP_SET, str_bodyf, NULL)) goto end;
|
||||
if (!eo_bind_func_generate(classname, fn, EOLIAN_PROP_SET, str_bodyf, NULL)) goto end;
|
||||
}
|
||||
if (prop_read)
|
||||
{
|
||||
if (!eo1_bind_func_generate(classname, fn, EOLIAN_PROP_GET, str_bodyf, NULL)) goto end;
|
||||
if (!eo_bind_func_generate(classname, fn, EOLIAN_PROP_GET, str_bodyf, NULL)) goto end;
|
||||
}
|
||||
}
|
||||
|
||||
//Methods
|
||||
EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, EOLIAN_METHOD), itr, fn)
|
||||
{
|
||||
if (!eo1_bind_func_generate(classname, fn, EOLIAN_UNRESOLVED, str_bodyf, NULL)) goto end;
|
||||
if (!eo_bind_func_generate(classname, fn, EOLIAN_UNRESOLVED, str_bodyf, NULL)) goto end;
|
||||
}
|
||||
|
||||
eina_strbuf_append(buf, eina_strbuf_string_get(str_bodyf));
|
||||
eina_strbuf_reset(str_bodyf);
|
||||
|
||||
if (!eo1_source_end_generate(classname, buf)) goto end;
|
||||
if (!eo_source_end_generate(classname, buf)) goto end;
|
||||
|
||||
ret = EINA_TRUE;
|
||||
end:
|
||||
|
|
|
@ -29,7 +29,7 @@ eo_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf);
|
|||
* @return EINA_TRUE on success, EINA_FALSE on error.
|
||||
*
|
||||
*/
|
||||
Eina_Bool eo1_header_generate(const char *classname, Eina_Strbuf *buf);
|
||||
Eina_Bool eo_header_generate(const char *classname, Eina_Strbuf *buf);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -315,10 +315,6 @@ _eapi_func_generate(const char *classname, Eolian_Function funcid, Eolian_Functi
|
|||
{
|
||||
char tmp_ret_str[0xFF];
|
||||
sprintf (tmp_ret_str, "%s%s", ret_const?"const ":"", rettype?rettype:"void");
|
||||
#ifndef EO
|
||||
if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", ");
|
||||
eina_strbuf_append_printf(eoparam, "&%s", retname);
|
||||
#endif
|
||||
const char *dflt_ret_val =
|
||||
eolian_function_return_dflt_value_get(funcid, ftype);
|
||||
Eina_Bool had_star = !!strchr(rettype, '*');
|
||||
|
@ -329,9 +325,7 @@ _eapi_func_generate(const char *classname, Eolian_Function funcid, Eolian_Functi
|
|||
eina_strbuf_replace_all(fbody, "@#ret_type", tmp_ret_str);
|
||||
eina_strbuf_replace_all(fbody, "@#ret_init_val", tmpstr);
|
||||
tmp_ret_str[0] = '\0';
|
||||
#ifdef EO
|
||||
if (rettype && !ret_is_void) sprintf(tmp_ret_str, "%s = ", retname);
|
||||
#endif
|
||||
eina_strbuf_replace_all(fbody, "@#eo_ret_assign", tmp_ret_str);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ _generate_eo_h_file(char *filename, const char *classname)
|
|||
{
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
Eina_Strbuf *hfile = eina_strbuf_new();
|
||||
if (!eo1_header_generate(classname, hfile))
|
||||
if (!eo_header_generate(classname, hfile))
|
||||
{
|
||||
ERR("Failed to generate header for %s", classname);
|
||||
goto end;
|
||||
|
@ -249,7 +249,7 @@ int main(int argc, char **argv)
|
|||
printf(" --help/-h Print that help\n");
|
||||
printf(" --include/-I Include 'input_dir' as directory to search .eo files into\n");
|
||||
printf(" --output/-o Force output filename to 'outfile'\n");
|
||||
printf(" --eo1/--eo Set generator to eo1/eo mode. Must be specified\n");
|
||||
printf(" --eo Set generator to eo mode. Must be specified\n");
|
||||
printf(" --gh Generate c header file [.h]\n");
|
||||
printf(" --gc Generate c source file [.c]\n");
|
||||
printf(" --ah Append eo class definitions to an existing c header file [.h]\n");
|
||||
|
@ -295,7 +295,7 @@ int main(int argc, char **argv)
|
|||
|
||||
if (!eo_version && !(gen_opt==H_GEN && legacy_support))
|
||||
{
|
||||
ERR("No eo version specified (use --eo1 or --eo). Aborting eo generation.\n");
|
||||
ERR("No eo version specified (use --eo). Aborting eo generation.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue