widl: Parse attribute custom(guid,expr).

Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Kevin Puetz 2020-11-17 19:14:14 -06:00 committed by Alexandre Julliard
parent 216b9cb080
commit 7afd550f34
3 changed files with 23 additions and 1 deletions

View File

@ -339,6 +339,7 @@ static const struct keyword attr_keywords[] =
{"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE, 0}, {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE, 0},
{"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE, 0}, {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE, 0},
{"control", tCONTROL, 0}, {"control", tCONTROL, 0},
{"custom", tCUSTOM, 0},
{"decode", tDECODE, 0}, {"decode", tDECODE, 0},
{"defaultbind", tDEFAULTBIND, 0}, {"defaultbind", tDEFAULTBIND, 0},
{"defaultcollelem", tDEFAULTCOLLELEM, 0}, {"defaultcollelem", tDEFAULTCOLLELEM, 0},
@ -431,7 +432,6 @@ static const struct keyword attr_keywords[] =
}; };
/* attributes TODO: /* attributes TODO:
custom
first_is first_is
last_is last_is
max_is max_is

View File

@ -58,6 +58,7 @@ static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t
static attr_t *make_attr(enum attr_type type); static attr_t *make_attr(enum attr_type type);
static attr_t *make_attrv(enum attr_type type, unsigned int val); static attr_t *make_attrv(enum attr_type type, unsigned int val);
static attr_t *make_attrp(enum attr_type type, void *val); static attr_t *make_attrp(enum attr_type type, void *val);
static attr_t *make_custom_attr(UUID *id, expr_t *pval);
static expr_list_t *append_expr(expr_list_t *list, expr_t *expr); static expr_list_t *append_expr(expr_list_t *list, expr_t *expr);
static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_t *decl, int top); static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_t *decl, int top);
static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls); static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls);
@ -177,6 +178,7 @@ static typelib_t *current_typelib;
%token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS %token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS
%token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE %token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE
%token tCONTEXTHANDLESERIALIZE tCONTROL tCPPQUOTE %token tCONTEXTHANDLESERIALIZE tCONTROL tCPPQUOTE
%token tCUSTOM
%token tDECODE tDEFAULT tDEFAULTBIND %token tDECODE tDEFAULT tDEFAULTBIND
%token tDEFAULTCOLLELEM %token tDEFAULTCOLLELEM
%token tDEFAULTVALUE %token tDEFAULTVALUE
@ -506,6 +508,7 @@ attribute: { $$ = NULL; }
| tCONTEXTHANDLENOSERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ } | tCONTEXTHANDLENOSERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ }
| tCONTEXTHANDLESERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ } | tCONTEXTHANDLESERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ }
| tCONTROL { $$ = make_attr(ATTR_CONTROL); } | tCONTROL { $$ = make_attr(ATTR_CONTROL); }
| tCUSTOM '(' uuid_string ',' expr_const ')' { $$ = make_custom_attr($3, $5); }
| tDECODE { $$ = make_attr(ATTR_DECODE); } | tDECODE { $$ = make_attr(ATTR_DECODE); }
| tDEFAULT { $$ = make_attr(ATTR_DEFAULT); } | tDEFAULT { $$ = make_attr(ATTR_DEFAULT); }
| tDEFAULTBIND { $$ = make_attr(ATTR_DEFAULTBIND); } | tDEFAULTBIND { $$ = make_attr(ATTR_DEFAULTBIND); }
@ -1366,6 +1369,17 @@ static attr_t *make_attrp(enum attr_type type, void *val)
return a; return a;
} }
static attr_t *make_custom_attr(UUID *id, expr_t *pval)
{
attr_t *a = xmalloc(sizeof(attr_t));
attr_custdata_t *cstdata = xmalloc(sizeof(attr_custdata_t));
a->type = ATTR_CUSTOM;
cstdata->id = *id;
cstdata->pval = pval;
a->u.pval = cstdata;
return a;
}
static expr_list_t *append_expr(expr_list_t *list, expr_t *expr) static expr_list_t *append_expr(expr_list_t *list, expr_t *expr)
{ {
if (!expr) return list; if (!expr) return list;
@ -2142,6 +2156,7 @@ struct allowed_attr allowed_attr[] =
/* ATTR_COMMSTATUS */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" }, /* ATTR_COMMSTATUS */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" },
/* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" }, /* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" },
/* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" }, /* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" },
/* ATTR_CUSTOM */ { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, "custom" },
/* ATTR_DECODE */ { 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "decode" }, /* ATTR_DECODE */ { 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "decode" },
/* ATTR_DEFAULT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, "default" }, /* ATTR_DEFAULT */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, "default" },
/* ATTR_DEFAULTBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultbind" }, /* ATTR_DEFAULTBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultbind" },

View File

@ -37,6 +37,7 @@ typedef GUID UUID;
typedef struct _loc_info_t loc_info_t; typedef struct _loc_info_t loc_info_t;
typedef struct _attr_t attr_t; typedef struct _attr_t attr_t;
typedef struct _attr_custdata_t attr_custdata_t;
typedef struct _expr_t expr_t; typedef struct _expr_t expr_t;
typedef struct _type_t type_t; typedef struct _type_t type_t;
typedef struct _var_t var_t; typedef struct _var_t var_t;
@ -84,6 +85,7 @@ enum attr_type
ATTR_COMMSTATUS, ATTR_COMMSTATUS,
ATTR_CONTEXTHANDLE, ATTR_CONTEXTHANDLE,
ATTR_CONTROL, ATTR_CONTROL,
ATTR_CUSTOM,
ATTR_DECODE, ATTR_DECODE,
ATTR_DEFAULT, ATTR_DEFAULT,
ATTR_DEFAULTBIND, ATTR_DEFAULTBIND,
@ -338,6 +340,11 @@ struct _expr_t {
struct list entry; struct list entry;
}; };
struct _attr_custdata_t {
GUID id;
expr_t *pval;
};
struct struct_details struct struct_details
{ {
var_list_t *fields; var_list_t *fields;