widl: Add the [allocate] acf attribute.
Signed-off-by: Eric Kohl <eric.kohl@reactos.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8c51bcb8a1
commit
ba72ef6c22
|
@ -318,6 +318,7 @@ static const struct keyword keywords[] = {
|
|||
static const struct keyword attr_keywords[] =
|
||||
{
|
||||
{"aggregatable", tAGGREGATABLE},
|
||||
{"all_nodes", tALLNODES},
|
||||
{"allocate", tALLOCATE},
|
||||
{"annotation", tANNOTATION},
|
||||
{"apartment", tAPARTMENT},
|
||||
|
@ -345,6 +346,7 @@ static const struct keyword attr_keywords[] =
|
|||
{"disable_consistency_check", tDISABLECONSISTENCYCHECK},
|
||||
{"displaybind", tDISPLAYBIND},
|
||||
{"dllname", tDLLNAME},
|
||||
{"dont_free", tDONTFREE},
|
||||
{"dual", tDUAL},
|
||||
{"enable_allocate", tENABLEALLOCATE},
|
||||
{"encode", tENCODE},
|
||||
|
@ -406,6 +408,7 @@ static const struct keyword attr_keywords[] =
|
|||
{"restricted", tRESTRICTED},
|
||||
{"retval", tRETVAL},
|
||||
{"single", tSINGLE},
|
||||
{"single_node", tSINGLENODE},
|
||||
{"size_is", tSIZEIS},
|
||||
{"source", tSOURCE},
|
||||
{"strict_context_handle", tSTRICTCONTEXTHANDLE},
|
||||
|
|
|
@ -172,7 +172,7 @@ static typelib_t *current_typelib;
|
|||
%token GREATEREQUAL LESSEQUAL
|
||||
%token LOGICALOR LOGICALAND
|
||||
%token ELLIPSIS
|
||||
%token tAGGREGATABLE tALLOCATE tANNOTATION tAPPOBJECT tASYNC tASYNCUUID
|
||||
%token tAGGREGATABLE tALLNODES tALLOCATE tANNOTATION tAPPOBJECT tASYNC tASYNCUUID
|
||||
%token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT
|
||||
%token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS
|
||||
%token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE
|
||||
|
@ -183,7 +183,7 @@ static typelib_t *current_typelib;
|
|||
%token tDEFAULTVTABLE
|
||||
%token tDISABLECONSISTENCYCHECK tDISPLAYBIND
|
||||
%token tDISPINTERFACE
|
||||
%token tDLLNAME tDOUBLE tDUAL
|
||||
%token tDLLNAME tDONTFREE tDOUBLE tDUAL
|
||||
%token tENABLEALLOCATE tENCODE tENDPOINT
|
||||
%token tENTRY tENUM tERRORSTATUST
|
||||
%token tEXPLICITHANDLE tEXTERN
|
||||
|
@ -235,7 +235,7 @@ static typelib_t *current_typelib;
|
|||
%token tRETVAL
|
||||
%token tSAFEARRAY
|
||||
%token tSHORT
|
||||
%token tSIGNED
|
||||
%token tSIGNED tSINGLENODE
|
||||
%token tSIZEIS tSIZEOF
|
||||
%token tSMALL
|
||||
%token tSOURCE
|
||||
|
@ -296,6 +296,7 @@ static typelib_t *current_typelib;
|
|||
%type <statement> statement typedef pragma_warning
|
||||
%type <stmt_list> gbl_statements imp_statements int_statements
|
||||
%type <warning_list> warnings
|
||||
%type <num> allocate_option_list allocate_option
|
||||
|
||||
%left ','
|
||||
%right '?' ':'
|
||||
|
@ -1150,16 +1151,20 @@ version:
|
|||
acf_statements
|
||||
: /* empty */
|
||||
| acf_interface acf_statements
|
||||
;
|
||||
|
||||
acf_int_statements
|
||||
: /* empty */
|
||||
| acf_int_statement acf_int_statements
|
||||
;
|
||||
|
||||
acf_int_statement
|
||||
: tTYPEDEF acf_attributes aKNOWNTYPE ';'
|
||||
{ type_t *type = find_type_or_error($3, 0);
|
||||
type->attrs = append_attr_list(type->attrs, $2);
|
||||
}
|
||||
;
|
||||
|
||||
acf_interface
|
||||
: acf_attributes tINTERFACE aKNOWNTYPE '{' acf_int_statements '}'
|
||||
{ type_t *iface = find_type_or_error2($3, 0);
|
||||
|
@ -1167,19 +1172,38 @@ acf_interface
|
|||
error_loc("%s is not an interface\n", iface->name);
|
||||
iface->attrs = append_attr_list(iface->attrs, $1);
|
||||
}
|
||||
;
|
||||
|
||||
acf_attributes
|
||||
: /* empty */ { $$ = NULL; };
|
||||
| '[' acf_attribute_list ']' { $$ = $2; };
|
||||
;
|
||||
|
||||
acf_attribute_list
|
||||
: acf_attribute { $$ = append_attr(NULL, $1); }
|
||||
| acf_attribute_list ',' acf_attribute { $$ = append_attr($1, $3); }
|
||||
;
|
||||
|
||||
acf_attribute
|
||||
: tENCODE { $$ = make_attr(ATTR_ENCODE); }
|
||||
: tALLOCATE '(' allocate_option_list ')'
|
||||
{ $$ = make_attrv(ATTR_ALLOCATE, $3); }
|
||||
| tENCODE { $$ = make_attr(ATTR_ENCODE); }
|
||||
| tDECODE { $$ = make_attr(ATTR_DECODE); }
|
||||
| tEXPLICITHANDLE { $$ = make_attr(ATTR_EXPLICIT_HANDLE); }
|
||||
;
|
||||
|
||||
allocate_option_list
|
||||
: allocate_option { $$ = $1; }
|
||||
| allocate_option_list ',' allocate_option
|
||||
{ $$ = $1 | $3; }
|
||||
;
|
||||
|
||||
allocate_option
|
||||
: tDONTFREE { $$ = FC_DONT_FREE; }
|
||||
| tFREE { $$ = 0; }
|
||||
| tALLNODES { $$ = FC_ALLOCATE_ALL_NODES; }
|
||||
| tSINGLENODE { $$ = 0; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
|
@ -2122,6 +2146,7 @@ struct allowed_attr allowed_attr[] =
|
|||
{
|
||||
/* attr { D ACF I Fn ARG T En Enm St Un Fi L DI M C <display name> } */
|
||||
/* ATTR_AGGREGATABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "aggregatable" },
|
||||
/* ATTR_ALLOCATE */ { 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "allocate" },
|
||||
/* ATTR_ANNOTATION */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
|
||||
/* ATTR_APPOBJECT */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "appobject" },
|
||||
/* ATTR_ASYNC */ { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" },
|
||||
|
|
|
@ -2153,6 +2153,9 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs
|
|||
type_t *ref = type_pointer_get_ref_type(type);
|
||||
if(is_declptr(ref) && !is_user_type(ref))
|
||||
flags |= FC_POINTER_DEREF;
|
||||
if (pointer_type != FC_RP) {
|
||||
flags |= get_attrv(type->attrs, ATTR_ALLOCATE);
|
||||
}
|
||||
}
|
||||
|
||||
print_file(file, 2, "0x%x, 0x%x,\t\t/* %s",
|
||||
|
@ -2165,6 +2168,10 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs
|
|||
fprintf(file, " [allocated_on_stack]");
|
||||
if (flags & FC_POINTER_DEREF)
|
||||
fprintf(file, " [pointer_deref]");
|
||||
if (flags & FC_DONT_FREE)
|
||||
fprintf(file, " [dont_free]");
|
||||
if (flags & FC_ALLOCATE_ALL_NODES)
|
||||
fprintf(file, " [all_nodes]");
|
||||
fprintf(file, " */\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ typedef struct list warning_list_t;
|
|||
enum attr_type
|
||||
{
|
||||
ATTR_AGGREGATABLE,
|
||||
ATTR_ALLOCATE,
|
||||
ATTR_ANNOTATION,
|
||||
ATTR_APPOBJECT,
|
||||
ATTR_ASYNC,
|
||||
|
|
Loading…
Reference in New Issue