forked from enlightenment/efl
Eolian/Lexer: support data type for events.
This commit is contained in:
parent
8e5234cf75
commit
0eb092d157
|
@ -286,7 +286,7 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
|
||||||
{
|
{
|
||||||
const char *evname = NULL;
|
const char *evname = NULL;
|
||||||
const char *evdesc = NULL;
|
const char *evdesc = NULL;
|
||||||
eolian_class_event_information_get(event, &evname, &evdesc);
|
eolian_class_event_information_get(event, &evname, NULL, &evdesc);
|
||||||
|
|
||||||
if (!evdesc) evdesc = "No description";
|
if (!evdesc) evdesc = "No description";
|
||||||
eina_strbuf_reset(tmpbuf);
|
eina_strbuf_reset(tmpbuf);
|
||||||
|
@ -553,7 +553,7 @@ eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf)
|
||||||
const char *evdesc;
|
const char *evdesc;
|
||||||
char *evdesc_line1;
|
char *evdesc_line1;
|
||||||
|
|
||||||
eolian_class_event_information_get(event, &evname, &evdesc);
|
eolian_class_event_information_get(event, &evname, NULL, &evdesc);
|
||||||
evdesc_line1 = _source_desc_get(evdesc);
|
evdesc_line1 = _source_desc_get(evdesc);
|
||||||
_template_fill(str_ev, "@#CLASS_EVENT_@#FUNC", classname, evname, EINA_TRUE);
|
_template_fill(str_ev, "@#CLASS_EVENT_@#FUNC", classname, evname, EINA_TRUE);
|
||||||
eina_strbuf_replace_all(str_ev, ",", "_");
|
eina_strbuf_replace_all(str_ev, ",", "_");
|
||||||
|
@ -810,7 +810,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
|
||||||
{
|
{
|
||||||
const char *evname;
|
const char *evname;
|
||||||
|
|
||||||
eolian_class_event_information_get(event, &evname, NULL);
|
eolian_class_event_information_get(event, &evname, NULL, NULL);
|
||||||
_template_fill(tmpbuf, "@#CLASS_EVENT_@#FUNC", classname, evname, EINA_TRUE);
|
_template_fill(tmpbuf, "@#CLASS_EVENT_@#FUNC", classname, evname, EINA_TRUE);
|
||||||
eina_strbuf_replace_all(tmpbuf, ",", "_");
|
eina_strbuf_replace_all(tmpbuf, ",", "_");
|
||||||
eina_strbuf_append_printf(str_ev, "\n %s,", eina_strbuf_string_get(tmpbuf));
|
eina_strbuf_append_printf(str_ev, "\n %s,", eina_strbuf_string_get(tmpbuf));
|
||||||
|
|
|
@ -578,7 +578,7 @@ EAPI const Eina_List *eolian_class_events_list_get(const char *class_name);
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool eolian_class_event_information_get(Eolian_Event event, const char **event_name, const char **event_desc);
|
EAPI Eina_Bool eolian_class_event_information_get(Eolian_Event event, const char **event_name, const char **event_type, const char **event_desc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Indicates if the class constructor has to invoke
|
* @brief Indicates if the class constructor has to invoke
|
||||||
|
|
|
@ -95,6 +95,8 @@ eo_definitions_event_def_free(Eo_Event_Def *sgn)
|
||||||
{
|
{
|
||||||
if (sgn->name)
|
if (sgn->name)
|
||||||
eina_stringshare_del(sgn->name);
|
eina_stringshare_del(sgn->name);
|
||||||
|
if (sgn->type)
|
||||||
|
eina_stringshare_del(sgn->type);
|
||||||
if (sgn->comment)
|
if (sgn->comment)
|
||||||
eina_stringshare_del(sgn->comment);
|
eina_stringshare_del(sgn->comment);
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ typedef struct _eo_method_def
|
||||||
typedef struct _eo_event_def
|
typedef struct _eo_event_def
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
const char *type;
|
||||||
const char *comment;
|
const char *comment;
|
||||||
} Eo_Event_Def;
|
} Eo_Event_Def;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -828,6 +828,13 @@ _eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p)
|
||||||
toknz->tmp.kls->events = eina_list_append(toknz->tmp.kls->events, toknz->tmp.event);
|
toknz->tmp.kls->events = eina_list_append(toknz->tmp.kls->events, toknz->tmp.event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
action end_event_type {
|
||||||
|
if (!toknz->tmp.event) ABORT(toknz, "No event!!!");
|
||||||
|
if (toknz->tmp.event->type != NULL)
|
||||||
|
ABORT(toknz, "event %s has already a type %s", toknz->tmp.event->name, toknz->tmp.event->type);
|
||||||
|
toknz->tmp.event->type = _eo_tokenizer_token_get(toknz, fpc-1);
|
||||||
|
}
|
||||||
|
|
||||||
action end_event_comment {
|
action end_event_comment {
|
||||||
if (!toknz->tmp.event) ABORT(toknz, "No event!!!");
|
if (!toknz->tmp.event) ABORT(toknz, "No event!!!");
|
||||||
if (toknz->tmp.event->comment != NULL)
|
if (toknz->tmp.event->comment != NULL)
|
||||||
|
@ -951,7 +958,8 @@ _eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p)
|
||||||
implements = 'implements' ignore* begin_def ignore* impl_it* end_def;
|
implements = 'implements' ignore* begin_def ignore* impl_it* end_def;
|
||||||
|
|
||||||
event_comment = ws* eo_comment %end_event_comment;
|
event_comment = ws* eo_comment %end_event_comment;
|
||||||
event_it = event %end_event_name ignore* end_statement event_comment? ignore*;
|
event_type = begin_list ws* alpha_u >save_fpc (alnum_u | '*' | ws )* ws* end_list %end_event_type;
|
||||||
|
event_it = event %end_event_name ws* event_type? ignore* end_statement event_comment? ignore*;
|
||||||
events = 'events' ignore* begin_def ignore* event_it* end_def;
|
events = 'events' ignore* begin_def ignore* event_it* end_def;
|
||||||
|
|
||||||
constructors = 'constructors' ignore* begin_def;
|
constructors = 'constructors' ignore* begin_def;
|
||||||
|
@ -1184,7 +1192,7 @@ eo_tokenizer_dump(Eo_Tokenizer *toknz)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" events:\n");
|
printf(" events:\n");
|
||||||
EINA_LIST_FOREACH(kls->events, l, sgn)
|
EINA_LIST_FOREACH(kls->events, l, sgn)
|
||||||
printf(" %s (%s)\n", sgn->name, sgn->comment);
|
printf(" %s <%s> (%s)\n", sgn->name, sgn->type, sgn->comment);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(kls->constructors, l, meth)
|
EINA_LIST_FOREACH(kls->constructors, l, meth)
|
||||||
{
|
{
|
||||||
|
@ -1511,7 +1519,7 @@ eo_tokenizer_database_fill(const char *filename)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(kls->events, l, event)
|
EINA_LIST_FOREACH(kls->events, l, event)
|
||||||
{
|
{
|
||||||
Eolian_Event ev = database_event_new(event->name, event->comment);
|
Eolian_Event ev = database_event_new(event->name, event->type, event->comment);
|
||||||
database_class_event_add(kls->name, ev);
|
database_class_event_add(kls->name, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Eina_Stringshare *name;
|
Eina_Stringshare *name;
|
||||||
|
Eina_Stringshare *type;
|
||||||
Eina_Stringshare *comment;
|
Eina_Stringshare *comment;
|
||||||
} _Event_Desc;
|
} _Event_Desc;
|
||||||
|
|
||||||
|
@ -983,12 +984,13 @@ eolian_function_object_is_const(Eolian_Function foo_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
Eolian_Event
|
Eolian_Event
|
||||||
database_event_new(const char *event_name, const char *event_comment)
|
database_event_new(const char *event_name, const char *event_type, const char *event_comment)
|
||||||
{
|
{
|
||||||
if (!event_name) return NULL;
|
if (!event_name) return NULL;
|
||||||
_Event_Desc *event_desc = calloc(1, sizeof(_Event_Desc));
|
_Event_Desc *event_desc = calloc(1, sizeof(_Event_Desc));
|
||||||
if (!event_desc) return NULL;
|
if (!event_desc) return NULL;
|
||||||
event_desc->name = eina_stringshare_add(event_name);
|
event_desc->name = eina_stringshare_add(event_name);
|
||||||
|
if (event_type) event_desc->type = eina_stringshare_add(event_type);
|
||||||
event_desc->comment = eina_stringshare_add(event_comment);
|
event_desc->comment = eina_stringshare_add(event_comment);
|
||||||
return (Eolian_Event) event_desc;
|
return (Eolian_Event) event_desc;
|
||||||
}
|
}
|
||||||
|
@ -1020,11 +1022,12 @@ eolian_class_events_list_get(const char *class_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eolian_class_event_information_get(Eolian_Event event, const char **event_name, const char **event_comment)
|
eolian_class_event_information_get(Eolian_Event event, const char **event_name, const char **event_type, const char **event_comment)
|
||||||
{
|
{
|
||||||
_Event_Desc *_event_desc = (_Event_Desc *) event;
|
_Event_Desc *_event_desc = (_Event_Desc *) event;
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(_event_desc, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(_event_desc, EINA_FALSE);
|
||||||
if (event_name) *event_name = _event_desc->name;
|
if (event_name) *event_name = _event_desc->name;
|
||||||
|
if (event_type) *event_type = _event_desc->type;
|
||||||
if (event_comment) *event_comment = _event_desc->comment;
|
if (event_comment) *event_comment = _event_desc->comment;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1112,10 +1115,10 @@ _implements_print(Eolian_Implement impl, int nb_spaces)
|
||||||
static void
|
static void
|
||||||
_event_print(Eolian_Event ev, int nb_spaces)
|
_event_print(Eolian_Event ev, int nb_spaces)
|
||||||
{
|
{
|
||||||
const char *name, *comment;
|
const char *name, *comment, *type;
|
||||||
|
|
||||||
eolian_class_event_information_get(ev, &name, &comment);
|
eolian_class_event_information_get(ev, &name, &type, &comment);
|
||||||
printf("%*s <%s> <%s>\n", nb_spaces + 5, "", name, comment);
|
printf("%*s <%s> <%s> <%s>\n", nb_spaces + 5, "", name, type, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool _function_print(const _Function_Id *fid, int nb_spaces)
|
static Eina_Bool _function_print(const _Function_Id *fid, int nb_spaces)
|
||||||
|
|
|
@ -133,7 +133,7 @@ Eina_Bool
|
||||||
database_class_dtor_enable_set(const char *class_name, Eina_Bool enable);
|
database_class_dtor_enable_set(const char *class_name, Eina_Bool enable);
|
||||||
|
|
||||||
Eolian_Event
|
Eolian_Event
|
||||||
database_event_new(const char *event_name, const char *event_desc);
|
database_event_new(const char *event_name, const char *event_type, const char *event_desc);
|
||||||
|
|
||||||
void
|
void
|
||||||
database_event_free(Eolian_Event event);
|
database_event_free(Eolian_Event event);
|
||||||
|
|
Loading…
Reference in New Issue