Commit 97d5f340 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

widl: Add support for varargs functions.

parent cdec0fe4
......@@ -42,6 +42,9 @@ static NDR_SCONTEXT (WINAPI *pNDRSContextUnmarshall2)(RPC_BINDING_HANDLE, void*,
static RPC_STATUS (WINAPI *pRpcServerRegisterIfEx)(RPC_IF_HANDLE,UUID*, RPC_MGR_EPV*, unsigned int,
unsigned int,RPC_IF_CALLBACK_FN*);
/* type check statements generated in header file */
fnprintf *p_printf = printf;
static void InitFunctionPointers(void)
{
HMODULE hrpcrt4 = GetModuleHandleA("rpcrt4.dll");
......
......@@ -27,6 +27,8 @@ typedef struct tag_vector
int z;
} vector_t;
typedef int fnprintf(const char *format, ...);
[
uuid(00000000-4114-0704-2301-000000000000),
#ifndef __midl
......
......@@ -348,11 +348,12 @@ void write_type_right(FILE *h, type_t *t, int is_field)
static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const char *name)
{
type_t *pt;
type_t *pt = NULL;
int ptr_level = 0;
if (!h) return;
if (t) {
for (pt = t; is_ptr(pt); pt = type_pointer_get_ref(pt), ptr_level++)
;
......@@ -369,9 +370,11 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
fputc('*', h);
} else
write_type_left(h, t, declonly);
}
if (name) fprintf(h, "%s%s", needs_space_after(t) ? " " : "", name );
if (name) fprintf(h, "%s%s", !t || needs_space_after(t) ? " " : "", name );
if (t) {
if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
const var_list_t *args = type_function_get_args(pt);
......@@ -384,6 +387,7 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
fputc(')', h);
} else
write_type_right(h, t, is_field);
}
}
void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name)
......
......@@ -193,6 +193,7 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY;
<INITIAL,ATTR>\<= return LESSEQUAL;
<INITIAL,ATTR>\|\| return LOGICALOR;
<INITIAL,ATTR>&& return LOGICALAND;
<INITIAL,ATTR>\.\.\. return ELLIPSIS;
<INITIAL,ATTR>. return yytext[0];
<<EOF>> {
if (import_stack_ptr)
......
......@@ -194,6 +194,7 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
%token EQUALITY INEQUALITY
%token GREATEREQUAL LESSEQUAL
%token LOGICALOR LOGICALAND
%token ELLIPSIS
%token tAGGREGATABLE tALLOCATE tANNOTATION tAPPOBJECT tASYNC tASYNCUUID
%token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT
%token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS
......@@ -292,7 +293,8 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
%type <ifref> coclass_int
%type <ifref_list> coclass_ints
%type <var> arg ne_union_field union_field s_field case enum declaration
%type <var_list> m_args args fields ne_union_fields cases enums enum_list dispint_props field
%type <var_list> m_args arg_list args
%type <var_list> fields ne_union_fields cases enums enum_list dispint_props field
%type <var> m_ident ident
%type <declarator> declarator direct_declarator init_declarator struct_declarator
%type <declarator> m_any_declarator any_declarator any_declarator_no_ident any_direct_declarator
......@@ -426,8 +428,12 @@ m_args: { $$ = NULL; }
| args
;
args: arg { check_arg_attrs($1); $$ = append_var( NULL, $1 ); }
| args ',' arg { check_arg_attrs($3); $$ = append_var( $1, $3); }
arg_list: arg { check_arg_attrs($1); $$ = append_var( NULL, $1 ); }
| arg_list ',' arg { check_arg_attrs($3); $$ = append_var( $1, $3 ); }
;
args: arg_list
| arg_list ',' ELLIPSIS { $$ = append_var( $1, make_var(strdup("...")) ); }
;
/* split into two rules to get bison to resolve a tVOID conflict */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment