forked from enlightenment/efl
eolian: update virtual to the new syntax (as per wiki)
This commit is contained in:
parent
19a6c265b6
commit
3e5da03f7d
|
@ -116,10 +116,10 @@ class Ecore_Audio (Eo.Base)
|
|||
}
|
||||
implements {
|
||||
Eo.Base.constructor;
|
||||
virtual.source.get;
|
||||
virtual.source.set;
|
||||
virtual.format.get;
|
||||
virtual.format.set;
|
||||
virtual.vio_set;
|
||||
@virtual .source.get;
|
||||
@virtual .source.set;
|
||||
@virtual .format.get;
|
||||
@virtual .format.set;
|
||||
@virtual .vio_set;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,10 +176,10 @@ class Ecore_Audio_In (Ecore_Audio)
|
|||
Eo.Base.constructor;
|
||||
Eo.Base.destructor;
|
||||
Ecore_Audio.vio_set;
|
||||
virtual.preloaded.get;
|
||||
virtual.preloaded.set;
|
||||
virtual.seek;
|
||||
virtual.length.set;
|
||||
@virtual .preloaded.get;
|
||||
@virtual .preloaded.set;
|
||||
@virtual .seek;
|
||||
@virtual .length.set;
|
||||
}
|
||||
events {
|
||||
in,looped; /*@ Called when an input has looped. */
|
||||
|
|
|
@ -157,16 +157,16 @@ abstract Ecore.Con.Base (Eo.Base) {
|
|||
}
|
||||
}
|
||||
implements {
|
||||
virtual.ip.get;
|
||||
virtual.uptime.get;
|
||||
virtual.port.set;
|
||||
virtual.port.get;
|
||||
virtual.fd.get;
|
||||
virtual.connected.get;
|
||||
virtual.timeout.set;
|
||||
virtual.timeout.get;
|
||||
virtual.flush;
|
||||
virtual.send;
|
||||
@virtual .ip.get;
|
||||
@virtual .uptime.get;
|
||||
@virtual .port.set;
|
||||
@virtual .port.get;
|
||||
@virtual .fd.get;
|
||||
@virtual .connected.get;
|
||||
@virtual .timeout.set;
|
||||
@virtual .timeout.get;
|
||||
@virtual .flush;
|
||||
@virtual .send;
|
||||
}
|
||||
events {
|
||||
data,received: Ecore_Con_Event_Data_Received;
|
||||
|
|
|
@ -230,57 +230,46 @@ _db_fill_implement(Eolian_Class *cl, Eolian_Implement *impl)
|
|||
{
|
||||
const char *impl_name = impl->full_name;
|
||||
|
||||
if (!strcmp(impl_name, "class.constructor"))
|
||||
if (impl->is_virtual)
|
||||
{
|
||||
Eolian_Function_Type ftype = EOLIAN_UNRESOLVED;
|
||||
|
||||
if (impl->is_prop_get)
|
||||
ftype = EOLIAN_PROP_GET;
|
||||
else if (impl->is_prop_set)
|
||||
ftype = EOLIAN_PROP_SET;
|
||||
printf("name: %s\n", impl_name);
|
||||
|
||||
Eolian_Function *foo_id = (Eolian_Function*)
|
||||
eolian_class_function_get_by_name(cl,
|
||||
impl_name,
|
||||
ftype);
|
||||
if (!foo_id)
|
||||
{
|
||||
ERR("Error - %s%s not known in class %s", impl_name,
|
||||
eolian_class_name_get(cl), (impl->is_prop_get ? ".get"
|
||||
: (impl->is_prop_set ? ".set" : "")));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (impl->is_prop_set)
|
||||
foo_id->set_virtual_pure = EINA_TRUE;
|
||||
else
|
||||
foo_id->get_virtual_pure = EINA_TRUE;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else if (impl->is_class_ctor)
|
||||
{
|
||||
cl->class_ctor_enable = EINA_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strcmp(impl_name, "class.destructor"))
|
||||
else if (impl->is_class_dtor)
|
||||
{
|
||||
cl->class_dtor_enable = EINA_TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!strncmp(impl_name, "virtual.", 8))
|
||||
{
|
||||
Eolian_Function_Type ftype = EOLIAN_UNRESOLVED;
|
||||
char *type_as_str = NULL;
|
||||
char *virtual_name = strdup(impl_name);
|
||||
char *func = strchr(virtual_name, '.');
|
||||
|
||||
if (func) *func = '\0';
|
||||
func += 1;
|
||||
|
||||
if ((type_as_str = strchr(func, '.')))
|
||||
{
|
||||
*type_as_str = '\0';
|
||||
|
||||
if (!strcmp(type_as_str+1, "set"))
|
||||
ftype = EOLIAN_PROP_SET;
|
||||
else if (!strcmp(type_as_str+1, "get"))
|
||||
ftype = EOLIAN_PROP_GET;
|
||||
}
|
||||
|
||||
Eolian_Function *foo_id = (Eolian_Function*)
|
||||
eolian_class_function_get_by_name(cl,
|
||||
func,
|
||||
ftype);
|
||||
|
||||
free(virtual_name);
|
||||
|
||||
if (!foo_id)
|
||||
{
|
||||
ERR("Error - %s not known in class %s", impl_name + 8,
|
||||
eolian_class_name_get(cl));
|
||||
return -1;
|
||||
}
|
||||
if (ftype == EOLIAN_PROP_SET)
|
||||
foo_id->set_virtual_pure = EINA_TRUE;
|
||||
else
|
||||
foo_id->get_virtual_pure = EINA_TRUE;
|
||||
return 1;
|
||||
}
|
||||
cl->implements = eina_list_append(cl->implements, impl);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -22,15 +22,15 @@ enum Tokens
|
|||
/* all keywords in eolian, they can still be used as names (they're TOK_VALUE)
|
||||
* they just fill in the "kw" field of the token */
|
||||
#define KEYWORDS KW(class), KW(const), KW(enum), KW(return), KW(struct), \
|
||||
KW(virtual), \
|
||||
\
|
||||
KW(abstract), KW(constructor), KW(data), KW(destructor), KW(eo), \
|
||||
KW(eo_prefix), KW(events), KW(free), KW(func), KW(get), KW(implements), \
|
||||
KW(interface), KW(keys), KW(legacy), KW(legacy_prefix), KW(methods), \
|
||||
KW(mixin), KW(own), KW(params), KW(properties), KW(set), KW(type), \
|
||||
KW(values), KW(var), KWAT(class), KWAT(const), KWAT(constructor), \
|
||||
KWAT(extern), KWAT(free), KWAT(in), KWAT(inout), KWAT(nonull), KWAT(out), \
|
||||
KWAT(private), KWAT(protected), KWAT(warn_unused), \
|
||||
KW(values), KW(var), KWAT(auto), KWAT(class), KWAT(const), \
|
||||
KWAT(constructor), KWAT(empty), KWAT(extern), KWAT(free), KWAT(in), \
|
||||
KWAT(inout), KWAT(nonull), KWAT(out), KWAT(private), KWAT(protected), \
|
||||
KWAT(virtual), KWAT(warn_unused), \
|
||||
\
|
||||
KW(byte), KW(ubyte), KW(char), KW(short), KW(ushort), KW(int), KW(uint), \
|
||||
KW(long), KW(ulong), KW(llong), KW(ullong), \
|
||||
|
|
|
@ -1481,7 +1481,6 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
|
|||
{
|
||||
Eina_Strbuf *buf = NULL;
|
||||
Eolian_Implement *impl = NULL;
|
||||
buf = push_strbuf(ls);
|
||||
impl = calloc(1, sizeof(Eolian_Implement));
|
||||
impl->base.file = eina_stringshare_ref(ls->filename);
|
||||
impl->base.line = ls->line_number;
|
||||
|
@ -1491,54 +1490,50 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
|
|||
check_kw(ls, KW_class);
|
||||
if (ls->t.kw == KW_class)
|
||||
{
|
||||
eina_strbuf_append(buf, "class.");
|
||||
eo_lexer_get(ls);
|
||||
check_next(ls, '.');
|
||||
if (ls->t.kw == KW_destructor)
|
||||
{
|
||||
eina_strbuf_append(buf, "destructor");
|
||||
impl->is_class_dtor = EINA_TRUE;
|
||||
eo_lexer_get(ls);
|
||||
}
|
||||
else
|
||||
{
|
||||
check_kw_next(ls, KW_constructor);
|
||||
eina_strbuf_append(buf, "constructor");
|
||||
impl->is_class_ctor = EINA_TRUE;
|
||||
}
|
||||
check_next(ls, ';');
|
||||
impl->full_name = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
pop_strbuf(ls);
|
||||
return;
|
||||
}
|
||||
else if (ls->t.kw == KW_virtual)
|
||||
else if (ls->t.kw == KW_at_virtual)
|
||||
{
|
||||
eina_strbuf_append(buf, "virtual.");
|
||||
impl->is_virtual = EINA_TRUE;
|
||||
eo_lexer_get(ls);
|
||||
check_next(ls, '.');
|
||||
if ((ls->t.token != TOK_VALUE) || (ls->t.kw == KW_get || ls->t.kw == KW_set))
|
||||
eo_lexer_syntax_error(ls, "name expected");
|
||||
eina_strbuf_append(buf, ls->t.value.s);
|
||||
impl->full_name = eina_stringshare_add(ls->t.value.s);
|
||||
eo_lexer_get(ls);
|
||||
if (ls->t.token == '.')
|
||||
{
|
||||
eo_lexer_get(ls);
|
||||
if (ls->t.kw == KW_set)
|
||||
{
|
||||
eina_strbuf_append(buf, ".set");
|
||||
impl->is_prop_set = EINA_TRUE;
|
||||
eo_lexer_get(ls);
|
||||
}
|
||||
else
|
||||
{
|
||||
check_kw_next(ls, KW_get);
|
||||
eina_strbuf_append(buf, ".get");
|
||||
impl->is_prop_get = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
check_next(ls, ';');
|
||||
impl->full_name = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
pop_strbuf(ls);
|
||||
return;
|
||||
}
|
||||
if ((ls->t.token != TOK_VALUE) || (ls->t.kw == KW_get || ls->t.kw == KW_set))
|
||||
eo_lexer_syntax_error(ls, "class name expected");
|
||||
buf = push_strbuf(ls);
|
||||
eina_strbuf_append(buf, ls->t.value.s);
|
||||
eo_lexer_get(ls);
|
||||
check_next(ls, '.');
|
||||
|
|
|
@ -159,6 +159,11 @@ struct _Eolian_Implement
|
|||
Eolian_Object base;
|
||||
const Eolian_Class *klass;
|
||||
Eina_Stringshare *full_name;
|
||||
Eina_Bool is_virtual :1;
|
||||
Eina_Bool is_prop_get :1;
|
||||
Eina_Bool is_prop_set :1;
|
||||
Eina_Bool is_class_ctor :1;
|
||||
Eina_Bool is_class_dtor :1;
|
||||
};
|
||||
|
||||
struct _Eolian_Event
|
||||
|
|
|
@ -65,8 +65,8 @@ class Evas_3D_Object (Eo.Base, Evas.Common_Interface)
|
|||
implements {
|
||||
Eo.Base.constructor;
|
||||
Evas.Common_Interface.evas.get;
|
||||
virtual.update_notify;
|
||||
virtual.change_notify;
|
||||
@virtual .update_notify;
|
||||
@virtual .change_notify;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,6 @@ class Base {
|
|||
}
|
||||
}
|
||||
implements {
|
||||
virtual.constructor;
|
||||
@virtual .constructor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,6 @@ class nmsp1.nmsp11.class2
|
|||
}
|
||||
}
|
||||
implements {
|
||||
virtual.a.set;
|
||||
@virtual .a.set;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class Object_Impl (Base) {
|
|||
class.destructor;
|
||||
Base.constructor;
|
||||
Base.destructor;
|
||||
virtual.pure_foo3;
|
||||
virtual.b.get;
|
||||
@virtual .pure_foo3;
|
||||
@virtual .b.get;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class Override (Base) {
|
|||
}
|
||||
implements {
|
||||
Base.constructor;
|
||||
virtual.a.set;
|
||||
virtual.foo;
|
||||
@virtual .a.set;
|
||||
@virtual .foo;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue