Rémi Bernon : widl: Support WinRT contractversion attribute parsing.

Alexandre Julliard julliard at winehq.org
Tue Dec 1 15:40:36 CST 2020


Module: wine
Branch: master
Commit: 19b5f3e060808a5d356f2fc887e100da320fa73c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=19b5f3e060808a5d356f2fc887e100da320fa73c

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Dec  1 15:01:55 2020 +0100

widl: Support WinRT contractversion attribute parsing.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator
 %type <declarator_list> declarator_list struct_declarator_list
 %type <type> coclass coclasshdr coclassdef
+%type <num> contract_ver
 %type <num> pointer_type threading_type version
 %type <str> libraryhdr callconv cppquote importlib import t_ident
 %type <uuid> 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,




More information about the wine-cvs mailing list