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

Alexandre Julliard julliard at winehq.org
Mon Jan 25 16:42:06 CST 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Jan 25 12:35:29 2021 +0100

widl: Support WinRT marshaling_behavior attribute parsing.

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

---

 tools/widl/parser.l    |  4 ++++
 tools/widl/parser.y    | 18 ++++++++++++++++--
 tools/widl/widltypes.h |  9 +++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 9dce03577c6..01c6f800a08 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -320,6 +320,7 @@ static const struct keyword keywords[] = {
 static const struct keyword attr_keywords[] =
 {
 	{"aggregatable",                tAGGREGATABLE,              0},
+	{"agile",                       tAGILE,                     1},
 	{"all_nodes",                   tALLNODES,                  0},
 	{"allocate",                    tALLOCATE,                  0},
 	{"annotation",                  tANNOTATION,                0},
@@ -381,12 +382,14 @@ static const struct keyword attr_keywords[] =
 	{"length_is",                   tLENGTHIS,                  0},
 	{"licensed",                    tLICENSED,                  0},
 	{"local",                       tLOCAL,                     0},
+	{"marshaling_behavior",         tMARSHALINGBEHAVIOR,        1},
 	{"maybe",                       tMAYBE,                     0},
 	{"message",                     tMESSAGE,                   0},
 	{"neutral",                     tNEUTRAL,                   0},
 	{"nocode",                      tNOCODE,                    0},
 	{"nonbrowsable",                tNONBROWSABLE,              0},
 	{"noncreatable",                tNONCREATABLE,              0},
+	{"none",                        tNONE,                      1},
 	{"nonextensible",               tNONEXTENSIBLE,             0},
 	{"notify",                      tNOTIFY,                    0},
 	{"notify_flag",                 tNOTIFYFLAG,                0},
@@ -416,6 +419,7 @@ static const struct keyword attr_keywords[] =
 	{"single_node",                 tSINGLENODE,                0},
 	{"size_is",                     tSIZEIS,                    0},
 	{"source",                      tSOURCE,                    0},
+	{"standard",                    tSTANDARD,                  1},
 	{"strict_context_handle",       tSTRICTCONTEXTHANDLE,       0},
 	{"string",                      tSTRING,                    0},
 	{"switch_is",                   tSWITCHIS,                  0},
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index b729d772fcd..48f180cdb49 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -174,7 +174,9 @@ static typelib_t *current_typelib;
 %token GREATEREQUAL LESSEQUAL
 %token LOGICALOR LOGICALAND
 %token ELLIPSIS
-%token tAGGREGATABLE tALLNODES tALLOCATE tANNOTATION
+%token tAGGREGATABLE
+%token tAGILE
+%token tALLNODES tALLOCATE tANNOTATION
 %token tAPICONTRACT
 %token tAPPOBJECT tASYNC tASYNCUUID
 %token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT
@@ -216,12 +218,14 @@ static typelib_t *current_typelib;
 %token tLENGTHIS tLIBRARY
 %token tLICENSED tLOCAL
 %token tLONG
+%token tMARSHALINGBEHAVIOR
 %token tMAYBE tMESSAGE
 %token tMETHODS
 %token tMODULE
 %token tNAMESPACE
 %token tNOCODE tNONBROWSABLE
 %token tNONCREATABLE
+%token tNONE
 %token tNONEXTENSIBLE
 %token tNOTIFY tNOTIFYFLAG
 %token tNULL
@@ -247,6 +251,7 @@ static typelib_t *current_typelib;
 %token tSIZEIS tSIZEOF
 %token tSMALL
 %token tSOURCE
+%token tSTANDARD
 %token tSTATIC
 %token tSTDCALL
 %token tSTRICTCONTEXTHANDLE
@@ -299,7 +304,7 @@ static typelib_t *current_typelib;
 %type <type> coclass coclasshdr coclassdef
 %type <type> apicontract
 %type <num> contract_ver
-%type <num> pointer_type threading_type version
+%type <num> pointer_type threading_type marshaling_behavior version
 %type <str> libraryhdr callconv cppquote importlib import t_ident
 %type <uuid> uuid_string
 %type <import> import_start
@@ -505,6 +510,12 @@ str_list: aSTRING                               { $$ = append_str( NULL, $1 ); }
 	| str_list ',' aSTRING                  { $$ = append_str( $1, $3 ); }
 	;
 
+marshaling_behavior:
+	  tAGILE				{ $$ = MARSHALING_AGILE; }
+	| tNONE					{ $$ = MARSHALING_NONE; }
+	| tSTANDARD				{ $$ = MARSHALING_STANDARD; }
+	;
+
 contract_ver:
 	  aNUM					{ $$ = MAKEVERSION(0, $1); }
 	| aNUM '.' aNUM				{ $$ = MAKEVERSION($3, $1); }
@@ -572,6 +583,8 @@ attribute:					{ $$ = NULL; }
 	| tLCID					{ $$ = make_attr(ATTR_PARAMLCID); }
 	| tLICENSED				{ $$ = make_attr(ATTR_LICENSED); }
 	| tLOCAL				{ $$ = make_attr(ATTR_LOCAL); }
+	| tMARSHALINGBEHAVIOR '(' marshaling_behavior ')'
+						{ $$ = make_attrv(ATTR_MARSHALING_BEHAVIOR, $3); }
 	| tMAYBE				{ $$ = make_attr(ATTR_MAYBE); }
 	| tMESSAGE				{ $$ = make_attr(ATTR_MESSAGE); }
 	| tNOCODE				{ $$ = make_attr(ATTR_NOCODE); }
@@ -2230,6 +2243,7 @@ struct allowed_attr allowed_attr[] =
     /* ATTR_LIBLCID */             { 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "lcid" },
     /* ATTR_LICENSED */            { 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, "licensed" },
     /* ATTR_LOCAL */               { 1, 0, 0,  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "local" },
+    /* ATTR_MARSHALING_BEHAVIOR */ { 0, 0, 0,  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "marshaling_behavior" },
     /* ATTR_MAYBE */               { 0, 0, 0,  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "maybe" },
     /* ATTR_MESSAGE */             { 0, 0, 0,  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "message" },
     /* ATTR_NOCODE */              { 0, 1, 0,  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "nocode" },
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index d5862426ad4..6c130d4701e 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -125,6 +125,7 @@ enum attr_type
     ATTR_LIBLCID,
     ATTR_LICENSED,
     ATTR_LOCAL,
+    ATTR_MARSHALING_BEHAVIOR,
     ATTR_MAYBE,
     ATTR_MESSAGE,
     ATTR_NOCODE,
@@ -271,6 +272,14 @@ enum threading_type
     THREADING_BOTH
 };
 
+enum marshaling_type
+{
+    MARSHALING_INVALID = 0,
+    MARSHALING_NONE,
+    MARSHALING_AGILE,
+    MARSHALING_STANDARD,
+};
+
 enum type_basic_type
 {
     TYPE_BASIC_INT8 = 1,




More information about the wine-cvs mailing list