From: "Rémi Bernon" Subject: [PATCH 2/4] widl: Support WinRT contractversion attribute parsing. Message-Id: <20201123112457.282037-2-rbernon@codeweavers.com> Date: Mon, 23 Nov 2020 12:24:55 +0100 In-Reply-To: <20201123112457.282037-1-rbernon@codeweavers.com> References: <20201123112457.282037-1-rbernon@codeweavers.com> Signed-off-by: Rémi Bernon --- tools/widl/parser.l | 1 + tools/widl/parser.y | 12 +++++++++++- tools/widl/widltypes.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/widl/parser.l b/tools/widl/parser.l index d7d96702322..a4e1d0d2c47 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -338,6 +338,7 @@ static const struct keyword attr_keywords[] = {"context_handle", tCONTEXTHANDLE, 0}, {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE, 0}, {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE, 0}, + {"contractversion", tCONTRACTVERSION, 1}, {"control", tCONTROL, 0}, {"custom", tCUSTOM, 0}, {"decode", tDECODE, 0}, diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 1bbb2e78f7e..3c4c8041a1c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -177,7 +177,9 @@ static typelib_t *current_typelib; %token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT %token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS %token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE -%token tCONTEXTHANDLESERIALIZE tCONTROL tCPPQUOTE +%token tCONTEXTHANDLESERIALIZE +%token tCONTRACTVERSION +%token tCONTROL tCPPQUOTE %token tCUSTOM %token tDECODE tDEFAULT tDEFAULTBIND %token tDEFAULTCOLLELEM @@ -290,6 +292,7 @@ static typelib_t *current_typelib; %type m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator %type declarator_list struct_declarator_list %type coclass coclasshdr coclassdef +%type contract_ver %type pointer_type threading_type version %type libraryhdr callconv cppquote importlib import t_ident %type uuid_string @@ -492,6 +495,11 @@ str_list: aSTRING { $$ = append_str( NULL, $1 ); } | str_list ',' aSTRING { $$ = append_str( $1, $3 ); } ; +contract_ver: + aNUM { $$ = MAKEVERSION(0, $1); } + | aNUM '.' aNUM { $$ = MAKEVERSION($3, $1); } + ; + attribute: { $$ = NULL; } | tAGGREGATABLE { $$ = make_attr(ATTR_AGGREGATABLE); } | tANNOTATION '(' aSTRING ')' { $$ = make_attrp(ATTR_ANNOTATION, $3); } @@ -507,6 +515,7 @@ attribute: { $$ = NULL; } | tCONTEXTHANDLE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); } | tCONTEXTHANDLENOSERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ } | tCONTEXTHANDLESERIALIZE { $$ = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ } + | tCONTRACTVERSION '(' contract_ver ')' { $$ = make_attrv(ATTR_CONTRACTVERSION, $3); } | tCONTROL { $$ = make_attr(ATTR_CONTROL); } | tCUSTOM '(' uuid_string ',' expr_const ')' { $$ = make_custom_attr($3, $5); } | tDECODE { $$ = make_attr(ATTR_DECODE); } @@ -2155,6 +2164,7 @@ struct allowed_attr allowed_attr[] = /* ATTR_CODE */ { 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" }, /* 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_CONTRACTVERSION */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "contractversion" }, /* 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" }, diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 7a43e517698..78401cf8278 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -84,6 +84,7 @@ enum attr_type ATTR_CODE, ATTR_COMMSTATUS, ATTR_CONTEXTHANDLE, + ATTR_CONTRACTVERSION, ATTR_CONTROL, ATTR_CUSTOM, ATTR_DECODE, -- 2.29.2