summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/eolian/eo_generator.c5
-rw-r--r--src/bindings/luajit/eolian.lua10
-rw-r--r--src/lib/eolian/Eolian.h10
-rw-r--r--src/lib/eolian/database_event_api.c7
-rw-r--r--src/lib/eolian/eo_lexer.h2
-rw-r--r--src/lib/eolian/eo_parser.c31
-rw-r--r--src/lib/eolian/eolian_database.h1
-rw-r--r--src/tests/eolian/data/events.eo1
-rw-r--r--src/tests/eolian/eolian_parsing.c9
9 files changed, 63 insertions, 13 deletions
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index b7612843af..25e8372227 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -621,8 +621,9 @@ eo_source_beginning_generate(const Eolian_Class *class, Eina_Strbuf *buf)
621 Eina_Stringshare *evname = eolian_event_c_name_get(event); 621 Eina_Stringshare *evname = eolian_event_c_name_get(event);
622 622
623 eina_strbuf_append_printf(tmpbuf, 623 eina_strbuf_append_printf(tmpbuf,
624 "EOAPI const Eo_Event_Description _%s =\n EO_EVENT_DESCRIPTION(\"%s\");\n", 624 "EOAPI const Eo_Event_Description _%s =\n EO_EVENT_DESCRIPTION%s(\"%s\");\n",
625 evname, eolian_event_name_get(event)); 625 evname, eolian_event_is_hot(event) ? "_HOT" : "",
626 eolian_event_name_get(event));
626 eina_stringshare_del(evname); 627 eina_stringshare_del(evname);
627 } 628 }
628 eina_iterator_free(itr); 629 eina_iterator_free(itr);
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 96be587a62..a517631648 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -252,6 +252,8 @@ ffi.cdef [[
252 const Eolian_Type *eolian_event_type_get(const Eolian_Event *event); 252 const Eolian_Type *eolian_event_type_get(const Eolian_Event *event);
253 const Eolian_Documentation *eolian_event_documentation_get(const Eolian_Event *event); 253 const Eolian_Documentation *eolian_event_documentation_get(const Eolian_Event *event);
254 Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event); 254 Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
255 Eina_Bool eolian_event_is_beta(const Eolian_Event *event);
256 Eina_Bool eolian_event_is_hot(const Eolian_Event *event);
255 const char *eolian_event_c_name_get(const Eolian_Event *event); 257 const char *eolian_event_c_name_get(const Eolian_Event *event);
256 Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass); 258 Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
257 Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass); 259 Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
@@ -858,6 +860,14 @@ ffi.metatype("Eolian_Event", {
858 local v = eolian.eolian_event_c_name_get(self) 860 local v = eolian.eolian_event_c_name_get(self)
859 if v == nil then return nil end 861 if v == nil then return nil end
860 return ffi_stringshare(v) 862 return ffi_stringshare(v)
863 end,
864
865 is_beta = function(self)
866 return eolian_event_is_beta(self) ~= 0
867 end,
868
869 is_hot = function(self)
870 return eolian_event_is_hot(self) ~= 0
861 end 871 end
862 } 872 }
863}) 873})
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 44b4e9abe1..a659e1f51e 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -1185,6 +1185,16 @@ EAPI Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
1185EAPI Eina_Bool eolian_event_is_beta(const Eolian_Event *event); 1185EAPI Eina_Bool eolian_event_is_beta(const Eolian_Event *event);
1186 1186
1187/* 1187/*
1188 * @brief Get whether an event is hot (unfreezable).
1189 *
1190 * @param[in] event the event handle
1191 * @return EINA_TRUE and EINA_FALSE respectively
1192 *
1193 * @ingroup Eolian
1194 */
1195EAPI Eina_Bool eolian_event_is_hot(const Eolian_Event *event);
1196
1197/*
1188 * @brief Returns the C name of an event 1198 * @brief Returns the C name of an event
1189 * 1199 *
1190 * @param[in] event the event handle 1200 * @param[in] event the event handle
diff --git a/src/lib/eolian/database_event_api.c b/src/lib/eolian/database_event_api.c
index 58e906e99e..3901cd1cad 100644
--- a/src/lib/eolian/database_event_api.c
+++ b/src/lib/eolian/database_event_api.c
@@ -40,6 +40,13 @@ eolian_event_is_beta(const Eolian_Event *event)
40 return event->is_beta; 40 return event->is_beta;
41} 41}
42 42
43EAPI Eina_Bool
44eolian_event_is_hot(const Eolian_Event *event)
45{
46 EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_FALSE);
47 return event->is_hot;
48}
49
43EAPI Eina_Stringshare * 50EAPI Eina_Stringshare *
44eolian_event_c_name_get(const Eolian_Event *event) 51eolian_event_c_name_get(const Eolian_Event *event)
45{ 52{
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h
index 9508765288..9908e265f2 100644
--- a/src/lib/eolian/eo_lexer.h
+++ b/src/lib/eolian/eo_lexer.h
@@ -30,7 +30,7 @@ enum Tokens
30 KW(legacy_prefix), KW(methods), KW(mixin), KW(own), KW(params), \ 30 KW(legacy_prefix), KW(methods), KW(mixin), KW(own), KW(params), \
31 KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \ 31 KW(set), KW(type), KW(values), KW(var), KWAT(auto), KWAT(beta), \
32 KWAT(c_only), KWAT(class), KWAT(const), KWAT(empty), KWAT(extern), \ 32 KWAT(c_only), KWAT(class), KWAT(const), KWAT(empty), KWAT(extern), \
33 KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \ 33 KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(nullable), \
34 KWAT(optional), KWAT(out), KWAT(private), KWAT(property), \ 34 KWAT(optional), KWAT(out), KWAT(private), KWAT(property), \
35 KWAT(protected), KWAT(virtual), KWAT(warn_unused), \ 35 KWAT(protected), KWAT(virtual), KWAT(warn_unused), \
36 \ 36 \
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 43fb30f04d..10fdfd83c5 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -1532,21 +1532,32 @@ parse_event(Eo_Lexer *ls)
1532 } 1532 }
1533 ev->name = eina_stringshare_add(eina_strbuf_string_get(buf)); 1533 ev->name = eina_stringshare_add(eina_strbuf_string_get(buf));
1534 pop_strbuf(ls); 1534 pop_strbuf(ls);
1535 if (ls->t.kw == KW_at_private) 1535 Eina_Bool has_scope = EINA_FALSE, has_beta = EINA_FALSE,
1536 { 1536 has_hot = EINA_FALSE;
1537 ev->scope = EOLIAN_SCOPE_PRIVATE; 1537 for (;;) switch (ls->t.kw)
1538 eo_lexer_get(ls);
1539 }
1540 else if (ls->t.kw == KW_at_protected)
1541 { 1538 {
1542 ev->scope = EOLIAN_SCOPE_PROTECTED; 1539 case KW_at_private:
1540 case KW_at_protected:
1541 CASE_LOCK(ls, scope, "scope qualifier")
1542 ev->scope = (ls->t.kw == KW_at_private)
1543 ? EOLIAN_SCOPE_PRIVATE
1544 : EOLIAN_SCOPE_PROTECTED;
1543 eo_lexer_get(ls); 1545 eo_lexer_get(ls);
1544 } 1546 break;
1545 if (ls->t.kw == KW_at_beta) 1547 case KW_at_beta:
1546 { 1548 CASE_LOCK(ls, beta, "beta qualifier")
1547 ev->is_beta = EINA_TRUE; 1549 ev->is_beta = EINA_TRUE;
1548 eo_lexer_get(ls); 1550 eo_lexer_get(ls);
1551 break;
1552 case KW_at_hot:
1553 CASE_LOCK(ls, hot, "hot qualifier");
1554 ev->is_hot = EINA_TRUE;
1555 eo_lexer_get(ls);
1556 break;
1557 default:
1558 goto end;
1549 } 1559 }
1560end:
1550 if (ls->t.token == ':') 1561 if (ls->t.token == ':')
1551 { 1562 {
1552 eo_lexer_get(ls); 1563 eo_lexer_get(ls);
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 73435a5fad..6a51c6273a 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -210,6 +210,7 @@ struct _Eolian_Event
210 Eolian_Class *klass; 210 Eolian_Class *klass;
211 int scope; 211 int scope;
212 Eina_Bool is_beta :1; 212 Eina_Bool is_beta :1;
213 Eina_Bool is_hot :1;
213}; 214};
214 215
215struct _Eolian_Struct_Type_Field 216struct _Eolian_Struct_Type_Field
diff --git a/src/tests/eolian/data/events.eo b/src/tests/eolian/data/events.eo
index e1f68d57f9..4b0e1f887c 100644
--- a/src/tests/eolian/data/events.eo
+++ b/src/tests/eolian/data/events.eo
@@ -2,5 +2,6 @@ class Events {
2 events { 2 events {
3 clicked @beta; [[Comment for clicked]] 3 clicked @beta; [[Comment for clicked]]
4 clicked,double: Evas_Event_Clicked_Double_Info; /* No comment */ 4 clicked,double: Evas_Event_Clicked_Double_Info; /* No comment */
5 hot @hot;
5 } 6 }
6} 7}
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index c104a619ef..5f66e2d678 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -118,6 +118,7 @@ START_TEST(eolian_events)
118 fail_if(eolian_event_type_get(ev)); 118 fail_if(eolian_event_type_get(ev));
119 fail_if(strcmp(name, "clicked")); 119 fail_if(strcmp(name, "clicked"));
120 fail_if(!eolian_event_is_beta(ev)); 120 fail_if(!eolian_event_is_beta(ev));
121 fail_if(eolian_event_is_hot(ev));
121 /* Clicked,double */ 122 /* Clicked,double */
122 fail_if(!(eina_iterator_next(iter, (void**)&ev))); 123 fail_if(!(eina_iterator_next(iter, (void**)&ev)));
123 fail_if(!(name = eolian_event_name_get(ev))); 124 fail_if(!(name = eolian_event_name_get(ev)));
@@ -126,6 +127,14 @@ START_TEST(eolian_events)
126 type_name = eolian_type_name_get(type); 127 type_name = eolian_type_name_get(type);
127 fail_if(strcmp(type_name, "Evas_Event_Clicked_Double_Info")); 128 fail_if(strcmp(type_name, "Evas_Event_Clicked_Double_Info"));
128 fail_if(eolian_event_is_beta(ev)); 129 fail_if(eolian_event_is_beta(ev));
130 fail_if(eolian_event_is_hot(ev));
131 /* Hot */
132 fail_if(!(eina_iterator_next(iter, (void**)&ev)));
133 fail_if(!(name = eolian_event_name_get(ev)));
134 fail_if(eolian_event_type_get(ev));
135 fail_if(strcmp(name, "hot"));
136 fail_if(eolian_event_is_beta(ev));
137 fail_if(!eolian_event_is_hot(ev));
129 fail_if(eina_iterator_next(iter, &dummy)); 138 fail_if(eina_iterator_next(iter, &dummy));
130 eina_iterator_free(iter); 139 eina_iterator_free(iter);
131 /* Check eolian_class_event_get_by_name */ 140 /* Check eolian_class_event_get_by_name */