forked from enlightenment/efl
eolian: support for void as separate type type
This commit is contained in:
parent
d5f4af5e61
commit
39aad55991
|
@ -116,6 +116,7 @@ typedef enum
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EOLIAN_TYPE_UNKNOWN_TYPE,
|
EOLIAN_TYPE_UNKNOWN_TYPE,
|
||||||
|
EOLIAN_TYPE_VOID,
|
||||||
EOLIAN_TYPE_REGULAR,
|
EOLIAN_TYPE_REGULAR,
|
||||||
EOLIAN_TYPE_POINTER,
|
EOLIAN_TYPE_POINTER,
|
||||||
EOLIAN_TYPE_FUNCTION
|
EOLIAN_TYPE_FUNCTION
|
||||||
|
|
|
@ -385,11 +385,11 @@ eo_lexer_lex_error(Eo_Lexer *ls, const char *msg, int token)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
txt_token(ls, token, buf);
|
txt_token(ls, token, buf);
|
||||||
throw(ls, "%s: %d: %s near '%s'\n", ls->source, ls->line_number, msg,
|
throw(ls, "%s:%d: %s near '%s'\n", ls->source, ls->line_number, msg,
|
||||||
buf);
|
buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw(ls, "%s: %d: %s\n", ls->source, ls->line_number, msg);
|
throw(ls, "%s:%d: %s\n", ls->source, ls->line_number, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -147,7 +147,20 @@ parse_name_list(Eo_Lexer *ls)
|
||||||
return ls->tmp.str_items;
|
return ls->tmp.str_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eo_Type_Def *parse_type(Eo_Lexer *ls);
|
static Eo_Type_Def *parse_type_void(Eo_Lexer *ls);
|
||||||
|
|
||||||
|
static Eo_Type_Def *
|
||||||
|
parse_type(Eo_Lexer *ls)
|
||||||
|
{
|
||||||
|
int line = ls->line_number;
|
||||||
|
Eo_Type_Def *ret = parse_type_void(ls);
|
||||||
|
if (ret->type == EOLIAN_TYPE_VOID)
|
||||||
|
{
|
||||||
|
ls->line_number = line;
|
||||||
|
eo_lexer_syntax_error(ls, "non-void type expected");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static Eo_Type_Def *
|
static Eo_Type_Def *
|
||||||
parse_function_type(Eo_Lexer *ls)
|
parse_function_type(Eo_Lexer *ls)
|
||||||
|
@ -159,7 +172,7 @@ parse_function_type(Eo_Lexer *ls)
|
||||||
if (ls->t.kw == KW_void)
|
if (ls->t.kw == KW_void)
|
||||||
eo_lexer_get(ls);
|
eo_lexer_get(ls);
|
||||||
else
|
else
|
||||||
def->ret_type = parse_type(ls);
|
def->ret_type = parse_type_void(ls);
|
||||||
line = ls->line_number;
|
line = ls->line_number;
|
||||||
check_next(ls, '(');
|
check_next(ls, '(');
|
||||||
if (ls->t.token != ')')
|
if (ls->t.token != ')')
|
||||||
|
@ -173,7 +186,7 @@ parse_function_type(Eo_Lexer *ls)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eo_Type_Def *
|
static Eo_Type_Def *
|
||||||
parse_type(Eo_Lexer *ls)
|
parse_type_void(Eo_Lexer *ls)
|
||||||
{
|
{
|
||||||
Eina_Bool has_struct = EINA_FALSE;
|
Eina_Bool has_struct = EINA_FALSE;
|
||||||
Eo_Type_Def *def;
|
Eo_Type_Def *def;
|
||||||
|
@ -186,7 +199,7 @@ parse_type(Eo_Lexer *ls)
|
||||||
eo_lexer_get(ls);
|
eo_lexer_get(ls);
|
||||||
line = ls->line_number;
|
line = ls->line_number;
|
||||||
check_next(ls, '(');
|
check_next(ls, '(');
|
||||||
def = parse_type(ls);
|
def = parse_type_void(ls);
|
||||||
def->is_const = EINA_TRUE;
|
def->is_const = EINA_TRUE;
|
||||||
check_match(ls, ')', '(', line);
|
check_match(ls, ')', '(', line);
|
||||||
goto parse_ptr;
|
goto parse_ptr;
|
||||||
|
@ -197,7 +210,7 @@ parse_type(Eo_Lexer *ls)
|
||||||
eo_lexer_get(ls);
|
eo_lexer_get(ls);
|
||||||
line = ls->line_number;
|
line = ls->line_number;
|
||||||
check_next(ls, '(');
|
check_next(ls, '(');
|
||||||
def = parse_type(ls);
|
def = parse_type_void(ls);
|
||||||
def->is_own = EINA_TRUE;
|
def->is_own = EINA_TRUE;
|
||||||
check_match(ls, ')', '(', line);
|
check_match(ls, ')', '(', line);
|
||||||
goto parse_ptr;
|
goto parse_ptr;
|
||||||
|
@ -213,12 +226,17 @@ parse_type(Eo_Lexer *ls)
|
||||||
}
|
}
|
||||||
def = calloc(1, sizeof(Eo_Type_Def));
|
def = calloc(1, sizeof(Eo_Type_Def));
|
||||||
ls->tmp.type_def = def;
|
ls->tmp.type_def = def;
|
||||||
def->type = EOLIAN_TYPE_REGULAR;
|
if (ls->t.kw == KW_void)
|
||||||
def->is_struct = has_struct;
|
def->type = EOLIAN_TYPE_VOID;
|
||||||
def->is_const = EINA_FALSE;
|
else
|
||||||
check(ls, TOK_VALUE);
|
{
|
||||||
ctype = eo_lexer_get_c_type(ls->t.kw);
|
def->type = EOLIAN_TYPE_REGULAR;
|
||||||
def->name = eina_stringshare_add(ctype ? ctype : ls->t.value);
|
def->is_struct = has_struct;
|
||||||
|
def->is_const = EINA_FALSE;
|
||||||
|
check(ls, TOK_VALUE);
|
||||||
|
ctype = eo_lexer_get_c_type(ls->t.kw);
|
||||||
|
def->name = eina_stringshare_add(ctype ? ctype : ls->t.value);
|
||||||
|
}
|
||||||
eo_lexer_get(ls);
|
eo_lexer_get(ls);
|
||||||
parse_ptr:
|
parse_ptr:
|
||||||
while (ls->t.token == '*')
|
while (ls->t.token == '*')
|
||||||
|
|
|
@ -1228,12 +1228,15 @@ _type_to_str(Eolian_Type tp, Eina_Strbuf *buf, const char *name)
|
||||||
_ftype_to_str(tp, buf, name);
|
_ftype_to_str(tp, buf, name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tpp->type == EOLIAN_TYPE_REGULAR && tpp->is_const)
|
if ((tpp->type == EOLIAN_TYPE_REGULAR || tpp->type == EOLIAN_TYPE_VOID)
|
||||||
|
&& tpp->is_const)
|
||||||
eina_strbuf_append(buf, "const ");
|
eina_strbuf_append(buf, "const ");
|
||||||
if (tpp->is_struct)
|
if (tpp->is_struct)
|
||||||
eina_strbuf_append(buf, "struct ");
|
eina_strbuf_append(buf, "struct ");
|
||||||
if (tpp->type == EOLIAN_TYPE_REGULAR)
|
if (tpp->type == EOLIAN_TYPE_REGULAR)
|
||||||
eina_strbuf_append(buf, tpp->name);
|
eina_strbuf_append(buf, tpp->name);
|
||||||
|
else if (tpp->type == EOLIAN_TYPE_VOID)
|
||||||
|
eina_strbuf_append(buf, "void");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_Parameter_Type *btpp = (_Parameter_Type*)tpp->base_type;
|
_Parameter_Type *btpp = (_Parameter_Type*)tpp->base_type;
|
||||||
|
|
|
@ -176,7 +176,6 @@ class Evas_3D_Mesh (Evas_3D_Object, Evas.Common_Interface)
|
||||||
|
|
||||||
@ingroup Evas_3D_Mesh
|
@ingroup Evas_3D_Mesh
|
||||||
*/
|
*/
|
||||||
return void ;
|
|
||||||
params {
|
params {
|
||||||
@in Evas_3D_Index_Format format; /*@ Vertex index data format. */
|
@in Evas_3D_Index_Format format; /*@ Vertex index data format. */
|
||||||
@in int count; /*@ Vertex index count. */
|
@in int count; /*@ Vertex index count. */
|
||||||
|
|
|
@ -60,7 +60,6 @@ class Evas_3D_Texture (Evas_3D_Object, Evas.Common_Interface)
|
||||||
@ingroup Evas_3D_Texture
|
@ingroup Evas_3D_Texture
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return void ;
|
|
||||||
params {
|
params {
|
||||||
@in const(char)* file; /*@ Path to the image file. */
|
@in const(char)* file; /*@ Path to the image file. */
|
||||||
@in const(char)* key; /*@ Key in the image file. */
|
@in const(char)* key; /*@ Key in the image file. */
|
||||||
|
@ -79,7 +78,6 @@ class Evas_3D_Texture (Evas_3D_Object, Evas.Common_Interface)
|
||||||
@ingroup Evas_3D_Texture
|
@ingroup Evas_3D_Texture
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return void ;
|
|
||||||
params {
|
params {
|
||||||
@in Evas_Object *source; /*@ Source evas object to be used as the texture data. */
|
@in Evas_Object *source; /*@ Source evas object to be used as the texture data. */
|
||||||
}
|
}
|
||||||
|
@ -147,7 +145,6 @@ class Evas_3D_Texture (Evas_3D_Object, Evas.Common_Interface)
|
||||||
@ingroup Evas_3D_Texture
|
@ingroup Evas_3D_Texture
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return void ;
|
|
||||||
params {
|
params {
|
||||||
@out Evas_3D_Wrap_Mode s; /*@ Pointer to receive S-axis wrap mode. */
|
@out Evas_3D_Wrap_Mode s; /*@ Pointer to receive S-axis wrap mode. */
|
||||||
@out Evas_3D_Wrap_Mode t; /*@ Pointer to receive T-axis wrap mode. */
|
@out Evas_3D_Wrap_Mode t; /*@ Pointer to receive T-axis wrap mode. */
|
||||||
|
|
Loading…
Reference in New Issue