forked from enlightenment/efl
Eolian: add support of eo_prefix and data.
You can add in the .eo file the eo_prefix:... and data:... in case you want to override respectively the Eo prefix and the data type. If "data: null" is used, no data type will be added.
This commit is contained in:
parent
456e6f20e0
commit
4e33fd16e2
|
@ -1,7 +1,28 @@
|
|||
#include "common_funcs.h"
|
||||
#include "Eolian.h"
|
||||
|
||||
int _eolian_gen_log_dom = -1;
|
||||
|
||||
const char *current_classname = NULL;
|
||||
|
||||
static void
|
||||
_class_names_fill(const char *classname)
|
||||
{
|
||||
char *p;
|
||||
const char *eo_prefix = NULL;
|
||||
if (classname == current_classname) return;
|
||||
current_classname = classname;
|
||||
if (eolian_class_exists(classname))
|
||||
eo_prefix = eolian_class_eo_prefix_get(classname);
|
||||
if (!eo_prefix) eo_prefix = classname;
|
||||
strncpy(current_eo_prefix_lower, eo_prefix, sizeof(current_eo_prefix_lower) - 1);
|
||||
p = current_eo_prefix_lower;
|
||||
eina_str_tolower(&p);
|
||||
strncpy(current_eo_prefix_upper, eo_prefix, sizeof(current_eo_prefix_lower) - 1);
|
||||
p = current_eo_prefix_upper;
|
||||
eina_str_toupper(&p);
|
||||
}
|
||||
|
||||
void
|
||||
_template_fill(Eina_Strbuf *buf, const char* templ, const char* classname, const char *funcname, Eina_Bool reset)
|
||||
{
|
||||
|
@ -11,12 +32,15 @@ _template_fill(Eina_Strbuf *buf, const char* templ, const char* classname, const
|
|||
static char lowclass[0xFF];
|
||||
static char normclass[0xFF];
|
||||
static char capfunc[0xFF];
|
||||
static char eoprefix[0xFF];
|
||||
|
||||
char *p;
|
||||
|
||||
if (reset) eina_strbuf_reset(buf);
|
||||
if (templ) eina_strbuf_append(buf, templ);
|
||||
_class_names_fill(classname);
|
||||
if (buf)
|
||||
{
|
||||
if (reset) eina_strbuf_reset(buf);
|
||||
if (templ) eina_strbuf_append(buf, templ);
|
||||
}
|
||||
|
||||
if (strcmp(classname, normclass))
|
||||
{
|
||||
|
@ -54,25 +78,22 @@ _template_fill(Eina_Strbuf *buf, const char* templ, const char* classname, const
|
|||
p = lowobjclass;
|
||||
eina_str_tolower(&p);
|
||||
|
||||
strncpy(eoprefix, lowobjclass, sizeof(eoprefix) - 1);
|
||||
|
||||
if (!strcmp(classname, "Elm_Widget"))
|
||||
strncpy(eoprefix, "elm_wdg", sizeof(eoprefix) - 1);
|
||||
|
||||
eina_strbuf_free(classobj);
|
||||
}
|
||||
|
||||
if (funcname) strncpy(capfunc, funcname, sizeof(capfunc) - 1);
|
||||
p = capfunc; eina_str_toupper(&p);
|
||||
|
||||
if (funcname) eina_strbuf_replace_all(buf, "@#func", funcname);
|
||||
eina_strbuf_replace_all(buf, "@#FUNC", capfunc);
|
||||
eina_strbuf_replace_all(buf, "@#Class", classname);
|
||||
eina_strbuf_replace_all(buf, "@#class", lowclass);
|
||||
eina_strbuf_replace_all(buf, "@#CLASS", capclass);
|
||||
eina_strbuf_replace_all(buf, "@#OBJCLASS", capobjclass);
|
||||
eina_strbuf_replace_all(buf, "@#objclass", lowobjclass);
|
||||
eina_strbuf_replace_all(buf, "@#eoprefix", eoprefix);
|
||||
if (buf)
|
||||
{
|
||||
if (funcname) eina_strbuf_replace_all(buf, "@#func", funcname);
|
||||
eina_strbuf_replace_all(buf, "@#FUNC", capfunc);
|
||||
eina_strbuf_replace_all(buf, "@#Class", classname);
|
||||
eina_strbuf_replace_all(buf, "@#class", lowclass);
|
||||
eina_strbuf_replace_all(buf, "@#CLASS", capclass);
|
||||
eina_strbuf_replace_all(buf, "@#OBJCLASS", capobjclass);
|
||||
eina_strbuf_replace_all(buf, "@#objclass", lowobjclass);
|
||||
}
|
||||
}
|
||||
|
||||
char*
|
||||
|
|
|
@ -38,4 +38,7 @@ char *_startline(char *str, char *pos);
|
|||
|
||||
char *_source_desc_get(const char *str);
|
||||
|
||||
char current_eo_prefix_lower[256];
|
||||
|
||||
char current_eo_prefix_upper[256];
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
static const char
|
||||
tmpl_eo_src_begin[] = "\
|
||||
\n\
|
||||
EAPI Eo_Op @#OBJCLASS_BASE_ID = EO_NOOP;\n\
|
||||
EAPI Eo_Op @#EOPREFIX_BASE_ID = EO_NOOP;\n\
|
||||
\n\
|
||||
@#list_events\n\
|
||||
\n\
|
||||
|
@ -51,58 +51,58 @@ static const Eo_Class_Description _@#class_class_desc = {\n\
|
|||
EO_VERSION,\n\
|
||||
\"@#Class\",\n\
|
||||
@#type_class,\n\
|
||||
EO_CLASS_DESCRIPTION_OPS(&@#OBJCLASS_BASE_ID, _@#class_op_desc, @#OBJCLASS_SUB_ID_LAST),\n\
|
||||
EO_CLASS_DESCRIPTION_OPS(&@#EOPREFIX_BASE_ID, _@#class_op_desc, @#EOPREFIX_SUB_ID_LAST),\n\
|
||||
_@#class_event_desc,\n\
|
||||
sizeof(@#Class_Data),\n\
|
||||
@#SizeOfData,\n\
|
||||
_gen_@#class_class_constructor,\n\
|
||||
@#dtor_name\n\
|
||||
};\n\
|
||||
\n\
|
||||
EO_DEFINE_CLASS(@#objclass_class_get, &_@#class_class_desc, @#list_inheritNULL);\
|
||||
EO_DEFINE_CLASS(@#eoprefix_class_get, &_@#class_class_desc, @#list_inheritNULL);\
|
||||
";
|
||||
|
||||
static const char
|
||||
tmpl_eo_op_desc[] = "\n EO_OP_DESCRIPTION(@#OBJCLASS_SUB_ID_@#FUNC, \"@#desc\"),";
|
||||
tmpl_eo_op_desc[] = "\n EO_OP_DESCRIPTION(@#EOPREFIX_SUB_ID_@#FUNC, \"@#desc\"),";
|
||||
|
||||
static const char
|
||||
tmpl_eo_func_desc[] = "\n EO_OP_FUNC(@#OBJCLASS_ID(@#OBJCLASS_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),";
|
||||
tmpl_eo_func_desc[] = "\n EO_OP_FUNC(@#EOPREFIX_ID(@#EOPREFIX_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),";
|
||||
|
||||
static const char
|
||||
tmpl_eobase_func_desc[] = "\n EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_@#FUNC), _eo_obj_@#class_@#func),";
|
||||
|
||||
static const char
|
||||
tmpl_eo_header[] = "\
|
||||
#define @#OBJCLASS_CLASS @#objclass_class_get()\n\
|
||||
tmpl_eo_obj_header[] = "\
|
||||
#define @#EOPREFIX_CLASS @#eoprefix_class_get()\n\
|
||||
\n\
|
||||
const Eo_Class *@#objclass_class_get(void) EINA_CONST;\n\
|
||||
const Eo_Class *@#eoprefix_class_get(void) EINA_CONST;\n\
|
||||
\n\
|
||||
extern EAPI Eo_Op @#OBJCLASS_BASE_ID;\n\
|
||||
extern EAPI Eo_Op @#EOPREFIX_BASE_ID;\n\
|
||||
\n\
|
||||
enum\n\
|
||||
{@#list_subid\n\
|
||||
@#OBJCLASS_SUB_ID_LAST\n\
|
||||
@#EOPREFIX_SUB_ID_LAST\n\
|
||||
};\n\
|
||||
\n\
|
||||
#define @#OBJCLASS_ID(sub_id) (@#OBJCLASS_BASE_ID + sub_id)\n\
|
||||
#define @#EOPREFIX_ID(sub_id) (@#EOPREFIX_BASE_ID + sub_id)\n\
|
||||
";
|
||||
|
||||
static const char
|
||||
tmpl_eo_subid[] = "\n @#OBJCLASS_SUB_ID_@#FUNC,";
|
||||
tmpl_eo_subid[] = "\n @#EOPREFIX_SUB_ID_@#FUNC,";
|
||||
|
||||
static const char
|
||||
tmpl_eo_subid_apnd[] = " @#OBJCLASS_SUB_ID_@#FUNC,\n";
|
||||
tmpl_eo_subid_apnd[] = " @#EOPREFIX_SUB_ID_@#FUNC,\n";
|
||||
|
||||
static const char
|
||||
tmpl_eo_funcdef[] = "\n\
|
||||
/**\n\
|
||||
* @def @#objclass_@#func\n\
|
||||
* @def @#eoprefix_@#func\n\
|
||||
*\n\
|
||||
@#desc\n\
|
||||
*\n\
|
||||
@#list_desc_param\
|
||||
*\n\
|
||||
*/\n\
|
||||
#define @#eoprefix_@#func(@#list_param) @#OBJCLASS_ID(@#OBJCLASS_SUB_ID_@#FUNC)@#list_typecheck\n\
|
||||
#define @#eoprefix_@#func(@#list_param) @#EOPREFIX_ID(@#EOPREFIX_SUB_ID_@#FUNC)@#list_typecheck\n\
|
||||
";
|
||||
|
||||
static const char
|
||||
|
@ -135,6 +135,7 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function
|
|||
void *data;
|
||||
char funcname[0xFF];
|
||||
char descname[0xFF];
|
||||
char *tmpstr = malloc(0x1FF);
|
||||
|
||||
char *fsuffix = "";
|
||||
if (ftype == GET) fsuffix = "_get";
|
||||
|
@ -147,6 +148,9 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function
|
|||
Eina_Strbuf *str_func = eina_strbuf_new();
|
||||
_template_fill(str_func, tmpl_eo_funcdef, classname, funcname, EINA_TRUE);
|
||||
|
||||
eina_strbuf_replace_all(str_func, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
eina_strbuf_replace_all(str_func, "@#eoprefix", current_eo_prefix_lower);
|
||||
|
||||
Eina_Strbuf *linedesc = eina_strbuf_new();
|
||||
eina_strbuf_append(linedesc, funcdesc ? funcdesc : "No description supplied.");
|
||||
if (eina_strbuf_length_get(linedesc))
|
||||
|
@ -223,6 +227,7 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function
|
|||
eina_strbuf_replace_all(str_func, "@#list_desc_param", eina_strbuf_string_get(str_pardesc));
|
||||
eina_strbuf_replace_all(str_func, "@#list_typecheck", eina_strbuf_string_get(str_typecheck));
|
||||
|
||||
free(tmpstr);
|
||||
eina_strbuf_free(str_par);
|
||||
eina_strbuf_free(str_pardesc);
|
||||
eina_strbuf_free(str_typecheck);
|
||||
|
@ -239,7 +244,7 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
|||
const Eolian_Function_Type ftype_order[] = {CONSTRUCTOR, PROPERTY_FUNC, METHOD_FUNC};
|
||||
const Eina_List *l;
|
||||
void *data;
|
||||
char tmpstr[0x1FF];
|
||||
char *tmpstr = malloc(0x1FF);
|
||||
|
||||
if (!eolian_class_exists(classname))
|
||||
{
|
||||
|
@ -248,7 +253,10 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
|||
}
|
||||
|
||||
Eina_Strbuf * str_hdr = eina_strbuf_new();
|
||||
_template_fill(str_hdr, tmpl_eo_header, 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);
|
||||
|
||||
Eina_Strbuf *str_subid = eina_strbuf_new();
|
||||
Eina_Strbuf *str_ev = eina_strbuf_new();
|
||||
|
@ -300,6 +308,7 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
|||
_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_subid, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
}
|
||||
|
||||
eina_strbuf_replace_all(str_hdr, "@#list_subid", eina_strbuf_string_get(str_subid));
|
||||
|
@ -307,6 +316,7 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
|||
|
||||
eina_strbuf_append(buf, eina_strbuf_string_get(str_hdr));
|
||||
|
||||
free(tmpstr);
|
||||
eina_strbuf_free(str_subid);
|
||||
eina_strbuf_free(str_ev);
|
||||
eina_strbuf_free(tmpbuf);
|
||||
|
@ -442,7 +452,19 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
|
|||
eina_strbuf_replace_all(fbody, "@#list_vars", eina_strbuf_string_get(va_args));
|
||||
eina_strbuf_replace_all(fbody, "@#full_params", eina_strbuf_string_get(full_params));
|
||||
eina_strbuf_replace_all(fbody, "@#list_params", eina_strbuf_string_get(params));
|
||||
eina_strbuf_replace_all(fbody, "@#Datatype", classname);
|
||||
const char *data_type = eolian_class_data_type_get(classname);
|
||||
if (data_type && !strcmp(data_type, "null"))
|
||||
eina_strbuf_replace_all(fbody, "@#Datatype_Data", "void *");
|
||||
else
|
||||
{
|
||||
if (data_type) eina_strbuf_replace_all(fbody, "@#Datatype_Data", data_type);
|
||||
else eina_strbuf_replace_all(fbody, "@#Datatype", classname);
|
||||
}
|
||||
|
||||
if (!data_type || !strcmp(data_type, "null"))
|
||||
eina_strbuf_replace_all(fbody, "@#Datatype", classname);
|
||||
else
|
||||
eina_strbuf_replace_all(fbody, "@#Datatype_Data", data_type);
|
||||
eina_strbuf_append(buf, eina_strbuf_string_get(fbody));
|
||||
|
||||
eina_strbuf_free(va_args);
|
||||
|
@ -456,6 +478,7 @@ Eina_Bool
|
|||
eo1_eo_func_desc_generate(const char *classname, const char *funcname, Eina_Strbuf *buf)
|
||||
{
|
||||
_template_fill(buf, tmpl_eo_func_desc, classname, funcname, EINA_TRUE);
|
||||
eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -463,6 +486,8 @@ Eina_Bool
|
|||
eo1_eo_op_desc_generate(const char *classname, const char *funcname, Eina_Strbuf *buf)
|
||||
{
|
||||
_template_fill(buf, tmpl_eo_op_desc, classname, funcname, EINA_TRUE);
|
||||
eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -476,6 +501,7 @@ eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf)
|
|||
Eina_Strbuf *str_ev = eina_strbuf_new();
|
||||
|
||||
_template_fill(str_begin, tmpl_eo_src_begin, classname, "", EINA_TRUE);
|
||||
eina_strbuf_replace_all(str_begin, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
|
||||
Eolian_Event event;
|
||||
EINA_LIST_FOREACH(eolian_class_events_list_get(classname), itr, event)
|
||||
|
@ -547,6 +573,8 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
_template_fill(str_end, tmpl_eo_src_end, classname, "", EINA_TRUE);
|
||||
|
||||
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);
|
||||
|
||||
if (eolian_class_dtor_enable_get(classname))
|
||||
{
|
||||
|
@ -592,7 +620,9 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
eolian_implement_information_get(impl_desc, &impl_class, &funcname, &ftype);
|
||||
|
||||
eina_strbuf_reset(tmpl_impl);
|
||||
_template_fill(str_func, NULL, impl_class, NULL, EINA_FALSE); /* Invoked to set the variables */
|
||||
eina_strbuf_append(tmpl_impl, tmpl_eo_func_desc);
|
||||
eina_strbuf_replace_all(tmpl_impl, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
|
||||
char implname[0xFF];
|
||||
char *tp = implname;
|
||||
|
@ -657,12 +687,15 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
char *desc = _source_desc_get(eolian_function_description_get(fn, "comment"));
|
||||
|
||||
_template_fill(tmpbuf, tmpl_eo_op_desc, classname, funcname, EINA_TRUE);
|
||||
eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
|
||||
eina_strbuf_replace_all(tmpbuf, "@#desc", desc);
|
||||
free(desc);
|
||||
|
||||
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
|
||||
|
||||
_template_fill(str_func, tmpl_eo_func_desc, classname, funcname, EINA_FALSE);
|
||||
eina_strbuf_replace_all(str_func, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
eo1_bind_func_generate(classname, fn, UNRESOLVED, str_bodyf, NULL);
|
||||
}
|
||||
|
||||
|
@ -744,21 +777,29 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
|||
eina_strbuf_reset(tmpbuf);
|
||||
EINA_LIST_FOREACH(eolian_class_inherits_list_get(classname), itr, inherit_name)
|
||||
{
|
||||
if (!strcmp(inherit_name, "Elm_Widget"))
|
||||
eina_strbuf_append(tmpbuf, "ELM_OBJ_WIDGET_CLASS, ");
|
||||
else if (!strcmp(inherit_name, "Elm_Interface_Scrollable"))
|
||||
eina_strbuf_append(tmpbuf, "ELM_SCROLLABLE_INTERFACE, ");
|
||||
else
|
||||
_template_fill(tmpbuf, "@#OBJCLASS_CLASS, ", inherit_name, "", EINA_FALSE);
|
||||
_template_fill(tmpbuf, "@#EOPREFIX_CLASS, ", inherit_name, "", EINA_FALSE);
|
||||
eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper);
|
||||
}
|
||||
|
||||
if (eina_strbuf_length_get(tmpbuf) == 0) eina_strbuf_append(tmpbuf,"EO_BASE_CLASS, ");
|
||||
if (eina_strbuf_length_get(tmpbuf) == 0) eina_strbuf_append(tmpbuf, "NULL, ");
|
||||
eina_strbuf_replace_all(str_end, "@#list_inherit", eina_strbuf_string_get(tmpbuf));
|
||||
|
||||
eina_strbuf_replace_all(str_end, "@#list_func", eina_strbuf_string_get(str_func));
|
||||
eina_strbuf_replace_all(str_end, "@#list_op", eina_strbuf_string_get(str_op));
|
||||
eina_strbuf_replace_all(str_end, "@#list_ctors_body", eina_strbuf_string_get(str_bodyf));
|
||||
|
||||
const char *data_type = eolian_class_data_type_get(classname);
|
||||
if (data_type && !strcmp(data_type, "null"))
|
||||
eina_strbuf_replace_all(str_end, "@#SizeOfData", "0");
|
||||
else
|
||||
{
|
||||
Eina_Strbuf *sizeofbuf = eina_strbuf_new();
|
||||
eina_strbuf_append_printf(sizeofbuf, "sizeof(%s%s)",
|
||||
data_type?data_type:classname,
|
||||
data_type?"":"_Data");
|
||||
eina_strbuf_replace_all(str_end, "@#SizeOfData", eina_strbuf_string_get(sizeofbuf));
|
||||
eina_strbuf_free(sizeofbuf);
|
||||
}
|
||||
eina_strbuf_append(buf, eina_strbuf_string_get(str_end));
|
||||
|
||||
ret = EINA_TRUE;
|
||||
|
|
|
@ -234,18 +234,25 @@ _eapi_func_generate(const char *classname, Eolian_Function funcid, Eolian_Functi
|
|||
}
|
||||
|
||||
func_lpref = (func_lpref) ? func_lpref : eolian_function_data_get(funcid, EOLIAN_LEGACY);
|
||||
if (func_lpref && !strcmp(func_lpref, "null")) goto end;
|
||||
|
||||
_template_fill(fbody, tmpl_eapi_body, classname, NULL, EINA_FALSE);
|
||||
eina_strbuf_replace_all(fbody, "@#eoprefix", current_eo_prefix_lower);
|
||||
|
||||
if (func_lpref)
|
||||
eina_strbuf_replace_all(fbody, "@#eapi_prefix_@#func", func_lpref);
|
||||
else
|
||||
{
|
||||
func_lpref = eolian_class_legacy_prefix_get(classname);
|
||||
eina_strbuf_replace_all(fbody, "@#eapi_prefix", func_lpref);
|
||||
|
||||
strncpy(tmpstr, classname, sizeof(tmpstr) - 1);
|
||||
char *p = tmpstr;
|
||||
eina_str_tolower(&p);
|
||||
if (func_lpref) eina_strbuf_replace_all(fbody, "@#eapi_prefix", func_lpref);
|
||||
else
|
||||
{
|
||||
strncpy(tmpstr, classname, sizeof(tmpstr) - 1);
|
||||
char *p = tmpstr;
|
||||
eina_str_tolower(&p);
|
||||
eina_strbuf_replace_all(fbody, "@#eapi_prefix", tmpstr);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf (tmpstr, "%s%s", eolian_function_name_get(funcid), suffix);
|
||||
|
@ -308,6 +315,7 @@ _eapi_func_generate(const char *classname, Eolian_Function funcid, Eolian_Functi
|
|||
|
||||
eina_strbuf_append(buf, eina_strbuf_string_get(fbody));
|
||||
|
||||
end:
|
||||
eina_strbuf_free(fbody);
|
||||
eina_strbuf_free(fparam);
|
||||
eina_strbuf_free(eoparam);
|
||||
|
|
|
@ -217,6 +217,27 @@ EAPI const char *eolian_class_description_get(const char *class_name);
|
|||
*/
|
||||
EAPI const char *eolian_class_legacy_prefix_get(const char *class_name);
|
||||
|
||||
/*
|
||||
* @brief Returns the eo prefix of a class
|
||||
*
|
||||
* @param[in] class_name name of the class
|
||||
* @return the eo prefix
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI const char* eolian_class_eo_prefix_get(const char *class_name);
|
||||
|
||||
/*
|
||||
* @brief Returns the data type of a class
|
||||
*
|
||||
* @param[in] class_name name of the class
|
||||
* @return the data type
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI const char*
|
||||
eolian_class_data_type_get(const char *class_name);
|
||||
|
||||
/*
|
||||
* @brief Returns the names list of the inherit classes of a class
|
||||
*
|
||||
|
|
|
@ -125,6 +125,10 @@ eo_definitions_class_def_free(Eo_Class_Def *kls)
|
|||
eina_stringshare_del(kls->comment);
|
||||
if (kls->legacy_prefix)
|
||||
eina_stringshare_del(kls->legacy_prefix);
|
||||
if (kls->eo_prefix)
|
||||
eina_stringshare_del(kls->eo_prefix);
|
||||
if (kls->data_type)
|
||||
eina_stringshare_del(kls->data_type);
|
||||
|
||||
EINA_LIST_FOREACH(kls->inherits, l, s)
|
||||
if (s) eina_stringshare_del(s);
|
||||
|
|
|
@ -125,6 +125,8 @@ typedef struct _eo_class_def
|
|||
Eolian_Class_Type type;
|
||||
const char *comment;
|
||||
const char *legacy_prefix;
|
||||
const char *eo_prefix;
|
||||
const char *data_type;
|
||||
Eina_List *inherits;
|
||||
Eina_List *implements;
|
||||
Eina_List *events;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -789,6 +789,24 @@ _eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p)
|
|||
|
||||
legacy_prefix = 'legacy_prefix' ignore* colon ignore* ident %end_legacy_prefix end_statement ignore*;
|
||||
|
||||
action end_eo_prefix {
|
||||
if (!toknz->tmp.kls) ABORT(toknz, "No class!!!");
|
||||
if (toknz->tmp.kls->eo_prefix != NULL)
|
||||
ABORT(toknz, "An Eo prefix has already been given");
|
||||
toknz->tmp.kls->eo_prefix = _eo_tokenizer_token_get(toknz, fpc);
|
||||
}
|
||||
|
||||
eo_prefix = 'eo_prefix' ignore* colon ignore* ident %end_eo_prefix end_statement ignore*;
|
||||
|
||||
action end_data_type{
|
||||
if (!toknz->tmp.kls) ABORT(toknz, "No class!!!");
|
||||
if (toknz->tmp.kls->data_type != NULL)
|
||||
ABORT(toknz, "A data type has already been given");
|
||||
toknz->tmp.kls->data_type = _eo_tokenizer_token_get(toknz, fpc);
|
||||
}
|
||||
|
||||
data_type = 'data' ignore* colon ignore* ident %end_data_type end_statement ignore*;
|
||||
|
||||
class_it = ident %end_str_item ignore*;
|
||||
class_it_next = list_separator ignore* class_it;
|
||||
inherits = begin_list (class_it class_it_next*)? end_list %end_inherits;
|
||||
|
@ -890,6 +908,8 @@ _eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p)
|
|||
eo_comment => end_class_comment;
|
||||
comment => show_comment;
|
||||
legacy_prefix;
|
||||
eo_prefix;
|
||||
data_type;
|
||||
implements => end_implements;
|
||||
events => end_events;
|
||||
constructors => begin_constructors;
|
||||
|
@ -1243,6 +1263,14 @@ eo_tokenizer_database_fill(const char *filename)
|
|||
{
|
||||
database_class_legacy_prefix_set(kls->name, kls->legacy_prefix);
|
||||
}
|
||||
if (kls->eo_prefix)
|
||||
{
|
||||
database_class_eo_prefix_set(kls->name, kls->eo_prefix);
|
||||
}
|
||||
if (kls->data_type)
|
||||
{
|
||||
database_class_data_type_set(kls->name, kls->data_type);
|
||||
}
|
||||
EINA_LIST_FOREACH(kls->constructors, l, meth)
|
||||
{
|
||||
Eolian_Function foo_id = database_function_new(meth->name, CONSTRUCTOR);
|
||||
|
|
|
@ -11,6 +11,8 @@ typedef struct
|
|||
Eolian_Class_Type type;
|
||||
Eina_Stringshare *description;
|
||||
Eina_Stringshare *legacy_prefix;
|
||||
Eina_Stringshare *eo_prefix;
|
||||
Eina_Stringshare *data_type;
|
||||
Eolian_Function dflt_ctor;
|
||||
Eolian_Function dflt_dtor;
|
||||
Eina_List *inherits; /* List Eina_Stringshare * */
|
||||
|
@ -128,6 +130,8 @@ _class_del(Class_desc *class)
|
|||
eina_stringshare_del(class->file);
|
||||
eina_stringshare_del(class->description);
|
||||
eina_stringshare_del(class->legacy_prefix);
|
||||
eina_stringshare_del(class->eo_prefix);
|
||||
eina_stringshare_del(class->data_type);
|
||||
free(class);
|
||||
}
|
||||
|
||||
|
@ -299,6 +303,38 @@ database_class_legacy_prefix_set(const char *class_name, const char *legacy_pref
|
|||
desc->legacy_prefix = eina_stringshare_add(legacy_prefix);
|
||||
}
|
||||
|
||||
EAPI const char*
|
||||
eolian_class_eo_prefix_get(const char *class_name)
|
||||
{
|
||||
Class_desc *desc = _class_get(class_name);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(desc, NULL);
|
||||
return desc->eo_prefix;
|
||||
}
|
||||
|
||||
void
|
||||
database_class_eo_prefix_set(const char *class_name, const char *eo_prefix)
|
||||
{
|
||||
Class_desc *desc = _class_get(class_name);
|
||||
EINA_SAFETY_ON_NULL_RETURN(desc);
|
||||
desc->eo_prefix = eina_stringshare_add(eo_prefix);
|
||||
}
|
||||
|
||||
EAPI const char*
|
||||
eolian_class_data_type_get(const char *class_name)
|
||||
{
|
||||
Class_desc *desc = _class_get(class_name);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(desc, NULL);
|
||||
return desc->data_type;
|
||||
}
|
||||
|
||||
void
|
||||
database_class_data_type_set(const char *class_name, const char *data_type)
|
||||
{
|
||||
Class_desc *desc = _class_get(class_name);
|
||||
EINA_SAFETY_ON_NULL_RETURN(desc);
|
||||
desc->data_type= eina_stringshare_add(data_type);
|
||||
}
|
||||
|
||||
EAPI const Eina_List *
|
||||
eolian_class_inherits_list_get(const char *class_name)
|
||||
{
|
||||
|
@ -1116,6 +1152,18 @@ static Eina_Bool _class_print(const Eina_Hash *hash EINA_UNUSED, const void *key
|
|||
printf(" legacy prefix: <%s>\n", desc->legacy_prefix);
|
||||
}
|
||||
|
||||
// Eo prefix
|
||||
if (desc->eo_prefix)
|
||||
{
|
||||
printf(" Eo prefix: <%s>\n", desc->eo_prefix);
|
||||
}
|
||||
|
||||
// Data type
|
||||
if (desc->data_type)
|
||||
{
|
||||
printf(" Data type: <%s>\n", desc->data_type);
|
||||
}
|
||||
|
||||
// Default constructor
|
||||
if (desc->dflt_ctor)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,14 @@ database_class_description_set(const char *class_name, const char *description);
|
|||
void
|
||||
database_class_legacy_prefix_set(const char *class_name, const char *legacy_prefix);
|
||||
|
||||
/* Set eo prefix of class. */
|
||||
void
|
||||
database_class_eo_prefix_set(const char *class_name, const char *eo_prefix);
|
||||
|
||||
/* Set data of class. */
|
||||
void
|
||||
database_class_data_type_set(const char *class_name, const char *data_type);
|
||||
|
||||
/* Set file of class */
|
||||
Eina_Bool
|
||||
database_class_file_set(const char *class_name, const char *file_name);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Evas_Line (Evas_Object)
|
||||
{
|
||||
legacy_prefix: evas_object_line;
|
||||
eo_prefix: evas_obj_line;
|
||||
properties {
|
||||
xy {
|
||||
set {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
abstract Evas_Object (Eo_Base, Evas_Common_Interface)
|
||||
{
|
||||
eo_prefix: evas_obj;
|
||||
properties {
|
||||
size_hint_max {
|
||||
set {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Evas_Polygon (Evas_Object)
|
||||
{
|
||||
legacy_prefix: evas_object_polygon;
|
||||
eo_prefix: evas_obj_polygon;
|
||||
methods {
|
||||
point_add {
|
||||
/*@
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Evas_Rectangle (Evas_Object)
|
||||
{
|
||||
legacy_prefix: evas_object_rectangle;
|
||||
eo_prefix: evas_obj_rectangle;
|
||||
implements {
|
||||
Eo_Base::constructor;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Evas_Text (Evas_Object)
|
||||
{
|
||||
legacy_prefix: evas_object_text;
|
||||
eo_prefix: evas_obj_text;
|
||||
properties {
|
||||
font_source {
|
||||
set {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Evas_Textblock (Evas_Object)
|
||||
{
|
||||
legacy_prefix: evas_object_textblock;
|
||||
eo_prefix: evas_obj_textblock;
|
||||
properties {
|
||||
text_markup {
|
||||
set {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Evas_Textgrid (Evas_Object)
|
||||
{
|
||||
legacy_prefix: evas_object_textgrid;
|
||||
eo_prefix: evas_obj_textgrid;
|
||||
properties {
|
||||
font_source {
|
||||
set {
|
||||
|
|
Loading…
Reference in New Issue